use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspFormNetworkResponse in project com.zsmartsystems.zigbee by zsmartsystems.
the class EmberNetworkInitialisation method doFormNetwork.
/**
* Forms the ZigBee network
*
* @param panId the panId as int
* @param extendedPanId the extended pan ID as {@link ExtendedPanId}
* @param channel the radio channel to use
* @return true if the network was formed successfully
*/
private boolean doFormNetwork(int panId, ExtendedPanId extendedPanId, int channel) {
EmberNetworkParameters networkParameters = new EmberNetworkParameters();
networkParameters.setJoinMethod(EmberJoinMethod.EMBER_USE_MAC_ASSOCIATION);
networkParameters.setExtendedPanId(extendedPanId);
networkParameters.setPanId(panId);
networkParameters.setRadioChannel(channel);
EzspFormNetworkRequest formNetwork = new EzspFormNetworkRequest();
formNetwork.setParameters(networkParameters);
EzspSingleResponseTransaction transaction = new EzspSingleResponseTransaction(formNetwork, EzspFormNetworkResponse.class);
ashHandler.sendEzspTransaction(transaction);
EzspFormNetworkResponse formNetworkResponse = (EzspFormNetworkResponse) transaction.getResponse();
logger.debug(formNetworkResponse.toString());
if (formNetworkResponse.getStatus() != EmberStatus.EMBER_SUCCESS) {
logger.debug("Error during retrieval of network parameters: {}", formNetworkResponse);
return false;
}
return true;
}
Aggregations