read

suspend fun read(transport: ApduTransport, options: ChipReadOptions): ChipReadResult

Reads the chip behind transport as options say.

It never throws for a chip, transport or content problem: those end in ChipReadResult.Partial or ChipReadResult.Failed with a typed error. Only cancellation of the calling coroutine is thrown.

Return

ChipReadResult.Complete, ChipReadResult.Partial or ChipReadResult.Failed.

Parameters

transport

The platform's connection to the chip, already open.

options

The key, the data groups, the roots and the check time.

Throws

when the calling coroutine is cancelled.


suspend fun read(transport: ApduTransport, options: ChipReadOptions, updates: ChipReadUpdateListener?): ChipReadResult

Reads the chip behind transport as options say, and tells updates where the read is.

The same read as the two-argument read, with the same result. updates gets an update as the read opens access (ChipReadState.OpeningAccess), reads each file part by part (ChipReadState.ReadingFile, with the byte counts once the file's length is known), runs chip or active authentication (ChipReadState.AuthenticatingChip) and runs the checks (ChipReadState.CheckingFiles), each with the progress. Every update has attempt 1 of 1: this call makes one attempt, on a link your app owns. The result is the ending, so the listener has no ending call; a ChipReadObserver can be passed, and its ChipReadObserver.onEnding is not called.

The updates come on the calling coroutine, one at a time. An exception the listener throws is ignored and never changes the read.

Return

ChipReadResult.Complete, ChipReadResult.Partial or ChipReadResult.Failed.

Since

1.0.0

Parameters

transport

The platform's connection to the chip, already open.

options

The key, the data groups, the roots and the check time.

updates

Where the updates go; null for none.

Throws

when the calling coroutine is cancelled.