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);
}
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();
}
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());
}
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());
}
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();
}
Aggregations