use of com.zsmartsystems.zigbee.serialization.DefaultDeserializer 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());
}
use of com.zsmartsystems.zigbee.serialization.DefaultDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class NodeDescriptorResponseTest method testReceive.
@Test
public void testReceive() {
int[] packet = getPacketData("00 00 00 00 00 40 8F CD AB 52 80 00 41 2A 80 00 00");
// data=01 90 45 00 00 00 02 80 00 00 40 01 00 00 36 FF 00 00 00 FF FF 11 00 00 00 00 00 40 8F CD AB 52 80 00 41
// 2A
// 80 00 00]
NodeDescriptorResponse descriptorResponse = new NodeDescriptorResponse();
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
descriptorResponse.deserialize(fieldDeserializer);
System.out.println(descriptorResponse);
NodeDescriptor nodeDescriptor = descriptorResponse.getNodeDescriptor();
assertEquals(82, nodeDescriptor.getBufferSize());
assertEquals(128, nodeDescriptor.getIncomingTransferSize());
assertEquals(43981, nodeDescriptor.getManufacturerCode());
}
use of com.zsmartsystems.zigbee.serialization.DefaultDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class PowerDescriptorResponseTest method testReceiveNotSupported.
@Test
public void testReceiveNotSupported() {
int[] packet = getPacketData("84 84");
PowerDescriptorResponse descriptorResponse = new PowerDescriptorResponse();
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
descriptorResponse.deserialize(fieldDeserializer);
System.out.println(descriptorResponse);
assertEquals(ZdoStatus.NOT_SUPPORTED, descriptorResponse.getStatus());
PowerDescriptor powerDescriptor = descriptorResponse.getPowerDescriptor();
assertEquals(null, powerDescriptor);
}
use of com.zsmartsystems.zigbee.serialization.DefaultDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class SimpleDescriptorResponseTest method testReceiveError.
@Test
public void testReceiveError() {
// int[] packet = getPacketData("00 00 00 00 10 C1");
int[] packet = getPacketData("00 81 00 01");
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();
assertNull(simpleDescriptor);
assertEquals(ZdoStatus.DEVICE_NOT_FOUND, descriptorResponse.getStatus());
}
use of com.zsmartsystems.zigbee.serialization.DefaultDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class NeighborTableTest method testDeserialize.
@Test
public void testDeserialize() {
int[] packet = getPacketData("B1 68 DE 3A 00 00 00 00 86 06 00 00 00 EE 1F 00 A9 44 25 02 0F E2");
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
NeighborTable neighbor = new NeighborTable();
neighbor.deserialize(deserializer);
assertEquals(LogicalType.ROUTER, neighbor.getDeviceType());
assertEquals(new IeeeAddress("001FEE0000000686"), neighbor.getExtendedAddress());
assertEquals(new ExtendedPanId("3ADE68B1"), neighbor.getExtendedPanId());
assertEquals(NeighborTableRelationship.SIBLING, neighbor.getRelationship());
assertEquals(Integer.valueOf(17577), neighbor.getNetworkAddress());
assertEquals(NeighborTableJoining.UNKNOWN, neighbor.getPermitJoining());
assertEquals(NeighborTableRxState.RX_ON, neighbor.getRxOnWhenIdle());
assertEquals(Integer.valueOf(15), neighbor.getDepth());
assertEquals(Integer.valueOf(226), neighbor.getLqi());
}
Aggregations