easyConnect

suspend fun Terminal.easyConnect(easyConnectConfiguration: EasyConnectConfiguration): Reader

Return

The connected Reader

Parameters

easyConnectConfiguration

Configuration for the easy connect process

See also

Automatically discovers and connects to a reader using easy connect.

This suspend function integrates with Kotlin's structured concurrency. If the coroutine calling this function is cancelled, the underlying easy connect operation will automatically be cancelled as well.

Example usage:

val job = coroutineScope.launch {
try {
val reader = terminal.easyConnect(
easyConnectConfiguration
)
// Handle successful connection
} catch (e: TerminalException) {
// Handle connection failure
}
}

// Cancelling the job will cancel the easy connect operation
job.cancel()

Throws

if the connection operation fails