Index: sources/canbus/MessageDispatcher.cpp =================================================================== diff -u -r80250cfdbe58a3df17950d342212f155d52d3971 -rb5afbc61af03dd2e84acf8439cb6be1f022a2921 --- sources/canbus/MessageDispatcher.cpp (.../MessageDispatcher.cpp) (revision 80250cfdbe58a3df17950d342212f155d52d3971) +++ sources/canbus/MessageDispatcher.cpp (.../MessageDispatcher.cpp) (revision b5afbc61af03dd2e84acf8439cb6be1f022a2921) @@ -1,15 +1,15 @@ /*! * - * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * Copyright (c) 2020-2022 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) Behrouz NematiPour - * \date (last) 31-Aug-2020 - * \author (original) Behrouz NematiPour - * \date (original) 26-Aug-2020 + * \file MessageDispatcher.cpp + * \author (last) Behrouz NematiPour + * \date (last) 18-Apr-2022 + * \author (original) Behrouz NematiPour + * \date (original) 26-Aug-2020 * */ #include "MessageDispatcher.h" @@ -75,11 +75,11 @@ */ void MessageDispatcher::quit() { - // coco begin validated: Application termination is not correctly done in coco!!! + // disabled coco begin validated: Application termination is not correctly done in coco!!! // it has been tested and works perfectly fine in normal run. quitThread(); // validated } -// coco end +// disabled coco end /*! * \brief Message Handler connections definition @@ -137,15 +137,15 @@ */ void MessageDispatcher::quitThread() { - // coco begin validated: Application termination is not correctly done in coco!!! + // disabled coco begin validated: Application termination is not correctly done in coco!!! // it has been tested and works perfectly fine in normal run. if ( ! _thread ) return; // runs in thread moveToThread(qApp->thread()); // validated } -// coco end +// disabled coco end /*! * \brief MessageDispatcher::onFrameReceive @@ -160,10 +160,10 @@ void MessageDispatcher::onFrameReceive(Can_Id vCan_Id, const QByteArray &vPayload) { // Append a message to the list - // coco begin validated: if empty (first condition) is true, it must never check for the complete (second condition) + // disabled coco begin validated: if empty (first condition) is true, it must never check for the complete (second condition) // because if the list is empty there is no last() item if (_messageList[vCan_Id].isEmpty() || _messageList[vCan_Id].last().isComplete()) { - // coco end + // disabled coco end _messageList[vCan_Id].append(Message()); } @@ -205,10 +205,10 @@ */ void MessageDispatcher::onFailedTransmit(Sequence vSequence) { - // coco begin validated: Is a placeholder and has not been implemented yet + // disabled coco begin validated: Is a placeholder and has not been implemented yet emit didFailedTransmit(vSequence); } -// coco end +// disabled coco end /*! * \brief MessageDispatcher::onActionTransmit @@ -360,14 +360,14 @@ * \param vData - Data model contains the user acknowledge request information. * \return void */ -/* // coco begin validated: Manually tested. This model class is a placeholder and there is no use case for this now. +/* // disabled coco begin validated: Manually tested. This model class is a placeholder and there is no use case for this now. void MessageDispatcher::onAdjustment(const AlarmClearedConditionRequestData &vData) { QVariantList mData; mData += vData.alarmID; onActionTransmit(GuiActionType::ID_AlarmClearedConditionReq, mData); } -// coco end */ +// disabled coco end */ /** * \details This method transmits the Saline Bolus Adjustment Denali message. @@ -469,12 +469,23 @@ * \param vData - Data model contains the epoch time * \return void */ -void MessageDispatcher::onAdjustment(const AdjustServiceRequestData &) +void MessageDispatcher::onAdjustment(const AdjustServiceDatesRequestData &) { QVariantList mData; - onActionTransmit(GuiActionType::ID_AdjustServiceReq, mData); + onActionTransmit(GuiActionType::ID_AdjustServiceDatesReq, mData); } +/*! + * \brief MessageDispatcher::onAdjustment + * \details This method transmits the Disposables Removal Confirm Adjustment Denali message. + * \param vData - Data model contains Service Mode adjustment. + * \return void + */ +void MessageDispatcher::onAdjustment(const AdjustServiceModeRequestData &) +{ + QVariantList mData; + onActionTransmit(GuiActionType::ID_AdjustServiceModeReq, mData); +} /*! * \brief MessageDispatcher::onAdjustment @@ -759,6 +770,20 @@ onActionTransmit(GuiActionType::ID_UIPostFinalResultData, mData); } +/*! + * \brief MessageDispatcher::onAdjustment + * \details This method transmits the UI Generic User Confirmation result. + * \param vData - Data model contains the Generic User Confirmation result. + * \return void + */ +void MessageDispatcher::onAdjustment(const DuetConfirmUIrData &vData) +{ + QVariantList mData; + mData += vData.mId; + mData += vData.mConfirm; + onActionTransmit(GuiActionType::ID_DuetConfirmUIr, mData); +} + // ---------------------------------------------------------------------------------------------------- /*! @@ -800,13 +825,13 @@ #endif } - // coco begin validated: Has been tested manually but in this function this cannot be false because the message interpreter is doing the same validation. + // disabled coco begin validated: Has been tested manually but in this function this cannot 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 cannot be built")); // TODO : LogInfo Improvement return; } - // coco end + // disabled 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 @@ -933,12 +958,12 @@ checkAcknowTransmit(vMessage, srcText); // then if needs acknow send it immediately. } - // coco begin validated: Has been validated manually. If MessageInterpreter::interpretMessage fails, this also returns false + // disabled coco begin validated: Has been validated manually. If MessageInterpreter::interpretMessage fails, this also returns false if ( _interpreter.interpretMessage( vMessage, mData ) ) { ok = true; emit didActionReceive(vMessage.actionId, mData); } - // coco end + // disabled coco end _messageList[vMessage.can_id].removeLast(); return ok; @@ -951,15 +976,15 @@ */ Sequence MessageDispatcher::rxCount() { - // coco begin validated: has been manually validated since it requires so many received messages to reset the seq + // disabled coco begin validated: has been manually validated since it requires so many received messages to reset the seq if ( _rxSequence < SEQUENCE_MAX ) { ++_rxSequence; } else { _rxSequence = 1; } return _rxSequence; } -// coco end +// disabled coco end /*! * \brief MessageDispatcher::txCount @@ -968,15 +993,15 @@ */ Sequence MessageDispatcher::txCount() { - // coco begin validated: has been manually validated since it requires so many received messages to reset the seq + // disabled coco begin validated: has been manually validated since it requires so many received messages to reset the seq if ( _txSequence < SEQUENCE_MAX ) { ++_txSequence; } else { _txSequence = 1; } return _txSequence; } -// coco end +// disabled coco end /*! * \brief MessageDispatcher::needsAcknow