MdocNfcCceService

Base class for implementing NFC Concurrent Channel Engagement (CCE) according to ISO/IEC 18013-5 Second Edition.

Applications should subclass this and register it in NfcApduRouter.buildServices for the appropriate AID (Nfc.ISO_MDOC_NFC_CCE_APPLICATION_ID, A0000002480401).

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion
Link copied to clipboard
data class Settings(val source: PresentmentSource, val promptModel: PromptModel, val presentmentModel: PresentmentModel?, val launchUi: () -> Unit? = null, val sessionEncryptionCurve: EcCurve, val onlyAllowNfc: Boolean, val handoverPreferredOrder: List<String> = emptyList(), val bleDirectL2capEnabled: Boolean = false, val transportOptions: MdocTransportOptions, val transportFactory: MdocTransportFactory = MdocTransportFactory.Default, val capabilities: Map<Capability, DataItem> = mapOf( Capability.READER_AUTH_ALL_SUPPORT to true.toDataItem(), Capability.EXTENDED_REQUEST_SUPPORT to true.toDataItem() ))

Settings provided by the application for how to configure NFC Concurrent Channel Engagement (CCE).

Properties

Link copied to clipboard
protected val serviceScope: CoroutineScope

CoroutineScope tied to the lifecycle of this service (cancelled in stop).

Functions

Link copied to clipboard

Signals that the NFC link has been deactivated.

Link copied to clipboard
abstract suspend fun getSettings(): MdocNfcCceService.Settings

Must be implemented by the application to specify its preferences/settings for NFC engagement.

Link copied to clipboard
protected open suspend override fun processCommandApdu(commandApdu: CommandApdu): ResponseApdu

Processes a CommandApdu sequentially on the service's background coroutine.

Link copied to clipboard
protected open suspend override fun processDeactivated(reason: NfcDeactivationReason)

Processes a deactivation event sequentially on the service's background coroutine.

Link copied to clipboard

Enqueues an incoming CommandApdu for sequential processing by processCommandApdu.

Link copied to clipboard
open override fun start()

Starts the service and its internal APDU dispatch coroutine.

Link copied to clipboard
open override fun stop()

Stops the service and cancels its internal APDU dispatch coroutine.

Link copied to clipboard
protected fun vibrateError()

Triggers haptic feedback indicating an NFC engagement error, if supported by the platform.

Link copied to clipboard
protected fun vibrateSuccess()

Triggers haptic feedback indicating successful NFC engagement, if supported by the platform.