Commit 41351f80 authored by Gus Grubba's avatar Gus Grubba

Remove debugging code

parent 0f974ebc
......@@ -443,7 +443,7 @@ Item {
Repeater {
model: parent._pairModel
delegate: QGCLabel {
text: modelData + ' ' + QGroundControl.pairingManager.pairedDeviceNameList.length
text: modelData
Layout.row: index
Layout.column: 0
Layout.minimumWidth:ScreenTools.defaultFontPixelWidth * 14
......
......@@ -62,6 +62,8 @@ void
PairingManager::setToolbox(QGCToolbox *toolbox)
{
QGCTool::setToolbox(toolbox);
_updatePairedDeviceNameList();
emit pairedListChanged();
}
//-----------------------------------------------------------------------------
......@@ -71,19 +73,20 @@ PairingManager::_pairingCompleted(QString name)
_writeJson(_jsonDoc, _pairingCacheFile(name));
_remotePairingMap["NM"] = name;
_lastPaired = name;
_updatePairedDeviceNameList();
emit pairedListChanged();
emit pairedVehicleChanged();
_app->informationMessageBoxOnMainThread("", tr("Paired with %1").arg(name));
//_app->informationMessageBoxOnMainThread("", tr("Paired with %1").arg(name));
setPairingStatus(PairingSuccess, tr("Pairing Successfull"));
}
//-----------------------------------------------------------------------------
void
PairingManager::_connectionCompleted(QString name)
PairingManager::_connectionCompleted(QString /*name*/)
{
//QString pwd = _remotePairingMap["PWD"].toString();
//_toolbox->microhardManager()->switchToConnectionEncryptionKey(pwd);
_app->informationMessageBoxOnMainThread("", tr("Connected to %1").arg(name));
//_app->informationMessageBoxOnMainThread("", tr("Connected to %1").arg(name));
setPairingStatus(PairingConnected, tr("Connection Successfull"));
}
......@@ -128,7 +131,7 @@ PairingManager::_stopUpload()
//-----------------------------------------------------------------------------
void
PairingManager::_uploadFinished(void)
PairingManager::_uploadFinished()
{
QMutexLocker lock(&_uploadMutex);
QNetworkReply* reply = qobject_cast<QNetworkReply*>(QObject::sender());
......@@ -198,22 +201,21 @@ PairingManager::removePairedDevice(QString name)
{
QFile file(_pairingCacheFile(name));
file.remove();
_updatePairedDeviceNameList();
emit pairedListChanged();
}
//-----------------------------------------------------------------------------
QStringList
PairingManager::pairedDeviceNameList(void)
void
PairingManager::_updatePairedDeviceNameList()
{
QStringList list;
_deviceList.clear();
QDirIterator it(_pairingCacheDir().absolutePath(), QDir::Files);
while (it.hasNext()) {
QFileInfo fileInfo(it.next());
list.append(fileInfo.fileName());
_deviceList.append(fileInfo.fileName());
qCDebug(PairingManagerLog) << "Listing: " << fileInfo.fileName();
}
return list;
}
//-----------------------------------------------------------------------------
......@@ -226,9 +228,9 @@ PairingManager::_assumeMicrohardPairingJson()
jsonObject.insert("LT", "MH");
jsonObject.insert("IP", "192.168.168.10");
jsonObject.insert("AIP", _toolbox->microhardManager()->remoteIPAddr());
jsonObject.insert("CU", _toolbox->microhardManager()->configUserName());
jsonObject.insert("CP", _toolbox->microhardManager()->configPassword());
jsonObject.insert("EK", _toolbox->microhardManager()->encryptionKey());
jsonObject.insert("CU", _toolbox->microhardManager()->configUserName());
jsonObject.insert("CP", _toolbox->microhardManager()->configPassword());
jsonObject.insert("EK", _toolbox->microhardManager()->encryptionKey());
json.setObject(jsonObject);
return QString(json.toJson(QJsonDocument::Compact));
......@@ -266,8 +268,8 @@ PairingManager::_parsePairingJson(QString jsonEnc)
}
_remotePairingMap = jsonObj.toVariantMap();
QString linkType = _remotePairingMap["LT"].toString();
QString pport = _remotePairingMap["PP"].toString();
QString linkType = _remotePairingMap["LT"].toString();
QString pport = _remotePairingMap["PP"].toString();
if (pport.length()==0) {
pport = "29351";
}
......@@ -449,7 +451,7 @@ PairingManager::_createMicrohardConnectJson(QString cert2)
//-----------------------------------------------------------------------------
QStringList
PairingManager::pairingLinkTypeStrings(void)
PairingManager::pairingLinkTypeStrings()
{
//-- Must follow same order as enum LinkType in LinkConfiguration.h
static QStringList list;
......@@ -478,7 +480,7 @@ PairingManager::_setPairingStatus(PairingStatus status, QString statusStr)
//-----------------------------------------------------------------------------
QString
PairingManager::pairingStatusStr(void) const
PairingManager::pairingStatusStr() const
{
return _statusString;
}
......
......@@ -61,13 +61,13 @@ public:
Q_ENUM(PairingStatus)
QStringList pairingLinkTypeStrings (void);
QString pairingStatusStr (void) const;
QStringList pairedDeviceNameList (void);
QStringList pairingLinkTypeStrings ();
QString pairingStatusStr () const;
QStringList pairedDeviceNameList () { return _deviceList; }
PairingStatus pairingStatus () { return _status; }
QString pairedVehicle () { return _lastPaired; }
int nfcIndex (void) { return _nfcIndex; }
int microhardIndex (void) { return _microhardIndex; }
int nfcIndex () { return _nfcIndex; }
int microhardIndex () { return _microhardIndex; }
bool firstBoot () { return _firstBoot; }
bool errorState () { return _status == PairingRejected || _status == PairingConnectionRejected || _status == PairingError; }
void setStatusMessage (PairingStatus status, QString statusStr) { emit setPairingStatus(status, statusStr); }
......@@ -98,23 +98,23 @@ public:
Q_PROPERTY(bool firstBoot READ firstBoot WRITE setFirstBoot NOTIFY firstBootChanged)
signals:
void startUpload(QString pairURL, QJsonDocument);
void closeConnection();
void pairingConfigurationsChanged();
void nameListChanged();
void pairingStatusChanged();
void parsePairingJson(QString json);
void setPairingStatus(PairingStatus status, QString pairingStatus);
void pairedListChanged();
void pairedVehicleChanged();
void firstBootChanged();
void startUpload (QString pairURL, QJsonDocument);
void closeConnection ();
void pairingConfigurationsChanged ();
void nameListChanged ();
void pairingStatusChanged ();
void parsePairingJson (QString json);
void setPairingStatus (PairingStatus status, QString pairingStatus);
void pairedListChanged ();
void pairedVehicleChanged ();
void firstBootChanged ();
private slots:
void _startUpload(QString pairURL, QJsonDocument);
void _stopUpload();
void _startUploadRequest();
void _parsePairingJson(QString jsonEnc);
void _setPairingStatus(PairingStatus status, QString pairingStatus);
void _startUpload (QString pairURL, QJsonDocument);
void _stopUpload ();
void _startUploadRequest ();
void _parsePairingJson (QString jsonEnc);
void _setPairingStatus (PairingStatus status, QString pairingStatus);
private:
QString _statusString;
......@@ -131,24 +131,26 @@ private:
QNetworkAccessManager* _uploadManager = nullptr;
QString _uploadURL{};
QString _uploadData{};
void _parsePairingJsonFile();
QJsonDocument _createZeroTierConnectJson(QString cert2);
QJsonDocument _createMicrohardConnectJson(QString cert2);
QJsonDocument _createZeroTierPairingJson(QString cert1);
QJsonDocument _createMicrohardPairingJson(QString pwd, QString cert1);
QString _assumeMicrohardPairingJson();
void _writeJson(QJsonDocument &jsonDoc, QString fileName);
QString _getLocalIPInNetwork(QString remoteIP, int num);
void _uploadFinished(void);
void _uploadError(QNetworkReply::NetworkError code);
void _pairingCompleted(QString name);
void _connectionCompleted(QString name);
QDir _pairingCacheDir();
QString _pairingCacheFile(QString uavName);
bool _firstBoot = true;
bool _firstBoot = true;
QStringList _deviceList;
void _parsePairingJsonFile ();
QJsonDocument _createZeroTierConnectJson (QString cert2);
QJsonDocument _createMicrohardConnectJson (QString cert2);
QJsonDocument _createZeroTierPairingJson (QString cert1);
QJsonDocument _createMicrohardPairingJson (QString pwd, QString cert1);
QString _assumeMicrohardPairingJson ();
void _writeJson (QJsonDocument &jsonDoc, QString fileName);
QString _getLocalIPInNetwork (QString remoteIP, int num);
void _uploadFinished ();
void _uploadError (QNetworkReply::NetworkError code);
void _pairingCompleted (QString name);
void _connectionCompleted (QString name);
QDir _pairingCacheDir ();
QString _pairingCacheFile (QString uavName);
void _updatePairedDeviceNameList ();
#if defined QGC_ENABLE_NFC || defined QGC_ENABLE_QTNFC
PairingNFC pairingNFC;
PairingNFC pairingNFC;
#endif
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment