Summary description for GPS.
예제 #1
0
        public GpsConnector(Form1 parentForm)
        {
            //signed parent to gpsConnector
            this.parentForm = parentForm;

            //initialize gps hardware handler
            _gps = Hardware.Hardware.GetGpsHandler();

            //initialize list to contain position info
            _tmpPositionList = new List<GpsPosition>();
            //initialize satelliteView to contain satellite info
            satView = new SatelliteView();

            //if gps hardware exist and gpsIntermediateDriver exist
            //initialize gps connection and events
            if (_gps.hasGPS)
            {
                gps = new Gps();

                gpsEvents = new GpsEvents(this);

                if (!gps.Opened)
                {
                    gps.Open();
                    gpsEvents.newLocationReceived += new EventHandler<LocationChangedEventArgs>(gpsEvents.Form1_NewLocationReceived);

                    gps.LocationChanged += new LocationChangedEventHandler(gpsEvents.gps_LocationChanged);

                }
            }
        }
예제 #2
0
        public static string Gps_collection()      //H Sunartisi Gps_collection
        {
            string location;                       //Metabliti pou periexei plirofories topothesias
            string lat = "1";                        //Arxikopoihsh metablitis pou periexei plirofories Latidute(1 gia na einai diaforo tou 0 prokeimenou na doume ama douleuei to gps)
            string lon = "1";                       //Arxikopoihsh metablitis pou periexei plirofories Longitude(1 gia na einai diaforo tou 0 prokeimenou na doume ama douleuei to gps)

            Gps gps = null;                        //Dilosi metablitis tupou gps

            if (gps == null)
            {
                gps = new Gps();                  //Dimiourgia neou gps
                gps.Open();                       //Anoigma gps
            }
            else
            {
                gps.Close();                     //Eidalos kleinoume to Gps
                gps = null;
            }

            GpsPosition position = gps.GetPosition();     //Pernoume tis plirofories apo to gps

            lat = position.Latitude.ToString();           //Apothikeuoume to Latitude
            lon = position.Longitude.ToString();          //Apothikeuoume to Longitude

            if (gps != null)
                gps.Close();                              //Kleinoume ot gps

            location = lat + "|" + lon;                   //Ftiaxnoume to Sting (sumfona me ta protipo mas)
             
            return location;                              //To epistrefoume
        }
예제 #3
0
 /// <summary>
 /// Form1()
 /// </summary>
 public Form1()
 {
     InitializeComponent();
     _welcome = new Welcome(this);
     this.PanelPrincipal.Controls.Clear();
     this.PanelPrincipal.Controls.Add(_welcome);
     this.Timer.Enabled = true;
     this.Timer.Interval = 1000;
     objGps = new Gps();
 }
예제 #4
0
 /// <summary>Disposes the object</summary>
 public override void Dispose()
 {
     var wasDisposed = IsDisposed;
     base.Dispose();
     if (!wasDisposed)
     {
         gps.DeviceStateChanged -= gps_DeviceStateChanged;
         gps.LocationChanged -= gps_LocationChanged;
         gps = null;
     }
 }
예제 #5
0
        /// <summary>Disposes the object</summary>
        public override void Dispose()
        {
            var wasDisposed = IsDisposed;

            base.Dispose();
            if (!wasDisposed)
            {
                gps.DeviceStateChanged -= gps_DeviceStateChanged;
                gps.LocationChanged    -= gps_LocationChanged;
                gps = null;
            }
        }
예제 #6
0
        private void Main_Load(object sender, EventArgs e)
        {
            outlook = new OutlookSession();

            gps = new Gps();
            gps.Open();

            #region SMS Interception Setup

            smsInterceptor = new MessageInterceptor(InterceptionAction.NotifyAndDelete);

            smsInterceptor.MessageCondition = new MessageCondition(
                MessageProperty.Sender,
                MessagePropertyComparisonType.Equal,
                "+14254448851");

            smsInterceptor.MessageReceived += new MessageInterceptorEventHandler(smsInterceptor_MessageReceived);

            #endregion

            #region State Notification Setup

            umtsAvailable = new SystemState(SystemProperty.CellularSystemAvailableUmts);
            umtsAvailable.ComparisonType = StatusComparisonType.AnyChange;
            umtsAvailable.Changed += new ChangeEventHandler(umtsAvailable_Changed);

            detailsMenuItem.Enabled =
                ((int)umtsAvailable.CurrentValue & SN_CELLSYSTEMAVAILABLE_UMTS_BITMASK) != 0;

            #endregion
        }
