use of com.zsmartsystems.zigbee.zdo.command.PowerDescriptorRequest in project com.zsmartsystems.zigbee by zsmartsystems.
the class ZigBeeNodeServiceDiscoverer method requestPowerDescriptor.
/**
* 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.unicast(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;
}
Aggregations