Index: sources/cloudsync/CloudSyncController.cpp =================================================================== diff -u -r80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803 -r2912750c8e787739f2cb2069fee1b33195a9ef54 --- sources/cloudsync/CloudSyncController.cpp (.../CloudSyncController.cpp) (revision 80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803) +++ sources/cloudsync/CloudSyncController.cpp (.../CloudSyncController.cpp) (revision 2912750c8e787739f2cb2069fee1b33195a9ef54) @@ -683,8 +683,8 @@ QVariantList args ; Errors_Enum error = eError_Unknown; qint32 messageID = UI2CS(static_cast( eMessageID_TxReport )); - - if ( ! isRegistered() ) { error = eError_NotRegistered ; args = { vFileName }; ok = false; goto lErr; } + // DEBUG ok = false; // using the ok bool which is true as the debug flag to bypass the registration on debug testing. + if ( ok && ! isRegistered() ) { error = eError_NotRegistered ; args = { vFileName }; ok = false; goto lErr; } sendUIBuff(makeUIBuff( messageID , { vFileName } )); return; @@ -700,7 +700,7 @@ */ bool CloudSyncController::sendMessage(const Message &vMessage) { bool ok = false; - + //DEBUG qDebug() << Q_FUNC_INFO << vMessage.id; // this function is used in sendUIResponse, therefore the message IDs which are responses should be implemented here. switch (vMessage.id) { case eMessageID_DeviceRegister : /* No Request/Response */ break; @@ -832,8 +832,8 @@ mTxCode = vMessage.params[0].trimmed(); if ( mTxCode.isEmpty() ) { toLog(eError_TxCodeEmpty , {}); ok = false; goto lOut; } - emit didTxCodeReceive ( mTxCode ); //DEBUG qDebug() << " ---------- " << mTxCode; + emit didTxCodeReceive ( mTxCode ); lOut: return ok; Index: sources/storage/Logger.cpp =================================================================== diff -u -r611bbf4dcba67768db87cf30f21fd2db788f677d -r2912750c8e787739f2cb2069fee1b33195a9ef54 --- sources/storage/Logger.cpp (.../Logger.cpp) (revision 611bbf4dcba67768db87cf30f21fd2db788f677d) +++ sources/storage/Logger.cpp (.../Logger.cpp) (revision 2912750c8e787739f2cb2069fee1b33195a9ef54) @@ -260,7 +260,6 @@ // use the Settings path first (/var/configurations (Encrypted Partition)) if ( ! QDir (basePath ).exists( )) { basePath = Storage::Standard_tmp; goto lOut; } if ( ! FileHandler::makeFolder (basePath + Storage::Log_Folder_Treatment )) { basePath = Storage::Standard_tmp; goto lOut; } - if ( ! FileHandler::makeFolder (basePath + Storage::Log_Folder_Pending )) { basePath = Storage::Standard_tmp; goto lOut; } lOut: _logPathNames[vLogType] = basePath + Storage::Log_Folder_Treatment; Index: sources/storage/Settings.h =================================================================== diff -u -rec31f94081864aec8b48a3cfa1e0aea80619714c -r2912750c8e787739f2cb2069fee1b33195a9ef54 --- sources/storage/Settings.h (.../Settings.h) (revision ec31f94081864aec8b48a3cfa1e0aea80619714c) +++ sources/storage/Settings.h (.../Settings.h) (revision 2912750c8e787739f2cb2069fee1b33195a9ef54) @@ -159,6 +159,7 @@ return ""; } + //Note: this funtion is specific to the settings and should not use the StorageGlobals function. static QString location(Location_Enum vLoc) { switch (vLoc) { // NOTE: don't use default case eInit : return Storage::Settings_Path_Init; Index: sources/storage/StorageGlobals.cpp =================================================================== diff -u -r689177edf29dee6f10bebfed42f6bbadeb7ce8a8 -r2912750c8e787739f2cb2069fee1b33195a9ef54 --- sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision 689177edf29dee6f10bebfed42f6bbadeb7ce8a8) +++ sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision 2912750c8e787739f2cb2069fee1b33195a9ef54) @@ -131,7 +131,6 @@ const char *Log_Folder_Application = "log/" ; // Event/Data Log const char *Log_Folder_Service = "service/" ; // Service Log const char *Log_Folder_Treatment = "treatment/" ; // Treatment Log - const char *Log_Folder_Pending = "treatment/pending/" ; // Treatment Log Pending, have not been saved on cloud yet. // TODO : These need to be removed from here because they are only used in their specific classes. // Date and Time Index: sources/storage/StorageGlobals.h =================================================================== diff -u -r611bbf4dcba67768db87cf30f21fd2db788f677d -r2912750c8e787739f2cb2069fee1b33195a9ef54 --- sources/storage/StorageGlobals.h (.../StorageGlobals.h) (revision 611bbf4dcba67768db87cf30f21fd2db788f677d) +++ sources/storage/StorageGlobals.h (.../StorageGlobals.h) (revision 2912750c8e787739f2cb2069fee1b33195a9ef54) @@ -77,7 +77,6 @@ extern const char *Log_Folder_Application; // Event/Data Log extern const char *Log_Folder_Service; // Service Log extern const char *Log_Folder_Treatment; // Treatment Log - extern const char *Log_Folder_Pending; // Treatment Log Pending, have not been saved on cloud yet. // Date and Time extern const char *Date_Time_Set_Sh; Index: sources/storage/TreatmentLog.cpp =================================================================== diff -u -r80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803 -r2912750c8e787739f2cb2069fee1b33195a9ef54 --- sources/storage/TreatmentLog.cpp (.../TreatmentLog.cpp) (revision 80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803) +++ sources/storage/TreatmentLog.cpp (.../TreatmentLog.cpp) (revision 2912750c8e787739f2cb2069fee1b33195a9ef54) @@ -65,6 +65,7 @@ connect(&_CloudSyncController , SIGNAL(didTxCodeReceive(const QString &)), this , SLOT( onTxCodeReceive(const QString &))); + //DEBUG onCloudSyncStatus(true); // to bypass the setting partition mount in debug testing. } /*! @@ -180,18 +181,13 @@ if (vLogType == Logger::eLogTrtmt) { if ( vLogPath.trimmed().isEmpty() ) { _treatmentLogPath = QString("%1%2") - .arg(Storage::Settings_Path_Name) + .arg(Storage::Settings_Path()) .arg(Storage::Log_Folder_Treatment ); } else { _treatmentLogPath = vLogPath; } - _treatmentLogPath_Pending = QString("%1%2") - .arg(Storage::Settings_Path_Name) - .arg(Storage::Log_Folder_Pending ); - LOG_DEBUG(QString("Treatment log folder has been set to %1" ).arg(_treatmentLogPath )); - LOG_DEBUG(QString("Treatment log pending folder has been set to %1" ).arg(_treatmentLogPath_Pending )); } } @@ -321,13 +317,14 @@ _lastTxInfo.mDeviceID = _deviceID; _lastTxInfo.mPatientID = _values[ePatientID]; - _lastTxInfo.mFileName = QString("%1%2_%3.log") - .arg(_treatmentLogPath_Pending) + _lastTxInfo.mFileName = QString("%1%2_%3.%4") + .arg(_treatmentLogPath) .arg(_lastTxInfo.mDateTime) - .arg(_lastTxInfo.mDeviceID); - - ok = Storage::FileHandler::makeFolder(_treatmentLogPath_Pending); - if ( ! ok ) { LOG_DEBUG(QString("Cannot create folder %1").arg(_treatmentLogPath_Pending)); return ok; } + .arg(_lastTxInfo.mDeviceID) + .arg(_treatmentLogExtPending); + //DEBUG qDebug() << _lastTxInfo.mFileName; + ok = Storage::FileHandler::makeFolder(_treatmentLogPath); + if ( ! ok ) { LOG_DEBUG(QString("Cannot create folder %1").arg(_treatmentLogPath )); return ok; } ok = Storage::FileHandler::write(_lastTxInfo.mFileName, logContent, false); if ( ! ok ) { LOG_DEBUG(QString("Cannot write to file %1").arg(_lastTxInfo.mFileName)); return ok; } _treatmentLogAvrgeData.clear(); @@ -466,7 +463,10 @@ { bool ok = true; QString src = _pendingTx; - QString dst = _treatmentLogPath + QFileInfo(src).fileName(); + QString dst = QString("%1%2.%3") + .arg(_treatmentLogPath) + .arg(QFileInfo(src).baseName()) + .arg(_treatmentLogExtUploaded); QString logContent; ADDTITLE("Title"); ADDALINE(QString("Tx Code,%1,").arg(_txCode)); @@ -521,7 +521,7 @@ } QFileInfoList pendingFiles; - pendingFiles = Storage::FileHandler::find(_TreatmentLog.logPathPending(), {"*.log"}); + pendingFiles = Storage::FileHandler::find( _TreatmentLog.logPath(), { QString("*.%1").arg(_treatmentLogExtPending) } ); // look into the list. // if there are pending files, // send a request only for the top on the list Index: sources/storage/TreatmentLog.h =================================================================== diff -u -r6d76149dca70e879f33bf6ed44203d0d06bc523a -r2912750c8e787739f2cb2069fee1b33195a9ef54 --- sources/storage/TreatmentLog.h (.../TreatmentLog.h) (revision 6d76149dca70e879f33bf6ed44203d0d06bc523a) +++ sources/storage/TreatmentLog.h (.../TreatmentLog.h) (revision 2912750c8e787739f2cb2069fee1b33195a9ef54) @@ -45,7 +45,8 @@ int _pendingCounter = 0 ; // QString _treatmentLogPath; - QString _treatmentLogPath_Pending; + const char* _treatmentLogExtUploaded = "txr"; + const char* _treatmentLogExtPending = "txr.p"; QFutureWatcher _saveWatcher; QFutureWatcher _exportWatcher; @@ -214,7 +215,7 @@ void initConnections(); - void logPath (Logger::LogType vLogType = Logger::eLogTrtmt, QString vLogPath = ""); + void logPath (Logger::LogType vLogType, QString vLogPath); bool saveLog (); void saveLogConcurrent (); bool exportLog (); @@ -242,8 +243,7 @@ void append(const TreatmentLogAlarmData &vData); void append(const TreatmentLogEventData &vData); - QString logPath () { return _treatmentLogPath ;} - QString logPathPending () { return _treatmentLogPath_Pending ;} + QString logPath () const { return _treatmentLogPath; } private slots: void onLogPathSet(Logger::LogType vLogType, const QString &vLogPath);