资源简介
飞凌-MX6UL GPS 模块的测试方法,请先确保已经连接 GPS 天线(最好将天线的接收端放到窗外)。运行 GPS 测试程序

代码片段和文件信息
#include “gps.h“
#include “ui_gps.h“
#define USE_BEIJING_TIMEZONE
gps::gps(QWidget *parent) :
QWidget(parent)
ui(new Ui::gps)
{
ui->setupUi(this);
m_timer = new QTimer;
connect(m_timer SIGNAL(timeout()) this SLOT(read_sermios()));
}
gps::~gps()
{
printf(“~gps\n“);
m_timer->stop();
delete ui;
}
void gps::on_pb_read_clicked()
{
printf(“read\n“);
set_termios();
m_timer->setInterval(1000);
m_timer->start();
}
void gps::on_pb_close_clicked()
{
printf(“close\n“);
m_timer->stop();
// ui->tedit_output->clear();
}
int gps:: set_termios()
{
int bound=ui->cmb_bound->currentText().toInt();
QString m_com=“/dev/“ + ui->cmb_com->currentText();
const char *com_name=m_com.toUtf8().constData();
fd = open(com_name O_RDWR | O_NONBLOCK| O_NOCTTY | O_NDELAY);
if(fd<0)
{
QMessageBox::about(NULL “About“ “com open error“);
return -1;
}
struct termios terminfo;
if (bound == 4800)
{
terminfo.c_cflag = B4800 | CRTSCTS | CS8 | CLOCAL | CREAD;/*ctrol flag*/
}
if (bound == 9600)
{
terminfo.c_cflag = B9600 | CRTSCTS | CS8 | CLOCAL | CREAD;/*ctrol flag*/
}
if (bound == 19200)
{
terminfo.c_cflag = B19200| CRTSCTS | CS8 | CLOCAL | CREAD;/*ctrol flag*/
}
if (bound == 38400)
{
terminfo.c_cflag = B38400 | CRTSCTS | CS8 | CLOCAL | CREAD;/*ctrol flag*/
}
terminfo.c_iflag = IGNPAR; /*input flag*/
terminfo.c_oflag = 0; /*output flag*/
terminfo.c_lflag = 0;/* local flag */
terminfo.c_cc[VMIN]=1;
terminfo.c_cc[VTIME]=0;
tcflush(fd TCIFLUSH);/*clear */
tcsetattr(fdTCSANOW&terminfo);/*set attrib */
return 1;
}
void gps::read_sermios()
{
gps_info gpsinfo;
int i=0j=0nread=0;
bool valid_flag=false;
char c;
char buf[1024];
nread=read(fd&c1);// read sermios
if(nread>0)
{
buf[i++] = c;
for(j=0;j<1024;j++)
{
nread=read(fd&c1);// read sermios
if(nread>0)
{
buf[i++] = c;
j++;
if(c == ‘\n‘ )
{
strncpy(m_bufbufi);
i=0;
j=0;
valid_flag=true;
break;
}
}
}
if (j>=1024)
{
printf(“baudrate error\n“);
ui->tedit_output->setText(“No data availableplease check the baudrate.“);
m_timer->stop();
return;
}
}
printf(“%s\n“&buf);
if(valid_flag==true)
{
parse_gps(m_buf&gpsinfo);
if ( gpsinfo.D.year > 1900 && gpsinfo.D.year < 2100)
{
QString date = QString(“%1-%2-%3“).arg(gpsinfo.D.year).arg(gpsinfo.D.month).arg(gpsinfo.D.day);
QString time = QString(“%1:%2:%3“).arg(gpsinfo.D.hour).arg(gpsinfo.D.minut
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 13 2016-05-26 17:18 qt-gps\.git\COMMIT_EDITMSG
文件 279 2016-05-26 17:18 qt-gps\.git\config
文件 73 2016-05-26 17:18 qt-gps\.git\desc
文件 38 2016-05-26 17:18 qt-gps\.git\HEAD
文件 452 2016-05-26 17:18 qt-gps\.git\hooks\applypatch-msg.sample
文件 896 2016-05-26 17:18 qt-gps\.git\hooks\commit-msg.sample
文件 189 2016-05-26 17:18 qt-gps\.git\hooks\post-update.sample
文件 398 2016-05-26 17:18 qt-gps\.git\hooks\pre-applypatch.sample
文件 1704 2016-05-26 17:18 qt-gps\.git\hooks\pre-commit.sample
文件 4898 2016-05-26 17:18 qt-gps\.git\hooks\pre-reba
文件 1239 2016-05-26 17:18 qt-gps\.git\hooks\prepare-commit-msg.sample
文件 3611 2016-05-26 17:18 qt-gps\.git\hooks\update.sample
文件 577 2016-05-26 17:18 qt-gps\.git\index
文件 240 2016-05-26 17:18 qt-gps\.git\info\exclude
文件 517 2016-05-26 17:18 qt-gps\.git\logs\HEAD
文件 297 2016-05-26 17:18 qt-gps\.git\logs\refs\heads\DualLite_GPS_optimize
文件 192 2016-05-26 17:18 qt-gps\.git\logs\refs\heads\master
文件 140 2016-05-26 17:18 qt-gps\.git\logs\refs\remotes\origin\DualLite_GPS_optimize
文件 626 2016-05-26 17:18 qt-gps\.git\ob
文件 16121 2016-05-26 17:18 qt-gps\.git\ob
文件 2413 2016-05-26 17:18 qt-gps\.git\ob
文件 225 2016-05-26 17:18 qt-gps\.git\ob
文件 175 2016-05-26 17:18 qt-gps\.git\ob
文件 1436 2016-05-26 17:18 qt-gps\.git\ob
文件 24746 2016-05-26 17:18 qt-gps\.git\ob
文件 94 2016-05-26 17:18 qt-gps\.git\packed-refs
文件 41 2016-05-26 17:18 qt-gps\.git\refs\heads\DualLite_GPS_optimize
文件 41 2016-05-26 17:18 qt-gps\.git\refs\heads\master
文件 41 2016-05-26 17:18 qt-gps\.git\refs\remotes\origin\DualLite_GPS_optimize
文件 32 2016-05-26 17:18 qt-gps\.git\refs\remotes\origin\HEAD
............此处省略43个文件信息
- 上一篇:SVG仿真模型适合PSIM9.0版本
- 下一篇:qt 4.85 CAN通讯测试
相关资源
- vtk QT做的三维地质可视化系统2of2
- 武汉大学 科傻GPS 静态后处理软件
- Qt局域网聊天软件
- Qt Creator opengl实现四元数鼠标控制轨迹
- QT局域网聊天系统(基于QT5.修改过)
- qt-电子点菜系统
- C 餐厅叫号系统(QT平)
- QT 实现文件下载
- qt图像处理
- QT,JPEG解码源代码(已完成)
- 开源的nmealib
- 相干与非相干实现捕获与跟踪GPS
- Qt 播放音频文件
- 天文钟GPS对时程序
- Qt 读取16进制的data文件
- MQTT+串口(usart)透传
- 易语言QQTEA算法源码
- VC工程转Qt工程文件的工具
- MQTT推送Demo
- 基于Linux、QT的视频监控系统的设计与
- Qt 百度地图 定位
- QT酷炫界面开发指南《QmlBook》
- 用切比雪夫多项式标准化GPS卫星轨道
- 起算点点位不同对GPS-RTK测高的影响
- GPS-RTK技术在公婆泉矿区详查中的应用
- Ubuntu下操作Excel,qt代码
- Qt图片浏览器 --基于Qt的Graphics View f
-
A web-ba
sed interview platform with geospat - qtnribbon2破解
- 根据GPS数据计算航向公式
评论
共有 条评论