summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-03-23 16:05:22 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2016-03-23 16:05:22 +0100
commit9c9253cd9106e656195aba6f0cadb29f6a940fe1 (patch)
tree92ae38b851e4b63a64c3bb2b6ed4ad03c5138c92 /plugins
parentbcc7f5e4fc170c7feaad561d13e3fb6b4e6dd798 (diff)
several improvements
Change-Id: Id21bd735b7e1e24993ae93bc9f3634c0298d6f12 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/samples/SamplePost.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/plugins/samples/SamplePost.c b/plugins/samples/SamplePost.c
index 88949736..22acd095 100644
--- a/plugins/samples/SamplePost.c
+++ b/plugins/samples/SamplePost.c
@@ -19,6 +19,27 @@
#include "local-def.h"
+// Sample Generic Ping Debug API
+static json_object* getPingTest(AFB_request *request) {
+ static int pingcount = 0;
+ json_object *response;
+ char query [256];
+ char session[256];
+ int len;
+
+ // request all query key/value
+ len = getQueryAll (request, query, sizeof(query));
+ if (len == 0) strncpy (query, "NoSearchQueryList", sizeof(query));
+
+ // check if we have some post data
+ if (request->post == NULL) request->post->data="NoData";
+
+ // return response to caller
+ response = jsonNewMessage(AFB_SUCCESS, "Ping Binder Daemon count=%d uuid=%s query={%s} session={0x%x} PostData: [%s] "
+ , pingcount++, request->uuid, query, session, request->post->data);
+ return (response);
+}
+
// With content-type=json data are directly avaliable in request->post->data
STATIC json_object* GetJsonByPost (AFB_request *request) {
json_object* jresp;