NciNfcController

class NciNfcController(packetIo: NciPacketIo, registerWithMultipaz: Boolean = true, externalReader: Boolean = false, disableReaderModeDelay: Duration = 5.seconds, openTagDisconnectDelay: Duration = 30.seconds, pollInterval: Duration = 100.milliseconds, commandTimeout: Duration = 3.seconds, scope: CoroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.Default)) : NfcApduRouterBackend

High-level NFC controller coordinating both NFC Reader/Writer mode (NfcTagReaderNci) and NFC Card/Tag Emulation mode (NfcApduRouterBackend) over an NciPacketIo transport (such as an NXP PN7160 connected via I2C + GPIO on a Raspberry Pi).

When start is called:

Constructors

Link copied to clipboard
constructor(packetIo: NciPacketIo, registerWithMultipaz: Boolean = true, externalReader: Boolean = false, disableReaderModeDelay: Duration = 5.seconds, openTagDisconnectDelay: Duration = 30.seconds, pollInterval: Duration = 100.milliseconds, commandTimeout: Duration = 3.seconds, scope: CoroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.Default))

Properties

Link copied to clipboard

Functions

Link copied to clipboard
fun close()

Non-suspending close that immediately tears down the NCI engine and NciPacketIo.

Link copied to clipboard
open override fun onRouterStarted(router: NfcApduRouter)
Link copied to clipboard
open override fun onRouterStopped(router: NfcApduRouter)
Link copied to clipboard
open override fun sendResponseApdu(responseApdu: ResponseApdu)
Link copied to clipboard
suspend fun start()

Initializes the NCI controller hardware and registers with NfcTagReader and NfcApduRouter.

Link copied to clipboard
suspend fun stop()

Stops the NCI controller, unregisters from NfcTagReader and NfcApduRouter, and closes the underlying NciPacketIo.