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; frequency;
dataRate; dataRate;
payloadSize; payloadData;
get payloadSize(){
return payloadData.length/2;
}
packetType; packetType;
} }

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

Loading…
Cancel
Save