use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspTransaction in project com.zsmartsystems.zigbee by zsmartsystems.
the class EzspNeighborTable method getNeighborCount.
private int getNeighborCount() {
// Check if the network is initialised
EzspNeighborCountRequest neighborCountRequest = new EzspNeighborCountRequest();
EzspTransaction neighborCountTransaction = ashHandler.sendEzspTransaction(new EzspSingleResponseTransaction(neighborCountRequest, EzspNeighborCountResponse.class));
EzspNeighborCountResponse neighborCountResponse = (EzspNeighborCountResponse) neighborCountTransaction.getResponse();
logger.debug(neighborCountResponse.toString());
logger.debug("EZSP neighborCountResponse {}", neighborCountResponse);
return neighborCountResponse.getValue();
}
use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspTransaction 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.EzspTransaction 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.EzspTransaction 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.EzspTransaction 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());
}
Aggregations