gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-16 07:37:31 28 4
gpt4 key购买 nike

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

ZigBeeEndpoint.getOutputCluster介绍

[英]Gets an output cluster
[中]获取一个输出集群

代码示例

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

/**
 * Gets a cluster from the input or output cluster list depending on the command {@link ZclCommandDirection} for a
 * received command.
 * <p>
 * If commandDirection is {@link ZclCommandDirection#CLIENT_TO_SERVER} then the cluster comes from the output
 * cluster list.
 * If commandDirection is {@link ZclCommandDirection#SERVER_TO_CLIENT} then the cluster comes from the input
 * cluster list.
 *
 * @param clusterId the cluster ID to get
 * @param direction the {@link ZclCommandDirection}
 * @return the {@link ZclCluster} or null if the cluster is not known
 */
private ZclCluster getReceiveCluster(int clusterId, ZclCommandDirection direction) {
  if (direction == ZclCommandDirection.CLIENT_TO_SERVER) {
    return getOutputCluster(clusterId);
  } else {
    return getInputCluster(clusterId);
  }
}

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

public List<ZclClusterConfigHandler> getConfigHandlers(ZigBeeEndpoint endpoint) {
  List<ZclClusterConfigHandler> handlers = new ArrayList<>();
  for (int clusterId : endpoint.getInputClusterIds()) {
    try {
      ZclClusterConfigHandler handler = getClusterConfigHandler(endpoint.getInputCluster(clusterId));
      if (handler != null) {
        handlers.add(handler);
      }
    } catch (InstantiationException | IllegalAccessException | IllegalArgumentException
        | InvocationTargetException | NoSuchMethodException | SecurityException e) {
      logger.debug("{}: Exception while getting config for input cluster {}: ", endpoint.getIeeeAddress(),
          clusterId, e);
    }
  }
  for (int clusterId : endpoint.getOutputClusterIds()) {
    try {
      ZclClusterConfigHandler handler = getClusterConfigHandler(endpoint.getOutputCluster(clusterId));
      if (handler != null) {
        handlers.add(handler);
      }
    } catch (InstantiationException | IllegalAccessException | IllegalArgumentException
        | InvocationTargetException | NoSuchMethodException | SecurityException e) {
      logger.debug("{}: Exception while getting config for output cluster {}: ", endpoint.getIeeeAddress(),
          clusterId, e);
    }
  }
  return handlers;
}

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

private void printClusters(final ZigBeeEndpoint endpoint, final boolean input, final PrintStream out) {
  Collection<Integer> clusters;
  if (input) {
    clusters = endpoint.getInputClusterIds();
  } else {
    clusters = endpoint.getOutputClusterIds();
  }
  Map<Integer, ZclCluster> clusterTree = new TreeMap<Integer, ZclCluster>();
  for (Integer clusterId : clusters) {
    ZclCluster cluster;
    if (input) {
      cluster = endpoint.getInputCluster(clusterId);
    } else {
      cluster = endpoint.getOutputCluster(clusterId);
    }
    clusterTree.put(cluster.getClusterId(), cluster);
  }
  for (ZclCluster cluster : clusterTree.values()) {
    out.println("   " + printClusterId(cluster.getClusterId()) + " " + cluster.getClusterName());
    printAttributes(cluster, out);
  }
}

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

