Closed joscha closed 8 years ago
In the decoder, you can currently do something like this:
const bytes = new Bytes(12); const result = decoder.decode( bytes, [ decoder.latLng, decoder.unixtime ], [ 'coords', 'timestamp'] ); // result is { coords: [/* lat */, /* longitude */], timestamp: /* unixtime */}
It would be great if we had something similar for the Arduino side, because currently it looks like this:
byte buffer[12]; latLngToBytes(buffer + 0, latitude, longitude); unixtimeToBytes(buffer + 8, unixtime); // byte has 12 define bytes
but ideally the user would not need to keep count of what position in the byte array the data is going to be written, e.g. it would be something like:
(pseudo code)
my_encoder = encoder(latLng, unixtime); byte buffer[my_encoder.targetSize]; my_encoder.encode(buffer, latitude, longitude, timestamp);
Idea from @htdvisser:
loRaBuffer = LoRaBuffer(12) loRaBuffer.WriteFloat(12.34) loRaBuffer.Bytes()
fixed via 66eeb59
In the decoder, you can currently do something like this:
It would be great if we had something similar for the Arduino side, because currently it looks like this:
but ideally the user would not need to keep count of what position in the byte array the data is going to be written, e.g. it would be something like:
(pseudo code)