Builder
Builder class for Packet.
Each packet sent to the Pico device is expected to follow a specific format, starting with a single byte for the command and ending with an array of byte data.
This builder class enforces that format and provides simple functions for appending the necessary data to the request.
For example:
val packet = Packet.Builder(Command.CMD_SET_PIN_SINGLE)
.addData(pin)
.addData(value)
.build()Content copied to clipboard
The above request sets the command to SET_PIN_SINGLE, appends the pin, appends the value to set for that pin, then compiles the data into a packet.
Parameters
command
The command to send with this packet of data