summaryrefslogtreecommitdiffstats
path: root/binding/afm-nfc-binding.c
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2018-12-16 21:55:05 -0500
committerScott Murray <scott.murray@konsulko.com>2018-12-16 21:55:05 -0500
commit025f9e643da7272123fb94fdf37d4284a356c4fe (patch)
tree4646ff2bb192f712bd7be57862ac53a92359eb09 /binding/afm-nfc-binding.c
parent43ca26febeba4605e71ef99ce804b0dfa72074c8 (diff)
Switch back to sending all tag contents to clients
Switch back to sending all tag records to subscribed clients on presence detection. While sending the first text record as the "uid" value the identity agent expects works, in the grand scheme of things, it is better to keep the NFC service generic and add the required parsing to the identity agent instead. Change-Id: I157dde987fb499772bb792b4c723e85734e2c9e4 Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Diffstat (limited to 'binding/afm-nfc-binding.c')
-rw-r--r--binding/afm-nfc-binding.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/binding/afm-nfc-binding.c b/binding/afm-nfc-binding.c
index d605632..ef87a7d 100644
--- a/binding/afm-nfc-binding.c
+++ b/binding/afm-nfc-binding.c
@@ -103,34 +103,28 @@ static void record_found(const char *tag_name, void *ptr)
gchar *str = g_variant_print(v, 0);
str[strlen(str) - 1] = '\0';
- AFB_API_DEBUG(afbBindingV3root,
- "%s tag, record %s= %s", tag_name, s, str);
+ AFB_API_WARNING(afbBindingV3root,
+ "%s tag, record %s= %s", tag_name, s, str);
json_object_object_add(jdict, s,
json_object_new_string(str + 1));
g_free(str);
}
+ json_object_object_add(jresp, "record", jdict);
+
neardal_free_record(record);
- /*
- * get record dictionary and look for 'Representation' field which should
- * contain the uid value the identity agent needs.
- *
- */
- if (json_object_object_get_ex(jdict, "Representation", &jtemp)) {
- const char *uid = json_object_get_string(jtemp);
+ AFB_API_WARNING(afbBindingV3root, "sending: %s",
+ json_object_to_json_string_ext(jresp, JSON_C_TO_STRING_SPACED | JSON_C_TO_STRING_PRETTY));
- pthread_mutex_lock(&mutex);
- data->jresp = jresp;
- json_object_object_add(jresp, "uid", json_object_new_string(uid));
- pthread_mutex_unlock(&mutex);
+ pthread_mutex_lock(&mutex);
+ data->jresp = jresp;
+ json_object_get(jresp);
+ pthread_mutex_unlock(&mutex);
- afb_event_push(presence_event, jresp);
- AFB_API_DEBUG(afbBindingV3root,
- "sent presence event, record content %s, tag %s",
- uid, tag_name);
- }
+ afb_event_push(presence_event, jresp);
+ AFB_API_WARNING(afbBindingV3root, "sent presence event");
return;
}