mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +01:00
Updating PipX configurator to use the qextserialport .. doesn't compile though :(
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2489 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
2bb935b223
commit
24a77b47a2
@ -9,10 +9,30 @@ QT += core gui
|
|||||||
TARGET = PipXtreme_Config
|
TARGET = PipXtreme_Config
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
||||||
|
INCLUDEPATH += ../../libs/qextserialport/src
|
||||||
|
|
||||||
SOURCES += main.cpp\
|
SOURCES += main.cpp\
|
||||||
mainwindow.cpp
|
mainwindow.cpp \
|
||||||
|
|
||||||
HEADERS += mainwindow.h
|
HEADERS += mainwindow.h \
|
||||||
|
|
||||||
|
HEADERS += ../../libs/qextserialport/src/qextserialport.h \
|
||||||
|
../../libs/qextserialport/src/qextserialenumerator.h \
|
||||||
|
../../libs/qextserialport/src/qextserialport_global.h
|
||||||
|
SOURCES = ../../libs/qextserialport/src/qextserialport.cpp
|
||||||
|
|
||||||
|
unix:SOURCES += ../../libs/qextserialport/src/posix_qextserialport.cpp
|
||||||
|
unix:!macx:SOURCES += ../../libs/qextserialport/src/qextserialenumerator_unix.cpp
|
||||||
|
macx {
|
||||||
|
SOURCES += ../../libs/qextserialport/src/qextserialenumerator_osx.cpp
|
||||||
|
LIBS += -framework IOKit -framework CoreFoundation
|
||||||
|
}
|
||||||
|
|
||||||
|
win32 {
|
||||||
|
SOURCES += ../../libs/qextserialport/src/win_qextserialport.cpp \
|
||||||
|
../../libs/qextserialport/src/qextserialenumerator_win.cpp
|
||||||
|
DEFINES += WINVER=0x0501 # needed for mingw to pull in appropriate dbt business...probably a better way to do this
|
||||||
|
LIBS += -lsetupapi
|
||||||
|
}
|
||||||
|
|
||||||
FORMS += mainwindow.ui
|
FORMS += mainwindow.ui
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include <QtGui/QApplication>
|
#include <QtGui/QApplication>
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
#include <qextserialport.h>
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
|
|
||||||
@ -6,9 +7,80 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
ui(new Ui::MainWindow)
|
ui(new Ui::MainWindow)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
port = NULL;
|
||||||
|
|
||||||
|
port = new QextSerialPort(QextSerialPort::EventDriven);
|
||||||
|
if (port)
|
||||||
|
{
|
||||||
|
port->setPortName("COM1");
|
||||||
|
port->setBaudRate(BAUD57600);
|
||||||
|
port->setFlowControl(FLOW_OFF);
|
||||||
|
port->setParity(PAR_NONE);
|
||||||
|
port->setDataBits(DATA_8);
|
||||||
|
port->setStopBits(STOP_1);
|
||||||
|
|
||||||
|
connect(port, SIGNAL(readyRead()), this, SLOT(onDataAvailable()));
|
||||||
|
|
||||||
|
port->open(0);
|
||||||
|
|
||||||
|
qDebug("isOpen : %d", port->isOpen());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
{
|
{
|
||||||
|
if (port)
|
||||||
|
{
|
||||||
|
if (port->isOpen())
|
||||||
|
port->close();
|
||||||
|
|
||||||
|
delete port;
|
||||||
|
port = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::onDataAvailable()
|
||||||
|
{
|
||||||
|
if (!port)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int avail = port->bytesAvailable();
|
||||||
|
if (avail <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
QByteArray data;
|
||||||
|
data.resize(avail);
|
||||||
|
|
||||||
|
int read = port->read(data.data(), data.size());
|
||||||
|
if (read <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
qDebug("bytes available: %d", avail);
|
||||||
|
qDebug("received: %d", read);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::closePort()
|
||||||
|
{
|
||||||
|
if (!port)
|
||||||
|
return;
|
||||||
|
|
||||||
|
port->close();
|
||||||
|
qDebug("is open: %d", port->isOpen());
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::openPort()
|
||||||
|
{
|
||||||
|
if (!port)
|
||||||
|
return;
|
||||||
|
|
||||||
|
port->open(QIODevice::ReadWrite);
|
||||||
|
qDebug("is open: %d", port->isOpen());
|
||||||
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define MAINWINDOW_H
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
#include <qextserialport.h>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
@ -17,6 +18,13 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
|
|
||||||
|
QextSerialPort *port;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void onDataAvailable();
|
||||||
|
void closePort();
|
||||||
|
void openPort();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Port</string>
|
<string> Serial Port </string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
@ -37,7 +37,37 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>200</width>
|
<width>150</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_13">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_11">
|
||||||
|
<property name="text">
|
||||||
|
<string> Baudrate </string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBox_5">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>150</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -81,6 +111,12 @@
|
|||||||
<property name="acceptDrops">
|
<property name="acceptDrops">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="maxLength">
|
||||||
|
<number>8</number>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
<property name="readOnly">
|
<property name="readOnly">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
@ -121,6 +157,12 @@
|
|||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="maxLength">
|
||||||
|
<number>8</number>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -151,6 +193,12 @@
|
|||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="maxLength">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -181,6 +229,12 @@
|
|||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="maxLength">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -211,6 +265,12 @@
|
|||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="maxLength">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -318,7 +378,11 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="lineEdit"/>
|
<widget class="QLineEdit" name="lineEdit">
|
||||||
|
<property name="maxLength">
|
||||||
|
<number>256</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkBox_AESEncryption">
|
<widget class="QCheckBox" name="checkBox_AESEncryption">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user