1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-21 11:54:15 +01:00

OP-1777 Added some board specific settings information.

This commit is contained in:
m_thread 2015-03-13 00:15:33 +01:00
parent 6c8f5a35ed
commit daad175c52
3 changed files with 52 additions and 43 deletions

View File

@ -159,13 +159,13 @@ void GeneralSettings::finish()
void GeneralSettings::readSettings(QSettings *qs) void GeneralSettings::readSettings(QSettings *qs)
{ {
qs->beginGroup(QLatin1String("General")); qs->beginGroup(QLatin1String("General"));
m_language = qs->value(QLatin1String("OverrideLanguage"), QLocale::system().name()).toString(); m_language = qs->value(QLatin1String("OverrideLanguage"), QLocale::system().name()).toString();
m_saveSettingsOnExit = qs->value(QLatin1String("SaveSettingsOnExit"), m_saveSettingsOnExit).toBool(); m_saveSettingsOnExit = qs->value(QLatin1String("SaveSettingsOnExit"), m_saveSettingsOnExit).toBool();
m_autoConnect = qs->value(QLatin1String("AutoConnect"), m_autoConnect).toBool(); m_autoConnect = qs->value(QLatin1String("AutoConnect"), m_autoConnect).toBool();
m_autoSelect = qs->value(QLatin1String("AutoSelect"), m_autoSelect).toBool(); m_autoSelect = qs->value(QLatin1String("AutoSelect"), m_autoSelect).toBool();
m_useUDPMirror = qs->value(QLatin1String("UDPMirror"), m_useUDPMirror).toBool(); m_useUDPMirror = qs->value(QLatin1String("UDPMirror"), m_useUDPMirror).toBool();
m_useExpertMode = qs->value(QLatin1String("ExpertMode"), m_useExpertMode).toBool(); m_useExpertMode = qs->value(QLatin1String("ExpertMode"), m_useExpertMode).toBool();
m_collectUsageData = qs->value(QLatin1String("CollectUsageData"), m_collectUsageData).toBool(); m_collectUsageData = qs->value(QLatin1String("CollectUsageData"), m_collectUsageData).toBool();
m_showUsageDataDisclaimer = qs->value(QLatin1String("ShowUsageDataDisclaimer"), m_showUsageDataDisclaimer).toBool(); m_showUsageDataDisclaimer = qs->value(QLatin1String("ShowUsageDataDisclaimer"), m_showUsageDataDisclaimer).toBool();
qs->endGroup(); qs->endGroup();
} }

View File

