Chapter 8. Peer-to-Peer Exchange

All the examples you’ve seen in this book so far have used a passive tag as an intermediary to carry NDEF data. This is a big change for RFID, as it introduces a common data format that covers a range of different tag types (though not all RFID tag types). The other major difference between RFID and NFC is the latter’s ability to make peer-to-peer exchanges. These exchanges are between two active devices directly. Prior to NFC, RFID was not used in a peer-to-peer context. In this chapter, you’ll see examples of how to program peer-to-peer (P2P) exchanges.

In each P2P exchange, there is a target and an initiator, both of which are active devices. This means that when you send a target an NDEF message via P2P, the target can manipulate the data that you send it, and send you something back in response. You can also copy information from a tag, store it on a device, and transfer it to another device or another tag. P2P offers a range of interesting possibilities.

Peer-to-peer exchanges rest on yet another NFC protocol, the Simple NDEF Exchange Protocol (SNEP). SNEP is a request-and-response protocol: the initiator sends a request about the kind of data it would like to exchange, and the target responds with the requested data. SNEP rests on the NFC Forum’s Logical Link Control Protocol (LLCP). Although you won’t have to wrestle with SNEP and LLCP directly if you’re writing application code, it’s helpful to know where they sit in the NFC architecture, ...

Get Beginning NFC now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.