use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction in project com.zsmartsystems.zigbee by zsmartsystems.
the class EmberNcp method getVersion.
/**
* The command allows the Host to specify the desired EZSP version and must be sent before any other command. The
* response provides information about the firmware running on the NCP.
*
* @param desiredVersion the requested version we support
* @return the {@link EzspVersionResponse}
*/
public EzspVersionResponse getVersion(int desiredVersion) {
EzspVersionRequest request = new EzspVersionRequest();
request.setDesiredProtocolVersion(EzspFrame.getEzspVersion());
EzspTransaction transaction = ashHandler.sendEzspTransaction(new EzspSingleResponseTransaction(request, EzspVersionResponse.class));
EzspVersionResponse response = (EzspVersionResponse) transaction.getResponse();
logger.debug(response.toString());
lastStatus = null;
return response;
}
use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction in project com.zsmartsystems.zigbee by zsmartsystems.
the class EmberNcp method getNetworkParameters.
/**
* Gets the current network parameters, or an empty parameters class if there's an error
*
* @return {@link EmberNetworkParameters}
*/
public EmberNetworkParameters getNetworkParameters() {
EzspGetNetworkParametersRequest request = new EzspGetNetworkParametersRequest();
EzspSingleResponseTransaction transaction = new EzspSingleResponseTransaction(request, EzspGetNetworkParametersResponse.class);
ashHandler.sendEzspTransaction(transaction);
EzspGetNetworkParametersResponse response = (EzspGetNetworkParametersResponse) transaction.getResponse();
logger.debug(response.toString());
lastStatus = response.getStatus();
if (response.getStatus() != EmberStatus.EMBER_SUCCESS && response.getStatus() != EmberStatus.EMBER_NOT_JOINED) {
logger.debug("Error during retrieval of network parameters: {}", response);
return new EmberNetworkParameters();
}
return response.getParameters();
}
use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction in project com.zsmartsystems.zigbee by zsmartsystems.
the class EmberNcp method addEndpoint.
/**
* Configures endpoint information on the NCP. The NCP does not remember these settings after a reset. Endpoints can
* be added by the Host after the NCP has reset. Once the status of the stack changes to EMBER_NETWORK_UP, endpoints
* can no longer be added and this command will respond with EZSP_ERROR_INVALID_CALL.
*
* @param endpointId the endpoint number to add
* @param deviceId the device id for the endpoint
* @param profileId the profile id
* @param inputClusters an array of input clusters supported by the endpoint
* @param outputClusters an array of output clusters supported by the endpoint
* @return the {@link EzspStatus} of the response
*/
public EzspStatus addEndpoint(int endpointId, int deviceId, int profileId, int[] inputClusters, int[] outputClusters) {
EzspAddEndpointRequest request = new EzspAddEndpointRequest();
request.setEndpoint(endpointId);
request.setDeviceId(deviceId);
request.setProfileId(profileId);
request.setInputClusterList(new int[] { 0 });
request.setOutputClusterList(new int[] { 0 });
EzspTransaction transaction = ashHandler.sendEzspTransaction(new EzspSingleResponseTransaction(request, EzspAddEndpointResponse.class));
EzspAddEndpointResponse response = (EzspAddEndpointResponse) 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 setConfiguration.
/**
* Set a configuration value
*
* @param configId the {@link EzspConfigId} to set
* @param value the value to set
* @return true if the configuration returns success
*/
public boolean setConfiguration(EzspConfigId configId, Integer value) {
EzspSetConfigurationValueRequest request = new EzspSetConfigurationValueRequest();
request.setConfigId(configId);
request.setValue(value);
logger.debug(request.toString());
EzspTransaction transaction = ashHandler.sendEzspTransaction(new EzspSingleResponseTransaction(request, EzspSetConfigurationValueResponse.class));
EzspSetConfigurationValueResponse response = (EzspSetConfigurationValueResponse) transaction.getResponse();
lastStatus = null;
logger.debug(response.toString());
return response.getStatus() == EzspStatus.EZSP_SUCCESS;
}
use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction in project com.zsmartsystems.zigbee by zsmartsystems.
the class EmberNcp method getKeyTableEntry.
/**
* Gets a Security Key based on the passed key type.
*
* @param index the index of the key to get
* @return the {@link EmberKeyStruct} of the requested key or null on error
*/
public EmberKeyStruct getKeyTableEntry(int index) {
EzspGetKeyTableEntryRequest request = new EzspGetKeyTableEntryRequest();
request.setIndex(index);
EzspTransaction transaction = ashHandler.sendEzspTransaction(new EzspSingleResponseTransaction(request, EzspGetKeyTableEntryResponse.class));
EzspGetKeyTableEntryResponse response = (EzspGetKeyTableEntryResponse) transaction.getResponse();
logger.debug(response.toString());
lastStatus = response.getStatus();
if (lastStatus != EmberStatus.EMBER_SUCCESS) {
return null;
}
return response.getKeyStruct();
}
Aggregations