We are trying to code GPS device listener on Javascript.
While doing this, we are unable to develop the right script for the CRC-ITU error check. The explanation for
There are some crc packages on npm, but they may not work for you, I create a new one that is just a copy of c code from your link to document.
Install crc-itu from terminal:
npm install crc-itu
app.js
var crc16 = require('crc-itu').crc16;
var crcInHex = crc16('0d0103588990501766460026', 'hex').toString(16);
console.log(crcInHex); // will print 7bf9
you can also try with these values, note: crc16(data).toString(16) => crc
start data crc end
-------------------------------------------
7878 0d0103588990501766460026 7bf9 0d0a
7878 0d010358899050176646002a b195 0d0a
7878 0d010358899050176646002b a01c 0d0a