当前位置:IT168首页 > 技术开发 > 概述
[收藏此页] [打印] [推荐] [评论]

WM下的GPS开发

责任编辑:nancy作者:ITPUB论坛   2008-07-03   
【内容导航】
文本Tag: 微软 sql

【IT168技术文档】

  内置GPS: 对于通用的WM设备,我们是通过串口Com9来获得内置GPS的信息的,而一般我们打开的比特率使用的是4800

  gPort.OpenPort(“com9”, 4800)

  打开端口之后,一般我们会启用新线程进行读数据
void ReadThreadFun() { byte[] buf = new byte[512];//端口缓存大小为512 int readLength = 0; while (_isWorking) { readLength = gPort.ReadPort(buf.Length, buf); lastReport += System.Text.Encoding.ASCII.GetString(buf, 0, readLength); try { string[] reports = lastReport.Split(new char[] { '\n' }); if ((reports[reports.Length - 1].Length > 0) && (reports[reports.Length - 1][reports[reports.Length - 1].Length - 1] != '\r')) lastReport = reports[reports.Length - 1]; else lastReport = ""; for (int i = 0; i < reports.Length; i++) { if (GetGpsInfo(reports[i])) { //记录GPS的各种信息 } } catch (Exception err) { } } } }
上一页
1
23下一页
收藏到: 添加到“百度搜藏”添加到“QQ书签”添加到“Google书签”添加到“Yahoo收藏”添加到“和讯网摘”
【内容导航】
本文欢迎转载,转载请注明:转载自IT168 [ http://www.it168.com/ ]
本文链接:http://tech.it168.com/d/2008-07-03/200807031042970.shtml
技术开发相关文章  
  • 暂无
友情推介