mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
OP-77 GCS-Removed alterations from the lib (serial port qlists sorting moved to plugins sources), added conditional compilation to serialplugin and uploader plugin.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@719 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
fb9e8563b8
commit
b9f81d4e7e
@ -33,9 +33,6 @@ struct QextPortInfo {
|
||||
QString enumName; ///< Enumerator name.
|
||||
int vendorID; ///< Vendor ID.
|
||||
int productID; ///< Product ID
|
||||
//added operator to alow sorting (PT_Dreamer)
|
||||
bool operator<(const QextPortInfo & other) const {
|
||||
return portName < other.portName;}
|
||||
};
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
|
@ -32,8 +32,6 @@
|
||||
|
||||
#include <QtCore/QtPlugin>
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <qextserialport.h>
|
||||
#include <qextserialenumerator.h>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
@ -55,6 +53,10 @@ void SerialConnection::onEnumerationChanged()
|
||||
{
|
||||
emit availableDevChanged(this);
|
||||
}
|
||||
bool sortPorts(const QextPortInfo &s1,const QextPortInfo &s2)
|
||||
{
|
||||
return s1.portName<s2.portName;
|
||||
}
|
||||
|
||||
QStringList SerialConnection::availableDevices()
|
||||
{
|
||||
@ -62,9 +64,13 @@ QStringList SerialConnection::availableDevices()
|
||||
QList<QextPortInfo> ports = QextSerialEnumerator::getPorts();
|
||||
|
||||
//sort the list by port number (nice idea from PT_Dreamer :))
|
||||
qSort(ports.begin(), ports.end());
|
||||
qSort(ports.begin(), ports.end(),sortPorts);
|
||||
foreach( QextPortInfo port, ports ) {
|
||||
list.append(port.friendName);
|
||||
#ifdef Q_OS_WIN
|
||||
list.append(port.portName);
|
||||
#else
|
||||
list.append(port.physName);
|
||||
#endif
|
||||
}
|
||||
|
||||
return list;
|
||||
@ -74,8 +80,12 @@ QIODevice *SerialConnection::openDevice(const QString &deviceName)
|
||||
{
|
||||
QList<QextPortInfo> ports = QextSerialEnumerator::getPorts();
|
||||
foreach( QextPortInfo port, ports ) {
|
||||
if(port.friendName == deviceName)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
if(port.portName == deviceName)
|
||||
#else
|
||||
if(port.physName == deviceName)
|
||||
#endif
|
||||
{
|
||||
//we need to handle port settings here...
|
||||
PortSettings set;
|
||||
set.BaudRate = BAUD57600;
|
||||
|
@ -29,7 +29,8 @@
|
||||
#define SERIALPLUGIN_H
|
||||
|
||||
#include "serial_global.h"
|
||||
|
||||
#include <qextserialport.h>
|
||||
#include <qextserialenumerator.h>
|
||||
#include "coreplugin/iconnection.h"
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtAlgorithms>
|
||||
#include <QStringList>
|
||||
#include <qextserialport/src/qextserialenumerator.h>
|
||||
|
||||
|
||||
UploaderGadgetOptionsPage::UploaderGadgetOptionsPage(UploaderGadgetConfiguration *config, QObject *parent) :
|
||||
IOptionsPage(parent),
|
||||
@ -158,7 +158,10 @@ UploaderGadgetOptionsPage::UploaderGadgetOptionsPage(UploaderGadgetConfiguration
|
||||
<<"FLOW_HARDWARE"
|
||||
<<"FLOW_XONXOFF";
|
||||
}
|
||||
|
||||
bool sortPorts(QextPortInfo const& s1,QextPortInfo const& s2)
|
||||
{
|
||||
return s1.portName<s2.portName;
|
||||
}
|
||||
//creates options page widget
|
||||
QWidget *UploaderGadgetOptionsPage::createPage(QWidget *parent)
|
||||
{
|
||||
@ -263,7 +266,7 @@ QWidget *UploaderGadgetOptionsPage::createPage(QWidget *parent)
|
||||
|
||||
//gets available serial ports
|
||||
QList<QextPortInfo> ports =QextSerialEnumerator ::getPorts();
|
||||
qSort(ports.begin(), ports.end());
|
||||
qSort(ports.begin(), ports.end(),sortPorts);
|
||||
qDebug() << "List of ports:";
|
||||
for (int i = 0; i < ports.size(); i++) {
|
||||
qDebug() << "port name:" << ports.at(i).portName;
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#ifndef UPLOADERGADGETOPTIONSPAGE_H
|
||||
#define UPLOADERGADGETOPTIONSPAGE_H
|
||||
|
||||
#include <qextserialport/src/qextserialenumerator.h>
|
||||
#include "coreplugin/dialogs/ioptionspage.h"
|
||||
#include "QString"
|
||||
#include <QStringList>
|
||||
|
Loading…
x
Reference in New Issue
Block a user