19 #include "qextserialport.h" 23 #include <QApplication> 24 #include <QStringList> 32 #define KNOTS_TO_KMH 1.852 79 int endSentenceIndex = 0;
87 if ( endSentenceIndex == -1 )
93 if ( endSentenceIndex >= dollarIndex )
95 if ( dollarIndex != -1 )
104 QgsDebugMsg(
"*******************GPS data received****************" );
111 QgsDebugMsg(
"*******************GPS data received****************" );
118 QgsDebugMsg(
"*******************GPS data received****************" );
125 QgsDebugMsg(
"*******************GPS data received****************" );
132 QgsDebugMsg(
"*******************GPS data received****************" );
147 double longitude = result.
lon;
148 if ( result.
ew ==
'W' )
150 longitude = -longitude;
152 double latitude = result.
lat;
153 if ( result.
ns ==
'S' )
155 latitude = -latitude;
171 double longitude = result.
lon;
172 if ( result.
ew ==
'W' )
174 longitude = -longitude;
176 double latitude = result.
lat;
177 if ( result.
ns ==
'S' )
179 latitude = -latitude;
223 satelliteInfo.
id = currentSatellite.
id;
225 satelliteInfo.
signal = currentSatellite.
sig;
char ns
[N]orth or [S]outh
void nmeaSentenceReceived(const QString &substring)
Information about satellite.
int nmea_parse_GPVTG(const char *buff, int buff_sz, nmeaGPVTG *pack)
QString toString(Qt::DateFormat format) const
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
int azimuth
Azimuth, degrees from true north, 000 to 359.
char ns
[N]orth or [S]outh
QString & append(QChar ch)
Status mStatus
Connection status.
void processRMCSentence(const char *data, int len)
double nmea_ndeg2degree(double val)
int hour
Hours since midnight - [0,23].
int mon
Months since January - [0,11].
int id
Satellite PRN number.
double lon
Longitude in NDEG - [degree][min].
GGA packet information structure (Global Positioning System Fix Data)
double lat
Latitude in NDEG - [degree][min].
int year
Years since 1900.
double spk
Ground speed, kilometers per hour.
VTG packet information structure (Track made good and ground speed)
int satinuse
Number of satellites in use (not those in view)
int nmea_parse_GPRMC(const char *buff, int buff_sz, nmeaGPRMC *pack)
void setTime(const QTime &time)
double lat
Latitude in NDEG - [degree][min].
QString & remove(int position, int n)
void processStringBuffer()
Splits mStringBuffer into sentences and calls libnmea.
double direction
Track angle in degrees True.
virtual bool isSequential() const
QString mStringBuffer
Store data from the device before it is processed.
char status
Status (A = active or V = void)
int elv
Elevation in degrees, 90 maximum.
void setTimeSpec(Qt::TimeSpec spec)
void processGSASentence(const char *data, int len)
QString number(int n, int base)
void append(const T &value)
int day
Day of the month - [1,31].
double VDOP
Vertical dilution of precision.
virtual qint64 size() const
Abstract base class for connection to a GPS device.
QgsNMEAConnection(QIODevice *dev)
double elv
Antenna altitude above/below mean sea level (geoid)
QgsGPSInformation mLastGPSInformation
Last state of the gps related variables (e.g.
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const
double speed
Speed over the ground in knots.
void setDate(const QDate &date)
qint64 read(char *data, qint64 maxSize)
int nmea_parse_GPGGA(const char *buff, int buff_sz, nmeaGPGGA *pack)
void processGGASentence(const char *data, int len)
virtual qint64 bytesAvailable() const
char fix_mode
Mode (M = Manual, forced to operate in 2D or 3D; A = Automatic, 3D/2D)
QByteArray toLocal8Bit() const
int nmea_parse_GPGSV(const char *buff, int buff_sz, nmeaGPGSV *pack)
QIODevice * mSource
Data source (e.g.
GSA packet information structure (Satellite status)
void parseData() override
Parse available data source content.
QString mid(int position, int n) const
int pack_index
Message number.
nmeaTIME utc
UTC of position.
void stateChanged(const QgsGPSInformation &info)
void processGSVSentence(const char *data, int len)
void processVTGSentence(const char *data, int len)
double lon
Longitude in NDEG - [degree][min].
int pack_count
Total number of messages of this type in this cycle.
int sig
GPS quality indicator (0 = Invalid; 1 = Fix; 2 = Differential, 3 = Sensitive)
GSV packet information structure (Satellites in view)
int sec
Seconds after the minute - [0,59].
QDateTime toLocalTime() const
nmeaSATELLITE sat_data[NMEA_SATINPACK]
int msec
Thousandths part of second - [0,999].
int sat_prn[NMEA_MAXSAT]
PRNs of satellites used in position fix (null for unused fields)
int min
Minutes after the hour - [0,59].
int in_use
Used in position fix.
int fix_type
Type, used for navigation (1 = Fix not available; 2 = 2D; 3 = 3D)
double HDOP
Horizontal dilution of precision.
RMC packet information structure (Recommended Minimum sentence C)
double PDOP
Dilution of precision.
int nmea_parse_GPGSA(const char *buff, int buff_sz, nmeaGPGSA *pack)