コード例 #1
0
 /// <summary>
 /// Applies stored settings to the GPS Controller
 /// </summary>
 /// <param name="gps">The GPS Controler to apply settings to</param>
 public static void ApplyGpsSettings(GpsController gps)
 {
     try
     {
         gps.PortName = Settings.Default.gpsSerialPort;
         gps.PortBaudrate = Settings.Default.gpsBaud;
         gps.PortParity = Settings.Default.gpsParity;
         gps.PortHandshake = Settings.Default.gpsHandshake;
         gps.PortDataBits = Settings.Default.gpsDataBits;
         gps.PortStopBits = Settings.Default.gpsStopBits;
     }
     catch (Exception)
     {
         //Something went wrong applying settings, ignore
     }
 }
コード例 #2
0
        /// <summary>
        /// Applies stored settings to the GPS Controller
        /// </summary>
        /// <param name="gps">The GPS Controler to apply settings to</param>
        public static void ApplyGpsSettings(GpsController gps)
        {
            try
            {
                gps.PortName = Settings.Default.gpsSerialPort;
                gps.PortBaudrate = Settings.Default.gpsBaud;
                gps.PortParity = Settings.Default.gpsParity;
                gps.PortHandshake = Settings.Default.gpsHandshake;
                gps.PortDataBits = Settings.Default.gpsDataBits;
                gps.PortStopBits = Settings.Default.gpsStopBits;

                //Start GPS if it was last time
                if (Settings.Default.gpsEnabled && !string.IsNullOrEmpty(gps.PortName))
                {
                    gps.Start();
                }
            }
            catch (Exception)
            {
                //Something went wrong applying settings, ignore
            }
        }
コード例 #3
0
 //
 //        /// <summary>
 //        /// Gets the list of filters from settings
 //        /// </summary>
 //        /// <returns>The list of last use filters</returns>
 //        public static Filter[] GetFilterList()
 //        {
 //            if(string.IsNullOrEmpty(Settings.Default.lastFilters)) return new Filter[0];
 //            //The format is:
 //            //<filterExpr>|<filterExpr>|<filterExpr>|etc.
 //
 //            try
 //            {
 //                string[] parts = Settings.Default.lastFilters.Split('|');
 //                List<Filter> filters = new List<Filter>();
 //                foreach (string s in parts)
 //                {
 //                    filters.Add(new Filter(s));
 //                }
 //                return filters.ToArray();
 //            }
 //            catch
 //            {
 //                return new Filter[0];
 //            }
 //        }
 //
 //        /// <summary>
 //        /// Saves a list of filters to the last filters list
 //        /// </summary>
 //        /// <param name="filters">The filters to save</param>
 //        public static void SaveFilterList(Filter[] filters)
 //        {
 //            if (filters != null && filters.Length > 0)
 //            {
 //                StringBuilder sbOut = new StringBuilder();
 //                //The format is:
 //                //<filterExpr>|<filterExpr>|<filterExpr>|etc.
 //                try
 //                {
 //                    string pipe = "";
 //                    foreach (Filter f in filters)
 //                    {
 //                        sbOut.Append(pipe);
 //                        sbOut.Append(f.ToString());
 //                        pipe = "|";
 //                    }
 //                }
 //                catch (Exception)
 //                {
 //                    //No nothing.
 //                }
 //                Settings.Default.lastFilters = sbOut.ToString();
 //            }
 //            else
 //            {
 //                //Clear the last filters
 //                Settings.Default.lastFilters = string.Empty;
 //            }
 //        }
 /// <summary>
 /// Saves settings from GPS Controller
 /// </summary>
 /// <param name="gps">The GPS Controler save settings for</param>
 public static void SaveGpsSettings(GpsController gps)
 {
     try
     {
         Settings.Default.gpsEnabled = gps.Enabled;
         if (!string.IsNullOrEmpty(gps.PortName))
         {
             Settings.Default.gpsSerialPort = gps.PortName;
         }
         Settings.Default.gpsBaud = gps.PortBaudrate;
         Settings.Default.gpsParity = gps.PortParity;
         Settings.Default.gpsHandshake = gps.PortHandshake;
         Settings.Default.gpsDataBits = gps.PortDataBits;
         Settings.Default.gpsStopBits = gps.PortStopBits;
         Settings.Default.Save();
     }
     catch (Exception)
     {
         //Something went wrong saving settings, ignore
     }
 }
