aboutsummaryrefslogtreecommitdiffstats
path: root/bindings/samples/HelloWorld.c
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-05-30 16:26:51 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-05-30 16:26:51 +0200
commit5254a884edde7a8e786d3fde925db4adf3579d21 (patch)
tree725401f28afe8c061192d51023260b773e501449 /bindings/samples/HelloWorld.c
parent02f7d876553d278f73e5d57603d1d20a11cd16ea (diff)
sample binding "hello" receives events
Change-Id: Ic39d2c025af257703340d1c8f56746b2e27d3818 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'bindings/samples/HelloWorld.c')
-rw-r--r--bindings/samples/HelloWorld.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/bindings/samples/HelloWorld.c b/bindings/samples/HelloWorld.c
index 6c904bde..09c7d3e7 100644
--- a/bindings/samples/HelloWorld.c
+++ b/bindings/samples/HelloWorld.c
@@ -342,6 +342,11 @@ static int init()
return 0;
}
+static void onevent(const char *event, struct json_object *object)
+{
+ NOTICE("received event %s(%s)", event, json_object_to_json_string(object));
+}
+
// NOTE: this sample does not use session to keep test a basic as possible
// in real application most APIs should be protected with AFB_SESSION_CHECK
static const struct afb_verb_v2 verbs[]= {
@@ -369,6 +374,7 @@ const struct afb_binding_v2 afbBindingV2 = {
.specification = NULL,
.verbs = verbs,
.preinit = preinit,
- .init = init
+ .init = init,
+ .onevent = onevent
};