Unverified Commit 8c7e5780 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #6096 from acfloria/feature/high_latency_configuration

Add highLatency property to LinkConfiguration
parents e37b067c 862f543c
......@@ -37,6 +37,7 @@ LinkConfiguration::LinkConfiguration(const QString& name)
, _name(name)
, _dynamic(false)
, _autoConnect(false)
, _highLatency(false)
{
_name = name;
if (_name.isEmpty()) {
......@@ -50,6 +51,7 @@ LinkConfiguration::LinkConfiguration(LinkConfiguration* copy)
_name = copy->name();
_dynamic = copy->isDynamic();
_autoConnect= copy->isAutoConnect();
_highLatency= copy->isHighLatency();
Q_ASSERT(!_name.isEmpty());
}
......@@ -60,6 +62,7 @@ void LinkConfiguration::copyFrom(LinkConfiguration* source)
_name = source->name();
_dynamic = source->isDynamic();
_autoConnect= source->isAutoConnect();
_highLatency= source->isHighLatency();
}
/*!
......
......@@ -33,6 +33,8 @@ public:
Q_PROPERTY(bool autoConnect READ isAutoConnect WRITE setAutoConnect NOTIFY autoConnectChanged)
Q_PROPERTY(bool autoConnectAllowed READ isAutoConnectAllowed CONSTANT)
Q_PROPERTY(QString settingsURL READ settingsURL CONSTANT)
Q_PROPERTY(bool highLatency READ isHighLatency WRITE setHighLatency NOTIFY highLatencyChanged)
Q_PROPERTY(bool highLatencyAllowed READ isHighLatencyAllowed CONSTANT)
// Property accessors
......@@ -76,6 +78,13 @@ public:
*/
bool isAutoConnect() { return _autoConnect; }
/*!
*
* Is this a High Latency configuration?
* @return True if this is an High Latency configuration (link with large delays).
*/
bool isHighLatency() { return _highLatency; }
/*!
* Set if this is this a dynamic configuration. (decided at runtime)
*/
......@@ -86,6 +95,11 @@ public:
*/
void setAutoConnect(bool autoc = true) { _autoConnect = autoc; emit autoConnectChanged(); }
/*!
* Set if this is this an High Latency configuration.
*/
void setHighLatency(bool hl = false) { _highLatency = hl; emit highLatencyChanged(); }
/// Virtual Methods
/*!
......@@ -95,6 +109,13 @@ public:
*/
virtual bool isAutoConnectAllowed() { return false; }
/*!
*
* Is High Latency allowed for this type?
* @return True if this type can be set as an High Latency configuration
*/
virtual bool isHighLatencyAllowed() { return false; }
/*!
* @brief Connection type
*
......@@ -174,6 +195,7 @@ signals:
void dynamicChanged ();
void autoConnectChanged ();
void linkChanged (LinkInterface* link);
void highLatencyChanged ();
protected:
LinkInterface* _link; ///< Link currently using this configuration (if any)
......@@ -181,6 +203,7 @@ private:
QString _name;
bool _dynamic; ///< A connection added automatically and not persistent (unless it's edited).
bool _autoConnect; ///< This connection is started automatically at boot
bool _highLatency;
};
typedef QSharedPointer<LinkConfiguration> SharedLinkConfigurationPointer;
......
......@@ -23,7 +23,7 @@ uint8_t LinkInterface::mavlinkChannel(void) const
LinkInterface::LinkInterface(SharedLinkConfigurationPointer& config)
: QThread (0)
, _config (config)
, _highLatency (false)
, _highLatency (config->isHighLatency())
, _mavlinkChannelSet (false)
, _active (false)
, _enableRateCollection (false)
......
......@@ -86,6 +86,7 @@ public:
/// From LinkConfiguration
LinkType type () { return LinkConfiguration::TypeSerial; }
void copyFrom (LinkConfiguration* source);
bool isHighLatencyAllowed () { return true; }
void loadSettings (QSettings& settings, const QString& root);
void saveSettings (QSettings& settings, const QString& root);
void updateSettings ();
......
......@@ -97,6 +97,7 @@ public:
/// From LinkConfiguration
LinkType type () { return LinkConfiguration::TypeTcp; }
void copyFrom (LinkConfiguration* source);
bool isHighLatencyAllowed () { return true; }
void loadSettings (QSettings& settings, const QString& root);
void saveSettings (QSettings& settings, const QString& root);
void updateSettings ();
......
......@@ -126,6 +126,7 @@ public:
void saveSettings (QSettings& settings, const QString& root);
void updateSettings ();
bool isAutoConnectAllowed () { return true; }
bool isHighLatencyAllowed () { return true; }
QString settingsURL () { return "UdpSettings.qml"; }
signals:
......
......@@ -235,5 +235,19 @@ Item {
}
}
}
QGCCheckBox {
text: "High Latency"
checked: false
visible: editConfig ? editConfig.highLatencyAllowed : false
onCheckedChanged: {
if(editConfig) {
editConfig.highLatency = checked
}
}
Component.onCompleted: {
if(editConfig)
checked = editConfig.highLatency
}
}
}
}
......@@ -75,5 +75,19 @@ Item {
anchors.verticalCenter: parent.verticalCenter
}
}
QGCCheckBox {
text: "High Latency"
checked: false
visible: editConfig ? editConfig.highLatencyAllowed : false
onCheckedChanged: {
if(editConfig) {
editConfig.highLatency = checked
}
}
Component.onCompleted: {
if(editConfig)
checked = editConfig.highLatency
}
}
}
}
......@@ -175,5 +175,19 @@ Item {
}
}
}
QGCCheckBox {
text: "High Latency"
checked: false
visible: editConfig ? editConfig.highLatencyAllowed : false
onCheckedChanged: {
if(editConfig) {
editConfig.highLatency = checked
}
}
Component.onCompleted: {
if(editConfig)
checked = editConfig.highLatency
}
}
}
}
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