gpt4 book ai didi

com.zsmartsystems.zigbee.app.discovery.ZigBeeNodeServiceDiscoverer.startDiscovery()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 06:37:31 26 4
gpt4 key购买 nike

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

ZigBeeNodeServiceDiscoverer.startDiscovery介绍

[英]Starts service discovery for the node.
[中]

代码示例

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

protected void startDiscovery(ZigBeeNode node) {
  ZigBeeNodeServiceDiscoverer nodeDiscoverer = new ZigBeeNodeServiceDiscoverer(networkManager, node);
  nodeDiscovery.put(node.getIeeeAddress(), nodeDiscoverer);
  nodeDiscoverer.startDiscovery();
}

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

/**
 * Starts service discovery for the node in order to update the mesh. This adds the
 * {@link NodeDiscoveryTask#NEIGHBORS} and {@link NodeDiscoveryTask#ROUTES} tasks to the task list.
 * <p>
 * Note that {@link NodeDiscoveryTask#ROUTES} is not added for end devices.
 */
public void updateMesh() {
  logger.debug("{}: Node SVC Discovery: Update mesh", node.getIeeeAddress());
  Set<NodeDiscoveryTask> tasks = new HashSet<NodeDiscoveryTask>();
  tasks.add(NodeDiscoveryTask.NEIGHBORS);
  if (node.getNodeDescriptor().getLogicalType() != LogicalType.END_DEVICE) {
    tasks.add(NodeDiscoveryTask.ROUTES);
  }
  startDiscovery(tasks);
}

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

/**
 * Starts service discovery for the node.
 */
public void startDiscovery() {
  logger.debug("{}: Node SVC Discovery: start discovery", node.getIeeeAddress());
  Set<NodeDiscoveryTask> tasks = new HashSet<NodeDiscoveryTask>();
  // Always request the network address - in case it's changed
  tasks.add(NodeDiscoveryTask.NWK_ADDRESS);
  if (node.getNodeDescriptor().getLogicalType() == LogicalType.UNKNOWN) {
    tasks.add(NodeDiscoveryTask.NODE_DESCRIPTOR);
  }
  if (node.getPowerDescriptor().getCurrentPowerMode() == CurrentPowerModeType.UNKNOWN) {
    tasks.add(NodeDiscoveryTask.POWER_DESCRIPTOR);
  }
  if (node.getEndpoints().size() == 0 && node.getNetworkAddress() != networkManager.getLocalNwkAddress()) {
    tasks.add(NodeDiscoveryTask.ACTIVE_ENDPOINTS);
  }
  tasks.add(NodeDiscoveryTask.NEIGHBORS);
  startDiscovery(tasks);
}

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

@Test
  public void testLocal() throws Exception {
    ZigBeeNode node = Mockito.mock(ZigBeeNode.class);
    ZigBeeNodeServiceDiscoverer discoverer = new ZigBeeNodeServiceDiscoverer(networkManager, node);

    TestUtilities.setField(ZigBeeNodeServiceDiscoverer.class, discoverer, "retryPeriod", 1);

    NodeDescriptor initialNodeDescriptor = Mockito.mock(NodeDescriptor.class);
    Mockito.when(initialNodeDescriptor.getLogicalType()).thenReturn(LogicalType.UNKNOWN);
    Mockito.when(node.getNodeDescriptor()).thenReturn(initialNodeDescriptor);

    PowerDescriptor initialPowerDescriptor = Mockito.mock(PowerDescriptor.class);
    Mockito.when(initialPowerDescriptor.getCurrentPowerMode()).thenReturn(CurrentPowerModeType.UNKNOWN);
    Mockito.when(node.getPowerDescriptor()).thenReturn(initialPowerDescriptor);

    // Use node 0 and we should not try and get the local endpoints
    Mockito.when(node.getNetworkAddress()).thenReturn(0);

    ScheduledFuture<?> futureTask = Mockito.mock(ScheduledFuture.class);
    TestUtilities.setField(ZigBeeNodeServiceDiscoverer.class, discoverer, "futureTask", futureTask);

    discoverer.startDiscovery();

    Mockito.verify(futureTask, Mockito.times(1)).cancel(true);

    assertFalse(discoverer.getTasks().contains(NodeDiscoveryTask.ACTIVE_ENDPOINTS));
  }
}

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

break;
case "start":
  discoverer.startDiscovery();
  out.println("Discovery for " + node.getIeeeAddress().toString() + " has been started.");
  return;

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

responses.put(ZdoCommandType.MANAGEMENT_ROUTING_REQUEST.getClusterId(), routingResponse);
discoverer.startDiscovery();

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