Index: AlarmMapping.csv =================================================================== diff -u -rfd79fadd4f42518f80e2cf3c19eec5a516ed75d4 -rcd7956150072dcb5264c891ee363074623052ead --- AlarmMapping.csv (.../AlarmMapping.csv) (revision fd79fadd4f42518f80e2cf3c19eec5a516ed75d4) +++ AlarmMapping.csv (.../AlarmMapping.csv) (revision cd7956150072dcb5264c891ee363074623052ead) @@ -171,8 +171,8 @@ 170,"HD syringe empty alarm." 171,"HD syringe pump occlusion alarm." 172,"HD syringe pump not enough Heparin alarm." - 173,"HD RTC configuration error." - 174,"Alarm ID is available for use." + 173,"HD arterial air bubble detected alarm." + 174,"HD arterial air bubble detected rinseback alarm." 175,"HD pump direction status error." 176,"HD active reservoir is full during treatment and DG not ready to switch reservoirs." 177,"DG software fault.\nSoftware found itself in an unexpected state." Index: denali.pro.user =================================================================== diff -u -r7e503c5459ec77a2816d6c7789da9b206cedbe8a -rcd7956150072dcb5264c891ee363074623052ead --- denali.pro.user (.../denali.pro.user) (revision 7e503c5459ec77a2816d6c7789da9b206cedbe8a) +++ denali.pro.user (.../denali.pro.user) (revision cd7956150072dcb5264c891ee363074623052ead) @@ -1,6 +1,6 @@ - + EnvironmentId @@ -1241,7 +1241,7 @@ Qt 5.12.5 (iMX8) Qt 5.12.5 (iMX8) {5d6458ef-f917-4aef-a092-c77bbe106149} - 1 + 0 0 0 @@ -1544,7 +1544,7 @@ 1 false - --logOut --disable-timeout --disable-alarm-no-minimize --disable-unhandled-report + --disable-timeout -disable-alarm-no-minimize --disable-unhandled-report 3768 false true Index: sources/cloudsync/CloudSyncController.cpp =================================================================== diff -u -r7e503c5459ec77a2816d6c7789da9b206cedbe8a -rcd7956150072dcb5264c891ee363074623052ead --- sources/cloudsync/CloudSyncController.cpp (.../CloudSyncController.cpp) (revision 7e503c5459ec77a2816d6c7789da9b206cedbe8a) +++ sources/cloudsync/CloudSyncController.cpp (.../CloudSyncController.cpp) (revision cd7956150072dcb5264c891ee363074623052ead) @@ -175,6 +175,10 @@ */ void CloudSyncController::onWatchFileChange(const QString &vFile) { + // TODO: It may improve the performance of the code to make it more specific. + // Meaning, Device controller has only one file watcher and it will call all the slots of all the classes watching for a file change. + // then ignore what is not important, but it may effect, the call queue and the threading performance. + // Later investigation. if ( vFile != _date_out_File ) return; // ignore unwanted file updates. QString content; Storage::FileHandler::read(vFile, content); @@ -622,7 +626,7 @@ bool CloudSyncController::sendMessage(const Message &vMessage) { bool ok = false; - // this function is used int sendUIResponse, therefore the message IDs which are responses should be implemented here. + // 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; @@ -717,12 +721,25 @@ if ( ok ) { for ( auto sourceFile : vMessage.params ) { QString fileName = QFileInfo(sourceFile).fileName(); + // NOTE: If a file with the name newName already exists, copy() returns false (i.e., QFile will not overwrite it). + // For the current scenario it is ideal, since that folder will turn RO after the successful registration and copying the files and reboot. if ( ! QFile::copy (sourceFile, destination + fileName) ) { toLog(eError_CredentialCopy , {fileName }); ok = false; goto lOut; } + else { + // TODO: Registration should be atomic so it is all or nothing. + // remove all the copied files. + // it should be all or nothing + ok = false; goto lOut; + } + } + // if all the copies are successful then remove them. + for ( auto sourceFile : vMessage.params ) { + QString fileName = QFileInfo(sourceFile).fileName(); if ( ! QFile::remove(sourceFile ) ) { toLog(eError_CredentialRemove , {fileName }); ok = false; goto lOut; } } } lOut: + if ( ok ) sendCredentialsResponse(); return ok; } @@ -747,6 +764,19 @@ } /*! + * \brief CloudSyncController::sendCredentialsResponse + * \return send the confirmation of the credential save on the device from UI to CS to let CS know when to delete them. + */ +bool CloudSyncController::sendCredentialsResponse() +{ + enum { eSucceed, eFailed }; + bool ok = false; + qint32 messageID = UI2CS(eMessageID_CredentialsSave); + ok = sendUIBuff(QString("%1,1,%2").arg( messageID ).arg( ok ? eSucceed : eFailed )); + return ok; +} + +/*! * \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 -r7e503c5459ec77a2816d6c7789da9b206cedbe8a -rcd7956150072dcb5264c891ee363074623052ead --- sources/cloudsync/CloudSyncController.h (.../CloudSyncController.h) (revision 7e503c5459ec77a2816d6c7789da9b206cedbe8a) +++ sources/cloudsync/CloudSyncController.h (.../CloudSyncController.h) (revision cd7956150072dcb5264c891ee363074623052ead) @@ -250,6 +250,7 @@ bool sendCredentialsSave (const Message &vMessage); // eMessageID_SaveCredentials bool sendCredentialsSend (); // eMessageID_SendCredentials + bool sendCredentialsResponse(); bool sendTxCodeDisplay (const Message &vMessage); // eMessageID_TxCodeDisplay Index: sources/model/hd/alarm/MAlarmMapping.cpp =================================================================== diff -u -rfd79fadd4f42518f80e2cf3c19eec5a516ed75d4 -rcd7956150072dcb5264c891ee363074623052ead --- sources/model/hd/alarm/MAlarmMapping.cpp (.../MAlarmMapping.cpp) (revision fd79fadd4f42518f80e2cf3c19eec5a516ed75d4) +++ sources/model/hd/alarm/MAlarmMapping.cpp (.../MAlarmMapping.cpp) (revision cd7956150072dcb5264c891ee363074623052ead) @@ -7,7 +7,7 @@ * * \file MAlarmMapping.cpp * \author (last) Behrouz NematiPour - * \date (last) 24-May-2022 + * \date (last) 31-May-2022 * \author (original) Behrouz NematiPour * \date (original) 03-May-2021 * @@ -206,8 +206,8 @@ /*0170*/case GuiAlarmID::ALARM_ID_HD_SYRINGE_PUMP_SYRINGE_EMPTY : { result = QObject::tr("HD syringe empty alarm." ); break; } /* 170*/ /*0171*/case GuiAlarmID::ALARM_ID_HD_SYRINGE_PUMP_OCCLUSION : { result = QObject::tr("HD syringe pump occlusion alarm." ); break; } /* 171*/ /*0172*/case GuiAlarmID::ALARM_ID_HD_SYRINGE_PUMP_NOT_ENOUGH_HEPARIN_ALARM : { result = QObject::tr("HD syringe pump not enough Heparin alarm." ); break; } /* 172*/ -/*0173*/case GuiAlarmID::ALARM_ID_HD_RTC_CONFIG_ERROR : { result = QObject::tr("HD RTC configuration error." ); break; } /* 173*/ -/*0174*/case GuiAlarmID::ALARM_ID____AVAILABLE_2 : { result = QObject::tr("Alarm ID is available for use." ); break; } /* 174*/ +/*0173*/case GuiAlarmID::ALARM_ID_HD_ARTERIAL_BUBBLE_DETECTED : { result = QObject::tr("HD arterial air bubble detected alarm." ); break; } /* 173*/ +/*0174*/case GuiAlarmID::ALARM_ID_HD_ARTERIAL_BUBBLE_DETECTED_RINSEBACK : { result = QObject::tr("HD arterial air bubble detected rinseback alarm." ); break; } /* 174*/ /*0175*/case GuiAlarmID::ALARM_ID_HD_PUMP_DIRECTION_STATUS_ERROR : { result = QObject::tr("HD pump direction status error." ); break; } /* 175*/ /*0176*/case GuiAlarmID::ALARM_ID_HD_RESERVOIR_FULL_AND_DG_NOT_READY_TO_SWITCH : { result = QObject::tr("HD active reservoir is full during treatment and DG not ready to switch reservoirs." ); break; } /* 176*/ /*0177*/case GuiAlarmID::ALARM_ID_DG_SOFTWARE_FAULT : { result = QObject::tr("DG software fault.\nSoftware found itself in an unexpected state." ); break; } /* 177*/