X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=plugins%2Fradio%2Fradio-api.c;h=c6e4b905a226eb3936a761b57f43ece2517596e7;hb=04331cc45e03325c6470bc5285d5c09843b24afd;hp=d6855feac679d6f534a824e153dc25672371019e;hpb=a10fa6960df758dcfcb406dcee6383be5d494187;p=src%2Fapp-framework-binder.git diff --git a/plugins/radio/radio-api.c b/plugins/radio/radio-api.c index d6855fea..c6e4b905 100644 --- a/plugins/radio/radio-api.c +++ b/plugins/radio/radio-api.c @@ -17,7 +17,6 @@ */ #include "radio-api.h" -#include "radio-rtlsdr.h" /* ******************************************************** @@ -27,6 +26,8 @@ /* ------ LOCAL HELPER FUNCTIONS --------- */ +static pluginHandleT *the_radio = NULL; + /* detect new radio devices */ STATIC void updateRadioDevList(pluginHandleT *handle) { @@ -117,9 +118,9 @@ STATIC AFB_error releaseRadio (pluginHandleT *handle, radioCtxHandleT *ctx) { } /* called when client session dies [e.g. client quits for more than 15mns] */ -STATIC void freeRadio (void *context, void *handle) { +STATIC void freeRadio (void *context) { - releaseRadio (handle, context); + releaseRadio (the_radio, context); free (context); } @@ -141,7 +142,7 @@ STATIC json_object* init (AFB_request *request) { /* AFB_SESSION_CHECK */ STATIC json_object* power (AFB_request *request) { /* AFB_SESSION_CHECK */ - pluginHandleT *handle = (pluginHandleT*)request->handle; + pluginHandleT *handle = the_radio; radioCtxHandleT *ctx = (radioCtxHandleT*)request->context; const char *value = getQueryValue (request, "value"); json_object *jresp; @@ -177,6 +178,8 @@ STATIC json_object* power (AFB_request *request) { /* AFB_SESSION_CHECK */ jresp = json_object_new_object(); json_object_object_add (jresp, "power", json_object_new_string ("off")); } + else + jresp = NULL; return jresp; } @@ -324,8 +327,8 @@ PUBLIC AFB_plugin* pluginRegister () { plugin->prefix = "radio"; plugin->apis = pluginApis; - plugin->handle = initRadioPlugin(); plugin->freeCtxCB = (AFB_freeCtxCB)freeRadio; - return (plugin); + the_radio = initRadioPlugin(); + return plugin; };