X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=plugins%2Fradio%2Fradio-api.c;h=cfa25995d3d751ed76181786f286fb220152903b;hb=e853da4bd1cb44b6a992aff96a4066ae5bd54720;hp=3048f7b3a7042539e17941de99cee4220dcbf1fd;hpb=61354a55ac2abd9e83e1f869cdb735654d6eb74a;p=src%2Fapp-framework-binder.git diff --git a/plugins/radio/radio-api.c b/plugins/radio/radio-api.c index 3048f7b3..cfa25995 100644 --- a/plugins/radio/radio-api.c +++ b/plugins/radio/radio-api.c @@ -219,6 +219,7 @@ STATIC json_object* freq (AFB_request *request) { /* AFB_SESSION_CHECK */ radioCtxHandleT *ctx = (radioCtxHandleT*)request->client->ctx; const char *value = getQueryValue (request, "value"); json_object *jresp = json_object_new_object(); + double freq; char freq_str[256]; /* no "?value=" parameter : return current state */ @@ -229,8 +230,9 @@ STATIC json_object* freq (AFB_request *request) { /* AFB_SESSION_CHECK */ /* "?value=" parameter, set frequency */ else { - ctx->freq = strtof (value, NULL); - _radio_set_freq (ctx->idx, ctx->freq); + freq = strtod (value, NULL); + _radio_set_freq (ctx->idx, freq); + ctx->freq = (float)freq; snprintf (freq_str, sizeof(freq_str), "%f", ctx->freq); json_object_object_add (jresp, "freq", json_object_new_string (freq_str)); @@ -325,7 +327,7 @@ STATIC AFB_restapi pluginApis[]= { {NULL} }; -PUBLIC AFB_plugin* radioRegister () { +PUBLIC AFB_plugin* pluginRegister () { AFB_plugin *plugin = malloc (sizeof(AFB_plugin)); plugin->type = AFB_PLUGIN_JSON; plugin->info = "Application Framework Binder - Radio plugin";