1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

Fix serial GPS not working (base function was not virtual), and some

minor tidying.


git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1501 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
cranphin 2010-09-01 21:49:47 +00:00 committed by cranphin
parent 9d1168226c
commit 102a16f0ff
6 changed files with 29 additions and 10 deletions

View File

@ -133,15 +133,17 @@ void GpsDisplayWidget::setParser(QString connectionMode)
{
if (connectionMode == "Serial") {
qDebug() << "Using Serial parser";
parser = new NMEAParser();
widget->connectButton->setEnabled(true);
widget->disconnectButton->setEnabled(false);
} else if (connectionMode == "Telemetry") {
qDebug() << "Using Telemetry parser";
parser = new TelemetryParser();
widget->connectButton->setEnabled(false);
widget->disconnectButton->setEnabled(false);
} else {
qDebug() << "Using Default parser";
parser = new NMEAParser(); // for the time being...
}
@ -150,10 +152,8 @@ void GpsDisplayWidget::setParser(QString connectionMode)
connect(parser,SIGNAL(speedheading(double,double)),this,SLOT(setSpeedHeading(double,double)));
connect(parser,SIGNAL(datetime(double,double)),this,SLOT(setDateTime(double,double)));
connect(parser,SIGNAL(packet(char*)), this, SLOT(dumpPacket(char*)));
connect(parser, SIGNAL(satellite(int,int,int,int,int)), widget->gpsSky, SLOT(updateSat(int,int,int,int,int)))
;
connect(parser, SIGNAL(satellite(int,int,int,int,int)), widget->gpsSky, SLOT(updateSat(int,int,int,int,int)));
port = NULL;
}
void GpsDisplayWidget::connectButtonClicked() {
@ -188,7 +188,6 @@ void GpsDisplayWidget::onDataAvailable() {
}
void GpsDisplayWidget::processNewSerialData(QByteArray serialData) {
int dataLength = serialData.size();
const char* data = serialData.constData();

View File

@ -26,3 +26,18 @@
*/
#include "gpsparser.h"
GPSParser::GPSParser(QObject *parent) : QObject(parent)
{
}
GPSParser::~GPSParser()
{
}
void GPSParser::processInputStream(char c) {
{
Q_UNUSED(c)}
}

View File

@ -37,7 +37,12 @@ class GPSParser: public QObject
{
Q_OBJECT
public:
void processInputStream(char c) { Q_UNUSED(c)};
~GPSParser();
virtual void processInputStream(char c);
protected:
GPSParser(QObject *parent = 0);
signals:
void sv(int); // Satellites in view
void position(double,double,double); // Lat, Lon, Alt

View File

@ -63,8 +63,9 @@
/**
* Initialize the parser
*/
NMEAParser::NMEAParser(QObject *parent):GPSParser()
NMEAParser::NMEAParser(QObject *parent):GPSParser(parent)
{
qDebug() << "NMEAParser::NMEAParser(" << parent << ")";
bufferInit(&gpsRxBuffer, (unsigned char *)gpsRxData, 512);
gpsRxOverflow=0;
}

View File

@ -57,6 +57,7 @@ typedef struct struct_GpsData
class NMEAParser: public GPSParser
{
Q_OBJECT
public:
NMEAParser(QObject *parent = 0);

View File

@ -35,10 +35,8 @@
/**
* Initialize the parser
*/
TelemetryParser::TelemetryParser(QObject *parent) : GPSParser()
TelemetryParser::TelemetryParser(QObject *parent) : GPSParser(parent)
{
Q_UNUSED(parent)
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
UAVDataObject *gpsObj = dynamic_cast<UAVDataObject*>(objManager->getObject("GPSPosition"));