Gateway TLG8411V1 User Manual V1.0.0
28
July 2020
var device = new Buffer(4);
for (var i=0; i<4; i++) {
device[i] = lorawan_packet[4-i];
}
var packet = lora_packet.fromWire(lorawan_packet);
var NwkSKey = new Buffer("2b7e151628aed2a6abf7158809cf4f3c",
'hex');
if(lora_packet.verifyMIC(packet, NwkSKey)){
var AppSKey = new Buffer("2b7e151628aed2a6abf7158809cf4f3c",
'hex');
var dec = lora_packet.decrypt(packet, AppSKey,
NwkSKey).toString('hex');
var msg = {
devaddr: device.toString('hex'),
data: dec,
fport: packet.getFPort(),
counter: packet.getFCnt(),
freq: raw.freq,
datr: raw.datr
};
debug_print(JSON.stringify(msg));
}
}
}