aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--binding/afm-nfc-binding.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/binding/afm-nfc-binding.c b/binding/afm-nfc-binding.c
index eb667de..5331d6c 100644
--- a/binding/afm-nfc-binding.c
+++ b/binding/afm-nfc-binding.c
@@ -281,10 +281,18 @@ static int init(afb_api_t api)
static void subscribe(afb_req_t request)
{
+ const char *value = afb_req_value(request, "value");
+ const char *ename = afb_event_name(presence_event);
+
+ if (!value || !ename)
+ return;
+
+ if (strcasecmp(value, ename))
+ return;
+
if (afb_req_subscribe(request, presence_event) < 0) {
AFB_REQ_ERROR(request, "subscribe to presence_event failed");
afb_req_reply(request, NULL, "failed", "Invalid event");
-
return;
}
@@ -293,10 +301,18 @@ static void subscribe(afb_req_t request)
static void unsubscribe(afb_req_t request)
{
+ const char *value = afb_req_value(request, "value");
+ const char *ename = afb_event_name(presence_event);
+
+ if (!value || !ename)
+ return;
+
+ if (strcasecmp(value, ename))
+ return;
+
if (afb_req_unsubscribe(request, presence_event) < 0) {
AFB_REQ_ERROR(request, "unsubscribe to presence_event failed");
afb_req_reply(request, NULL, "failed", "Invalid event");
-
return;
}