Exemplo n.º 1
0
        public static WiFiCardInterface getInstance()
        {
            if (wiFiCardInstance == null)
                wiFiCardInstance = new WiFiCardInterface();

            return wiFiCardInstance;
        }
        public DeviceDiscoveryDaemon(int timeout, int sleepMin, int sleepMax, addMessageDelegate msgDelegate)
        {
            tTimeOut = timeout;
            tSleepMin = sleepMin;
            tSleepMax = sleepMax;
            addMessageToLog = msgDelegate;

            wiFiCard = WiFiCardInterface.getInstance();

            neighbors = new List<AdHocAccessPoint>();

            Logger.flushAll();
        }
Exemplo n.º 3
0
        /// <summary>
        /// This function stops all timers and disables WiFi radio.
        /// </summary>
        public void stop()
        {
            StopDiscoveryTimer();

            LogNeighborRecords();

            try
            {
                if (wiFiCard != null)
                    wiFiCard.clearPreferredNetworks();

                if (_socketReceive != null)
                    _socketReceive.Close();

            }
            catch (Exception ex)
            {
                Logger.addEntry("OppCommHandler:stop - " + ex.Message);
            }
            finally
            {
                wiFiCard = null;
                _socketReceive = null;
            }

            try
            {
                if (SessionInitiationThread != null)
                    SessionInitiationThread.Abort();

                radioController.setWiFiRadio(false);

            }
            catch (ThreadAbortException)
            {
                Logger.addEntry("OppCommHandler: Aborting Session Initiation Thread.");
            }
            finally
            {
                SessionInitiationThread = null;
                radioController = null;
            }
        }