use of com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class DiscoverAttributesResponseTest method testReceive.
@Test
public void testReceive() {
int[] packet = getPacketData("00 02 00 21 03 00 21 04 00 21 07 00 21 08 00 30");
DiscoverAttributesResponse response = new DiscoverAttributesResponse();
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
response.deserialize(fieldDeserializer);
System.out.println(response);
List<AttributeInformation> records = response.getAttributeInformation();
assertEquals(5, records.size());
AttributeInformation record = records.get(0);
assertEquals(ZclDataType.UNSIGNED_16_BIT_INTEGER, record.getDataType());
assertEquals(2, record.getIdentifier());
}
use of com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class DiscoverCommandsGeneratedResponseTest method testReceive.
@Test
public void testReceive() {
int[] packet = getPacketData("01");
DiscoverCommandsGeneratedResponse response = new DiscoverCommandsGeneratedResponse();
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
response.deserialize(fieldDeserializer);
System.out.println(response);
assertNull(response.getCommandIdentifiers());
}
use of com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class ReadAttributesResponseTest method testReceiveNull.
@Test
public void testReceiveNull() {
int[] packet = getPacketData("01 00 86");
ReadAttributesResponse response = new ReadAttributesResponse();
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
response.deserialize(fieldDeserializer);
System.out.println(response);
List<ReadAttributeStatusRecord> records = response.getRecords();
ReadAttributeStatusRecord record = records.get(0);
assertEquals(ZclStatus.UNSUPPORTED_ATTRIBUTE, record.getStatus());
}
use of com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class ReadAttributesResponseTest method testReceive.
@Test
public void testReceive() {
int[] packet = getPacketData("05 00 00 42 06 4C 43 54 30 30 33 21 00 1D");
ReadAttributesResponse response = new ReadAttributesResponse();
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
response.deserialize(fieldDeserializer);
System.out.println(response);
List<ReadAttributeStatusRecord> records = response.getRecords();
ReadAttributeStatusRecord record = records.get(0);
assertEquals(ZclDataType.CHARACTER_STRING, record.getAttributeDataType());
assertEquals(5, record.getAttributeIdentifier());
assertEquals(ZclStatus.SUCCESS, record.getStatus());
assertEquals("LCT003", record.getAttributeValue());
}
use of com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class ZoneEnrollRequestCommandTest method test.
@Test
public void test() {
int[] packet = getPacketData("09 63 01 0D 00 4E 10");
ZoneEnrollRequestCommand command = new ZoneEnrollRequestCommand();
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
ZclHeader zclHeader = new ZclHeader(fieldDeserializer);
System.out.println(zclHeader);
command.deserialize(fieldDeserializer);
System.out.println(command);
assertEquals(Integer.valueOf(0x500), command.getClusterId());
assertEquals(Integer.valueOf(13), command.getZoneType());
assertEquals(Integer.valueOf(4174), command.getManufacturerCode());
}
Aggregations