Search in sources :

Example 6 with IeeeAddress

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());
}
Also used : DefaultDeserializer(com.zsmartsystems.zigbee.serialization.DefaultDeserializer) NeighborTable(com.zsmartsystems.zigbee.zdo.field.NeighborTable) ZclFieldDeserializer(com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer) IeeeAddress(com.zsmartsystems.zigbee.IeeeAddress) CommandTest(com.zsmartsystems.zigbee.CommandTest) Test(org.junit.Test)

Example 7 with IeeeAddress

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());
}
Also used : ExtendedPanId(com.zsmartsystems.zigbee.ExtendedPanId) DefaultDeserializer(com.zsmartsystems.zigbee.serialization.DefaultDeserializer) IeeeAddress(com.zsmartsystems.zigbee.IeeeAddress) Test(org.junit.Test) CommandTest(com.zsmartsystems.zigbee.CommandTest)

Example 8 with IeeeAddress

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());
}
Also used : IeeeAddress(com.zsmartsystems.zigbee.IeeeAddress) Test(org.junit.Test)

Example 9 with IeeeAddress

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());
}
Also used : IeeeAddress(com.zsmartsystems.zigbee.IeeeAddress) Test(org.junit.Test)

Example 10 with IeeeAddress

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()));
}
Also used : EmberKeyData(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.structure.EmberKeyData) EmberInitialSecurityState(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.structure.EmberInitialSecurityState) IeeeAddress(com.zsmartsystems.zigbee.IeeeAddress) EzspFrameTest(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.EzspFrameTest) Test(org.junit.Test)

Aggregations

IeeeAddress (com.zsmartsystems.zigbee.IeeeAddress)66 Test (org.junit.Test)53 ZigBeeEndpoint (com.zsmartsystems.zigbee.ZigBeeEndpoint)12 ZigBeeNode (com.zsmartsystems.zigbee.ZigBeeNode)12 CommandTest (com.zsmartsystems.zigbee.CommandTest)7 DefaultDeserializer (com.zsmartsystems.zigbee.serialization.DefaultDeserializer)7 ZclOnOffCluster (com.zsmartsystems.zigbee.zcl.clusters.ZclOnOffCluster)7 ZigBeeEndpointAddress (com.zsmartsystems.zigbee.ZigBeeEndpointAddress)6 ZclFieldDeserializer (com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer)6 ArrayList (java.util.ArrayList)6 ZigBeeCommand (com.zsmartsystems.zigbee.ZigBeeCommand)5 EzspFrameTest (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.EzspFrameTest)4 CommandResult (com.zsmartsystems.zigbee.CommandResult)3 ExtendedPanId (com.zsmartsystems.zigbee.ExtendedPanId)3 NodeDescriptor (com.zsmartsystems.zigbee.zdo.field.NodeDescriptor)3 HashSet (java.util.HashSet)3 ZigBeeNetworkManager (com.zsmartsystems.zigbee.ZigBeeNetworkManager)2 EmberInitialSecurityState (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.structure.EmberInitialSecurityState)2 EmberKeyData (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.structure.EmberKeyData)2 XBeeFrameHandler (com.zsmartsystems.zigbee.dongle.xbee.internal.XBeeFrameHandler)2