aboutsummaryrefslogtreecommitdiffstats
path: root/bindings/samples
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-10-10 18:21:54 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-10-10 20:28:40 +0200
commit04241c8168fe8826b4fc7a80500577b50936b57a (patch)
tree145d56f7357b463dabe60c2126348b9126edfbb0 /bindings/samples
parentb55a56d550d4a62a63e175f87c89a0a6c55e691e (diff)
Add the function afb_req_get_uid
Change-Id: I9caf38ee3811cf10b546489094f0bb5b3d844c40 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'bindings/samples')
-rw-r--r--bindings/samples/HelloWorld.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/bindings/samples/HelloWorld.c b/bindings/samples/HelloWorld.c
index 0b0d1a96..134ea620 100644
--- a/bindings/samples/HelloWorld.c
+++ b/bindings/samples/HelloWorld.c
@@ -428,6 +428,12 @@ static void appid (afb_req request)
free(aid);
}
+static void uid (afb_req request)
+{
+ int uid = afb_req_get_uid(request);
+ afb_req_success_f(request, json_object_new_int(uid), "uid is %d", uid);
+}
+
static int preinit()
{
AFB_NOTICE("hello binding comes to live");
@@ -468,6 +474,7 @@ static const afb_verb_v2 verbs[]= {
{ .verb="broadcast", .callback=broadcast },
{ .verb="hasperm", .callback=hasperm },
{ .verb="appid", .callback=appid },
+ { .verb="uid", .callback=uid },
{ .verb="exit", .callback=exitnow },
{ .verb=NULL}
};