Exemplo n.º 1
0
        /**
         * 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();
            IEzspTransaction         transaction = _protocolHandler.SendEzspTransaction(new EzspSingleResponseTransaction(request, typeof(EzspNetworkStateResponse)));
            EzspNetworkStateResponse response    = (EzspNetworkStateResponse)transaction.GetResponse();

            _lastStatus = EmberStatus.UNKNOWN;

            return(response.GetStatus());
        }
        private bool CheckNetworkJoined()
        {
            // Check if the network is initialised
            EzspNetworkStateRequest  networkStateRequest     = new EzspNetworkStateRequest();
            IEzspTransaction         networkStateTransaction = _protocolHandler.SendEzspTransaction(new EzspSingleResponseTransaction(networkStateRequest, typeof(EzspNetworkStateResponse)));
            EzspNetworkStateResponse networkStateResponse    = (EzspNetworkStateResponse)networkStateTransaction.GetResponse();

            Log.Debug(networkStateResponse.ToString());
            Log.Debug("EZSP networkStateResponse {Status}", networkStateResponse.GetStatus());

            return(networkStateResponse.GetStatus() == EmberNetworkStatus.EMBER_JOINED_NETWORK);
        }