Search in sources :

Example 1 with EzspSetConcentratorResponse

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

the class ZigBeeDongleEzsp method setConcentrator.

private TransportConfigResult setConcentrator(ConcentratorConfig concentratorConfig) {
    EzspSetConcentratorRequest concentratorRequest = new EzspSetConcentratorRequest();
    concentratorRequest.setMinTime(concentratorConfig.getRefreshMinimum());
    concentratorRequest.setMaxTime(concentratorConfig.getRefreshMaximum());
    concentratorRequest.setMaxHops(concentratorConfig.getMaxHops());
    concentratorRequest.setRouteErrorThreshold(concentratorConfig.getMaxFailures());
    concentratorRequest.setDeliveryFailureThreshold(concentratorConfig.getMaxFailures());
    switch(concentratorConfig.getType()) {
        case DISABLED:
            concentratorRequest.setEnable(false);
            break;
        case HIGH_RAM:
            concentratorRequest.setConcentratorType(EmberConcentratorType.EMBER_HIGH_RAM_CONCENTRATOR);
            concentratorRequest.setEnable(true);
            break;
        case LOW_RAM:
            concentratorRequest.setConcentratorType(EmberConcentratorType.EMBER_LOW_RAM_CONCENTRATOR);
            concentratorRequest.setEnable(true);
            break;
        default:
            break;
    }
    EzspTransaction concentratorTransaction = ashHandler.sendEzspTransaction(new EzspSingleResponseTransaction(concentratorRequest, EzspSetConcentratorResponse.class));
    EzspSetConcentratorResponse concentratorResponse = (EzspSetConcentratorResponse) concentratorTransaction.getResponse();
    logger.debug(concentratorResponse.toString());
    if (concentratorResponse.getStatus() == EzspStatus.EZSP_SUCCESS) {
        return TransportConfigResult.SUCCESS;
    }
    return TransportConfigResult.FAILURE;
}
Also used : EzspSetConcentratorResponse(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspSetConcentratorResponse) EzspSetConcentratorRequest(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspSetConcentratorRequest) EzspTransaction(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspTransaction) EzspSingleResponseTransaction(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction)

Aggregations

EzspSetConcentratorRequest (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspSetConcentratorRequest)1 EzspSetConcentratorResponse (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspSetConcentratorResponse)1 EzspSingleResponseTransaction (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction)1 EzspTransaction (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspTransaction)1