function decode_meters(dgram) {
	const meterParser = new binaryParser()
		.uint16('meter')
		.uint16('value');

	const metersParser = new binaryParser()
		.array(null, {
			type: meterParser,
			readUntil: 'eof'
		});

	const meter_values = {};
	if (dgram.stream === StreamType.meter) {
		try {
			const meter_reports = metersParser.parse(dgram.payload);
			for (let m = 0; m < meter_reports.length; m++) {
				const meter_report = meter_reports[m];
				meter_values[meter_report.meter] = meter_report.value;
			};
		} catch (error) {
			console.error('flexradio-js meter decoding error');
			console.error(error);
			return null;
		}
	}

	return meter_values;
}
// decode_meters() -- decode the meter reporting datagram (just the payload)
- decode the meter reporting datagram (just the payload)
- decode the meter reporting datagram ( just the payload )
function decode_meters(dgram) {
	const meterParser = new binaryParser()
		.uint16('meter')
		.uint16('value');
	const metersParser = new binaryParser()
		.array(null, {
			type: meterParser,
			readUntil: 'eof'
		});
	const meter_values = {};
	if (dgram.stream === StreamType.meter) {
		try {
			const meter_reports = metersParser.parse(dgram.payload);
			for (let m = 0; m < meter_reports.length; m++) {
				const meter_report = meter_reports[m];
				meter_values[meter_report.meter] = meter_report.value;
			};
		} catch (error) {
			console.error('flexradio-js meter decoding error');
			console.error(error);
			return null;
		}
	}
	return meter_values;
}
function decode_meters ( dgram ) { const meterParser = new binaryParser ( ) . uint16 ( 'meter' ) . uint16 ( 'value' ) ; const metersParser = new binaryParser ( ) . array ( null , { type : meterParser , readUntil : 'eof' } ) ; const meter_values = { } ; if ( dgram . stream === StreamType . meter ) { try { const meter_reports = metersParser . parse ( dgram . payload ) ; for ( let m = 0 ; m < meter_reports . length ; m ++ ) { const meter_report = meter_reports [ m ] ; meter_values [ meter_report . meter ] = meter_report . value ; } ; } catch ( error ) { console . error ( 'flexradio-js meter decoding error' ) ; console . error ( error ) ; return null ; } } return meter_values ; }
decode_meters() -- decode the meter reporting datagram (just the payload)
decode_meters () -- decode the meter reporting datagram ( just the payload )