Search in sources :

Example 1 with EzspGetNetworkParametersRequest

use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetNetworkParametersRequest in project com.zsmartsystems.zigbee by zsmartsystems.

the class EmberNcp method getNetworkParameters.

/**
 * Gets the current network parameters, or an empty parameters class if there's an error
 *
 * @return {@link EmberNetworkParameters}
 */
public EmberNetworkParameters getNetworkParameters() {
    EzspGetNetworkParametersRequest request = new EzspGetNetworkParametersRequest();
    EzspSingleResponseTransaction transaction = new EzspSingleResponseTransaction(request, EzspGetNetworkParametersResponse.class);
    ashHandler.sendEzspTransaction(transaction);
    EzspGetNetworkParametersResponse response = (EzspGetNetworkParametersResponse) transaction.getResponse();
    logger.debug(response.toString());
    lastStatus = response.getStatus();
    if (response.getStatus() != EmberStatus.EMBER_SUCCESS && response.getStatus() != EmberStatus.EMBER_NOT_JOINED) {
        logger.debug("Error during retrieval of network parameters: {}", response);
        return new EmberNetworkParameters();
    }
    return response.getParameters();
}
Also used : EzspGetNetworkParametersRequest(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetNetworkParametersRequest) EzspGetNetworkParametersResponse(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetNetworkParametersResponse) EmberNetworkParameters(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.structure.EmberNetworkParameters) EzspSingleResponseTransaction(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction)

Example 2 with EzspGetNetworkParametersRequest

use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetNetworkParametersRequest in project com.zsmartsystems.zigbee by zsmartsystems.

the class EmberNetworkInitialisation method getNetworkParameters.

/**
 * Get the current network parameters
 *
 * @return the {@link EmberNetworkParameters} or null on error
 */
private EmberNetworkParameters getNetworkParameters() {
    EzspGetNetworkParametersRequest networkParms = new EzspGetNetworkParametersRequest();
    EzspSingleResponseTransaction transaction = new EzspSingleResponseTransaction(networkParms, EzspGetNetworkParametersResponse.class);
    ashHandler.sendEzspTransaction(transaction);
    EzspGetNetworkParametersResponse getNetworkParametersResponse = (EzspGetNetworkParametersResponse) transaction.getResponse();
    logger.debug(getNetworkParametersResponse.toString());
    if (getNetworkParametersResponse.getStatus() != EmberStatus.EMBER_SUCCESS) {
        logger.debug("Error during retrieval of network parameters: {}", getNetworkParametersResponse);
        return null;
    }
    return getNetworkParametersResponse.getParameters();
}
Also used : EzspGetNetworkParametersRequest(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetNetworkParametersRequest) EzspGetNetworkParametersResponse(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetNetworkParametersResponse) EzspSingleResponseTransaction(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction)

Aggregations

EzspGetNetworkParametersRequest (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetNetworkParametersRequest)2 EzspGetNetworkParametersResponse (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetNetworkParametersResponse)2 EzspSingleResponseTransaction (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction)2 EmberNetworkParameters (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.structure.EmberNetworkParameters)1