17 lines
403 B
JavaScript
17 lines
403 B
JavaScript
"use strict";
|
|
|
|
const offset_id = 0;
|
|
const offset_lat = 32 / 8;
|
|
const offset_lng = (32 / 8) + (32 / 8);
|
|
|
|
function decode_payload(payload_base64) {
|
|
let payload_buffer = Buffer.from(payload_base64, "base64");
|
|
|
|
return {
|
|
id: payload_buffer.readUInt32LE(offset_id),
|
|
latitude: patload_buffer.readFloatLE(offset_lat),
|
|
longitude: patload_buffer.readFloatLE(offset_lng)
|
|
};
|
|
}
|
|
|
|
export { decode_payload };
|