use of com.zsmartsystems.zigbee.zdo.command.SimpleDescriptorRequest in project com.zsmartsystems.zigbee by zsmartsystems.
the class ZigBeeNodeServiceDiscoverer method getSimpleDescriptor.
/**
* Get the simple descriptor for an endpoint and create the {@link ZigBeeEndpoint}
*
* @param endpointId the endpoint id to request
* @return the newly created {@link ZigBeeEndpoint} for the endpoint, or null on error
* @throws ExecutionException
* @throws InterruptedException
*/
private ZigBeeEndpoint getSimpleDescriptor(final int endpointId) throws InterruptedException, ExecutionException {
final SimpleDescriptorRequest simpleDescriptorRequest = new SimpleDescriptorRequest();
simpleDescriptorRequest.setDestinationAddress(new ZigBeeEndpointAddress(node.getNetworkAddress()));
simpleDescriptorRequest.setNwkAddrOfInterest(node.getNetworkAddress());
simpleDescriptorRequest.setEndpoint(endpointId);
CommandResult response = networkManager.unicast(simpleDescriptorRequest, simpleDescriptorRequest).get();
final SimpleDescriptorResponse simpleDescriptorResponse = (SimpleDescriptorResponse) response.getResponse();
logger.debug("{}: Node SVC Discovery SimpleDescriptorResponse returned {}", node.getIeeeAddress(), simpleDescriptorResponse);
if (simpleDescriptorResponse == null) {
return null;
}
if (simpleDescriptorResponse.getStatus() == ZdoStatus.SUCCESS) {
ZigBeeEndpoint endpoint = new ZigBeeEndpoint(networkManager, node, endpointId);
SimpleDescriptor simpleDescriptor = simpleDescriptorResponse.getSimpleDescriptor();
endpoint.setProfileId(simpleDescriptor.getProfileId());
endpoint.setDeviceId(simpleDescriptor.getDeviceId());
endpoint.setDeviceVersion(simpleDescriptor.getDeviceVersion());
endpoint.setInputClusterIds(simpleDescriptor.getInputClusterList());
endpoint.setOutputClusterIds(simpleDescriptor.getOutputClusterList());
return endpoint;
}
return null;
}
Aggregations