⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c++读取gps程序(wince).txt

📁 wince下读取gps的程序源代码
💻 TXT
字号:
用C#读取GPS数据的基类,适用于wince操作系统


using System;
using System.Runtime.InteropServices;
using System.Text;

namespace BaseStationPDA 
{
 class GPS 
 {

  public string PortNum; 
  public int BaudRate;
  public byte ByteSize;
  public byte Parity; // 0-4=no,odd,even,mark,space 
  public byte StopBits; // 0,1,2 = 1, 1.5, 2 
  public int ReadTimeout;
  
  //comm port win32 file handle
  private int hComm = -1;
  
  public bool Opened = false;
   
  //win32 api constants
  private const uint GENERIC_READ = 0x80000000;
  private const uint GENERIC_WRITE = 0x40000000;
  private const int OPEN_EXISTING = 3;  
  private const int INVALID_HANDLE_VALUE = -1;
  
  [StructLayout(LayoutKind.Sequential)]
   public struct DCB 
  {
   //taken from c struct in platform sdk 
   public int DCBlength;           // sizeof(DCB) 
   public int BaudRate;            // 指定当前波特率 current baud rate
   // these are the c struct bit fields, bit twiddle flag to set
   public int fBinary;          // 指定是否允许二进制模式,在windows95中必须主TRUE binary mode, no EOF check 
   public int fParity;          // 指定是否允许奇偶校验 enable parity checking 
   public int fOutxCtsFlow;      // 指定CTS是否用于检测发送控制,当为TRUE是CTS为OFF,发送将被挂起。 CTS output flow control 
   public int fOutxDsrFlow;      // 指定CTS是否用于检测发送控制 DSR output flow control 
   public int fDtrControl;       // DTR_CONTROL_DISABLE值将DTR置为OFF, DTR_CONTROL_ENABLE值将DTR置为ON, DTR_CONTROL_HANDSHAKE允许DTR"握手" DTR flow control type 
   public int fDsrSensitivity;   // 当该值为TRUE时DSR为OFF时接收的字节被忽略 DSR sensitivity 
   public int fTXContinueOnXoff; // 指定当接收缓冲区已满,并且驱动程序已经发送出XoffChar字符时发送是否停止。TRUE时,诮邮栈撼迩

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -