use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.structure.EmberNetworkParameters in project com.zsmartsystems.zigbee by zsmartsystems.
the class EmberConsoleNetworkStateCommand method process.
@Override
public void process(ZigBeeNetworkManager networkManager, String[] args, PrintStream out) throws IllegalArgumentException {
EmberNcp ncp = getEmberNcp(networkManager);
EmberNetworkParameters networkState = ncp.getNetworkParameters();
out.println("PAN ID : " + networkState.getPanId());
out.println("Extended PAN ID: " + networkState.getExtendedPanId());
out.println("Radio Channel : " + networkState.getRadioChannel());
out.println("Transmit Power : " + networkState.getRadioTxPower());
out.println("Join Method : " + networkState.getJoinMethod());
out.println("Network Manager: " + networkState.getNwkManagerId());
}
use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.structure.EmberNetworkParameters in project com.zsmartsystems.zigbee by zsmartsystems.
the class EzspGetNetworkParametersResponseTest method testVersionError.
@Test
public void testVersionError() {
EzspFrame.setEzspVersion(4);
EzspGetNetworkParametersResponse response = new EzspGetNetworkParametersResponse(getPacketData("05 80 28 00 01 EF CB B1 57 A8 CC C6 D7 05 C8 00 0B 00 00 00 00 00 F8 FF 07"));
System.out.println(response);
assertEquals(5, response.getSequenceNumber());
assertEquals(true, response.isResponse());
assertEquals(EzspGetNetworkParametersResponse.FRAME_ID, response.getFrameId());
assertEquals(EmberStatus.EMBER_SUCCESS, response.getStatus());
assertEquals(EmberNodeType.EMBER_COORDINATOR, response.getNodeType());
EmberNetworkParameters networkParameters = response.getParameters();
assertEquals(11, networkParameters.getRadioChannel());
assertEquals(0, networkParameters.getRadioTxPower());
assertEquals(EmberJoinMethod.EMBER_USE_MAC_ASSOCIATION, networkParameters.getJoinMethod());
assertEquals(0, networkParameters.getNwkManagerId());
assertEquals(134215680, networkParameters.getChannels());
}
use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.structure.EmberNetworkParameters in project com.zsmartsystems.zigbee by zsmartsystems.
the class EmberNcp method getNetworkParameters.
/**
* Gets the current network parameters, or an empty parameters class if there's an error
*
* @return {@link EmberNetworkParameters}
*/
public EmberNetworkParameters getNetworkParameters() {
EzspGetNetworkParametersRequest request = new EzspGetNetworkParametersRequest();
EzspSingleResponseTransaction transaction = new EzspSingleResponseTransaction(request, EzspGetNetworkParametersResponse.class);
ashHandler.sendEzspTransaction(transaction);
EzspGetNetworkParametersResponse response = (EzspGetNetworkParametersResponse) transaction.getResponse();
logger.debug(response.toString());
lastStatus = response.getStatus();
if (response.getStatus() != EmberStatus.EMBER_SUCCESS && response.getStatus() != EmberStatus.EMBER_NOT_JOINED) {
logger.debug("Error during retrieval of network parameters: {}", response);
return new EmberNetworkParameters();
}
return response.getParameters();
}
use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.structure.EmberNetworkParameters 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