com.zsmartsystems.zigbee.ZigBeeBroadcastDestination.getKey()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(75)

本文整理了Java中com.zsmartsystems.zigbee.ZigBeeBroadcastDestination.getKey()方法的一些代码示例,展示了ZigBeeBroadcastDestination.getKey()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZigBeeBroadcastDestination.getKey()方法的具体详情如下:
包路径:com.zsmartsystems.zigbee.ZigBeeBroadcastDestination
类名称:ZigBeeBroadcastDestination
方法名:getKey

ZigBeeBroadcastDestination.getKey介绍

暂无

代码示例

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

/**
   * Tests the supplied address to determine if it is a broadcast address
   *
   * @param address the address to test
   * @return true if the address is in the broadcast address range
   */
  public static boolean isBroadcast(int address) {
    return (address >= BROADCAST_RESERVED_FFF8.getKey() && address <= BROADCAST_ALL_DEVICES.getKey());
  }
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

/**
 * Enables or disables devices to join the whole network.
 * <p>
 * Devices can only join the network when joining is enabled. It is not advised to leave joining enabled permanently
 * since it allows devices to join the network without the installer knowing.
 *
 * @param duration sets the duration of the join enable. Setting this to 0 disables joining. As per ZigBee 3, a
 *            value of 255 is not permitted and will be ignored.
 * @return {@link ZigBeeStatus} with the status of function
 */
public ZigBeeStatus permitJoin(final int duration) {
  return permitJoin(new ZigBeeEndpointAddress(ZigBeeBroadcastDestination.BROADCAST_ROUTERS_AND_COORD.getKey()),
      duration);
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

request.setStartIndex(0);
request.setDestinationAddress(
    new ZigBeeEndpointAddress(ZigBeeBroadcastDestination.BROADCAST_RX_ON.getKey()));
CommandResult response;
response = networkManager.sendTransaction(request, request).get();

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

/**
 * Get node descriptor
 *
 * @return true if the message was processed ok
 * @throws ExecutionException
 * @throws InterruptedException
 */
private boolean requestNetworkAddress() throws InterruptedException, ExecutionException {
  NetworkAddressRequest networkAddressRequest = new NetworkAddressRequest();
  networkAddressRequest.setIeeeAddr(node.getIeeeAddress());
  networkAddressRequest.setRequestType(0);
  networkAddressRequest.setStartIndex(0);
  networkAddressRequest.setDestinationAddress(
      new ZigBeeEndpointAddress(ZigBeeBroadcastDestination.BROADCAST_ALL_DEVICES.getKey()));
  CommandResult response = networkManager.sendTransaction(networkAddressRequest, networkAddressRequest).get();
  final NetworkAddressResponse networkAddressResponse = (NetworkAddressResponse) response.getResponse();
  logger.debug("{}: Node SVC Discovery: NetworkAddressRequest returned {}", node.getNetworkAddress(),
      networkAddressResponse);
  if (networkAddressResponse == null) {
    return false;
  }
  if (networkAddressResponse.getStatus() == ZdoStatus.SUCCESS) {
    node.setNetworkAddress(networkAddressResponse.getNwkAddrRemoteDev());
    return true;
  }
  return false;
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

@Test
  public void getDestination() {
    ZigBeeBroadcastDestination destination = ZigBeeBroadcastDestination.getBroadcastDestination(0);
    assertEquals(null, destination);

    destination = ZigBeeBroadcastDestination.getBroadcastDestination(0xFFFC);
    assertEquals(ZigBeeBroadcastDestination.BROADCAST_ROUTERS_AND_COORD, destination);

    destination = ZigBeeBroadcastDestination.getBroadcastDestination(0xFFFB);
    assertEquals(ZigBeeBroadcastDestination.BROADCAST_LOW_POWER_ROUTERS, destination);

    assertEquals(0xFFFF, ZigBeeBroadcastDestination.BROADCAST_ALL_DEVICES.getKey());

    assertTrue(ZigBeeBroadcastDestination.isBroadcast(0xfff8));
    assertTrue(ZigBeeBroadcastDestination.isBroadcast(0xffff));
    assertFalse(ZigBeeBroadcastDestination.isBroadcast(0xfff7));
    assertFalse(ZigBeeBroadcastDestination.isBroadcast(0x10000));
  }
}

相关文章