コード例 #4
0
 public FormGpsCfg(GpsController control)
 {
     InitializeComponent();
     _gpsC = control;
 }
コード例 #5
0
ファイル: ScanController.cs プロジェクト: sp1ke77/inSSIDer-2
        public bool Initialize(out Exception error)
        {
            error = null;
            NetworkScanner = new NetworkScannerN();

            //Set new data handler
            NetworkScanner.NewNetworkDataEvent += NetworkScannerNewNetworkDataEvent;

            //GPS
            GpsControl = new GpsController();

            Logger = new GpxDataLogger { AutoSave = true, AutoSaveInterval = TimeSpan.FromSeconds(10) };

            //Null scanning
            _tNullScan.Elapsed += TNullScanElapsed;

            //Init the interface manager
            InterfaceManager.Instance.Init(out error);

            return true;
        }
コード例 #6
0
        public void Dispose()
        {
            //Un-hook the event
            //NetworkScanner.NewNetworkDataEvent -= NetworkScannerNewNetworkDataEvent;

            Log.WriteLine("Stop _ns", "Scanner.Dispose()");
            NetworkScanner.Stop();
            Log.WriteLine("Dispose _ns", "Scanner.Dispose()");
            NetworkScanner.Dispose();
            Log.WriteLine("Null out Cache", "Scanner.Dispose()");
            Cache = null;
            Log.WriteLine("Stop GpsControl", "Scanner.Dispose()");
            GpsControl.Stop();
            Log.WriteLine("Null out GpsControl", "Scanner.Dispose()");
            GpsControl = null;
        }
コード例 #7
0
ファイル: Scanner.cs プロジェクト: metageektrent/inSSIDer-2
        public bool Initalize(out Exception error)
        {
            error = null;
            NetworkScanner = new NetworkScanner();

            //Set new data handler
            NetworkScanner.NewNetworkDataEvent += NetworkScannerNewNetworkDataEvent;

            Cache = new NetworkDataCacheN();

            //GPS
            GpsControl = new GpsController();
            GpsControl.GpsUpdated += GpsControl_GpsUpdated;
            GpsControl.GpsTimeout += GpsControl_GpsTimeout;
            GpsControl.GpsError += GpsControl_GpsError;
            GpsControl.GpsLocationUpdated += GpsControl_GpsLocationUpdated;

            Logger = new GpxDataLogger { AutoSave = true, AutoSaveInterval = TimeSpan.FromSeconds(10) };

            //Null scanning
            _tNullScan.Elapsed += TNullScanElapsed;

            try
            {
                WlanClient = new WlanClient();
            }
            catch (Win32Exception exception)
            {
                error = exception;
                return false;
                //MessageBox.Show("Error Initializing Wlan Client: " + exception.Message + "\n\nWi-Fi data will not be displayed.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            catch (DllNotFoundException)
            {
                error = new Exception(Localizer.GetString("WlanapiNotFound"));
                return false;
                //MessageBox.Show("Error: wlanapi.dll could not be found.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }

            return true;
        }
コード例 #8
0
ファイル: Scanner.cs プロジェクト: metageektrent/inSSIDer-2
 public void Dispose()
 {
     Log.WriteLine("Stop _ns", "Scanner.Dispose()");
     NetworkScanner.Stop();
     Log.WriteLine("Dispose _ns", "Scanner.Dispose()");
     NetworkScanner.Dispose();
     Log.WriteLine("Null out WlanClient", "Scanner.Dispose()");
     WlanClient = null;
     Log.WriteLine("Null out Cache", "Scanner.Dispose()");
     Cache = null;
     Log.WriteLine("Stop GpsControl", "Scanner.Dispose()");
     GpsControl.Stop();
     Log.WriteLine("Null out GpsControl", "Scanner.Dispose()");
     GpsControl = null;
 }