use of com.zsmartsystems.zigbee.serialization.DefaultDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class SimpleDescriptorResponseTest method testReceive.
@Test
public void testReceive() {
int[] packet = getPacketData("00 00 00 00 14 01 04 01 00 00 00 03 00 00 01 00 06 00 03 00 00 01 00 06 00");
SimpleDescriptorResponse descriptorResponse = new SimpleDescriptorResponse();
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
descriptorResponse.deserialize(fieldDeserializer);
System.out.println(descriptorResponse);
SimpleDescriptor simpleDescriptor = descriptorResponse.getSimpleDescriptor();
assertEquals(ZdoStatus.SUCCESS, descriptorResponse.getStatus());
assertEquals(0, (int) descriptorResponse.getNwkAddrOfInterest());
assertEquals(1, simpleDescriptor.getEndpoint());
assertEquals(0x104, simpleDescriptor.getProfileId());
assertEquals(3, simpleDescriptor.getInputClusterList().size());
assertTrue(simpleDescriptor.getInputClusterList().contains(0));
assertTrue(simpleDescriptor.getInputClusterList().contains(1));
assertTrue(simpleDescriptor.getInputClusterList().contains(6));
assertEquals(3, simpleDescriptor.getOutputClusterList().size());
}
use of com.zsmartsystems.zigbee.serialization.DefaultDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class NodeDescriptorTest method testNodeDescriptorDeserialize.
@Test
public void testNodeDescriptorDeserialize() {
int[] packet = getPacketData("00 00 00 00 00 40 8F CD AB 52 80 00 41 2A 80 00 00");
NodeDescriptor descriptor = new NodeDescriptor();
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
descriptor.deserialize(deserializer);
System.out.println(descriptor);
assertEquals(0, descriptor.getManufacturerCode());
assertEquals(LogicalType.COORDINATOR, descriptor.getLogicalType());
}
use of com.zsmartsystems.zigbee.serialization.DefaultDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class ConfigureReportingResponseTest method test.
@Test
public void test() {
int[] packet = getPacketData("18 1B 07 00 00 00 00");
ConfigureReportingResponse response = new ConfigureReportingResponse();
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
ZclHeader zclHeader = new ZclHeader(fieldDeserializer);
System.out.println(zclHeader);
response.deserialize(fieldDeserializer);
System.out.println(response);
assertNull(response.getStatus());
assertEquals(1, response.getRecords().size());
AttributeStatusRecord record = response.getRecords().get(0);
assertEquals(0, record.getAttributeIdentifier());
assertEquals(ZclStatus.SUCCESS, record.getStatus());
}
use of com.zsmartsystems.zigbee.serialization.DefaultDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class ConfigureReportingResponseTest method testStatusOnly.
@Test
public void testStatusOnly() {
int[] packet = getPacketData("18 11 07 00");
ConfigureReportingResponse response = new ConfigureReportingResponse();
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
ZclHeader zclHeader = new ZclHeader(fieldDeserializer);
System.out.println(zclHeader);
response.deserialize(fieldDeserializer);
System.out.println(response);
assertEquals(ZclStatus.SUCCESS, response.getStatus());
assertNull(response.getRecords());
}
use of com.zsmartsystems.zigbee.serialization.DefaultDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class ReadAttributesResponseTest method testReceiveOtaImageStatus.
@Test
public void testReceiveOtaImageStatus() {
int[] packet = getPacketData("06 00 00 20 02");
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.UNSIGNED_8_BIT_INTEGER, record.getAttributeDataType());
assertEquals(6, record.getAttributeIdentifier());
assertEquals(ZclStatus.SUCCESS, record.getStatus());
assertEquals(2, record.getAttributeValue());
}
Aggregations