scanMdocReader

suspend fun NfcTagReader.scanMdocReader(message: String?, options: MdocTransportOptions, transportFactory: MdocTransportFactory = MdocTransportFactory.Default, selectConnectionMethod: suspend (connectionMethods: List<MdocConnectionMethod>) -> MdocConnectionMethod?, negotiatedHandoverConnectionMethods: List<MdocConnectionMethod>, nfcScanOptions: NfcScanOptions = NfcScanOptions(), context: CoroutineContext = Dispatchers.IO): ScanMdocReaderResult?

Performs NFC engagement as a mdoc reader.

This blocks until a connection has been established and on successful handover a ScanMdocReaderResult instance is returned with the transport, device engagement, handover, and the time spent exchanging APDUs with the remote mdoc.

Return

a ScanMdocReaderResult if successful handover was established, null if the user dismissed the dialog.

Parameters

message

the message to display in the NFC tag scanning dialog or null to not show a dialog. Not all platforms supports not showing a dialog, use org.multipaz.nfc.nfcTagScanningSupportedWithoutDialog to check at runtime if the platform supports this.

options

the MdocTransportOptions used to create new MdocTransport instances.

transportFactory

the factory used to create MdocTransport instances.

selectConnectionMethod

used to choose a connection method if the remote mdoc is using NFC static handover.

negotiatedHandoverConnectionMethods

the connection methods to offer if the remote mdoc is using NFC Negotiated Handover.

nfcScanOptions

a NfcScanOptions with options to influence scanning.

context

the CoroutineContext to use for calls to the tag which blocks the calling thread.