read

suspend fun read(packet: Packet, length: Int): ByteArray

Performs a read request after flushing the queue, if needed.

A read request is one which expects a meaningful response. For example, reading data from SPI, or reading a pin's state.

Return

Server response to the read request

Parameters

packet

Data packet which contains an array of bytes to send to the PGN daemon.

length

Expected length of the response from the server


suspend fun read(length: Int): ByteArray

Reads the specified number of bytes from the socket.

Return

Bytes read from the socket

Parameters

length

Number of bytes to read from the socket