gpt4 book ai didi

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

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

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

ZigBeeEndpoint.getEndpointId介绍

[英]Gets end point.
[中]得到终点。

代码示例

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

/**
 * Creates a set of properties, adding the standard properties required by the system.
 * Channel converters may add additional properties prior to creating the channel.
 *
 * @param endpoint the {@link ZigBeeEndpoint}
 * @return an initial properties map
 */
protected Map<String, String> createProperties(ZigBeeEndpoint endpoint) {
  Map<String, String> properties = new HashMap<String, String>();
  properties.put(ZigBeeBindingConstants.CHANNEL_PROPERTY_ENDPOINT, Integer.toString(endpoint.getEndpointId()));
  return properties;
}

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

/**
 * Adds an endpoint to the node
 *
 * @param endpoint the {@link ZigBeeEndpoint} to add
 */
public void addEndpoint(final ZigBeeEndpoint endpoint) {
  synchronized (endpoints) {
    endpoints.put(endpoint.getEndpointId(), endpoint);
  }
  synchronized (this) {
    for (final ZigBeeNetworkEndpointListener listener : endpointListeners) {
      NotificationService.execute(new Runnable() {
        @Override
        public void run() {
          listener.deviceAdded(endpoint);
        }
      });
    }
  }
}

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

/**
 * Updates an endpoint information in the node
 *
 * @param endpoint the {@link ZigBeeEndpoint} to update
 */
public void updateEndpoint(final ZigBeeEndpoint endpoint) {
  synchronized (endpoints) {
    endpoints.put(endpoint.getEndpointId(), endpoint);
  }
  synchronized (this) {
    for (final ZigBeeNetworkEndpointListener listener : endpointListeners) {
      NotificationService.execute(new Runnable() {
        @Override
        public void run() {
          listener.deviceUpdated(endpoint);
        }
      });
    }
  }
}

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

/**
 * Creates a standard channel UID given the {@link ZigBeeEndpoint}
 *
 * @param thingUID the {@link ThingUID}
 * @param endpoint the {@link ZigBeeEndpoint}
 * @param channelName the name of the channel
 * @return
 */
protected ChannelUID createChannelUID(ThingUID thingUID, ZigBeeEndpoint endpoint, String channelName) {
  return new ChannelUID(thingUID, endpoint.getIeeeAddress() + "_" + endpoint.getEndpointId() + "_" + channelName);
}

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

/**
 * 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

endpointIds.add(endpoint.getEndpointId());
for (Integer endpointId : endpointIds) {
  ZigBeeEndpoint endpoint = node.getEndpoint(endpointId);
  out.print(String.format("            %-3d  : ", endpoint.getEndpointId()));
  outputEndpoint(out, endpoint);

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

private void createEndpoint() {
  endpoint = Mockito.mock(ZigBeeEndpoint.class);
  Mockito.when(endpoint.getEndpointId()).thenReturn(5);
  Mockito.when(endpoint.getEndpointAddress()).thenReturn(new ZigBeeEndpointAddress(1234, 5));
  commandCapture = ArgumentCaptor.forClass(ZigBeeCommand.class);
  matcherCapture = ArgumentCaptor.forClass(ZigBeeTransactionMatcher.class);
  Mockito.when(endpoint.sendTransaction(commandCapture.capture(), matcherCapture.capture())).thenReturn(null);
}

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

List<Integer> endpointIds = new ArrayList<Integer>();
for (final ZigBeeEndpoint endpoint : node.getEndpoints()) {
  endpointIds.add(endpoint.getEndpointId());
  out.println(String.format("%-3d  %-25s  %s", endpoint.getEndpointId(),
      ZigBeeProfileType.getByValue(endpoint.getProfileId()),
      ZigBeeDeviceType.getByValue(endpoint.getDeviceId())));

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

@Override
public void process(ZigBeeNetworkManager networkManager, String[] args, PrintStream out)
    throws IllegalArgumentException {
  if (args.length != 2) {
    throw new IllegalArgumentException("Invalid number of arguments");
  }
  final ZigBeeEndpoint endpoint = getEndpoint(networkManager, args[1]);
  ZigBeeProfileType profile = ZigBeeProfileType.getByValue(endpoint.getProfileId());
  ZigBeeDeviceType device = ZigBeeDeviceType.getByValue(endpoint.getDeviceId());
  out.println("IEEE Address     : " + endpoint.getIeeeAddress());
  out.println("Network Address  : " + endpoint.getParentNode().getNetworkAddress());
  out.println("Endpoint         : " + endpoint.getEndpointId());
  out.println("Device Profile   : " + String.format("0x%04X, ", endpoint.getProfileId())
      + (profile == null ? "Unknown" : profile.toString()));
  out.println("Device Type      : " + String.format("0x%04X, ", endpoint.getDeviceId())
      + (device == null ? "Unknown" : device.toString()));
  out.println("Device Version   : " + endpoint.getDeviceVersion());
  out.println("Input Clusters   : (Server)");
  printClusters(endpoint, true, out);
  out.println("Output Clusters  : (Client)");
  printClusters(endpoint, false, out);
}

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

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

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

@Override
  public void process(ZigBeeNetworkManager networkManager, String[] args, PrintStream out)
      throws IllegalArgumentException, InterruptedException, ExecutionException {
    if (args.length < 3 || args.length > 4) {
      throw new IllegalArgumentException("Invalid number of arguments");
    }

    String clusterSpecParam = args[1];
    String sourceEndpointParam = args[2];
    String destEndpointParam = (args.length == 4) ? args[3] : null;

    final ZigBeeEndpoint sourceEndpoint = getEndpoint(networkManager, sourceEndpointParam);
    ZclCluster cluster = getCluster(sourceEndpoint, clusterSpecParam);

    IeeeAddress destAddress;
    int destEndpoint;
    if (destEndpointParam != null) {
      ZigBeeEndpoint destination = getEndpoint(networkManager, destEndpointParam);
      destAddress = destination.getIeeeAddress();
      destEndpoint = destination.getEndpointId();
    } else {
      destAddress = networkManager.getNode(0).getIeeeAddress();
      destEndpoint = 1;
    }

    final CommandResult response = cluster.bind(destAddress, destEndpoint).get();
    processDefaultResponse(response, out);
  }
}

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

@Override
  public void process(ZigBeeNetworkManager networkManager, String[] args, PrintStream out)
      throws IllegalArgumentException, InterruptedException, ExecutionException {
    if (args.length < 3 || args.length > 4) {
      throw new IllegalArgumentException("Invalid number of arguments");
    }

    String clusterSpecParam = args[1];
    String sourceEndpointParam = args[2];
    String destEndpointParam = (args.length == 4) ? args[3] : null;

    final ZigBeeEndpoint sourceEndpoint = getEndpoint(networkManager, sourceEndpointParam);
    ZclCluster cluster = getCluster(sourceEndpoint, clusterSpecParam);

    IeeeAddress destAddress;
    int destEndpoint;
    if (destEndpointParam != null) {
      ZigBeeEndpoint destination = getEndpoint(networkManager, destEndpointParam);
      destAddress = destination.getIeeeAddress();
      destEndpoint = destination.getEndpointId();
    } else {
      destAddress = networkManager.getNode(0).getIeeeAddress();
      destEndpoint = 1;
    }

    final CommandResult response = cluster.unbind(destAddress, destEndpoint).get();
    processDefaultResponse(response, out);
  }
}

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

public void setDao(ZigBeeNodeDao dao) {
  ieeeAddress = new IeeeAddress(dao.getIeeeAddress());
  networkAddress = dao.getNetworkAddress();
  nodeDescriptor = dao.getNodeDescriptor();
  powerDescriptor = dao.getPowerDescriptor();
  if (dao.getBindingTable() != null) {
    bindingTable.addAll(dao.getBindingTable());
  }
  for (ZigBeeEndpointDao endpointDao : dao.getEndpoints()) {
    ZigBeeEndpoint endpoint = new ZigBeeEndpoint(this, endpointDao.getEndpointId());
    endpoint.setDao(endpointDao);
    endpoints.put(endpoint.getEndpointId(), endpoint);
  }
}

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

@Override
public Channel getChannel(ThingUID thingUID, ZigBeeEndpoint endpoint) {
  ZclPowerConfigurationCluster powerConfigurationCluster = (ZclPowerConfigurationCluster) endpoint
      .getInputCluster(ZclPowerConfigurationCluster.CLUSTER_ID);
  if (powerConfigurationCluster == null) {
    logger.trace("{}: Power configuration cluster not found on endpoint {}", endpoint.getIeeeAddress(),
        endpoint.getEndpointId());
    return null;
  }
  try {
    if (!powerConfigurationCluster.discoverAttributes(false).get() && !powerConfigurationCluster
        .isAttributeSupported(ZclPowerConfigurationCluster.ATTR_BATTERYALARMSTATE)) {
      logger.trace("{}: Power configuration cluster battery alarm state not supported",
          endpoint.getIeeeAddress());
      return null;
    }
  } catch (InterruptedException | ExecutionException e) {
    logger.warn("{}: Exception discovering attributes in power configuration cluster",
        endpoint.getIeeeAddress(), e);
    return null;
  }
  return ChannelBuilder
      .create(createChannelUID(thingUID, endpoint, ZigBeeBindingConstants.CHANNEL_NAME_POWER_BATTERYALARM),
          ZigBeeBindingConstants.ITEM_TYPE_STRING)
      .withType(ZigBeeBindingConstants.CHANNEL_POWER_BATTERYALARM)
      .withLabel(ZigBeeBindingConstants.CHANNEL_LABEL_POWER_BATTERYALARM)
      .withProperties(createProperties(endpoint)).build();
}

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

@Override
public void attributeUpdated(ZclAttribute attribute) {
  logger.debug("{}: ZigBee attribute reports {}  on endpoint {}", endpoint.getIeeeAddress(), attribute,
      endpoint.getEndpointId());
  if (attribute.getCluster() == ZclClusterType.COLOR_CONTROL
      && attribute.getId() == ZclColorControlCluster.ATTR_COLORTEMPERATURE) {
    if (lastColorMode == null || lastColorMode == ColorModeEnum.COLORTEMPERATURE) {
      Integer temperatureInMired = (Integer) attribute.getLastValue();
      PercentType percent = miredToPercent(temperatureInMired);
      if (percent != null) {
        updateChannelState(percent);
      }
    }
  } else if (attribute.getCluster() == ZclClusterType.COLOR_CONTROL
      && attribute.getId() == ZclColorControlCluster.ATTR_COLORMODE) {
    Integer colorMode = (Integer) attribute.getLastValue();
    lastColorMode = ColorModeEnum.getByValue(colorMode);
    if (lastColorMode != ColorModeEnum.COLORTEMPERATURE) {
      updateChannelState(UnDefType.UNDEF);
    }
  }
}

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

if (clusterColorControl == null) {
  logger.error("{}: Error opening color control input cluster on endpoint {}", endpoint.getIeeeAddress(),
      endpoint.getEndpointId());
  return false;

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

/**
 * Adds a binding from the cluster to the destination {@link ZigBeeEndpoint}.
 *
 * @param address the destination {@link IeeeAddress}
 * @param endpointId the destination endpoint ID
 * @return Command future
 */
