Changed payloadSize to payloadData with payloadSize getter

f_influx-checks
Ruakij 3 years ago
parent 62b55b94f1
commit aa9d5431f8

@ -24,7 +24,10 @@ class Packet{
frequency;
dataRate;
payloadSize;
payloadData;
get payloadSize(){
return payloadData.length/2;
}
packetType;
}

@ -76,8 +76,7 @@ class PacketStreamFactory extends Transform{
_handlePayload(packet, data){
// Get payload-Hex-Data. If there is no data: empty
let payloadData = data.join('').match(/(?<=\s)([A-F0-9]{1,4}(?!(\.|x)))/igm)?.join('') ?? '';
packet.payloadSize = payloadData.length/2; // 2 hex-chars = 1 byte
packet.payloadData = data.join('').match(/(?<=\s)([A-F0-9]{1,4}(?!(\.|x)))/igm)?.join('') ?? '';
}
}

Loading…
Cancel
Save