scan
open suspend override fun <T : Any> scan(message: String?, tagInteractionFunc: suspend (NfcIsoTag) -> T?, options: NfcScanOptions, context: CoroutineContext): T
Scans for an NFC tag using the USB CCID reader and executes tagInteractionFunc.
Return
the non-null result returned by tagInteractionFunc.
Parameters
message
optional message to display in the scan prompt dialog, or null for headless scanning.
tagInteractionFunc
callback invoked when an ISO-DEP tag enters the reader's RF field.
options
options for NFC scanning (such as custom polling frames).
context
the CoroutineContext used to execute tagInteractionFunc.
Throws
if close has already been called on this reader.
if the user dismisses the scan prompt dialog.
if the tag is lost and not caught by tagInteractionFunc.
IOException
if opening the USB device or communicating over CCID fails.