mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
Update to the GPS display gadget from Cranphin. Very nice work, not tested on Mac or Linux yet, works great on Windows.
Please test on Mac & Linux and report. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1213 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
eb00be6a14
commit
f4abfd12f0
@ -47,6 +47,16 @@ GpsDisplayGadget::~GpsDisplayGadget()
|
||||
*/
|
||||
void GpsDisplayGadget::loadConfiguration(IUAVGadgetConfiguration* config)
|
||||
{
|
||||
GpsDisplayGadgetConfiguration *m = qobject_cast<GpsDisplayGadgetConfiguration*>(config);
|
||||
//m_widget->setSystemFile(m->getSystemFile()); // Triggers widget repaint
|
||||
GpsDisplayGadgetConfiguration *m = qobject_cast< GpsDisplayGadgetConfiguration*>(config);
|
||||
PortSettings portsettings;
|
||||
portsettings.BaudRate=m->speed();
|
||||
portsettings.DataBits=m->dataBits();
|
||||
portsettings.FlowControl=m->flow();
|
||||
portsettings.Parity=m->parity();
|
||||
portsettings.StopBits=m->stopBits();
|
||||
portsettings.Timeout_Millisec=m->timeOut();
|
||||
|
||||
//Creates new serial port with the user configuration and passes it to the widget
|
||||
QextSerialPort *port=new QextSerialPort(m->port(),portsettings,QextSerialPort::Polling);
|
||||
m_widget->setPort(port);
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include "gpsdisplaygadgetconfiguration.h"
|
||||
#include <QtCore/QDataStream>
|
||||
#include <qextserialport/src/qextserialport.h>
|
||||
|
||||
/**
|
||||
* Loads a saved configuration or defaults if non exist.
|
||||
@ -34,14 +35,52 @@
|
||||
*/
|
||||
GpsDisplayGadgetConfiguration::GpsDisplayGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent) :
|
||||
IUAVGadgetConfiguration(classId, parent),
|
||||
systemFile("Unknown")
|
||||
m_defaultPort("Unknown"),
|
||||
m_defaultSpeed(BAUD4800),
|
||||
m_defaultDataBits(DATA_8),
|
||||
m_defaultFlow(FLOW_OFF),
|
||||
m_defaultParity(PAR_NONE),
|
||||
m_defaultStopBits(STOP_1),
|
||||
m_defaultTimeOut(5000)
|
||||
|
||||
{
|
||||
//if a saved configuration exists load it
|
||||
if (state.count() > 0) {
|
||||
QDataStream stream(state);
|
||||
stream >> systemFile;
|
||||
BaudRateType speed;
|
||||
DataBitsType databits;
|
||||
FlowType flow;
|
||||
ParityType parity;
|
||||
StopBitsType stopbits;
|
||||
int ispeed;
|
||||
int idatabits;
|
||||
int iflow;
|
||||
int iparity;
|
||||
int istopbits;
|
||||
QString port;
|
||||
stream >> ispeed;
|
||||
stream >> idatabits;
|
||||
stream >>iflow;
|
||||
stream >>iparity;
|
||||
stream >> istopbits;
|
||||
stream >> port;
|
||||
|
||||
databits=(DataBitsType) idatabits;
|
||||
flow=(FlowType)iflow;
|
||||
parity=(ParityType)iparity;
|
||||
stopbits=(StopBitsType)istopbits;
|
||||
speed=(BaudRateType)ispeed;
|
||||
m_defaultPort=port;
|
||||
m_defaultSpeed=speed;
|
||||
m_defaultDataBits=databits;
|
||||
m_defaultFlow=flow;
|
||||
m_defaultParity=parity;
|
||||
m_defaultStopBits=stopbits;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Clones a configuration.
|
||||
*
|
||||
@ -49,9 +88,16 @@ GpsDisplayGadgetConfiguration::GpsDisplayGadgetConfiguration(QString classId, co
|
||||
IUAVGadgetConfiguration *GpsDisplayGadgetConfiguration::clone()
|
||||
{
|
||||
GpsDisplayGadgetConfiguration *m = new GpsDisplayGadgetConfiguration(this->classId());
|
||||
m->systemFile=systemFile;
|
||||
|
||||
m->m_defaultSpeed=m_defaultSpeed;
|
||||
m->m_defaultDataBits=m_defaultDataBits;
|
||||
m->m_defaultFlow=m_defaultFlow;
|
||||
m->m_defaultParity=m_defaultParity;
|
||||
m->m_defaultStopBits=m_defaultStopBits;
|
||||
m->m_defaultPort=m_defaultPort;
|
||||
return m;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves a configuration.
|
||||
*
|
||||
@ -60,7 +106,11 @@ QByteArray GpsDisplayGadgetConfiguration::saveState() const
|
||||
{
|
||||
QByteArray bytes;
|
||||
QDataStream stream(&bytes, QIODevice::WriteOnly);
|
||||
stream << systemFile;
|
||||
|
||||
stream << (int)m_defaultSpeed;
|
||||
stream << (int)m_defaultDataBits;
|
||||
stream << (int)m_defaultFlow;
|
||||
stream << (int)m_defaultParity;
|
||||
stream << (int)m_defaultStopBits;
|
||||
stream << m_defaultPort;
|
||||
return bytes;
|
||||
}
|
||||
|
@ -29,30 +29,45 @@
|
||||
#define GPSDISPLAYGADGETCONFIGURATION_H
|
||||
|
||||
#include <coreplugin/iuavgadgetconfiguration.h>
|
||||
#include <qextserialport/src/qextserialport.h>
|
||||
|
||||
using namespace Core;
|
||||
|
||||
/* This is a generic system health gadget displaying
|
||||
system alarms for one or more components.
|
||||
*/
|
||||
class GpsDisplayGadgetConfiguration : public IUAVGadgetConfiguration
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GpsDisplayGadgetConfiguration(QString classId, const QByteArray &state = 0, QObject *parent = 0);
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GpsDisplayGadgetConfiguration(QString classId, const QByteArray &state = 0, QObject *parent = 0);
|
||||
|
||||
//set gps display configuration functions
|
||||
void setSystemFile(QString filename){systemFile=filename;}
|
||||
//set port configuration functions
|
||||
void setSpeed(BaudRateType speed) {m_defaultSpeed=speed;}
|
||||
void setDataBits(DataBitsType databits) {m_defaultDataBits=databits;}
|
||||
void setFlow(FlowType flow) {m_defaultFlow=flow;}
|
||||
void setParity(ParityType parity) {m_defaultParity=parity;}
|
||||
void setStopBits(StopBitsType stopbits) {m_defaultStopBits=stopbits;}
|
||||
void setPort(QString port){m_defaultPort=port;}
|
||||
void setTimeOut(long timeout){m_defaultTimeOut=timeout;}
|
||||
|
||||
//get dial configuration functions
|
||||
QString getSystemFile() {return systemFile;}
|
||||
//get port configuration functions
|
||||
QString port(){return m_defaultPort;}
|
||||
BaudRateType speed() {return m_defaultSpeed;}
|
||||
FlowType flow() {return m_defaultFlow;}
|
||||
DataBitsType dataBits() {return m_defaultDataBits;}
|
||||
StopBitsType stopBits() {return m_defaultStopBits;}
|
||||
ParityType parity() {return m_defaultParity;}
|
||||
long timeOut(){return m_defaultTimeOut;}
|
||||
|
||||
QByteArray saveState() const;
|
||||
IUAVGadgetConfiguration *clone();
|
||||
QByteArray saveState() const;
|
||||
IUAVGadgetConfiguration *clone();
|
||||
|
||||
private:
|
||||
// systemFile contains the source SVG:
|
||||
QString systemFile;
|
||||
private:
|
||||
QString m_defaultPort;
|
||||
BaudRateType m_defaultSpeed;
|
||||
DataBitsType m_defaultDataBits;
|
||||
FlowType m_defaultFlow;
|
||||
ParityType m_defaultParity;
|
||||
StopBitsType m_defaultStopBits;
|
||||
long m_defaultTimeOut;
|
||||
|
||||
};
|
||||
|
||||
|
@ -165,21 +165,72 @@ return s1.portName<s2.portName;
|
||||
//creates options page widget (uses the UI file)
|
||||
QWidget *GpsDisplayGadgetOptionsPage::createPage(QWidget *parent)
|
||||
{
|
||||
|
||||
options_page = new Ui::GpsDisplayGadgetOptionsPage();
|
||||
//main widget
|
||||
QWidget *optionsPageWidget = new QWidget;
|
||||
//main layout
|
||||
options_page->setupUi(optionsPageWidget);
|
||||
|
||||
// Restore the contents from the settings:
|
||||
options_page->svgFilePathChooser->setExpectedKind(Utils::PathChooser::File);
|
||||
options_page->svgFilePathChooser->setPromptDialogFilter(tr("SVG image (*.svg)"));
|
||||
options_page->svgFilePathChooser->setPromptDialogTitle(tr("Choose SVG image"));
|
||||
options_page->svgFilePathChooser->setPath(m_config->getSystemFile());
|
||||
|
||||
// PORTS
|
||||
QList<QextPortInfo> ports = QextSerialEnumerator::getPorts();
|
||||
qSort(ports.begin(), ports.end(),sortPorts);
|
||||
foreach( QextPortInfo port, ports ) {
|
||||
qDebug() << "Adding port: " << port.friendName << " (" << port.portName << ")";
|
||||
options_page->portComboBox->addItem(port.friendName, port.portName);
|
||||
}
|
||||
|
||||
int portIndex = options_page->portComboBox->findData(m_config->port());
|
||||
if(portIndex!=-1){
|
||||
qDebug() << "createPage(): port is " << m_config->port();
|
||||
options_page->portComboBox->setCurrentIndex(portIndex);
|
||||
}
|
||||
|
||||
// BAUDRATES
|
||||
options_page->portSpeedComboBox->addItems(BaudRateTypeString);
|
||||
|
||||
int portSpeedIndex = options_page->portSpeedComboBox->findText(BaudRateTypeStringALL.at((int)m_config->speed()));
|
||||
if(portSpeedIndex != -1){
|
||||
options_page->portSpeedComboBox->setCurrentIndex(portSpeedIndex);
|
||||
}
|
||||
|
||||
// FLOW CONTROL
|
||||
options_page->flowControlComboBox->addItems(FlowTypeString);
|
||||
|
||||
int flowControlIndex = options_page->flowControlComboBox->findText(FlowTypeString.at((int)m_config->flow()));
|
||||
if(flowControlIndex != -1){
|
||||
options_page->flowControlComboBox->setCurrentIndex(flowControlIndex);
|
||||
}
|
||||
|
||||
// DATABITS
|
||||
options_page->dataBitsComboBox->addItems(DataBitsTypeString);
|
||||
|
||||
int dataBitsIndex = options_page->dataBitsComboBox->findText(DataBitsTypeStringALL.at((int)m_config->dataBits()));
|
||||
if(dataBitsIndex != -1){
|
||||
options_page->dataBitsComboBox->setCurrentIndex(dataBitsIndex);
|
||||
}
|
||||
|
||||
// STOPBITS
|
||||
options_page->stopBitsComboBox->addItems(StopBitsTypeString);
|
||||
|
||||
int stopBitsIndex = options_page->stopBitsComboBox->findText(StopBitsTypeStringALL.at((int)m_config->stopBits()));
|
||||
if(stopBitsIndex != -1){
|
||||
options_page->stopBitsComboBox->setCurrentIndex(stopBitsIndex);
|
||||
}
|
||||
|
||||
// PARITY
|
||||
options_page->parityComboBox->addItems(ParityTypeString);
|
||||
|
||||
int parityIndex = options_page->parityComboBox->findText(ParityTypeStringALL.at((int)m_config->parity()));
|
||||
if(parityIndex != -1){
|
||||
options_page->parityComboBox->setCurrentIndex(parityIndex);
|
||||
}
|
||||
|
||||
// TIMEOUT
|
||||
options_page->timeoutSpinBox->setValue(m_config->timeOut());
|
||||
|
||||
|
||||
return optionsPageWidget;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the user presses apply or OK.
|
||||
*
|
||||
@ -188,9 +239,17 @@ QWidget *GpsDisplayGadgetOptionsPage::createPage(QWidget *parent)
|
||||
*/
|
||||
void GpsDisplayGadgetOptionsPage::apply()
|
||||
{
|
||||
m_config->setSystemFile(options_page->svgFilePathChooser->path());
|
||||
}
|
||||
int portIndex = options_page->portComboBox->currentIndex();
|
||||
m_config->setPort(options_page->portComboBox->itemData(portIndex).toString());
|
||||
qDebug() << "apply(): port is " << m_config->port();
|
||||
|
||||
m_config->setSpeed((BaudRateType)BaudRateTypeStringALL.indexOf(options_page->portSpeedComboBox->currentText()));
|
||||
m_config->setFlow((FlowType)FlowTypeString.indexOf(options_page->flowControlComboBox->currentText()));
|
||||
m_config->setDataBits((DataBitsType)DataBitsTypeStringALL.indexOf(options_page->dataBitsComboBox->currentText()));
|
||||
m_config->setStopBits((StopBitsType)StopBitsTypeStringALL.indexOf(options_page->stopBitsComboBox->currentText()));
|
||||
m_config->setParity((ParityType)ParityTypeStringALL.indexOf(options_page->parityComboBox->currentText()));
|
||||
m_config->setTimeOut( options_page->timeoutSpinBox->value());
|
||||
}
|
||||
|
||||
void GpsDisplayGadgetOptionsPage::finish()
|
||||
{
|
||||
|
@ -24,7 +24,7 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="Utils::PathChooser" name="svgFilePathChooser" native="true">
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
@ -61,153 +61,99 @@
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<widget class="QWidget" name="formLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>60</y>
|
||||
<width>46</width>
|
||||
<height>13</height>
|
||||
<x>50</x>
|
||||
<y>50</y>
|
||||
<width>421</width>
|
||||
<height>201</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Port:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<y>60</y>
|
||||
<width>61</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Port Speed:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="comboBox_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>60</y>
|
||||
<width>69</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="comboBox_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>230</x>
|
||||
<y>60</y>
|
||||
<width>69</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>320</x>
|
||||
<y>60</y>
|
||||
<width>71</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Flow Control:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="comboBox_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>390</x>
|
||||
<y>60</y>
|
||||
<width>69</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>100</y>
|
||||
<width>51</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Bit format:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="comboBox_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>100</y>
|
||||
<width>69</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="comboBox_6">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>150</x>
|
||||
<y>100</y>
|
||||
<width>69</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="comboBox_7">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>230</x>
|
||||
<y>100</y>
|
||||
<width>69</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="comboBox_8">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>140</y>
|
||||
<width>69</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>140</y>
|
||||
<width>46</width>
|
||||
<height>13</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Timeout:</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="portLabel">
|
||||
<property name="text">
|
||||
<string>Port:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="portComboBox"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="portSpeedLabel">
|
||||
<property name="text">
|
||||
<string>Port Speed:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="portSpeedComboBox"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="flowControlLabel">
|
||||
<property name="text">
|
||||
<string>Flow Control:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="flowControlComboBox"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="dataBitsLabel">
|
||||
<property name="text">
|
||||
<string>Data Bits:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="dataBitsComboBox"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="stopBitsLabel">
|
||||
<property name="text">
|
||||
<string>Stop Bits:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="stopBitsComboBox"/>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="parityLabel">
|
||||
<property name="text">
|
||||
<string>Parity:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QComboBox" name="parityComboBox"/>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="timeoutLabel">
|
||||
<property name="text">
|
||||
<string>Timeout(ms):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QSpinBox" name="timeoutSpinBox">
|
||||
<property name="maximum">
|
||||
<number>100000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Utils::PathChooser</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>utils/pathchooser.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@ -34,6 +34,17 @@
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
class MyThread : public QThread
|
||||
{
|
||||
public:
|
||||
QextSerialPort *port;
|
||||
void setPort(QextSerialPort* port);
|
||||
void run();
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Initialize the widget
|
||||
*/
|
||||
@ -61,6 +72,9 @@ GpsDisplayWidget::GpsDisplayWidget(QWidget *parent) : QWidget(parent)
|
||||
widget->gpsWorld->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
world->setScale(factor);
|
||||
|
||||
|
||||
connect(widget->connectButton, SIGNAL(clicked(bool)),
|
||||
this,SLOT(connectButtonClicked()));
|
||||
}
|
||||
|
||||
GpsDisplayWidget::~GpsDisplayWidget()
|
||||
@ -69,8 +83,44 @@ GpsDisplayWidget::~GpsDisplayWidget()
|
||||
}
|
||||
|
||||
|
||||
void GpsDisplayWidget::setPort(QextSerialPort* port)
|
||||
{
|
||||
|
||||
this->port=port;
|
||||
}
|
||||
|
||||
void GpsDisplayWidget::connectButtonClicked() {
|
||||
MyThread* myThread = new MyThread();
|
||||
myThread->setPort(port);
|
||||
myThread->start();
|
||||
}
|
||||
|
||||
|
||||
void MyThread::setPort(QextSerialPort* port)
|
||||
{
|
||||
|
||||
this->port=port;
|
||||
}
|
||||
|
||||
void MyThread::run()
|
||||
{
|
||||
qDebug() << "Opening.";
|
||||
|
||||
qDebug() << port->portName();
|
||||
|
||||
bool isOpen = port->open(QIODevice::ReadWrite);
|
||||
qDebug() << "Open: " << isOpen;
|
||||
|
||||
char buf[1024];
|
||||
while(true) {
|
||||
qDebug() << "Reading.";
|
||||
qint64 bytesRead = port->readLine(buf, sizeof(buf));
|
||||
qDebug() << "bytesRead: " << bytesRead;
|
||||
if (bytesRead != -1) {
|
||||
qDebug() << "Result: '" << buf << "'";
|
||||
}
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -48,6 +48,7 @@ public:
|
||||
~GpsDisplayWidget();
|
||||
|
||||
// void setMode(QString mode); // Either UAVTalk or serial port
|
||||
void setPort(QextSerialPort* port);
|
||||
|
||||
|
||||
private slots:
|
||||
@ -55,6 +56,7 @@ private slots:
|
||||
|
||||
private:
|
||||
Ui_GpsDisplayWidget* widget;
|
||||
QextSerialPort *port;
|
||||
bool connected;
|
||||
|
||||
};
|
||||
|
@ -107,7 +107,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<widget class="QPushButton" name="connectButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
|
Loading…
x
Reference in New Issue
Block a user