Index: sources/cloudsync/CloudSyncController.cpp =================================================================== diff -u -r8566686e033eaa3025180a735ce6f485e4fcaad4 -re7d731932dbc46bb459190e8a46cb9f7c4b54f01 --- sources/cloudsync/CloudSyncController.cpp (.../CloudSyncController.cpp) (revision 8566686e033eaa3025180a735ce6f485e4fcaad4) +++ sources/cloudsync/CloudSyncController.cpp (.../CloudSyncController.cpp) (revision e7d731932dbc46bb459190e8a46cb9f7c4b54f01) @@ -113,6 +113,8 @@ this , SLOT( onWatchFileChange (const QString &))); connect(&_DeviceController , SIGNAL(didFactoryReset (bool)), this , SLOT( onFactoryReset (bool))); + connect(&_DeviceController , SIGNAL(didDecommissioning (bool)), + this , SLOT( onDecommissioning (bool))); connect(&_TreatmentLog , SIGNAL(didPendingTxr (const QString &)), this , SLOT( onPendingTxr (const QString &))); connect(this , SIGNAL(didInitComplete ()), @@ -222,7 +224,7 @@ /*! * \brief CloudSyncController::onFactoryReset * \details this slot will be called when the DeviceController is done with the Factory Reset - * to let the UI request CS to do the Factory Reset and clean up all the Tokens. + * to let the UI request CS to do the Factory Reset and clean up all the Logs. * \param vPass - Device controller factory reset was successful. */ void CloudSyncController::onFactoryReset(bool vPass) @@ -233,6 +235,19 @@ } /*! + * \brief CloudSyncController::onDecommissioning + * \details this slot will be called when the DeviceController is done with the Decommissioning + * to let the UI request CS to do the Decommissioning and clean up all the Tokens. + * \param vPass - Device controller Decommissioning was successful. + */ +void CloudSyncController::onDecommissioning(bool vPass) +{ + if ( vPass ) { + csDecommissioning(); + } +} + +/*! * \brief CloudSyncController::onWatchFileChange * \details This slot will be called when the Device Controller identifies any changes in the watched files. * \param vFile - watched file @@ -873,26 +888,54 @@ /*! * \brief CloudSyncController::csFactoryReset + * \details This function is requesting CloudSync to remove all the logs + * in the logs folder (/media/sd-card/cloudsync/log/) + * during Factory Reset + * It is a request from UI to CS since UI Linux user (denali) should not have access + * to remove the CloudSync logs. + */ +bool CloudSyncController::csFactoryReset() +{ + + bool ok = true; + return ok; // NOT IMPLEMENTED + + QVariantList args ; + Errors_Enum error = eError_Unknown; + qint32 messageID = UI2CS(static_cast( eMessageID_CSFactoryReset )); + + if ( ! isRegistered() ) { error = eError_NotRegistered ; args = {}; ok = false; goto lErr; } + sendUIBuff(makeUIBuff( messageID , { } )); + + return ok; +lErr: + toLog(error, args); + return ok; +} + +/*! + * \brief CloudSyncController::Decommissioning * \details This function is requesting CloudSync to remove all the credentials and configurations * in the settings partition (/var/configurations/CloudSync) * during decommissioning * which then it means the device needs to be re-registered to able to communicate with cloud. * It is a request from UI to CS since UI Linux user (denali) should not have access * to remove the CloudSync credentials. */ -void CloudSyncController::csFactoryReset() +bool CloudSyncController::csDecommissioning() { - bool ok = true; Q_UNUSED(ok) + bool ok = true; QVariantList args ; Errors_Enum error = eError_Unknown; - qint32 messageID = UI2CS(static_cast( eMessageID_CSFactoryReset )); + qint32 messageID = UI2CS(static_cast( eMessageID_CSDecommissioning )); if ( ! isRegistered() ) { error = eError_NotRegistered ; args = {}; ok = false; goto lErr; } sendUIBuff(makeUIBuff( messageID , { } )); - return; + return ok; lErr: toLog(error, args); + return ok; } /*!