diff options
Diffstat (limited to 'src/alsa-api.c')
-rw-r--r-- | src/alsa-api.c | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/src/alsa-api.c b/src/alsa-api.c index ab7dced3..01341ce0 100644 --- a/src/alsa-api.c +++ b/src/alsa-api.c @@ -19,24 +19,43 @@ #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} }; |