Open justinmoon opened 5 years ago
The port object I'm currently getting from arduino-webusb has a .send() method that will send a string over the WebUSB connection to the device. But this .send() doesn't provide the actual response from the Arduino.
port
.send()
In https://github.com/arduino-bitcoin/simple_hardware_wallet/pull/21 I prototyped a protocol where the Arduino would send a comma-delimited command,payload message to the UI, which the UI would listen for and handle.
command,payload
This works but it doesn't seem optimal to me. It will become complicated to keep track of loading states. And it's ugly.
Hopefully we can find a better way ...
Stepan was saying how it would probably be better to send bytes instead of strings.
Something like Serial.write(arr, sizeof(arr)); where arr is our message: an array of bytes
Serial.write(arr, sizeof(arr));
The
port
object I'm currently getting from arduino-webusb has a.send()
method that will send a string over the WebUSB connection to the device. But this.send()
doesn't provide the actual response from the Arduino.In https://github.com/arduino-bitcoin/simple_hardware_wallet/pull/21 I prototyped a protocol where the Arduino would send a comma-delimited
command,payload
message to the UI, which the UI would listen for and handle.This works but it doesn't seem optimal to me. It will become complicated to keep track of loading states. And it's ugly.
Hopefully we can find a better way ...