aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md5
-rw-r--r--binding/afm-nfc-binding.c30
2 files changed, 15 insertions, 20 deletions
diff --git a/README.md b/README.md
index a9eec9b..506d984 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,8 @@
## Overview
NFC service uses neard package to detect the presence of NFC tags and signal clients via an event.
-The NDEF data shall include a text record ('uid') to keep compatibility with the existing agl-service-identity-agent.
+The presence event shall include a dictionary named "record" that contains entries with a "Type"
+field and a value field named after the "Type" value.
## Verbs
@@ -18,4 +19,4 @@ The NDEF data shall include a text record ('uid') to keep compatibility with the
| Name | Description | JSON Response |
|--------------------|:-------------------------------------|:-----------------------------------------------------------------------|
| presence | event that reports NFC tag presence | *Response:* {"status": "detected", |
-| | | "uid": "042eb3628e4981"}, |
+| | | "record": { "Type": "URI", "URI": "http://www.nfc-forum.com" } } |
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;
}