gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-15 20:27:31 28 4
gpt4 key购买 nike

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

ZigBeeNode.getEndpoints介绍

[英]Gets the a Collection of ZigBeeEndpoints this node provides
[中]获取此节点提供的ZigBeeEndpoints集合

代码示例

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

public Collection<ZigBeeEndpoint> getNodeEndpoints(IeeeAddress nodeIeeeAddress) {
  if (networkManager == null) {
    return Collections.<ZigBeeEndpoint> emptySet();
  }
  ZigBeeNode node = networkManager.getNode(nodeIeeeAddress);
  if (node == null) {
    return Collections.<ZigBeeEndpoint> emptySet();
  }
  return node.getEndpoints();
}

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

private Map<Integer, ZigBeeEndpoint> getApplications(ZigBeeNetworkManager networkManager, int clusterId) {
    Map<Integer, ZigBeeEndpoint> applications = new TreeMap<>();

    for (ZigBeeNode node : networkManager.getNodes()) {
      for (ZigBeeEndpoint endpoint : node.getEndpoints()) {
        ZigBeeApplication application = endpoint.getApplication(clusterId);
        if (application != null) {
          applications.put(endpoint.getEndpointId(), endpoint);
        }
      }
    }

    return applications;
  }
}

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

/**
 * Gets {@link ZigBeeEndpoint} by device identifier.
 *
 * @param networkManager the {@link ZigBeeNetworkManager}
 * @param endpointId the device identifier
 * @return the {@link ZigBeeEndpoint}
 * @throws IllegalArgumentException
 */
protected ZigBeeEndpoint getEndpoint(final ZigBeeNetworkManager networkManager, final String endpointId)
    throws IllegalArgumentException {
  for (final ZigBeeNode node : networkManager.getNodes()) {
    for (final ZigBeeEndpoint endpoint : node.getEndpoints()) {
      if (endpointId.equals(node.getNetworkAddress() + "/" + endpoint.getEndpointId())) {
        return endpoint;
      }
    }
  }
  throw new IllegalArgumentException("Endpoint '" + endpointId + "' is not found");
}

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

@Override
public void nodeAdded(ZigBeeNode node) {
  for (ZigBeeEndpoint endpoint : node.getEndpoints()) {
    if (endpoint.getOutputCluster(ZclOtaUpgradeCluster.CLUSTER_ID) != null) {
      endpoint.addApplication(new ZclOtaUpgradeServer());
      break;
    }
  }
}

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

/**
 * Gets device by device identifier.
 *
 * @param zigbeeApi the ZigBee API
 * @param deviceIdentifier the device identifier
 * @return the device
 */
private ZigBeeEndpoint getDevice(ZigBeeApi zigbeeApi, final String deviceIdentifier) {
  for (final ZigBeeNode node : networkManager.getNodes()) {
    for (final ZigBeeEndpoint endpoint : node.getEndpoints()) {
      if (deviceIdentifier.equals(node.getNetworkAddress() + "/" + endpoint.getEndpointId())) {
        return endpoint;
      }
    }
  }
  return null;
}

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

for (final ZigBeeEndpoint endpoint : node.getEndpoints()) {
  endpointIds.add(endpoint.getEndpointId());

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

node.getIeeeAddress(), node.getLogicalType()));
List<Integer> endpointIds = new ArrayList<Integer>();
for (final ZigBeeEndpoint endpoint : node.getEndpoints()) {
  endpointIds.add(endpoint.getEndpointId());

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

@Override
public void nodeAdded(ZigBeeNode node) {
  for (ZigBeeEndpoint endpoint : node.getEndpoints()) {
    if (endpoint.getInputCluster(ZclIasZoneCluster.CLUSTER_ID) != null) {
      endpoint.addApplication(new ZclIasZoneClient(networkManager.getNode(0).getIeeeAddress(), 0));
      break;
    }
  }
}

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

Collection<ZigBeeEndpoint> endpoints = node.getEndpoints();
for (ZigBeeEndpoint endpoint : node.getEndpoints()) {
  otaCluster = (ZclOtaUpgradeCluster) endpoint.getOutputCluster(ZclOtaUpgradeCluster.CLUSTER_ID);
  if (otaCluster != null) {

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

for (ZigBeeEndpoint endpoint : node.getEndpoints()) {
  otaServer = (ZclOtaUpgradeServer) endpoint.getApplication(ZclOtaUpgradeCluster.CLUSTER_ID);
  if (otaServer != null) {

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

@Test
public void isDiscovered() {
  ZigBeeNode node = new ZigBeeNode(Mockito.mock(ZigBeeNetworkManager.class), new IeeeAddress("1234567890"));
  ZigBeeNetworkEndpointListener listener = Mockito.mock(ZigBeeNetworkEndpointListener.class);
  node.addNetworkEndpointListener(listener);
  assertFalse(node.isDiscovered());
  assertNotNull(node.getEndpoints());
  NodeDescriptor descriptor = new NodeDescriptor(0, 3333, 74, true, 6666, 0, 6, 4444, true, 8);
  node.setNodeDescriptor(descriptor);
  assertFalse(node.isDiscovered());
  ZigBeeEndpoint endpoint = new ZigBeeEndpoint(node, 1);
  node.addEndpoint(endpoint);
  assertTrue(node.isDiscovered());
  Mockito.verify(listener, Mockito.timeout(TIMEOUT)).deviceAdded(endpoint);
  assertEquals(endpoint, node.getEndpoint(1));
  assertEquals(1, node.getEndpoints().size());
  node.removeEndpoint(1);
  assertEquals(0, node.getEndpoints().size());
  Mockito.verify(listener, Mockito.timeout(TIMEOUT)).deviceRemoved(endpoint);
  node.removeNetworkEndpointListener(listener);
}

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

@Test
public void testNormal() {
  // Add all the required responses to a list
  IeeeAddressResponse ieeeResponse = new IeeeAddressResponse();
  ieeeResponse.setStatus(ZdoStatus.SUCCESS);
  ieeeResponse.setSourceAddress(new ZigBeeEndpointAddress(0));
  ieeeResponse.setDestinationAddress(new ZigBeeEndpointAddress(0));
  ieeeResponse.setIeeeAddrRemoteDev(new IeeeAddress("1234567890ABCDEF"));
  responses.put(ZdoCommandType.IEEE_ADDRESS_REQUEST.getClusterId(), ieeeResponse);
  ZigBeeNetworkDiscoverer discoverer = new ZigBeeNetworkDiscoverer(networkManager);
  discoverer.setRetryPeriod(1);
  discoverer.startup();
  // Check it registers listeners
  Mockito.verify(networkManager).addCommandListener(discoverer);
  Mockito.verify(networkManager).addAnnounceListener(discoverer);
  // Then wait for the node to be added
  Mockito.verify(networkManager, Mockito.timeout(TIMEOUT).times(1)).addNode(nodeCapture.capture());
  ZigBeeNode node = nodeCapture.getValue();
  assertNotNull(node);
  assertEquals(Integer.valueOf(0), node.getNetworkAddress());
  assertEquals(new IeeeAddress("1234567890ABCDEF"), node.getIeeeAddress());
  assertEquals(0, node.getEndpoints().size());
}

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