Example #1
0
        /**
         * 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);
            IEzspTransaction      transaction       = _protocolHandler.SendEzspTransaction(new EzspSingleResponseTransaction(getPolicyRequest, typeof(EzspGetPolicyResponse)));
            EzspGetPolicyResponse getPolicyResponse = (EzspGetPolicyResponse)transaction.GetResponse();

            _lastStatus = EmberStatus.UNKNOWN;
            Log.Debug(getPolicyResponse.ToString());
            if (getPolicyResponse.GetStatus() != EzspStatus.EZSP_SUCCESS)
            {
                Log.Debug("Error getting policy: {}", getPolicyResponse);
                return(EzspDecisionId.UNKNOWN);
            }

            return(getPolicyResponse.GetDecisionId());
        }
Example #2
0
 public void SerializeEzspPolicyId(EzspPolicyId policyId)
 {
     _buffer[_length++] = (int)policyId;
 }
 /// <summary>
 /// The policyId to set as <see cref="EzspPolicyId"/> </summary>
 public void SetPolicyId(EzspPolicyId policyId)
 {
     _policyId = policyId;
 }