@ -34,6 +34,7 @@
#include <QDebug> #include <QDebug>
#include <QMessageBox> #include <QMessageBox>
#include <attitudesettings.h> #include <attitudesettings.h>
#include <revosettings.h>
#include <uavobjectutil/devicedescriptorstruct.h> #include <uavobjectutil/devicedescriptorstruct.h>
#include <uavobjectutil/uavobjectutilmanager.h> #include <uavobjectutil/uavobjectutilmanager.h>
#include <coreplugin/generalsettings.h> #include <coreplugin/generalsettings.h>
@ -44,12 +45,10 @@
UsageTrackerPlugin::UsageTrackerPlugin() : UsageTrackerPlugin::UsageTrackerPlugin() :
m_telemetryManager(NULL) m_telemetryManager(NULL)
{ {}
}
UsageTrackerPlugin::~UsageTrackerPlugin() UsageTrackerPlugin::~UsageTrackerPlugin()
{ {}
}
bool UsageTrackerPlugin::initialize(const QStringList & args, QString *errMsg) bool UsageTrackerPlugin::initialize(const QStringList & args, QString *errMsg)
{ {
@ -62,6 +61,7 @@ bool UsageTrackerPlugin::initialize(const QStringList & args, QString *errMsg)
void UsageTrackerPlugin::extensionsInitialized() void UsageTrackerPlugin::extensionsInitialized()
{ {
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
m_telemetryManager = pm->getObject<TelemetryManager>(); m_telemetryManager = pm->getObject<TelemetryManager>();
connect(m_telemetryManager, SIGNAL(connected()), this, SLOT(onAutopilotConnect())); connect(m_telemetryManager, SIGNAL(connected()), this, SLOT(onAutopilotConnect()));
} }
@ -77,6 +77,7 @@ void UsageTrackerPlugin::onAutopilotConnect()
{ {
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
Core::Internal::GeneralSettings *settings = pm->getObject<Core::Internal::GeneralSettings>(); Core::Internal::GeneralSettings *settings = pm->getObject<Core::Internal::GeneralSettings>();
if (settings->collectUsageData()) { if (settings->collectUsageData()) {
if (settings->showUsageDataDisclaimer()) { if (settings->showUsageDataDisclaimer()) {
QMessageBox message; QMessageBox message;
@ -85,29 +86,29 @@ void UsageTrackerPlugin::onAutopilotConnect()
message.addButton(tr("Yes, count me in"), QMessageBox::AcceptRole); message.addButton(tr("Yes, count me in"), QMessageBox::AcceptRole);
message.addButton(tr("No, I will not help"), QMessageBox::RejectRole); message.addButton(tr("No, I will not help"), QMessageBox::RejectRole);
message.setText(tr("Openpilot GCS has a function to collect limited anonymous information about " message.setText(tr("Openpilot GCS has a function to collect limited anonymous information about "
"the usage of the application itself and the OpenPilot hardware connected to it.\n\n" "the usage of the application itself and the OpenPilot hardware connected to it.\n\n"
"The intention is to not include anything that can be considered sensitive " "The intention is to not include anything that can be considered sensitive "
"or a threat to the users integrity. The collected information will be sent " "or a threat to the users integrity. The collected information will be sent "
"using a secure protocol to an OpenPilot web service and stored in a database " "using a secure protocol to an OpenPilot web service and stored in a database "
"for later analysis and statistical purposes.\n" "for later analysis and statistical purposes.\n"
"No information will be sold or given to any third party. The sole purpose is " "No information will be sold or given to any third party. The sole purpose is "
"to collect statistics about the usage of our software and hardware to enable us " "to collect statistics about the usage of our software and hardware to enable us "
"to make things better for you.\n\n" "to make things better for you.\n\n"
"The following things are collected:\n" "The following things are collected:\n"
"- Bootloader version\n" "- Bootloader version\n"
"- Firmware version, tag and git hash\n" "- Firmware version, tag and git hash\n"
"- OP Hardware type, revision and mcu serial number\n" "- OP Hardware type, revision and mcu serial number\n"
"- Selected configuration parameters\n" "- Selected configuration parameters\n"
"- GCS version\n" "- GCS version\n"
"- Operating system version and architecture\n" "- Operating system version and architecture\n"
"- Current local time\n" "- Current local time\n"
"The information is collected only at the time when a board is connecting to GCS.\n\n" "The information is collected only at the time when a board is connecting to GCS.\n\n"
"It is possible to enable or disable this functionality in the general " "It is possible to enable or disable this functionality in the general "
"settings part of the options for the GCS application at any time.\n\n" "settings part of the options for the GCS application at any time.\n\n"
"We need your help, with your feedback we know where to improve things and what " "We need your help, with your feedback we know where to improve things and what "
"platforms are in use. This is a community project that depends on people being involved.\n" "platforms are in use. This is a community project that depends on people being involved.\n"
"Thank You for helping us making things better and for supporting OpenPilot!")); "Thank You for helping us making things better and for supporting OpenPilot!"));
QCheckBox* disclaimerCb = new QCheckBox(tr("&Don't show this message again.")); QCheckBox *disclaimerCb = new QCheckBox(tr("&Don't show this message again."));
disclaimerCb->setChecked(true); disclaimerCb->setChecked(true);
message.setCheckBox(disclaimerCb); message.setCheckBox(disclaimerCb);
if (message.exec() != QMessageBox::AcceptRole) { if (message.exec() != QMessageBox::AcceptRole) {
@ -153,20 +154,28 @@ void UsageTrackerPlugin::collectUsageParameters(QMap<QString, QString> &paramete
QByteArray description = utilMngr->getBoardDescription(); QByteArray description = utilMngr->getBoardDescription();
deviceDescriptorStruct devDesc; deviceDescriptorStruct devDesc;
if (UAVObjectUtilManager::descriptionToStructure(description, devDesc)) { if (UAVObjectUtilManager::descriptionToStructure(description, devDesc)) {
parameters["board_type"] = "0x" + QString::number(utilMngr->getBoardModel(), 16).toLower(); int boardModel = utilMngr->getBoardModel();
parameters["board_type"] = "0x" + QString::number(boardModel, 16).toLower();
parameters["board_serial"] = utilMngr->getBoardCPUSerial().toHex(); parameters["board_serial"] = utilMngr->getBoardCPUSerial().toHex();
parameters["bl_version"] = QString::number(utilMngr->getBootloaderRevision()); parameters["bl_version"] = QString::number(utilMngr->getBootloaderRevision());
parameters["fw_tag"] = devDesc.gitTag; parameters["fw_tag"] = devDesc.gitTag;
parameters["fw_hash"] = devDesc.gitHash; parameters["fw_hash"] = devDesc.gitHash;
parameters["os_version"] = QSysInfo::prettyProductName() + " " + QSysInfo::currentCpuArchitecture(); parameters["os_version"] = QSysInfo::prettyProductName() + " " + QSysInfo::currentCpuArchitecture();
parameters["gcs_version"] = VersionInfo::revision(); parameters["gcs_version"] = VersionInfo::revision();
parameters["localtime"] = QDateTime::currentDateTime().toString(Qt::ISODate); parameters["localtime"] = QDateTime::currentDateTime().toString(Qt::ISODate);
// Configuration parameters // Configuration parameters
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>(); UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
ManualControlSettings * controlSettings = ManualControlSettings::GetInstance(objManager); ManualControlSettings *controlSettings = ManualControlSettings::GetInstance(objManager);
parameters["conf_receiver"] = controlSettings->getField("ChannelGroups")->getValue(ManualControlSettings::CHANNELGROUPS_THROTTLE).toString(); parameters["settings_receiver"] = controlSettings->getField("ChannelGroups")->getValue(ManualControlSettings::CHANNELGROUPS_THROTTLE).toString();
RevoSettings revoSettings = RevoSettings::GetInstance(objManager);
// Only get this info if uavo is known by controller
if (revoSettings.isKnown()) {
parameters["settings_fusion"] = revoSettings.getField("FusionAlgorithm")->getValue().toString();
}
} }
} }

View File

@ -32,7 +32,7 @@
class UsageTrackerPlugin : public ExtensionSystem::IPlugin { class UsageTrackerPlugin : public ExtensionSystem::IPlugin {
Q_OBJECT Q_OBJECT
Q_PLUGIN_METADATA(IID "OpenPilot.UsageTracker") Q_PLUGIN_METADATA(IID "OpenPilot.UsageTracker")
public: public:
UsageTrackerPlugin(); UsageTrackerPlugin();
~UsageTrackerPlugin(); ~UsageTrackerPlugin();
@ -47,7 +47,7 @@ private slots:
void collectUsageParameters(QMap<QString, QString> &parameters); void collectUsageParameters(QMap<QString, QString> &parameters);
private: private:
TelemetryManager * m_telemetryManager; TelemetryManager *m_telemetryManager;
}; };
#endif // USAGETRACKERPLUGIN_H #endif // USAGETRACKERPLUGIN_H