use of com.zsmartsystems.zigbee.IeeeAddress 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.IeeeAddress 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());
}
use of com.zsmartsystems.zigbee.IeeeAddress in project com.zsmartsystems.zigbee by zsmartsystems.
the class TelegesisDeviceJoinedNetworkEventTest method testRemoteAddress.
@Test
public void testRemoteAddress() {
TelegesisDeviceJoinedNetworkEvent event = new TelegesisDeviceJoinedNetworkEvent();
event.deserialize(stringToIntArray("NEWNODE:1234,1234567890ABCDEF,ABCD"));
System.out.println(event);
assertEquals(Integer.valueOf(0x1234), event.getNetworkAddress());
assertEquals(new IeeeAddress("1234567890ABCDEF"), event.getIeeeAddress());
assertEquals(Integer.valueOf(0xABCD), event.getParentAddress());
}
use of com.zsmartsystems.zigbee.IeeeAddress in project com.zsmartsystems.zigbee by zsmartsystems.
the class TelegesisDeviceLeftNetworkEventTest method testRemoteAddress.
@Test
public void testRemoteAddress() {
TelegesisDeviceLeftNetworkEvent event = new TelegesisDeviceLeftNetworkEvent();
event.deserialize(stringToIntArray("NODELEFT:1234,1234567890ABCDEF"));
System.out.println(event);
assertEquals(Integer.valueOf(0x1234), event.getNetworkAddress());
assertEquals(new IeeeAddress("1234567890ABCDEF"), event.getIeeeAddress());
}
use of com.zsmartsystems.zigbee.IeeeAddress in project com.zsmartsystems.zigbee by zsmartsystems.
the class EzspSetInitialSecurityStateRequestTest method testSecurityStateRequest.
@Test
public void testSecurityStateRequest() {
EzspFrame.setEzspVersion(4);
EmberKeyData keyData;
EzspSetInitialSecurityStateRequest request = new EzspSetInitialSecurityStateRequest();
EmberInitialSecurityState state = new EmberInitialSecurityState();
keyData = new EmberKeyData();
keyData.setContents(new int[] { 0xAA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xAA });
state.setNetworkKey(keyData);
keyData = new EmberKeyData();
keyData.setContents(new int[] { 0xBB, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xBB });
state.setPreconfiguredKey(keyData);
state.setPreconfiguredTrustCenterEui64(new IeeeAddress("1234567890ABCDEF"));
state.setNetworkKeySequenceNumber(0);
state.addBitmask(EmberInitialSecurityBitmask.EMBER_STANDARD_SECURITY_MODE);
request.setState(state);
request.setSequenceNumber(7);
System.out.println(request);
assertTrue(Arrays.equals(getPacketData("07 00 68 00 00 BB 00 00 00 00 00 00 00 00 00 00 00 00 00 00 BB AA 00 00 00 00 00 00 00 00 00 00 00 00 00 00 AA 00 EF CD AB 90 78 56 34 12"), request.serialize()));
}
Aggregations