本文整理了Java中com.zsmartsystems.zigbee.ZigBeeNode.setPowerDescriptor()
方法的一些代码示例,展示了ZigBeeNode.setPowerDescriptor()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZigBeeNode.setPowerDescriptor()
方法的具体详情如下:
包路径:com.zsmartsystems.zigbee.ZigBeeNode
类名称: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());
}
内容来源于网络,如有侵权,请联系作者删除!