10-26-2013 05:30 PM
I am able to send one message from a device, and read it on the other.
I wanted to do a 3-way handshake using NFC, my goal was to have:
- App 1 writes a tag that starts app 2 on tap if it is not running
- App 2 sends a piece of data to app 1
- On reception app 1 sends another piece of data in response to app 2
To receive the data, I use a
- With a: <property var="uris" value="ndef://4/myApp.domain.com/action"/>
- Then I connect to InvokeManager::invoked, in which I extract the Payload
To send the data, I use
- I use the nfc_target_t that I get in the NFC_SNEP_CONNECTION_EVENT event.
I am able to push the message immediately in NFC_SNEP_CONNECTION_EVENT, or later in an asynchronous event.
But I cannot push the message twice, else it is only received once
I didn't find a way to use the nfc_* native functions to read the NFC data. I am calling nfc_register_tag_readerwriter(TAG_TYPE_NDEF), but AbstractBpsEventHandler::event is never called
Solved! Go to Solution.
10-28-2013 09:46 AM
unfortunately you cannot send multiple push messages in the context of a single NFC "tap". You need to have the users separate devices and tap again before you can send your second push message.
The alternative and arguably best way to implement your handshake is to use LLCP.
I'm working on a code sample for this right now and will publish asap.