Index: sources/cloudsync/CloudSyncController.cpp =================================================================== diff -u -r9ae3b0d6624904693329309aaf8ff02784c17184 -raeffd70bf53171d4418d4d083fae3085c50a38bd --- sources/cloudsync/CloudSyncController.cpp (.../CloudSyncController.cpp) (revision 9ae3b0d6624904693329309aaf8ff02784c17184) +++ sources/cloudsync/CloudSyncController.cpp (.../CloudSyncController.cpp) (revision aeffd70bf53171d4418d4d083fae3085c50a38bd) @@ -176,15 +176,24 @@ */ void CloudSyncController::onActionReceive(GuiActionType vAction, const QVariantList &vData) { + QString inp; switch (vAction) { case GuiActionType::ID_HDOperationModeData: case GuiActionType::ID_PreTreatmentStates : case GuiActionType::ID_TreatmentStates : case GuiActionType::ID_PostTreatmentStates: case GuiActionType::ID_DisinfectStates : - qDebug() << "~ update for CloudSync" << vAction << vData; - if ( ! Storage::FileHandler::write(Storage::SDCard_Base_Path_Name + _location + Storage::CloudSync_Inp_File, enumString(vAction)) ) - LOG_DEBUG(tr("Error writing to the CloudSync Input file.")); + // TODO: This section is the translation/mapping section + // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv + // preparing the message + inp = QString::number(_seq++); + inp += ',' + Format::toHexString/*QString::number*//*enumString*/(vAction); + for (auto var : vData) { + inp += ',' + var.toString(); + } + // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + // writing the message into the buffer. + LOG_CLOUD(inp); break; default: break; Index: sources/cloudsync/CloudSyncController.h =================================================================== diff -u -r9ae3b0d6624904693329309aaf8ff02784c17184 -raeffd70bf53171d4418d4d083fae3085c50a38bd --- sources/cloudsync/CloudSyncController.h (.../CloudSyncController.h) (revision 9ae3b0d6624904693329309aaf8ff02784c17184) +++ sources/cloudsync/CloudSyncController.h (.../CloudSyncController.h) (revision aeffd70bf53171d4418d4d083fae3085c50a38bd) @@ -47,6 +47,7 @@ bool _init = false; const QString _location = "cloudsync/"; + quint64 _seq = 0; public slots: bool init(); Index: sources/storage/Logger.cpp =================================================================== diff -u -r3e64d98e243484505a44d99b13826097cb6b01eb -raeffd70bf53171d4418d4d083fae3085c50a38bd --- sources/storage/Logger.cpp (.../Logger.cpp) (revision 3e64d98e243484505a44d99b13826097cb6b01eb) +++ sources/storage/Logger.cpp (.../Logger.cpp) (revision aeffd70bf53171d4418d4d083fae3085c50a38bd) @@ -234,6 +234,7 @@ if ( ok && ! setLogPath(LogType::eLogDatum) ) ok = false; if ( ok && ! setLogPath(LogType::eLogDebug) ) ok = false; if ( ok && ! setLogPath(LogType::eLogTrtmt) ) ok = false; + if ( ok && ! setLogPath(LogType::eLogCloud) ) ok = false; return ok; } // coco end @@ -285,13 +286,16 @@ date = currentDate; } - QString fileName = date + _dateSeparator + _logFileNamePrefix; + QString fileName = date + _dateSeparator; switch (vLogType) { case LogType::eLogEvent: case LogType::eLogDatum: case LogType::eLogDebug: + fileName += _logFileNamePrefix + _logFileNameExt[vLogType]; + break; // case LogType::eLogTrtmt: // this type of log will never happen here. Only put here to make sure it is intentional. - fileName += _logFileNameExt[vLogType]; + case LogType::eLogCloud: + fileName += QString(Storage::CloudSync_Inp_File) + _logFileNameExt[vLogType]; break; default: @@ -395,7 +399,7 @@ static QString mOExtension; int removeCount = 0; QString mLogFileFilter; - for ( const auto &iType : { eLogEvent , eLogDatum , eLogDebug , eLogTrtmt } ) { + for ( const auto &iType : { eLogEvent , eLogDatum , eLogDebug , eLogTrtmt , eLogCloud } ) { QString mCSource = _logPathNames [iType]; QString mCExtension = _logFileNameExt[iType]; // if the event and datum are mixed (mOSource == mCSource && mCExtension == mOExtension) in one file then no need to go over the same files in same folder and do it again. Index: sources/storage/Logger.h =================================================================== diff -u -r3e64d98e243484505a44d99b13826097cb6b01eb -raeffd70bf53171d4418d4d083fae3085c50a38bd --- sources/storage/Logger.h (.../Logger.h) (revision 3e64d98e243484505a44d99b13826097cb6b01eb) +++ sources/storage/Logger.h (.../Logger.h) (revision aeffd70bf53171d4418d4d083fae3085c50a38bd) @@ -33,9 +33,12 @@ #define LOG_DATUM(vCONTENT) emit Storage::Logger::I().didLog(vCONTENT, Storage::Logger::LogType::eLogDatum, true ) #define LOG_DEBUG(vCONTENT) emit Storage::Logger::I().didLog(vCONTENT, Storage::Logger::LogType::eLogDebug, true ) +#define LOG_CLOUD(vCONTENT) emit Storage::Logger::I().didLog(vCONTENT, Storage::Logger::LogType::eLogCloud, true ) + #define LOG_EVENT_UI(vCONTENT) emit Storage::Logger::I().didLog("UI," + vCONTENT, Storage::Logger::LogType::eLogEvent, true ) #define LOG_DATUM_UI(vCONTENT) emit Storage::Logger::I().didLog("UI," + vCONTENT, Storage::Logger::LogType::eLogDatum, true ) + #define MIXED_EVENT_DATUM #undef DISABLE_ACKNOW_CHECKIN_MESSAGE_LOG @@ -89,6 +92,8 @@ eLogTrtmt, ///< Treatment Log Files + eLogCloud, ///< CloudSync Log File)s) + eLogType_Count, }; Q_ENUM(LogType) @@ -103,6 +108,7 @@ { LogType::eLogDatum, "log/" }, { LogType::eLogDebug, "service/" }, { LogType::eLogTrtmt, Storage::Treatment_Log_Folder }, + { LogType::eLogCloud, Storage::CloudSync_Log_Folder }, }; const QHash _logPrefix { // Will be used for the logging in the file @@ -120,6 +126,7 @@ #endif { LogType::eLogDebug, ".err" }, { LogType::eLogTrtmt, ".log" }, + { LogType::eLogCloud, ".buf" }, }; // be careful when defining these percentages @@ -138,6 +145,7 @@ { LogType::eLogDebug, 15 }, // in percent // Not Sure yet so commented out in the remove. { LogType::eLogTrtmt, 100}, // in percent // No Remove for now + { LogType::eLogCloud, 100}, // in percent // No Remove for now }; const char *_dateFormat = "yyyy_MM_dd" ; // date used in the file name Index: sources/storage/StorageGlobals.cpp =================================================================== diff -u -r9ae3b0d6624904693329309aaf8ff02784c17184 -raeffd70bf53171d4418d4d083fae3085c50a38bd --- sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision 9ae3b0d6624904693329309aaf8ff02784c17184) +++ sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision aeffd70bf53171d4418d4d083fae3085c50a38bd) @@ -115,6 +115,9 @@ const char *Brightness_Get = "brightness_get.sh"; // Cloud Sync - const char *CloudSync_Out_File = "cloudsync_out.log"; - const char *CloudSync_Inp_File = "cloudsync_inp.log"; + // Please notice that, is the folder not the path + // and it needs to be concatenated after SDCard_Base_Path_Name for each build configuration + const char *CloudSync_Log_Folder = "cloudsync/"; + const char *CloudSync_Out_File = "cloudsync_out"; + const char *CloudSync_Inp_File = "cloudsync_inp"; } Index: sources/storage/StorageGlobals.h =================================================================== diff -u -r9ae3b0d6624904693329309aaf8ff02784c17184 -raeffd70bf53171d4418d4d083fae3085c50a38bd --- sources/storage/StorageGlobals.h (.../StorageGlobals.h) (revision 9ae3b0d6624904693329309aaf8ff02784c17184) +++ sources/storage/StorageGlobals.h (.../StorageGlobals.h) (revision aeffd70bf53171d4418d4d083fae3085c50a38bd) @@ -83,6 +83,7 @@ extern const char *Brightness_Get; // Cloud Sync + extern const char *CloudSync_Log_Folder; extern const char *CloudSync_Out_File; extern const char *CloudSync_Inp_File; }