X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=plugins%2Fradio%2Fradio-api.c;h=bdb1768fc50610ca50687f3ad13d02af2903f4f1;hb=520bbafb30ce49b94b7825ff553d8cb5bda6d612;hp=ea17eb511827eb20ae63edd34e41f5e34525801e;hpb=1309721790b7b2aeb29658b8907c99fcaabf85a5;p=src%2Fapp-framework-binder.git diff --git a/plugins/radio/radio-api.c b/plugins/radio/radio-api.c index ea17eb51..bdb1768f 100644 --- a/plugins/radio/radio-api.c +++ b/plugins/radio/radio-api.c @@ -26,6 +26,8 @@ /* ------ LOCAL HELPER FUNCTIONS --------- */ +static pluginHandleT *the_radio = NULL; + /* detect new radio devices */ STATIC void updateRadioDevList(pluginHandleT *handle) { @@ -116,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); } @@ -140,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; @@ -325,8 +327,8 @@ PUBLIC AFB_plugin* pluginRegister () { plugin->prefix = "radio"; plugin->apis = pluginApis; - plugin->handle = initRadioPlugin(); plugin->freeCtxCB = (AFB_freeCtxCB)freeRadio; - return (plugin); + radio = initRadioPlugin(); + return plugin; };