MdocTransport
An abstraction of a ISO/IEC 18013-5:2021 device retrieval method.
A MdocTransport's state can be tracked in the state property which is State.IDLE when constructed from the factory. This is a StateFlow and intended to be used by the application to update its user interface.
To open a connection to the other peer, call open. When open returns successfully the state is State.CONNECTED. At this point, the application can use sendMessage and waitForMessage to exchange messages with the remote peer.
Each MdocTransport has a role, indicating whether the application is acting as the mdoc or mdoc reader. For forward engagement, if acting in the role MdocRole.MDOC the application should create one or more MdocConnectionMethod instances, call open on each of them, share the MdocConnectionMethods (through QR or NFC in Device Engagement according to ISO/EC 18013-5:2021). Similarly, the other peer - acting in the role MdocRole.MDOC_READER - should obtain the Device Engagement, get one or more MdocConnectionMethod objects and call open on one of them. For reverse engagement, the process is the same but with the roles reversed.
The transport can fail at any time, for example if the other peer sends invalid data or actively disconnects. In this case the state is changed to State.FAILED and any calls except for close will fail with the MdocTransportException exception.
The connection can be closed at any time using the close method which will transition the state to State.CLOSED except if it's already in State.FAILED.
MdocTransport instances are thread-safe and methods and properties can be called from any thread or coroutine.
Inheritors
Properties
A MdocConnectionMethod which can be sent to the other peer to connect to.
The time spent scanning for the other peer.
The current state of the transport.