Search in sources :

Example 1 with EzspSetPolicyResponse

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

the class EmberNcp method setPolicy.

/**
 * Set a policy used by the NCP to make fast decisions.
 *
 * @param policyId the {@link EzspPolicyId} to set
 * @param decisionId the {@link EzspDecisionId} to set to
 * @return true if the policy setting was successful
 */
public boolean setPolicy(EzspPolicyId policyId, EzspDecisionId decisionId) {
    EzspSetPolicyRequest setPolicyRequest = new EzspSetPolicyRequest();
    setPolicyRequest.setPolicyId(policyId);
    setPolicyRequest.setDecisionId(decisionId);
    EzspSingleResponseTransaction transaction = new EzspSingleResponseTransaction(setPolicyRequest, EzspSetPolicyResponse.class);
    ashHandler.sendEzspTransaction(transaction);
    EzspSetPolicyResponse setPolicyResponse = (EzspSetPolicyResponse) transaction.getResponse();
    lastStatus = null;
    logger.debug(setPolicyResponse.toString());
    if (setPolicyResponse.getStatus() != EzspStatus.EZSP_SUCCESS) {
        logger.debug("Error during setting policy: {}", setPolicyResponse);
        return false;
    }
    return true;
}
Also used : EzspSetPolicyResponse(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspSetPolicyResponse) EzspSetPolicyRequest(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspSetPolicyRequest) EzspSingleResponseTransaction(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction)

Aggregations

EzspSetPolicyRequest (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspSetPolicyRequest)1 EzspSetPolicyResponse (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspSetPolicyResponse)1 EzspSingleResponseTransaction (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction)1