Search in sources :

Example 11 with EzspSingleResponseTransaction

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

the class EzspNeighborTable method getNeighbor.

private void getNeighbor(int neighbor) {
    EzspGetNeighborRequest neighborRequest = new EzspGetNeighborRequest();
    neighborRequest.setIndex(neighbor);
    EzspTransaction neighborTransaction = ashHandler.sendEzspTransaction(new EzspSingleResponseTransaction(neighborRequest, EzspGetNeighborResponse.class));
    EzspGetNeighborResponse neighborResponse = (EzspGetNeighborResponse) neighborTransaction.getResponse();
    logger.debug(neighborResponse.toString());
    logger.debug("EZSP getNetworkResponse {}", neighborResponse);
}
Also used : EzspGetNeighborResponse(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetNeighborResponse) EzspTransaction(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspTransaction) EzspGetNeighborRequest(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetNeighborRequest) EzspSingleResponseTransaction(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction)

Example 12 with EzspSingleResponseTransaction

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

the class EzspNeighborTable method getConfiguration.

/**
 * Get a configuration value
 *
 * @param configId the {@link EzspConfigId} to set
 * @return the configuration value as {@link Integer} or null on error
 */
private Integer getConfiguration(EzspConfigId configId) {
    EzspGetConfigurationValueRequest configValue = new EzspGetConfigurationValueRequest();
    configValue.setConfigId(configId);
    EzspTransaction configTransaction = ashHandler.sendEzspTransaction(new EzspSingleResponseTransaction(configValue, EzspGetConfigurationValueResponse.class));
    EzspGetConfigurationValueResponse configResponse = (EzspGetConfigurationValueResponse) configTransaction.getResponse();
    logger.debug(configResponse.toString());
    if (configResponse.getStatus() != EzspStatus.EZSP_SUCCESS) {
        return null;
    }
    return configResponse.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 13 with EzspSingleResponseTransaction

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

the class EzspSingleResponseTransactionTest method testResponseMatches.

@Test
public void testResponseMatches() {
    EzspVersionRequest version = new EzspVersionRequest();
    version.setSequenceNumber(3);
    version.setDesiredProtocolVersion(4);
    EzspTransaction versionTransaction = new EzspSingleResponseTransaction(version, EzspVersionResponse.class);
    EzspVersionResponse versionResponse = new EzspVersionResponse(getPacketData("03 80 00 04 02 00 58"));
    assertTrue(versionTransaction.isMatch(versionResponse));
    versionTransaction.getRequest();
    assertEquals(1, versionTransaction.getResponses().size());
    assertNotNull(versionTransaction.getResponses());
    assertEquals(versionTransaction.getResponses().get(0), versionTransaction.getResponse());
}
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) EzspFrameTest(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.EzspFrameTest) Test(org.junit.Test)

Example 14 with EzspSingleResponseTransaction

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

the class EzspSingleResponseTransactionTest method testResponseMatchFails.

@Test
public void testResponseMatchFails() {
    EzspVersionRequest version = new EzspVersionRequest();
    version.setSequenceNumber(4);
    version.setDesiredProtocolVersion(4);
    EzspTransaction versionTransaction = new EzspSingleResponseTransaction(version, EzspVersionResponse.class);
    EzspVersionResponse versionResponse = new EzspVersionResponse(getPacketData("03 80 00 04 02 00 58"));
    assertFalse(versionTransaction.isMatch(versionResponse));
    assertNull(versionTransaction.getResponse());
    assertNull(versionTransaction.getResponses());
}
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) EzspFrameTest(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.EzspFrameTest) Test(org.junit.Test)

Example 15 with EzspSingleResponseTransaction

use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction 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)

Aggregations

EzspSingleResponseTransaction (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction)28 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 EzspGetNetworkParametersRequest (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetNetworkParametersRequest)2 EzspGetNetworkParametersResponse (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetNetworkParametersResponse)2 EzspNetworkStateRequest (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspNetworkStateRequest)2 EzspNetworkStateResponse (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspNetworkStateResponse)2 EmberNetworkParameters (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.structure.EmberNetworkParameters)2 Test (org.junit.Test)2 IeeeAddress (com.zsmartsystems.zigbee.IeeeAddress)1 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 EzspFormNetworkRequest (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspFormNetworkRequest)1 EzspFormNetworkResponse (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspFormNetworkResponse)1