sendAndAwait
suspend fun <T : McuMgrResponse> McuManager.sendAndAwait(op: Int, commandId: Int, payload: Map<String, Any>?, timeout: Long, responseType: Class<T>): T
Sends a command to the device and suspends until the response is received.
This is the suspending counterpart of McuManager.send with a callback, which can be used to implement commands of custom groups. The managers provided by this library have dedicated methods in their wrappers.
Cancelling the coroutine does not cancel the request, only the wait for the response.
Return
The response.
Parameters
op
The operation: 0 for read, or 2 for write.
commandId
The ID of the command.
payload
The map of values to send along, or null if the header is the only required field.
timeout
The timeout, in milliseconds.
responseType
The type of the response.
Throws
if the request fails.
if the device responds with an error, that is with a non-zero return code.