use of org.openhab.binding.modbus.e3dc.internal.modbus.Parser in project openhab-addons by openhab.
the class InfoTest method testInvalidBlockSize.
@Test
public void testInvalidBlockSize() {
byte[] infoBlock = new byte[] { -29, -36, 1, 2, 0, -120, 69, 51, 47, 68, 67, 32, 71, 109, 98, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 83, 49, 48, 32, 69, 32, 65, 73, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 85, 78, 73, 78, 73, 84, 73, 65, 76, 73, 90, 69, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 83, 49, 48, 95, 50, 48, 50, 48, 95, 48 };
Parser mc = new Parser(DataType.INFO);
mc.setArray(infoBlock);
Optional<Data> infoOpt = mc.parse(DataType.INFO);
InfoBlock b = (InfoBlock) infoOpt.get();
// block still valid but data maybe corrupted => logged in warnings
assertTrue(infoOpt.isPresent());
assertNotNull(b);
}
use of org.openhab.binding.modbus.e3dc.internal.modbus.Parser in project openhab-addons by openhab.
the class InfoTest method setup.
@BeforeEach
public void setup() {
byte[] infoBlock = new byte[] { -29, -36, 1, 2, 0, -120, 69, 51, 47, 68, 67, 32, 71, 109, 98, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 83, 49, 48, 32, 69, 32, 65, 73, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 85, 78, 73, 78, 73, 84, 73, 65, 76, 73, 90, 69, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 83, 49, 48, 95, 50, 48, 50, 48, 95, 48, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
mc = new Parser(DataType.INFO);
mc.setArray(infoBlock);
}
use of org.openhab.binding.modbus.e3dc.internal.modbus.Parser in project openhab-addons by openhab.
the class ParserNameTest method testDebugNames.
@Test
public void testDebugNames() {
Parser mcInfo = new Parser(DataType.INFO);
assertEquals("org.openhab.binding.modbus.e3dc.internal.modbus.Parser:INFO", mcInfo.toString(), "Debug Name Info");
Parser mcPower = new Parser(DataType.DATA);
assertEquals("org.openhab.binding.modbus.e3dc.internal.modbus.Parser:DATA", mcPower.toString(), "Debug Name Power");
}
Aggregations