Exemplo n.º 1
0
 private void btConnect_Click(object sender, EventArgs e)
 {
     if (ntripStarted)
     {
         try
         {
             if (ntrip != null)
             {
                 ntrip.StopNTRIP();
             }
             foreach (SerialPort port in Coms)
             {
                 port.Stop();
             }
             Coms.Clear();
             ntripStarted   = false;
             btConnect.Text = "Connect";
         }
         catch (Exception ex)
         {
             tbRTCM.AppendText(ex.Message + "\n");
         }
     }
     else
     {
         try
         {
             if (ntrip == null)
             {
                 ntrip = new SharpGis.SharpGps.NTRIP.NTRIPClient(new System.Net.IPEndPoint(System.Net.IPAddress.Parse(tbNTRIPServerIP.Text.Trim()), int.Parse(tbNTRIPPort.Text)), tbNTRIPUser.Text, tbNTRIPPasswd.Text);
             }
             ntrip.NTripDataReceived += ntrip_NTripDataReceived;
             foreach (string com in frmNtripSettings.COMs)
             {
                 string[]   portrate = com.Split(',');
                 SerialPort port     = new SerialPort(portrate[0], int.Parse(portrate[1]));
                 if (port.Port == frmNtripSettings.ReCom)
                 {
                     port.NewGPSData += port_NewGPSData;
                 }
                 port.Start();
                 Coms.Add(port);
             }
             ntrip.StartNTRIP(cbMountPoints.Text);
             ntripStarted   = true;
             btConnect.Text = "Connected";
         }
         catch (Exception ex)
         {
             tbRTCM.AppendText(ex.Message + "\n");
         }
     }
 }
Exemplo n.º 2
0
        public MainForm()
        {
            InitializeComponent();

            GPS              = new GPSHandler(this);                                  //Initialize GPS handler
            GPS.TimeOut      = 5;                                                     //Set timeout to 5 seconds
            GPS.NewGPSFix   += new GPSHandler.NewGPSFixHandler(this.GPSEventHandler); //Hook up GPS data events to a handler
            frmGpsSettings   = new FrmGpsSettings();
            frmNtripSettings = new FrmNTRIPSettings();
            ntrip            = null;
            ntripStarted     = false;
            Coms             = new List <SerialPort>();
        }
Exemplo n.º 3
0
        public MainForm()
        {
            InitializeComponent();

            GPS = new GPSHandler(this); //Initialize GPS handler
            GPS.TimeOut = 5; //Set timeout to 5 seconds
            GPS.NewGPSFix += new GPSHandler.NewGPSFixHandler(this.GPSEventHandler); //Hook up GPS data events to a handler
            frmGpsSettings = new FrmGpsSettings();
            frmNtripSettings = new FrmNTRIPSettings();
            ntrip = null;
            ntripStarted = false;
            Coms = new List<SerialPort>();
        }
Exemplo n.º 4
0
        private void btnNTRIPGetSourceTable_Click(object sender, EventArgs e)
        {
            cbMountPoints.Items.Clear();
            if (ntrip == null)
            {
                ntrip = new SharpGis.SharpGps.NTRIP.NTRIPClient(new System.Net.IPEndPoint(System.Net.IPAddress.Parse(tbNTRIPServerIP.Text.Trim()), int.Parse(tbNTRIPPort.Text)), tbNTRIPUser.Text, tbNTRIPPasswd.Text);
            }
            // http://igs.ifag.de/root_ftp/misc/ntrip/streamlist_euref-ip.htm

            SharpGis.SharpGps.NTRIP.SourceTable table = ntrip.GetSourceTable();
            if (table != null)
            {
                //dgNTRIPCasters.DataSource = table.Casters;
                //dgNTRIPNetworks.DataSource = table.Networks;
                //dgNTRIPStreams.DataSource = table.DataStreams;
                //dgNTRIPStreams.SetDataBinding(table.DataStreams, "");

                if (table.DataStreams.Count > 0)
                {
                    //ntrip.StartNTRIP(table.DataStreams[0].MountPoint);
                    foreach (SharpGis.SharpGps.NTRIP.SourceTable.NTRIPDataStream nst in table.DataStreams)
                    {
                        cbMountPoints.Items.Add(nst.MountPoint);
                    }
                    cbMountPoints.SelectedIndex = 0;
                }
                else
                {
                    MessageBox.Show("Sourcetable doesn't contain any datastreams");
                }
            }
            else
            {
                MessageBox.Show("Failed to request or parse the DataSource Table");
            }
        }
Exemplo n.º 5
0
 private void btConnect_Click(object sender, EventArgs e)
 {
     if (ntripStarted)
     {
         try
         {
             if (ntrip != null)
                 ntrip.StopNTRIP();
             foreach (SerialPort port in Coms)
             {
                 port.Stop();
             }
             Coms.Clear();
             ntripStarted = false;
             btConnect.Text = "Connect";
         }
         catch (Exception ex)
         {
             tbRTCM.AppendText(ex.Message + "\n");
         }
     }
     else
     {
         try
         {
             if (ntrip == null)
                 ntrip = new SharpGis.SharpGps.NTRIP.NTRIPClient(new System.Net.IPEndPoint(System.Net.IPAddress.Parse(tbNTRIPServerIP.Text.Trim()), int.Parse(tbNTRIPPort.Text)), tbNTRIPUser.Text, tbNTRIPPasswd.Text);
             ntrip.NTripDataReceived += ntrip_NTripDataReceived;
             foreach (string com in frmNtripSettings.COMs)
             {
                 string[] portrate = com.Split(',');
                 SerialPort port = new SerialPort(portrate[0], int.Parse(portrate[1]));
                 if (port.Port == frmNtripSettings.ReCom)
                     port.NewGPSData += port_NewGPSData;
                 port.Start();
                 Coms.Add(port);
             }
             ntrip.StartNTRIP(cbMountPoints.Text);
             ntripStarted = true;
             btConnect.Text = "Connected";
         }
         catch (Exception ex)
         {
             tbRTCM.AppendText(ex.Message + "\n");
         }
     }
 }
Exemplo n.º 6
0
        private void btnNTRIPGetSourceTable_Click(object sender, EventArgs e)
        {
            cbMountPoints.Items.Clear();
            if (ntrip == null)
                ntrip = new SharpGis.SharpGps.NTRIP.NTRIPClient(new System.Net.IPEndPoint(System.Net.IPAddress.Parse(tbNTRIPServerIP.Text.Trim()), int.Parse(tbNTRIPPort.Text)), tbNTRIPUser.Text, tbNTRIPPasswd.Text);
            // http://igs.ifag.de/root_ftp/misc/ntrip/streamlist_euref-ip.htm

            SharpGis.SharpGps.NTRIP.SourceTable table = ntrip.GetSourceTable();
            if (table != null)
            {
                //dgNTRIPCasters.DataSource = table.Casters;
                //dgNTRIPNetworks.DataSource = table.Networks;
                //dgNTRIPStreams.DataSource = table.DataStreams;
                //dgNTRIPStreams.SetDataBinding(table.DataStreams, "");

                if (table.DataStreams.Count > 0)
                {
                    //ntrip.StartNTRIP(table.DataStreams[0].MountPoint);
                    foreach (SharpGis.SharpGps.NTRIP.SourceTable.NTRIPDataStream nst in table.DataStreams)
                    {
                        cbMountPoints.Items.Add(nst.MountPoint);
                    }
                    cbMountPoints.SelectedIndex = 0;
                }
                else
                    MessageBox.Show("Sourcetable doesn't contain any datastreams");
            }
            else
                MessageBox.Show("Failed to request or parse the DataSource Table");
        }