• 大小: 293KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-09
  • 语言: 其他
  • 标签: GPS  串口  接收  

资源简介

此源码可以直接运行,示例如何接收GPS卫星报文、如何解析、如何使用的功能,可供参考。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace GPSSerialPortData
{
    public partial class ConfigForm : Form
    {
        public ConfigForm()
        {
            InitializeComponent();
        }

        private void ConfigForm_Load(object sender EventArgs e)
        {
            /*获取当前计算机上所有的串口*/
            string[] ports = System.IO.Ports.SerialPort.GetPortNames();
            //checkedListBox1.set
            foreach (string port in ports)
            {
                checkedListBox1.Items.Add(port);
            }
            //for (int i = 1; i < 10; i++)
            //{
            //    checkedListBox1.Items.Add(“COM“ + i.ToString());
            //}

            InitForm();
        }

        private void InitForm()
        {
            for (int i = 0; i < checkedListBox1.Items.Count; i++)
            {
                if (SerialPortConfig.IsExistPort(checkedListBox1.Items[i].ToString()))
                {
                    checkedListBox1.SetItemChecked(i true);
                }
                else
                {
                    checkedListBox1.SetItemChecked(i false);
                }
            }


            cbBaudRate.Text = SerialPortConfig.BaudRate.ToString();

            switch (SerialPortConfig.Parity)
            {
                case System.IO.Ports.Parity.Even:
                    cbParity.Text = “E“;
                    break;
                case System.IO.Ports.Parity.Mark:
                    cbParity.Text = “M“;
                    break;
                case System.IO.Ports.Parity.None:
                    cbParity.Text = “N“;
                    break;
                case System.IO.Ports.Parity.Odd:
                    cbParity.Text = “O“;
                    break;
                case System.IO.Ports.Parity.Space:
                    cbParity.Text = “S“;
                    break;
            }
            cbDataBits.Text = SerialPortConfig.DataBits.ToString();
            switch (SerialPortConfig.StopBits)
            {
                case System.IO.Ports.StopBits.None:
                    cbStopBits.Text = “0“;
                    break;
                case System.IO.Ports.StopBits.One:
                    cbStopBits.Text = “1“;
                    break;
                case System.IO.Ports.StopBits.OnePointFive:
                    cbStopBits.Text = “1.5“;
                    break;
                case System.IO.Ports.StopBits.Two:
                    cbStopBits.Text = “2“;
                    break;
            }
        }

        private void btnCancel_Click(object sender EventArgs e)
        {
            this.Close();
        }

        private void btnSave_Click(object sender EventArgs e)
        {
            try
            {
          

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       9984  2006-06-15 15:56  DBConfigForm.Designer.cs

     文件       6019  2006-06-15 15:56  DBConfigForm.resx

     文件       6821  2006-06-12 14:01  EchoplexOperationForm.cs

     文件       9313  2006-06-12 10:35  EchoplexOperationForm.Designer.cs

     文件       5814  2006-06-12 10:35  EchoplexOperationForm.resx

     文件       6777  2006-06-09 11:20  GPSSerialPortData.csproj

     文件        168  2006-06-09 11:20  GPSSerialPortData.csproj.user

     文件       1608  2006-06-26 19:41  GPSSerialPortData.sln

    ..A..H.     53248  2006-06-27 11:12  GPSSerialPortData.suo

     文件      18112  2006-06-27 11:08  MainFrom.cs

     文件      13936  2006-06-13 10:16  MainFrom.Designer.cs

     文件      13182  2006-06-13 10:16  MainFrom.resx

     文件      94208  2006-02-10 16:28  Microsoft.Practices.EnterpriseLibrary.Common.dll

     文件      69632  2006-02-10 16:29  Microsoft.Practices.EnterpriseLibrary.Data.dll

     文件      61440  2006-02-10 16:28  Microsoft.Practices.objectBuilder.dll

     文件       3200  2006-06-15 16:03  Program.cs

     文件          0  2006-05-29 09:31  ReceiveData.txt

     文件      20369  2006-04-25 13:41  SerialLCD.cs

     文件       5714  2006-06-13 10:15  SetTimeForm.cs

     文件       8721  2006-06-13 10:15  SetTimeForm.Designer.cs

     文件       5814  2006-06-13 10:15  SetTimeForm.resx

     文件        592  2006-06-07 17:13  TestForm.cs

     文件       2038  2006-06-07 16:48  TestForm.Designer.cs

     文件       5814  2006-06-07 16:48  TestForm.resx

     文件      94208  2006-02-10 16:28  bin\Debug\Microsoft.Practices.EnterpriseLibrary.Common.dll

     文件      69632  2006-02-10 16:29  bin\Debug\Microsoft.Practices.EnterpriseLibrary.Data.dll

     文件      61440  2006-02-10 16:28  bin\Debug\Microsoft.Practices.objectBuilder.dll

     文件          0  2006-05-29 09:31  bin\Debug\ReceiveData.txt

     文件        675  2006-06-27 10:41  bin\Debug\GPSSerialPortData.exe.config

     文件      69632  2006-06-27 11:08  bin\Debug\GPSSerialPortData.exe

............此处省略45个文件信息

评论

共有 条评论