use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction in project com.zsmartsystems.zigbee by zsmartsystems.
the class EmberNcp method getKey.
/**
* Gets a Security Key based on the passed key type.
*
* @param keyType the {@link EmberKeyType} of the key to get
* @return the {@link EmberKeyStruct} or null on error
*/
public EmberKeyStruct getKey(EmberKeyType keyType) {
EzspGetKeyRequest request = new EzspGetKeyRequest();
request.setKeyType(keyType);
EzspTransaction transaction = ashHandler.sendEzspTransaction(new EzspSingleResponseTransaction(request, EzspGetKeyResponse.class));
EzspGetKeyResponse response = (EzspGetKeyResponse) transaction.getResponse();
logger.debug(response.toString());
lastStatus = response.getStatus();
if (lastStatus != EmberStatus.EMBER_SUCCESS) {
return null;
}
return response.getKeyStruct();
}
use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction 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;
}
use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction in project com.zsmartsystems.zigbee by zsmartsystems.
the class EmberNcp method getNetworkState.
/**
* Returns a value indicating whether the node is joining, joined to, or leaving a network.
*
* @return the {@link EmberNetworkStatus}
*/
public EmberNetworkStatus getNetworkState() {
EzspNetworkStateRequest request = new EzspNetworkStateRequest();
EzspTransaction transaction = ashHandler.sendEzspTransaction(new EzspSingleResponseTransaction(request, EzspNetworkStateResponse.class));
EzspNetworkStateResponse response = (EzspNetworkStateResponse) transaction.getResponse();
logger.debug(response.toString());
lastStatus = null;
return response.getStatus();
}
use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction in project com.zsmartsystems.zigbee by zsmartsystems.
the class EmberNcp method getCounters.
/**
* Retrieves Ember counters. See the EmberCounterType enumeration for the counter types.
*
* @return the array of counters
*/
public int[] getCounters() {
EzspReadCountersRequest request = new EzspReadCountersRequest();
EzspTransaction transaction = ashHandler.sendEzspTransaction(new EzspSingleResponseTransaction(request, EzspReadCountersResponse.class));
EzspReadCountersResponse response = (EzspReadCountersResponse) transaction.getResponse();
logger.debug(response.toString());
lastStatus = null;
return response.getValues();
}
use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction 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();
}
Aggregations