采集WINCE设备GPS数据
来源:互联网 发布:广电网络电视没有信号 编辑:程序博客网 时间:2024/04/28 19:09
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Threading;using System.IO;namespace getgpsdata{ public partial class Form1 : Form { private delegate void FlushClient();//代理 public Form1() { InitializeComponent(); } Thread Online; private void btbegin_Click(object sender, EventArgs e) { if (!spgps.IsOpen) spgps.Open(); spgps.DiscardInBuffer();//清除输入缓冲区 spgps.DiscardOutBuffer();//清除输出缓冲区 Online = new Thread(CrossThreadFlush); Online.IsBackground = true; Online.Start(); } private void CrossThreadFlush() { while (true) { ThreadFunction(); //将sleep和无限循环放在等待异步的外面 //Thread.Sleep(7500); //30秒 //Thread.Sleep(3750); //15秒 Thread.Sleep(1250); //5秒 // spgps.DiscardInBuffer(); } } private void ThreadFunction() { if (this.txtdata.InvokeRequired)//等待异步 { FlushClient fc = new FlushClient(ThreadFunction); this.Invoke(fc);//通过代理调用刷新方法 } else { string record = spgps.ReadLine(); if (record.StartsWith("$GPRMC")) { txtdata.Text += record+"\n"; // 设置光标位置到文本最后 txtdata.SelectionStart = txtdata.TextLength; // 随文本滚动 txtdata.ScrollToCaret(); spgps.DiscardInBuffer(); } } } private void btstop_Click(object sender, EventArgs e) { //string gpsFile = "1秒" + DateTime.Now.ToString().Replace(@"/", @"-").Replace(@"\", @"-").Replace(@":", @"-") + ".txt"; string gpsFile = "5秒" + DateTime.Now.ToString().Replace(@"/", @"-").Replace(@"\", @"-").Replace(@":", @"-") + ".txt"; //string gpsFile = "15秒" + DateTime.Now.ToString().Replace(@"/", @"-").Replace(@"\", @"-").Replace(@":", @"-") + ".txt"; //string gpsFile = "30秒" + DateTime.Now.ToString().Replace(@"/", @"-").Replace(@"\", @"-").Replace(@":", @"-") + ".txt"; StreamWriter swFromFile = new StreamWriter("\\ResidentFlash\\" + gpsFile); swFromFile.Write(txtdata.Text); swFromFile.Flush(); swFromFile.Close(); this.Close(); try { Online.Abort(Online); } catch (System.Exception ex) { MessageBox.Show(ex.ToString()); } try { if (spgps.IsOpen) { spgps.Close(); } } catch (System.Exception ex) { MessageBox.Show(ex.ToString()); } } }}
- 采集WINCE设备GPS数据
- WinCE设备电池电量采集问题
- WinCE下的GPS设备操作
- Wince下的GPS设备操作
- WinCE下的GPS设备操作
- 用C#读取GPS数据的基类,适用于wince操作系统。 适合自带GPS模块的PDA或智能手机的设备
- 用C#读取GPS数据的基类,适用于wince操作系统。 适合自带GPS模块的PDA或智能手机的设备
- GPS设备采集的原始GPS坐标转换成百度坐标
- Delphi中利用MSCOMM控件进行GPS数据采集
- Delphi利用MSCOMM控件进行GPS数据采集
- BroadcastRecevier和Service开启APP-GPS数据采集服务
- arm9+linux fl2440 GPS 数据采集和处理
- 组态软件实现RFID设备数据采集
- 远程数据采集传输---RTU设备
- Tcp方式采集CNC兄弟设备数据
- WinCE在工业生产现场采集数据的应用
- 工业数据采集器,介绍嵌入式WinCE在远程数据采集系统设计
- WINCE GPS 虚拟串口
- UML类图中的6种关系
- oracle 9i/10g安装包和PATCH下载地址汇总
- Eclipse使用问题集
- 堆排序
- eclipse配置android开发环境
- 采集WINCE设备GPS数据
- OpenGL函数思考-glLoadIdentity
- js对象创建过程
- 设计模式入门学习 享元(Flyweight)模式
- vim乱码的一些问题
- C# ?(问号)的三个用处
- 关于float、cssFloat和styleFloat的讨论
- DIV横向排列
- Word常用操作