Index: scripts/autostart =================================================================== diff -u -rbb8f39a014644c70b832dd2a784f62fa9f6b6106 -r057d3ef4e29c63235040c5cfe8c6421ef7787d6a --- scripts/autostart (.../autostart) (revision bb8f39a014644c70b832dd2a784f62fa9f6b6106) +++ scripts/autostart (.../autostart) (revision 057d3ef4e29c63235040c5cfe8c6421ef7787d6a) @@ -1,5 +1,14 @@ #!/bin/sh # +# Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +# \copyright \n +# THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, \n +# IN PART OR IN WHOLE, \n +# WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. \n +# \file run.sh +# \date 2019/10/28 +# \author Behrouz NematiPour +# \details # This script will be in the /etc/init.d/ as an autostart. # case "$1" in Index: scripts/run.sh =================================================================== diff -u -r4a6abe765f03feae8100ec660aa04aa218d4dfa3 -r057d3ef4e29c63235040c5cfe8c6421ef7787d6a --- scripts/run.sh (.../run.sh) (revision 4a6abe765f03feae8100ec660aa04aa218d4dfa3) +++ scripts/run.sh (.../run.sh) (revision 057d3ef4e29c63235040c5cfe8c6421ef7787d6a) @@ -1,8 +1,17 @@ #!/bin/sh # +# Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +# \copyright \n +# THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, \n +# IN PART OR IN WHOLE, \n +# WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. \n +# \file run.sh +# \date 2019/10/28 +# \author Behrouz NematiPour +# \details # This script will be called by autostart script in the /etc/init.d/ # to initialize the Denali UI Application Software environment -# and finaly calls the Application itself in background. +# and finally calls the Application itself in background. # HOME=/home/root SDCARD_DEV=/dev/mmcblk1p1 @@ -63,4 +72,3 @@ #launching denali application $HOME/denali & - Index: sources/applicationcontroller.cpp =================================================================== diff -u -rd3edfbd78f021082f37c7ee79a5a31a57b2808d4 -r057d3ef4e29c63235040c5cfe8c6421ef7787d6a --- sources/applicationcontroller.cpp (.../applicationcontroller.cpp) (revision d3edfbd78f021082f37c7ee79a5a31a57b2808d4) +++ sources/applicationcontroller.cpp (.../applicationcontroller.cpp) (revision 057d3ef4e29c63235040c5cfe8c6421ef7787d6a) @@ -293,6 +293,7 @@ data += seq.bytes[0]; data += seq.bytes[1]; break; + } Types::safeIncrement(txCount); } @@ -349,6 +350,7 @@ data += (char)(0); } break; + } Types::safeIncrement(txCount); } Index: sources/canbus/caninterface.cpp =================================================================== diff -u -r4a6abe765f03feae8100ec660aa04aa218d4dfa3 -r057d3ef4e29c63235040c5cfe8c6421ef7787d6a --- sources/canbus/caninterface.cpp (.../caninterface.cpp) (revision 4a6abe765f03feae8100ec660aa04aa218d4dfa3) +++ sources/canbus/caninterface.cpp (.../caninterface.cpp) (revision 057d3ef4e29c63235040c5cfe8c6421ef7787d6a) @@ -332,8 +332,10 @@ _canStatus = _canDevice->errorString(); LOG_ERROR(QString("%1 - %2").arg(_erFrameCount).arg(_canStatus)); break; + default: break; + } emit didFrameError(_canStatus); } Index: sources/canbus/frameinterface.cpp =================================================================== diff -u -rbb8f39a014644c70b832dd2a784f62fa9f6b6106 -r057d3ef4e29c63235040c5cfe8c6421ef7787d6a --- sources/canbus/frameinterface.cpp (.../frameinterface.cpp) (revision bb8f39a014644c70b832dd2a784f62fa9f6b6106) +++ sources/canbus/frameinterface.cpp (.../frameinterface.cpp) (revision 057d3ef4e29c63235040c5cfe8c6421ef7787d6a) @@ -193,6 +193,7 @@ default: ok = false; break; + } if (vOK) *vOK = ok; Index: sources/canbus/messagedispatcher.cpp =================================================================== diff -u -r4a6abe765f03feae8100ec660aa04aa218d4dfa3 -r057d3ef4e29c63235040c5cfe8c6421ef7787d6a --- sources/canbus/messagedispatcher.cpp (.../messagedispatcher.cpp) (revision 4a6abe765f03feae8100ec660aa04aa218d4dfa3) +++ sources/canbus/messagedispatcher.cpp (.../messagedispatcher.cpp) (revision 057d3ef4e29c63235040c5cfe8c6421ef7787d6a) @@ -317,6 +317,7 @@ #endif emit didAcknowReceive(mSequence); break; + default: if (mSequence < 0) { LOG_EVENT(tr("HD Ack Req %1").arg(mSequence)); @@ -328,11 +329,11 @@ } emit didActionReceive(mActionId, mData); break; + } } _messageList[vMessage.can_id].removeLast(); return ok; - } /*! Index: sources/canbus/messageinterpreter.cpp =================================================================== diff -u -r595ed1fbe8066960afd4c8fea168208e81b173d9 -r057d3ef4e29c63235040c5cfe8c6421ef7787d6a --- sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) +++ sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision 057d3ef4e29c63235040c5cfe8c6421ef7787d6a) @@ -86,6 +86,7 @@ LOG_ERROR(tr("Unknown Message ID (UI) '%1'").arg(mActionIdHexString)); ok = false; break; + } return ok; } @@ -112,13 +113,16 @@ case eChlid_HD_Sync: ok = interpretMessage_HD(vMessage, vData); break; + case eChlid_DG_UI: //case eChlid_DG_Alarm: //case eChlid_DG_Sync: ok = interpretMessage_DG(vMessage, vData); break; + default: break; + } return ok; } @@ -211,6 +215,7 @@ default: printUnhandled (vMessage); break; + } return ok; } @@ -250,6 +255,7 @@ if ( vMessage.actionId != Gui::GuiActionType::PowerOff) { return false; } + if ( vMessage.data.length() < payloadLen[Gui::GuiActionType::PowerOff] ) { QString mActionIdHexString = Format::toHexString(vMessage.actionId); LOG_ERROR(tr("Incorrect data for Message ID (HD) '%1'").arg(mActionIdHexString)); @@ -296,6 +302,7 @@ if ( vMessage.actionId != Gui::GuiActionType::BloodFlow ) { return false; } + if ( vMessage.data.length() < payloadLen[Gui::GuiActionType::BloodFlow] ) { QString mActionIdHexString = Format::toHexString(vMessage.actionId); LOG_ERROR(tr("Incorrect data for Message ID (HD) '%1'").arg(mActionIdHexString)); @@ -342,6 +349,7 @@ if ( vMessage.actionId != Gui::GuiActionType::DialysateInletFlow ) { return false; } + if ( vMessage.data.length() < payloadLen[Gui::GuiActionType::DialysateInletFlow] ) { QString mActionIdHexString = Format::toHexString(vMessage.actionId); LOG_ERROR(tr("Incorrect data for Message ID (HD) '%1'").arg(mActionIdHexString)); @@ -389,6 +397,7 @@ if ( vMessage.actionId != Gui::GuiActionType::DialysateOutletFlow ) { return false; } + if ( vMessage.data.length() < payloadLen[Gui::GuiActionType::DialysateOutletFlow] ) { QString mActionIdHexString = Format::toHexString(vMessage.actionId); LOG_ERROR(tr("Incorrect data for Message ID (HD) '%1'").arg(mActionIdHexString)); @@ -433,6 +442,7 @@ if ( vMessage.actionId != Gui::GuiActionType::TreatmentTime ) { return false; } + if ( vMessage.data.length() < payloadLen[Gui::GuiActionType::TreatmentTime] ) { QString mActionIdHexString = Format::toHexString(vMessage.actionId); LOG_ERROR(tr("Incorrect data for Message ID (HD) '%1'").arg(mActionIdHexString)); @@ -480,6 +490,7 @@ if ( vMessage.actionId != Gui::GuiActionType::AlarmStatus ) { return false; } + if ( vMessage.data.length() < payloadLen[Gui::GuiActionType::AlarmStatus] ) { QString mActionIdHexString = Format::toHexString(vMessage.actionId); LOG_ERROR(tr("Incorrect data for Message ID (HD) '%1'").arg(mActionIdHexString)); Index: sources/canbus/messageinterpreter.h =================================================================== diff -u -r595ed1fbe8066960afd4c8fea168208e81b173d9 -r057d3ef4e29c63235040c5cfe8c6421ef7787d6a --- sources/canbus/messageinterpreter.h (.../messageinterpreter.h) (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) +++ sources/canbus/messageinterpreter.h (.../messageinterpreter.h) (revision 057d3ef4e29c63235040c5cfe8c6421ef7787d6a) @@ -55,8 +55,8 @@ bool dialysateOutletFlowData(const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; // ---- AlarmStatus - bool getAlarmStatus (const Message &vMessage, Model::MAlarmStatus &vData) __attribute_warn_unused_result__; - bool alarmStatus (const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; + bool getAlarmStatus (const Message &vMessage, Model::MAlarmStatus &vData) __attribute_warn_unused_result__; + bool alarmStatus (const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; // ---- Treatment Time bool getTreatmentTime (const Message &vMessage, Model::MTreatmentTime &vData); Index: sources/gui/guicontroller.cpp =================================================================== diff -u -r4a6abe765f03feae8100ec660aa04aa218d4dfa3 -r057d3ef4e29c63235040c5cfe8c6421ef7787d6a --- sources/gui/guicontroller.cpp (.../guicontroller.cpp) (revision 4a6abe765f03feae8100ec660aa04aa218d4dfa3) +++ sources/gui/guicontroller.cpp (.../guicontroller.cpp) (revision 057d3ef4e29c63235040c5cfe8c6421ef7787d6a) @@ -183,11 +183,13 @@ // return true; //} break; + //case Another_Command_Which_Doesn't_Require_HD_Approval: //return true; //break; default: break; + } return false; } Index: sources/gui/qml/main.qml =================================================================== diff -u -r595ed1fbe8066960afd4c8fea168208e81b173d9 -r057d3ef4e29c63235040c5cfe8c6421ef7787d6a --- sources/gui/qml/main.qml (.../main.qml) (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) +++ sources/gui/qml/main.qml (.../main.qml) (revision 057d3ef4e29c63235040c5cfe8c6421ef7787d6a) @@ -56,6 +56,7 @@ 5000 // if there is any error happening then after 5 seconds dialog hides. ) break; + } } } @@ -74,15 +75,18 @@ case GuiActions.Command: _powerOffDialog.open() break; + case GuiActions.Timeout: _powerOffDialog.close() break; + case GuiActions.Rejected: _autoHideInfo.showDialog( qsTr("Cannot shutdown during 'Treatment'"), // '%1').arg() 1000 // if there is any error happening then after 5 seconds dialog hides. ) break; + } } } Index: sources/storage/logger.cpp =================================================================== diff -u -r805119c460b4a266d6401c8705f4427e7fbe270f -r057d3ef4e29c63235040c5cfe8c6421ef7787d6a --- sources/storage/logger.cpp (.../logger.cpp) (revision 805119c460b4a266d6401c8705f4427e7fbe270f) +++ sources/storage/logger.cpp (.../logger.cpp) (revision 057d3ef4e29c63235040c5cfe8c6421ef7787d6a) @@ -222,6 +222,7 @@ case eLogError: case eLogDatum: break; + default: LOG_ERROR(tr("Incorrect type of logging").arg(vLogType)); } Index: sources/storage/usbwatcher.cpp =================================================================== diff -u -r805119c460b4a266d6401c8705f4427e7fbe270f -r057d3ef4e29c63235040c5cfe8c6421ef7787d6a --- sources/storage/usbwatcher.cpp (.../usbwatcher.cpp) (revision 805119c460b4a266d6401c8705f4427e7fbe270f) +++ sources/storage/usbwatcher.cpp (.../usbwatcher.cpp) (revision 057d3ef4e29c63235040c5cfe8c6421ef7787d6a) @@ -202,9 +202,11 @@ error = tr("%1 - Device or resource busy (%2)").arg(errno).arg(vDevice); _mounted = true; break; + default: error = tr("%1 - %2 (%3 , %4)").arg(errno).arg(strerror(errno)).arg(vDevice).arg(USB_Mount_Point); break; + } if (error != lastError) { LOG_ERROR(error); Index: sources/utility/types.h =================================================================== diff -u -r595ed1fbe8066960afd4c8fea168208e81b173d9 -r057d3ef4e29c63235040c5cfe8c6421ef7787d6a --- sources/utility/types.h (.../types.h) (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) +++ sources/utility/types.h (.../types.h) (revision 057d3ef4e29c63235040c5cfe8c6421ef7787d6a) @@ -110,7 +110,9 @@ template < typename T > static T safeIncrement(T &vValue, quint8 vStep = 1) { - if (!vStep) vStep = 1; // step can't be zero + // step can't be zero + if (!vStep) vStep = 1; + T mMax = (T)(pow(2, sizeof(T) * 8) - 1); if ( vValue <= mMax ) { vValue += vStep; Index: sources/view/vpoweroff.h =================================================================== diff -u -r595ed1fbe8066960afd4c8fea168208e81b173d9 -r057d3ef4e29c63235040c5cfe8c6421ef7787d6a --- sources/view/vpoweroff.h (.../vpoweroff.h) (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) +++ sources/view/vpoweroff.h (.../vpoweroff.h) (revision 057d3ef4e29c63235040c5cfe8c6421ef7787d6a) @@ -34,4 +34,3 @@ }; } -