use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.structure.EmberNetworkStatus in project com.zsmartsystems.zigbee by zsmartsystems.
the class EmberConsoleNcpStateCommand method process.
@Override
public void process(ZigBeeNetworkManager networkManager, String[] args, PrintStream out) throws IllegalArgumentException {
EmberNcp ncp = getEmberNcp(networkManager);
EmberNetworkStatus status = ncp.getNetworkState();
out.println("Ember NCP state is " + status);
}
use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.structure.EmberNetworkStatus 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