Search in sources :

Example 1 with ExtendedPanId

use of com.zsmartsystems.zigbee.ExtendedPanId in project com.zsmartsystems.zigbee by zsmartsystems.

the class DefaultSerializerTest method testSerialize_EXTENDED_PANID.

@Test
public void testSerialize_EXTENDED_PANID() {
    ExtendedPanId valIn = new ExtendedPanId("1234567890123456");
    int[] valOut = { 0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12 };
    testSerializedData(valIn, valOut, ZclDataType.EXTENDED_PANID);
}
Also used : ExtendedPanId(com.zsmartsystems.zigbee.ExtendedPanId) Test(org.junit.Test)

Example 2 with ExtendedPanId

use of com.zsmartsystems.zigbee.ExtendedPanId 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 3 with ExtendedPanId

use of com.zsmartsystems.zigbee.ExtendedPanId in project com.zsmartsystems.zigbee by zsmartsystems.

the class TelegesisActiveScanCommandTest method test.

@Test
public void test() {
    TelegesisActiveScanCommand command = new TelegesisActiveScanCommand();
    command.setChannelMask(0xFFF0);
    System.out.println(command);
    assertEquals("AT+PANSCAN:FFF0\r\n", intArrayToString(command.serialize()));
    command.deserialize(stringToIntArray("+PANSCAN:11,2001,000000003ADE68B1,02,00\r"));
    System.out.println(command);
    command.deserialize(stringToIntArray("+PANSCAN:19,9D12,BD42FE090EEE14CA,02,00\r"));
    System.out.println(command);
    command.deserialize(stringToIntArray("OK\r"));
    System.out.println(command);
    assertEquals(2, command.getScanResults().size());
    assertEquals(TelegesisStatusCode.SUCCESS, command.getStatus());
    ScanResult result;
    Iterator<ScanResult> resultIterator = command.getScanResults().iterator();
    result = resultIterator.next();
    assertEquals(Integer.valueOf(11), result.getChannel());
    assertEquals(Integer.valueOf(0x2001), result.getPanId());
    assertEquals(new ExtendedPanId("000000003ADE68B1"), result.getEpanId());
    assertEquals(Integer.valueOf(2), result.getProfileId());
    assertEquals(false, result.getJoiningEnabled());
    result = resultIterator.next();
    assertEquals(Integer.valueOf(19), result.getChannel());
    assertEquals(Integer.valueOf(0x9D12), result.getPanId());
    assertEquals(new ExtendedPanId("BD42FE090EEE14CA"), result.getEpanId());
    assertEquals(Integer.valueOf(2), result.getProfileId());
    assertEquals(false, result.getJoiningEnabled());
}
Also used : ScanResult(com.zsmartsystems.zigbee.dongle.telegesis.internal.protocol.TelegesisActiveScanCommand.ScanResult) ExtendedPanId(com.zsmartsystems.zigbee.ExtendedPanId) Test(org.junit.Test)

Example 4 with ExtendedPanId

use of com.zsmartsystems.zigbee.ExtendedPanId in project com.zsmartsystems.zigbee by zsmartsystems.

the class TelegesisDisplayNetworkInformationCommandTest method test.

@Test
public void test() {
    TelegesisDisplayNetworkInformationCommand command = new TelegesisDisplayNetworkInformationCommand();
    System.out.println(command);
    assertEquals("AT+N?\r\n", intArrayToString(command.serialize()));
    command.deserialize(stringToIntArray("+N=FFD,18,5,1234,1234567890ABCDEF"));
    System.out.println(command);
    assertEquals(Integer.valueOf(18), command.getChannel());
    assertEquals(Integer.valueOf(5), command.getPower());
    assertEquals(Integer.valueOf(0x1234), command.getPanId());
    assertEquals(new ExtendedPanId("1234567890ABCDEF"), command.getEpanId());
}
Also used : ExtendedPanId(com.zsmartsystems.zigbee.ExtendedPanId) Test(org.junit.Test)

Example 5 with ExtendedPanId

use of com.zsmartsystems.zigbee.ExtendedPanId in project com.zsmartsystems.zigbee by zsmartsystems.

the class TelegesisGetEpanIdCommandTest method testOk.

@Test
public void testOk() {
    TelegesisGetEpanIdCommand command = new TelegesisGetEpanIdCommand();
    System.out.println(command);
    assertEquals("ATS03?\r\n", intArrayToString(command.serialize()));
    assertFalse(command.deserialize(stringToIntArray("1234567890ABCDEF\r")));
    System.out.println(command);
    assertTrue(command.deserialize(stringToIntArray("OK\r")));
    System.out.println(command);
    assertEquals(new ExtendedPanId("1234567890ABCDEF"), command.getEpanId());
    assertEquals(TelegesisStatusCode.SUCCESS, command.getStatus());
}
Also used : ExtendedPanId(com.zsmartsystems.zigbee.ExtendedPanId) Test(org.junit.Test)

Aggregations

ExtendedPanId (com.zsmartsystems.zigbee.ExtendedPanId)18 Test (org.junit.Test)13 IeeeAddress (com.zsmartsystems.zigbee.IeeeAddress)3 ConBeeReadParameterResponse (com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeReadParameterResponse)3 ByteArray (com.zsmartsystems.zigbee.zcl.field.ByteArray)2 ArrayList (java.util.ArrayList)2 CommandTest (com.zsmartsystems.zigbee.CommandTest)1 ZigBeeKey (com.zsmartsystems.zigbee.ZigBeeKey)1 ZigBeeNetworkManager (com.zsmartsystems.zigbee.ZigBeeNetworkManager)1 ZigBeeNetworkMeshMonitor (com.zsmartsystems.zigbee.ZigBeeNetworkMeshMonitor)1 ZigBeeNetworkStateSerializer (com.zsmartsystems.zigbee.ZigBeeNetworkStateSerializer)1 ZigBeeConsoleCommand (com.zsmartsystems.zigbee.console.ZigBeeConsoleCommand)1 EmberConsoleNcpChildrenCommand (com.zsmartsystems.zigbee.console.ember.EmberConsoleNcpChildrenCommand)1 EmberConsoleNcpCountersCommand (com.zsmartsystems.zigbee.console.ember.EmberConsoleNcpCountersCommand)1 EmberConsoleNcpStateCommand (com.zsmartsystems.zigbee.console.ember.EmberConsoleNcpStateCommand)1 EmberConsoleNcpVersionCommand (com.zsmartsystems.zigbee.console.ember.EmberConsoleNcpVersionCommand)1 EmberConsoleNetworkStateCommand (com.zsmartsystems.zigbee.console.ember.EmberConsoleNetworkStateCommand)1 EmberConsoleSecurityStateCommand (com.zsmartsystems.zigbee.console.ember.EmberConsoleSecurityStateCommand)1 ZigBeeDongleTiCc2531 (com.zsmartsystems.zigbee.dongle.cc2531.ZigBeeDongleTiCc2531)1 ZigBeeDongleConBee (com.zsmartsystems.zigbee.dongle.conbee.ZigBeeDongleConBee)1