📄 qgps.h
字号:
//----------------------------------------------------------------------------// qgps.h : visualization widget for GPS device data//// - assume GPGSA is followed by GPGSV.//// - programmed by Boyoon Jung (boyoon@robotics.usc.edu)//----------------------------------------------------------------------------#ifndef __QGPS_H#define __QGPS_H// header files for IMU device#include <gps.h>// header files for Qt library#include <qgps_ui.h> // GPS UI#include <qpixmap.h>#include <qthread.h>#include <qsocket.h>// header files for debugging#include <iostream>#include <cstdio>#include <cerrno>using std::cerr;using std::endl;// constants#define DGPS_MSG_MAX 1024// class definition for GPS devicesclass QGps : public QGpsUI, public QThread{ //Q_OBJECT protected: GPS* gps; // GPS device int aprns[12]; // active PRNs char buffer[MAX_RTCM]; // message buffer QPixmap led_red, led_green, led_blue; // LEDs // retrieve the GPS info from the device virtual void run(void); // update the position page void updateGGA(void); // update the satellites page (active-satellite info only) void updateGSA(void); // update the satellites page (satellite-in-view info only) void updateGSV(void); // update the garmin page (estimated errors only) void updatePGRME(void); // update the garmin page (3D velocity only) void updatePGRMV(void); // check if a PRN is active or not bool isActive(int prn); // convert a latitude to a string char* lat2str(float l, char str[]); // convert a longitude to a string char* long2str(float l, char str[]); public: // constructor QGps(GPS* gps=0, QWidget* parent=0, const char* name=0, WFlags f=0); // destructor ~QGps(void); // set/get the IMU void setGPS(GPS* gps); GPS* getGPS(void) { return gps; }};// check if a PRN is active or notinline bool QGps::isActive(int prn){ for (int i=0; i<12 && aprns[i] >= 0; i++) if (aprns[i] == prn) return true; return false;}// convert a latitude to a stringinline char* QGps::lat2str(float l, char str[]){ float usl = fabs(l); int deg = int(usl); int min = int((usl-deg) * 60); int sec = int(((usl-deg) - (min/60.0)) * 3600); sprintf(str, "%dd %d\' %d\" %c", deg, min, sec, (l>0) ? 'N' : 'S'); return str;}// convert a longitude to a stringinline char* QGps::long2str(float l, char str[]){ float usl = fabs(l); int deg = int(usl); int min = int((usl-deg) * 60); int sec = int(((usl-deg) - (min/60.0)) * 3600); sprintf(str, "%dd %d\' %d\" %c", deg, min, sec, (l>0) ? 'E' : 'W'); return str;}#endif // __QGPS_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -