Index: main.cpp =================================================================== diff -u -ra7c580f0998ee781c47314384f677249cea4c4b4 -r1bf8c894c5cc5ea6d62af0662fcf5a18e1a06459 --- main.cpp (.../main.cpp) (revision a7c580f0998ee781c47314384f677249cea4c4b4) +++ main.cpp (.../main.cpp) (revision 1bf8c894c5cc5ea6d62af0662fcf5a18e1a06459) @@ -353,9 +353,9 @@ */ void setApplicationVersion() { bool isOnServer = true; - QString ver_major = QString("%1").arg(UI_VERSION_MAJAR ); - QString ver_minor = QString("%1").arg(UI_VERSION_MINOR ); - QString ver_micro = QString("%1").arg(UI_VERSION_MICRO ); + QString ver_major = QString("%1").arg(VER_MAJOR ); + QString ver_minor = QString("%1").arg(VER_MINOR ); + QString ver_micro = QString("%1").arg(VER_MICRO ); QString ver_revis = QString("%1").arg(VER_REVIS ); QString ver_branch = QString("%1").arg(VER_BRANCH ); QString ver_comp = QString("%1").arg(SW_COMPATIBILITY_REV ); Index: sources/ApplicationController.cpp =================================================================== diff -u -ra7c580f0998ee781c47314384f677249cea4c4b4 -r1bf8c894c5cc5ea6d62af0662fcf5a18e1a06459 --- sources/ApplicationController.cpp (.../ApplicationController.cpp) (revision a7c580f0998ee781c47314384f677249cea4c4b4) +++ sources/ApplicationController.cpp (.../ApplicationController.cpp) (revision 1bf8c894c5cc5ea6d62af0662fcf5a18e1a06459) @@ -659,7 +659,7 @@ * or * Queues the alarms if vSend is false. * \param vAlarmID - The alarm ID - * \param vSend - False to queue the ValarmID alarm ID, or True to send the list of the queued alarms. + * \param vSend - False to queue the vAlarmID alarm ID, or True to send the list of the queued alarms. */ void ApplicationController::onPOSTFail(GuiAlarmID vAlarmID) { alarmTrigger(vAlarmID, false, false); @@ -715,13 +715,14 @@ /*! * \brief ApplicationController::onCryptSetupMount * \details It is the slot to handle _DeviceController::didCryptSetupMount signal. - * Tels the settings start initate. + * Tells the settings start initiate. */ void ApplicationController::onCryptSetupMount(bool vPass) { //DEBUG qDebug() << " ***** " << Q_FUNC_INFO << vPass; if ( ! vPass ) { _post.isDone(vPass); + LOG_APPED_PO(QString("Configuration partition encryption failed.")); alarmTrigger(Gui::GuiAlarmID::ALARM_ID_HD_UI_POST_FAILURE_SETTINGS_BAD); } // if ( vPass ) // it needs more investigation @@ -747,6 +748,7 @@ //DEBUG qDebug() << " ***** " << Q_FUNC_INFO; if ( ! vPass ) { _post.isDone(vPass); + LOG_APPED_PO(QString("Configuration treatment ranges failed.")); alarmTrigger(Gui::GuiAlarmID::ALARM_ID_HD_UI_POST_FAILURE_SETTINGS_BAD); } Index: sources/cloudsync/CloudSyncController.cpp =================================================================== diff -u -r656094cd72dfcb6cec410b8e36570abf5c9d6975 -r1bf8c894c5cc5ea6d62af0662fcf5a18e1a06459 --- sources/cloudsync/CloudSyncController.cpp (.../CloudSyncController.cpp) (revision 656094cd72dfcb6cec410b8e36570abf5c9d6975) +++ sources/cloudsync/CloudSyncController.cpp (.../CloudSyncController.cpp) (revision 1bf8c894c5cc5ea6d62af0662fcf5a18e1a06459) @@ -25,7 +25,8 @@ #include "TreatmentLog.h" #include "crc.h" -SINGLETON_DISABLE(CloudSyncController) +//TODO testing the CloudSync and Application execution order +// SINGLETON_DISABLE(CloudSyncController) /*! * \brief CloudSyncController::CloudSyncController @@ -96,9 +97,10 @@ */ void CloudSyncController::initConnections() { - if ( ! gDisableCloudSyncFailStop ) { - SINGLETON_DISABLE_CONNECT(didPOSTCloudSync) - } + //TODO testing the CloudSync and Application execution order + // if ( ! gDisableCloudSyncFailStop ) { + // SINGLETON_DISABLE_CONNECT(didPOSTCloudSync) + // } connect(&_ApplicationController , SIGNAL(didPOSTCloudSync(bool)), this , SLOT( onPOSTCloudSync(bool))); @@ -161,8 +163,8 @@ */ void CloudSyncController::timerEvent(QTimerEvent *) { - // TODO: touch the inp file to as a check-in for CloudSync to know we are up - // a simple touch or a check-in message? + TIME_CALL(sendCheckIn(), _checkinIntervalSend); // call every x times/second - will be called on first call. + TIME_CALL(testCheckIn(), _checkinIntervalTest); // call every x times/second - will be called on first call. testWatchBuffDate(); testDeviceInfoWait(); } @@ -195,9 +197,9 @@ * \details This the handler for the ApplicationController::didPOSTCloudSync(bool) * \param vPass - will be true if the POST test of CloudSync passed and it is running. */ -void CloudSyncController::onPOSTCloudSync(bool vPass) +void CloudSyncController::onPOSTCloudSync(bool) { - _postPass = vPass; + //TOD _postPass = vPass; } /*! @@ -249,15 +251,33 @@ */ bool CloudSyncController::addCSBuffWatch() { + // this makeFolder function call investigated for permissions + // during setup the folder if does not exists will be created (root) + // the lockdown.sh script will set the permissions for it. + // on power cycle to normal operation the folder with the correct exists. + // *** NOTE: the makeFolder returns true if the folder already exists. *** bool ok = Storage::FileHandler::makeFolder(_location); QVariantList args {}; Errors_Enum error = eError_Unknown; - if ( ! ok ) { error = eError_LogFolder; args = {{ _location }}; ok = false; goto lErr; } - _date_out_File = _location + // The location - _dateFormatted + _dateSeparator + _out_File; // The file name - // watching for the cloud sync output file buffer. - _DeviceController.doAddWatch(_date_out_File); + _date_out_File = _location + // The location + _dateFormatted + _dateSeparator + _out_File; // The file name + // watching for the cloud sync output file buffer. + if ( ! QFileInfo(_date_out_File).exists() ) { + // if the file does not exists, send a check-in to the CS and wait for the response. + // by CS sending the response it will create the out file and next time this function with start watching the file. + // since this class has a one second timer set, next call is next second + // TODO: during this less that 1s UI will not see messages from CS, since the file was not there to watch. + sendCheckIn(); + // send device state to make the CloudSync send back a message to create the out buff with its user to own the file + return ok; + } + _DeviceController.doAddWatch(_date_out_File, false); + // since the buff files will be deleted on each power cycle, when the out buf is created it means the CloudSync is running. + // we emit the ApplicationController to check the post.log for the CloudSync status check. + _postPass = true; + testReady(); + return ok; lErr: @@ -603,7 +623,6 @@ { bool ok = true; QString inpBuff = "%1,%2,%3,%4"; - inpBuff = inpBuff .arg( _secSinceEpoch ) .arg( Types::safeIncrement(_seq)) @@ -748,7 +767,7 @@ // 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; - + case eMessageID_CheckIn : ok = takeCheckIn ( ); break; case eMessageID_DeviceInfo : ok = sendDeviceInfo ( ); break; case eMessageID_CredentialsSave : ok = sendCredentialsSave( vMessage ); break; case eMessageID_UIFactoryReset : ok = sendFactoryReset ( ); break; @@ -884,6 +903,42 @@ } /*! + * \brief CloudSyncController::sendCheckIn + * \details Send a check-in message and expects the same check-in message from CS + * \return + */ +bool CloudSyncController::sendCheckIn() +{ + _checkinRcvd = false; + qint32 messageID = UI2CS(eMessageID_CheckIn); + return sendUIBuff( { QString("%1").arg( messageID ) ,"0" } ); +} + +/*! + * \brief CloudSyncController::testCheckIn + * \details + * \return + */ +void CloudSyncController::testCheckIn() +{ + if ( ! _checkinRcvd ) { + LOG_APPED_UI(QString("CloudSync check-in failed")); + } +} + +/*! + * \brief CloudSyncController::takeCheckIn + * \details if the check-in received this method will be called + * \return true - + */ +bool CloudSyncController::takeCheckIn() +{ + _checkinRcvd = true; + emit didCheckInReceive(); + return true; +} + +/*! * \brief CloudSyncController::sendTxCodeDisplay * \details reads the received Tx Code from CloudSync app and notifies with a signal. * \param vMessage : message containing the Tx Code. Index: sources/cloudsync/CloudSyncController.h =================================================================== diff -u -r15dffa44e42fe108caa6dd0dfbe659b192ee5323 -r1bf8c894c5cc5ea6d62af0662fcf5a18e1a06459 --- sources/cloudsync/CloudSyncController.h (.../CloudSyncController.h) (revision 15dffa44e42fe108caa6dd0dfbe659b192ee5323) +++ sources/cloudsync/CloudSyncController.h (.../CloudSyncController.h) (revision 1bf8c894c5cc5ea6d62af0662fcf5a18e1a06459) @@ -74,6 +74,10 @@ QString _deviceInfoDG = ""; QString _deviceInfoUI = ""; + const quint8 _checkinIntervalSend = 60; // count down for check-in error if not responded back - regarding the _interval it will be 60s + const quint8 _checkinIntervalTest = 5; // count down for check-in error if not responded back - regarding the _interval it will be 5s + bool _checkinRcvd = false; // id check-in received will set to true. + bool _postPass = false; enum Errors_Enum { @@ -161,7 +165,7 @@ eMessageID_DeviceRegister = 1, // [ UI(1001) -> CS( ) ] Device Registration Request eMessageID_DeviceInfo = 2, // [ CS(2002) <-> UI(1002) ] Device information Request eMessageID_CredentialsSave = 3, // [ CS(2003) <-> UI(1003) ] Save Credentials Request/Response - //// Not Used 4, + eMessageID_CheckIn = 4, // [ CS(2004) <-> UI(1004) ] CheckIn/HeartBeat Request/Response eMessageID_UIFactoryReset = 5, // [ CS(2005) <-> UI(1005) ] Factory Reset Request // Deployment eMessageID_DeviceState = 6, // [ CS(2006) <-> UI(1006) ] Device State Request @@ -222,6 +226,7 @@ void didRegisterStart (bool vOK ); void didRegisterDone (bool vOK ); void didCloudSyncStatus (bool vReady ); + void didCheckInReceive (); private: void initConnections(); @@ -289,6 +294,11 @@ bool sendCredentialsSave (const Message &vMessage ); // eMessageID_SaveCredentials bool sendCredentialsResponse(); + // check-in + bool sendCheckIn (); + void testCheckIn (); + bool takeCheckIn (); + // pending log void sendPendingLog ( const QString &vFileName ); // eMessageID_TxReport bool sendTxCodeDisplay ( const Message &vMessage ); // eMessageID_TxCodeDisplay Index: sources/device/DeviceController.cpp =================================================================== diff -u -ra7c580f0998ee781c47314384f677249cea4c4b4 -r1bf8c894c5cc5ea6d62af0662fcf5a18e1a06459 --- sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision a7c580f0998ee781c47314384f677249cea4c4b4) +++ sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision 1bf8c894c5cc5ea6d62af0662fcf5a18e1a06459) @@ -863,17 +863,18 @@ * \details The thread safe add file watch method * \param vFile - The file to add to watch. */ -void DeviceController::ondoAddWatch(const QString &vFile) +void DeviceController::ondoAddWatch(const QString &vFile, bool vCreate) { - if ( ! QFileInfo::exists(vFile)) { - if ( ! FileHandler::write(vFile, "", false) ) { // if the file doesn't exist it has to be created to be watched. - LOG_DEBUG(DeviceError::deviceErrorText(DeviceError::eDevice_Watch_Error_NotFound, 0)); - return; - } + DeviceError::Scripts_Error_Enum err = DeviceError::eDevice_OK; + if ( vCreate ) { + if ( ! FileHandler::write( vFile, "", false) ) { err = DeviceError::eDevice_Watch_Error_NotCreate; goto lErr; } + } else { + if ( ! QFileInfo::exists ( vFile ) ) { err = DeviceError::eDevice_Watch_Error_NotFound ; goto lErr; } } - if ( ! _fileSystemWatcher.addPath(vFile) ) { - LOG_DEBUG(DeviceError::deviceErrorText(DeviceError::eDevice_Watch_Error_NotAdded, 0)); - } + if ( ! _fileSystemWatcher.addPath( vFile ) ) { err = DeviceError::eDevice_Watch_Error_NotAdded ; goto lErr; } + return; +lErr: + LOG_DEBUG(DeviceError::deviceErrorText(err, 0)); } /*! @@ -889,7 +890,7 @@ /*! * \brief DeviceController::onEventThreadChange * \details The signal handler for the DeviceController(this)::didEventThreadChange - * to start checking for the Encrypted partition readyness. + * to start checking for the Encrypted partition readiness. */ void DeviceController::onEventThreadChange() { Index: sources/device/DeviceController.h =================================================================== diff -u -ra7c580f0998ee781c47314384f677249cea4c4b4 -r1bf8c894c5cc5ea6d62af0662fcf5a18e1a06459 --- sources/device/DeviceController.h (.../DeviceController.h) (revision a7c580f0998ee781c47314384f677249cea4c4b4) +++ sources/device/DeviceController.h (.../DeviceController.h) (revision 1bf8c894c5cc5ea6d62af0662fcf5a18e1a06459) @@ -303,6 +303,6 @@ void usbSpaceCheck(); void settingsPartitionSpaceCheck(); - SAFE_CALL_EX(doAddWatch, const QString &) + SAFE_CALL_EX2(doAddWatch, const QString &, bool) }; } Index: sources/device/DeviceError.cpp =================================================================== diff -u -r80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803 -r1bf8c894c5cc5ea6d62af0662fcf5a18e1a06459 --- sources/device/DeviceError.cpp (.../DeviceError.cpp) (revision 80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803) +++ sources/device/DeviceError.cpp (.../DeviceError.cpp) (revision 1bf8c894c5cc5ea6d62af0662fcf5a18e1a06459) @@ -35,6 +35,7 @@ QT_TR_NOOP("The requested value is incorrect." ), // eDevice_Scripts_Error_Incorrect_Req QT_TR_NOOP("The response value is incorrect." ), // eDevice_Scripts_Error_Incorrect_Rsp + QT_TR_NOOP("The watch file cannot be created." ), // eDevice_Watch_Error_NotCreate QT_TR_NOOP("The watch file is not found." ), // eDevice_Watch_Error_NotFound QT_TR_NOOP("The watch file cannot be added." ), // eDevice_Watch_Error_NotAdded Index: sources/device/DeviceError.h =================================================================== diff -u -r80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803 -r1bf8c894c5cc5ea6d62af0662fcf5a18e1a06459 --- sources/device/DeviceError.h (.../DeviceError.h) (revision 80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803) +++ sources/device/DeviceError.h (.../DeviceError.h) (revision 1bf8c894c5cc5ea6d62af0662fcf5a18e1a06459) @@ -53,6 +53,7 @@ eDevice_Scripts_Error_Incorrect_Req , eDevice_Scripts_Error_Incorrect_Rsp , + eDevice_Watch_Error_NotCreate , eDevice_Watch_Error_NotFound , eDevice_Watch_Error_NotAdded , Index: sources/main.h =================================================================== diff -u -rf9e747f0f28df1cc6a33179f0bc78bfc03d486fc -r1bf8c894c5cc5ea6d62af0662fcf5a18e1a06459 --- sources/main.h (.../main.h) (revision f9e747f0f28df1cc6a33179f0bc78bfc03d486fc) +++ sources/main.h (.../main.h) (revision 1bf8c894c5cc5ea6d62af0662fcf5a18e1a06459) @@ -568,9 +568,28 @@ } \ emit did##vMETHOD( vData); \ } \ -Q_SIGNALS : void did##vMETHOD(vTYPE); \ -private Q_SLOTS : void on##vMETHOD(vTYPE); + Q_SIGNALS : void did##vMETHOD(vTYPE); \ + private Q_SLOTS : void on##vMETHOD(vTYPE); //--------------------------------------------------------------------------------// +#define SAFE_CALL_EX2( vMETHOD,vTYPE1 ,vTYPE2 ) \ +public Q_SLOTS : void vMETHOD(vTYPE1 vDATA1 ,vTYPE2 vDATA2 ) { \ + static bool init = false; \ + if ( ! init ) { \ + connect(this, SIGNAL( did##vMETHOD(vTYPE1 ,vTYPE2 )), \ + this, SLOT( on##vMETHOD(vTYPE1 ,vTYPE2 )));\ + init = true; \ + } \ + emit did##vMETHOD( vDATA1 , vDATA2 ); \ + } \ + Q_SIGNALS : void did##vMETHOD(vTYPE1 ,vTYPE2 ); \ + private Q_SLOTS : void on##vMETHOD(vTYPE1 ,vTYPE2 ); +//--------------------------------------------------------------------------------// +#define TIME_CALL( vMETHOD,vCOUNT ) \ +{ \ + static quint8 counter = 0; \ + if ( ! counter-- ) { counter = vCOUNT; vMETHOD; } \ +} \ +//--------------------------------------------------------------------------------// #define REGISTER_METATYPE(vTYPE) \ qRegisterMetaType < vTYPE > (#vTYPE); //--------------------------------------------------------------------------------// Index: sources/model/hd/adjustment/settings/MAdjustHDRequests.h =================================================================== diff -u -ra7c580f0998ee781c47314384f677249cea4c4b4 -r1bf8c894c5cc5ea6d62af0662fcf5a18e1a06459 --- sources/model/hd/adjustment/settings/MAdjustHDRequests.h (.../MAdjustHDRequests.h) (revision a7c580f0998ee781c47314384f677249cea4c4b4) +++ sources/model/hd/adjustment/settings/MAdjustHDRequests.h (.../MAdjustHDRequests.h) (revision 1bf8c894c5cc5ea6d62af0662fcf5a18e1a06459) @@ -122,9 +122,9 @@ class MAdjustVersionsReq : public MModel { public: - quint8 ver_major = QString("%1").arg(UI_VERSION_MAJAR ).toUInt(); - quint8 ver_minor = QString("%1").arg(UI_VERSION_MINOR ).toUInt(); - quint8 ver_micro = QString("%1").arg(UI_VERSION_MICRO ).toUInt(); + quint8 ver_major = QString("%1").arg(VER_MAJOR ).toUInt(); + quint8 ver_minor = QString("%1").arg(VER_MINOR ).toUInt(); + quint8 ver_micro = QString("%1").arg(VER_MICRO ).toUInt(); quint16 ver_revis = QString("%1").arg(VER_REVIS ).toUInt(); quint32 ver_comp = QString("%1").arg(SW_COMPATIBILITY_REV).toUInt();