AutoConnectSettings.cc 4.04 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
/****************************************************************************
 *
 *   (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/

#include "AutoConnectSettings.h"
11
#include "LinkManager.h"
12 13

#include <QQmlEngine>
Don Gagne's avatar
Don Gagne committed
14
#include <QtQml>
15

16 17 18 19 20 21 22 23
const char* AutoConnectSettings::_settingsGroup =                       "LinkManager";

const char* AutoConnectSettings:: autoConnectUDPSettingsName =          "AutoconnectUDP";
const char* AutoConnectSettings:: autoConnectPixhawkSettingsName =      "AutoconnectPixhawk";
const char* AutoConnectSettings:: autoConnectSiKRadioSettingsName =     "Autoconnect3DRRadio";
const char* AutoConnectSettings:: autoConnectPX4FlowSettingsName =      "AutoconnectPX4Flow";
const char* AutoConnectSettings:: autoConnectRTKGPSSettingsName =       "AutoconnectRTKGPS";
const char* AutoConnectSettings:: autoConnectLibrePilotSettingsName =   "AutoconnectLibrePilot";
24 25 26
const char* AutoConnectSettings:: udpListenPortName =                   "AutoconnectUDPListenPort";
const char* AutoConnectSettings:: udpTargetHostIPName =                 "AutoconnectUDPTargetHostIP";
const char* AutoConnectSettings:: udpTargetHostPortName =               "AutoconnectUDPTargetHostPort";
27

28
const char* AutoConnectSettings::autoConnectSettingsGroupName = "AutoConnect";
29 30

AutoConnectSettings::AutoConnectSettings(QObject* parent)
31 32 33 34 35 36
    : SettingsGroup             (autoConnectSettingsGroupName, _settingsGroup, parent)
    , _autoConnectUDPFact       (NULL)
    , _autoConnectPixhawkFact   (NULL)
    , _autoConnectSiKRadioFact  (NULL)
    , _autoConnectPX4FlowFact   (NULL)
    , _autoConnectRTKGPSFact    (NULL)
37
    , _autoConnectLibrePilotFact(NULL)
38 39 40
    , _udpListenPortFact        (NULL)
    , _udpTargetHostIPFact      (NULL)
    , _udpTargetHostPortFact    (NULL)
41 42 43 44
{
    QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
    qmlRegisterUncreatableType<AutoConnectSettings>("QGroundControl.SettingsManager", 1, 0, "AutoConnectSettings", "Reference only");
}
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98

Fact* AutoConnectSettings::autoConnectUDP(void)
{
    if (!_autoConnectUDPFact) {
        _autoConnectUDPFact = _createSettingsFact(autoConnectUDPSettingsName);
    }

    return _autoConnectUDPFact;
}

Fact* AutoConnectSettings::autoConnectPixhawk(void)
{
    if (!_autoConnectPixhawkFact) {
        _autoConnectPixhawkFact = _createSettingsFact(autoConnectPixhawkSettingsName);
    }

    return _autoConnectPixhawkFact;
}

Fact* AutoConnectSettings::autoConnectSiKRadio(void)
{
    if (!_autoConnectSiKRadioFact) {
        _autoConnectSiKRadioFact = _createSettingsFact(autoConnectSiKRadioSettingsName);
    }

    return _autoConnectSiKRadioFact;
}

Fact* AutoConnectSettings::autoConnectPX4Flow(void)
{
    if (!_autoConnectPX4FlowFact) {
        _autoConnectPX4FlowFact = _createSettingsFact(autoConnectPX4FlowSettingsName);
    }

    return _autoConnectPX4FlowFact;
}

Fact* AutoConnectSettings::autoConnectRTKGPS(void)
{
    if (!_autoConnectRTKGPSFact) {
        _autoConnectRTKGPSFact = _createSettingsFact(autoConnectRTKGPSSettingsName);
    }

    return _autoConnectRTKGPSFact;
}

Fact* AutoConnectSettings::autoConnectLibrePilot(void)
{
    if (!_autoConnectLibrePilotFact) {
        _autoConnectLibrePilotFact = _createSettingsFact(autoConnectLibrePilotSettingsName);
    }

    return _autoConnectLibrePilotFact;
}
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125

Fact* AutoConnectSettings::udpListenPort(void)
{
    if (!_udpListenPortFact) {
        _udpListenPortFact = _createSettingsFact(udpListenPortName);
    }

    return _udpListenPortFact;
}

Fact* AutoConnectSettings::udpTargetHostIP(void)
{
    if (!_udpTargetHostIPFact) {
        _udpTargetHostIPFact = _createSettingsFact(udpTargetHostIPName);
    }

    return _udpTargetHostIPFact;
}

Fact* AutoConnectSettings::udpTargetHostPort(void)
{
    if (!_udpTargetHostPortFact) {
        _udpTargetHostPortFact = _createSettingsFact(udpTargetHostPortName);
    }

    return _udpTargetHostPortFact;
}