Browse Source

Merge pull request #4465 from AlexeyBulatov/pr/autoconnect

Auto connect on start for UDP links
QGC4.4
Don Gagne 8 years ago committed by GitHub
parent
commit
3ae6d91590
  1. 3
      src/QGCApplication.cc
  2. 1
      src/comm/BluetoothLink.h
  3. 2
      src/comm/LinkConfiguration.h
  4. 11
      src/comm/LinkManager.cc
  5. 2
      src/comm/LinkManager.h
  6. 1
      src/comm/LogReplayLink.h
  7. 13
      src/comm/UDPLink.h
  8. 6
      src/ui/preferences/LinkSettings.qml

3
src/QGCApplication.cc

@ -439,6 +439,9 @@ bool QGCApplication::_initForNormalAppBoot(void) @@ -439,6 +439,9 @@ bool QGCApplication::_initForNormalAppBoot(void)
"Your saved settings have been reset to defaults.");
}
// Connect links with flag AutoconnectLink
toolbox()->linkManager()->startAutoConnectedLinks();
if (getQGCMapEngine()->wasCacheReset()) {
showMessage("The Offline Map Cache database has been upgraded. "
"Your old map cache sets have been reset.");

1
src/comm/BluetoothLink.h

@ -104,7 +104,6 @@ public: @@ -104,7 +104,6 @@ public:
void loadSettings (QSettings& settings, const QString& root);
void saveSettings (QSettings& settings, const QString& root);
void updateSettings ();
bool isAutoConnectAllowed () { return false; }
QString settingsURL () { return "BluetoothSettings.qml"; }
public slots:

2
src/comm/LinkConfiguration.h

@ -93,7 +93,7 @@ public: @@ -93,7 +93,7 @@ public:
* Is Auto Connect allowed for this type?
* @return True if this type can be set as an Auto Connect configuration
*/
virtual bool isAutoConnectAllowed() { return true; }
virtual bool isAutoConnectAllowed() { return false; }
/*!
* @brief Connection type

11
src/comm/LinkManager.cc

@ -990,3 +990,14 @@ QList<LinkInterface*> LinkManager::links(void) @@ -990,3 +990,14 @@ QList<LinkInterface*> LinkManager::links(void)
return rawLinks;
}
void LinkManager::startAutoConnectedLinks(void)
{
SharedLinkConfigurationPointer conf;
for(int i = 0; i < _sharedConfigurations.count(); i++) {
conf = _sharedConfigurations[i];
if (conf->isAutoConnect())
createConnectedLink(conf);
}
}

2
src/comm/LinkManager.h

@ -171,6 +171,8 @@ public: @@ -171,6 +171,8 @@ public:
SharedLinkConfigurationPointer addConfiguration(LinkConfiguration* config);
void startAutoConnectedLinks(void);
signals:
void autoconnectUDPChanged (bool autoconnect);
void autoconnectPixhawkChanged (bool autoconnect);

1
src/comm/LogReplayLink.h

@ -40,7 +40,6 @@ public: @@ -40,7 +40,6 @@ public:
void loadSettings (QSettings& settings, const QString& root);
void saveSettings (QSettings& settings, const QString& root);
void updateSettings ();
bool isAutoConnectAllowed () { return false; }
QString settingsURL () { return "LogReplaySettings.qml"; }
signals:
void fileNameChanged();

13
src/comm/UDPLink.h

@ -131,12 +131,13 @@ public: @@ -131,12 +131,13 @@ public:
QStringList hostList () { return _hostList; }
/// From LinkConfiguration
LinkType type () { return LinkConfiguration::TypeUdp; }
void copyFrom (LinkConfiguration* source);
void loadSettings (QSettings& settings, const QString& root);
void saveSettings (QSettings& settings, const QString& root);
void updateSettings ();
QString settingsURL () { return "UdpSettings.qml"; }
LinkType type () { return LinkConfiguration::TypeUdp; }
void copyFrom (LinkConfiguration* source);
void loadSettings (QSettings& settings, const QString& root);
void saveSettings (QSettings& settings, const QString& root);
void updateSettings ();
bool isAutoConnectAllowed () { return true; }
QString settingsURL () { return "UdpSettings.qml"; }
signals:
void localPortChanged ();

6
src/ui/preferences/LinkSettings.qml

@ -271,12 +271,11 @@ Rectangle { @@ -271,12 +271,11 @@ Rectangle {
height: ScreenTools.defaultFontPixelHeight * 0.5
width: parent.width
}
/*
//-- Auto Connect
//-- Auto Connect on Start
QGCCheckBox {
text: "Automatically Connect on Start"
checked: false
enabled: editConfig ? editConfig.autoConnectAllowed : false
visible: editConfig ? editConfig.autoConnectAllowed : false
onCheckedChanged: {
if(editConfig) {
editConfig.autoConnect = checked
@ -287,7 +286,6 @@ Rectangle { @@ -287,7 +286,6 @@ Rectangle {
checked = editConfig.autoConnect
}
}
*/
Item {
height: ScreenTools.defaultFontPixelHeight
width: parent.width

Loading…
Cancel
Save