Search in sources :

Example 1 with EzspGetPolicyRequest

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

the class EmberNcp method getPolicy.

/**
 * Get a policy used by the NCP to make fast decisions.
 *
 * @param policyId the {@link EzspPolicyId} to set
 * @return the returned {@link EzspDecisionId} if the policy was retrieved successfully or null if there was an
 *         error
 */
public EzspDecisionId getPolicy(EzspPolicyId policyId) {
    EzspGetPolicyRequest getPolicyRequest = new EzspGetPolicyRequest();
    getPolicyRequest.setPolicyId(policyId);
    EzspSingleResponseTransaction transaction = new EzspSingleResponseTransaction(getPolicyRequest, EzspGetPolicyResponse.class);
    ashHandler.sendEzspTransaction(transaction);
    EzspGetPolicyResponse getPolicyResponse = (EzspGetPolicyResponse) transaction.getResponse();
    lastStatus = null;
    logger.debug(getPolicyResponse.toString());
    if (getPolicyResponse.getStatus() != EzspStatus.EZSP_SUCCESS) {
        logger.debug("Error getting policy: {}", getPolicyResponse);
        return null;
    }
    return getPolicyResponse.getDecisionId();
}
Also used : EzspGetPolicyRequest(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetPolicyRequest) EzspGetPolicyResponse(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetPolicyResponse) EzspSingleResponseTransaction(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction)

Aggregations

EzspGetPolicyRequest (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetPolicyRequest)1 EzspGetPolicyResponse (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetPolicyResponse)1 EzspSingleResponseTransaction (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction)1