Wireless M-Bus Range Extender /
/
User Manual Version 1.0
Page 30 of 32
let base64Payload = deviceEvent.base64Payload;
let statusData = Buffer.from(base64Payload, 'base64');
var systemTimeBuffer = statusData.slice(1, 5);
var firmwareVersionMinor = statusData[5];
var firmwareVersionMajor = statusData[6];
var lastSyncTimeBuffer = statusData.slice(7, 11);
var resetCounterBuffer = statusData.slice(11, 15);
var statusBitsBuffer = statusData.slice(15, 17);
var rxCounterBuffer = statusData.slice(17, 21);
var sdCounterBuffer = statusData.slice(21, 25);
var txCounterBuffer = statusData.slice(25, 29);
var epochSeconds = systemTimeBuffer[0] | systemTimeBuffer[1] << 8 |
systemTimeBuffer[2] << 16 | systemTimeBuffer[3] << 24;
var systemTime = new Date(epochSeconds * 1000);
var epochSeconds = lastSyncTimeBuffer[0] | lastSyncTimeBuffer[1] << 8 |
lastSyncTimeBuffer[2] << 16 | lastSyncTimeBuffer[3] << 24;
var lastSyncTime = new Date(epochSeconds * 1000);
var resetCounter = resetCounterBuffer[0] | resetCounterBuffer[1] << 8 |
resetCounterBuffer[2] << 16 | resetCounterBuffer[3] << 24;
var statusBits = statusBitsBuffer[0] | statusBitsBuffer[1] << 8;
var rxCounter = rxCounterBuffer[0] | rxCounterBuffer[1] << 8 |
rxCounterBuffer[2] << 16 | rxCounterBuffer[3] << 24;
var sdCounter = sdCounterBuffer[0] | sdCounterBuffer[1] << 8 |
sdCounterBuffer[2] << 16 | sdCounterBuffer[3] << 24;
var txCounter = txCounterBuffer[0] | txCounterBuffer[1] << 8 |
txCounterBuffer[2] << 16 | txCounterBuffer[3] << 24;