result = endpoint.getInputCluster(clusterId);
} else if (isOutput) {
  result = endpoint.getOutputCluster(clusterId);
} else {
  ZclCluster cluster = endpoint.getInputCluster(clusterId);
  result = (cluster != null) ? cluster : endpoint.getOutputCluster(clusterId);

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

@Test
public void testOutputClusterIds() {
  ZigBeeEndpoint endpoint = getEndpoint();
  List<Integer> clusterIdList = new ArrayList<Integer>();
  clusterIdList.add(ZclAlarmsCluster.CLUSTER_ID);
  clusterIdList.add(ZclBasicCluster.CLUSTER_ID);
  clusterIdList.add(ZclColorControlCluster.CLUSTER_ID);
  clusterIdList.add(ZclDoorLockCluster.CLUSTER_ID);
  clusterIdList.add(ZclLevelControlCluster.CLUSTER_ID);
  endpoint.setOutputClusterIds(clusterIdList);
  assertEquals(5, endpoint.getOutputClusterIds().size());
  assertNotNull(endpoint.getOutputCluster(ZclAlarmsCluster.CLUSTER_ID));
  assertTrue(endpoint.getOutputCluster(ZclAlarmsCluster.CLUSTER_ID).isClient());
  assertFalse(endpoint.getOutputCluster(ZclAlarmsCluster.CLUSTER_ID).isServer());
  assertNotNull(endpoint.getOutputCluster(ZclLevelControlCluster.CLUSTER_ID));
  assertTrue(endpoint.getOutputCluster(ZclLevelControlCluster.CLUSTER_ID).isClient());
  assertFalse(endpoint.getOutputCluster(ZclLevelControlCluster.CLUSTER_ID).isServer());
  clusterIdList = new ArrayList<Integer>();
  clusterIdList.add(ZclAlarmsCluster.CLUSTER_ID);
  clusterIdList.add(ZclBasicCluster.CLUSTER_ID);
  assertTrue(endpoint.getOutputCluster(ZclAlarmsCluster.CLUSTER_ID).isClient());
  assertFalse(endpoint.getOutputCluster(ZclLevelControlCluster.CLUSTER_ID).isServer());
  assertTrue(endpoint.addOutputCluster(new ZclScenesCluster(endpoint)));
  assertFalse(endpoint.addOutputCluster(new ZclScenesCluster(endpoint)));
  assertTrue(endpoint.getOutputClusterIds().contains(ZclScenesCluster.CLUSTER_ID));
  assertTrue(endpoint.getInputClusterIds().isEmpty());
  System.out.println(endpoint.toString());
}

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

@Override
public boolean initializeConverter() {
  clusterOnOffClient = (ZclOnOffCluster) endpoint.getOutputCluster(ZclOnOffCluster.CLUSTER_ID);
  clusterOnOffServer = (ZclOnOffCluster) endpoint.getInputCluster(ZclOnOffCluster.CLUSTER_ID);
  if (clusterOnOffClient == null && clusterOnOffServer == null) {
    logger.error("{}: Error opening device on/off controls", endpoint.getIeeeAddress());
    return false;
  }
  if (clusterOnOffServer != null) {
    // Add the listener
    clusterOnOffServer.addAttributeListener(this);
  }
  if (clusterOnOffClient != null) {
    // Add the command listener
    clusterOnOffClient.addCommandListener(this);
  }
  return true;
}

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

ZclCluster clientCluster = endpoint.getOutputCluster(clusterId);
if (clientCluster == null) {
  logger.error("{}: Error opening client cluster {} on endpoint {}", endpoint.getIeeeAddress(), clusterId,

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

cluster = endpoint.getInputCluster(clusterId);
} else {
  cluster = endpoint.getOutputCluster(clusterId);

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

@Override
public boolean initializeDevice() {
  ZclOnOffCluster clientCluster = (ZclOnOffCluster) endpoint.getOutputCluster(ZclOnOffCluster.CLUSTER_ID);
  ZclOnOffCluster serverCluster = (ZclOnOffCluster) endpoint.getInputCluster(ZclOnOffCluster.CLUSTER_ID);
  if (clientCluster == null && serverCluster == null) {

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

otaCluster = (ZclOtaUpgradeCluster) endpoint.getOutputCluster(ZclOtaUpgradeCluster.CLUSTER_ID);
if (otaCluster != null) {
  break;

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

@Override
public Channel getChannel(ThingUID thingUID, ZigBeeEndpoint endpoint) {
  if (endpoint.getInputCluster(ZclOnOffCluster.CLUSTER_ID) == null
      && endpoint.getOutputCluster(ZclOnOffCluster.CLUSTER_ID) == null) {
    logger.trace("{}: OnOff cluster not found", endpoint.getIeeeAddress());
    return null;
  }
  return ChannelBuilder
      .create(createChannelUID(thingUID, endpoint, ZigBeeBindingConstants.CHANNEL_NAME_SWITCH_ONOFF),
          ZigBeeBindingConstants.ITEM_TYPE_SWITCH)
      .withType(ZigBeeBindingConstants.CHANNEL_SWITCH_ONOFF)
      .withLabel(ZigBeeBindingConstants.CHANNEL_LABEL_SWITCH_ONOFF).withProperties(createProperties(endpoint))
      .build();
}

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

if (endpoint.getOutputCluster(ZclOtaUpgradeCluster.CLUSTER_ID) != null) {
  otaEndpoint = endpoint;
  break;

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