Search in sources :

Example 1 with EzspGetParentChildParametersResponse

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

Example 2 with EzspGetParentChildParametersResponse

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;
}
Also used : EzspTransaction(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspTransaction) EzspGetParentChildParametersResponse(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetParentChildParametersResponse) EzspSingleResponseTransaction(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction) EzspGetParentChildParametersRequest(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetParentChildParametersRequest)

Example 3 with EzspGetParentChildParametersResponse

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;
}
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

EzspGetParentChildParametersResponse (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetParentChildParametersResponse)3 EmberNcp (com.zsmartsystems.zigbee.dongle.ember.EmberNcp)1 EmberNetworkInitialisation (com.zsmartsystems.zigbee.dongle.ember.internal.EmberNetworkInitialisation)1 EzspGetChildDataResponse (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetChildDataResponse)1 EzspGetParentChildParametersRequest (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetParentChildParametersRequest)1 EmberCurrentSecurityState (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.structure.EmberCurrentSecurityState)1 EmberNetworkStatus (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.structure.EmberNetworkStatus)1 EzspSingleResponseTransaction (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction)1 EzspTransaction (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspTransaction)1