Index: denali.pro.user =================================================================== diff -u -rd2035a8728794afeefaa244bf8d1597926d945f5 -rbf645acccabb7b5a84801620c4f7fa0b0e6878e0 --- denali.pro.user (.../denali.pro.user) (revision d2035a8728794afeefaa244bf8d1597926d945f5) +++ denali.pro.user (.../denali.pro.user) (revision bf645acccabb7b5a84801620c4f7fa0b0e6878e0) @@ -1,6 +1,6 @@ - + EnvironmentId @@ -89,7 +89,7 @@ Desktop Qt 5.12.5 GCC 64bit Desktop Qt 5.12.5 GCC 64bit qt.qt5.5125.gcc_64_kit - 11 + 1 0 0 @@ -100,19 +100,12 @@ true - qmake - QtProjectManager.QMakeBuildStep - false false - false - false true - Make - Qt4ProjectManager.MakeStep false @@ -128,8 +121,6 @@ true - Make - Qt4ProjectManager.MakeStep true @@ -145,11 +136,11 @@ 2 false - Debug Debug Qt4ProjectManager.Qt4BuildConfiguration 2 - true + 0 + 2 true @@ -159,17 +150,12 @@ true - qmake - QtProjectManager.QMakeBuildStep - false false true - Make - Qt4ProjectManager.MakeStep false @@ -185,8 +171,6 @@ true - Make - Qt4ProjectManager.MakeStep true @@ -202,11 +186,11 @@ 2 false - Release Release Qt4ProjectManager.Qt4BuildConfiguration 0 - true + 0 + 2 true @@ -216,19 +200,12 @@ true - qmake - QtProjectManager.QMakeBuildStep - false CONFIG+=tst_threads CONFIG+=CodeCoverage false - false - false true - Make - Qt4ProjectManager.MakeStep false @@ -241,35 +218,27 @@ %{buildDir}/denali %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true -m denali.csmes -t UnitTests denali.csexe cmcsexeimport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true --csmes=denali.csmes --html=Coverage/index cmreport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true --csmes=denali.csmes --csv-excel=Coverage/coverage.csv cmreport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep 6 @@ -280,8 +249,6 @@ true - Make - Qt4ProjectManager.MakeStep true @@ -299,11 +266,11 @@ PATH=/opt/SquishCoco/bin:/opt/SquishCoco/wrapper/bin:/opt/Qt5.12.5/5.12.5/gcc_64/bin:/usr/bin:/home/denali/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin - tst_threads tst_threads Qt4ProjectManager.Qt4BuildConfiguration 2 - true + 2 + 2 true @@ -313,19 +280,12 @@ true - qmake - QtProjectManager.QMakeBuildStep - false CONFIG+=tst_messaging CONFIG+=CodeCoverage false - false - false true - Make - Qt4ProjectManager.MakeStep false @@ -338,35 +298,27 @@ %{buildDir}/denali %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true -m denali.csmes -t UnitTests denali.csexe cmcsexeimport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true --csmes=denali.csmes --html=Coverage/index cmreport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true --csmes=denali.csmes --csv-excel=Coverage/coverage.csv cmreport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep 6 @@ -377,8 +329,6 @@ true - Make - Qt4ProjectManager.MakeStep true @@ -396,11 +346,11 @@ PATH=/opt/SquishCoco/bin:/opt/SquishCoco/wrapper/bin:/opt/Qt5.12.5/5.12.5/gcc_64/bin:/usr/bin:/home/denali/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin - tst_messaging tst_messaging Qt4ProjectManager.Qt4BuildConfiguration 2 - true + 2 + 2 true @@ -410,19 +360,12 @@ true - qmake - QtProjectManager.QMakeBuildStep - false true - false - false true - Make - Qt4ProjectManager.MakeStep false @@ -438,8 +381,6 @@ true - Make - Qt4ProjectManager.MakeStep true @@ -455,11 +396,11 @@ 2 false - Profile Profile Qt4ProjectManager.Qt4BuildConfiguration 0 - true + 2 + 2 true @@ -469,19 +410,12 @@ true - qmake - QtProjectManager.QMakeBuildStep - false CONFIG+=tst_canbus CONFIG+=CodeCoverage false - false - false true - Make - Qt4ProjectManager.MakeStep false @@ -494,35 +428,27 @@ %{buildDir}/denali %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true -m denali.csmes -t UnitTests denali.csexe cmcsexeimport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true --csmes=denali.csmes --html=Coverage/index cmreport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true --csmes=denali.csmes --csv-excel=Coverage/coverage.csv cmreport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep 6 @@ -533,8 +459,6 @@ true - Make - Qt4ProjectManager.MakeStep true @@ -552,11 +476,11 @@ PATH=/opt/SquishCoco/bin:/opt/SquishCoco/wrapper/bin:/opt/Qt5.12.5/5.12.5/gcc_64/bin:/usr/bin:/home/denali/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin - tst_canbus tst_canbus Qt4ProjectManager.Qt4BuildConfiguration 2 - true + 2 + 2 true @@ -566,19 +490,12 @@ true - qmake - QtProjectManager.QMakeBuildStep - false CONFIG+=tst_logging CONFIG+=CodeCoverage false - false - false true - Make - Qt4ProjectManager.MakeStep false @@ -591,35 +508,27 @@ %{buildDir}/denali %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true -m denali.csmes -t UnitTests denali.csexe cmcsexeimport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true --csmes=denali.csmes --html=Coverage/index cmreport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true --csmes=denali.csmes --csv-excel=Coverage/coverage.csv cmreport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep 6 @@ -630,8 +539,6 @@ true - Make - Qt4ProjectManager.MakeStep true @@ -649,11 +556,11 @@ PATH=/opt/SquishCoco/bin:/opt/SquishCoco/wrapper/bin:/opt/Qt5.12.5/5.12.5/gcc_64/bin:/usr/bin:/home/denali/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin - tst_logging tst_logging Qt4ProjectManager.Qt4BuildConfiguration 2 - true + 2 + 2 true @@ -663,17 +570,12 @@ true - qmake - QtProjectManager.QMakeBuildStep - false CONFIG+=tst_utilities CONFIG+=CodeCoverage false true - Make - Qt4ProjectManager.MakeStep false @@ -686,35 +588,27 @@ %{buildDir}/denali %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true -m denali.csmes -t UnitTests denali.csexe cmcsexeimport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true --csmes=denali.csmes --html=Coverage/index cmreport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true --csmes=denali.csmes --csv-excel=Coverage/coverage.csv cmreport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep 6 @@ -725,8 +619,6 @@ true - Make - Qt4ProjectManager.MakeStep true @@ -744,11 +636,11 @@ PATH=/opt/SquishCoco/bin:/opt/SquishCoco/wrapper/bin:/opt/Qt5.12.5/5.12.5/gcc_64/bin:/usr/bin:/home/denali/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin - tst_utilities tst_utilities Qt4ProjectManager.Qt4BuildConfiguration 2 - true + 2 + 2 true @@ -758,17 +650,12 @@ true - qmake - QtProjectManager.QMakeBuildStep - false CONFIG+=tst_acknow CONFIG+=CodeCoverage false true - Make - Qt4ProjectManager.MakeStep false @@ -781,35 +668,27 @@ %{buildDir}/denali %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true -m denali.csmes -t UnitTests denali.csexe cmcsexeimport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true --csmes=denali.csmes --html=Coverage/index cmreport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true --csmes=denali.csmes --csv-excel=Coverage/coverage.csv cmreport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep 6 @@ -820,8 +699,6 @@ true - Make - Qt4ProjectManager.MakeStep true @@ -839,11 +716,11 @@ PATH=/opt/SquishCoco/bin:/opt/SquishCoco/wrapper/bin:/opt/Qt5.12.5/5.12.5/gcc_64/bin:/usr/bin:/home/denali/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin - tst_acknow tst_acknow Qt4ProjectManager.Qt4BuildConfiguration 2 - true + 2 + 2 true @@ -853,19 +730,12 @@ true - qmake - QtProjectManager.QMakeBuildStep - false CONFIG+=tst_models CONFIG+=CodeCoverage false - false - false true - Make - Qt4ProjectManager.MakeStep false @@ -878,35 +748,27 @@ %{buildDir}/denali %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true -m denali.csmes -t UnitTests denali.csexe cmcsexeimport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true --csmes=denali.csmes --html=Coverage/index cmreport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true --csmes=denali.csmes --csv-excel=Coverage/coverage.csv cmreport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep 6 @@ -917,8 +779,6 @@ true - Make - Qt4ProjectManager.MakeStep true @@ -936,11 +796,11 @@ PATH=/opt/SquishCoco/bin:/opt/SquishCoco/wrapper/bin:/opt/Qt5.12.5/5.12.5/gcc_64/bin:/usr/bin:/home/denali/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin - tst_models tst_models Qt4ProjectManager.Qt4BuildConfiguration 2 - true + 2 + 2 true @@ -950,19 +810,12 @@ true - qmake - QtProjectManager.QMakeBuildStep - false CONFIG+=tst_initializations CONFIG+=CodeCoverage false - false - false true - Make - Qt4ProjectManager.MakeStep false @@ -975,35 +828,27 @@ %{buildDir}/denali %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true -m denali.csmes -t UnitTests denali.csexe cmcsexeimport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true --csmes=denali.csmes --html=Coverage/index cmreport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true --csmes=denali.csmes --csv-excel=Coverage/coverage.csv cmreport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep 6 @@ -1014,8 +859,6 @@ true - Make - Qt4ProjectManager.MakeStep true @@ -1033,11 +876,11 @@ PATH=/opt/SquishCoco/bin:/opt/SquishCoco/wrapper/bin:/opt/Qt5.12.5/5.12.5/gcc_64/bin:/usr/bin:/home/denali/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin - tst_initializations tst_initializations Qt4ProjectManager.Qt4BuildConfiguration 2 - true + 2 + 2 true @@ -1047,19 +890,12 @@ true - qmake - QtProjectManager.QMakeBuildStep - false CONFIG+=tst_views CONFIG+=CodeCoverage false - false - false true - Make - Qt4ProjectManager.MakeStep false @@ -1072,35 +908,27 @@ %{buildDir}/denali %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true -m denali.csmes -t UnitTests denali.csexe cmcsexeimport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true --csmes=denali.csmes --html=Coverage/index cmreport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true --csmes=denali.csmes --csv-excel=Coverage/coverage.csv cmreport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep 6 @@ -1111,8 +939,6 @@ true - Make - Qt4ProjectManager.MakeStep true @@ -1130,11 +956,11 @@ PATH=/opt/SquishCoco/bin:/opt/SquishCoco/wrapper/bin:/opt/Qt5.12.5/5.12.5/gcc_64/bin:/usr/bin:/home/denali/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin - tst_views tst_views Qt4ProjectManager.Qt4BuildConfiguration 2 - true + 2 + 2 12 @@ -1145,8 +971,8 @@ ProjectExplorer.BuildSteps.Deploy 1 - Deploy Configuration - + + false ProjectExplorer.DefaultDeployConfiguration 1 @@ -1158,6 +984,14 @@ 250 + + -e + cpu-cycles + --call-graph + dwarf,4096 + -F + 250 + -F true 4096 @@ -1206,15 +1040,16 @@ Qt4ProjectManager.Qt4RunConfiguration:/home/denali/Projects/application/denali.pro /home/denali/Projects/application/denali.pro - 3768 + false + false true true false false true - /home/denali/Projects/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Debug + /home/denali/Projects/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Release 1 @@ -1236,19 +1071,12 @@ true - qmake - QtProjectManager.QMakeBuildStep - false false - false - false true - Make - Qt4ProjectManager.MakeStep false @@ -1264,8 +1092,6 @@ true - Make - Qt4ProjectManager.MakeStep true @@ -1281,11 +1107,11 @@ 2 false - Debug Debug Qt4ProjectManager.Qt4BuildConfiguration 2 - true + 2 + 2 true @@ -1295,19 +1121,12 @@ true - qmake - QtProjectManager.QMakeBuildStep - false false - false - false true - Make - Qt4ProjectManager.MakeStep false @@ -1323,8 +1142,6 @@ true - Make - Qt4ProjectManager.MakeStep true @@ -1340,11 +1157,11 @@ 2 false - Release Release Qt4ProjectManager.Qt4BuildConfiguration 0 - true + 2 + 2 true @@ -1354,17 +1171,12 @@ true - qmake - QtProjectManager.QMakeBuildStep - false false true - Make - Qt4ProjectManager.MakeStep false @@ -1380,8 +1192,6 @@ true - Make - Qt4ProjectManager.MakeStep true @@ -1397,19 +1207,17 @@ 2 false - Profile Profile Qt4ProjectManager.Qt4BuildConfiguration 0 - true + 2 + 2 3 true - Check for free disk space - RemoteLinux.CheckForFreeDiskSpaceStep @@ -1422,8 +1230,6 @@ true - Kill current application instance - RemoteLinux.KillAppStep @@ -1434,8 +1240,6 @@ true - Deploy files via rsync - RemoteLinux.RsyncDeployStep @@ -1452,8 +1256,8 @@ ProjectExplorer.BuildSteps.Deploy 1 - Deploy to Remote Linux Host - + + false DeployToGenericLinux 1 @@ -1465,6 +1269,14 @@ 250 + + -e + cpu-cycles + --call-graph + dwarf,4096 + -F + 250 + -F true 4096 @@ -1517,7 +1329,8 @@ false - 3768 + false + false true false Index: sources/canbus/messagedispatcher.cpp =================================================================== diff -u -rd2035a8728794afeefaa244bf8d1597926d945f5 -rbf645acccabb7b5a84801620c4f7fa0b0e6878e0 --- sources/canbus/messagedispatcher.cpp (.../messagedispatcher.cpp) (revision d2035a8728794afeefaa244bf8d1597926d945f5) +++ sources/canbus/messagedispatcher.cpp (.../messagedispatcher.cpp) (revision bf645acccabb7b5a84801620c4f7fa0b0e6878e0) @@ -1,16 +1,16 @@ /*! - * + * * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. * \copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. - * + * * \file messagedispatcher.cpp * \author (last) Peter Lucia * \date (last) 29-Jun-2020 * \author (original) Behrouz NematiPour * \date (original) 09-Dec-2019 - * + * */ #include "messagedispatcher.h" @@ -301,6 +301,7 @@ } QByteArray mData; + if (! _interpreter.interpretMessage(vActionId, vData, mData)) { LOG_DEBUG(QString("Incorrect Message, can't be interpreted, %1").arg(Format::toHexString(vActionId))); // TODO : LOGGINF IMPROVEMENT return; @@ -318,10 +319,13 @@ #endif } + // coco begin validated: Has been tested manyally but in this function this can't be false because the message interpreter is doing the same validation. + // still checking here in case the logic has changed therefore buildFrame should still validate the message for developer safety. if ( ! _builder.buildFrames(vActionId, mData, frameList, mSequence) ) { LOG_DEBUG(QString("Incorrect Message can't be built")); // TODO : LOGGINF IMPROVEMENT return; } + // coco end if (mNeedsAcknow) { // NOTE : here vSequence should be used which is not negative // because when we get the Acknow it is not the negative Index: sources/canbus/messageinterpreter.cpp =================================================================== diff -u -r61d776c2405c22848f1182cba903477d44e7163f -rbf645acccabb7b5a84801620c4f7fa0b0e6878e0 --- sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision 61d776c2405c22848f1182cba903477d44e7163f) +++ sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision bf645acccabb7b5a84801620c4f7fa0b0e6878e0) @@ -49,13 +49,17 @@ bool MessageInterpreter::notify(const Message &vMessage, QVariantList &vData, Gui::GuiActionType vIdCheck) { bool ok = false; - TModel mModel; + TModel tModel; if ( ! isValidMessage(vMessage, vIdCheck) ) return ok; - ok = mModel.fromByteArray(vMessage.data); - mModel.toVariantList(vData); - if ( ! ok ) return false; - emit didActionReceive(mModel.data()); - logReceivedMessage(mModel); + ok = tModel.fromByteArray(vMessage.data); + tModel.toVariantList(vData); + // coco begin validated : Tested manually. This code will never go false + // because the isValidMessage is catching errors. + // only is checking here for developer safty if logic has changed. + if ( ! ok ) return false; + // coco end + emit didActionReceive(tModel.data()); + logReceivedMessage(tModel); DEBUG_RECEIVE_SIGNAL(vIdCheck, typeid(TModel).name()) return ok; } @@ -178,18 +182,18 @@ int count = vData.length(); switch (vActionId) { // notice we are in transmit mode - case Gui::GuiActionType::ID_Acknow: + case Gui::GuiActionType::ID_Acknow: // len: 0, can have zero len break; // No data, Just registered - case Gui::GuiActionType::ID_KeepAlive: + case Gui::GuiActionType::ID_KeepAlive: // len: 255, can have any len if ( count ) { // this message has a variable length vPayload = Format::fromVariant(vData[0]); } LOG_EVENT(mSenderID + QString("CheckIn")); break; - case Gui::GuiActionType::ID_RawData: + case Gui::GuiActionType::ID_RawData: // len: 255, can have any len if ( count ) { // this message has a variable length vPayload = Format::fromVariant(vData[0]); } @@ -269,14 +273,12 @@ case eChlid_HD_Alarm: case eChlid_HD_Sync : ok = interpretMessage_HD(vMessage, vData); break; - // coco-begin-validated: Is a placeholder and There is no definition/implementation of DG communication with UI. case eChlid_DG_UI : - case eChlid_DG_Alarm: + // case eChlid_DG_Alarm: // commented out for now. Currentlyh there is no message in this category. case eChlid_DG_Sync : ok = interpretMessage_DG(vMessage, vData); break; default: break; - // coco-end } return ok; } @@ -437,14 +439,6 @@ emit didActionReceive(mData.data()); return ok; - - // --- an example of unit test --- // - // Types::Flags flag; - // int i = 0; - // QByteArray ba; - // ba += 0x83; ba += 0xf8; ba += 0x28; ba += 0xa1; - // Types::getBits(ba, i, flag, 32); - // qDebug() << '@' << flag << flag.toString() << ba; } /*! Index: sources/gui/qml/components/NotificationBar.qml =================================================================== diff -u -r44a85c96ab55e424866ec4cca0270aa218355f82 -rbf645acccabb7b5a84801620c4f7fa0b0e6878e0 --- sources/gui/qml/components/NotificationBar.qml (.../NotificationBar.qml) (revision 44a85c96ab55e424866ec4cca0270aa218355f82) +++ sources/gui/qml/components/NotificationBar.qml (.../NotificationBar.qml) (revision bf645acccabb7b5a84801620c4f7fa0b0e6878e0) @@ -1,16 +1,16 @@ /*! - * + * * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. * \copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. - * + * * \file NotificationBar.qml * \author (last) Peter Lucia * \date (last) 01-Jul-2020 * \author (original) Behrouz NematiPour * \date (original) 30-Mar-2020 - * + * */ // Qt @@ -30,6 +30,16 @@ property int muteTimeoutSec : 0 property color backgroundColor : Colors.textNotificationNoneBg + visible : _text.text + height : Variables.notificationHeight + color : Colors.textNotificationNoneBg + //radius : Variables.dialogRadius + anchors { + bottom : parent.bottom + left : parent.left + right : parent.right + } + signal clickedNotificationBar() function toggleSilence(silence, timeoutSec) { @@ -38,6 +48,10 @@ _bell.source = isSilenced ? "qrc:/images/bell-off.svg" : "qrc:/images/bell.svg" } + function setFlashing(enable) { + _timer.running = enable; + } + // Placeholder animation Timer { id: _timer @@ -50,21 +64,6 @@ } } - function setFlashing(enable) { - _timer.running = enable; - } - - visible : _text.text - - height : Variables.notificationHeight - color : Colors.textNotificationNoneBg - //radius : Variables.dialogRadius - anchors { - bottom : parent.bottom - left : parent.left - right : parent.right - } - Image { id: _icon source: "qrc:/images/alarm.svg" Index: sources/gui/qml/dialogs/NotificationDialog.qml =================================================================== diff -u -r44a85c96ab55e424866ec4cca0270aa218355f82 -rbf645acccabb7b5a84801620c4f7fa0b0e6878e0 --- sources/gui/qml/dialogs/NotificationDialog.qml (.../NotificationDialog.qml) (revision 44a85c96ab55e424866ec4cca0270aa218355f82) +++ sources/gui/qml/dialogs/NotificationDialog.qml (.../NotificationDialog.qml) (revision bf645acccabb7b5a84801620c4f7fa0b0e6878e0) @@ -1,16 +1,16 @@ /*! - * + * * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. * \copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. - * + * * \file NotificationDialog.qml * \author (last) Peter Lucia * \date (last) 26-Jun-2020 * \author (original) Peter Lucia * \date (original) 02-Jun-2020 - * + * */ // Qt @@ -25,6 +25,8 @@ * \brief Contains the PowerOff Dialog Implementation */ ModalDialog { id : _root + contentItem.objectName: "_NotificationDialog" // SquishQt + property alias titleText : _title.text; property alias description : _desc.text; property alias titleBarForeground : _title.color @@ -33,8 +35,9 @@ property alias dismissBtn : _dismiss; property bool isSilenced : false; property int alarmID : -1 - objectName: "_notification_dialog" // SquishQt + visible: description + signal clickedSilence(); signal clickedOkay(); @@ -77,8 +80,8 @@ anchors.centerIn: _titleBar; } } - Text { - id: _desc + Text { id: _desc + objectName: "_NotificationDialog_Description" color: Colors.textMain font.pixelSize: Fonts.fontPixelButton anchors { Index: sources/gui/qml/pages/SettingsHome.qml =================================================================== diff -u -r93b6ad6b18c505fedab37d95dc87be61db48641c -rbf645acccabb7b5a84801620c4f7fa0b0e6878e0 --- sources/gui/qml/pages/SettingsHome.qml (.../SettingsHome.qml) (revision 93b6ad6b18c505fedab37d95dc87be61db48641c) +++ sources/gui/qml/pages/SettingsHome.qml (.../SettingsHome.qml) (revision bf645acccabb7b5a84801620c4f7fa0b0e6878e0) @@ -195,6 +195,7 @@ "%" + vTreatmentUltrafiltration.ultrafiltration_PWMDtCycle .toFixed(2) ] Text { + objectName: "_OutletFlowData" + index text: modelData width: _DialysateOutletFlowColumn.width horizontalAlignment: Text.AlignRight Index: sources/model/hd/alarm/MAlarmStatusData.cpp =================================================================== diff -u -r93b6ad6b18c505fedab37d95dc87be61db48641c -rbf645acccabb7b5a84801620c4f7fa0b0e6878e0 --- sources/model/hd/alarm/MAlarmStatusData.cpp (.../MAlarmStatusData.cpp) (revision 93b6ad6b18c505fedab37d95dc87be61db48641c) +++ sources/model/hd/alarm/MAlarmStatusData.cpp (.../MAlarmStatusData.cpp) (revision bf645acccabb7b5a84801620c4f7fa0b0e6878e0) @@ -23,16 +23,16 @@ return QString(stringPrefix + ",%1,%2,%3,%4,%5") .arg(_data.mState .value ) .arg(_data.mTop .value ) - .arg(_data.mMuteTimeout .value ) .arg(_data.mEscalatesIn .value ) + .arg(_data.mMuteTimeout .value ) .arg(_data.mFlags .toString("")); } void MAlarmStatus::toVariantList(QVariantList &vData) const { vData += _data.mState .value ; vData += _data.mTop .value ; - vData += _data.mMuteTimeout .value ; vData += _data.mEscalatesIn .value ; + vData += _data.mMuteTimeout .value ; for (int i = 0; i < _data.mFlags.count(); i++) { vData += _data.mFlags.at(i); } @@ -42,8 +42,8 @@ int index = 0; // message data start position if (GetValue(vByteArray, index, _data.mState )) if (GetValue(vByteArray, index, _data.mTop )) - if (GetValue(vByteArray, index, _data.mMuteTimeout )) if (GetValue(vByteArray, index, _data.mEscalatesIn )) + if (GetValue(vByteArray, index, _data.mMuteTimeout )) if (GetBits (vByteArray, index, _data.mFlags , eFlag_Bits_Length)) return true ; else { if(vIndex) *vIndex = index; return false; } @@ -57,8 +57,8 @@ Data data; data.mState = _data.mState .value; data.mTop = _data.mTop .value; - data.mMuteTimeout = _data.mMuteTimeout .value; data.mEscalatesIn = _data.mEscalatesIn .value; + data.mMuteTimeout = _data.mMuteTimeout .value; data.mFlags = _data.mFlags ; return data; } @@ -73,67 +73,69 @@ QString result; switch (vAlarmID) { - case GuiAlarmID::ALARM_ID_NO_ALARM: { result = QObject::tr(""); break; } - case GuiAlarmID::ALARM_ID_SOFTWARE_FAULT: { result = QObject::tr("Software Error."); break; } - case GuiAlarmID::ALARM_ID_STUCK_BUTTON_TEST_FAILED: { result = QObject::tr("Indication for when no alarms is a possible situation."); break; } - case GuiAlarmID::ALARM_ID_FPGA_POST_TEST_FAILED: { result = QObject::tr("FPGA POST failure."); break; } - case GuiAlarmID::ALARM_ID_WATCHDOG_POST_TEST_FAILED: { result = QObject::tr("Watchdog POST failure."); break; } - case GuiAlarmID::ALARM_ID_UI_COMM_POST_FAILED: { result = QObject::tr("UI communication POST failure."); break; } - case GuiAlarmID::ALARM_ID_BLOOD_PUMP_MC_CURRENT_CHECK: { result = QObject::tr("Blood pump failed motor controller current check."); break; } - case GuiAlarmID::ALARM_ID_BLOOD_PUMP_OFF_CHECK: { result = QObject::tr("Blood pump failed motor off check. \nMeasured speed while commanded off."); break; } - case GuiAlarmID::ALARM_ID_BLOOD_PUMP_MC_DIRECTION_CHECK: { result = QObject::tr("Blood pump failed motor controller direction check."); break; } - case GuiAlarmID::ALARM_ID_BLOOD_PUMP_ROTOR_SPEED_CHECK: { result = QObject::tr("Blood pump failed rotor speed check."); break; } - case GuiAlarmID::ALARM_ID_DIAL_IN_PUMP_MC_CURRENT_CHECK: { result = QObject::tr("Dialysis inlet pump failed motor controller current check."); break; } - case GuiAlarmID::ALARM_ID_DIAL_IN_PUMP_OFF_CHECK: { result = QObject::tr("Dialysis inlet pump failed motor off check. \nMeasured speed while commanded off."); break; } - case GuiAlarmID::ALARM_ID_DIAL_IN_PUMP_MC_DIRECTION_CHECK: { result = QObject::tr("Dialysis inlet pump failed motor controller direction check."); break; } - case GuiAlarmID::ALARM_ID_DIAL_IN_PUMP_ROTOR_SPEED_CHECK: { result = QObject::tr("Dialysis inlet pump failed rotor speed check."); break; } - case GuiAlarmID::ALARM_ID_DIAL_OUT_PUMP_MC_CURRENT_CHECK: { result = QObject::tr("Dialysis outlet pump failed motor controller current check."); break; } - case GuiAlarmID::ALARM_ID_DIAL_OUT_PUMP_OFF_CHECK: { result = QObject::tr("Dialysis outlet pump failed motor off check. \nMeasured speed while commanded off."); break; } - case GuiAlarmID::ALARM_ID_DIAL_OUT_PUMP_MC_DIRECTION_CHECK: { result = QObject::tr("Dialysis outlet pump failed motor controller direction check."); break; } - case GuiAlarmID::ALARM_ID_DIAL_OUT_PUMP_ROTOR_SPEED_CHECK: { result = QObject::tr("Dialysis outlet pump failed rotor speed check."); break; } - case GuiAlarmID::ALARM_ID_WATCHDOG_EXPIRED: { result = QObject::tr("Watchdog expired error."); break; } - case GuiAlarmID::ALARM_ID_RTC_COMM_ERROR: { result = QObject::tr("Real-time clock communication error."); break; } - case GuiAlarmID::ALARM_ID_RTC_CONFIG_ERROR: { result = QObject::tr("Real-time clock configuration error."); break; } - case GuiAlarmID::ALARM_ID_DG_COMM_TIMEOUT: { result = QObject::tr("Dialysate generator communication timeout."); break; } - case GuiAlarmID::ALARM_ID_UI_COMM_TIMEOUT: { result = QObject::tr("User interface communication timeout."); break; } - case GuiAlarmID::ALARM_ID_COMM_TOO_MANY_BAD_CRCS: { result = QObject::tr("Too many bad CRCs detected on received system messages."); break; } - case GuiAlarmID::ALARM_ID_TREATMENT_STOPPED_BY_USER: { result = QObject::tr("Treatment stopped by user action - pressed stop button."); break; } - case GuiAlarmID::ALARM_ID_BLOOD_SITTING_WARNING: { result = QObject::tr("Blood sitting too long warning (>4 min)."); break; } - case GuiAlarmID::ALARM_ID_BLOOD_SITTING_TOO_LONG_NO_RESUME: { result = QObject::tr("Blood sitting too long alarm (>5 min)."); break; } - case GuiAlarmID::ALARM_ID_BLOOD_SITTING_TOO_LONG_NO_RINSEBACK: { result = QObject::tr("Blood sitting too long alarm (>10 min)."); break; } - case GuiAlarmID::ALARM_ID_CAN_MESSAGE_NOT_ACKED: { result = QObject::tr("System message needing acknowledgment was not acknowledged."); break; } - case GuiAlarmID::ALARM_ID_OCCLUSION_BLOOD_PUMP: { result = QObject::tr("Blood pump occlusion detected."); break; } - case GuiAlarmID::ALARM_ID_OCCLUSION_DIAL_IN_PUMP: { result = QObject::tr("Dialysate inlet pump occlusion detected."); break; } - case GuiAlarmID::ALARM_ID_OCCLUSION_DIAL_OUT_PUMP: { result = QObject::tr("Dialysate outlet pump occlusion detected."); break; } - case GuiAlarmID::ALARM_ID_ARTERIAL_PRESSURE_LOW: { result = QObject::tr("Arterial pressure too low during treatment."); break; } - case GuiAlarmID::ALARM_ID_ARTERIAL_PRESSURE_HIGH: { result = QObject::tr("Arterial pressure too high during treatment."); break; } - case GuiAlarmID::ALARM_ID_VENOUS_PRESSURE_LOW: { result = QObject::tr("Venous pressure too low during treatment."); break; } - case GuiAlarmID::ALARM_ID_VENOUS_PRESSURE_HIGH: { result = QObject::tr("Venous pressure too high during treatment."); break; } - case GuiAlarmID::ALARM_ID_UF_RATE_TOO_HIGH_ERROR: { result = QObject::tr("Ultrafiltration rate is too high error during treatment."); break; } - case GuiAlarmID::ALARM_ID_UF_VOLUME_ACCURACY_ERROR: { result = QObject::tr("Ultrafiltration volume accuracy error during treatment."); break; } - case GuiAlarmID::ALARM_ID_RTC_BATTERY_LOW: { result = QObject::tr("RTC battery low."); break; } - case GuiAlarmID::ALARM_ID_RTC_OR_TIMER_ACCURACY_FAILURE: { result = QObject::tr("RTC or MCU timer inaccurate."); break; } - case GuiAlarmID::ALARM_ID_RTC_RAM_OPS_ERROR: { result = QObject::tr("RTC or RAM operations failure (read or write)."); break; } - case GuiAlarmID::ALARM_ID_NVDATA_EEPROM_OPS_FAILURE: { result = QObject::tr("EEPRON operations (read, write, erase) failure."); break; } - case GuiAlarmID::ALARM_ID_NVDATA_MFG_RECORD_CRC_ERROR: { result = QObject::tr("Manufacturing record CRC failure."); break; } - case GuiAlarmID::ALARM_ID_NVDATA_SRVC_RECORD_CRC_ERROR: { result = QObject::tr("Service record CRC failure."); break; } - case GuiAlarmID::ALARM_ID_NVDATA_CAL_RECORD_CRC_ERROR: { result = QObject::tr("Calibration record CRC failure."); break; } - case GuiAlarmID::ALARM_ID_NVDATA_HW_USAGE_DATA_CRC_ERROR: { result = QObject::tr("HW usage data failure."); break; } - case GuiAlarmID::AlARM_ID_NVDATA_DISINFECTION_DATE_CRC_ERROR: { result = QObject::tr("Last disinfection date CRC error."); break; } - case GuiAlarmID::ALARM_ID_RO_PUMP_OUT_PRESSURE_OUT_OF_RANGE: { result = QObject::tr("Pressure at outlet of RO pump is out of range."); break; } - case GuiAlarmID::ALARM_ID_TEMPERATURE_SENSORS_OUT_OF_RANGE: { result = QObject::tr("DG temperature sensors ADC read out of range."); break; } - case GuiAlarmID::ALARM_ID_TEMPERATURE_SENSORS_INCONSISTENT: { result = QObject::tr("DG temperature sensors values are inconsistent."); break; } - case GuiAlarmID::ALARM_ID_HD_COMM_TIMEOUT: { result = QObject::tr("HD communication timeout."); break; } - case GuiAlarmID::ALARM_ID_VALVE_CONTROL_FAILURE: { result = QObject::tr("FPGA not accepting commanded valve states."); break; } - case GuiAlarmID::ALARM_ID_BLOOD_PUMP_FLOW_VS_MOTOR_SPEED_CHECK: { result = QObject::tr("Blood pump failed flow vs. motor speed check. \nMismatch with flow rate and rate implied by motor speed."); break; } - case GuiAlarmID::ALARM_ID_DIAL_IN_PUMP_FLOW_VS_MOTOR_SPEED_CHECK: { result = QObject::tr("Dialysate inlet pump failed flow vs. motor speed check. \nMismatch with flow rate and rate implied by motor speed."); break; } - case GuiAlarmID::ALARM_ID_DIAL_OUT_PUMP_FLOW_VS_MOTOR_SPEED_CHECK: { result = QObject::tr("Dialysate outlet pump failed flow vs. motor speed check. \nMismatch with flow rate and rate implied by motor speed."); break; } - case GuiAlarmID::ALARM_ID_BLOOD_PUMP_MOTOR_SPEED_CHECK: { result = QObject::tr("Blood pump failed motor speed check. Measured vs. commanded."); break; } - case GuiAlarmID::ALARM_ID_DIAL_IN_PUMP_MOTOR_SPEED_CHECK: { result = QObject::tr("Dialysate inlet pump failed motor speed check. Measured vs. commanded."); break; } - case GuiAlarmID::ALARM_ID_DIAL_OUT_PUMP_MOTOR_SPEED_CHECK: { result = QObject::tr("Dialysate outlet pump failed motor speed check. Measured vs. commanded."); break; } - case GuiAlarmID::ALARM_ID_BLOOD_PUMP_ROTOR_SPEED_TOO_HIGH: { result = QObject::tr("Blood pump rotor speed too high."); break; } - case GuiAlarmID::ALARM_ID_INLET_WATER_TEMPERATURE_OUT_OF_RANGE: { result = QObject::tr("Intel water temperature out of range."); break; } - default: { result = QObject::tr("Alarm Not Recognized."); break; } + case GuiAlarmID::ALARM_ID_NO_ALARM: { result = QObject::tr("" ); break; } + case GuiAlarmID::ALARM_ID_HD_SOFTWARE_FAULT: { result = QObject::tr("Software Error." ); break; } + case GuiAlarmID::ALARM_ID_STUCK_BUTTON_TEST_FAILED: { result = QObject::tr("Indication for when no alarms is a possible situation." ); break; } + case GuiAlarmID::ALARM_ID_FPGA_POST_TEST_FAILED: { result = QObject::tr("FPGA POST failure." ); break; } + case GuiAlarmID::ALARM_ID_WATCHDOG_POST_TEST_FAILED: { result = QObject::tr("Watchdog POST failure." ); break; } + case GuiAlarmID::ALARM_ID_UI_COMM_POST_FAILED: { result = QObject::tr("UI communication POST failure." ); break; } + case GuiAlarmID::ALARM_ID_BLOOD_PUMP_MC_CURRENT_CHECK: { result = QObject::tr("Blood pump failed motor controller current check." ); break; } + case GuiAlarmID::ALARM_ID_BLOOD_PUMP_OFF_CHECK: { result = QObject::tr("Blood pump failed motor off check. \nMeasured speed while commanded off." ); break; } + case GuiAlarmID::ALARM_ID_BLOOD_PUMP_MC_DIRECTION_CHECK: { result = QObject::tr("Blood pump failed motor controller direction check." ); break; } + case GuiAlarmID::ALARM_ID_BLOOD_PUMP_ROTOR_SPEED_CHECK: { result = QObject::tr("Blood pump failed rotor speed check." ); break; } + case GuiAlarmID::ALARM_ID_DIAL_IN_PUMP_MC_CURRENT_CHECK: { result = QObject::tr("Dialysis inlet pump failed motor controller current check." ); break; } + case GuiAlarmID::ALARM_ID_DIAL_IN_PUMP_OFF_CHECK: { result = QObject::tr("Dialysis inlet pump failed motor off check. \nMeasured speed while commanded off." ); break; } + case GuiAlarmID::ALARM_ID_DIAL_IN_PUMP_MC_DIRECTION_CHECK: { result = QObject::tr("Dialysis inlet pump failed motor controller direction check." ); break; } + case GuiAlarmID::ALARM_ID_DIAL_IN_PUMP_ROTOR_SPEED_CHECK: { result = QObject::tr("Dialysis inlet pump failed rotor speed check." ); break; } + case GuiAlarmID::ALARM_ID_DIAL_OUT_PUMP_MC_CURRENT_CHECK: { result = QObject::tr("Dialysis outlet pump failed motor controller current check." ); break; } + case GuiAlarmID::ALARM_ID_DIAL_OUT_PUMP_OFF_CHECK: { result = QObject::tr("Dialysis outlet pump failed motor off check. \nMeasured speed while commanded off." ); break; } + case GuiAlarmID::ALARM_ID_DIAL_OUT_PUMP_MC_DIRECTION_CHECK: { result = QObject::tr("Dialysis outlet pump failed motor controller direction check." ); break; } + case GuiAlarmID::ALARM_ID_DIAL_OUT_PUMP_ROTOR_SPEED_CHECK: { result = QObject::tr("Dialysis outlet pump failed rotor speed check." ); break; } + case GuiAlarmID::ALARM_ID_WATCHDOG_EXPIRED: { result = QObject::tr("Watchdog expired error." ); break; } + case GuiAlarmID::ALARM_ID_RTC_COMM_ERROR: { result = QObject::tr("Real-time clock communication error." ); break; } + case GuiAlarmID::ALARM_ID_RTC_CONFIG_ERROR: { result = QObject::tr("Real-time clock configuration error." ); break; } + case GuiAlarmID::ALARM_ID_DG_COMM_TIMEOUT: { result = QObject::tr("Dialysate generator communication timeout." ); break; } + case GuiAlarmID::ALARM_ID_UI_COMM_TIMEOUT: { result = QObject::tr("User interface communication timeout." ); break; } + case GuiAlarmID::ALARM_ID_COMM_TOO_MANY_BAD_CRCS: { result = QObject::tr("Too many bad CRCs detected on received system messages." ); break; } + case GuiAlarmID::ALARM_ID_TREATMENT_STOPPED_BY_USER: { result = QObject::tr("Treatment stopped by user action - pressed stop button." ); break; } + case GuiAlarmID::ALARM_ID_BLOOD_SITTING_WARNING: { result = QObject::tr("Blood sitting too long warning (>4 min)." ); break; } + case GuiAlarmID::ALARM_ID_BLOOD_SITTING_TOO_LONG_NO_RESUME: { result = QObject::tr("Blood sitting too long alarm (>5 min)." ); break; } + case GuiAlarmID::ALARM_ID_BLOOD_SITTING_TOO_LONG_NO_RINSEBACK: { result = QObject::tr("Blood sitting too long alarm (>10 min)." ); break; } + case GuiAlarmID::ALARM_ID_CAN_MESSAGE_NOT_ACKED: { result = QObject::tr("System message needing acknowledgment was not acknowledged." ); break; } + case GuiAlarmID::ALARM_ID_OCCLUSION_BLOOD_PUMP: { result = QObject::tr("Blood pump occlusion detected." ); break; } + case GuiAlarmID::ALARM_ID_OCCLUSION_DIAL_IN_PUMP: { result = QObject::tr("Dialysate inlet pump occlusion detected." ); break; } + case GuiAlarmID::ALARM_ID_OCCLUSION_DIAL_OUT_PUMP: { result = QObject::tr("Dialysate outlet pump occlusion detected." ); break; } + case GuiAlarmID::ALARM_ID_ARTERIAL_PRESSURE_LOW: { result = QObject::tr("Arterial pressure too low during treatment." ); break; } + case GuiAlarmID::ALARM_ID_ARTERIAL_PRESSURE_HIGH: { result = QObject::tr("Arterial pressure too high during treatment." ); break; } + case GuiAlarmID::ALARM_ID_VENOUS_PRESSURE_LOW: { result = QObject::tr("Venous pressure too low during treatment." ); break; } + case GuiAlarmID::ALARM_ID_VENOUS_PRESSURE_HIGH: { result = QObject::tr("Venous pressure too high during treatment." ); break; } + case GuiAlarmID::ALARM_ID_UF_RATE_TOO_HIGH_ERROR: { result = QObject::tr("Ultrafiltration rate is too high error during treatment." ); break; } + case GuiAlarmID::ALARM_ID_UF_VOLUME_ACCURACY_ERROR: { result = QObject::tr("Ultrafiltration volume accuracy error during treatment." ); break; } + case GuiAlarmID::ALARM_ID_RTC_BATTERY_LOW: { result = QObject::tr("RTC battery low." ); break; } + case GuiAlarmID::ALARM_ID_RTC_OR_TIMER_ACCURACY_FAILURE: { result = QObject::tr("RTC or MCU timer inaccurate." ); break; } + case GuiAlarmID::ALARM_ID_RTC_RAM_OPS_ERROR: { result = QObject::tr("RTC or RAM operations failure (read or write)." ); break; } + case GuiAlarmID::ALARM_ID_NVDATA_EEPROM_OPS_FAILURE: { result = QObject::tr("EEPRON operations (read, write, erase) failure." ); break; } + case GuiAlarmID::ALARM_ID_NVDATA_MFG_RECORD_CRC_ERROR: { result = QObject::tr("Manufacturing record CRC failure." ); break; } + case GuiAlarmID::ALARM_ID_NVDATA_SRVC_RECORD_CRC_ERROR: { result = QObject::tr("Service record CRC failure." ); break; } + case GuiAlarmID::ALARM_ID_NVDATA_CAL_RECORD_CRC_ERROR: { result = QObject::tr("Calibration record CRC failure." ); break; } + case GuiAlarmID::ALARM_ID_NVDATA_HW_USAGE_DATA_CRC_ERROR: { result = QObject::tr("HW usage data failure." ); break; } + case GuiAlarmID::AlARM_ID_NVDATA_DISINFECTION_DATE_CRC_ERROR: { result = QObject::tr("Last disinfection date CRC error." ); break; } + case GuiAlarmID::ALARM_ID_RO_PUMP_OUT_PRESSURE_OUT_OF_RANGE: { result = QObject::tr("Pressure at outlet of RO pump is out of range." ); break; } + case GuiAlarmID::ALARM_ID_TEMPERATURE_SENSORS_FAULT: { result = QObject::tr("DG temperature sensors fault." ); break; } + case GuiAlarmID::ALARM_ID_TEMPERATURE_SENSORS_INCONSISTENT: { result = QObject::tr("DG temperature sensors values are inconsistent." ); break; } + case GuiAlarmID::ALARM_ID_HD_COMM_TIMEOUT: { result = QObject::tr("HD communication timeout." ); break; } + case GuiAlarmID::ALARM_ID_VALVE_CONTROL_FAILURE: { result = QObject::tr("FPGA not accepting commanded valve states." ); break; } + case GuiAlarmID::ALARM_ID_BLOOD_PUMP_FLOW_VS_MOTOR_SPEED_CHECK: { result = QObject::tr("Blood pump failed flow vs. motor speed check. \nMismatch with flow rate and rate implied by motor speed." ); break; } + case GuiAlarmID::ALARM_ID_DIAL_IN_PUMP_FLOW_VS_MOTOR_SPEED_CHECK: { result = QObject::tr("Dialysate inlet pump failed flow vs. motor speed check. \nMismatch with flow rate and rate implied by motor speed." ); break; } + case GuiAlarmID::ALARM_ID_DIAL_OUT_PUMP_FLOW_VS_MOTOR_SPEED_CHECK: { result = QObject::tr("Dialysate outlet pump failed flow vs. motor speed check. \nMismatch with flow rate and rate implied by motor speed." ); break; } + case GuiAlarmID::ALARM_ID_BLOOD_PUMP_MOTOR_SPEED_CHECK: { result = QObject::tr("Blood pump failed motor speed check. Measured vs. commanded." ); break; } + case GuiAlarmID::ALARM_ID_DIAL_IN_PUMP_MOTOR_SPEED_CHECK: { result = QObject::tr("Dialysate inlet pump failed motor speed check. Measured vs. commanded." ); break; } + case GuiAlarmID::ALARM_ID_DIAL_OUT_PUMP_MOTOR_SPEED_CHECK: { result = QObject::tr("Dialysate outlet pump failed motor speed check. Measured vs. commanded." ); break; } + case GuiAlarmID::ALARM_ID_BLOOD_PUMP_ROTOR_SPEED_TOO_HIGH: { result = QObject::tr("Blood pump rotor speed too high." ); break; } + case GuiAlarmID::ALARM_ID_INLET_WATER_LOW_CONDUCTIVITY: { result = QObject::tr("Inlet water conductivity too low." ); break; } + default: + result = QObject::tr("ALARM_ID_UNDEFINED [%1]").arg(int(vAlarmID)); + break; } return result; } Index: sources/model/hd/alarm/MAlarmStatusData.h =================================================================== diff -u -r93b6ad6b18c505fedab37d95dc87be61db48641c -rbf645acccabb7b5a84801620c4f7fa0b0e6878e0 --- sources/model/hd/alarm/MAlarmStatusData.h (.../MAlarmStatusData.h) (revision 93b6ad6b18c505fedab37d95dc87be61db48641c) +++ sources/model/hd/alarm/MAlarmStatusData.h (.../MAlarmStatusData.h) (revision bf645acccabb7b5a84801620c4f7fa0b0e6878e0) @@ -20,9 +20,16 @@ #include "types.h" #include "guiglobals.h" +// forward declarations +class tst_models; + namespace Model { class MAlarmStatus { + + // friends + friend class ::tst_models; + public: enum Flag { eFlag_systemFault = 0 , @@ -41,17 +48,17 @@ struct Data { quint32 mState = 0; /*!< State - Alarm Priority value of type unsigned int as 4 bytes extracted out */ quint32 mTop = 0; /*!< Top - Top value of type unsigned int as 4 bytes extracted out */ - quint32 mMuteTimeout = 0; /*!< MuteTimeout - MuteTimeout value of type unsigned int as 4 bytes extracted out */ quint32 mEscalatesIn = 0; /*!< EscalatesIn - EscalatesIn value of type unsigned int as 4 bytes extracted out */ + quint32 mMuteTimeout = 0; /*!< MuteTimeout - MuteTimeout value of type unsigned int as 4 bytes extracted out */ QBitArray mFlags ; /*!< Flags - Flags value of type unsigned int as 1 byte extracted out */ }; private: struct { Types::U32 mState ; Types::U32 mTop ; - Types::U32 mMuteTimeout ; Types::U32 mEscalatesIn ; + Types::U32 mMuteTimeout ; Types::Flags mFlags ; } _data; Index: sources/storage/filehandler.cpp =================================================================== diff -u -rd2035a8728794afeefaa244bf8d1597926d945f5 -rbf645acccabb7b5a84801620c4f7fa0b0e6878e0 --- sources/storage/filehandler.cpp (.../filehandler.cpp) (revision d2035a8728794afeefaa244bf8d1597926d945f5) +++ sources/storage/filehandler.cpp (.../filehandler.cpp) (revision bf645acccabb7b5a84801620c4f7fa0b0e6878e0) @@ -1,16 +1,16 @@ /*! - * + * * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. * \copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. - * + * * \file filehandler.cpp * \author (last) Behrouz NematiPour * \date (last) 22-Apr-2020 * \author (original) Behrouz NematiPour * \date (original) 24-Sep-2019 - * + * */ #include "filehandler.h" @@ -49,8 +49,8 @@ QFile::OpenMode openMode = vAppend ? QFile::Text | QFile::Append : QFile::Text | QFile::WriteOnly; + // coco begin validated : This has been manually test. Needs filesystem access to make file the way it can't be opened for writing. if (! file.open(openMode)) { - // coco begin validated : This has been manually test. Needs filesystem access to make file the way it can't be opened for writing. QString msg = QString("Can't open file for write (%1).Possible corrupted file system").arg(vFileName); errOut (msg); LOG_DEBUG(msg); @@ -125,21 +125,19 @@ for (const auto &info : infoList) { QDateTime fileTime = info.lastModified(); QString fileName = info.absoluteFilePath(); + // coco begin validated : This has been manually tested since requires to change in file system to reproduce the error. if (fileTime.isValid()) { if (fileTime.date() <= vDateOlderThan) { if (QFile::remove(fileName)) { ++countRemoved; LOG_DEBUG(QString("%1 File(s) %2 removed").arg(countRemoved).arg(fileName)); } else { - // coco begin validated : This has been manually tested since requires to change in file system to reproduce the error. LOG_DEBUG(QString("Can't delete file : ") + fileName); } - // coco end } } else { - // coco begin validated : This has been manually tested since requires to change in file system to reproduce the error. LOG_DEBUG(QString("Can't get last modified date of file : ") + fileName); } // coco end Index: sources/storage/logger.cpp =================================================================== diff -u -r4cdc58eeac133511c98a1a6cc0d0839dd770e1d9 -rbf645acccabb7b5a84801620c4f7fa0b0e6878e0 --- sources/storage/logger.cpp (.../logger.cpp) (revision 4cdc58eeac133511c98a1a6cc0d0839dd770e1d9) +++ sources/storage/logger.cpp (.../logger.cpp) (revision bf645acccabb7b5a84801620c4f7fa0b0e6878e0) @@ -201,11 +201,13 @@ bool Logger::setLogPath() { bool ok = true; + // coco begin validated: Has been tested manually, this needs user interaction to check the file system if ( ok && ! setLogPath(LogType::eLogDebug) ) ok = false; if ( ok && ! setLogPath(LogType::eLogEvent) ) ok = false; if ( ok && ! setLogPath(LogType::eLogDatum) ) ok = false; return ok; } +// coco end /*! * \brief Logger::setLogPath Index: sources/view/valarmstatus.cpp =================================================================== diff -u -r93b6ad6b18c505fedab37d95dc87be61db48641c -rbf645acccabb7b5a84801620c4f7fa0b0e6878e0 --- sources/view/valarmstatus.cpp (.../valarmstatus.cpp) (revision 93b6ad6b18c505fedab37d95dc87be61db48641c) +++ sources/view/valarmstatus.cpp (.../valarmstatus.cpp) (revision bf645acccabb7b5a84801620c4f7fa0b0e6878e0) @@ -99,13 +99,7 @@ */ QString VAlarmStatus::alarmIDText(GuiAlarmID vEnum) { - const QMetaObject *mo = qt_getEnumMetaObject(vEnum); - int enumIdx = mo->indexOfEnumerator(qt_getEnumName(vEnum)); - const char *key = mo->enumerator(enumIdx).valueToKey(vEnum); - if (key) - return Model::MAlarmStatus::toText(vEnum); - else - return QString("ALARM_ID_UNDEFINED [%1]").arg(vEnum); + return Model::MAlarmStatus::toText(vEnum); } /*! Index: unittests/tst_messaging.cpp =================================================================== diff -u -rd2035a8728794afeefaa244bf8d1597926d945f5 -rbf645acccabb7b5a84801620c4f7fa0b0e6878e0 --- unittests/tst_messaging.cpp (.../tst_messaging.cpp) (revision d2035a8728794afeefaa244bf8d1597926d945f5) +++ unittests/tst_messaging.cpp (.../tst_messaging.cpp) (revision bf645acccabb7b5a84801620c4f7fa0b0e6878e0) @@ -1,16 +1,16 @@ /*! - * + * * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. * \copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. - * + * * \file tst_messaging.cpp * \author (last) Peter Lucia * \date (last) 06-Jul-2020 * \author (original) Behrouz NematiPour * \date (original) 21-Apr-2020 - * + * */ #include "tst_messaging.h" @@ -77,7 +77,7 @@ msg.data = {}; Model::MPowerOff data; data.fromByteArray(msg.data); - //QVERIFY( ! iMsg.interpretMessage(msg, data)); + // QVERIFY( ! iMsg.interpretMessage(msg, data)); } /*! @@ -92,7 +92,7 @@ msg.data = {}; Model::MPowerOff data; data.fromByteArray(msg.data); - //QVERIFY( ! iMsg.interpretMessage(msg, data)); + // QVERIFY( ! iMsg.interpretMessage(msg, data)); } /*! @@ -285,7 +285,7 @@ msg.actionId = Gui::GuiActionType::ID_TreatmentTime; msg.data = {}; QVariantList data; - //QVERIFY( ! iMsg.treatmentTime(msg, data)); + QVERIFY( ! iMsg.interpretMessage(msg, data)); QVERIFY( data.isEmpty()); } @@ -446,7 +446,7 @@ msg.actionId = Gui::GuiActionType::ID_Unknown; msg.data = {}; QVariantList list; - QVERIFY( ! iMsg.interpretMessage(msg, list)); + QVERIFY( ! iMsg.adjustUltrafiltrationState(msg, list)); } /*! @@ -460,7 +460,7 @@ msg.actionId = Gui::GuiActionType::ID_AdjustUltrafiltrationStateReq; msg.data = {}; QVariantList list; - QVERIFY( ! iMsg.interpretMessage(msg, list)); + QVERIFY( ! iMsg.adjustUltrafiltrationState(msg, list)); } /*! @@ -474,7 +474,7 @@ msg.actionId = Gui::GuiActionType::ID_Unknown; msg.data = {}; QVariantList list; - QVERIFY( ! iMsg.interpretMessage(msg, list)); + QVERIFY( ! iMsg.adjustUltrafiltrationEdit(msg, list)); } /*! @@ -488,7 +488,7 @@ msg.actionId = Gui::GuiActionType::ID_AdjustUltrafiltrationEditRsp; msg.data = {}; QVariantList list; - QVERIFY( ! iMsg.interpretMessage(msg, list)); + QVERIFY( ! iMsg.adjustUltrafiltrationEdit(msg, list)); } /*! @@ -502,7 +502,7 @@ msg.actionId = Gui::GuiActionType::ID_Unknown; msg.data = {}; QVariantList list; - QVERIFY( ! iMsg.interpretMessage(msg, list)); + QVERIFY( ! iMsg.adjustUltrafiltrationConfirm(msg, list)); } /*! @@ -516,7 +516,7 @@ msg.actionId = Gui::GuiActionType::ID_AdjustUltrafiltrationConfirmRsp; msg.data = {}; QVariantList list; - QVERIFY( ! iMsg.interpretMessage(msg, list)); + QVERIFY( ! iMsg.adjustUltrafiltrationConfirm(msg, list)); } /*! @@ -525,27 +525,26 @@ */ void tst_messaging::tst_MessageInterpreter_HD_emptyMessages() { - gDisableHunhandledReport = true; + gDisableUnhandledReport = true; Can::MessageInterpreter interpreter; Can::Message msg; - msg.actionId = Gui::GuiActionType::AlarmTriggered; + msg.actionId = Gui::GuiActionType::ID_AlarmTriggered; msg.data = {}; QVariantList list; QList actionTypes = { - Gui::GuiActionType::AlarmTriggered, - Gui::GuiActionType::AlarmCleared, - Gui::GuiActionType::AlarmSilenceRsp, - Gui::GuiActionType::TreatmentState, + Gui::GuiActionType::ID_AlarmTriggered, + Gui::GuiActionType::ID_AlarmCleared, + Gui::GuiActionType::ID_AlarmSilenceRsp, + Gui::GuiActionType::ID_TreatmentStates, }; foreach (const Gui::GuiActionType &each, actionTypes) { msg.actionId = each; - QVERIFY(interpreter.interpretMessage_HD(msg, list)); - + QVERIFY(! interpreter.interpretMessage_HD(msg, list)); } - msg.actionId = Gui::GuiActionType::String; + msg.actionId = Gui::GuiActionType::ID_RawData; QVERIFY(!interpreter.interpretMessage_HD(msg, list)); } @@ -686,6 +685,17 @@ QVERIFY(list.isEmpty()); } +void tst_messaging::tst_MessageInterpreter_notify_fromByteArray() +{ + Can::MessageInterpreter iMsg; + Can::Message msg; + msg.actionId = Gui::GuiActionType::ID_PowerOff; + msg.data = {}; + QVariantList list; + QVERIFY( ! iMsg.notify(msg, list, Gui::GuiActionType::ID_PowerOff)); + QVERIFY(list.isEmpty()); +} + /*! * \brief tst_messaging::tst_MessageInterpreter_interpretMessage_AdjustBloodDialysateReq * \details Tests MessageInterpreter interpretMessage to handle AdjustBloodDialysateReq message type @@ -695,7 +705,8 @@ { Can::MessageInterpreter iMsg; QByteArray payload; - //QVERIFY(iMsg.interpretMessage(Gui::GuiActionType::ID_AdjustBloodDialysateReq, {}, payload)); + // if the payload is empty the len is not valid and should return false and empty payload + QVERIFY(! iMsg.interpretMessage(Gui::GuiActionType::ID_AdjustBloodDialysateReq, {}, payload)); QVERIFY(payload.isEmpty()); } @@ -708,7 +719,8 @@ { Can::MessageInterpreter iMsg; QByteArray payload; - //QVERIFY(iMsg.interpretMessage(Gui::GuiActionType::ID_AdjustDurationReq, {}, payload)); + // if the payload is empty the len is not valid and should return false and empty payload + QVERIFY( ! iMsg.interpretMessage(Gui::GuiActionType::ID_AdjustDurationReq, {}, payload)); QVERIFY(payload.isEmpty()); } @@ -721,7 +733,8 @@ { Can::MessageInterpreter iMsg; QByteArray payload; - QVERIFY(iMsg.interpretMessage(Gui::GuiActionType::AlarmSilenceReq, {}, payload)); + // if the payload is empty the len is not valid and should return false and empty payload + QVERIFY(! iMsg.interpretMessage(Gui::GuiActionType::ID_AlarmSilenceReq, {}, payload)); QVERIFY(payload.isEmpty()); } @@ -734,7 +747,8 @@ { Can::MessageInterpreter iMsg; QByteArray payload; - //QVERIFY(iMsg.interpretMessage(Gui::GuiActionType::ID_AdjustUltrafiltrationStateReq, {}, payload)); + // if the payload is empty the len is not valid and should return false and empty payload + QVERIFY(! iMsg.interpretMessage(Gui::GuiActionType::ID_AdjustUltrafiltrationStateReq, {}, payload)); QVERIFY(payload.isEmpty()); } @@ -747,7 +761,8 @@ { Can::MessageInterpreter iMsg; QByteArray payload; - //QVERIFY(iMsg.interpretMessage(Gui::GuiActionType::ID_AdjustUltrafiltrationEditReq, {}, payload)); + // if the payload is empty the len is not valid and should return false and empty payload + QVERIFY( ! iMsg.interpretMessage(Gui::GuiActionType::ID_AdjustUltrafiltrationEditReq, {}, payload)); QVERIFY(payload.isEmpty()); } @@ -760,7 +775,8 @@ { Can::MessageInterpreter iMsg; QByteArray payload; - //QVERIFY(iMsg.interpretMessage(Gui::GuiActionType::ID_AdjustUltrafiltrationConfirmReq, {}, payload)); + // if the payload is empty the len is not valid and should return false and empty payload + QVERIFY( ! iMsg.interpretMessage(Gui::GuiActionType::ID_AdjustUltrafiltrationConfirmReq, {}, payload)); QVERIFY(payload.isEmpty()); } @@ -906,3 +922,16 @@ dMsg.actionTransmit(Gui::GuiActionType::ID_AdjustBloodDialysateReq, data, seq); } +/*! + * \brief tst_messaging::tst_MessageDispatcher_actionTransmit + * \details Tests MessageDispatcher actionTransmit() + */ +void tst_messaging::tst_MessageDispatcher_actionTransmit_Unknown() +{ + Can::MessageDispatcher dMsg; + QVariantList data; + Can::Sequence seq = 1; + dMsg.actionTransmit(Gui::GuiActionType::ID_KeepAlive, data, seq); +} + + Index: unittests/tst_messaging.h =================================================================== diff -u -r44a85c96ab55e424866ec4cca0270aa218355f82 -rbf645acccabb7b5a84801620c4f7fa0b0e6878e0 --- unittests/tst_messaging.h (.../tst_messaging.h) (revision 44a85c96ab55e424866ec4cca0270aa218355f82) +++ unittests/tst_messaging.h (.../tst_messaging.h) (revision bf645acccabb7b5a84801620c4f7fa0b0e6878e0) @@ -1,16 +1,16 @@ /*! - * + * * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. * \copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. - * + * * \file tst_messaging.h * \author (last) Peter Lucia * \date (last) 06-Jul-2020 * \author (original) Behrouz NematiPour * \date (original) 21-Apr-2020 - * + * */ #pragma once @@ -94,11 +94,11 @@ void tst_MessageInterpreter_interpretMessage_AdjustUltrafiltrationConfirmReq(); void tst_MessageInterpreter_interpretMessage_canbusFaultCountData(); - void tst_MessageInterpreter_interpretMessage_String(); - void tst_MessageInterpreter_interpretMessage_DG_Unhandled(); + void tst_MessageInterpreter_notify_fromByteArray(); + void tst_MessageBuilder_addActionId(); void tst_MessageBuilder_addData_shorterLen(); void tst_MessageBuilder_addData_LongerThanMax(); @@ -109,6 +109,8 @@ void tst_MessageBuilder_buildFrames_eLenCanFrame(); void tst_MessageDispatcher_actionTransmit(); + void tst_MessageDispatcher_actionTransmit_Unknown(); + }; Index: unittests/tst_models.cpp =================================================================== diff -u -r9cc1608f615e66d0f1c3a022aa6d19579d76b241 -rbf645acccabb7b5a84801620c4f7fa0b0e6878e0 --- unittests/tst_models.cpp (.../tst_models.cpp) (revision 9cc1608f615e66d0f1c3a022aa6d19579d76b241) +++ unittests/tst_models.cpp (.../tst_models.cpp) (revision bf645acccabb7b5a84801620c4f7fa0b0e6878e0) @@ -44,6 +44,8 @@ #include "MTreatmentAdjustUltrafiltrationConfirmResponse.h" #include "MAlarmStatusData.h" +#include "MAlarmTriggered.h" +#include "MAlarmCleared.h" // #define CONSOLEOUT @@ -379,18 +381,7 @@ } } -void tst_models::tst_MAlarmStatus() -{ - for (int i = 1; i < Gui::GuiAlarmID::NUM_OF_ALARM_IDS; ++i) { - QVERIFY(!Model::MAlarmStatus::toText(Gui::GuiAlarmID(i)).isEmpty()); - } - - QCOMPARE(Model::MAlarmStatus::toText(Gui::GuiAlarmID(0)), tr("")); - QCOMPARE(Model::MAlarmStatus::toText(Gui::GuiAlarmID(-1)), tr("Alarm Not Recognized.")); - QCOMPARE(Model::MAlarmStatus::toText(Gui::GuiAlarmID(599)), tr("Alarm Not Recognized.")); -} - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGROPumpData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGROPumpData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // @@ -1248,4 +1239,140 @@ } } +void tst_models::tst_MAlarmStatus_text() +{ + for (int i = 1; i < Gui::GuiAlarmID::NUM_OF_ALARM_IDS; ++i) { + QVERIFY(!Model::MAlarmStatus::toText(Gui::GuiAlarmID(i)).isEmpty()); + } + + QCOMPARE(Model::MAlarmStatus::toText(Gui::GuiAlarmID(0)), tr("")); + QCOMPARE(Model::MAlarmStatus::toText(Gui::GuiAlarmID(-1)), tr("Alarm Not Recognized.")); + QCOMPARE(Model::MAlarmStatus::toText(Gui::GuiAlarmID(599)), tr("Alarm Not Recognized.")); +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAlarmStatus ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAlarmStatus data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAlarmStatus_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11")); + QTest::newRow("mState ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mState ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mState ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mState ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mTop ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mTop ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("mTop ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("mTop ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + QTest::newRow("mEscalatesIn") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mEscalatesIn") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("mEscalatesIn") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("mEscalatesIn") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); + QTest::newRow("mMuteTimeout") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("mMuteTimeout") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); + QTest::newRow("mMuteTimeout") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); + QTest::newRow("mMuteTimeout") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); + QTest::newRow("mFlags ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); + QTest::newRow("mFlags ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10")); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAlarmStatus test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAlarmStatus() { + Model::MAlarmStatus mData; + + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) +#ifdef CONSOLEOUT + qDebug() << index << errorIndex << startIndex << ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mTop ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mEscalatesIn; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mMuteTimeout; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mFlags ; QVERIFY (! mData.fromByteArray(data)); /* GetBits doesn't need this */} break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAlarmTriggered ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAlarmTriggered data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAlarmTriggered_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mAlarmID ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mAlarmID ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mAlarmID ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mAlarmID ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAlarmTriggered test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAlarmTriggered() { + Model::MAlarmTriggered mData; + + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) +#ifdef CONSOLEOUT + qDebug() << index << errorIndex << startIndex << ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mAlarmID; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAlarmCleared ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAlarmCleared data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAlarmCleared_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mAlarmID ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mAlarmID ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mAlarmID ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mAlarmID ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAlarmCleared test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAlarmCleared() { + Model::MAlarmCleared mData; + + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) +#ifdef CONSOLEOUT + qDebug() << index << errorIndex << startIndex << ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mAlarmID; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} Index: unittests/tst_models.h =================================================================== diff -u -rd2035a8728794afeefaa244bf8d1597926d945f5 -rbf645acccabb7b5a84801620c4f7fa0b0e6878e0 --- unittests/tst_models.h (.../tst_models.h) (revision d2035a8728794afeefaa244bf8d1597926d945f5) +++ unittests/tst_models.h (.../tst_models.h) (revision bf645acccabb7b5a84801620c4f7fa0b0e6878e0) @@ -1,16 +1,16 @@ /*! - * + * * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. * \copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. - * + * * \file tst_models.h * \author (last) Peter Lucia * \date (last) 01-Jul-2020 * \author (original) Behrouz NematiPour * \date (original) 21-Apr-2020 - * + * */ #pragma once @@ -53,8 +53,7 @@ void tst_MAdjustUltrafiltrationConfirmResponse_data (); void tst_MAdjustUltrafiltrationConfirmResponse (); - void tst_MAlarmStatus(); - + // - Data Messages void tst_DGROPumpData_data(); void tst_DGROPumpData(); @@ -90,5 +89,17 @@ void tst_MPressureOcclusionData(); void tst_MPowerOff_data(); void tst_MPowerOff(); + + // Alarms + void tst_MAlarmStatus_text(); + + void tst_MAlarmStatus_data(); + void tst_MAlarmStatus(); + + void tst_MAlarmTriggered_data(); + void tst_MAlarmTriggered(); + + void tst_MAlarmCleared_data(); + void tst_MAlarmCleared(); };