Search in sources :

Example 1 with NodeDescriptorRequest

use of com.zsmartsystems.zigbee.zdo.command.NodeDescriptorRequest in project com.zsmartsystems.zigbee by zsmartsystems.

the class ZigBeeNodeServiceDiscoverer method requestNodeDescriptor.

/**
 * Get node descriptor
 *
 * @return true if the message was processed ok
 * @throws ExecutionException
 * @throws InterruptedException
 */
private boolean requestNodeDescriptor() throws InterruptedException, ExecutionException {
    final NodeDescriptorRequest nodeDescriptorRequest = new NodeDescriptorRequest();
    nodeDescriptorRequest.setDestinationAddress(new ZigBeeEndpointAddress(node.getNetworkAddress()));
    nodeDescriptorRequest.setNwkAddrOfInterest(node.getNetworkAddress());
    CommandResult response = networkManager.unicast(nodeDescriptorRequest, nodeDescriptorRequest).get();
    final NodeDescriptorResponse nodeDescriptorResponse = (NodeDescriptorResponse) response.getResponse();
    logger.debug("{}: Node SVC Discovery NodeDescriptorResponse returned {}", node.getIeeeAddress(), nodeDescriptorResponse);
    if (nodeDescriptorResponse == null) {
        return false;
    }
    if (nodeDescriptorResponse.getStatus() == ZdoStatus.SUCCESS) {
        node.setNodeDescriptor(nodeDescriptorResponse.getNodeDescriptor());
        return true;
    }
    return false;
}
Also used : NodeDescriptorResponse(com.zsmartsystems.zigbee.zdo.command.NodeDescriptorResponse) NodeDescriptorRequest(com.zsmartsystems.zigbee.zdo.command.NodeDescriptorRequest) ZigBeeEndpointAddress(com.zsmartsystems.zigbee.ZigBeeEndpointAddress) CommandResult(com.zsmartsystems.zigbee.CommandResult)

Aggregations

CommandResult (com.zsmartsystems.zigbee.CommandResult)1 ZigBeeEndpointAddress (com.zsmartsystems.zigbee.ZigBeeEndpointAddress)1 NodeDescriptorRequest (com.zsmartsystems.zigbee.zdo.command.NodeDescriptorRequest)1 NodeDescriptorResponse (com.zsmartsystems.zigbee.zdo.command.NodeDescriptorResponse)1