nfc.snep

The nfc.snep module implements the NFC Forum Simple NDEF Exchange Protocol (SNEP) specification and provides a server and client class for applications to easily send or receive SNEP messages.

nfc.snep.SnepServer

class nfc.snep.SnepServer(llc, service_name='urn:nfc:sn:snep', max_acceptable_length=1048576, recv_miu=1984, recv_buf=15)

NFC Forum Simple NDEF Exchange Protocol server

get(acceptable_length, ndef_message)

Handle Get requests. This method should be overwritten by a subclass of SnepServer to customize it’s behavior. The default implementation simply returns Not Implemented.

put(ndef_message)

Handle Put requests. This method should be overwritten by a subclass of SnepServer to customize it’s behavior. The default implementation simply returns Not Implemented.

nfc.snep.SnepClient

class nfc.snep.SnepClient(llc, max_ndef_msg_recv_size=1024)

Simple NDEF exchange protocol - client implementation

connect(service_name)

Connect to a SNEP server. This needs only be called to connect to a server other than the Default SNEP Server at urn:nfc:sn:snep or if the client wants to send multiple requests with a single connection.

close()

Close the data link connection with the SNEP server.

get(ndef_message=None, timeout=1.0)

Get an NDEF message from the server. Temporarily connects to the default SNEP server if the client is not yet connected.

put(ndef_message, timeout=1.0)

Send an NDEF message to the server. Temporarily connects to the default SNEP server if the client is not yet connected.