Browse Source

Merge pull request #6096 from acfloria/feature/high_latency_configuration

Add highLatency property to LinkConfiguration
QGC4.4
Don Gagne 7 years ago committed by GitHub
parent
commit
8c7e5780c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      src/comm/LinkConfiguration.cc
  2. 23
      src/comm/LinkConfiguration.h
  3. 2
      src/comm/LinkInterface.cc
  4. 1
      src/comm/SerialLink.h
  5. 1
      src/comm/TCPLink.h
  6. 1
      src/comm/UDPLink.h
  7. 14
      src/ui/preferences/SerialSettings.qml
  8. 14
      src/ui/preferences/TcpSettings.qml
  9. 14
      src/ui/preferences/UdpSettings.qml

3
src/comm/LinkConfiguration.cc

@ -37,6 +37,7 @@ LinkConfiguration::LinkConfiguration(const QString& name) @@ -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) @@ -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) @@ -60,6 +62,7 @@ void LinkConfiguration::copyFrom(LinkConfiguration* source)
_name = source->name();
_dynamic = source->isDynamic();
_autoConnect= source->isAutoConnect();
_highLatency= source->isHighLatency();
}
/*!

23
src/comm/LinkConfiguration.h

@ -33,6 +33,8 @@ public: @@ -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
@ -77,6 +79,13 @@ public: @@ -77,6 +79,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)
*/
void setDynamic(bool dynamic = true) { _dynamic = dynamic; emit dynamicChanged(); }
@ -86,6 +95,11 @@ public: @@ -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
/*!
@ -96,6 +110,13 @@ public: @@ -96,6 +110,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
*
* Pure virtual method returning one of the -TypeXxx types above.
@ -174,6 +195,7 @@ signals: @@ -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: @@ -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;

2
src/comm/LinkInterface.cc

@ -23,7 +23,7 @@ uint8_t LinkInterface::mavlinkChannel(void) const @@ -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)

1
src/comm/SerialLink.h

@ -86,6 +86,7 @@ public: @@ -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 ();

1
src/comm/TCPLink.h

@ -97,6 +97,7 @@ public: @@ -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 ();

1
src/comm/UDPLink.h

@ -126,6 +126,7 @@ public: @@ -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:

14
src/ui/preferences/SerialSettings.qml

@ -235,5 +235,19 @@ Item { @@ -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
}
}
}
}

14
src/ui/preferences/TcpSettings.qml

@ -75,5 +75,19 @@ Item { @@ -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
}
}
}
}

14
src/ui/preferences/UdpSettings.qml

@ -175,5 +175,19 @@ Item { @@ -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
}
}
}
}

Loading…
Cancel
Save