bool UsageTrackerPlugin::shouldSend(const QString &hash) { if (getGeneralSettings()->lastUsageHash() == hash) { return false; } else { m_lastHash = hash; return true; } }
void UsageTrackerPlugin::onFinished(QNetworkReply *reply) { if (reply->error() == QNetworkReply::NoError) { getGeneralSettings()->setLastUsageHash(m_lastHash); qDebug() << "Updated last usage hash to:" << m_lastHash; } else { qDebug() << "Usage tracking failed with:" << reply->errorString(); } }
void EEPFILE::eeLoadOwnerName(char*buf,uint8_t len) { EEGeneral g_eeGeneral; int ret = getGeneralSettings(&g_eeGeneral); memset(buf,0,len); if (ret<(int)(sizeof(EEGeneral)-20)) return; memcpy(buf,&g_eeGeneral.ownerName,sizeof(g_eeGeneral.ownerName)); }
bool EEPFILE::eeLoadGeneral() { EEGeneral g_eeGeneral; int ret = getGeneralSettings(&g_eeGeneral); if (ret<(int)(sizeof(EEGeneral)-20)) return false; uint16_t sum=0; for(int i=0; i<12;i++) sum+=g_eeGeneral.calibMid[i]; putGeneralSettings(&g_eeGeneral); return g_eeGeneral.chkSum == sum; }
void UsageTrackerPlugin::onAutopilotConnect() { Core::Internal::GeneralSettings *settings = getGeneralSettings(); if (settings->collectUsageData()) { if (settings->showUsageDataDisclaimer()) { QMessageBox message; message.setWindowTitle(tr("Usage feedback")); message.setIcon(QMessageBox::Information); message.addButton(tr("Yes, count me in"), QMessageBox::AcceptRole); message.addButton(tr("No, I will not help"), QMessageBox::RejectRole); message.setText(tr("The NinjaPilot version of Openpilot GCS has a function to collect limited anonymous information about " "the usage of the application itself and the OpenPilot hardware connected to it.<p>" "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 " "using a secure protocol to an OpenPilot web service and stored in a database " "for later analysis and statistical purposes.<br>" "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 make things better for you.<p>" "The following things are collected:<ul>" "<li>Bootloader version</li>" "<li>Firmware version, tag and git hash</li>" "<li>OP Hardware type, revision and mcu serial number</li>" "<li>Selected configuration parameters</li>" "<li>GCS version</li>" "<li>Operating system version and architecture</li>" "<li>Current local time</li></ul>" "The information is collected only at the time when a board is connecting to GCS.<p>" "It is possible to enable or disable this functionality in the general " "settings part of the options for the GCS application at any time.<p>" "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.<br>" "Thank You for helping us making things better and for supporting OpenPilot!")); QCheckBox *disclaimerCb = new QCheckBox(tr("&Don't show this message again.")); disclaimerCb->setChecked(true); message.setCheckBox(disclaimerCb); if (message.exec() != QMessageBox::AcceptRole) { settings->setCollectUsageData(false); settings->setShowUsageDataDisclaimer(!message.checkBox()->isChecked()); return; } else { settings->setCollectUsageData(true); settings->setShowUsageDataDisclaimer(!message.checkBox()->isChecked()); } } QTimer::singleShot(1000, this, SLOT(trackUsage())); } }
bool EEPFILE::loadFile(void* buf) { theFile->m_type = mee_type ; theFile->load(buf); EEGeneral g_eeGeneral; int sz = getGeneralSettings(&g_eeGeneral); if(sz<40) { return false ; //if it's too small then we have a corrupted memory } if(g_eeGeneral.myVers>MDVERS || (g_eeGeneral.myVers<MDVERS_r261 && g_eeGeneral.myVers!=4)) { return false ; } int16_t sum=0; for(int i=0; i<12;i++) sum+=g_eeGeneral.calibMid[i]; return g_eeGeneral.chkSum == sum; }