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

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

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

ZigBeeNode.getNodeDescriptor介绍

[英]Gets the NodeDescriptor for this node.
[中]获取此节点的NodeDescriptor。

代码示例

代码示例来源: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

out.println("Node Descriptor  : " + node.getNodeDescriptor());
out.println("Power Descriptor : " + node.getPowerDescriptor());
out.println("Associations     : " + node.getAssociatedDevices().toString());

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

properties.put(ZigBeeBindingConstants.THING_PROPERTY_NETWORKADDRESS, node.getNetworkAddress().toString());
properties.put(ZigBeeBindingConstants.THING_PROPERTY_STACKCOMPLIANCE,
    Integer.toString(node.getNodeDescriptor().getStackCompliance()));

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

if (!nodeDescriptor.equals(node.getNodeDescriptor())) {
  updated = true;
  nodeDescriptor = node.getNodeDescriptor();

代码示例来源: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

@Test
public void testAddDescriptors() {
  ZigBeeNode node = new ZigBeeNode(Mockito.mock(ZigBeeNetworkManager.class), new IeeeAddress());
  // Not null by default
  assertNotNull(node.getNodeDescriptor());
  assertNotNull(node.getPowerDescriptor());
  node.setPowerDescriptor(null);
  assertEquals(null, node.getPowerDescriptor());
  node.setNodeDescriptor(null);
  assertEquals(null, node.getPowerDescriptor());
  System.out.println(node.toString());
}

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

Mockito.when(node.getNodeDescriptor()).thenReturn(initialNodeDescriptor);

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

@Test
public void testDeviceTypes() {
  ZigBeeNode node = new ZigBeeNode(Mockito.mock(ZigBeeNetworkManager.class), new IeeeAddress());
  assertFalse(node.isFullFuntionDevice());
  assertFalse(node.isReducedFuntionDevice());
  assertFalse(node.isPrimaryTrustCenter());
  assertFalse(node.isSecurityCapable());
  assertEquals(LogicalType.UNKNOWN, node.getLogicalType());
  NodeDescriptor nodeDescriptor = new NodeDescriptor();
  node.setNodeDescriptor(nodeDescriptor);
  assertFalse(node.isFullFuntionDevice());
  assertFalse(node.isReducedFuntionDevice());
  assertFalse(node.isPrimaryTrustCenter());
  assertFalse(node.isSecurityCapable());
  nodeDescriptor = new NodeDescriptor(0, 0, 0xff, false, 0, 0, 0xff, 0, false, 0);
  node.setNodeDescriptor(nodeDescriptor);
  assertNotNull(node.getNodeDescriptor());
  assertTrue(node.isFullFuntionDevice());
  assertFalse(node.isReducedFuntionDevice());
  assertTrue(node.isPrimaryTrustCenter());
  assertTrue(node.isSecurityCapable());
  nodeDescriptor = new NodeDescriptor(0, 0, 0x00, false, 0, 0, 0xff, 0, false, 0);
  node.setNodeDescriptor(nodeDescriptor);
  assertFalse(node.isFullFuntionDevice());
  assertTrue(node.isReducedFuntionDevice());
  assertEquals(LogicalType.COORDINATOR, node.getLogicalType());
}

相关文章