Esempio n. 1
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (rbAuto.Checked)
     {
         this.FixType = Fix_Type.Auto;
     }
     else
     {
         this.FixType = Fix_Type.Custom;
     }
     this.DialogResult = DialogResult.OK;
     this.Close();
 }
Esempio n. 2
0
        private void process_gpgsa(string []strdata,string gpsdata)
        {
            try
            {
                //0 Mode 1 - A - A = Auto 2D/3D, M = Forced 2D/3D
                if (strdata[0].Length>0)
                {
                    if (strdata[0][0]=='A')
                        fixmode = OpenNETCF.IO.Serial.GPS.Fix_Mode.Auto;
                    else
                        fixmode = OpenNETCF.IO.Serial.GPS.Fix_Mode.Manual;
                }

                //1 Mode 1 - 3 - 1 = No fix, 2 = 2D, 3 = 3D
                if (strdata[1].Length>0)
                {
                    switch (Convert.ToInt32(strdata[1]))
                    {
                        case 1:
                            fixindicator=OpenNETCF.IO.Serial.GPS.Fix_Indicator.NotSet;
                            fixtype=OpenNETCF.IO.Serial.GPS.Fix_Type.NotSet;
                            break;
                        case 2:
                            fixindicator=OpenNETCF.IO.Serial.GPS.Fix_Indicator.Mode2D;
                            fixtype=OpenNETCF.IO.Serial.GPS.Fix_Type.NoAltitude;
                            break;
                        case 3:
                            fixindicator=OpenNETCF.IO.Serial.GPS.Fix_Indicator.Mode3D;
                            fixtype=OpenNETCF.IO.Serial.GPS.Fix_Type.WithAltitude;
                            break;
                        default:
                            fixindicator=OpenNETCF.IO.Serial.GPS.Fix_Indicator.NotSet;
                            fixtype=OpenNETCF.IO.Serial.GPS.Fix_Type.NotSet;
                            break;
                    }
                }

                // if satellites is null because GSV sentence not arrived or not present
                if (satellites==null)
                {
                    nbsatused=0;
                    for (int intcount=0;intcount<12;intcount++)
                    {
                        string strid=strdata[2+intcount];
                        if (strid!="")
                        {
                            nbsatused++;
                        }
                    }
                    setupsats(nbsatused);
                }

                if (satellites!=null)
                {
                    foreach (Satellite s in this.satellites)
                    {
                        s.Active=false;
                        s.Channel=0;
                    }

                    //  2 Satellite used 1  - 01 - Satellite used on channel  1
                    //  3 Satellite used 2  - 20 - Satellite used on channel  2
                    //  4 Satellite used 3  - 19 - Satellite used on channel  3
                    //  5 Satellite used 4  - 13 - Satellite used on channel  4
                    //  6 Satellite used 5  -    - Satellite used on channel  5
                    //  7 Satellite used 6  -    - Satellite used on channel  6
                    //  8 Satellite used 7  -    - Satellite used on channel  7
                    //  9 Satellite used 8  -    - Satellite used on channel  8
                    // 10 Satellite used 9  -    - Satellite used on channel  9
                    // 11 Satellite used 10 -    - Satellite used on channel 10
                    // 12 Satellite used 11 -    - Satellite used on channel 11
                    // 13 Satellite used 12 -    - Satellite used on channel 12

                    nbsatused=0;
                    for (int intcount=0;intcount<12;intcount++)
                    {
                        string strid=strdata[2+intcount];
                        if (strid!="")
                        {
                            nbsatused++;
                            setsat(Convert.ToInt32(strid),intcount+1);
                        }
                    }
                }

                // 14 PDOP 40.4 Position dilution of precision
                if (strdata[14].Length>0)
                    pdop=Misc.ToDecimal(strdata[14]);

                // 15 HDOP 24.4 Horizontal dilution of precision
                if (strdata[15].Length>0)
                    hdop=Misc.ToDecimal(strdata[15]);

                // 16 VDOP 32.2 Vertical dilution of precision
                if (strdata[16].Length>0)
                    vdop=Misc.ToDecimal(strdata[16]);

            }
            catch(Exception ex)
            {
                OnError(ex,"Error in process_gpgsa",gpsdata);
            }
        }