Commit ecf99f66 authored by Don Gagne's avatar Don Gagne

Keep track of USB direct connection links

parent 438cf368
......@@ -508,11 +508,13 @@ void LinkManager::_updateAutoConnectLinks(void)
case QGCSerialPortInfo::BoardTypePX4FMUV4:
if (_autoconnectPixhawk) {
pSerialConfig = new SerialConfiguration(QString("Pixhawk on %1").arg(portInfo.portName().trimmed()));
pSerialConfig->setUsbDirect(true);
}
break;
case QGCSerialPortInfo::BoardTypeAeroCore:
if (_autoconnectPixhawk) {
pSerialConfig = new SerialConfiguration(QString("AeroCore on %1").arg(portInfo.portName().trimmed()));
pSerialConfig->setUsbDirect(true);
}
break;
case QGCSerialPortInfo::BoardTypePX4Flow:
......
......@@ -388,6 +388,7 @@ SerialConfiguration::SerialConfiguration(const QString& name) : LinkConfiguratio
_parity = QSerialPort::NoParity;
_dataBits = 8;
_stopBits = 1;
_usbDirect = false;
}
SerialConfiguration::SerialConfiguration(SerialConfiguration* copy) : LinkConfiguration(copy)
......@@ -399,6 +400,7 @@ SerialConfiguration::SerialConfiguration(SerialConfiguration* copy) : LinkConfig
_stopBits = copy->stopBits();
_portName = copy->portName();
_portDisplayName = copy->portDisplayName();
_usbDirect = copy->_usbDirect;
}
void SerialConfiguration::copyFrom(LinkConfiguration *source)
......@@ -413,6 +415,7 @@ void SerialConfiguration::copyFrom(LinkConfiguration *source)
_stopBits = ssource->stopBits();
_portName = ssource->portName();
_portDisplayName = ssource->portDisplayName();
_usbDirect = ssource->_usbDirect;
}
void SerialConfiguration::updateSettings()
......@@ -554,3 +557,10 @@ void SerialConfiguration::_initBaudRates()
kSupportedBaudRates << "921600";
}
void SerialConfiguration::setUsbDirect(bool usbDirect)
{
if (_usbDirect != usbDirect) {
_usbDirect = usbDirect;
emit usbDirectChanged(_usbDirect);
}
}
......@@ -73,12 +73,14 @@ public:
Q_PROPERTY(int parity READ parity WRITE setParity NOTIFY parityChanged)
Q_PROPERTY(QString portName READ portName WRITE setPortName NOTIFY portNameChanged)
Q_PROPERTY(QString portDisplayName READ portDisplayName NOTIFY portDisplayNameChanged)
Q_PROPERTY(bool usbDirect READ usbDirect WRITE setUsbDirect NOTIFY usbDirectChanged) ///< true: direct usb connection to board
int baud() { return _baud; }
int dataBits() { return _dataBits; }
int flowControl() { return _flowControl; } ///< QSerialPort Enums
int stopBits() { return _stopBits; }
int parity() { return _parity; } ///< QSerialPort Enums
bool usbDirect() { return _usbDirect; }
const QString portName () { return _portName; }
const QString portDisplayName () { return _portDisplayName; }
......@@ -89,6 +91,7 @@ public:
void setStopBits (int stopBits);
void setParity (int parity); ///< QSerialPort Enums
void setPortName (const QString& portName);
void setUsbDirect (bool usbDirect);
static QStringList supportedBaudRates();
static QString cleanPortDisplayname(const QString name);
......@@ -109,6 +112,7 @@ signals:
void parityChanged ();
void portNameChanged ();
void portDisplayNameChanged ();
void usbDirectChanged (bool usbDirect);
private:
static void _initBaudRates();
......@@ -121,6 +125,7 @@ private:
int _parity;
QString _portName;
QString _portDisplayName;
bool _usbDirect;
};
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment