gpt4 book ai didi

com.zsmartsystems.zigbee.ZigBeeAddress类的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 05:13:31 27 4
gpt4 key购买 nike

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

ZigBeeAddress介绍

[英]Defines an abstract ZigBee address. All addresses must provide a 16 bit network address.

Addresses in the range 0x0000 to 0xfff7 are used for node addresses while 0xfff8 to 0xffff are used for broadcast addresses.
[中]定义一个抽象的ZigBee地址。所有地址必须提供16位网络地址。
0x0000到0xfff7范围内的地址用于节点地址,而0xfff8到0xffff范围内的地址用于广播地址。

代码示例

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

break;
case GROUP:
  builder.append(destinationAddress.getAddress());
  break;
case NWK:

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

/**
 * Sends {@link ZclCommand} command to {@link ZigBeeAddress}.
 *
 * @param destination the destination
 * @param command the {@link ZclCommand}
 * @return the command result future
 */
public Future<CommandResult> send(ZigBeeAddress destination, ZclCommand command) {
  command.setDestinationAddress(destination);
  if (destination.isGroup()) {
    return broadcast(command);
  } else {
    final ZigBeeTransactionMatcher responseMatcher = new ZclTransactionMatcher();
    return sendTransaction(command, responseMatcher);
  }
}

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

@Override
public void commandReceived(ZigBeeCommand command) {
  // This gets called for all received commands
  // Check if it's our address
  if (command.getSourceAddress().getAddress() != networkAddress) {
    return;
  }
  if (!(command instanceof ZclCommand)) {
    return;
  }
  logger.trace("{}: ZigBeeEndpoint.commandReceived({})", ieeeAddress, command);
  ZclCommand zclCommand = (ZclCommand) command;
  ZigBeeEndpointAddress endpointAddress = (ZigBeeEndpointAddress) zclCommand.getSourceAddress();
  ZigBeeEndpoint endpoint = endpoints.get(endpointAddress.getEndpoint());
  if (endpoint != null) {
    endpoint.commandReceived(zclCommand);
  }
}

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

Mockito.when(zigbeeAddress.getAddress()).thenReturn(124);
ZigBeeCommand zigbeeCommandInvalidAddressCmd = Mockito.mock(ZigBeeCommand.class);
Mockito.when(zigbeeCommandInvalidAddressCmd.getSourceAddress()).thenReturn(zigbeeAddress);
Mockito.when(zdoSource.getAddress()).thenReturn(12345);
Mockito.when(zdoCommand.getSourceAddress()).thenReturn(zdoSource);
node.commandReceived(zdoCommand);

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

@Override
public void commandReceived(final ZigBeeCommand command) {
  // ZCL command received from remote node. Perform discovery if it is not yet known.
  if (command instanceof ZclCommand) {
    final ZclCommand zclCommand = (ZclCommand) command;
    if (networkManager.getNode(zclCommand.getSourceAddress().getAddress()) == null) {
      // TODO: Protect against group address?
      ZigBeeEndpointAddress address = (ZigBeeEndpointAddress) zclCommand.getSourceAddress();
      startNodeDiscovery(address.getAddress());
    }
    return;
  }
  // Node has been announced.
  if (command instanceof DeviceAnnounce) {
    final DeviceAnnounce announce = (DeviceAnnounce) command;
    logger.debug("{}: Device announce received. NWK={}", announce.getIeeeAddr(),
        announce.getNwkAddrOfInterest());
    addNode(announce.getIeeeAddr(), announce.getNwkAddrOfInterest());
  }
}

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

@Test
  public void testMatcherMatchInOut() {
    ClusterMatcher matcher = getMatcher();
    matcher.addCluster(0x500);
    matcher.addCluster(0x600);

    List<Integer> clusterListIn = new ArrayList<Integer>();
    List<Integer> clusterListOut = new ArrayList<Integer>();
    clusterListIn.add(0x500);
    clusterListOut.add(0x500);
    MatchDescriptorRequest request = new MatchDescriptorRequest();
    request.setSourceAddress(new ZigBeeEndpointAddress(1234, 5));
    request.setNwkAddrOfInterest(4321);
    request.setProfileId(0x104);
    request.setInClusterList(clusterListIn);
    request.setOutClusterList(clusterListOut);

    matcher.commandReceived(request);
    assertEquals(1, mockedCommandCaptor.getAllValues().size());
    MatchDescriptorResponse response = (MatchDescriptorResponse) mockedCommandCaptor.getValue();
    assertEquals(1234, response.getDestinationAddress().getAddress());
    assertEquals(Integer.valueOf(4321), response.getNwkAddrOfInterest());
  }
}

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

switch (destinationAddressMode) {
  case GROUP:
    serializeUInt16(destinationAddress.getAddress());
    break;
  case IEEE:
    break;
  case NWK:
    serializeUInt16(destinationAddress.getAddress());
    serializeUInt8(((ZigBeeEndpointAddress) destinationAddress).getEndpoint());
    break;

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

apsFrame.setDestinationEndpoint(((ZigBeeEndpointAddress) command.getDestinationAddress()).getEndpoint());
ZigBeeNode node = getNode(command.getDestinationAddress().getAddress());
if (node != null) {
  apsFrame.setDestinationIeeeAddress(node.getIeeeAddress());

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