nfc.handover

The nfc.handover module implements the NFC Forum Connection Handover 1.2 protocol as a server and client class that simplify realization of handover selector and requester functionality.

nfc.handover.HandoverServer

class nfc.handover.HandoverServer(llc, request_size_limit=65536, recv_miu=1984, recv_buf=15)

Bases: threading.Thread

NFC Forum Connection Handover server

process_request(request)

Process a handover request message. The request argument is a nfc.ndef.HandoverRequestMessage object. The return value must be a nfc.ndef.HandoverSelectMessage object to be sent back to the client.

This method should be overwritten by a subclass of HandoverServer to customize it’s behavior. The default implementation returns a version 1.2 nfc.ndef.HandoverSelectMessage with no carriers.

nfc.handover.HandoverClient

class nfc.handover.HandoverClient(llc)

Bases: object

NFC Forum Connection Handover client

connect(recv_miu=248, recv_buf=2)

Connect to the remote handover server if available. Raises nfc.llcp.ConnectRefused if the remote device does not have a handover service or the service does not accept any more connections.

close()

Disconnect from the remote handover server.

send(message)

Send a handover request message to the remote server.

recv(timeout=None)

Receive a handover select message from the remote server.