I’ve just purchased a few waterproof panic buttons; previously I have used Dragino units and they have been very helpful in providing a TTN decoder.
Mokosmart have only provided me example data and don’t provide the decoder, so hoping someone with smarts can help me; as I just cant work out how to count the bytes etc; hoping after seeing how this one is done I will learn for the future.
I managed to get this far but don’t know how to get to the value of 2838905 or 5334647 in their latitude/longitude example
function Decoder(bytes, port) {
// Decode an uplink message from a buffer
// (array) of bytes to an object of fields.
var decoded = {};
// if (port === 1) decoded.led = bytes[0];
decoded.Battery = bytes[0]
decoded.Alatm_STATUS = bytes[1]
decoded.Latitude= bytes[2]+bytes[3]+bytes[4]+bytes[5]
decoded.Longitude= bytes[6]+bytes[7]+bytes[8]+bytes[9]
return decoded;
}
So I need to get the 3 bytes next to each other, i.e. 306EA3 = 3174051
But I cant work out how to place the 3 bytes next to each other
bytes[4] bytes[3] bytes[2]