예제 #7
0
        /// <summary>
        /// Almacena ruta del archivo RUTAS.txt
        /// </summary>
        /// <param name="args">recibe datos desde takeData</param>
        /// <param name="main">recibe instancia de MainWindows</param>
        public NoAcces(Form1 main, params String[] args)
        {
            InitializeComponent();

            this.main = main;
            //codigo,actual,n_medidor,verificador
            this.tCodeService.Text = args[0];

            this.tReadActual.Text = args[1];

            this.tN_medidor.Text = args[2];

            this.tVerificador.Text = args[3];

            this.tCodeService.Focus();

            this._date_hour = new Date_hour();

            #region comprueba que los codigos de servicio o rutas esten cargados

            if (this.main.cod_service_auto.Count < 1)
            {

                MessageBoxButtons buttons = MessageBoxButtons.YesNo;

                DialogResult dr = MessageBox.Show("No se cargo las rutas\n¿Desea cargarlas ahora?.", "", buttons, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

                if (dr == DialogResult.Yes)
                {
                    if (this.main.cargarRutas() > 0)
                    {
                        this.list_input_data = cid.read_file(this.main.filename);
                    }
                    /*else
                    {
                        this.list_input_data = new List<Input_data>();
                        Input_data _ID = new Input_data("00001", "2", "000000004521", "000061869", "005", "0000194", "1.00376");
                        list_input_data.Add(_ID);

                    }*/
                }

            }
            else
            {
                this.list_input_data = cid.read_file(this.main.filename);
               /* this.list_input_data = new List<Input_data>();
                Input_data _ID = new Input_data("00001", "2", "000000004521", "000061869", "005", "0000194", "1.00376");
                list_input_data.Add(_ID);*/
            }

            #endregion

            #region configuracio y activacion gps

            objGps = this.main.objGps;// new Gps();

            objGps.Close();

            if (!objGps.Opened)
            {

                // objgps.DeviceStateChanged += new DeviceStateChangedEventHandler(gps_DeviceStateChange);

                objGps.LocationChanged += new LocationChangedEventHandler(gps_LocationChanged);

                objGps.Open();
            }

            #endregion
        }
 /// <summary>
 /// Close GPS Connection
 /// </summary>
 public void Dispose()
 {
     if (_Gps != null && _Gps.Opened)
     {
         _Gps.Close();
     }
     _Gps = null;
 }
예제 #9
0
        /// <summary>
        /// TakeData(main)
        /// </summary>
        /// <param name="main">recibe instancia de MainWindows</param>
        public TakeData(Form1 main)
        {
            InitializeComponent();

            this.main = main;

            this._date_hour = new Date_hour();

            this.tCodServ.Focus();

            #region configuraciones visuales

            int anchoPanel = Convert.ToInt32(this.Width * 0.5);

            this.panel1.Width = anchoPanel;

            this.panel2.Width = anchoPanel;

            this.panel3.Width = anchoPanel;

            this.panel4.Width = anchoPanel;

            this.panel5.Width = anchoPanel;

            this.pSave.Width = anchoPanel;
            #endregion

            #region comprueba que existan los codigos de servicio o no

            if (this.main.cod_service_auto.Count < 1)
            {
                MessageBoxButtons buttons = MessageBoxButtons.YesNo;

                DialogResult dr = MessageBox.Show("Debe cargar las ahora.", "", buttons, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

                if (dr == DialogResult.Yes)
                {

                    if (this.main.cargarRutas() > 0)
                    {

                        this.list_input_data = cid.read_file(this.main.filename);

                    }
                    /*else
                    {
                        this.list_input_data = new List<Input_data>();
                        Input_data _ID = new Input_data("00001", "2", "000000004521", "000061869", "005", "0000194", "1.00376");
                        list_input_data.Add(_ID);

                    }*/
                }
            }
            else {
                this.list_input_data = cid.read_file(this.main.filename);
                /*
                this.list_input_data = new List<Input_data>();
                Input_data _ID = new Input_data("00001", "2", "000000004521", "000061869", "005", "0000194", "1.00376");
                list_input_data.Add(_ID);*/
            }
            #endregion

            #region configura y habilita gps
            objGps = this.main.objGps;//new Gps();
            objGps.Close();
            if (!objGps.Opened)
            {
                objGps.LocationChanged += new LocationChangedEventHandler(gps_LocationChanged);
                objGps.Open();
            }
            #endregion
        }
예제 #10
0
파일: Plot.cs 프로젝트: Mustack/ML-Forestry
        public void pollGPS()
        {
            gps = new Gps();
            gps.Open();

            gpsPosition = gps.GetPosition();

            //while (!gpsPosition.LatitudeValid || !gpsPosition.LatitudeValid)
                //Thread.Sleep(500);

            gps.Close();

            latitude = gpsPosition.Latitude;
            longitude = gpsPosition.Longitude;
        }
 public Geolocator()
 {
     gps = new Gps();
 }