use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetParentChildParametersResponse in project com.zsmartsystems.zigbee by zsmartsystems.
the class EmberConsoleNcpChildrenCommand method process.
@Override
public void process(ZigBeeNetworkManager networkManager, String[] args, PrintStream out) throws IllegalArgumentException {
EmberNcp ncp = getEmberNcp(networkManager);
EzspGetParentChildParametersResponse childParameters = ncp.getChildParameters();
out.println("Ember NCP contains " + childParameters.getChildCount() + " children" + ((childParameters.getChildCount() == 0) ? "." : ":"));
for (int childId = 0; childId < childParameters.getChildCount(); childId++) {
EzspGetChildDataResponse child = ncp.getChildInformation(childId);
out.println(String.format("%2d %-10s %-10s %s", child.getChildId(), child.getStatus(), child.getChildType(), child.getChildEui64()));
}
}
use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetParentChildParametersResponse in project com.zsmartsystems.zigbee by zsmartsystems.
the class EmberNcp method getChildParameters.
/**
* Returns information about the children of the local node and the parent of the local node.
*
* @return the {@link EzspGetParentChildParametersResponse}
*/
public EzspGetParentChildParametersResponse getChildParameters() {
EzspGetParentChildParametersRequest request = new EzspGetParentChildParametersRequest();
EzspTransaction transaction = ashHandler.sendEzspTransaction(new EzspSingleResponseTransaction(request, EzspGetParentChildParametersResponse.class));
EzspGetParentChildParametersResponse response = (EzspGetParentChildParametersResponse) transaction.getResponse();
lastStatus = null;
return response;
}
use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetParentChildParametersResponse in project com.zsmartsystems.zigbee by zsmartsystems.
the class ZigBeeDongleEzsp method startup.
@Override
public boolean startup(boolean reinitialize) {
logger.debug("EZSP dongle startup.");
// If ashHandler is null then the serial port didn't initialise
if (ashHandler == null) {
logger.error("Initialising Ember Dongle but low level handle is not initialised.");
return false;
}
EmberNcp ncp = new EmberNcp(ashHandler);
// Check if the network is initialised
EmberNetworkStatus networkState = ncp.getNetworkState();
logger.debug("EZSP networkStateResponse {}", networkState);
// If we want to reinitialize the network, then go...
if (reinitialize) {
logger.debug("Reinitialising Ember NCP and forming network.");
EmberNetworkInitialisation netInitialiser = new EmberNetworkInitialisation(ashHandler);
netInitialiser.formNetwork(networkParameters, networkKey);
ncp.getNetworkParameters();
}
// Check if the network is now up
networkState = ncp.getNetworkState();
logger.debug("EZSP networkStateResponse {}", networkState);
if (networkState == EmberNetworkStatus.EMBER_JOINED_NETWORK) {
zigbeeTransportReceive.setNetworkState(ZigBeeTransportState.ONLINE);
}
// Get the security state - mainly for debug
EmberCurrentSecurityState currentSecurityState = ncp.getCurrentSecurityState();
logger.debug("Current Security State = {}", currentSecurityState);
EzspGetParentChildParametersResponse childParametersResponse = ncp.getChildParameters();
logger.debug("Current Parent Child Information = {}", childParametersResponse);
for (int childId = 0; childId < childParametersResponse.getChildCount(); childId++) {
ncp.getChildInformation(childId);
}
logger.debug("EZSP dongle startup done.");
return true;
}
Aggregations