Search in sources :

Example 1 with ScanResult

use of com.zsmartsystems.zigbee.dongle.telegesis.internal.protocol.TelegesisActiveScanCommand.ScanResult 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)

Aggregations

ExtendedPanId (com.zsmartsystems.zigbee.ExtendedPanId)1 ScanResult (com.zsmartsystems.zigbee.dongle.telegesis.internal.protocol.TelegesisActiveScanCommand.ScanResult)1 Test (org.junit.Test)1