Search in sources :

Example 1 with EzspNetworkStateResponse

use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspNetworkStateResponse in project com.zsmartsystems.zigbee by zsmartsystems.

the class EmberNcp method getNetworkState.

/**
 * Returns a value indicating whether the node is joining, joined to, or leaving a network.
 *
 * @return the {@link EmberNetworkStatus}
 */
public EmberNetworkStatus getNetworkState() {
    EzspNetworkStateRequest request = new EzspNetworkStateRequest();
    EzspTransaction transaction = ashHandler.sendEzspTransaction(new EzspSingleResponseTransaction(request, EzspNetworkStateResponse.class));
    EzspNetworkStateResponse response = (EzspNetworkStateResponse) transaction.getResponse();
    logger.debug(response.toString());
    lastStatus = null;
    return response.getStatus();
}
Also used : EzspNetworkStateResponse(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspNetworkStateResponse) EzspTransaction(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspTransaction) EzspSingleResponseTransaction(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction) EzspNetworkStateRequest(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspNetworkStateRequest)

Example 2 with EzspNetworkStateResponse

use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspNetworkStateResponse in project com.zsmartsystems.zigbee by zsmartsystems.

the class EmberNetworkInitialisation method checkNetworkJoined.

private boolean checkNetworkJoined() {
    // Check if the network is initialised
    EzspNetworkStateRequest networkStateRequest = new EzspNetworkStateRequest();
    EzspTransaction networkStateTransaction = ashHandler.sendEzspTransaction(new EzspSingleResponseTransaction(networkStateRequest, EzspNetworkStateResponse.class));
    EzspNetworkStateResponse networkStateResponse = (EzspNetworkStateResponse) networkStateTransaction.getResponse();
    logger.debug(networkStateResponse.toString());
    logger.debug("EZSP networkStateResponse {}", networkStateResponse.getStatus());
    return networkStateResponse.getStatus() == EmberNetworkStatus.EMBER_JOINED_NETWORK;
}
Also used : EzspNetworkStateResponse(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspNetworkStateResponse) EzspTransaction(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspTransaction) EzspSingleResponseTransaction(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction) EzspNetworkStateRequest(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspNetworkStateRequest)

Aggregations

EzspNetworkStateRequest (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspNetworkStateRequest)2 EzspNetworkStateResponse (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspNetworkStateResponse)2 EzspSingleResponseTransaction (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction)2 EzspTransaction (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspTransaction)2