use of com.zsmartsystems.zigbee.zdo.command.ActiveEndpointsRequest in project com.zsmartsystems.zigbee by zsmartsystems.
the class ZigBeeNodeServiceDiscoverer method requestActiveEndpoints.
/**
* Get the active endpoints for a node
*
* @return true if the message was processed ok
* @throws ExecutionException
* @throws InterruptedException
*/
private boolean requestActiveEndpoints() throws InterruptedException, ExecutionException {
final ActiveEndpointsRequest activeEndpointsRequest = new ActiveEndpointsRequest();
activeEndpointsRequest.setDestinationAddress(new ZigBeeEndpointAddress(node.getNetworkAddress()));
activeEndpointsRequest.setNwkAddrOfInterest(node.getNetworkAddress());
CommandResult response = networkManager.unicast(activeEndpointsRequest, activeEndpointsRequest).get();
final ActiveEndpointsResponse activeEndpointsResponse = (ActiveEndpointsResponse) response.getResponse();
logger.debug("{}: Node SVC Discovery ActiveEndpointsResponse returned {}", node.getIeeeAddress(), response);
if (activeEndpointsResponse == null) {
return false;
}
// Get the simple descriptors for all endpoints
List<ZigBeeEndpoint> endpoints = new ArrayList<ZigBeeEndpoint>();
for (final int endpointId : activeEndpointsResponse.getActiveEpList()) {
ZigBeeEndpoint endpoint = getSimpleDescriptor(endpointId);
if (endpoint == null) {
return false;
}
endpoints.add(endpoint);
}
// All endpoints have been received, so add them to the node
for (ZigBeeEndpoint endpoint : endpoints) {
node.addEndpoint(endpoint);
}
return true;
}
Aggregations