Search in sources :

Example 1 with EmberNetworkStatus

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);
}
Also used : EmberNcp(com.zsmartsystems.zigbee.dongle.ember.EmberNcp) EmberNetworkStatus(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.structure.EmberNetworkStatus)

Example 2 with EmberNetworkStatus

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;
}
Also used : EmberNetworkInitialisation(com.zsmartsystems.zigbee.dongle.ember.internal.EmberNetworkInitialisation) EzspGetParentChildParametersResponse(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetParentChildParametersResponse) EmberNetworkStatus(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.structure.EmberNetworkStatus) EmberCurrentSecurityState(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.structure.EmberCurrentSecurityState)

Aggregations

EmberNetworkStatus (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.structure.EmberNetworkStatus)2 EmberNcp (com.zsmartsystems.zigbee.dongle.ember.EmberNcp)1 EmberNetworkInitialisation (com.zsmartsystems.zigbee.dongle.ember.internal.EmberNetworkInitialisation)1 EzspGetParentChildParametersResponse (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetParentChildParametersResponse)1 EmberCurrentSecurityState (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.structure.EmberCurrentSecurityState)1