gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-14 07:35:31 26 4
gpt4 key购买 nike

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

ZigBeeNetworkManager.permitJoin介绍

[英]Enables or disables devices to join the whole network.

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.
[中]启用或禁用设备以加入整个网络。
只有在启用加入时,设备才能加入网络。不建议永久启用加入,因为它允许设备在安装程序不知道的情况下加入网络。

代码示例

代码示例来源:origin: openhab/org.openhab.binding.zigbee

/**
 * Stops an active scan on the ZigBee coordinator
 */
public void scanStop() {
  networkManager.permitJoin(0);
}

代码示例来源:origin: openhab/org.openhab.binding.zigbee

public void startDeviceDiscovery() {
  // Allow devices to join for 60 seconds
  networkManager.permitJoin(60);
}

代码示例来源: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: openhab/org.openhab.binding.zigbee

/**
 * Permit joining only for the specified node
 *
 * @param address the 16 bit network address of the node to enable joining
 * @param duration the duration of the join
 */
public boolean permitJoin(IeeeAddress address, int duration) {
  logger.debug("{}: ZigBee join command", address);
  ZigBeeNode node = networkManager.getNode(address);
  if (node == null) {
    logger.debug("{}: ZigBee join command - node not found", address);
    return false;
  }
  logger.debug("{}: ZigBee join command to {}", address, node.getNetworkAddress());
  networkManager.permitJoin(new ZigBeeEndpointAddress(node.getNetworkAddress()), duration);
  return true;
}

代码示例来源:origin: openhab/org.openhab.binding.zigbee

/**
 * Starts an active scan on the ZigBee coordinator.
 */
public void scanStart() {
  if (getThing().getStatus() != ThingStatus.ONLINE) {
    logger.debug("ZigBee coordinator is offline - aborted scan for {}", getThing().getUID());
    return;
  }
  networkManager.permitJoin(60);
}

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

networkManager.permitJoin(join);
if (join != 0) {
  out.println("Permit join enable broadcast success.");

代码示例来源:origin: openhab/org.openhab.binding.zigbee

/**
 * Sends a ZDO Leave Request to a device requesting that an end device leave the network.
 * <p>
 * This method will send the ZDO message to the device itself requesting it leave the network
 *
 * @param address the network address to leave
 * @return true if the command is sent
 */
public boolean leave(IeeeAddress address) {
  // First we want to make sure that join is disabled
  networkManager.permitJoin(0);
  logger.debug("{}: ZigBee leave command", address);
  ZigBeeNode node = networkManager.getNode(address);
  if (node == null) {
    logger.debug("{}: ZigBee leave command - node not found", address);
    return false;
  }
  logger.debug("{}: ZigBee leave command to {}", address, node.getNetworkAddress());
  networkManager.leave(node.getNetworkAddress(), node.getIeeeAddress());
  return true;
}

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

@Test
public void testPermitJoin() {
  ZigBeeNetworkManager networkManager = mockZigBeeNetworkManager();
  networkManager.setSerializer(DefaultSerializer.class, DefaultDeserializer.class);
  assertEquals(ZigBeeStatus.SUCCESS, networkManager.permitJoin(0));
  assertEquals(ZigBeeStatus.SUCCESS, networkManager.permitJoin(254));
  assertEquals(ZigBeeStatus.INVALID_ARGUMENTS, networkManager.permitJoin(255));
  // Check that the unicast sends 1 frame
  int start = mockedApsFrameListener.getAllValues().size();
  networkManager.permitJoin(new ZigBeeEndpointAddress(1), 1);
  assertEquals(1, mockedApsFrameListener.getAllValues().size() - start);
  // Check that the broadcast sends 2 frames
  start = mockedApsFrameListener.getAllValues().size();
  networkManager.permitJoin(1);
  assertEquals(2, mockedApsFrameListener.getAllValues().size() - start);
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com