Open bonedaddy opened 4 years ago
LoRa protocol is 50% done. I've got the LibP2P bridge successfully sending data to peers that is received from the arduino, however I need to enable clients to send data to the bridge to send through the arduino.
There's an issue with the way I implemented reading data from the stream to write into the serial interface. Not quite sure what it is but definitely strange. It was preventing the bridge from properly sending data through the LibP2P protocol, but as soon as that read-from-stream part of the code was commented out, everything started working.
Improvements Todo:
Enable an internal buffer for reading LoRa data. Let's allocate 25KB of "buffer" data at startup, and queue the data we receive from LoRa into the buffer. Every time it is full, after X cycles, or when prompted via the serial interface we can send the data and empty the buffer. LoRa frames on the bridge are 255 bytes, which a 25kb buffer allows us to queue 90 of, but the more we queue without sending we are at risk of losing if power fails. So perhaps 10 second bursts are best.
This should allow us to receive more messages on average as we would miss less messages due to spending less time on average processing messages.
Change the usage of ^
to a null character \0
.
Part 1 - LoRa LibP2P Protocol
LibP2P allows us to register arbitrary protocols, and setup stream handlers. We should implement a basic LibP2P protocol that allows a LibP2P host with a compatible device running the "LoRa bridge". Using this, authorized peers can read/write data from/to the LoRa bridge.
Part 2 -LoRa LibP2P Transport
This will allow leveraging the LoRa bridge as a pure LibP2P transport, communicating through the LoRa bridge