X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Falsa-api.c;h=01341ce03d5e1a6b46380b964e98f3d42063280d;hb=8e61a22b3d7219c59f3925ac8e173b9b74fbcf30;hp=dca372ab705b48b2c14b09a533f2ce3f21fa055d;hpb=cd054544444e92e7695dd288f0c04b7af0f668e3;p=src%2Fapp-framework-binder.git diff --git a/src/alsa-api.c b/src/alsa-api.c index dca372ab..01341ce0 100644 --- a/src/alsa-api.c +++ b/src/alsa-api.c @@ -19,30 +19,49 @@ #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_session *session, AFB_request *request, void* handle) { + int zero=0; + int bug=1234; + int impossible; + + impossible=bug/zero; +} + +STATIC json_object* pingSample (AFB_session *session, AFB_request *request, void* handle) { + static pingcount = 0; json_object *response; - response = jsonNewMessage(AFB_SUCCESS, "Ping Application Framework %d", 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} PostData: \'%s\' ", pingcount++, query, request->post); + if (verbose) fprintf(stderr, "%d: \n", pingcount); 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"}, + {"ping" , (AFB_apiCB)pingSample , "Ping Application Framework", NULL}, + {"error" , (AFB_apiCB)wrongApi , "Ping Application Framework", NULL}, + {"ctx-store", (AFB_apiCB)pingSample , "Verbose Mode", NULL}, + {"ctx-load" , (AFB_apiCB)pingSample , "Verbose Mode", NULL}, {0,0,0} }; PUBLIC AFB_plugin *alsaRegister (AFB_session *session) { AFB_plugin *plugin = malloc (sizeof (AFB_plugin)); - + plugin->type = AFB_PLUGIN; plugin->info = "Application Framework Binder Service"; plugin->prefix = "alsa"; plugin->apis = pluginApis;