Added Decoder
This commit is contained in:
parent
a7b15a95aa
commit
afb9d1f844
12
decoder.txt
Normal file
12
decoder.txt
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
function Decoder(b, port) {
|
||||||
|
var lat = (b[0] | b[1]<<8 | b[2]<<16 | (b[2] & 0x80 ? 0xFF<<24 : 0)) / 10000;
|
||||||
|
var lon = (b[3] | b[4]<<8 | b[5]<<16 | (b[5] & 0x80 ? 0xFF<<24 : 0)) / 10000;
|
||||||
|
var alt = (b[6] | b[7]<<8 | (b[7] & 0x80 ? 0xFF<<16 : 0));
|
||||||
|
var hdop = b[8] / 100;
|
||||||
|
return {
|
||||||
|
latitude: lat,
|
||||||
|
longitude: lon,
|
||||||
|
altitude: alt,
|
||||||
|
hdop: hdop
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user