gpt4 book ai didi

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

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

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

ZigBeeNode.setPowerDescriptor介绍

[英]Sets the nodes PowerDescriptor
[中]设置节点描述符

代码示例

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

/**
 * Get node power descriptor
 *
 * @return true if the message was processed ok, or if the end device does not support the power descriptor
 * @throws ExecutionException
 * @throws InterruptedException
 */
private boolean requestPowerDescriptor() throws InterruptedException, ExecutionException {
  final PowerDescriptorRequest powerDescriptorRequest = new PowerDescriptorRequest();
  powerDescriptorRequest.setDestinationAddress(new ZigBeeEndpointAddress(node.getNetworkAddress()));
  powerDescriptorRequest.setNwkAddrOfInterest(node.getNetworkAddress());
  CommandResult response = networkManager.sendTransaction(powerDescriptorRequest, powerDescriptorRequest).get();
  final PowerDescriptorResponse powerDescriptorResponse = (PowerDescriptorResponse) response.getResponse();
  logger.debug("{}: Node SVC Discovery: PowerDescriptorResponse returned {}", node.getIeeeAddress(),
      powerDescriptorResponse);
  if (powerDescriptorResponse == null) {
    return false;
  }
  if (powerDescriptorResponse.getStatus() == ZdoStatus.SUCCESS) {
    node.setPowerDescriptor(powerDescriptorResponse.getPowerDescriptor());
    return true;
  } else if (powerDescriptorResponse.getStatus() == ZdoStatus.NOT_SUPPORTED) {
    return true;
  }
  return false;
}

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

@Test
public void testAddDescriptors() {
  ZigBeeNode node = new ZigBeeNode(Mockito.mock(ZigBeeNetworkManager.class), new IeeeAddress());
  // Not null by default
  assertNotNull(node.getNodeDescriptor());
  assertNotNull(node.getPowerDescriptor());
  node.setPowerDescriptor(null);
  assertEquals(null, node.getPowerDescriptor());
  node.setNodeDescriptor(null);
  assertEquals(null, node.getPowerDescriptor());
  System.out.println(node.toString());
}

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

@Test
public void testSetPowerDescriptor() {
  PowerDescriptor descriptor = new PowerDescriptor(1, 2, 4, 0xc);
  ZigBeeNode node = new ZigBeeNode(Mockito.mock(ZigBeeNetworkManager.class), new IeeeAddress());
  node.setPowerDescriptor(descriptor);
  assertEquals(CurrentPowerModeType.RECEIVER_ON_PERIODICALLY, node.getPowerDescriptor().getCurrentPowerMode());
  assertEquals(PowerSourceType.DISPOSABLE_BATTERY, node.getPowerDescriptor().getCurrentPowerSource());
  assertEquals(PowerLevelType.FULL, node.getPowerDescriptor().getPowerLevel());
}

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