Index: AlarmMapping.csv =================================================================== diff -u -r7ebc073150532073ae7f1a0e768272bcff5d6fb3 -r465a935949a85d3d1bebd11979737ff38ef96122 --- AlarmMapping.csv (.../AlarmMapping.csv) (revision 7ebc073150532073ae7f1a0e768272bcff5d6fb3) +++ AlarmMapping.csv (.../AlarmMapping.csv) (revision 465a935949a85d3d1bebd11979737ff38ef96122) @@ -8,25 +8,25 @@ 7,"HD RTC battery low." 8,"HD accelerometer failed POST." 9,"DG accelerometer failed POST." - 10,"Alarm ID available for use." - 11,"Alarm ID available for use." + 10,"Not used." + 11,"HD dialysate temperature below target temperature." 12,"HD firmware image integrity POST test failed." 13,"DG firmware image integrity POST test failed." - 14,"HD blood flow invalid calibration." - 15,"HD dialysate flow invalid calibration." + 14,"Not used." + 15,"Not used." 16,"HD alarm audio failed POST." 17,"HD UI POST failed." 18,"DG load cells invalid calibration record." - 19,"DG flow sensors invalid calibration record." + 19,"HD dialysate temperature above target temperature." 20,"DG conductivity sensors invalid calibration record." 21,"DG drain line volume invalid calibration record." 22,"DG reservoirs invalid calibration record." 23,"DG acid concentrate calibration record." 24,"DG bicarb concentrate calibration record." 25,"DG accelerometer invalid calibration record." 26,"HD accelerometer invalid calibration record." - 27,"HD blood flow invalid calibration record." - 28,"HD dialyzer flow invalid calibration record." + 27,"Not used." + 28,"Not used." 29,"HD heparin force sensor invalid calibration record." 30,"HD Software fault.\nSoftware found itself in an unexpected state." 31,"Blood pump failed motor controller current check.\nToo high when pump should be off or out of range when pump should be running." @@ -70,8 +70,8 @@ 69,"HD blood leak sensor invalid calibration record." 70,"HD arterial pressure self-test failure alarm." 71,"HD venous pressure self-test failure alarm." - 72,"HD blood flow meter status check self-test failure alarm." - 73,"HD dialysate flow meter status check self-test failure alarm." + 72,"Not used." + 73,"Not used." 74,"HD blood leak detector self-test transmit timeout." 75,"HD syringe pump self-test failure alarm." 76,"HD monitored voltage is out of range." @@ -153,8 +153,8 @@ 152,"Inlet water pressure in low range." 153,"HD prime completed high priority alarm." 154,"EEPROM operations (read, write, erase) failure." - 155,"Alarm ID available for use." - 156,"Alarm ID available for use." + 155,"Not used." + 156,"Not used." 157,"DG chemical disinfect prime acid line timeout." 158,"Inlet water temperature is in the low range." 159,"Dialysate inlet pump failed flow vs motor speed check." @@ -174,7 +174,7 @@ 173,"HD RTC configuration error." 174,"HD RTC or timer accuracy failure." 175,"HD pump direction status error." - 176,"HD active reservoir is full during treatment and DG not ready to switch reservoirs." + 176,"HD dialysate temperature out of high safety range." 177,"DG software fault.\nSoftware found itself in an unexpected state." 178,"HD communication timeout." 179,"DG FPGA communication down for too long." @@ -191,7 +191,7 @@ 190,"DG drain pump off fault." 191,"DG flow rate out of upper range." 192,"DG flow rate out of lower range." - 193,"Alarm available for use." + 193,"HD dialysate temperature out of low safety range." 194,"DG RO pump duty cycle out of range." 195,"DG RO pump pressure out of range." 196,"DG temperature sensor error bit fault." Index: main.cpp =================================================================== diff -u -r627b97843f87f5ca8fbd731c6c4a6d9fae4352ce -r465a935949a85d3d1bebd11979737ff38ef96122 --- main.cpp (.../main.cpp) (revision 627b97843f87f5ca8fbd731c6c4a6d9fae4352ce) +++ main.cpp (.../main.cpp) (revision 465a935949a85d3d1bebd11979737ff38ef96122) @@ -89,6 +89,7 @@ bool gDisableAlarmNoMinimize = false ; bool gDisableCheckInLog = false ; bool gDisableAcknowLog = false ; +bool gDisableSDCFailLogStop = false ; bool gConsoleoutLogs = false ; bool gConsoleoutFrameInterface = false ; @@ -215,6 +216,11 @@ QCoreApplication::translate("main", "Disables Acknowledgment Log")); parser.addOption(optionDisableAcknowLog); + // --- -S : disable-sd-card-fail-log-stop + QCommandLineOption optionDisableSDCardFailLogStop(QStringList() << "S" << "disable-sd-card-fail-log-stop", + QCoreApplication::translate("main", "disable-sd-card-fail-log-stop")); + parser.addOption(optionDisableSDCardFailLogStop); + // --- parse command lines parser.process(*qApp); @@ -227,6 +233,7 @@ gDisableAlarmNoMinimize = parser.isSet(optionDisableAlarmMoMinimize ); gDisableCheckInLog = parser.isSet(optionDisableCheckInLog ); gDisableAcknowLog = parser.isSet(optionDisableAcknowLog ); + gDisableSDCFailLogStop = parser.isSet(optionDisableSDCardFailLogStop ); if (parser.isSet(optionSendEmptyKeepAwake)) gSendEmptyKeepAwake = true; bool ok = false; @@ -388,7 +395,7 @@ _ApplicationController.initSettings(); ////! - Initializing GUI Controller - _GuiController.init(Threads::_Application_Thread); + _GuiController.init(Threads::_Gui_Thread); //! - Initializing Main Timer _MainTimer.init(); Index: scripts/run.sh =================================================================== diff -u -r627b97843f87f5ca8fbd731c6c4a6d9fae4352ce -r465a935949a85d3d1bebd11979737ff38ef96122 --- scripts/run.sh (.../run.sh) (revision 627b97843f87f5ca8fbd731c6c4a6d9fae4352ce) +++ scripts/run.sh (.../run.sh) (revision 465a935949a85d3d1bebd11979737ff38ef96122) @@ -27,6 +27,7 @@ SDCARD_DEV=/dev/mmcblk1p1 SDCARD_MNT=/media/sd-card +SDCARD_TYP=ext4 USB_DEV=/dev/sda1 USB_MNT=/media/usb CLOUDSYNC_FOLDER=cloudsync # both for log and application @@ -42,35 +43,42 @@ POSTMSG_BLUETOOTH="Bluetooth passed" POSTMSG_SHASUM="App shasum passed" + # cleanup the POST log file echo "Start: $(currDate)" > $POSTLOG echo "" > $POSTERR echo "" > $POSTOUT + #create folders for sd-card and usb if not exist mkdir -p $SDCARD_MNT mkdir -p $USB_MNT + +# ---------------------------------------- STOP denali in case running (sys not rebooted) +killall denali + + # ---------------------------------------- UPDATE #mounting usb mount $USB_DEV $USB_MNT -if [ $? -eq 0 ]; then +USBTEST="$(mount | grep "$USB_MNT")" +if ! [ -z "$USBTEST" ]; then echo ":: USB drive found and mounted on $USB_MNT" -fi -#A simple none secure update -if [ -e $USB_MNT/denali ]; then - mv $HOME/denali $HOME/denali.$(currDate) - cp $USB_MNT/denali $HOME/denali - # check if update where successful - if [ $? -eq 0 ]; then - sync;sync;sync; - echo ":: Denali application has been updated with the one on the USB drive" - mv $USB_MNT/denali $USB_MNT/denali.updated - sync;sync;sync; + #A simple none secure update + if [ -e $USB_MNT/denali ]; then + mv $HOME/denali $HOME/denali.$(currDate) + cp $USB_MNT/denali $HOME/denali + # check if update where successful + if [ $? -eq 0 ]; then + sync;sync;sync; + echo ":: Denali application has been updated with the one on the USB drive" + mv $USB_MNT/denali $USB_MNT/denali.updated + sync;sync;sync; + fi fi fi - # ---------------------------------------- SETUP & POST #Here only passed is logged and if nothing added to the post.log means it failed. @@ -88,14 +96,12 @@ #mounting sdcard -------------------------- SD-CARD mount $SDCARD_DEV $SDCARD_MNT -if [ $? -eq 0 ]; then - SDTEST="$(mount | grep "$SDCARD_DEV on $SDCARD_MNT.*(rw,")" - if ! [ -z "$SDTEST" ]; then - SDINFO="$(df -h | grep -i $SDCARD_MNT)" - echo $POSTMSG_SDCARD >> $POSTLOG - echo $SDTEST >> $POSTLOG - echo $SDINFO >> $POSTLOG - fi +SDCTEST="$(mount | grep "$SDCARD_DEV on $SDCARD_MNT type $SDCARD_TYP (rw,")" +if ! [ -z "$SDCTEST" ]; then + SDINFO="$(df -h | grep -i $SDCARD_MNT)" + echo $POSTMSG_SDCARD >> $POSTLOG + echo $SDCTEST >> $POSTLOG + echo $SDINFO >> $POSTLOG fi @@ -155,19 +161,21 @@ # ---------------------------------------- CloudSync -# moving/ backing up the previous treatment logs so the new buff starts with fresh sequence -echo "Backing up CloudSync I/O buff" -CLOUDSYNC_PATH="$SDCARD_MNT"/"$CLOUDSYNC_FOLDER" -CLOUDSYNC_BACKUP="$CLOUDSYNC_PATH"_backup/$(currDate)/ -mkdir -p $CLOUDSYNC_BACKUP -mv $CLOUDSYNC_PATH/* $CLOUDSYNC_BACKUP -rm $HOME/$CLOUDSYNC_FOLDER/data/* -echo "Starting CloudSync" >> $POSTLOG -cd $HOME/$CLOUDSYNC_FOLDER/ -python3 ./cs.py start & -sleep 2 -echo "$(python3 ./cs.py status)" >> $POSTLOG -cd +if [ -d $CLOUDSYNC_FOLDER ]; then + # moving/ backing up the previous treatment logs so the new buff starts with fresh sequence + echo "Backing up CloudSync I/O buff" + CLOUDSYNC_PATH="$SDCARD_MNT"/"$CLOUDSYNC_FOLDER" + CLOUDSYNC_BACKUP="$CLOUDSYNC_PATH"_backup/$(currDate)/ + mkdir -p $CLOUDSYNC_BACKUP + mv $CLOUDSYNC_PATH/* $CLOUDSYNC_BACKUP + rm $HOME/$CLOUDSYNC_FOLDER/data/* + echo "Starting CloudSync" >> $POSTLOG + cd $HOME/$CLOUDSYNC_FOLDER/ + python3 ./cs.py start & + sleep 2 + echo "$(python3 ./cs.py status)" >> $POSTLOG + cd +fi # ---------------------------------------- Denali Index: sources/AlarmGenerator.cpp =================================================================== diff -u -r79a6cfcb10472261f3ec26eaf0baf6f1245cd311 -r465a935949a85d3d1bebd11979737ff38ef96122 --- sources/AlarmGenerator.cpp (.../AlarmGenerator.cpp) (revision 79a6cfcb10472261f3ec26eaf0baf6f1245cd311) +++ sources/AlarmGenerator.cpp (.../AlarmGenerator.cpp) (revision 465a935949a85d3d1bebd11979737ff38ef96122) @@ -64,3 +64,29 @@ return data; } +/*! + * \brief AlarmGenerator::ALARM_ID_UI_POST_FAILURE_SDCARD + * \details generates the ALARM_ID_UI_POST_FAILURE_SDCARD alarm. + * \return The AlarmStatusData filled with appropriate data for the alarm. + */ +const AlarmStatusData AlarmGenerator::ALARM_ID_UI_POST_FAILURE_SDCARD() +{ + AlarmStatusData data; + data.mState = GuiAlarmPriority::ALARM_PRIORITY_HIGH; // Alarm priority + data.mTop = GuiAlarmID::ALARM_ID_UI_POST_FAILURE_SDCARD; // Alarm ID + data.mMuteTimeout = 0; // Alarm timeout + data.mEscalatesIn = 0; // Alarm Escalate Time Period + data.mFlags = setBits(NO_BUTTON); // No button since there is no HD to communicate. + return data; +} + +const AlarmStatusData AlarmGenerator::ALARM_ID_NO_ALARM() +{ + AlarmStatusData data; + data.mState = GuiAlarmPriority::ALARM_PRIORITY_NONE; // Alarm priority + data.mTop = GuiAlarmID::ALARM_ID_NO_ALARM; // Alarm ID + data.mMuteTimeout = 0; // Alarm timeout + data.mEscalatesIn = 0; // Alarm Escalate Time Period + data.mFlags = setBits(NO_BUTTON); // No button since there is no HD to communicate. + return data; +} Index: sources/AlarmGenerator.h =================================================================== diff -u -r27cc308ff5113a9386899d3c8f8b29962a8498e1 -r465a935949a85d3d1bebd11979737ff38ef96122 --- sources/AlarmGenerator.h (.../AlarmGenerator.h) (revision 27cc308ff5113a9386899d3c8f8b29962a8498e1) +++ sources/AlarmGenerator.h (.../AlarmGenerator.h) (revision 465a935949a85d3d1bebd11979737ff38ef96122) @@ -57,4 +57,7 @@ // static const AlarmStatusData (); // is the enum from GuiAlarmID like ALARM_ID_HD_COMM_TIMEOUT static const AlarmStatusData ALARM_ID_HD_COMM_TIMEOUT(); + static const AlarmStatusData ALARM_ID_UI_POST_FAILURE_SDCARD(); + static const AlarmStatusData ALARM_ID_NO_ALARM(); + }; Index: sources/ApplicationController.cpp =================================================================== diff -u -r7ebc073150532073ae7f1a0e768272bcff5d6fb3 -r465a935949a85d3d1bebd11979737ff38ef96122 --- sources/ApplicationController.cpp (.../ApplicationController.cpp) (revision 7ebc073150532073ae7f1a0e768272bcff5d6fb3) +++ sources/ApplicationController.cpp (.../ApplicationController.cpp) (revision 465a935949a85d3d1bebd11979737ff38ef96122) @@ -114,16 +114,20 @@ this , SLOT( onFailedTransmit(Sequence))); // USB drive - connect(&_GuiController , SIGNAL(didUSBDriveUmount()), - this , SLOT( onUSBDriveUmount())); + connect(&_GuiController , SIGNAL(didUSBDriveUmount()), + this , SLOT( onUSBDriveUmount())); connect(&_DeviceController , SIGNAL(didUSBDriveMount ()), this , SLOT( onUSBDriveMount ())); connect(&_DeviceController , SIGNAL(didUSBDriveRemove()), this , SLOT( onUSBDriveRemove())); + connect(&_DeviceController , SIGNAL(didUSBSpaceChange(bool, qint64, qint64, quint8)), + this , SLOT( onUSBSpaceChange(bool, qint64, qint64, quint8))); // SD Card connect(&_DeviceController , SIGNAL(didSDCardStateChange(bool, bool)), this , SLOT( onSDCardStateChange(bool, bool))); + connect(&_DeviceController , SIGNAL(didSDCardSpaceChange(bool, qint64, qint64, quint8)), + this , SLOT( onSDCardSpaceChange(bool, qint64, qint64, quint8))); connect(&_DeviceController , SIGNAL(didSDCardSpaceTooLow(quint8)), this , SLOT( onSDCardSpaceTooLow(quint8))); @@ -134,8 +138,8 @@ connect(&_GuiController , SIGNAL(didExportTreatment ()), this , SLOT( onExportTreatment ())); - connect(&_Logger , SIGNAL(didExportLogs()), - this , SLOT( onExport ())); + connect(&_Logger , SIGNAL(didExportLogs ()), + this , SLOT( onExport ())); // Settings - move to application thread connect(this, SIGNAL(didSettingsInit()), @@ -263,12 +267,15 @@ */ void ApplicationController::onUSBDriveRemove() { - // disabled coco begin validated: This needs user interaction to plug-in USB device - // has been tested manually emit didUSBDriveRemove(); } -// disabled coco end +void ApplicationController::onUSBSpaceChange(bool vReady, qint64 vTotal, qint64 vAvailable, quint8 vPercent) +{ + //DEBUG:0: qDebug() << "ApplicationController::onUSBSpaceChange" << vReady << vTotal << vAvailable << vPercent; + emit didUSBSpaceChange(vReady, vTotal, vAvailable, vPercent); +} + /*! * \brief ApplicationController::onSDCardStateChange * \details This is the slot which connects to the _DeviceController didSDCardStateChange signal @@ -278,13 +285,15 @@ */ void ApplicationController::onSDCardStateChange(bool vIsReady, bool vIsReadOnly) { - // disabled coco begin validated: This needs user interaction to plug-in SD Card - // has been tested manually - /// DEBUG: qDebug() << " ***** ApplicationController " << Storage::SDCard_Base_Path_Name << vIsReady; + //DEBUG:0: qDebug() << " ***** ApplicationController " << Storage::SDCard_Base_Path_Name << vIsReady; emit didSDCardStateChange(vIsReady, vIsReadOnly); } -// disabled coco end +void ApplicationController::onSDCardSpaceChange(bool vReady, qint64 vTotal, qint64 vAvailable, quint8 vPercent) +{ + emit didSDCardSpaceChange(vReady, vTotal, vAvailable, vPercent); +} + /*! * \brief ApplicationController::onSDCardSpaceTooLow * \details The handler slot for the didSDCardSpaceTooLow signal comes form DeviceController Index: sources/ApplicationController.h =================================================================== diff -u -r7ebc073150532073ae7f1a0e768272bcff5d6fb3 -r465a935949a85d3d1bebd11979737ff38ef96122 --- sources/ApplicationController.h (.../ApplicationController.h) (revision 7ebc073150532073ae7f1a0e768272bcff5d6fb3) +++ sources/ApplicationController.h (.../ApplicationController.h) (revision 465a935949a85d3d1bebd11979737ff38ef96122) @@ -89,8 +89,10 @@ void onUSBDriveMount (); void onUSBDriveUmount(); void onUSBDriveRemove(); + void onUSBSpaceChange(bool vReady, qint64 vTotal, qint64 vAvailable, quint8 vPercent); void onSDCardStateChange(bool vIsReady, bool vIsReadOnly); + void onSDCardSpaceChange(bool vReady, qint64 vTotal, qint64 vAvailable, quint8 vPercent); void onSDCardSpaceTooLow(quint8 vAvailablePercent); void onExportLog (); @@ -116,8 +118,10 @@ void didUSBDriveMount (); void didUSBDriveUmount(); void didUSBDriveRemove(); + void didUSBSpaceChange(bool vReady, qint64 vTotal, qint64 vAvailable, quint8 vPercent); void didSDCardStateChange(bool vIsReady, bool vIsReadOnly); + void didSDCardSpaceChange(bool vReady, qint64 vTotal, qint64 vAvailable, quint8 vPercent); void didSDCardSpaceTooLow(quint8 vAvailablePercent); void didExport (); Index: sources/Threads.cpp =================================================================== diff -u -r79a6cfcb10472261f3ec26eaf0baf6f1245cd311 -r465a935949a85d3d1bebd11979737ff38ef96122 --- sources/Threads.cpp (.../Threads.cpp) (revision 79a6cfcb10472261f3ec26eaf0baf6f1245cd311) +++ sources/Threads.cpp (.../Threads.cpp) (revision 465a935949a85d3d1bebd11979737ff38ef96122) @@ -34,6 +34,7 @@ QThread _DeviceController_Thread; QThread _Logger_Thread ; QThread _Application_Thread ; + QThread _Gui_Thread ; QThread _Wifi_Thread ; QThread _Bluetooth_Thread ; QThread _CloudSync_Thread ; @@ -95,6 +96,7 @@ quitThread(_Bluetooth_Thread ); quitThread(_Wifi_Thread ); quitThread(_Application_Thread ); + quitThread(_Gui_Thread ); quitThread(_Logger_Thread ); } // disabled coco end Index: sources/Threads.h =================================================================== diff -u -r27cc308ff5113a9386899d3c8f8b29962a8498e1 -r465a935949a85d3d1bebd11979737ff38ef96122 --- sources/Threads.h (.../Threads.h) (revision 27cc308ff5113a9386899d3c8f8b29962a8498e1) +++ sources/Threads.h (.../Threads.h) (revision 465a935949a85d3d1bebd11979737ff38ef96122) @@ -25,6 +25,7 @@ extern QThread _DeviceController_Thread ; extern QThread _Logger_Thread ; extern QThread _Application_Thread ; + extern QThread _Gui_Thread ; extern QThread _Wifi_Thread ; extern QThread _Bluetooth_Thread ; extern QThread _CloudSync_Thread ; Index: sources/device/DeviceController.cpp =================================================================== diff -u -r3caffb866d4c84ac6282dcd36fc2d8f7cad9584d -r465a935949a85d3d1bebd11979737ff38ef96122 --- sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision 3caffb866d4c84ac6282dcd36fc2d8f7cad9584d) +++ sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision 465a935949a85d3d1bebd11979737ff38ef96122) @@ -85,19 +85,9 @@ */ void DeviceController::quit() { - // disabled coco begin validated: Application termination is not correctly done in coco!!! - // it has been tested and works perfectly fine in normal run. - quitThread(); // validated + quitThread(); } -// disabled coco end -void DeviceController::onRemoveLogs(bool vInProgress) -{ - // disabled coco begin validated: The log in progress requires user interaction - // it has been tested and works fine in normal run. - _pauseSpaceCheck = vInProgress; -} -// disabled coco end /*! * \brief DeviceController::initConnections @@ -108,8 +98,6 @@ { connect(&_ApplicationController , SIGNAL(didUSBDriveUmount()), this , SLOT( onUSBDriveUmount())); - connect(&_Logger , SIGNAL(didRemoveLogs(bool)), - this , SLOT( onRemoveLogs(bool))); connect(this , SIGNAL(didScreenshot(const QImage &, const QString &)), this , SLOT( onScreenshot(const QImage &, const QString &))); @@ -199,13 +187,13 @@ */ bool DeviceController::driveSpaceCheck(const QString &vPath, qint64 &vTotalBytes, qint64 &vAvailableBytes, bool *vIsReadOnly) { - // disabled coco begin validated: Needed User Interaction to make the device not ready so tested manually - bool isReadOnly = true; - bool isMounted = FileHandler::isMounted(vPath, &isReadOnly); + QStorageInfo storage(vPath); + bool isReady = storage.isReady (); + bool isReadOnly = storage.isReadOnly(); + bool isMounted = FileHandler::isMounted(vPath); + if ( vIsReadOnly ) *vIsReadOnly = isReadOnly; - QStorageInfo storage(vPath); - bool isReady = storage.isReady(); if ( isReady ) { vTotalBytes = storage.bytesTotal(); vAvailableBytes = storage.bytesAvailable(); @@ -218,7 +206,6 @@ } return isReady; } -// disabled coco end /*! * \brief DeviceController::timerEvent @@ -264,11 +251,11 @@ void DeviceController::sdcardSpaceCheck() { static bool mInitialized = false; - // Old Info ; // Current info - static bool mOIsReady ; bool mCIsReady ; - static bool mOIsReadOnly; bool mCIsReadOnly ; - static qint64 mOTotal ; qint64 mCTotal ; - static qint64 mOAvailable ; qint64 mCAvailable ; + // Old Info ; // Current info + static bool mOIsReady = false; bool mCIsReady = false; + static bool mOIsReadOnly = false; bool mCIsReadOnly = false; + static qint64 mOTotal = 0; qint64 mCTotal = 0; + static qint64 mOAvailable = 0; qint64 mCAvailable = 0; quint8 mPercent = 0; @@ -277,15 +264,15 @@ mOIsReadOnly = mCIsReadOnly; mOIsReady = mCIsReady; mInitialized = true; + //DEBUG:0: qDebug() << " ~~~~~~~~~~ " << __FUNCTION__ << mInitialized << mCIsReady << mOIsReady << mCIsReadOnly << mOIsReadOnly; emit didSDCardStateChange(mCIsReady, mCIsReadOnly); - } - if (! mCIsReady ) { - mOIsReady = mCIsReady; - mOTotal = 0; - mOAvailable = 0; - emit didSDCardSpaceChange(mCIsReady, mCTotal, mCAvailable, mPercent); - return; + if (! mCIsReady ) { + mOTotal = 0; + mOAvailable = 0; + emit didSDCardSpaceChange(mCIsReady, mCTotal, mCAvailable, mPercent); + return; + } } mPercent = mCTotal ? ((100 * mCAvailable) / mCTotal) : 0; @@ -296,17 +283,13 @@ } /// DEBUG: qDebug() << Storage::SDCard_Base_Path_Name << mCIsReady << mOTotal << mCTotal << (mOTotal == mCTotal) << mOAvailable << mCAvailable << (mOAvailable == mCAvailable) << mPercent << mCIsReadOnly; - if (mOTotal == mCTotal && - mOAvailable == mCAvailable) { - return; + if (mOTotal != mCTotal && mOAvailable != mCAvailable ) { + mOTotal = mCTotal ; + mOAvailable = mCAvailable ; + emit didSDCardSpaceChange(mCIsReady, mCTotal, mCAvailable, mPercent); + /// DEBUG: qDebug() << Storage::SDCard_Base_Path_Name << mCIsReady << mCTotal << mCAvailable << mPercent ; } - mOIsReady = mCIsReady ; - mOTotal = mCTotal ; - mOAvailable = mCAvailable ; - if (_pauseSpaceCheck) return; //TODO: may not be required, but needs a lot of time consuming testing. - emit didSDCardSpaceChange(mCIsReady, mCTotal, mCAvailable, mPercent); - /// DEBUG: qDebug() << Storage::SDCard_Base_Path_Name << mCIsReady << mCTotal << mCAvailable << mPercent ; } /*! @@ -316,11 +299,11 @@ void DeviceController::usbSpaceCheck() { static bool mInitialized = false; - // Old Info ; // Current info - static bool mOIsReady ; bool mCIsReady ; - static bool mOIsReadOnly; bool mCIsReadOnly ; - static qint64 mOTotal ; qint64 mCTotal ; - static qint64 mOAvailable ; qint64 mCAvailable ; + // Old Info ; // Current info + static bool mOIsReady = false; bool mCIsReady = false; + static bool mOIsReadOnly = false; bool mCIsReadOnly = false; + static qint64 mOTotal = 0; qint64 mCTotal = 0; + static qint64 mOAvailable = 0; qint64 mCAvailable = 0; quint8 mPercent = 0; @@ -333,26 +316,27 @@ mOIsReady = mCIsReady; mInitialized = true; emit didUSBStateChange(mCIsReady, mCIsReadOnly); - } - if (! mCIsReady ) { - mOIsReady = mCIsReady; - mOTotal = 0; - mOAvailable = 0; - emit didUSBSpaceChange(mCIsReady, mCTotal, mCAvailable, mPercent); - return; + if (! mCIsReady ) { + mOTotal = 0; + mOAvailable = 0; + emit didUSBSpaceChange(mCIsReady, mCTotal, mCAvailable, mPercent); + return; + } } mPercent = mCTotal ? ((100 * mCAvailable) / mCTotal) : 0; - if (mOTotal == mCTotal && - mOAvailable == mCAvailable) { - return; + if (mOTotal != mCTotal || mOAvailable != mCAvailable) { + mOTotal = mCTotal ; + mOAvailable = mCAvailable ; + emit didUSBSpaceChange(mCIsReady, mCTotal, mCAvailable, mPercent); } - mOIsReady = mCIsReady ; - mOTotal = mCTotal ; - mOAvailable = mCAvailable ; - emit didUSBSpaceChange(mCIsReady, mCTotal, mCAvailable, mPercent); + // DEBUG: qDebug() << "DeviceController::usbSpaceCheck" + // << mCIsReady + // << mCIsReadOnly + // << mCTotal + // << mCAvailable ; } @@ -374,11 +358,11 @@ case EBUSY: error = tr("%1 - Device or resource busy (%2)").arg(errno).arg(vDevice); _mounted = true; - break; + break; default: error = tr("%1 - %2 (%3 , %4)").arg(errno).arg(strerror(errno)).arg(vDevice).arg(USB_Mount_Point); - break; + break; } if (error != lastError) { Index: sources/device/DeviceController.h =================================================================== diff -u -r86e9dfbff50cb7e16fd94c16c1c818cef3b47eac -r465a935949a85d3d1bebd11979737ff38ef96122 --- sources/device/DeviceController.h (.../DeviceController.h) (revision 86e9dfbff50cb7e16fd94c16c1c818cef3b47eac) +++ sources/device/DeviceController.h (.../DeviceController.h) (revision 465a935949a85d3d1bebd11979737ff38ef96122) @@ -108,8 +108,6 @@ QThread *_thread = nullptr; bool _init = false; - bool _pauseSpaceCheck = false; - QFileSystemWatcher _fileSystemWatcher; //TODO: all of these should use the TimesProcess (instead of QProcess) @@ -124,7 +122,6 @@ void doScreenshot(const QImage &vImage, const QString &vFileName); private slots: - void onRemoveLogs(bool vInProgress); void onScreenshot(const QImage &vImage, const QString &vFileName); protected: Index: sources/gui/GuiController.cpp =================================================================== diff -u -r7ebc073150532073ae7f1a0e768272bcff5d6fb3 -r465a935949a85d3d1bebd11979737ff38ef96122 --- sources/gui/GuiController.cpp (.../GuiController.cpp) (revision 7ebc073150532073ae7f1a0e768272bcff5d6fb3) +++ sources/gui/GuiController.cpp (.../GuiController.cpp) (revision 465a935949a85d3d1bebd11979737ff38ef96122) @@ -80,10 +80,14 @@ this , SLOT( onUSBDriveMount ())); connect(&_ApplicationController, SIGNAL(didUSBDriveRemove()), this , SLOT( onUSBDriveRemove())); + connect(&_ApplicationController, SIGNAL(didUSBSpaceChange(bool, qint64, qint64, quint8)), + this , SLOT( onUSBSpaceChange(bool, qint64, qint64, quint8))); // SD card connect(&_ApplicationController, SIGNAL(didSDCardStateChange(bool,bool)), this , SLOT( onSDCardStateChange(bool,bool))); + connect(&_ApplicationController, SIGNAL(didSDCardSpaceChange(bool, qint64, qint64, quint8)), + this , SLOT( onSDCardSpaceChange(bool, qint64, qint64, quint8))); connect(&_ApplicationController, SIGNAL(didSDCardSpaceTooLow(quint8)), this , SLOT( onSDCardSpaceTooLow(quint8))); @@ -263,12 +267,15 @@ */ void GuiController::onUSBDriveRemove() { - // disabled coco begin validated: This needs user interaction to plug-out the USB device - // has been tested manually emit didUSBDriveRemove(); } -// disabled coco end +void GuiController::onUSBSpaceChange(bool vReady, qint64 vTotal, qint64 vAvailable, quint8 vPercent) +{ + //DEBUG:0: qDebug() << "GuiController::onUSBSpaceChange" << vReady << vTotal << vAvailable << vPercent; + emit didUSBSpaceChange(vReady, vTotal, vAvailable, vPercent); +} + /*! * \brief GuiController::onSDCardStateChange * \details emits didSDCardStateChange signal to notify other classes (GuiView) @@ -278,14 +285,29 @@ */ void GuiController::onSDCardStateChange(bool vIsReady, bool vIsReadOnly) { - // disabled coco begin validated: This needs user interaction to plug-out the SD Card - // has been tested manually - /// DEBUG: qDebug() << " ***** GuiController " << Storage::SDCard_Base_Path_Name << vIsReady; + //DEBUG:0: qDebug() << " ***** GuiController " << Storage::SDCard_Base_Path_Name << vIsReady << vIsReadOnly << gDisableSDCFailLogStop; + + static bool hasAlarm = false; // to make it clear the alarm only once. + if ( ( ! vIsReady || vIsReadOnly ) && ! gDisableSDCFailLogStop ) { + hasAlarm = true; + AlarmStatusData data = AlarmGenerator::ALARM_ID_UI_POST_FAILURE_SDCARD(); + emit didActionReceive(data); + } + else if ( hasAlarm ) { + hasAlarm = false; + AlarmStatusData data = AlarmGenerator::ALARM_ID_NO_ALARM(); + emit didActionReceive(data); + } + emit didSDCardStateChange(vIsReady, vIsReadOnly); } -// disabled coco end +void GuiController::onSDCardSpaceChange(bool vReady, qint64 vTotal, qint64 vAvailable, quint8 vPercent) +{ + emit didSDCardSpaceChange(vReady, vTotal, vAvailable, vPercent); +} + /*! * \brief GuiController::onSDCardSpaceTooLow * \details The handler slot for the didSDCardSpaceTooLow signal comes form ApplicationController. Index: sources/gui/GuiController.h =================================================================== diff -u -r7ebc073150532073ae7f1a0e768272bcff5d6fb3 -r465a935949a85d3d1bebd11979737ff38ef96122 --- sources/gui/GuiController.h (.../GuiController.h) (revision 7ebc073150532073ae7f1a0e768272bcff5d6fb3) +++ sources/gui/GuiController.h (.../GuiController.h) (revision 465a935949a85d3d1bebd11979737ff38ef96122) @@ -80,8 +80,10 @@ void onUSBDriveMount (); // OS => UI void onUSBDriveRemove(); // OS => UI + void onUSBSpaceChange(bool vReady, qint64 vTotal, qint64 vAvailable, quint8 vPercent); void onSDCardStateChange(bool vIsReady, bool vIsReadOnly); // OS => UI + void onSDCardSpaceChange(bool vReady, qint64 vTotal, qint64 vAvailable, quint8 vPercent); void onSDCardSpaceTooLow(quint8 vAvailablePercent); // OS => UI void onExport (); // OS => UI @@ -94,8 +96,10 @@ void didUSBDriveMount (); void didUSBDriveUmount(); void didUSBDriveRemove(); + void didUSBSpaceChange(bool vReady, qint64 vTotal, qint64 vAvailable, quint8 vPercent); void didSDCardStateChange(bool vIsReady, bool vIsReadOnly); + void didSDCardSpaceChange(bool vReady, qint64 vTotal, qint64 vAvailable, quint8 vPercent); void didSDCardSpaceTooLow(quint8 vAvailablePercent); void didExportLog (); Index: sources/gui/GuiView.cpp =================================================================== diff -u -rfa8a24789926622048cdd480ea48abd9596c03b3 -r465a935949a85d3d1bebd11979737ff38ef96122 --- sources/gui/GuiView.cpp (.../GuiView.cpp) (revision fa8a24789926622048cdd480ea48abd9596c03b3) +++ sources/gui/GuiView.cpp (.../GuiView.cpp) (revision 465a935949a85d3d1bebd11979737ff38ef96122) @@ -57,22 +57,17 @@ this , SLOT( onUSBDriveMount ())); connect(&_GuiController, SIGNAL(didUSBDriveRemove()), this , SLOT( onUSBDriveRemove())); + connect(&_GuiController, SIGNAL(didUSBSpaceChange(bool, qint64, qint64, quint8)), + this , SLOT( onUSBSpaceChange(bool, qint64, qint64, quint8))); - // USB Drive - connect(&_DeviceController, SIGNAL( didUSBSpaceChange(bool, qint64, qint64, quint8)), - this , SLOT( onUSBSpaceChange(bool, qint64, qint64, quint8))); - // SD Card - connect(&_GuiController, SIGNAL(didSDCardStateChange(bool,bool)), - this , SLOT( onSDCardStateChange(bool,bool))); + connect(&_GuiController , SIGNAL(didSDCardStateChange(bool,bool)), + this , SLOT( onSDCardStateChange(bool,bool))); + connect(&_GuiController , SIGNAL(didSDCardSpaceChange(bool, qint64, qint64, quint8)), + this , SLOT( onSDCardSpaceChange(bool, qint64, qint64, quint8))); + connect(&_GuiController , SIGNAL(didExport()), + this , SLOT( onExport())); - /// TEST: Test the space on GUI, not sure if we keep it. - connect(&_DeviceController, SIGNAL( didSDCardSpaceChange(bool, qint64, qint64, quint8)), - this , SLOT( onSDCardSpaceChange(bool, qint64, qint64, quint8))); - - connect(&_GuiController, SIGNAL(didExport()), - this , SLOT( onExport())); - // From UI : Export Log connect(this , SIGNAL(didExportLog ()), &_GuiController, SLOT( doExportLog ())); @@ -157,6 +152,7 @@ // has been tested manually usbIsReady (false); usbIsRemoved(false); + exportRunning(false); emit didUSBDriveUmount(); } // disabled coco end @@ -172,6 +168,7 @@ // has been tested manually usbIsReady (false); usbIsRemoved(true ); + exportRunning(false); emit didUSBDriveRemove(); } // disabled coco end @@ -187,9 +184,12 @@ { // disabled coco begin validated: This needs user interaction to plug-in USB device // has been tested manually - /// DEBUG: qDebug() << " ***** GuiView " << Storage::SDCard_Base_Path_Name << vIsReady; + //DEBUG:0: qDebug() << " ***** GuiView " << Storage::SDCard_Base_Path_Name << vIsReady; sdIsReady (vIsReady ); sdIsReadOnly(vIsReadOnly); + if (! vIsReady || vIsReadOnly) exportRunning(false); + + //DEBUG:0: qDebug() << __FUNCTION__ << _sdIsReady << _sdIsReadOnly; } // disabled coco end @@ -215,6 +215,7 @@ { exportRunning(false); emit didExport(); + //DEBUG:0: qDebug() << " ~~~~~ " << "GuiView::onExport" << _exportRunning; } @@ -264,25 +265,21 @@ */ void GuiView::onSDCardSpaceChange(bool vReady, qint64 vTotal, qint64 vAvailable, quint8 vPercent) { - // disabled coco begin validated: This needs user interaction to change the SD card files system. - // has been tested manually /// DEBUG: qDebug() << vReady << vTotal << vAvailable << vPercent << Storage::Available_Space_Percent; Q_UNUSED(vReady) sdTotal ( vTotal ); sdAvail ( vAvailable ); sdPercent ( vPercent ); sdIsLow ( Storage::Log_Min_Available_Total_Space_IsLow(vPercent) ); } -// disabled coco end void GuiView::onUSBSpaceChange(bool vReady, qint64 vTotal, qint64 vAvailable, quint8 vPercent) { - // has been tested manually - /// DEBUG: qDebug() << vReady << vTotal << vAvailable << vPercent << Storage::Available_Space_Percent; + // DEBUG: qDebug() << "GuiView::onUSBSpaceChange" << vReady << vTotal << vAvailable << vPercent; usbTotal ( vTotal ); usbAvail ( vAvailable ); usbPercent ( vPercent ); usbIsReady ( vReady ); - // TODO : the space check should also be done for the USB as destination but needs calculation has will be done later. + // TODO : the space check should also be done for the USB as destination but needs calculation and will be done later. // usbIsLow ( vPercent <= Storage::Available_Space_Percent ); } Index: sources/gui/GuiView.h =================================================================== diff -u -r7ebc073150532073ae7f1a0e768272bcff5d6fb3 -r465a935949a85d3d1bebd11979737ff38ef96122 --- sources/gui/GuiView.h (.../GuiView.h) (revision 7ebc073150532073ae7f1a0e768272bcff5d6fb3) +++ sources/gui/GuiView.h (.../GuiView.h) (revision 465a935949a85d3d1bebd11979737ff38ef96122) @@ -43,8 +43,8 @@ // disabled coco begin validated: This needs user interaction to plug-in/out SD Card // has been tested manually - PROPERTY(bool, sdIsReady , false) - PROPERTY(bool, sdIsReadOnly, false) + PROPERTY(bool , sdIsReady , false ) + PROPERTY(bool , sdIsReadOnly , false ) PROPERTY(quint64, sdTotal , 0 ) PROPERTY(quint64, sdAvail , 0 ) @@ -81,14 +81,14 @@ void onUSBDriveMount (); void onUSBDriveRemove(); + void onUSBSpaceChange(bool vReady, qint64 vTotal, qint64 vAvailable, quint8 vPercent); void onExport (); void onSDCardStateChange(bool vIsReady, bool vIsReadOnly); void onSDCardSpaceTooLow(quint8 vAvailablePercent); void onSDCardSpaceChange(bool vReady, qint64 vTotal, qint64 vAvailable, quint8 vPercent); - void onUSBSpaceChange (bool vReady, qint64 vTotal, qint64 vAvailable, quint8 vPercent); public slots: // is public since will be used in the UI and is in the same thread. void doActionTransmit(GuiActionType vAction, const QVariantList &vData); // UI => HD/DG @@ -106,6 +106,7 @@ void didUSBDriveMount (); void didUSBDriveUmount(); void didUSBDriveRemove(); + void didUSBSpaceChange(bool vReady, qint64 vTotal, qint64 vAvailable, quint8 vPercent); void didExportLog (); void didExportService (); Index: sources/gui/qml/components/ExportButton.qml =================================================================== diff -u -r5e0731af5ae5e11d3981e4d3065a886975fb7fc3 -r465a935949a85d3d1bebd11979737ff38ef96122 --- sources/gui/qml/components/ExportButton.qml (.../ExportButton.qml) (revision 5e0731af5ae5e11d3981e4d3065a886975fb7fc3) +++ sources/gui/qml/components/ExportButton.qml (.../ExportButton.qml) (revision 465a935949a85d3d1bebd11979737ff38ef96122) @@ -34,10 +34,4 @@ text: qsTr("Export") font.pixelSize: Fonts.fontPixelButton * (isSmall ? 0.75 : 1) } - - Connections { target: _GuiView - onDidUSBDriveUmount : _root.enabled = false - onDidUSBDriveRemove : _root.enabled = false - onDidUSBDriveMount : _root.enabled = true && ! disabled - } } Index: sources/gui/qml/components/USBButton.qml =================================================================== diff -u -r5e0731af5ae5e11d3981e4d3065a886975fb7fc3 -r465a935949a85d3d1bebd11979737ff38ef96122 --- sources/gui/qml/components/USBButton.qml (.../USBButton.qml) (revision 5e0731af5ae5e11d3981e4d3065a886975fb7fc3) +++ sources/gui/qml/components/USBButton.qml (.../USBButton.qml) (revision 465a935949a85d3d1bebd11979737ff38ef96122) @@ -39,10 +39,4 @@ } fading: ! _GuiView.usbIsReady && ! _GuiView.usbIsRemoved - - Connections { target: _GuiView - onDidUSBDriveUmount : _root.enabled = false - onDidUSBDriveRemove : _root.enabled = false - onDidUSBDriveMount : _root.enabled = true && ! disabled - } } Index: sources/gui/qml/pages/MainStack.qml =================================================================== diff -u -r11a7a3223f8405b6cfba01f8f684fadb2090e0cc -r465a935949a85d3d1bebd11979737ff38ef96122 --- sources/gui/qml/pages/MainStack.qml (.../MainStack.qml) (revision 11a7a3223f8405b6cfba01f8f684fadb2090e0cc) +++ sources/gui/qml/pages/MainStack.qml (.../MainStack.qml) (revision 465a935949a85d3d1bebd11979737ff38ef96122) @@ -149,9 +149,9 @@ onIsManagerChanged : { if( visManager ) _mainMenu.isManager () } onIsSettingsChanged : { if( visSettings ) _mainMenu.isSettings () } - onFaultChanged : { page( _faultModeScreen , vfault )} + onFaultChanged : { page( _faultModeScreen , vfault && ! vSettings.noCANBus )} onServiceChanged : { page( _serviceModeScreen , vservice )} - onInitChanged : { page( _postModeScreen , vinit ) + onInitChanged : { page( _postModeScreen , vinit && ! vSettings.noCANBus ) if ( vinit ) vHDPOSTData.reset() // better to reset on vinit = true because the rest makes the screen animation to run } Index: sources/gui/qml/pages/posttreatment/PostTreatmentReview.qml =================================================================== diff -u -r5e0731af5ae5e11d3981e4d3065a886975fb7fc3 -r465a935949a85d3d1bebd11979737ff38ef96122 --- sources/gui/qml/pages/posttreatment/PostTreatmentReview.qml (.../PostTreatmentReview.qml) (revision 5e0731af5ae5e11d3981e4d3065a886975fb7fc3) +++ sources/gui/qml/pages/posttreatment/PostTreatmentReview.qml (.../PostTreatmentReview.qml) (revision 465a935949a85d3d1bebd11979737ff38ef96122) @@ -47,7 +47,7 @@ anchors.top : _exportButton.top anchors.left : _exportButton.right anchors.leftMargin: Variables.minVGap - enabled : ! _GuiView.exportRunning + enabled : _GuiView.usbIsReady && !_GuiView.exportRunning } ScrollBar { Index: sources/gui/qml/pages/settings/SettingsExportLogs.qml =================================================================== diff -u -r5e0731af5ae5e11d3981e4d3065a886975fb7fc3 -r465a935949a85d3d1bebd11979737ff38ef96122 --- sources/gui/qml/pages/settings/SettingsExportLogs.qml (.../SettingsExportLogs.qml) (revision 5e0731af5ae5e11d3981e4d3065a886975fb7fc3) +++ sources/gui/qml/pages/settings/SettingsExportLogs.qml (.../SettingsExportLogs.qml) (revision 465a935949a85d3d1bebd11979737ff38ef96122) @@ -47,8 +47,8 @@ //////////////////////////////////////////////////////////////////////////////// readonly property string sdcLabel : qsTr("SD-Card") - readonly property string dvcUnit : "MB" // no translation - readonly property string dvcUnitLabel : " (" + dvcUnit + ")\n" // no translation + readonly property string devUnit : "MB" // no translation + readonly property string devUnitLabel : " (" + devUnit + ")\n" // no translation readonly property string usbLabel : qsTr("USB Drive") readonly property int headetRowHight : 50 @@ -133,13 +133,19 @@ isUpdatePanels = false } + Connections { target: _GuiView + onSdIsReadyChanged: { + _root.updatePanels() + } + } + USBButton { id: _usbEjectButton width : 155 height : 50 anchors.right : _root.right anchors.top : _root.top anchors.margins : Variables.headerButtonsMargin - enabled : ! _GuiView.exportRunning && ! isUpdatePanels + enabled : _GuiView.usbIsReady && !_GuiView.exportRunning && ! isUpdatePanels } Row { id : _contentRect @@ -249,7 +255,7 @@ anchors.left : _SDC_progressItem.right anchors.leftMargin : _progressColumn.spacing anchors.verticalCenter : parent.verticalCenter - text : _root.sdcLabel + _root.dvcUnitLabel + ("Free : %1\nTotal: %2").arg( Variables.sizeConverted( _GuiView.sdAvail, 1000, 3) ).arg( Variables.sizeConverted( _GuiView.sdTotal, 1000, 3) ) + text : _root.sdcLabel + _root.devUnitLabel + ("Free : %1\nTotal: %2").arg( Variables.sizeConverted( _GuiView.sdAvail, 1000, 3) ).arg( Variables.sizeConverted( _GuiView.sdTotal, 1000, 3) ) } Label { anchors.fill : parent @@ -271,7 +277,7 @@ anchors.left : _USB_progressItem.right anchors.leftMargin : _progressColumn.spacing anchors.verticalCenter : parent.verticalCenter - text : _root.usbLabel + _root.dvcUnitLabel + ("Free : %1\nTotal: %2").arg( Variables.sizeConverted( _GuiView.usbAvail, 1000, 3) ).arg( Variables.sizeConverted( _GuiView.usbTotal, 1000, 3) ) + text : _root.usbLabel + _root.devUnitLabel + ("Free : %1\nTotal: %2").arg( Variables.sizeConverted( _GuiView.usbAvail, 1000, 3) ).arg( Variables.sizeConverted( _GuiView.usbTotal, 1000, 3) ) } Label { anchors.fill : parent @@ -286,7 +292,7 @@ height : Variables.touchRectHeight radius : Variables.touchRectRadius border.width : Variables.borderWidth - enabled : ! _GuiView.exportRunning && ! isUpdatePanels + enabled : _GuiView.usbIsReady && !_GuiView.exportRunning && ! isUpdatePanels onClicked : doExport() } } Index: sources/main.h =================================================================== diff -u -rae149c87409efbe66b84924aa1cbb3131be9d5b7 -r465a935949a85d3d1bebd11979737ff38ef96122 --- sources/main.h (.../main.h) (revision ae149c87409efbe66b84924aa1cbb3131be9d5b7) +++ sources/main.h (.../main.h) (revision 465a935949a85d3d1bebd11979737ff38ef96122) @@ -64,6 +64,7 @@ extern bool gDisableAlarmNoMinimize ; extern bool gDisableCheckInLog ; extern bool gDisableAcknowLog ; +extern bool gDisableSDCFailLogStop ; extern bool gConsoleoutLogs ; extern bool gConsoleoutFrameInterface ; Index: sources/model/hd/alarm/MAlarmMapping.cpp =================================================================== diff -u -r5e0731af5ae5e11d3981e4d3065a886975fb7fc3 -r465a935949a85d3d1bebd11979737ff38ef96122 --- sources/model/hd/alarm/MAlarmMapping.cpp (.../MAlarmMapping.cpp) (revision 5e0731af5ae5e11d3981e4d3065a886975fb7fc3) +++ sources/model/hd/alarm/MAlarmMapping.cpp (.../MAlarmMapping.cpp) (revision 465a935949a85d3d1bebd11979737ff38ef96122) @@ -7,7 +7,7 @@ * * \file MAlarmMapping.cpp * \author (last) Behrouz NematiPour - * \date (last) 08-Aug-2022 + * \date (last) 11-Aug-2022 * \author (original) Behrouz NematiPour * \date (original) 03-May-2021 * @@ -43,25 +43,25 @@ /*0007*/case GuiAlarmID::ALARM_ID_HD_RTC_BATTERY_LOW : { result = QObject::tr("HD RTC battery low." ); break; } /* 7*/ /*0008*/case GuiAlarmID::ALARM_ID_HD_ACCELEROMETER_SELF_TEST_FAILURE : { result = QObject::tr("HD accelerometer failed POST." ); break; } /* 8*/ /*0009*/case GuiAlarmID::ALARM_ID_DG_ACCELEROMETER_SELF_TEST_FAILURE : { result = QObject::tr("DG accelerometer failed POST." ); break; } /* 9*/ -/*0010*/case GuiAlarmID::ALARM_ID_HD_BLOOD_LEAK_FAULT : { result = QObject::tr("Alarm ID available for use." ); break; } /* 10*/ -/*0011*/case GuiAlarmID::ALARM_ID_HD_BLOOD_LEAK_SELF_TEST_FAILURE : { result = QObject::tr("Alarm ID available for use." ); break; } /* 11*/ +/*0010*/case GuiAlarmID::ALARM_ID_HD___AVAILABLE_7 : { result = QObject::tr("Not used." ); break; } /* 10*/ +/*0011*/case GuiAlarmID::ALARM_ID_HD_DIALYSATE_TEMP_BELOW_TARGET_TEMP : { result = QObject::tr("HD dialysate temperature below target temperature." ); break; } /* 11*/ /*0012*/case GuiAlarmID::ALARM_ID_HD_INTEGRITY_POST_TEST_FAILED : { result = QObject::tr("HD firmware image integrity POST test failed." ); break; } /* 12*/ /*0013*/case GuiAlarmID::ALARM_ID_DG_INTEGRITY_POST_TEST_FAILED : { result = QObject::tr("DG firmware image integrity POST test failed." ); break; } /* 13*/ -/*0014*/case GuiAlarmID::ALARM_ID_HD_BLOOD_FLOW_INVALID_CALIBRATION : { result = QObject::tr("HD blood flow invalid calibration." ); break; } /* 14*/ -/*0015*/case GuiAlarmID::ALARM_ID_HD_DIALYSATE_FLOW_INVALID_CALIBRATION : { result = QObject::tr("HD dialysate flow invalid calibration." ); break; } /* 15*/ +/*0014*/case GuiAlarmID::ALARM_ID___AVAILABLE_1 : { result = QObject::tr("Not used." ); break; } /* 14*/ +/*0015*/case GuiAlarmID::ALARM_ID___AVAILABLE_2 : { result = QObject::tr("Not used." ); break; } /* 15*/ /*0016*/case GuiAlarmID::ALARM_ID_HD_ALARM_AUDIO_SELF_TEST_FAILURE : { result = QObject::tr("HD alarm audio failed POST." ); break; } /* 16*/ /*0017*/case GuiAlarmID::ALARM_ID_HD_UI_POST_FAILED : { result = QObject::tr("HD UI POST failed." ); break; } /* 17*/ /*0018*/case GuiAlarmID::ALARM_ID_DG_PRESSURE_SENSORS_INVALID_CAL_RECORD : { result = QObject::tr("DG load cells invalid calibration record." ); break; } /* 18*/ -/*0019*/case GuiAlarmID::ALARM_ID_DG_FLOW_SENSORS_INVALID_CAL_RECORD : { result = QObject::tr("DG flow sensors invalid calibration record." ); break; } /* 19*/ +/*0019*/case GuiAlarmID::ALARM_ID_HD_DIALYSATE_TEMP_ABOVE_TARGET_TEMP : { result = QObject::tr("HD dialysate temperature above target temperature." ); break; } /* 19*/ /*0020*/case GuiAlarmID::ALARM_ID_DG_COND_SENSORS_INVALID_CAL_RECORD : { result = QObject::tr("DG conductivity sensors invalid calibration record." ); break; } /* 20*/ /*0021*/case GuiAlarmID::ALARM_ID_DG_DRAIN_LINE_VOLUME_INVALID_CAL_RECORD : { result = QObject::tr("DG drain line volume invalid calibration record." ); break; } /* 21*/ /*0022*/case GuiAlarmID::ALARM_ID_DG_RESERVOIRS_INVALID_CAL_RECORD : { result = QObject::tr("DG reservoirs invalid calibration record." ); break; } /* 22*/ /*0023*/case GuiAlarmID::ALARM_ID_DG_ACID_CONCENTRATE_INVALID_CAL_RECORD : { result = QObject::tr("DG acid concentrate calibration record." ); break; } /* 23*/ /*0024*/case GuiAlarmID::ALARM_ID_DG_BICARB_CONCENTRATE_INVALID_CAL_RECORD : { result = QObject::tr("DG bicarb concentrate calibration record." ); break; } /* 24*/ /*0025*/case GuiAlarmID::ALARM_ID_DG_ACCELEROMETERS_INVALID_CAL_RECORD : { result = QObject::tr("DG accelerometer invalid calibration record." ); break; } /* 25*/ /*0026*/case GuiAlarmID::ALARM_ID_HD_ACCELEROMETERS_INVALID_CAL_RECORD : { result = QObject::tr("HD accelerometer invalid calibration record." ); break; } /* 26*/ -/*0027*/case GuiAlarmID::ALARM_ID_HD_BLOOD_FLOW_INVALID_CAL_RECORD : { result = QObject::tr("HD blood flow invalid calibration record." ); break; } /* 27*/ -/*0028*/case GuiAlarmID::ALARM_ID_HD_DIALYSATE_FLOW_INVALID_CAL_RECORD : { result = QObject::tr("HD dialyzer flow invalid calibration record." ); break; } /* 28*/ +/*0027*/case GuiAlarmID::ALARM_ID_HD___AVAILABLE_3 : { result = QObject::tr("Not used." ); break; } /* 27*/ +/*0028*/case GuiAlarmID::ALARM_ID_HD___AVAILABLE_4 : { result = QObject::tr("Not used." ); break; } /* 28*/ /*0029*/case GuiAlarmID::ALARM_ID_HD_HEPARIN_FORCE_SENSOR_INVALID_CAL_RECORD : { result = QObject::tr("HD heparin force sensor invalid calibration record." ); break; } /* 29*/ /*0030*/case GuiAlarmID::ALARM_ID_HD_SOFTWARE_FAULT : { result = QObject::tr("HD Software fault.\nSoftware found itself in an unexpected state." ); break; } /* 30*/ /*0031*/case GuiAlarmID::ALARM_ID_BLOOD_PUMP_MC_CURRENT_CHECK : { result = QObject::tr("Blood pump failed motor controller current check.\nToo high when pump should be off or out of range when pump should be running." ); break; } /* 31*/ @@ -105,8 +105,8 @@ /*0069*/case GuiAlarmID::ALARM_ID_HD_BLOOD_LEAK_INVALID_CAL_RECORD : { result = QObject::tr("HD blood leak sensor invalid calibration record." ); break; } /* 69*/ /*0070*/case GuiAlarmID::ALARM_ID_HD_ARTERIAL_PRESSURE_SELF_TEST_FAILURE : { result = QObject::tr("HD arterial pressure self-test failure alarm." ); break; } /* 70*/ /*0071*/case GuiAlarmID::ALARM_ID_HD_VENOUS_PRESSURE_SELF_TEST_FAILURE : { result = QObject::tr("HD venous pressure self-test failure alarm." ); break; } /* 71*/ -/*0072*/case GuiAlarmID::ALARM_ID_HD_BLOOD_FLOW_STATUS_SELF_TEST_FAILURE : { result = QObject::tr("HD blood flow meter status check self-test failure alarm." ); break; } /* 72*/ -/*0073*/case GuiAlarmID::ALARM_ID_HD_DIALYSATE_FLOW_STATUS_SELF_TEST_FAILURE : { result = QObject::tr("HD dialysate flow meter status check self-test failure alarm." ); break; } /* 73*/ +/*0072*/case GuiAlarmID::ALARM_ID_HD___AVAILABLE_5 : { result = QObject::tr("Not used." ); break; } /* 72*/ +/*0073*/case GuiAlarmID::ALARM_ID_HD___AVAILABLE_6 : { result = QObject::tr("Not used." ); break; } /* 73*/ /*0074*/case GuiAlarmID::ALARM_ID_HD_BLOOD_LEAK_SELF_TEST_SEND_TIMEOUT : { result = QObject::tr("HD blood leak detector self-test transmit timeout." ); break; } /* 74*/ /*0075*/case GuiAlarmID::ALARM_ID_HD_SYRINGE_PUMP_SELF_TEST_FAILURE : { result = QObject::tr("HD syringe pump self-test failure alarm." ); break; } /* 75*/ /*0076*/case GuiAlarmID::ALARM_ID_HD_VOLTAGE_OUT_OF_RANGE : { result = QObject::tr("HD monitored voltage is out of range." ); break; } /* 76*/ @@ -188,8 +188,8 @@ /*0152*/case GuiAlarmID::ALARM_ID_INLET_WATER_PRESSURE_IN_LOW_RANGE : { result = QObject::tr("Inlet water pressure in low range." ); break; } /* 152*/ /*0153*/case GuiAlarmID::ALARM_ID_PRIME_COMPLETED_HIGH : { result = QObject::tr("HD prime completed high priority alarm." ); break; } /* 153*/ /*0154*/case GuiAlarmID::ALARM_ID_NVDATA_EEPROM_OPS_FAILURE : { result = QObject::tr("EEPROM operations (read, write, erase) failure." ); break; } /* 154*/ -/*0155*/case GuiAlarmID::ALARM_ID_DG_TEMPERATURE_SENSOR_ADC_OUT_OF_RANGE : { result = QObject::tr("Alarm ID available for use." ); break; } /* 155*/ -/*0156*/case GuiAlarmID::ALARM_ID_DG_TEMPERATURE_SENSOR_FAULT : { result = QObject::tr("Alarm ID available for use." ); break; } /* 156*/ +/*0155*/case GuiAlarmID::ALARM_ID_HD___AVAILABLE_9 : { result = QObject::tr("Not used." ); break; } /* 155*/ +/*0156*/case GuiAlarmID::ALARM_ID_HD___AVAILABLE_10 : { result = QObject::tr("Not used." ); break; } /* 156*/ /*0157*/case GuiAlarmID::ALARM_ID_DG_CHEM_DISINFECT_PRIME_ACID_LINE_TIME_OUT : { result = QObject::tr("DG chemical disinfect prime acid line timeout." ); break; } /* 157*/ /*0158*/case GuiAlarmID::ALARM_ID_INLET_WATER_TEMPERATURE_IN_LOW_RANGE : { result = QObject::tr("Inlet water temperature is in the low range." ); break; } /* 158*/ /*0159*/case GuiAlarmID::ALARM_ID_DIAL_IN_PUMP_FLOW_VS_MOTOR_SPEED_CHECK : { result = QObject::tr("Dialysate inlet pump failed flow vs motor speed check." ); break; } /* 159*/ @@ -209,7 +209,7 @@ /*0173*/case GuiAlarmID::ALARM_ID_HD_RTC_CONFIG_ERROR : { result = QObject::tr("HD RTC configuration error." ); break; } /* 173*/ /*0174*/case GuiAlarmID::ALARM_ID_HD_RTC_OR_TIMER_ACCURACY_FAILURE : { result = QObject::tr("HD RTC or timer accuracy failure." ); 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*/ +/*0176*/case GuiAlarmID::ALARM_ID_HD_DIALYSATE_TEMP_OUT_OF_HIGH_SAFETY_RANGE : { result = QObject::tr("HD dialysate temperature out of high safety range." ); 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*/ /*0178*/case GuiAlarmID::ALARM_ID_HD_COMM_TIMEOUT : { result = QObject::tr("HD communication timeout." ); break; } /* 178*/ /*0179*/case GuiAlarmID::ALARM_ID_DG_FPGA_COMM_TIMEOUT : { result = QObject::tr("DG FPGA communication down for too long." ); break; } /* 179*/ @@ -226,7 +226,7 @@ /*0190*/case GuiAlarmID::ALARM_ID_DRAIN_PUMP_OFF_FAULT : { result = QObject::tr("DG drain pump off fault." ); break; } /* 190*/ /*0191*/case GuiAlarmID::ALARM_ID_FLOW_RATE_OUT_OF_UPPER_RANGE : { result = QObject::tr("DG flow rate out of upper range." ); break; } /* 191*/ /*0192*/case GuiAlarmID::ALARM_ID_FLOW_RATE_OUT_OF_LOWER_RANGE : { result = QObject::tr("DG flow rate out of lower range." ); break; } /* 192*/ -/*0193*/case GuiAlarmID::ALARM_ID__AVAILABLE_13 : { result = QObject::tr("Alarm available for use." ); break; } /* 193*/ +/*0193*/case GuiAlarmID::ALARM_ID_HD_DIALYSATE_TEMP_OUT_OF_LOW_SAFETY_RANGE : { result = QObject::tr("HD dialysate temperature out of low safety range." ); break; } /* 193*/ /*0194*/case GuiAlarmID::ALARM_ID_RO_PUMP_DUTY_CYCLE_OUT_OF_RANGE : { result = QObject::tr("DG RO pump duty cycle out of range." ); break; } /* 194*/ /*0195*/case GuiAlarmID::ALARM_ID_RO_PUMP_PRESSURE_OUT_OF_RANGE : { result = QObject::tr("DG RO pump pressure out of range." ); break; } /* 195*/ /*0196*/case GuiAlarmID::ALARM_ID_DG_TEMPERATURE_SENSOR_ERROR_BIT_FAULT : { result = QObject::tr("DG temperature sensor error bit fault." ); break; } /* 196*/ Index: sources/storage/Logger.cpp =================================================================== diff -u -r7ebc073150532073ae7f1a0e768272bcff5d6fb3 -r465a935949a85d3d1bebd11979737ff38ef96122 --- sources/storage/Logger.cpp (.../Logger.cpp) (revision 7ebc073150532073ae7f1a0e768272bcff5d6fb3) +++ sources/storage/Logger.cpp (.../Logger.cpp) (revision 465a935949a85d3d1bebd11979737ff38ef96122) @@ -141,6 +141,8 @@ connect(&_removeLogsWatcher, SIGNAL(finished ()), this , SLOT(onRemoveLogs())); + connect(&_DeviceController, SIGNAL( didSDCardStateChange(bool, bool)), + this , SLOT( onSDCardStateChange(bool, bool))); connect(&_DeviceController, SIGNAL( didSDCardSpaceChange(bool, qint64, qint64, quint8)), this , SLOT( onSDCardSpaceChange(bool, qint64, qint64, quint8))); } @@ -183,6 +185,15 @@ void Logger::onLog(const QString &vContent, LogType vLogType, bool vTimestamp) { + static bool notified = false; + if ( ! _logStorageReady && ! gDisableSDCFailLogStop ) { + if ( ! notified ) { + notified = true; + qDebug() << "Log storage not ready, logging rejected"; + } + return; + } + log(vContent, vLogType, vTimestamp); } @@ -557,6 +568,17 @@ } // disabled coco end +void Logger::onSDCardStateChange(bool vReady, bool vReadonly) +{ +#if BUILD_FOR_DESKTOP + Q_UNUSED(vReady ) + Q_UNUSED(vReadonly ) + _logStorageReady = true; +#else + _logStorageReady = vReady && !vReadonly; +#endif +} + /*! * \brief Logger::onSDCardSpaceChange * \details SD Card storage space parameter change slot. @@ -575,6 +597,7 @@ Q_UNUSED(vTotal ) Q_UNUSED(vAvailable ) if ( ! vReady ) return; + // DEBUG: qDebug() << vPercent << Storage::Available_Space_Percent; if ( Storage::Log_Min_Available_Total_Space_IsLow(vPercent) ) { concurrentRemoveLogs(); Index: sources/storage/Logger.h =================================================================== diff -u -r7ebc073150532073ae7f1a0e768272bcff5d6fb3 -r465a935949a85d3d1bebd11979737ff38ef96122 --- sources/storage/Logger.h (.../Logger.h) (revision 7ebc073150532073ae7f1a0e768272bcff5d6fb3) +++ sources/storage/Logger.h (.../Logger.h) (revision 465a935949a85d3d1bebd11979737ff38ef96122) @@ -96,6 +96,9 @@ Q_ENUM(LogType) private: + + bool _logStorageReady = true; + const char *_headerE = "TimeStamp,Type,SubSys,Name,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40"; QDir _dir; QString _logFileNamePrefix; @@ -225,6 +228,7 @@ // ----- Available space is low private slots: + void onSDCardStateChange(bool vReady, bool vReadonly); void onSDCardSpaceChange(bool vReady, qint64 vTotal, qint64 vAvailable, quint8 vPercent); // ----- logging structure Index: sources/storage/Settings.cpp =================================================================== diff -u -r627b97843f87f5ca8fbd731c6c4a6d9fae4352ce -r465a935949a85d3d1bebd11979737ff38ef96122 --- sources/storage/Settings.cpp (.../Settings.cpp) (revision 627b97843f87f5ca8fbd731c6c4a6d9fae4352ce) +++ sources/storage/Settings.cpp (.../Settings.cpp) (revision 465a935949a85d3d1bebd11979737ff38ef96122) @@ -116,7 +116,7 @@ if ( line.contains('=') ) { QStringList keyValue = line.split('='); key = keyValue[0].trimmed().replace("\\n","\n"); - value = keyValue[1].trimmed(); + value = keyValue[1].trimmed().replace("\\n","\n"); } else { key = line; Index: sources/view/hd/alarm/VAlarmStatus.cpp =================================================================== diff -u -r6f2622be80fcaee8d71baf78404627381157970c -r465a935949a85d3d1bebd11979737ff38ef96122 --- sources/view/hd/alarm/VAlarmStatus.cpp (.../VAlarmStatus.cpp) (revision 6f2622be80fcaee8d71baf78404627381157970c) +++ sources/view/hd/alarm/VAlarmStatus.cpp (.../VAlarmStatus.cpp) (revision 465a935949a85d3d1bebd11979737ff38ef96122) @@ -213,9 +213,9 @@ AlarmData alarmData; InstructionData instructionData; for (const QString &key : _Settings.keys(group)) { - if (isTitle ( key ) ) { + if (isTitle ( key ) ) { alarmData.title = _Settings.value(group, key).toString(); - } else if (isMessage ( key ) ) { + } else if (isMessage ( key ) ) { alarmData.message = _Settings.value(group, key).toString(); } else { instructionData[key] = _Settings.value(group, key).toString(); @@ -232,4 +232,5 @@ // } } } + emit alarm_AlarmIDChanged(_alarm_AlarmID); // to get the dialog content in sync with the Alarm.conf in case there is an early alarm. } Index: sources/view/settings/VSettings.cpp =================================================================== diff -u -r6f2622be80fcaee8d71baf78404627381157970c -r465a935949a85d3d1bebd11979737ff38ef96122 --- sources/view/settings/VSettings.cpp (.../VSettings.cpp) (revision 6f2622be80fcaee8d71baf78404627381157970c) +++ sources/view/settings/VSettings.cpp (.../VSettings.cpp) (revision 465a935949a85d3d1bebd11979737ff38ef96122) @@ -91,6 +91,8 @@ mNoCANBus = _Settings.value(group, key).toBool (); // returns 0/false if fails, so no error checking needed. keyValue[key] = mNoCANBus ; noCANBus ( mNoCANBus); + if (_noCANBus ) + LOG_EVENT_UI(QString("System is working on NoCANBus set")); } else { keyValue[key] = _Settings.value(group, key); Index: unittests/tst_threads.cpp =================================================================== diff -u -rf9912fcd4b809e5a7fd59cf855488b6a762198d0 -r465a935949a85d3d1bebd11979737ff38ef96122 --- unittests/tst_threads.cpp (.../tst_threads.cpp) (revision f9912fcd4b809e5a7fd59cf855488b6a762198d0) +++ unittests/tst_threads.cpp (.../tst_threads.cpp) (revision 465a935949a85d3d1bebd11979737ff38ef96122) @@ -42,7 +42,7 @@ QCOMPARE( _MessageAcknowModel .init(Threads::_CanAcknow_Thread ), ! _MessageAcknowModel .init(Threads::_CanAcknow_Thread )); QCOMPARE( _MessageDispatcher .init(Threads::_CanMessage_Thread ), ! _MessageDispatcher .init(Threads::_CanMessage_Thread )); QCOMPARE( _ApplicationController .init(Threads::_Application_Thread ), ! _ApplicationController .init(Threads::_Application_Thread )); - QCOMPARE( _GuiController .init(Threads::_Application_Thread ), ! _GuiController .init(Threads::_Application_Thread )); + QCOMPARE( _GuiController .init(Threads::_Gui_Thread ), ! _GuiController .init(Threads::_Gui_Thread )); } void tst_threads::tst_Thread_names() @@ -53,7 +53,7 @@ QCOMPARE( _FrameInterface .thread()->objectName(), "Can::FrameInterface_Thread" ); QCOMPARE( _MessageAcknowModel .thread()->objectName(), "Can::MessageAcknowModel_Thread" ); QCOMPARE( _MessageDispatcher .thread()->objectName(), "Can::MessageDispatcher_Thread" ); - QCOMPARE( _ApplicationController .thread()->objectName(), "Gui::GuiController_Thread" ); + QCOMPARE( _ApplicationController .thread()->objectName(), "Gui::ApplicationController_Thread" ); QCOMPARE( _GuiController .thread()->objectName(), "Gui::GuiController_Thread" ); }