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

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

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

ZigBeeCommand.getDestinationAddress介绍

[英]Gets destination address.
[中]获取目标地址。

代码示例

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

@Override
  public boolean isTransactionMatch(ZigBeeCommand request, ZigBeeCommand response) {
    if (!request.getDestinationAddress().equals(response.getSourceAddress())) {
      return false;
    }

    if (response instanceof ZclCommand && ((ZclCommand) request).getTransactionId() != null) {
      final int transactionId = ((ZclCommand) request).getTransactionId();
      return Integer.valueOf(transactionId).equals(((ZclCommand) response).getTransactionId());
    } else {
      return false;
    }
  }
}

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

@Test
public void sendTransaction() {
  ZigBeeNetworkManager networkManager = Mockito.mock(ZigBeeNetworkManager.class);
  ZigBeeCommand command = Mockito.mock(ZigBeeCommand.class);
  Mockito.when(command.getDestinationAddress()).thenReturn(new ZigBeeEndpointAddress(123));
  ZigBeeTransactionMatcher responseMatcher = Mockito.mock(ZigBeeTransactionMatcher.class);
  ZigBeeNode node = Mockito.mock(ZigBeeNode.class);
  Mockito.when(node.getIeeeAddress()).thenReturn(new IeeeAddress("1234567890ABCDEF"));
  Mockito.when(networkManager.getNode(123)).thenReturn(node);
  ZigBeeTransactionManager transactionManager = new ZigBeeTransactionManager(networkManager);
  transactionManager.sendTransaction(command);
  Future<CommandResult> cmdResult = transactionManager.sendTransaction(command, responseMatcher);
  assertNotNull(cmdResult);
  ZigBeeCommand unknownCommand = Mockito.mock(ZigBeeCommand.class);
  Mockito.when(unknownCommand.getDestinationAddress()).thenReturn(new ZigBeeEndpointAddress(456));
  cmdResult = transactionManager.sendTransaction(unknownCommand, responseMatcher);
  // assertNull(cmdResult);
}

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

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

相关文章