Index: SDDs/lowBicarb.puml =================================================================== diff -u -r68854054b9bd1a8a0ea900844bbbf9a290c7315f -ra6b0dd1e380125fc9128dbe882c6eaf488098c3d --- SDDs/lowBicarb.puml (.../lowBicarb.puml) (revision 68854054b9bd1a8a0ea900844bbbf9a290c7315f) +++ SDDs/lowBicarb.puml (.../lowBicarb.puml) (revision a6b0dd1e380125fc9128dbe882c6eaf488098c3d) @@ -69,7 +69,7 @@ TD -> SW: MSG: [x01: #4] \nTD AlarmStatus : \ \n\t(U32) mState \ - \n\t(U32) mTop=CONDUCTIVITY_OUT_OF_RANGE \ + \n\t(U32) mTop=Dialysate_Proportioning_In_Progress \ \n\t(U32) mMuteTimeout \ \n\t(U16) mFlags |= NO_BUTTONS SW -> UI: ACT: Display Alarm Dialog \ Index: sources/gui/qml/dialogs/AlarmDialog.qml =================================================================== diff -u -r8f6ecb60abf6d47d4554cfd3019ca496d79b6f69 -ra6b0dd1e380125fc9128dbe882c6eaf488098c3d --- sources/gui/qml/dialogs/AlarmDialog.qml (.../AlarmDialog.qml) (revision 8f6ecb60abf6d47d4554cfd3019ca496d79b6f69) +++ sources/gui/qml/dialogs/AlarmDialog.qml (.../AlarmDialog.qml) (revision a6b0dd1e380125fc9128dbe882c6eaf488098c3d) @@ -177,7 +177,7 @@ font.pixelSize : Fonts.fontPixelInstructionStep font.weight : _delegateControl.ListView.isCurrentItem ? Font.DemiBold : Font.Normal color : _delegateControl.ListView.isCurrentItem ? _colorMode.modeSelctedColor : _colorMode.modeTextColor - text : model.instruction + text : model.instruction.join(" ") wrapMode : Text.WordWrap } Index: sources/model/hd/data/treatment/MTreatmentHeparinData.h =================================================================== diff -u -r1edd5fe4e852a2b352a86587820a269a5103fc9f -ra6b0dd1e380125fc9128dbe882c6eaf488098c3d --- sources/model/hd/data/treatment/MTreatmentHeparinData.h (.../MTreatmentHeparinData.h) (revision 1edd5fe4e852a2b352a86587820a269a5103fc9f) +++ sources/model/hd/data/treatment/MTreatmentHeparinData.h (.../MTreatmentHeparinData.h) (revision a6b0dd1e380125fc9128dbe882c6eaf488098c3d) @@ -38,7 +38,7 @@ * | || * | #1:(F32) | \ref Data::mCumulative | * | #2:(F32) | \ref Data::mTarget | - * | #2:(U32) | \ref Data::mTimeRemaining | + * | #3:(U32) | \ref Data::mTimeRemaining | * * \sa Data * \sa MAdjustHeparinReq : Heparin Request Index: sources/view/hd/alarm/VAlarmStatus.cpp =================================================================== diff -u -r0f83de066c8a116195a3cc60577d597ef9654c55 -ra6b0dd1e380125fc9128dbe882c6eaf488098c3d --- sources/view/hd/alarm/VAlarmStatus.cpp (.../VAlarmStatus.cpp) (revision 0f83de066c8a116195a3cc60577d597ef9654c55) +++ sources/view/hd/alarm/VAlarmStatus.cpp (.../VAlarmStatus.cpp) (revision a6b0dd1e380125fc9128dbe882c6eaf488098c3d) @@ -14,6 +14,10 @@ */ #include "VAlarmStatus.h" +// Qt +#include +#include + // Project #include "GuiController.h" #include "Settings.h" @@ -26,6 +30,9 @@ ADJUST_VIEW_CONNECTION(AlarmSilenceRequestData ); ADJUST_VIEW_CONNECTION(AlarmUserActionRequestData ); + connect(&_GuiController, SIGNAL(didActionReceive (GuiActionType, const QVariantList &)), + this , SLOT( onActionReceive (GuiActionType, const QVariantList &))); + _instructionsList.setRoleNames({ { eRole_Instruction , "instruction" }, { eRole_Image , "image" }, @@ -228,11 +235,10 @@ QFileInfo fileInfo(imagePath); - QHash instructionStep; - instructionStep.insert(eRole_Instruction, key); + QStringList updatedKey = updateReplacements(group, key, id, instructionData.count()); + instructionStep.insert(eRole_Instruction, updatedKey); instructionStep.insert(eRole_Image, fileInfo.exists() && fileInfo.isFile() ? "file:" + imagePath : "") ; - instructionData.append(instructionStep); alarmData.instructions = instructionData; } @@ -249,3 +255,82 @@ } emit alarm_AlarmIDChanged(_alarm_AlarmID); // to get the dialog content in sync with the Alarm.conf in case there is an early alarm. } + +QStringList VAlarmStatus::updateReplacements(const QString &vGroup, const QString &vKey, const int &vAlarmID, const int &vIndex) +{ + QRegExp regx("\\{\\s*\\d+\\s*:\\s*\\d+\\s*:\\s*\\w*\\s*:\\s*\\d*\\s*\\}"); + QString key = vKey; + int replacementCount = key.count(regx); + QStringList keyList; + for ( int j = 0; j < replacementCount; j++ ) { + int pos = key.indexOf(regx); + int len = regx.matchedLength(); + QString blk = key.mid(pos+1, len-2); + keyList += key.mid(0, pos); + keyList += ""; // value placeholder + key.remove(0, pos + regx.matchedLength()); + QStringList lst = blk.split(":"); + quint16 id = lst[0].toUInt(); + quint16 ix = lst[1].toUInt(); + QString ex = lst[2] ; + quint16 rd = lst[3].toUInt(); + Q_UNUSED(vGroup); + TLocation loc; + loc.group = vGroup ; + loc.alarmID = vAlarmID ; + loc.index = vIndex ; + loc.locIndex = j * 2 + 1 ; + loc.prmIndex = ix ; + loc.prmExtra = ex ; + loc.prmRound = rd ; + + _replacements[id] += loc; + } + keyList += key; + + return keyList; +} + +/*! + * \brief VSettings::onActionReceive + * \details emits didActionReceive signal to notify other classes (Gui) + * , an action has been received. + * \param vAction - the action + * \param vData - the action data + */ +void VAlarmStatus::onActionReceive (GuiActionType vAction, const QVariantList &vData) +{ + bool isChanged = false; + quint16 id = qFromBigEndian((quint16)vAction); + quint32 alarmID; + if (_replacements.contains(id)) { + isChanged = true; + for ( const auto &item : _replacements[id]) { + QString value; + + quint16 len = vData.length(); + + if ( 0 < item.prmIndex && item.prmIndex <= len ) { + if ( item.prmRound > 0 ) { + value = QString::number(vData[item.prmIndex - 1].toFloat(), 'f', item.prmRound) + item.prmExtra; + } + else { + value = vData[item.prmIndex - 1].toString() + item.prmExtra; + } + } + else { + qDebug() << QString("Given prmIndex %1 is out of message %2 parameters count %3 on alarm id '%4'") + .arg(item.prmIndex).arg(id).arg(len).arg(item.alarmID); + continue; + } + + // update alarm instruction step + alarmID = item.alarmID; + QStringList step = _alarms[alarmID].instructions[item.index][eRole_Instruction].toStringList(); + step[item.locIndex] = value; + _alarms[alarmID].instructions[item.index][eRole_Instruction] = step; + } + } + + if ( isChanged ) emit alarm_AlarmIDChanged(alarmID); +} Index: sources/view/hd/alarm/VAlarmStatus.h =================================================================== diff -u -r0f83de066c8a116195a3cc60577d597ef9654c55 -ra6b0dd1e380125fc9128dbe882c6eaf488098c3d --- sources/view/hd/alarm/VAlarmStatus.h (.../VAlarmStatus.h) (revision 0f83de066c8a116195a3cc60577d597ef9654c55) +++ sources/view/hd/alarm/VAlarmStatus.h (.../VAlarmStatus.h) (revision a6b0dd1e380125fc9128dbe882c6eaf488098c3d) @@ -60,6 +60,19 @@ QMap _alarms; + typedef struct { + QString group ; + quint32 alarmID ; + quint16 index ; + quint16 locIndex; + quint16 prmIndex; + QString prmExtra; + quint16 prmRound; + } TLocation; + typedef QList TLocationList; + typedef QMap TReplacements; + TReplacements _replacements; + // ********** DYNAMIC PROPERTIES: The properties which need to be updated by each alarm message received. ********** // READONLY( bool , hasAlarm , false) PROPERTY( quint32 , alarm_Priority , 0) @@ -88,7 +101,7 @@ // ********** STATIC PROPERTIES: The properties which need to be updated by each alarm message received. ********** // Q_PROPERTY(QString title READ title NOTIFY alarm_AlarmIDChanged ) Q_PROPERTY(QString text READ text NOTIFY alarm_AlarmIDChanged ) - Q_PROPERTY(MListModel* instructions READ instructions NOTIFY alarm_AlarmIDChanged) + Q_PROPERTY(MListModel* instructions READ instructions NOTIFY alarm_AlarmIDChanged ) VIEW_DEC_CLASS ( VAlarmStatus ) VIEW_DEC_SLOT ( AlarmStatusData ) @@ -110,6 +123,12 @@ MListModel* instructions () { return &_instructionsList; } ; MListModel _instructionsList; + QStringList updateReplacements( const QString &vGroup , + const QString &vKey , + const int &vAlarmID , + const int &vIndex ); +private slots: + void onActionReceive (GuiActionType vAction, const QVariantList &vData); signals: void didAlarmRaise();