Bugfix: Correct payload decoder

This commit is contained in:
Starbeamrainbowlabs 2019-07-09 13:14:12 +01:00
parent 3f1cf278e9
commit 380f984253

View file

@ -7,10 +7,13 @@ const offset_lng = (32 / 8) + (32 / 8);
function decode_payload(payload_base64) {
let payload_buffer = Buffer.from(payload_base64, "base64");
// console.debug(`Offsets: ${offset_id}, ${offset_lat}, ${offset_lng}`);
// console.debug(`Message hex: ${payload_buffer.toString("hex")}`)
return {
id: payload_buffer.readUInt32LE(offset_id),
latitude: patload_buffer.readFloatLE(offset_lat),
longitude: patload_buffer.readFloatLE(offset_lng)
latitude: payload_buffer.readFloatLE(offset_lat),
longitude: payload_buffer.readFloatLE(offset_lng)
};
}