use of com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class ZoneStatusChangeNotificationCommandTest method test.
@Test
public void test() {
int[] packet = getPacketData("09 7B 00 24 00 00 00 00 00");
ZoneStatusChangeNotificationCommand command = new ZoneStatusChangeNotificationCommand();
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(36), command.getZoneStatus());
}
use of com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class OffWithEffectCommandTest method deserialize.
@Test
public void deserialize() {
int[] packet = getPacketData("01 12 40 00 00");
OffWithEffectCommand command = new OffWithEffectCommand();
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(0), command.getEffectIdentifier());
assertEquals(Integer.valueOf(0), command.getEffectVariant());
}
use of com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class ActiveEndpointsResponseTest method testReceive.
@Test
public void testReceive() {
int[] packet = getPacketData("00 00 00 00 01 01");
ActiveEndpointsResponse endpointsResponse = new ActiveEndpointsResponse();
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
endpointsResponse.deserialize(fieldDeserializer);
System.out.println(endpointsResponse);
assertEquals(1, endpointsResponse.getActiveEpList().size());
assertEquals(0x8005, (int) endpointsResponse.getClusterId());
assertEquals(ZdoStatus.SUCCESS, endpointsResponse.getStatus());
assertEquals(0, (int) endpointsResponse.getNwkAddrOfInterest());
assertEquals(1, (int) endpointsResponse.getActiveEpList().get(0));
}
use of com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class IeeeAddressResponseTest method testReceiveShort.
@Test
public void testReceiveShort() {
// Short response - ie not extended. This is from the Ember response!
int[] packet = getPacketData("00 00 BF 32 17 00 00 A3 22 00 00 00 00");
IeeeAddressResponse addressResponse = new IeeeAddressResponse();
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
addressResponse.deserialize(fieldDeserializer);
System.out.println(addressResponse);
assertEquals(new IeeeAddress("0022A300001732BF"), addressResponse.getIeeeAddrRemoteDev());
assertEquals(0x8001, (int) addressResponse.getClusterId());
assertEquals(ZdoStatus.SUCCESS, addressResponse.getStatus());
}
use of com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class ManagementLqiResponseTest method testReceive.
@Test
public void testReceive() {
// Short response - ie not extended
int[] packet = getPacketData("00 00 02 00 02 14 D4 F1 02 00 4B 12 00 0B 88 DC 00 01 88 17 00 8F 22 15 02 01 3B 14 D4 F1 02 00 4B 12 00 EC A1 A5 01 00 8D 15 00 35 38 15 02 01 58");
ManagementLqiResponse lqiResponse = new ManagementLqiResponse();
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
lqiResponse.deserialize(fieldDeserializer);
System.out.println(lqiResponse);
assertEquals(2, (int) lqiResponse.getNeighborTableEntries());
assertEquals(0, (int) lqiResponse.getStartIndex());
List<NeighborTable> neighbors = lqiResponse.getNeighborTableList();
assertEquals(2, neighbors.size());
assertEquals(59, (int) neighbors.get(0).getLqi());
assertEquals(NeighborTableJoining.UNKNOWN, neighbors.get(0).getPermitJoining());
assertEquals(1, (int) neighbors.get(0).getDepth());
assertEquals(NeighborTableRelationship.CHILD, neighbors.get(0).getRelationship());
assertEquals(LogicalType.ROUTER, neighbors.get(0).getDeviceType());
assertEquals(NeighborTableRxState.RX_ON, neighbors.get(0).getRxOnWhenIdle());
assertEquals(new IeeeAddress("0017880100DC880B"), neighbors.get(0).getExtendedAddress());
}
Aggregations