Search in sources :

Example 11 with EzspTransaction

use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspTransaction in project com.zsmartsystems.zigbee by zsmartsystems.

the class EmberNcp method getConfiguration.

/**
 * Get a configuration value
 *
 * @param configId the {@link EzspConfigId} to set
 * @return the configuration value as {@link Integer} or null on error
 */
public Integer getConfiguration(EzspConfigId configId) {
    EzspGetConfigurationValueRequest request = new EzspGetConfigurationValueRequest();
    request.setConfigId(configId);
    EzspTransaction transaction = ashHandler.sendEzspTransaction(new EzspSingleResponseTransaction(request, EzspGetConfigurationValueResponse.class));
    EzspGetConfigurationValueResponse response = (EzspGetConfigurationValueResponse) transaction.getResponse();
    lastStatus = null;
    logger.debug(response.toString());
    if (response.getStatus() != EzspStatus.EZSP_SUCCESS) {
        return null;
    }
    return response.getValue();
}
Also used : EzspTransaction(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspTransaction) EzspGetConfigurationValueResponse(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetConfigurationValueResponse) EzspSingleResponseTransaction(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction) EzspGetConfigurationValueRequest(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetConfigurationValueRequest)

Example 12 with EzspTransaction

use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspTransaction 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;
}
Also used : EzspVersionRequest(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspVersionRequest) EzspTransaction(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspTransaction) EzspVersionResponse(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspVersionResponse) EzspSingleResponseTransaction(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction)

Example 13 with EzspTransaction

use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspTransaction 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();
}
Also used : EzspTransaction(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspTransaction) EzspSingleResponseTransaction(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction) EzspAddEndpointRequest(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspAddEndpointRequest) EzspAddEndpointResponse(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspAddEndpointResponse)

Example 14 with EzspTransaction

use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspTransaction 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;
}
Also used : EzspSetConfigurationValueResponse(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspSetConfigurationValueResponse) EzspTransaction(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspTransaction) EzspSingleResponseTransaction(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction) EzspSetConfigurationValueRequest(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspSetConfigurationValueRequest)

Example 15 with EzspTransaction

use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspTransaction 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();
}
Also used : EzspGetKeyTableEntryRequest(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetKeyTableEntryRequest) EzspTransaction(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspTransaction) EzspSingleResponseTransaction(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction) EzspGetKeyTableEntryResponse(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetKeyTableEntryResponse)

Aggregations

EzspSingleResponseTransaction (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction)21 EzspTransaction (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspTransaction)21 EzspVersionRequest (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspVersionRequest)3 EzspVersionResponse (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspVersionResponse)3 EzspFrameTest (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.EzspFrameTest)2 EzspGetConfigurationValueRequest (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetConfigurationValueRequest)2 EzspGetConfigurationValueResponse (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetConfigurationValueResponse)2 EzspNetworkStateRequest (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspNetworkStateRequest)2 EzspNetworkStateResponse (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspNetworkStateResponse)2 Test (org.junit.Test)2 EmberFirmwareUpdateHandler (com.zsmartsystems.zigbee.dongle.ember.internal.EmberFirmwareUpdateHandler)1 EmberStackConfiguration (com.zsmartsystems.zigbee.dongle.ember.internal.EmberStackConfiguration)1 EzspAddEndpointRequest (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspAddEndpointRequest)1 EzspAddEndpointResponse (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspAddEndpointResponse)1 EzspGetChildDataRequest (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetChildDataRequest)1 EzspGetChildDataResponse (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetChildDataResponse)1 EzspGetKeyRequest (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetKeyRequest)1 EzspGetKeyResponse (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetKeyResponse)1 EzspGetKeyTableEntryRequest (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetKeyTableEntryRequest)1 EzspGetKeyTableEntryResponse (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetKeyTableEntryResponse)1