diff --git a/ground/src/plugins/gpsdisplay/gpsdisplaygadget.cpp b/ground/src/plugins/gpsdisplay/gpsdisplaygadget.cpp index efca7b718..03c0760e6 100644 --- a/ground/src/plugins/gpsdisplay/gpsdisplaygadget.cpp +++ b/ground/src/plugins/gpsdisplay/gpsdisplaygadget.cpp @@ -105,7 +105,7 @@ void GpsDisplayGadget::loadConfiguration(IUAVGadgetConfiguration* config) connect(parser, SIGNAL(position(double,double,double)), m_widget,SLOT(setPosition(double,double,double))); connect(parser, SIGNAL(speedheading(double,double)), m_widget,SLOT(setSpeedHeading(double,double))); connect(parser, SIGNAL(datetime(double,double)), m_widget,SLOT(setDateTime(double,double))); - connect(parser, SIGNAL(packet(char*)), m_widget, SLOT(dumpPacket(char*))); + connect(parser, SIGNAL(packet(QString)), m_widget, SLOT(dumpPacket(QString))); connect(parser, SIGNAL(satellite(int,int,int,int,int)), m_widget->gpsSky, SLOT(updateSat(int,int,int,int,int))); connect(parser, SIGNAL(fixtype(QString)), m_widget, SLOT(setFixType(QString))); connect(parser, SIGNAL(dop(double,double,double)), m_widget, SLOT(setDOP(double,double,double))); diff --git a/ground/src/plugins/gpsdisplay/gpsdisplaywidget.cpp b/ground/src/plugins/gpsdisplay/gpsdisplaywidget.cpp index 79ba21a70..d13ccfde7 100644 --- a/ground/src/plugins/gpsdisplay/gpsdisplaywidget.cpp +++ b/ground/src/plugins/gpsdisplay/gpsdisplaywidget.cpp @@ -82,14 +82,24 @@ void GpsDisplayWidget::setDateTime(double date, double time) time_value->setText(dstring1 + " " + dstring2 + " GMT"); } -void GpsDisplayWidget::setFixType(QString fixtype) +void GpsDisplayWidget::setFixType(const QString &fixtype) { - fix_value->setText(fixtype); + if(fixtype =="NoGPS") { + fix_value->setText("No GPS"); + } else if (fixtype == "NoFix") { + fix_value->setText("Fix not available"); + } else if (fixtype == "Fix2D") { + fix_value->setText("2D"); + } else if (fixtype =="Fix3D") { + fix_value->setText("3D"); + } else { + fix_value->setText("Unknown"); + } } -void GpsDisplayWidget::dumpPacket(char *packet) +void GpsDisplayWidget::dumpPacket(const QString &packet) { - textBrowser->append(QString(packet)); + textBrowser->append(packet); } void GpsDisplayWidget::setSVs(int sv) diff --git a/ground/src/plugins/gpsdisplay/gpsdisplaywidget.h b/ground/src/plugins/gpsdisplay/gpsdisplaywidget.h index fe7228e36..d61608835 100644 --- a/ground/src/plugins/gpsdisplay/gpsdisplaywidget.h +++ b/ground/src/plugins/gpsdisplay/gpsdisplaywidget.h @@ -51,8 +51,8 @@ private slots: void setPosition(double, double, double); void setDateTime(double, double); void setSpeedHeading(double, double); - void dumpPacket(char*); - void setFixType(QString fixtype); + void dumpPacket(const QString &packet); + void setFixType(const QString &fixtype); void setDOP(double hdop, double vdop, double pdop); private: diff --git a/ground/src/plugins/gpsdisplay/gpsdisplaywidget.ui b/ground/src/plugins/gpsdisplay/gpsdisplaywidget.ui index d0ca2cdba..29f938082 100644 --- a/ground/src/plugins/gpsdisplay/gpsdisplaywidget.ui +++ b/ground/src/plugins/gpsdisplay/gpsdisplaywidget.ui @@ -1,527 +1,527 @@ - - - GpsDisplayWidget - - - - 0 - 0 - 533 - 424 - - - - Form - - - - - - - - - 0 - 0 - - - - - 300 - 120 - - - - - 400 - 200 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - - - 0 - 0 - - - - Coord: - - - - - - - - 0 - 0 - - - - - 50 - false - - - - Unknown - - - - - - - - 0 - 0 - - - - - 50 - false - - - - Unknown - - - - - - - - 0 - 0 - - - - - 50 - false - - - - Unknown - - - - - - - - - - - - 0 - 0 - - - - Speed: - - - - - - - - 0 - 0 - - - - - 50 - false - - - - Unknown - - - - - - - - 0 - 0 - - - - Heading: - - - - - - - - 0 - 0 - - - - - 50 - false - - - - Unknown - - - - - - - - - Qt::Horizontal - - - - - - - - - - 0 - 0 - - - - H / V / P DOP: - - - - - - - - 0 - 0 - - - - - 50 - false - - - - 0 / 0 / 0 - - - - - - - - - Qt::Horizontal - - - - - - - - - - 0 - 0 - - - - Sats Used: - - - - - - - - 0 - 0 - - - - - 50 - false - - - - Unknown - - - - - - - - - - - Fix Type: - - - - - - - - 0 - 0 - - - - - 50 - false - - - - Unknown - - - - - - - - - - 50 - false - - - - Unknown - - - - - - - - - - - - - - - 0 - 0 - - - - - 64 - 64 - - - - - 250 - 250 - - - - - 10 - 10 - - - - - 120 - 120 - - - - - - - - - - - - - 0 - 0 - - - - - 60 - 60 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - Connect - - - - - - - Disconnect - - - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 191 - 95 - - - - - 191 - 95 - - - - false - - - - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOff - - - QGraphicsView::DontAdjustForAntialiasing - - - - - - - - 0 - 0 - - - - - 250 - 95 - - - - - - - - - - - 0 - 0 - - - - - 0 - 100 - - - - - 16777215 - 250 - - - - GPS Data Stream - - - - 0 - - - - - - 0 - 0 - - - - - Courier New - 8 - - - - Qt::ScrollBarAlwaysOn - - - QTextEdit::WidgetWidth - - - false - - - - - - - - - - - GpsConstellationWidget - QGraphicsView -
gpsconstellationwidget.h
-
-
- - -
+ + + GpsDisplayWidget + + + + 0 + 0 + 533 + 424 + + + + Form + + + + + + + + + 0 + 0 + + + + + 300 + 120 + + + + + 400 + 200 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + + + 0 + 0 + + + + Coord: + + + + + + + + 0 + 0 + + + + + 50 + false + + + + Unknown + + + + + + + + 0 + 0 + + + + + 50 + false + + + + Unknown + + + + + + + + 0 + 0 + + + + + 50 + false + + + + Unknown + + + + + + + + + + + + 0 + 0 + + + + Speed: + + + + + + + + 0 + 0 + + + + + 50 + false + + + + Unknown + + + + + + + + 0 + 0 + + + + Heading: + + + + + + + + 0 + 0 + + + + + 50 + false + + + + Unknown + + + + + + + + + Qt::Horizontal + + + + + + + + + + 0 + 0 + + + + H / V / P DOP: + + + + + + + + 0 + 0 + + + + + 50 + false + + + + 0 / 0 / 0 + + + + + + + + + Qt::Horizontal + + + + + + + + + + 0 + 0 + + + + Sats Used: + + + + + + + + 0 + 0 + + + + + 50 + false + + + + Unknown + + + + + + + + + + + Fix Type: + + + + + + + + 0 + 0 + + + + + 50 + false + + + + Unknown + + + + + + + + + + 50 + false + + + + Unknown + + + + + + + + + + + + + + + 0 + 0 + + + + + 64 + 64 + + + + + 250 + 250 + + + + + 10 + 10 + + + + + 120 + 120 + + + + + + + + + + + + + 0 + 0 + + + + + 60 + 60 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Connect + + + + + + + Disconnect + + + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 191 + 95 + + + + + 191 + 95 + + + + false + + + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + QGraphicsView::DontAdjustForAntialiasing + + + + + + + + 0 + 0 + + + + + 250 + 95 + + + + + + + + + + + 0 + 0 + + + + + 0 + 100 + + + + + 16777215 + 250 + + + + GPS Data Stream + + + + 0 + + + + + + 0 + 0 + + + + + Courier New + 8 + + + + Qt::ScrollBarAlwaysOn + + + QTextEdit::WidgetWidth + + + false + + + + + + + + + + + GpsConstellationWidget + QGraphicsView +
gpsconstellationwidget.h
+
+
+ + +
diff --git a/ground/src/plugins/gpsdisplay/gpsparser.h b/ground/src/plugins/gpsdisplay/gpsparser.h index a45d54732..750cecb16 100644 --- a/ground/src/plugins/gpsdisplay/gpsparser.h +++ b/ground/src/plugins/gpsdisplay/gpsparser.h @@ -32,7 +32,6 @@ #include #include - class GPSParser: public QObject { Q_OBJECT @@ -48,9 +47,9 @@ signals: void position(double,double,double); // Lat, Lon, Alt void datetime(double,double); // Date then time void speedheading(double,double); - void packet(char*); // Raw NMEA Packet (or just info) + void packet(QString); // Raw NMEA Packet (or just info) void satellite(int,int,int,int,int); // Index, PRN, Elevation, Azimuth, SNR - void fixtype(QString); // Type of fix (none, 2D, 3D, etc). + void fixtype(QString); // Type of fix: "NoGPS", "NoFix", "Fix2D", "Fix3D". void dop(double, double, double); // HDOP, VDOP, PDOP }; diff --git a/ground/src/plugins/gpsdisplay/nmeaparser.cpp b/ground/src/plugins/gpsdisplay/nmeaparser.cpp index 0cfe169d9..935141312 100644 --- a/ground/src/plugins/gpsdisplay/nmeaparser.cpp +++ b/ground/src/plugins/gpsdisplay/nmeaparser.cpp @@ -208,7 +208,7 @@ uint8_t NMEAParser::nmeaProcess(cBuffer* rxBuffer) #ifdef NMEA_DEBUG_PKT qDebug() << NmeaPacket; #endif - emit packet(NmeaPacket); + emit packet(QString(NmeaPacket)); // found a packet // done with this processing session foundpacket = NMEA_UNKNOWN; @@ -284,8 +284,8 @@ void NMEAParser::nmeaProcessGPGSV(char *packet) } nmeaTerminateAtChecksum(packet); - QString* nmeaString = new QString( packet ); - QStringList tokenslist = nmeaString->split(","); + QString nmeaString( packet ); + QStringList tokenslist = nmeaString.split(","); // Officially there should be a max of three sentences (12 sats), some gps receivers do more.. @@ -333,8 +333,8 @@ void NMEAParser::nmeaProcessGPGGA(char* packet) } nmeaTerminateAtChecksum(packet); - QString* nmeaString = new QString( packet ); - QStringList tokenslist = nmeaString->split(","); + QString nmeaString( packet ); + QStringList tokenslist = nmeaString.split(","); GpsData.GPStime = tokenslist.at(1).toDouble(); GpsData.Latitude = tokenslist.at(2).toDouble(); int deg = (int)GpsData.Latitude/100; @@ -380,8 +380,8 @@ void NMEAParser::nmeaProcessGPRMC(char* packet) } nmeaTerminateAtChecksum(packet); - QString* nmeaString = new QString( packet ); - QStringList tokenslist = nmeaString->split(","); + QString nmeaString( packet ); + QStringList tokenslist = nmeaString.split(","); GpsData.GPStime = tokenslist.at(1).toDouble(); GpsData.Groundspeed = tokenslist.at(7).toDouble(); GpsData.Groundspeed = GpsData.Groundspeed*0.51444; @@ -410,8 +410,8 @@ void NMEAParser::nmeaProcessGPVTG(char* packet) } nmeaTerminateAtChecksum(packet); - QString* nmeaString = new QString( packet ); - QStringList tokenslist = nmeaString->split(","); + QString nmeaString( packet ); + QStringList tokenslist = nmeaString.split(","); } /** @@ -432,28 +432,26 @@ void NMEAParser::nmeaProcessGPGSA(char* packet) } nmeaTerminateAtChecksum(packet); - QString* nmeaString = new QString( packet ); - QStringList tokenslist = nmeaString->split(","); + QString nmeaString( packet ); + QStringList tokenslist = nmeaString.split(","); // next field: Mode // Mode: 1=Fix not available, 2=2D, 3=3D int mode = tokenslist.at(2).toInt(); - /*if (mode == 1) + if (mode == 1) { - GpsData.Status = POSITIONACTUAL_STATUS_NOFIX; + emit fixtype(QString("NoFix")); } else if (mode == 2) { - GpsData.Status = POSITIONACTUAL_STATUS_FIX2D; + emit fixtype(QString("Fix2D")); } else if (mode == 3) { - GpsData.Status = POSITIONACTUAL_STATUS_FIX3D; - }*/ + emit fixtype(QString("Fix3D")); + } + GpsData.PDOP = tokenslist.at(15).toDouble(); GpsData.HDOP = tokenslist.at(16).toDouble(); GpsData.VDOP = tokenslist.at(17).toDouble(); emit dop(GpsData.HDOP, GpsData.VDOP, GpsData.PDOP); - } - -