introduce meterbus parsing
This commit is contained in:
@ -7,6 +7,9 @@ import java.util.Properties;
|
|||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
import org.openmuc.jmbus.DataRecord;
|
||||||
|
import org.openmuc.jmbus.MBusMessage;
|
||||||
|
import org.openmuc.jmbus.VariableDataStructure;
|
||||||
|
|
||||||
public class MbusMaster {
|
public class MbusMaster {
|
||||||
static final String PROPS_FILENAME = "mbusMaster.props";
|
static final String PROPS_FILENAME = "mbusMaster.props";
|
||||||
@ -48,9 +51,21 @@ public class MbusMaster {
|
|||||||
mbusgw.sendRequest((byte)0x5b, device);
|
mbusgw.sendRequest((byte)0x5b, device);
|
||||||
|
|
||||||
byte[] frame = mbusgw.collectResponse();
|
byte[] frame = mbusgw.collectResponse();
|
||||||
|
|
||||||
|
MBusMessage mbusMsg = MBusMessage.decode(frame, frame.length);
|
||||||
|
VariableDataStructure variableDataStructure = mbusMsg.getVariableDataResponse();
|
||||||
|
variableDataStructure.decode();
|
||||||
|
List<DataRecord> dataRecords = variableDataStructure.getDataRecords();
|
||||||
|
|
||||||
|
for (DataRecord dr : dataRecords) {
|
||||||
|
System.out.println(dr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
for (byte x : frame) {
|
for (byte x : frame) {
|
||||||
System.out.print(Integer.toHexString(Byte.toUnsignedInt(x)) + " ");
|
System.out.print(Integer.toHexString(Byte.toUnsignedInt(x)) + " ");
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
System.out.println();
|
System.out.println();
|
||||||
successCnt++;
|
successCnt++;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
Reference in New Issue
Block a user