-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathgps.h
120 lines (91 loc) · 2.49 KB
/
gps.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#ifndef GPS_H
#define GPS_H
#include "serialport.h"
#include <QElapsedTimer>
#include <QTimer>
class DashBoard;
class Serialport;
class GPS : public QObject
{
Q_OBJECT
public:
explicit GPS(QObject *parent = 0);
explicit GPS(DashBoard *dashboard, QObject *parent = 0);
Q_INVOKABLE void defineFinishLine(const qreal & Y1,const qreal & X1,const qreal & Y2,const qreal & X2);
Q_INVOKABLE void defineFinishLine2(const qreal & Y1,const qreal & X1,const qreal & Y2,const qreal & X2);
Q_INVOKABLE void resetLaptimer();
private:
DashBoard *m_dashboard;
SerialPort *m_serialport;
QByteArray m_readData;
QByteArray m_buffer;
QElapsedTimer m_timer;
QTimer m_timeouttimer;
QString convertToDecimal(const QString & coord, const QString & dir);
void processGPRMC(const QString &line);
void checklinecrossed();
void linecrossed();
void processGPGGA(const QString &line);
void processGPVTG(const QString & line);
void checknewLap();
public slots:
//void delaytimer();
void openConnection(const QString &portName,const QString &Baud);
void ProcessMessage(QByteArray messageline);
void removeNMEAmsg();
void setGPSBAUD115();
void setGPS10HZ();
void setGPSOnly();
void closeConnection();
void closeConnection1();
void clear();
private slots:
void readyToRead();
void handleTimeout();
void handleError(QSerialPort::SerialPortError error);
void initSerialPort();
signals:
void sig_linecrossed();
};
#endif // GPS_H
/*
#ifndef GPS_H
#define GPS_H
#define _USE_MATH_DEFINES
#include <QDebug>
#include <vector>
#include <QDesktopServices>
#include <QUrl>
#include <cmath>
#include <map>
#include <QSerialPort>
#include <QSerialPortInfo>
#include <QQueue>
#include <QObject>
class DashBoard;
class GPS : public QObject
{
Q_OBJECT
public:
explicit GPS(QObject *parent = 0);
explicit GPS(DashBoard *dashboard, QObject *parent = 0);
public slots:
void startGPScom(const QString &portName,const int &baud);
void stopGPScom();
signals:
void portStatusChange(const bool &portStatus);
void rmcUpde(const QString & rmcList);
private slots:
void readLine();
void printUpdate(const QString & update);
void initSerialPort();
private:
DashBoard *m_dashboard;
QString convertToDecimal(const QString & coord, const QString & dir);
void processLine(const QString &line);
QSerialPort *com;
QByteArray serialData;
QString serialBuffer;
};
#endif // GPS_H
*/