1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-03 11:24:10 +01:00

Some fixing/cleanup:

- Swap fix type and satelite count in UI.
- Use QString for the packet signal, if it ever happens to be
multithreaded signal/slot this will be better (And char* should perish
:) )
- Make QString in the slots const and by reference, that seems to be
preferred (const = safer, reference = faster).
- Don't use 'new' QStrings in the nmea parser, not sot sure if that
causes memory leakage, but it wouldn't surprise me.
- Emit fix type updates from the (Serial) nmea parser.


git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1550 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
cranphin 2010-09-06 19:15:42 +00:00 committed by cranphin
parent 609d215749
commit c87ff38039
6 changed files with 563 additions and 556 deletions

View File

@ -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(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(speedheading(double,double)), m_widget,SLOT(setSpeedHeading(double,double)));
connect(parser, SIGNAL(datetime(double,double)), m_widget,SLOT(setDateTime(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(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(fixtype(QString)), m_widget, SLOT(setFixType(QString)));
connect(parser, SIGNAL(dop(double,double,double)), m_widget, SLOT(setDOP(double,double,double))); connect(parser, SIGNAL(dop(double,double,double)), m_widget, SLOT(setDOP(double,double,double)));

View File

@ -82,14 +82,24 @@ void GpsDisplayWidget::setDateTime(double date, double time)
time_value->setText(dstring1 + " " + dstring2 + " GMT"); 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) void GpsDisplayWidget::setSVs(int sv)

View File

@ -51,8 +51,8 @@ private slots:
void setPosition(double, double, double); void setPosition(double, double, double);
void setDateTime(double, double); void setDateTime(double, double);
void setSpeedHeading(double, double); void setSpeedHeading(double, double);
void dumpPacket(char*); void dumpPacket(const QString &packet);
void setFixType(QString fixtype); void setFixType(const QString &fixtype);
void setDOP(double hdop, double vdop, double pdop); void setDOP(double hdop, double vdop, double pdop);
private: private:

View File

@ -1,527 +1,527 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>GpsDisplayWidget</class> <class>GpsDisplayWidget</class>
<widget class="QWidget" name="GpsDisplayWidget"> <widget class="QWidget" name="GpsDisplayWidget">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>533</width> <width>533</width>
<height>424</height> <height>424</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QFrame" name="frame_2"> <widget class="QFrame" name="frame_2">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>300</width> <width>300</width>
<height>120</height> <height>120</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>400</width> <width>400</width>
<height>200</height> <height>200</height>
</size> </size>
</property> </property>
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::StyledPanel</enum> <enum>QFrame::StyledPanel</enum>
</property> </property>
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_3">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<item> <item>
<widget class="QLabel" name="lat_label"> <widget class="QLabel" name="lat_label">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>Coord:</string> <string>Coord:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="coord_value"> <widget class="QLabel" name="coord_value">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<weight>50</weight> <weight>50</weight>
<bold>false</bold> <bold>false</bold>
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>Unknown</string> <string>Unknown</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="coord_value_2"> <widget class="QLabel" name="coord_value_2">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<weight>50</weight> <weight>50</weight>
<bold>false</bold> <bold>false</bold>
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>Unknown</string> <string>Unknown</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="coord_value_3"> <widget class="QLabel" name="coord_value_3">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<weight>50</weight> <weight>50</weight>
<bold>false</bold> <bold>false</bold>
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>Unknown</string> <string>Unknown</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">
<item> <item>
<widget class="QLabel" name="speed_label"> <widget class="QLabel" name="speed_label">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>Speed:</string> <string>Speed:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="speed_value"> <widget class="QLabel" name="speed_value">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<weight>50</weight> <weight>50</weight>
<bold>false</bold> <bold>false</bold>
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>Unknown</string> <string>Unknown</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="bear_label"> <widget class="QLabel" name="bear_label">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>Heading:</string> <string>Heading:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="bear_value"> <widget class="QLabel" name="bear_value">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<weight>50</weight> <weight>50</weight>
<bold>false</bold> <bold>false</bold>
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>Unknown</string> <string>Unknown</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item> <item>
<widget class="Line" name="line"> <widget class="Line" name="line">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_5"> <layout class="QHBoxLayout" name="horizontalLayout_5">
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>H / V / P DOP:</string> <string>H / V / P DOP:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="dop_value"> <widget class="QLabel" name="dop_value">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<weight>50</weight> <weight>50</weight>
<bold>false</bold> <bold>false</bold>
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>0 / 0 / 0</string> <string>0 / 0 / 0</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item> <item>
<widget class="Line" name="line_2"> <widget class="Line" name="line_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_6"> <layout class="QHBoxLayout" name="horizontalLayout_6">
<item> <item>
<widget class="QLabel" name="fix_label_2"> <widget class="QLabel" name="fix_label_2">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>Sats Used:</string> <string>Sats Used:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="fix_value"> <widget class="QLabel" name="status_value">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<weight>50</weight> <weight>50</weight>
<bold>false</bold> <bold>false</bold>
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>Unknown</string> <string>Unknown</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_7"> <layout class="QHBoxLayout" name="horizontalLayout_7">
<item> <item>
<widget class="QLabel" name="fix_label"> <widget class="QLabel" name="fix_label">
<property name="text"> <property name="text">
<string>Fix Type:</string> <string>Fix Type:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="status_value"> <widget class="QLabel" name="fix_value">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<weight>50</weight> <weight>50</weight>
<bold>false</bold> <bold>false</bold>
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>Unknown</string> <string>Unknown</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_5"> <layout class="QVBoxLayout" name="verticalLayout_5">
<item> <item>
<widget class="QLabel" name="time_value"> <widget class="QLabel" name="time_value">
<property name="font"> <property name="font">
<font> <font>
<weight>50</weight> <weight>50</weight>
<bold>false</bold> <bold>false</bold>
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>Unknown</string> <string>Unknown</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
</layout> </layout>
</item> </item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="GpsConstellationWidget" name="gpsSky"> <widget class="GpsConstellationWidget" name="gpsSky">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>64</width> <width>64</width>
<height>64</height> <height>64</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>250</width> <width>250</width>
<height>250</height> <height>250</height>
</size> </size>
</property> </property>
<property name="sizeIncrement"> <property name="sizeIncrement">
<size> <size>
<width>10</width> <width>10</width>
<height>10</height> <height>10</height>
</size> </size>
</property> </property>
<property name="baseSize"> <property name="baseSize">
<size> <size>
<width>120</width> <width>120</width>
<height>120</height> <height>120</height>
</size> </size>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<widget class="QFrame" name="frame"> <widget class="QFrame" name="frame">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum"> <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>60</width> <width>60</width>
<height>60</height> <height>60</height>
</size> </size>
</property> </property>
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::StyledPanel</enum> <enum>QFrame::StyledPanel</enum>
</property> </property>
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QPushButton" name="connectButton"> <widget class="QPushButton" name="connectButton">
<property name="text"> <property name="text">
<string>Connect</string> <string>Connect</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="disconnectButton"> <widget class="QPushButton" name="disconnectButton">
<property name="text"> <property name="text">
<string>Disconnect</string> <string>Disconnect</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QGraphicsView" name="flatEarth"> <widget class="QGraphicsView" name="flatEarth">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>191</width> <width>191</width>
<height>95</height> <height>95</height>
</size> </size>
</property> </property>
<property name="baseSize"> <property name="baseSize">
<size> <size>
<width>191</width> <width>191</width>
<height>95</height> <height>95</height>
</size> </size>
</property> </property>
<property name="acceptDrops"> <property name="acceptDrops">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string extracomment="Location of GCS on the Earth"/> <string extracomment="Location of GCS on the Earth"/>
</property> </property>
<property name="verticalScrollBarPolicy"> <property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum> <enum>Qt::ScrollBarAlwaysOff</enum>
</property> </property>
<property name="horizontalScrollBarPolicy"> <property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum> <enum>Qt::ScrollBarAlwaysOff</enum>
</property> </property>
<property name="optimizationFlags"> <property name="optimizationFlags">
<set>QGraphicsView::DontAdjustForAntialiasing</set> <set>QGraphicsView::DontAdjustForAntialiasing</set>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QGraphicsView" name="graphicsView"> <widget class="QGraphicsView" name="graphicsView">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>250</width> <width>250</width>
<height>95</height> <height>95</height>
</size> </size>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="dataStreamGroupBox"> <widget class="QGroupBox" name="dataStreamGroupBox">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding"> <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
<height>100</height> <height>100</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>16777215</width> <width>16777215</width>
<height>250</height> <height>250</height>
</size> </size>
</property> </property>
<property name="title"> <property name="title">
<string>GPS Data Stream</string> <string>GPS Data Stream</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_4" stretch="0"> <layout class="QVBoxLayout" name="verticalLayout_4" stretch="0">
<property name="margin"> <property name="margin">
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QTextBrowser" name="textBrowser"> <widget class="QTextBrowser" name="textBrowser">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Ignored"> <sizepolicy hsizetype="Minimum" vsizetype="Ignored">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<family>Courier New</family> <family>Courier New</family>
<pointsize>8</pointsize> <pointsize>8</pointsize>
</font> </font>
</property> </property>
<property name="verticalScrollBarPolicy"> <property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum> <enum>Qt::ScrollBarAlwaysOn</enum>
</property> </property>
<property name="lineWrapMode"> <property name="lineWrapMode">
<enum>QTextEdit::WidgetWidth</enum> <enum>QTextEdit::WidgetWidth</enum>
</property> </property>
<property name="acceptRichText"> <property name="acceptRichText">
<bool>false</bool> <bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>
<class>GpsConstellationWidget</class> <class>GpsConstellationWidget</class>
<extends>QGraphicsView</extends> <extends>QGraphicsView</extends>
<header>gpsconstellationwidget.h</header> <header>gpsconstellationwidget.h</header>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>

View File

@ -32,7 +32,6 @@
#include <QtCore> #include <QtCore>
#include <stdint.h> #include <stdint.h>
class GPSParser: public QObject class GPSParser: public QObject
{ {
Q_OBJECT Q_OBJECT
@ -48,9 +47,9 @@ signals:
void position(double,double,double); // Lat, Lon, Alt void position(double,double,double); // Lat, Lon, Alt
void datetime(double,double); // Date then time void datetime(double,double); // Date then time
void speedheading(double,double); 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 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 void dop(double, double, double); // HDOP, VDOP, PDOP
}; };

View File

@ -208,7 +208,7 @@ uint8_t NMEAParser::nmeaProcess(cBuffer* rxBuffer)
#ifdef NMEA_DEBUG_PKT #ifdef NMEA_DEBUG_PKT
qDebug() << NmeaPacket; qDebug() << NmeaPacket;
#endif #endif
emit packet(NmeaPacket); emit packet(QString(NmeaPacket));
// found a packet // found a packet
// done with this processing session // done with this processing session
foundpacket = NMEA_UNKNOWN; foundpacket = NMEA_UNKNOWN;
@ -284,8 +284,8 @@ void NMEAParser::nmeaProcessGPGSV(char *packet)
} }
nmeaTerminateAtChecksum(packet); nmeaTerminateAtChecksum(packet);
QString* nmeaString = new QString( packet ); QString nmeaString( packet );
QStringList tokenslist = nmeaString->split(","); QStringList tokenslist = nmeaString.split(",");
// Officially there should be a max of three sentences (12 sats), some gps receivers do more.. // 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); nmeaTerminateAtChecksum(packet);
QString* nmeaString = new QString( packet ); QString nmeaString( packet );
QStringList tokenslist = nmeaString->split(","); QStringList tokenslist = nmeaString.split(",");
GpsData.GPStime = tokenslist.at(1).toDouble(); GpsData.GPStime = tokenslist.at(1).toDouble();
GpsData.Latitude = tokenslist.at(2).toDouble(); GpsData.Latitude = tokenslist.at(2).toDouble();
int deg = (int)GpsData.Latitude/100; int deg = (int)GpsData.Latitude/100;
@ -380,8 +380,8 @@ void NMEAParser::nmeaProcessGPRMC(char* packet)
} }
nmeaTerminateAtChecksum(packet); nmeaTerminateAtChecksum(packet);
QString* nmeaString = new QString( packet ); QString nmeaString( packet );
QStringList tokenslist = nmeaString->split(","); QStringList tokenslist = nmeaString.split(",");
GpsData.GPStime = tokenslist.at(1).toDouble(); GpsData.GPStime = tokenslist.at(1).toDouble();
GpsData.Groundspeed = tokenslist.at(7).toDouble(); GpsData.Groundspeed = tokenslist.at(7).toDouble();
GpsData.Groundspeed = GpsData.Groundspeed*0.51444; GpsData.Groundspeed = GpsData.Groundspeed*0.51444;
@ -410,8 +410,8 @@ void NMEAParser::nmeaProcessGPVTG(char* packet)
} }
nmeaTerminateAtChecksum(packet); nmeaTerminateAtChecksum(packet);
QString* nmeaString = new QString( packet ); QString nmeaString( packet );
QStringList tokenslist = nmeaString->split(","); QStringList tokenslist = nmeaString.split(",");
} }
/** /**
@ -432,28 +432,26 @@ void NMEAParser::nmeaProcessGPGSA(char* packet)
} }
nmeaTerminateAtChecksum(packet); nmeaTerminateAtChecksum(packet);
QString* nmeaString = new QString( packet ); QString nmeaString( packet );
QStringList tokenslist = nmeaString->split(","); QStringList tokenslist = nmeaString.split(",");
// next field: Mode // next field: Mode
// Mode: 1=Fix not available, 2=2D, 3=3D // Mode: 1=Fix not available, 2=2D, 3=3D
int mode = tokenslist.at(2).toInt(); 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) else if (mode == 2)
{ {
GpsData.Status = POSITIONACTUAL_STATUS_FIX2D; emit fixtype(QString("Fix2D"));
} }
else if (mode == 3) else if (mode == 3)
{ {
GpsData.Status = POSITIONACTUAL_STATUS_FIX3D; emit fixtype(QString("Fix3D"));
}*/ }
GpsData.PDOP = tokenslist.at(15).toDouble(); GpsData.PDOP = tokenslist.at(15).toDouble();
GpsData.HDOP = tokenslist.at(16).toDouble(); GpsData.HDOP = tokenslist.at(16).toDouble();
GpsData.VDOP = tokenslist.at(17).toDouble(); GpsData.VDOP = tokenslist.at(17).toDouble();
emit dop(GpsData.HDOP, GpsData.VDOP, GpsData.PDOP); emit dop(GpsData.HDOP, GpsData.VDOP, GpsData.PDOP);
} }