public Future<CommandResult> bind(IeeeAddress address, int endpointId) {
  final BindRequest command = new BindRequest();
  command.setDestinationAddress(new ZigBeeEndpointAddress(zigbeeEndpoint.getEndpointAddress().getAddress()));
  command.setSrcAddress(zigbeeEndpoint.getIeeeAddress());
  command.setSrcEndpoint(zigbeeEndpoint.getEndpointId());
  command.setBindCluster(clusterId);
  command.setDstAddrMode(3); // 64 bit addressing
  command.setDstAddress(address);
  command.setDstEndpoint(endpointId);
  return zigbeeEndpoint.sendTransaction(command, new BindRequest());
}

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

/**
 * Removes a binding from the cluster to the destination {@link ZigBeeEndpoint}.
 *
 * @param address the destination {@link IeeeAddress}
 * @param endpointId the destination endpoint ID
 * @return Command future
 */
public Future<CommandResult> unbind(IeeeAddress address, int endpointId) {
  final UnbindRequest command = new UnbindRequest();
  command.setDestinationAddress(new ZigBeeEndpointAddress(zigbeeEndpoint.getEndpointAddress().getAddress()));
  command.setSrcAddress(zigbeeEndpoint.getIeeeAddress());
  command.setSrcEndpoint(zigbeeEndpoint.getEndpointId());
  command.setBindCluster(clusterId);
  command.setDstAddrMode(3); // 64 bit addressing
  command.setDstAddress(address);
  command.setDstEndpoint(endpointId);
  return zigbeeEndpoint.sendTransaction(command, new UnbindRequest());
}

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