Index: denali.pro.user =================================================================== diff -u -r3f60b9a1c0b3a43ec1c5c72955dce0d80354e35c -r1c23a7f4c576dd70c2bfb94a85af470b7d641f1e --- denali.pro.user (.../denali.pro.user) (revision 3f60b9a1c0b3a43ec1c5c72955dce0d80354e35c) +++ denali.pro.user (.../denali.pro.user) (revision 1c23a7f4c576dd70c2bfb94a85af470b7d641f1e) @@ -1,6 +1,6 @@ - + EnvironmentId Index: scripts/wifi_save_dhcp_interface.sh =================================================================== diff -u -r27cc308ff5113a9386899d3c8f8b29962a8498e1 -r1c23a7f4c576dd70c2bfb94a85af470b7d641f1e --- scripts/wifi_save_dhcp_interface.sh (.../wifi_save_dhcp_interface.sh) (revision 27cc308ff5113a9386899d3c8f8b29962a8498e1) +++ scripts/wifi_save_dhcp_interface.sh (.../wifi_save_dhcp_interface.sh) (revision 1c23a7f4c576dd70c2bfb94a85af470b7d641f1e) @@ -1,4 +1,4 @@ - +#!/bin/sh ########################################################################### # # Copyright (c) 2021-2022 Diality Inc. - All Rights Reserved. @@ -14,6 +14,7 @@ # @date (original) 11-May-2021 # ############################################################################ + if [ $# -eq 0 ]; then currentFile=$(basename "$0") echo "Usage: ./$currentFile " @@ -24,4 +25,4 @@ echo "auto $iface iface $iface inet dhcp wpa-driver wext - wpa-conf /etc/wpa_supplicant.conf" > /etc/network/interfaces \ No newline at end of file + wpa-conf /etc/wpa_supplicant.conf" > /etc/network/interfaces Index: sources/cloudsync/CloudSyncController.cpp =================================================================== diff -u -r3f60b9a1c0b3a43ec1c5c72955dce0d80354e35c -r1c23a7f4c576dd70c2bfb94a85af470b7d641f1e --- sources/cloudsync/CloudSyncController.cpp (.../CloudSyncController.cpp) (revision 3f60b9a1c0b3a43ec1c5c72955dce0d80354e35c) +++ sources/cloudsync/CloudSyncController.cpp (.../CloudSyncController.cpp) (revision 1c23a7f4c576dd70c2bfb94a85af470b7d641f1e) @@ -92,6 +92,8 @@ this , SLOT( onActionReceive (GuiActionType , const QVariantList &))); connect(&_TreatmentLog , SIGNAL(didTreatmentLogSave(const QString &, const QString &, const QString &)), this , SLOT( onTreatmentLogSave(const QString &, const QString &, const QString &))); + connect(this , SIGNAL(didInitComplete ()), + this , SLOT( onInitComplete ()),Qt::QueuedConnection); // it has to be queued connection, don't remove it. } /*! @@ -144,6 +146,28 @@ } /*! + * \brief CloudSyncController::event + * \details The override method of QObject event to handle the ThreadChange. + * \param vEvent - the QObject event + * \return true if the event e was recognized and processed + */ +bool CloudSyncController::event(QEvent *vEvent) { + if (vEvent->type() == QEvent::ThreadChange) { + emit didInitComplete(); + } + // Make sure the rest of events are handled + return QObject::event(vEvent); +} + +/*! + * \brief CloudSyncController::onInitComplete + * \details The slot to be called when the CloudSync initialization is complete, to call the testDeviceRegister. + */ +void CloudSyncController::onInitComplete() { + testDeviceRegister(); +} + +/*! * \brief CloudSyncController::onWatchFileChange * \details This slot will be called when the Device Controller identifies any changes in the watched files. * \param vFile - watched file @@ -294,6 +318,7 @@ case eError_CredentialMake : text = tr( "CS The credentials folder make failed." ) ; break; case eError_CredentialCopy : text = tr( "CS The credentials file copy failed." ) ; break; case eError_CredentialRemove: text = tr( "CS The credentials file remove failed." ) ; break; + case eError_CredentialEmpty : text = tr( "CS The credentials folder is empty." ) ; break; } return text; } @@ -311,7 +336,7 @@ // It means it is designed to not throw out of bound error and just use "~" as a missing info argument. auto item = [=](uint i) { return vInfoItems.value(i,"~").toString(); }; - QString info = QString( "[%1]" ).arg( vErrorID ) ; + QString info = QString( "[%1]" ).arg( vErrorID ) ; switch (vErrorID) { case eError_Unknown : ; break; case eError_OutFileEmpty : ; break; @@ -331,6 +356,7 @@ case eError_CredentialMake : info = QString( "[%1:%2]" ).arg( vErrorID ).arg( item(0) ) ; break; case eError_CredentialCopy : info = QString( "[%1:%2]" ).arg( vErrorID ).arg( item(0) ) ; break; case eError_CredentialRemove: info = QString( "[%1:%2]" ).arg( vErrorID ).arg( item(0) ) ; break; + case eError_CredentialEmpty : info = QString( "[%1:%2]" ).arg( vErrorID ).arg( item(0) ) ; break; } return info; } @@ -604,6 +630,7 @@ { // reset factory has not been implemented yet. bool ok = true; + // TODO: call the UI Software Reset Factory here when it has implemented. LOG_DEBUG("CloudSync Reset factory request has not been implemented yet."); return ok; } @@ -615,11 +642,12 @@ */ bool CloudSyncController::sendResetFactory() { + enum { eSucceed, eFailed }; bool ok = false; ok = doResetFactory(); // if ( ! ok ) { } /* Not defined */ qint32 messageID = UI2CS(eMessageID_ResetFactory); - ok = sendUIBuff(QString("%1,0,0").arg( messageID )); + ok = sendUIBuff(QString("%1,1,%2").arg( messageID ).arg( ok ? eSucceed : eFailed )); return ok; } @@ -693,8 +721,15 @@ */ bool CloudSyncController::testDeviceRegister() { - // the device registration request condition needs to be discussed. - return false; + QString source = QString(Storage::CloudSync_Base_Path_Name) + Storage::CloudSync_Credentials_Folder_Name; + QFileInfoList fileInfos = QDir(source).entryInfoList(QDir::NoDotAndDotDot|QDir::Files); + if( ! fileInfos.isEmpty() ) { + sendDeviceRegister(); + } else { + toLog(eError_CredentialEmpty,{}); // It is intentional that the vault folder path has not been sent to the log. + } + + return true; // for now always true. } /*! Index: sources/cloudsync/CloudSyncController.h =================================================================== diff -u -r3f60b9a1c0b3a43ec1c5c72955dce0d80354e35c -r1c23a7f4c576dd70c2bfb94a85af470b7d641f1e --- sources/cloudsync/CloudSyncController.h (.../CloudSyncController.h) (revision 3f60b9a1c0b3a43ec1c5c72955dce0d80354e35c) +++ sources/cloudsync/CloudSyncController.h (.../CloudSyncController.h) (revision 1c23a7f4c576dd70c2bfb94a85af470b7d641f1e) @@ -93,11 +93,13 @@ eError_LogFolder , eError_LogFileInp , - eError_CredentialMake , - eError_CredentialFile , - eError_CredentialCopy , - eError_CredentialRemove , + eError_CredentialMake , // the UI vault folder for cloudsync credentials can't be created. + eError_CredentialFile , // the credential files sent to UI can't be find or read or doesn't exist.. + eError_CredentialCopy , // the credential files sent to UI can't be copied to UI vault. + eError_CredentialRemove , // the credential files sent to UI can't be removed. + eError_CredentialEmpty , // the UI folder doesn't have credential files. + eError_OutFileEmpty , // Out file has changed from CS2UI but the content is empty. }; @@ -166,20 +168,24 @@ protected: void timerEvent(QTimerEvent *event) override; - + bool event(QEvent* vEvent) override; public slots: bool init(); bool init(QThread &vThread); private slots: void quit(); - void onWatchFileChange (const QString &vFile); - void onActionReceive (GuiActionType vAction, const QVariantList &vData); - void onTreatmentLogSave (const QString &vPatientID , - const QString &vDeviceID , - const QString &vFileName ); + void onWatchFileChange (const QString &vFile); + void onActionReceive (GuiActionType vAction, const QVariantList &vData); + void onTreatmentLogSave(const QString &vPatientID , + const QString &vDeviceID , + const QString &vFileName ); + void onInitComplete (); +signals: + void didInitComplete (); + private: void initConnections(); Index: sources/model/hd/alarm/MAlarmMapping.cpp =================================================================== diff -u -r3f60b9a1c0b3a43ec1c5c72955dce0d80354e35c -r1c23a7f4c576dd70c2bfb94a85af470b7d641f1e --- sources/model/hd/alarm/MAlarmMapping.cpp (.../MAlarmMapping.cpp) (revision 3f60b9a1c0b3a43ec1c5c72955dce0d80354e35c) +++ sources/model/hd/alarm/MAlarmMapping.cpp (.../MAlarmMapping.cpp) (revision 1c23a7f4c576dd70c2bfb94a85af470b7d641f1e) @@ -7,7 +7,7 @@ * * \file MAlarmMapping.cpp * \author (last) Behrouz NematiPour - * \date (last) 24-Feb-2022 + * \date (last) 25-Feb-2022 * \author (original) Behrouz NematiPour * \date (original) 03-May-2021 *