diff options
author | Manuel Bachmann <manuel.bachmann@iot.bzh> | 2015-12-18 20:00:27 +0100 |
---|---|---|
committer | Manuel Bachmann <manuel.bachmann@iot.bzh> | 2015-12-18 20:05:57 +0100 |
commit | 61354a55ac2abd9e83e1f869cdb735654d6eb74a (patch) | |
tree | b90c2a2d408b89c7e2cbc159a500d521bcba920c /plugins/audio | |
parent | 3bce4a6a8648c91b6ddea478116b3b0679ef4648 (diff) |
Fix bugs in Radio sequence, parameters, add ping/refresh
Fixed the following :
- in some cases, powering off a playing radio would block ;
- Radio API "mode" should be "AM/FM", not "true/false".
Radio and Audio APIs now have dedicated functions to ping
status and refresh a session token.
Signed-off-by: Manuel Bachmann <manuel.bachmann@iot.bzh>
Diffstat (limited to 'plugins/audio')
-rw-r--r-- | plugins/audio/audio-api.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/plugins/audio/audio-api.c b/plugins/audio/audio-api.c index f7897682..74a1be95 100644 --- a/plugins/audio/audio-api.c +++ b/plugins/audio/audio-api.c @@ -168,8 +168,14 @@ STATIC json_object* mute (AFB_request *request) { /* AFB_SESSION_CHECK */ return jresp; } -STATIC json_object* status (AFB_request *request) { /* AFB_SESSION_RENEW */ - return NULL; +STATIC json_object* refresh (AFB_request *request) { /* AFB_SESSION_RENEW */ + json_object *jresp = json_object_new_object(); + json_object_object_add(jresp, "token", json_object_new_string (request->client->token)); + return jresp; +} + +STATIC json_object* ping (AFB_request *request) { /* AFB_SESSION_NONE */ + return jsonNewMessage(AFB_SUCCESS, "Ping Binder Daemon - Radio API"); } @@ -178,7 +184,8 @@ STATIC AFB_restapi pluginApis[]= { {"volume" , AFB_SESSION_CHECK, (AFB_apiCB)volume , "Audio API - volume"}, {"channels", AFB_SESSION_CHECK, (AFB_apiCB)channels , "Audio API - channels"}, {"mute" , AFB_SESSION_CHECK, (AFB_apiCB)mute , "Audio API - mute"}, - {"status" , AFB_SESSION_RENEW, (AFB_apiCB)status , "Audio API - status"}, + {"refresh", AFB_SESSION_RENEW, (AFB_apiCB)refresh , "Audio API - refresh"}, + {"ping" , AFB_SESSION_NONE, (AFB_apiCB)ping , "Audio API - ping"}, {NULL} }; |