I'm transmitting data through bluetooth LE from a chip to node.js server.
Firmware code:
uint16_t txBuf[5]
top &= 0x3FF;
bottom &= 0x3FF;
txBuf[0] = top + (bottom << 10);
txBuf[1] = bottom >> 2;
Basically, the first 10 bit is top, and the next 10 bit is bottom. I could print the buffer in node.js:
console.log(buffer)
console.log(buffer.data)
<Buffer cd d3 8d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>
20
How can I parse this in javascript and node.js without doing bit manipulation?