X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Falsa-api.c;h=46b971b33373a5c1aad8abc16dd32e65caac6a18;hb=1250a56369315c017abfe429c556b863730b9b44;hp=dca372ab705b48b2c14b09a533f2ce3f21fa055d;hpb=cd054544444e92e7695dd288f0c04b7af0f668e3;p=src%2Fapp-framework-binder.git diff --git a/src/alsa-api.c b/src/alsa-api.c index dca372ab..46b971b3 100644 --- a/src/alsa-api.c +++ b/src/alsa-api.c @@ -19,33 +19,51 @@ #include "local-def.h" -STATIC json_object* pingAfbs (AFB_plugin *plugin, AFB_session *session, struct MHD_Connection *connection, AFB_request *request) { - static pingcount=0; +STATIC json_object* wrongApi (AFB_request *request, void* handle) { + int zero=0; + int bug=1234; + int impossible; + + impossible=bug/zero; +} + +STATIC json_object* pingSample (AFB_request *request) { + static pingcount = 0; json_object *response; - response = jsonNewMessage(AFB_SUCCESS, "Ping Application Framework %d", pingcount++); - if (verbose) fprintf(stderr, "%d: \n", pingcount); + char query [512]; + + // request all query key/value + getQueryAll (request,query, sizeof(query)); + + // check if we have some post data + if (request->post == NULL) request->post="NoData"; + + // return response to caller + response = jsonNewMessage(AFB_SUCCESS, "Ping Binder Daemon %d query={%s} handle=[%s] PostData: \'%s\' " + , pingcount++, query, request->post); + return (response); -}; +} + + +STATIC struct { + void * somedata; +} handle; STATIC AFB_restapi pluginApis[]= { - {"/ping" , (AFB_apiCB)pingSample ,"Ping Service"}, - {"/get-all" , (AFB_apiCB)pingAfbs ,"Ping Application Framework"}, - {"/get-one" , (AFB_apiCB)pingSample ,"Verbose Mode"}, - {"/start-one", (AFB_apiCB)pingSample ,"Verbose Mode"}, - {"/stop-one" , (AFB_apiCB)pingSample ,"Verbose Mode"}, - {"/probe-one", (AFB_apiCB)pingSample ,"Verbose Mode"}, - {"/ctx-store", (AFB_apiCB)pingSample ,"Verbose Mode"}, - {"/ctx-load" , (AFB_apiCB)pingSample ,"Verbose Mode"}, - {0,0,0} + {"ping" , (AFB_apiCB)pingSample , "Ping Application Framework"}, + {"error" , (AFB_apiCB)wrongApi , "Ping Application Framework"}, + {"ctx-store", (AFB_apiCB)pingSample , "Verbose Mode"}, + {"ctx-load" , (AFB_apiCB)pingSample , "Verbose Mode"}, + {NULL} }; -PUBLIC AFB_plugin *alsaRegister (AFB_session *session) { +PUBLIC AFB_plugin *alsaRegister () { AFB_plugin *plugin = malloc (sizeof (AFB_plugin)); - + plugin->type = AFB_PLUGIN_JSON; plugin->info = "Application Framework Binder Service"; - plugin->prefix = "alsa"; + plugin->prefix= "alsa"; plugin->apis = pluginApis; - return (plugin); }; \ No newline at end of file