use of com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer 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());
}
use of com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class QueryNextImageCommandTest method testReceive.
@Test
public void testReceive() {
int[] packet = getPacketData("00 0C 11 62 00 03 05 02 01");
QueryNextImageCommand command = new QueryNextImageCommand();
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
command.deserialize(fieldDeserializer);
System.out.println(command);
assertEquals(Integer.valueOf(4364), command.getManufacturerCode());
assertEquals(Integer.valueOf(98), command.getImageType());
assertEquals(Integer.valueOf(0x1020503), command.getFileVersion());
assertNull(command.getHardwareVersion());
}
use of com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class QueryNextImageCommandTest method testReceiveHwVersion.
@Test
public void testReceiveHwVersion() {
int[] packet = getPacketData("01 0C 11 62 00 03 05 02 01 33 44");
QueryNextImageCommand command = new QueryNextImageCommand();
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
command.deserialize(fieldDeserializer);
System.out.println(command);
assertEquals(Integer.valueOf(4364), command.getManufacturerCode());
assertEquals(Integer.valueOf(98), command.getImageType());
assertEquals(Integer.valueOf(0x1020503), command.getFileVersion());
assertEquals(Integer.valueOf(0x4433), command.getHardwareVersion());
}
use of com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class ActiveEndpointsResponseTest method testReceive2.
@Test
public void testReceive2() {
int[] packet = getPacketData("00 00 BD 97 06 01 02 03 04 C8 E8");
ActiveEndpointsResponse endpointsResponse = new ActiveEndpointsResponse();
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
endpointsResponse.deserialize(fieldDeserializer);
System.out.println(endpointsResponse);
assertEquals(6, endpointsResponse.getActiveEpList().size());
assertEquals(0x8005, (int) endpointsResponse.getClusterId());
assertEquals(ZdoStatus.SUCCESS, endpointsResponse.getStatus());
assertEquals(0x97bd, (int) endpointsResponse.getNwkAddrOfInterest());
assertEquals(1, (int) endpointsResponse.getActiveEpList().get(0));
assertEquals(2, (int) endpointsResponse.getActiveEpList().get(1));
assertEquals(3, (int) endpointsResponse.getActiveEpList().get(2));
assertEquals(4, (int) endpointsResponse.getActiveEpList().get(3));
assertEquals(0xc8, (int) endpointsResponse.getActiveEpList().get(4));
assertEquals(0xe8, (int) endpointsResponse.getActiveEpList().get(5));
}
use of com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class IeeeAddressResponseTest method testReceiveVeryShort.
@Test
public void testReceiveVeryShort() {
// Short response - ie not extended. This is from the Ember response!
int[] packet = getPacketData("00 00 42 CC 12 00 00 24 E5 7C AD B8");
IeeeAddressResponse addressResponse = new IeeeAddressResponse();
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
addressResponse.deserialize(fieldDeserializer);
System.out.println(addressResponse);
assertEquals(ZdoStatus.SUCCESS, addressResponse.getStatus());
assertEquals(new IeeeAddress("7CE524000012CC42"), addressResponse.getIeeeAddrRemoteDev());
assertEquals(Integer.valueOf(47277), addressResponse.getNwkAddrRemoteDev());
assertEquals(0x8001, (int) addressResponse.getClusterId());
}
Aggregations