Index: AlarmMapping.csv =================================================================== diff -u -r6f2622be80fcaee8d71baf78404627381157970c -r7ebc073150532073ae7f1a0e768272bcff5d6fb3 --- AlarmMapping.csv (.../AlarmMapping.csv) (revision 6f2622be80fcaee8d71baf78404627381157970c) +++ AlarmMapping.csv (.../AlarmMapping.csv) (revision 7ebc073150532073ae7f1a0e768272bcff5d6fb3) @@ -231,7 +231,7 @@ 230,"HD prime dialysate bypass time out alarm." 231,"HD pre-treatment mode dry pressure self-test failure." 232,"HD pre-treatment mode wet self-test LC vs LC failure." - 233,"Alarm ID available for use." + 233,"DG barometric sensor coefficients bad CRC." 234,"RTC (i.e read time) or RAM operations failure (read or write)." 235,"HD in treatment stopped sub-mode after rinseback completed (no escalation)." 236,"HD needs new cartridge to be installed." Index: denali.pro.user =================================================================== diff -u -rae149c87409efbe66b84924aa1cbb3131be9d5b7 -r7ebc073150532073ae7f1a0e768272bcff5d6fb3 --- denali.pro.user (.../denali.pro.user) (revision ae149c87409efbe66b84924aa1cbb3131be9d5b7) +++ denali.pro.user (.../denali.pro.user) (revision 7ebc073150532073ae7f1a0e768272bcff5d6fb3) @@ -1,6 +1,6 @@ - + EnvironmentId @@ -97,7 +97,7 @@ Desktop Qt 5.12.5 GCC 64bit Desktop Qt 5.12.5 GCC 64bit qt.qt5.5125.gcc_64_kit - 1 + 0 0 0 @@ -117,7 +117,7 @@ qmake QtProjectManager.QMakeBuildStep - false + true false false @@ -1239,7 +1239,7 @@ true false - /home/denali/Projects/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Release + /home/denali/Projects/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Debug 1 Index: sources/ApplicationController.cpp =================================================================== diff -u -rec7f919fdb70ff29a8de627937e4ad7008e59c1c -r7ebc073150532073ae7f1a0e768272bcff5d6fb3 --- sources/ApplicationController.cpp (.../ApplicationController.cpp) (revision ec7f919fdb70ff29a8de627937e4ad7008e59c1c) +++ sources/ApplicationController.cpp (.../ApplicationController.cpp) (revision 7ebc073150532073ae7f1a0e768272bcff5d6fb3) @@ -127,8 +127,12 @@ connect(&_DeviceController , SIGNAL(didSDCardSpaceTooLow(quint8)), this , SLOT( onSDCardSpaceTooLow(quint8))); - connect(&_GuiController , SIGNAL(didExportLog()), - this , SLOT( onExportLog())); + connect(&_GuiController , SIGNAL(didExportLog ()), + this , SLOT( onExportLog ())); + connect(&_GuiController , SIGNAL(didExportService ()), + this , SLOT( onExportService ())); + connect(&_GuiController , SIGNAL(didExportTreatment ()), + this , SLOT( onExportTreatment ())); connect(&_Logger , SIGNAL(didExportLogs()), this , SLOT( onExport ())); @@ -300,11 +304,24 @@ */ void ApplicationController::onExportLog() { - // disabled coco begin validated: This needs user interaction to plug-in USB device - // has been tested manually - LOG_EXPORT; + LOG_EXPORTLOG; } -// disabled coco end +/*! + * \brief ApplicationController::onExportService + * \details the slot which will be called by UI to do the service log export. + */ +void ApplicationController::onExportService() +{ + LOG_EXPORTERR; +} +/*! + * \brief ApplicationController::onExportTreatment + * \details the slot which will be called by UI to do the treatment treatment log export. + */ +void ApplicationController::onExportTreatment() +{ + LOG_EXPORTTRT; +} /*! * \brief ApplicationController::onExport Index: sources/ApplicationController.h =================================================================== diff -u -rae149c87409efbe66b84924aa1cbb3131be9d5b7 -r7ebc073150532073ae7f1a0e768272bcff5d6fb3 --- sources/ApplicationController.h (.../ApplicationController.h) (revision ae149c87409efbe66b84924aa1cbb3131be9d5b7) +++ sources/ApplicationController.h (.../ApplicationController.h) (revision 7ebc073150532073ae7f1a0e768272bcff5d6fb3) @@ -93,8 +93,10 @@ void onSDCardStateChange(bool vIsReady, bool vIsReadOnly); void onSDCardSpaceTooLow(quint8 vAvailablePercent); - void onExportLog (); - void onExport (); + void onExportLog (); + void onExportService (); + void onExportTreatment (); + void onExport (); void onFailedTransmit(Sequence seq); Index: sources/gui/GuiController.cpp =================================================================== diff -u -r79a6cfcb10472261f3ec26eaf0baf6f1245cd311 -r7ebc073150532073ae7f1a0e768272bcff5d6fb3 --- sources/gui/GuiController.cpp (.../GuiController.cpp) (revision 79a6cfcb10472261f3ec26eaf0baf6f1245cd311) +++ sources/gui/GuiController.cpp (.../GuiController.cpp) (revision 7ebc073150532073ae7f1a0e768272bcff5d6fb3) @@ -306,11 +306,8 @@ */ void GuiController::onExport() { - // disabled coco begin validated: This needs user interaction to export to USB device - // has been tested manually emit didExport(); } -// disabled coco end /*! * \brief GuiController::doExportLog @@ -319,13 +316,30 @@ */ void GuiController::doExportLog() { - // disabled coco begin validated: This needs user interaction to export to USB device - // has been tested manually emit didExportLog(); } -// disabled coco end /*! + * \brief GuiController::doExportService + * \details emits didExportService signal to notify other classes (ApplicationController) + * , the User requested to export the log. + */ +void GuiController::doExportService() +{ + emit didExportService(); +} + +/*! + * \brief GuiController::doExportTreatment + * \details emits didExportTreatment signal to notify other classes (ApplicationController) + * , the User requested to export the log. + */ +void GuiController::doExportTreatment() +{ + emit didExportTreatment(); +} + +/*! * \brief GuiController::didFailedTransmit * \details Raises an HD communication timeout alarm if communication with HD is lost. * \param seq - Sequence that failed to transmit Index: sources/gui/GuiController.h =================================================================== diff -u -rae149c87409efbe66b84924aa1cbb3131be9d5b7 -r7ebc073150532073ae7f1a0e768272bcff5d6fb3 --- sources/gui/GuiController.h (.../GuiController.h) (revision ae149c87409efbe66b84924aa1cbb3131be9d5b7) +++ sources/gui/GuiController.h (.../GuiController.h) (revision 7ebc073150532073ae7f1a0e768272bcff5d6fb3) @@ -70,8 +70,10 @@ public slots: void doActionTransmit(GuiActionType vAction, const QVariantList &vData); // UI => HD/DG - void doUSBDriveUmount(); // UI => OS - void doExportLog (); // UI => OS + void doUSBDriveUmount (); // UI => OS + void doExportLog (); // UI => OS + void doExportService (); // UI => OS + void doExportTreatment (); // UI => OS private slots: // Should be private for thread safety and is connected internally. void onActionReceive (GuiActionType vAction, const QVariantList &vData); // UI <= HD/DG @@ -96,7 +98,9 @@ void didSDCardStateChange(bool vIsReady, bool vIsReadOnly); void didSDCardSpaceTooLow(quint8 vAvailablePercent); - void didExportLog(); + void didExportLog (); + void didExportService (); + void didExportTreatment (); void didExport (); // Device controller signal slots connection Index: sources/gui/GuiView.cpp =================================================================== diff -u -r3a528c6f3fce8132de2791b55d3227e715d68898 -r7ebc073150532073ae7f1a0e768272bcff5d6fb3 --- sources/gui/GuiView.cpp (.../GuiView.cpp) (revision 3a528c6f3fce8132de2791b55d3227e715d68898) +++ sources/gui/GuiView.cpp (.../GuiView.cpp) (revision 7ebc073150532073ae7f1a0e768272bcff5d6fb3) @@ -74,8 +74,12 @@ this , SLOT( onExport())); // From UI : Export Log - connect(this , SIGNAL(didExportLog()), - &_GuiController, SLOT( doExportLog())); + connect(this , SIGNAL(didExportLog ()), + &_GuiController, SLOT( doExportLog ())); + connect(this , SIGNAL(didExportService ()), + &_GuiController, SLOT( doExportService ())); + connect(this , SIGNAL(didExportTreatment ()), + &_GuiController, SLOT( doExportTreatment ())); } /*! @@ -226,6 +230,28 @@ } /*! + * \brief GuiView::doExportService + * \details emits didExportService signal to notify other classes (GuiController) + * , the User requested to export the log. + */ +void GuiView::doExportService() +{ + exportRunning(true); + emit didExportService(); +} + +/*! + * \brief GuiView::doExportTreatment + * \details emits didExportTreatment signal to notify other classes (GuiController) + * , the User requested to export the log. + */ +void GuiView::doExportTreatment() +{ + exportRunning(true); + emit didExportTreatment(); +} + +/*! * \brief GuiView::onSDCardSpaceChange * \details SD Card storage space parameter change slot. * This slot when called is calling the function concurrentRemoveLogs, Index: sources/gui/GuiView.h =================================================================== diff -u -r3caffb866d4c84ac6282dcd36fc2d8f7cad9584d -r7ebc073150532073ae7f1a0e768272bcff5d6fb3 --- sources/gui/GuiView.h (.../GuiView.h) (revision 3caffb866d4c84ac6282dcd36fc2d8f7cad9584d) +++ sources/gui/GuiView.h (.../GuiView.h) (revision 7ebc073150532073ae7f1a0e768272bcff5d6fb3) @@ -94,8 +94,11 @@ void doActionTransmit(GuiActionType vAction, const QVariantList &vData); // UI => HD/DG void doActionTransmit(GuiActionType vAction, const QVariant &vData); // UI => HD/DG void doUSBDriveUmount(); - void doExportLog (); + void doExportLog (); + void doExportService (); + void doExportTreatment (); + signals: void didActionReceive (GuiActionType vAction, const QVariantList &vData); // UI <= HD/DG void didActionTransmit(GuiActionType vAction, const QVariantList &vData); // UI => HD/DG @@ -104,7 +107,9 @@ void didUSBDriveUmount(); void didUSBDriveRemove(); - void didExportLog(); + void didExportLog (); + void didExportService (); + void didExportTreatment (); void didExport (); }; } Index: sources/gui/qml/pages/settings/SettingsExportLogs.qml =================================================================== diff -u -r86e9dfbff50cb7e16fd94c16c1c818cef3b47eac -r7ebc073150532073ae7f1a0e768272bcff5d6fb3 --- sources/gui/qml/pages/settings/SettingsExportLogs.qml (.../SettingsExportLogs.qml) (revision 86e9dfbff50cb7e16fd94c16c1c818cef3b47eac) +++ sources/gui/qml/pages/settings/SettingsExportLogs.qml (.../SettingsExportLogs.qml) (revision 7ebc073150532073ae7f1a0e768272bcff5d6fb3) @@ -37,9 +37,97 @@ * \brief SettingsExportLogs is used to Export logs, and display the SD-Card and USB device informaiton and list of files. */ SettingsBase { id: _root + + 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 usbLabel : qsTr("USB Drive") + readonly property int headetRowHight : 50 + + readonly property int typeIndexApplication : 0 + readonly property int typeIndexService : 1 + readonly property int typeIndexTreatment : 2 + + readonly property string typeLabelApplication : qsTr("Application" ) + readonly property string typeLabelService : qsTr("Service" ) + readonly property string typeLabelTreatment : qsTr("Treatment" ) + + property bool isDevice : false + readonly property string typePathClr : "" + readonly property string typePathSrc : isDevice ? "file:///media/sd-card" : "file:///home/denali/Desktop/sd-card" + readonly property string typePathDst : isDevice ? "file:///media/usb" : "file:///home/denali/Desktop/usb-disk" + readonly property string typeFolderApplication : "/log" + readonly property string typeFolderService : "/service" + readonly property string typeFolderTreatment : "/treatment" + + readonly property string typeFolderApplicationSrc : typePathSrc + typeFolderApplication + readonly property string typeFolderApplicationDst : typePathDst + typeFolderApplication + readonly property string typeFolderServiceSrc : typePathSrc + typeFolderService + readonly property string typeFolderServiceDst : typePathDst + typeFolderService + readonly property string typeFolderTreatmentSrc : typePathSrc + typeFolderTreatment + readonly property string typeFolderTreatmentDst : typePathDst + typeFolderTreatment + + readonly property var typeFilterClr : [] + readonly property var typeFilterAll : ["*"] + readonly property var typeFilterApplication : ["*log" ] + readonly property var typeFilterService : ["*.err" ] + readonly property var typeFilterTreatment : ["*" ] + + itemIndex : SettingsStack.ExportLogs confirmVisible : false + function doExport() { + switch (_logTypeCombo.currentIndex) { + case typeIndexApplication: + _GuiView.doExportLog() + break + case typeIndexService: + _GuiView.doExportService() + break + case typeIndexTreatment: + _GuiView.doExportTreatment() + break + } + } + + function updatePanels (vIndex) { + console.debug(vIndex) + _usbEjectButton .enabled = false + _logTypeExportButton.enabled = false + _logTypeCombo .enabled = false + + _sdcFolderColumn.clearModel() + _usbFolderColumn.clearModel() + + switch (vIndex) { + case typeIndexApplication: + _sdcFolderColumn.currentTypeFolderApplication = typeFolderApplicationSrc + _sdcFolderColumn.currentTypeFilterApplication = typeFilterApplication + _usbFolderColumn.currentTypeFolderApplication = typeFolderApplicationDst + _usbFolderColumn.currentTypeFilterApplication = typeFilterApplication + break + case typeIndexService: + _sdcFolderColumn.currentTypeFolderApplication = typeFolderServiceSrc + _sdcFolderColumn.currentTypeFilterApplication = typeFilterService + _usbFolderColumn.currentTypeFolderApplication = typeFolderServiceDst + _usbFolderColumn.currentTypeFilterApplication = typeFilterService + break + case typeIndexTreatment: + _sdcFolderColumn.currentTypeFolderApplication = typeFolderTreatmentSrc + _sdcFolderColumn.currentTypeFilterApplication = typeFilterTreatment + _usbFolderColumn.currentTypeFolderApplication = typeFolderTreatmentDst + _usbFolderColumn.currentTypeFilterApplication = typeFilterTreatment + break + } + _sdcFolderColumn.updateModel() + _usbFolderColumn.updateModel() + + _logTypeExportButton.enabled = true + _logTypeCombo .enabled = true + _usbEjectButton .enabled = true + } + USBButton { id: _usbEjectButton width : 155 height : 50 @@ -74,21 +162,25 @@ Row { id : _logTypeRow anchors.left : parent.left width : parent.width - height : 50 + height : _root.headetRowHight spacing : _logTypeCombo.width - _logTypeExportButton.width // FIXME: This combobox needs to be a global Component ComboBox { id : _logTypeCombo + onCurrentIndexChanged : { + _root.updatePanels(currentIndex) + } + currentIndex : 0 displayText : currentText font.pixelSize : Fonts.fontPixelTextRectExtra width : parent.width // 2 height : parent.height padding : 10 model : [ - qsTr("Application" ), - qsTr("Service" ), - qsTr("Treatment" ) + _root.typeLabelApplication , + _root.typeLabelService , + _root.typeLabelTreatment ] background : Rectangle { @@ -151,7 +243,7 @@ anchors.left : _SDC_progressItem.right anchors.leftMargin : _progressColumn.spacing anchors.verticalCenter : parent.verticalCenter - text : qsTr("SD-Card") + " (MB)\n" + ("Free : %1\nTotal: %2").arg( Variables.sizeConverted( _GuiView.sdAvail, 1000, 3) ).arg( Variables.sizeConverted( _GuiView.sdTotal, 1000, 3) ) + text : _root.sdcLabel + _root.dvcUnitLabel + ("Free : %1\nTotal: %2").arg( Variables.sizeConverted( _GuiView.sdAvail, 1000, 3) ).arg( Variables.sizeConverted( _GuiView.sdTotal, 1000, 3) ) } Label { anchors.fill : parent @@ -173,7 +265,7 @@ anchors.left : _USB_progressItem.right anchors.leftMargin : _progressColumn.spacing anchors.verticalCenter : parent.verticalCenter - text : qsTr("USB Drive") + " (MB)\n" + ("Free : %1\nTotal: %2").arg( Variables.sizeConverted( _GuiView.usbAvail, 1000, 3) ).arg( Variables.sizeConverted( _GuiView.usbTotal, 1000, 3) ) + text : _root.usbLabel + _root.dvcUnitLabel + ("Free : %1\nTotal: %2").arg( Variables.sizeConverted( _GuiView.usbAvail, 1000, 3) ).arg( Variables.sizeConverted( _GuiView.usbTotal, 1000, 3) ) } Label { anchors.fill : parent @@ -188,23 +280,40 @@ height : Variables.touchRectHeight radius : Variables.touchRectRadius border.width : Variables.borderWidth - onClicked : _GuiView.doExportLog() + onClicked : doExport() } - } Column { id : _sdcFolderColumn + property string currentTypeFolderApplication : _root.typeFolderApplicationSrc + property var currentTypeFilterApplication : _root.typeFilterApplication + + // FIXME: there has to be a View for this, and the timer should be removed and an event driven signal should be implemented there. + function updateModel() { + _sdcFolderModel.folder = currentTypeFolderApplication // FIXME: there has to be a View for this which also get changed by log type. + _sdcFolderModel.nameFilters = currentTypeFilterApplication // FIXME: there has to be a View for this which also get changed by log type. + } + function clearModel() { + _sdcFolderModel.folder = _root.typePathClr + _sdcFolderModel.nameFilters = _root.typeFilterClr + } + spacing : 5 width : _contentRect.columnWidthFolder height : parent.height anchors.verticalCenter : parent.verticalCenter - + Label { id : _sdcLabel + text : _root.sdcLabel + ": %1 files"/*, %2 %3"*/.arg(_sdcFolderModel.count)//.arg("__").arg(_root.dvcUnit) + width : parent.width // 2 + height : _root.headetRowHight + verticalAlignment : Text.AlignVCenter + } Rectangle { id : _sdcFolderRectangle color : Colors.transparent border.color : Colors.borderButton radius : Variables.dialogRadius anchors.left : parent.left width : parent.width - height : parent.height + height : parent.height - _sdcLabel.height ScrollBar { anchors.fill : _sdcFolderView @@ -219,14 +328,15 @@ FolderListModel { id : _sdcFolderModel showDirs : false sortField : FolderListModel.Time - folder : "file:///media/sd-card/log" // FIXME: ther has to be a View for this which also get changed by log type. - nameFilters : ["*.log"] // FIXME: ther has to be a View for this which also get changed by log type. + folder : _sdcFolderColumn.currentTypeFolderApplication // FIXME: there has to be a View for this which also get changed by log type. + nameFilters : _sdcFolderColumn.currentTypeFilterApplication // FIXME: there has to be a View for this which also get changed by log type. } Component { id : _sdcFileDelegate Row { id : _sdcFileRow width : parent.width height : 40 Text { id : _sdcFileNameText + clip : true width : _contentRect.columnWidthFileName text : fileName color : Colors.textMain @@ -240,6 +350,7 @@ height : parent.height + _usbFolderColumn.spacing } Text { id : _sdcFileSizeText + clip : true width : _contentRect.columnWidthFileSize text : Variables.sizeConverted( fileSize, 1000, 3) color : Colors.textMain @@ -256,14 +367,18 @@ } Column { id : _usbFolderColumn + property string currentTypeFolderApplication : _root.typeFolderApplicationDst + property var currentTypeFilterApplication : _root.typeFilterApplication + // FIXME: there has to be a View for this, and the timer should be removed and an event driven signal should be implemented there. function updateModel() { - _usbFolderModel.folder = "file:///media/usb/log" // FIXME: there has to be a View for this which also get changed by log type. - _usbFolderModel.nameFilters = ["*.log"] // FIXME: there has to be a View for this which also get changed by log type. + _usbFolderModel.folder = currentTypeFolderApplication // FIXME: there has to be a View for this which also get changed by log type. + _usbFolderModel.nameFilters = currentTypeFilterApplication // FIXME: there has to be a View for this which also get changed by log type. + console.debug("Update model") } function clearModel() { - _usbFolderModel.folder = "" - _usbFolderModel.nameFilters = [] + _usbFolderModel.folder = _root.typePathClr + _usbFolderModel.nameFilters = _root.typeFilterClr } // FIXME: there has to be a View for this, and the timer should be removed and an event driven signal should be implemented there. @@ -272,9 +387,8 @@ repeat : true running : _GuiView.exportRunning onTriggered : { - _usbFolderColumn. clearModel() + // _usbFolderColumn. clearModel() _usbFolderColumn.updateModel() - console.debug("Updating usb") } } @@ -291,13 +405,20 @@ height : parent.height anchors.verticalCenter : parent.verticalCenter + Label { id : _usbLabel + text : _root.usbLabel + ": %1 files"/*", %2 %3"*/.arg(_usbFolderModel.count)//.arg("__").arg(_root.dvcUnit) + width : parent.width + height : _root.headetRowHight + verticalAlignment : Text.AlignVCenter + } + Rectangle { id : _usbFolderRectangle color : Colors.transparent border.color : Colors.borderButton radius : Variables.dialogRadius anchors.left : parent.left width : parent.width - height : parent.height + height : parent.height - _sdcLabel.height ScrollBar { anchors.fill : _usbFolderView @@ -312,14 +433,15 @@ FolderListModel { id : _usbFolderModel // FIXME: I don't like this model, it's too lazy and I don't have control over it. There has to be a Model for this. showDirs : false sortField : FolderListModel.Time - folder : "file:///media/usb" - nameFilters : ["*"] + folder : _usbFolderColumn.currentTypeFolderApplication + nameFilters : _usbFolderColumn.currentTypeFilterApplication } Component { id : _usbFileDelegate Row { id : _usbFileRow width : parent.width height : 40 Text { id : _usbFileNameText + clip : true width : _contentRect.columnWidthFileName text : fileName color : Colors.textMain @@ -333,6 +455,7 @@ height: parent.height + _usbFolderColumn.spacing } Text { id : _usbFileSizeText + clip : true width : _contentRect.columnWidthFileSize text : Variables.sizeConverted( fileSize, 1000, 3) color : Colors.textMain Index: sources/model/hd/alarm/MAlarmMapping.cpp =================================================================== diff -u -r6f2622be80fcaee8d71baf78404627381157970c -r7ebc073150532073ae7f1a0e768272bcff5d6fb3 --- sources/model/hd/alarm/MAlarmMapping.cpp (.../MAlarmMapping.cpp) (revision 6f2622be80fcaee8d71baf78404627381157970c) +++ sources/model/hd/alarm/MAlarmMapping.cpp (.../MAlarmMapping.cpp) (revision 7ebc073150532073ae7f1a0e768272bcff5d6fb3) @@ -7,7 +7,7 @@ * * \file MAlarmMapping.cpp * \author (last) Behrouz NematiPour - * \date (last) 03-Aug-2022 + * \date (last) 05-Aug-2022 * \author (original) Behrouz NematiPour * \date (original) 03-May-2021 * @@ -266,7 +266,7 @@ /*0230*/case GuiAlarmID::ALARM_ID_PRIME_DIALYSATE_BYPASS_TIME_OUT : { result = QObject::tr("HD prime dialysate bypass time out alarm." ); break; } /* 230*/ /*0231*/case GuiAlarmID::ALARM_ID_PRE_TREATMENT_DRY_PRESSURE_TEST_FAILURE : { result = QObject::tr("HD pre-treatment mode dry pressure self-test failure." ); break; } /* 231*/ /*0232*/case GuiAlarmID::ALARM_ID_PRE_TREATMENT_WET_LC_TEST_FAILURE : { result = QObject::tr("HD pre-treatment mode wet self-test LC vs LC failure." ); break; } /* 232*/ -/*0233*/case GuiAlarmID::ALARM_ID__AVAILABLE_8 : { result = QObject::tr("Alarm ID available for use." ); break; } /* 233*/ +/*0233*/case GuiAlarmID::ALARM_ID_DG_BAROMETRIC_SENSOR_COEFFS_BAD_CRC : { result = QObject::tr("DG barometric sensor coefficients bad CRC." ); break; } /* 233*/ /*0234*/case GuiAlarmID::ALARM_ID_RTC_RAM_OPS_ERROR : { result = QObject::tr("RTC (i.e read time) or RAM operations failure (read or write)." ); break; } /* 234*/ /*0235*/case GuiAlarmID::ALARM_ID_TREATMENT_STOPPED_AFTER_RINSEBACK : { result = QObject::tr("HD in treatment stopped sub-mode after rinseback completed (no escalation)." ); break; } /* 235*/ /*0236*/case GuiAlarmID::ALARM_ID_INSTALL_NEW_CARTRIDGE : { result = QObject::tr("HD needs new cartridge to be installed." ); break; } /* 236*/ Index: sources/storage/Logger.cpp =================================================================== diff -u -r3a528c6f3fce8132de2791b55d3227e715d68898 -r7ebc073150532073ae7f1a0e768272bcff5d6fb3 --- sources/storage/Logger.cpp (.../Logger.cpp) (revision 3a528c6f3fce8132de2791b55d3227e715d68898) +++ sources/storage/Logger.cpp (.../Logger.cpp) (revision 7ebc073150532073ae7f1a0e768272bcff5d6fb3) @@ -335,7 +335,7 @@ int result = 0; static QString mOSource; QString mDestination = USB_Mount_Point; - for ( const auto &iType : { eLogEvent, eLogDatum /*, eLogDebug*/ } ) { + for ( const auto &iType : { eLogEvent, eLogDatum } ) { QString mCSource = _logPathNames[iType]; // if the event and datum are mixed (mOSource == mCSource) in one file then no need to go over the same files in same folder and do it again. if (mOSource != mCSource) { @@ -349,31 +349,113 @@ } /*! + * \brief Logger::exportService + * \details Exports the service files from service folder (Storage::Log_Base_Path_Name_Location) + * into USB drive folder (Storage::USB_Mount_Point) + * \return true if at least one file has been exported + */ +bool Logger::exportErrs() +{ + // qDebug() << " ~~~~~~~~~~ " << QThread::currentThread()->objectName(); + int result = 0; + QString mDestination = USB_Mount_Point; + QString mSource = _logPathNames[eLogDebug]; + // Copy Folder + result = FileHandler::copyFolder( mSource, mDestination); + return result >= 0; // refer to QProcess::execute(hit F1 on execute) doc. +} + +/*! + * \brief Logger::exportTreatment + * \details Exports the treatment files from treatment folder (Storage::Log_Base_Path_Name_Location) + * into USB drive folder (Storage::USB_Mount_Point) + * \return true if at least one file has been exported + */ +bool Logger::exportTrts() +{ + // qDebug() << " ~~~~~~~~~~ " << QThread::currentThread()->objectName(); + int result = 0; + QString mDestination = USB_Mount_Point; + QString mSource = _logPathNames[eLogTrtmt]; + // Copy Folder + result = FileHandler::copyFolder( mSource, mDestination); + return result >= 0; // refer to QProcess::execute(hit F1 on execute) doc. +} + +/*! + * \brief Logger::concurrentExportTest + * \details Tests if a log is running + * \return if running return false + */ +bool Logger::concurrentExportIsOk() +{ + if ( _exportLogsWatcher.isRunning() ) { + LOG_DEBUG(QString("Export type of %1 is running").arg(_logNames[_exportLogsType])); + return false; + } + return true; +} + +/*! * \brief Logger::concurrentExportLogs * \details Export logs scheduler. * \return always returns true for now. * \note This method uses QtConcurrent run to execute the FileHandler copyFolder method. */ bool Logger::concurrentExportLogs() { - // disabled coco begin validated: This needs user interaction to export to USB device - // has been tested manually - LOG_DEBUG("Export Logs Start"); - QFuture future = QtConcurrent::run(this, &Logger::exportLogs); + if ( ! concurrentExportIsOk() ) return false; + + _exportLogsType = eLogEvent; + LOG_DEBUG(QString("Export %1 start").arg(_logNames[_exportLogsType])); + QFuture future = QtConcurrent::run(this, &Logger::exportLogs); _exportLogsWatcher.setFuture(future); return true; } -// disabled coco end /*! + * \brief Logger::concurrentExportLogs + * \details Export logs scheduler. + * \return always returns true for now. + * \note This method uses QtConcurrent run to execute the FileHandler copyFolder method. + */ +bool Logger::concurrentExportErrs() +{ + if ( ! concurrentExportIsOk() ) return false; + + _exportLogsType = eLogDebug; + LOG_DEBUG(QString("Export %1 start").arg(_logNames[_exportLogsType])); + QFuture future = QtConcurrent::run(this, &Logger::exportErrs); + _exportLogsWatcher.setFuture(future); + return true; +} + +/*! + * \brief Logger::concurrentExportLogs + * \details Export logs scheduler. + * \return always returns true for now. + * \note This method uses QtConcurrent run to execute the FileHandler copyFolder method. + */ +bool Logger::concurrentExportTrts() +{ + if ( ! concurrentExportIsOk() ) return false; + + _exportLogsType = eLogTrtmt; + LOG_DEBUG(QString("Export %1 start").arg(_logNames[_exportLogsType])); + QFuture future = QtConcurrent::run(this, &Logger::exportTrts); + _exportLogsWatcher.setFuture(future); + return true; +} + +/*! * \brief Logger::onExportLogs * \details Export log notification slot which logs result of export. */ void Logger::onExportLogs() { // disabled coco begin validated: This needs user interaction to export to USB device // has been tested manually - LOG_DEBUG(QString("Export Logs Ended: %1").arg(_exportLogsWatcher.result())); + LOG_DEBUG(QString("Export %1 ended: %2").arg(_logNames[_exportLogsType]).arg(_exportLogsWatcher.result())); emit didExportLogs(); } // disabled coco end Index: sources/storage/Logger.h =================================================================== diff -u -r627b97843f87f5ca8fbd731c6c4a6d9fae4352ce -r7ebc073150532073ae7f1a0e768272bcff5d6fb3 --- sources/storage/Logger.h (.../Logger.h) (revision 627b97843f87f5ca8fbd731c6c4a6d9fae4352ce) +++ sources/storage/Logger.h (.../Logger.h) (revision 7ebc073150532073ae7f1a0e768272bcff5d6fb3) @@ -26,7 +26,9 @@ // Define #define _Logger Storage::Logger::I() -#define LOG_EXPORT _Logger.concurrentExportLogs() +#define LOG_EXPORTLOG _Logger.concurrentExportLogs() +#define LOG_EXPORTERR _Logger.concurrentExportErrs() +#define LOG_EXPORTTRT _Logger.concurrentExportTrts() #define ADD_EVENT_HEADER emit Storage::Logger::I().didLog(_headerE, Storage::Logger::LogType::eLogEvent, false) #define LOG_EVENT(vCONTENT) emit Storage::Logger::I().didLog(vCONTENT, Storage::Logger::LogType::eLogEvent, true ) @@ -80,6 +82,8 @@ public : enum LogType { + eLogNone = -1, + eLogDebug, ///< Application Error : CANBus messages does not have error it's Event/Data only eLogEvent, ///< Massages on the CANBus : Error is an event type @@ -109,6 +113,12 @@ { LogType::eLogDebug, "" }, // it has its own file and all the content is Error }; + const QHash _logNames { // Will be used for the logging in the file + { LogType::eLogEvent, "Log" }, + { LogType::eLogDatum, "Service" }, + { LogType::eLogDebug, "Treatment" }, // it has its own file and all the content is Error + }; + const QHash _logFileNameExt { { LogType::eLogEvent, ".log" }, #ifdef MIXED_EVENT_DATUM @@ -147,6 +157,7 @@ QString _logFileName = ""; QMutex _logRemoveRunning; + LogType _exportLogsType = eLogNone; QFutureWatcher _exportLogsWatcher; QFutureWatcher _removeLogsWatcher; @@ -185,9 +196,14 @@ // ----- Export structure private : bool exportLogs(); + bool exportErrs(); + bool exportTrts(); public slots: // this slot is thread safe and can be called from outside by LOG_EXPORT. - bool concurrentExportLogs(); - void onExportLogs(); + bool concurrentExportIsOk (); + bool concurrentExportLogs (); + bool concurrentExportErrs (); + bool concurrentExportTrts (); + void onExportLogs (); signals: void didExportLogs();