Index: denali.pro =================================================================== diff -u -re5a802bc26647388cfea4f1d46ae22570ec2dba3 -rb5a7852d2637f7969680fbd3d2c821a6a74a8ccd --- denali.pro (.../denali.pro) (revision e5a802bc26647388cfea4f1d46ae22570ec2dba3) +++ denali.pro (.../denali.pro) (revision b5a7852d2637f7969680fbd3d2c821a6a74a8ccd) @@ -86,6 +86,7 @@ sources/model/hd/alarm/MAlarmClearedCondition.h \ \ # ---------- Models - HD - Adjustment sources/model/hd/adjustment/MTreatmentAdjustHDVersionsResponse.h \ + sources/model/hd/adjustment/MAdjustHDDateTimeResponse.h \ \ # ---------- Models - HD - Adjustment - In-Treatment sources/model/hd/adjustment/MTreatmentAdjustRequests.h \ sources/model/hd/adjustment/MTreatmentAdjustDurationResponse.h \ @@ -118,6 +119,7 @@ sources/model/hd/data/MPrimingData.h \ \ # ---------- Models - DG - Adjustment sources/model/dg/adjustment/MTreatmentAdjustDGVersionsResponse.h \ + sources/model/dg/adjustment/MAdjustDGDateTimeResponse.h \ \ # ---------- Models - DG - Data sources/model/dg/data/MDGDrainPumpData.h \ sources/model/dg/data/MDGHeatersData.h \ @@ -159,6 +161,7 @@ sources/view/VPriming.h \ sources/view/VVitals.h \ sources/view/VNetworkModel.h \ + sources/view/VDateTime.h \ \ # ---------- Views - Alarm sources/view/hd/alarm/VAlarmStatus.h \ \ # ---------- Views - HD - Adjustment @@ -242,6 +245,7 @@ sources/model/hd/alarm/MAlarmClearedCondition.cpp \ \ # ---------- Models - HD - Adjustment - In-Treatment sources/model/hd/adjustment/MTreatmentAdjustHDVersionsResponse.cpp \ + sources/model/hd/adjustment/MAdjustHDDateTimeResponse.cpp \ \ # ---------- Models - HD - Adjustment - In-Treatment sources/model/hd/adjustment/MTreatmentAdjustDurationResponse.cpp \ sources/model/hd/adjustment/MTreatmentAdjustBloodDialysateResponse.cpp \ @@ -273,6 +277,7 @@ sources/model/hd/data/MPrimingData.cpp \ \ # ---------- Models - DG - Adjustment sources/model/dg/adjustment/MTreatmentAdjustDGVersionsResponse.cpp \ + sources/model/dg/adjustment/MAdjustDGDateTimeResponse.cpp \ \ # ---------- Models - DG - Data sources/model/dg/data/MDGDrainPumpData.cpp \ sources/model/dg/data/MDGHeatersData.cpp \ @@ -311,6 +316,7 @@ sources/view/VPowerOff.cpp \ sources/view/VVitals.cpp \ sources/view/VNetworkModel.cpp \ + sources/view/VDateTime.cpp \ \ # ---------- Views - Alarm sources/view/hd/alarm/VAlarmStatus.cpp \ \ # ---------- Views - HD - Adjustment Index: denali.pro.user =================================================================== diff -u -r13ac42cf8bdc5038dedd3302ba79dc387e5704b4 -rb5a7852d2637f7969680fbd3d2c821a6a74a8ccd --- denali.pro.user (.../denali.pro.user) (revision 13ac42cf8bdc5038dedd3302ba79dc387e5704b4) +++ denali.pro.user (.../denali.pro.user) (revision b5a7852d2637f7969680fbd3d2c821a6a74a8ccd) @@ -1,6 +1,6 @@ - + EnvironmentId Index: sources/canbus/MessageDispatcher.cpp =================================================================== diff -u -r179783b8085cac87e0fe9f247b475f2c64886174 -rb5a7852d2637f7969680fbd3d2c821a6a74a8ccd --- sources/canbus/MessageDispatcher.cpp (.../MessageDispatcher.cpp) (revision 179783b8085cac87e0fe9f247b475f2c64886174) +++ sources/canbus/MessageDispatcher.cpp (.../MessageDispatcher.cpp) (revision b5a7852d2637f7969680fbd3d2c821a6a74a8ccd) @@ -484,6 +484,32 @@ } /*! + * \brief MessageDispatcher::onAdjustment + * \details This method transmits the HD Set Date Time Denali message. + * \param vData - Data model contains the epoch time + * \return void + */ +void MessageDispatcher::onAdjustment(const AdjustHDDateTimeRequestData &vData) +{ + QVariantList mData; + mData += vData.mEpoch ; + onActionTransmit(GuiActionType::ID_AdjustHDDateTimeReq, mData); +} + +/*! + * \brief MessageDispatcher::onAdjustment + * \details This method transmits the DG Set Date Time Denali message. + * \param vData - Data model contains the epoch time + * \return void + */ +void MessageDispatcher::onAdjustment(const AdjustDGDateTimeRequestData &vData) +{ + QVariantList mData; + mData += vData.mEpoch ; + onActionTransmit(GuiActionType::ID_AdjustDGDateTimeReq, mData); +} + +/*! * \brief MessageDispatcher::actionTransmit * \details This method is called by slot MessageDispatcher::onActionTransmit * which emits didFrameTransmit on successful interpretation of the requested message Index: sources/canbus/MessageDispatcher.h =================================================================== diff -u -r93b6bd48e2aec1fca4f2b5b79dcefffa49e9ce16 -rb5a7852d2637f7969680fbd3d2c821a6a74a8ccd --- sources/canbus/MessageDispatcher.h (.../MessageDispatcher.h) (revision 93b6bd48e2aec1fca4f2b5b79dcefffa49e9ce16) +++ sources/canbus/MessageDispatcher.h (.../MessageDispatcher.h) (revision b5a7852d2637f7969680fbd3d2c821a6a74a8ccd) @@ -120,6 +120,8 @@ GuiActionType::ID_AdjustRecirculateReq , GuiActionType::ID_AdjustTreatmentEndReq , GuiActionType::ID_AdjustVersionsReq , + GuiActionType::ID_AdjustHDDateTimeReq , + GuiActionType::ID_AdjustDGDateTimeReq , // Alarm GuiActionType::ID_AlarmUserActionReq , GuiActionType::ID_AlarmSilenceReq , Index: sources/canbus/MessageGlobals.h =================================================================== diff -u -r13ac42cf8bdc5038dedd3302ba79dc387e5704b4 -rb5a7852d2637f7969680fbd3d2c821a6a74a8ccd --- sources/canbus/MessageGlobals.h (.../MessageGlobals.h) (revision 13ac42cf8bdc5038dedd3302ba79dc387e5704b4) +++ sources/canbus/MessageGlobals.h (.../MessageGlobals.h) (revision b5a7852d2637f7969680fbd3d2c821a6a74a8ccd) @@ -156,6 +156,12 @@ {Gui::GuiActionType::ID_AdjustHDVersionsRsp , 9 }, // 9 parameters each 4bytes {Gui::GuiActionType::ID_AdjustDGVersionsRsp , 9 }, // 9 parameters each 4bytes + // ---- RTC + {Gui::GuiActionType::ID_AdjustHDDateTimeReq , 1 * 4 }, // 1 parameters each 4bytes + {Gui::GuiActionType::ID_AdjustHDDateTimeRsp , 2 * 4 }, // 2 parameters each 4bytes + {Gui::GuiActionType::ID_AdjustDGDateTimeReq , 1 * 4 }, // 1 parameters each 4bytes + {Gui::GuiActionType::ID_AdjustDGDateTimeRsp , 2 * 4 }, // 2 parameters each 4bytes + // ---- {Gui::GuiActionType::ID_CANBusFaultCount , 1 }, {Gui::GuiActionType::ID_RawData , 255 }, Index: sources/canbus/MessageInterpreter.cpp =================================================================== diff -u -r179783b8085cac87e0fe9f247b475f2c64886174 -rb5a7852d2637f7969680fbd3d2c821a6a74a8ccd --- sources/canbus/MessageInterpreter.cpp (.../MessageInterpreter.cpp) (revision 179783b8085cac87e0fe9f247b475f2c64886174) +++ sources/canbus/MessageInterpreter.cpp (.../MessageInterpreter.cpp) (revision b5a7852d2637f7969680fbd3d2c821a6a74a8ccd) @@ -233,6 +233,8 @@ case Gui::GuiActionType::ID_PowerOff : INTERPRET_RECEIVED_MESSAGE(AdjustPowerOffRequestData ); break; case Gui::GuiActionType::ID_AdjustVersionsReq : INTERPRET_RECVD_MT_MESSAGE(AdjustVersionsRequestData ); break; + case Gui::GuiActionType::ID_AdjustHDDateTimeReq : INTERPRET_RECEIVED_MESSAGE(AdjustHDDateTimeRequestData ); break; + case Gui::GuiActionType::ID_AdjustDGDateTimeReq : INTERPRET_RECEIVED_MESSAGE(AdjustDGDateTimeRequestData ); break; // in-treatment case Gui::GuiActionType::ID_AdjustDurationReq : INTERPRET_RECEIVED_MESSAGE(AdjustDurationRequestData ); break; case Gui::GuiActionType::ID_AdjustBloodDialysateReq : INTERPRET_RECEIVED_MESSAGE(AdjustBloodDialysateRequestData ); break; @@ -357,6 +359,7 @@ case Gui::GuiActionType::ID_AdjustRecirculateRsp : ok = notify(vMessage, vData, Gui::GuiActionType::ID_AdjustRecirculateRsp ); break; case Gui::GuiActionType::ID_AdjustTreatmentEndRsp : ok = notify(vMessage, vData, Gui::GuiActionType::ID_AdjustTreatmentEndRsp ); break; case Gui::GuiActionType::ID_AdjustHDVersionsRsp : ok = notify(vMessage, vData, Gui::GuiActionType::ID_AdjustHDVersionsRsp ); break; + case Gui::GuiActionType::ID_AdjustHDDateTimeRsp : ok = notify(vMessage, vData, Gui::GuiActionType::ID_AdjustHDDateTimeRsp ); break; // these need to be standard and use notify as well case Gui::GuiActionType::ID_AdjustUltrafiltrationEditRsp : ok = adjustUltrafiltrationEdit (vMessage, vData); break; // TODO : implement notify<>() @@ -417,7 +420,9 @@ // DG Response Messages case Gui::GuiActionType::ID_AdjustDGVersionsRsp : ok = notify(vMessage, vData, Gui::GuiActionType::ID_AdjustDGVersionsRsp ); break; + case Gui::GuiActionType::ID_AdjustDGDateTimeRsp : ok = notify(vMessage, vData, Gui::GuiActionType::ID_AdjustDGDateTimeRsp ); break; + // unhandled messages: these will only be logged as received message // there has nothing been defined for these messages. default: Index: sources/gui/GuiGlobals.cpp =================================================================== diff -u -rf35b360054e1e2fa81bf107427fe2d50d78e9e8a -rb5a7852d2637f7969680fbd3d2c821a6a74a8ccd --- sources/gui/GuiGlobals.cpp (.../GuiGlobals.cpp) (revision f35b360054e1e2fa81bf107427fe2d50d78e9e8a) +++ sources/gui/GuiGlobals.cpp (.../GuiGlobals.cpp) (revision b5a7852d2637f7969680fbd3d2c821a6a74a8ccd) @@ -76,6 +76,7 @@ #include "VTreatmentAdjustmentEnd.h" #include "VTreatmentAdjustmentPressuresLimits.h" #include "VTreatmentAdjustmentVersions.h" +#include "VDateTime.h" namespace Gui { MainView *_viewer = nullptr; Index: sources/gui/GuiGlobals.h =================================================================== diff -u -r5215e145a0f26a20c99e3f10af6ac8a9c3b67383 -rb5a7852d2637f7969680fbd3d2c821a6a74a8ccd --- sources/gui/GuiGlobals.h (.../GuiGlobals.h) (revision 5215e145a0f26a20c99e3f10af6ac8a9c3b67383) +++ sources/gui/GuiGlobals.h (.../GuiGlobals.h) (revision b5a7852d2637f7969680fbd3d2c821a6a74a8ccd) @@ -171,6 +171,12 @@ ID_AdjustVersionsReq = 0x1C00, // 28 ID_AdjustHDVersionsRsp = 0x1D00, // 29 ID_AdjustDGVersionsRsp = 0x1E00, // 30 + + // RTC + ID_AdjustHDDateTimeReq = 0x6D00, // 109 + ID_AdjustHDDateTimeRsp = 0x6E00, // 110 + ID_AdjustDGDateTimeReq = 0x6F00, // 111 + ID_AdjustDGDateTimeRsp = 0x7000, // 112 }; enum class GuiActionsData_Enum /*: quint8 QML doesn't support*/ { @@ -190,13 +196,16 @@ enum AlertID { ID_Alert_None = 0, ID_Alert_BLE_Connection, - ID_Alert_BLE_Measurement_Timeout + ID_Alert_BLE_Measurement_Timeout, + ID_Alert_Set_HD_RTC_Response, + ID_Alert_Set_DG_RTC_Response }; struct AlertRequest { AlertID id; QString title; QString description; + bool acknowledgeOnly; }; struct AlertResponse { Index: sources/gui/qml/dialogs/Alert.qml =================================================================== diff -u -r89e3ca8e108dd4b3315ae7862c631eba43f8fd0f -rb5a7852d2637f7969680fbd3d2c821a6a74a8ccd --- sources/gui/qml/dialogs/Alert.qml (.../Alert.qml) (revision 89e3ca8e108dd4b3315ae7862c631eba43f8fd0f) +++ sources/gui/qml/dialogs/Alert.qml (.../Alert.qml) (revision b5a7852d2637f7969680fbd3d2c821a6a74a8ccd) @@ -83,6 +83,7 @@ TouchRect { id: _confirm objectName: "AlertConfirmButton" + visible: !vAlert.acknowledgeOnly width: _root.width / 3; text.text: qsTr("CONFIRM") button.onPressed: { @@ -93,6 +94,7 @@ TouchRect { id: _cancel objectName: "AlertCancelButton" + visible: !vAlert.acknowledgeOnly width: _root.width / 3; text.text: qsTr("CANCEL") button.onPressed: { @@ -102,6 +104,23 @@ } } + + TouchRect { id: _acknowledge + objectName: "AlertOkayButton" + anchors { + horizontalCenter: parent.horizontalCenter + bottom: parent.bottom + bottomMargin: Variables.dialogMargin + } + visible: vAlert.acknowledgeOnly + width: _root.width / 3; + text.text: qsTr("OKAY") + button.onPressed: { + vAlert.doAlertResponse(true) + close() + } + } + Connections { target: vAlert onDidRequestShowAlert: { Index: sources/gui/qml/main.qml =================================================================== diff -u -r5600d2133dd0ea6dc1f733aa78bd26e2a4892a38 -rb5a7852d2637f7969680fbd3d2c821a6a74a8ccd --- sources/gui/qml/main.qml (.../main.qml) (revision 5600d2133dd0ea6dc1f733aa78bd26e2a4892a38) +++ sources/gui/qml/main.qml (.../main.qml) (revision b5a7852d2637f7969680fbd3d2c821a6a74a8ccd) @@ -71,6 +71,7 @@ import VVitals 0.1; import VAlert 0.1; import VNetworkModel 0.1; +import VDateTime 0.1; // Qml imports import "qrc:/globals" @@ -138,6 +139,7 @@ VVitals { id: vVitals } VAlert { id: vAlert } VNetworkModel { id: vNetworkModel } + VDateTime { id: vDateTime } VHDTreatmentStates { id: vHDTreatmentStates } Index: sources/gui/qml/pages/SettingsDateTimeSet.qml =================================================================== diff -u -r917f7b344c2c8121c2d5241326b0e9b7b2aa1396 -rb5a7852d2637f7969680fbd3d2c821a6a74a8ccd --- sources/gui/qml/pages/SettingsDateTimeSet.qml (.../SettingsDateTimeSet.qml) (revision 917f7b344c2c8121c2d5241326b0e9b7b2aa1396) +++ sources/gui/qml/pages/SettingsDateTimeSet.qml (.../SettingsDateTimeSet.qml) (revision b5a7852d2637f7969680fbd3d2c821a6a74a8ccd) @@ -85,7 +85,7 @@ bottom: 0 top: 24 } - textInput.text: "HH" + textInput.text: vDateTime.hour onEnterPressed: { _keyboard.setVisible(false) } @@ -113,7 +113,7 @@ bottom: 0 top: 60 } - textInput.text: "MM" + textInput.text: vDateTime.minute onEnterPressed: { _keyboard.setVisible(false) } @@ -145,7 +145,7 @@ bottom: 1 top: 12 } - textInput.text: "MM" + textInput.text: vDateTime.month onEnterPressed: { _keyboard.setVisible(false) } @@ -173,7 +173,7 @@ bottom: 1 top: 31 } - textInput.text: "DD" + textInput.text: vDateTime.day onEnterPressed: { _keyboard.setVisible(false) } @@ -202,7 +202,7 @@ bottom: 1970 top: 2200 } - textInput.text: "YYYY" + textInput.text: vDateTime.year onEnterPressed: { _keyboard.setVisible(false) } @@ -216,7 +216,7 @@ backgroundColor: Colors.backgroundButtonSelect textColor: Colors.textMain text.text: qsTr("Save") - onClicked: console.debug("Clicked Save Date and Time") + onClicked: vDateTime.doSave() } } } Index: sources/model/MModel.h =================================================================== diff -u -r5215e145a0f26a20c99e3f10af6ac8a9c3b67383 -rb5a7852d2637f7969680fbd3d2c821a6a74a8ccd --- sources/model/MModel.h (.../MModel.h) (revision 5215e145a0f26a20c99e3f10af6ac8a9c3b67383) +++ sources/model/MModel.h (.../MModel.h) (revision b5a7852d2637f7969680fbd3d2c821a6a74a8ccd) @@ -70,6 +70,8 @@ #include "MStartTreatmentResponse.h" #include "MTreatmentAdjustHDVersionsResponse.h" #include "MTreatmentAdjustDGVersionsResponse.h" +#include "MAdjustHDDateTimeResponse.h" +#include "MAdjustDGDateTimeResponse.h" /*! * \page MessageFlow Message interpretation Flow @@ -250,6 +252,8 @@ REGISTER_METATYPE( AdjustPressuresLimitsRequestData ) \ REGISTER_METATYPE( AdjustTreatmentParametersRequestData ) \ REGISTER_METATYPE( AdjustVersionsRequestData ) \ + REGISTER_METATYPE( AdjustHDDateTimeRequestData ) \ + REGISTER_METATYPE( AdjustDGDateTimeRequestData ) \ /* Response */ \ REGISTER_METATYPE( GuiAlertRequestData ) \ REGISTER_METATYPE( TreatmentStartResponseData ) \ @@ -269,7 +273,9 @@ REGISTER_METATYPE( AdjustPressuresLimitsResponseData ) \ REGISTER_METATYPE( AdjustTreatmentParametersResponseData ) \ REGISTER_METATYPE( AdjustHDVersionsResponseData ) \ - REGISTER_METATYPE( AdjustDGVersionsResponseData ) + REGISTER_METATYPE( AdjustDGVersionsResponseData ) \ + REGISTER_METATYPE( AdjustHDDateTimeResponseData ) \ + REGISTER_METATYPE( AdjustDGDateTimeResponseData ) //===============================================================================// /*! @@ -340,6 +346,8 @@ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, AdjustTreatmentParametersResponseData ) \ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, AdjustHDVersionsResponseData ) \ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, AdjustDGVersionsResponseData ) \ + ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, AdjustHDDateTimeResponseData ) \ + ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, AdjustDGDateTimeResponseData ) // /* Request */ ---------------------------------------------------------// #define ADJUST_TRANSMT_MODEL_BRIDGE_CONNECTIONS(vSOURCE) \ @@ -364,6 +372,8 @@ \ ADJUST_TRANSMT_BRIDGE_CONNECTION(vSOURCE, AlarmSilenceRequestData ) \ ADJUST_TRANSMT_BRIDGE_CONNECTION(vSOURCE, AlarmUserActionRequestData ) \ + ADJUST_TRANSMT_BRIDGE_CONNECTION(vSOURCE, AdjustHDDateTimeRequestData ) \ + ADJUST_TRANSMT_BRIDGE_CONNECTION(vSOURCE, AdjustDGDateTimeRequestData ) \ /* coco begin validated: Manually tested. This model class is a placeholder and there is no use case for this now. ADJUST_TRANSMT_BRIDGE_CONNECTION(vSOURCE, AlarmClearedConditionRequestData ) \ coco end */ \ @@ -440,6 +450,8 @@ ACTION_RECEIVE_BRIDGE_DEFINITION( AdjustTreatmentParametersResponseData ) \ ACTION_RECEIVE_BRIDGE_DEFINITION( AdjustHDVersionsResponseData ) \ ACTION_RECEIVE_BRIDGE_DEFINITION( AdjustDGVersionsResponseData ) \ + ACTION_RECEIVE_BRIDGE_DEFINITION( AdjustHDDateTimeResponseData ) \ + ACTION_RECEIVE_BRIDGE_DEFINITION( AdjustDGDateTimeResponseData ) \ #define ADJUST_TRANSMT_MODEL_BRIDGE_DEFINITIONS \ /* Request --------------------------------------------------------- */ \ @@ -459,6 +471,8 @@ ADJUST_TRANSMT_BRIDGE_DEFINITION( AdjustPressuresLimitsRequestData ) \ ADJUST_TRANSMT_BRIDGE_DEFINITION( AdjustTreatmentParametersRequestData ) \ ADJUST_TRANSMT_BRIDGE_DEFINITION( AdjustVersionsRequestData ) \ + ADJUST_TRANSMT_BRIDGE_DEFINITION( AdjustHDDateTimeRequestData ) \ + ADJUST_TRANSMT_BRIDGE_DEFINITION( AdjustDGDateTimeRequestData ) \ \ ADJUST_TRANSMT_BRIDGE_DEFINITION( AlarmSilenceRequestData ) \ ADJUST_TRANSMT_BRIDGE_DEFINITION( AlarmUserActionRequestData ) \ @@ -484,6 +498,8 @@ ADJUST_TRANSMT_BRIDGE_DEFINITION_NOEMIT( AdjustPressuresLimitsRequestData ) \ ADJUST_TRANSMT_BRIDGE_DEFINITION_NOEMIT( AdjustTreatmentParametersRequestData ) \ ADJUST_TRANSMT_BRIDGE_DEFINITION_NOEMIT( AdjustVersionsRequestData ) \ + ADJUST_TRANSMT_BRIDGE_DEFINITION_NOEMIT( AdjustHDDateTimeRequestData ) \ + ADJUST_TRANSMT_BRIDGE_DEFINITION_NOEMIT( AdjustDGDateTimeRequestData ) \ \ ADJUST_TRANSMT_BRIDGE_DEFINITION_NOEMIT( AlarmSilenceRequestData ) \ ADJUST_TRANSMT_BRIDGE_DEFINITION_NOEMIT( AlarmUserActionRequestData ) \ @@ -509,6 +525,8 @@ ADJUST_TRANSMT_BRIDGE_DEFINITION_PUBLIC( TreatmentConfirmRequestData ) \ ADJUST_TRANSMT_BRIDGE_DEFINITION_PUBLIC( AdjustTreatmentParametersRequestData ) \ ADJUST_TRANSMT_BRIDGE_DEFINITION_PUBLIC( AdjustVersionsRequestData ) \ + ADJUST_TRANSMT_BRIDGE_DEFINITION_PUBLIC( AdjustHDDateTimeRequestData ) \ + ADJUST_TRANSMT_BRIDGE_DEFINITION_PUBLIC( AdjustDGDateTimeRequestData ) \ \ ADJUST_TRANSMT_BRIDGE_DEFINITION_PUBLIC( AlarmSilenceRequestData ) \ ADJUST_TRANSMT_BRIDGE_DEFINITION_PUBLIC( AlarmUserActionRequestData ) \ @@ -572,6 +590,8 @@ ACTION_RECEIVE_SIGNAL( AdjustPressuresLimitsResponseData ) \ ACTION_RECEIVE_SIGNAL( AdjustHDVersionsResponseData ) \ ACTION_RECEIVE_SIGNAL( AdjustDGVersionsResponseData ) \ + ACTION_RECEIVE_SIGNAL( AdjustHDDateTimeResponseData ) \ + ACTION_RECEIVE_SIGNAL( AdjustDGDateTimeResponseData ) \ //--------------------------------------------------------------------------------// //--------------------------------------------------------------------------------// Index: sources/model/dg/adjustment/MAdjustDGDateTimeResponse.cpp =================================================================== diff -u --- sources/model/dg/adjustment/MAdjustDGDateTimeResponse.cpp (revision 0) +++ sources/model/dg/adjustment/MAdjustDGDateTimeResponse.cpp (revision b5a7852d2637f7969680fbd3d2c821a6a74a8ccd) @@ -0,0 +1,31 @@ +#include "MAdjustDGDateTimeResponse.h" + +using namespace Model; + +QVariantList MAdjustDGDateTimeResponse::parameters() const { + return { + _data.mAccepted.value, + _data.mReason .value, + }; +} + +bool MAdjustDGDateTimeResponse::fromByteArray(const QByteArray &vByteArray, int *vIndex) { + int index = 0; // message data start position + if (GetValue(vByteArray, index, _data.mAccepted )) + if (GetValue(vByteArray, index, _data.mReason )) + return true ; + else { if(vIndex) *vIndex = index; return false; } + else { if(vIndex) *vIndex = index; return false; } +} + +/*! + * \brief MAdjustDGDateTimeResponse::data + * \details Provides model's Data from the received messages data values + * \return Data + */ +AdjustDGDateTimeResponseData MAdjustDGDateTimeResponse::data() const { + Data data; + data.mAccepted = _data.mAccepted.value; + data.mReason = _data.mReason .value; + return data; +} Index: sources/model/dg/adjustment/MAdjustDGDateTimeResponse.h =================================================================== diff -u --- sources/model/dg/adjustment/MAdjustDGDateTimeResponse.h (revision 0) +++ sources/model/dg/adjustment/MAdjustDGDateTimeResponse.h (revision b5a7852d2637f7969680fbd3d2c821a6a74a8ccd) @@ -0,0 +1,68 @@ +#pragma once + +// Qt +#include + +// Project +#include "MAbstract.h" +#include "types.h" + +// forward declarations +class tst_models; + +namespace Model { + +/*! + * \brief The MAdjustDGDateTimeResponse class + * \details The DG Date and Time adjustment response model + * + * | MSG | CAN ID | M.Box | Type | Ack | Src | Dest | Description | + * |:----:|:------:|:-----:|:----:|:---:|:---:|:----:|:---------------------:| + * |0x7000| 0x070 | | Rsp | Y | DG | UI | Set RTC Response | + * + * | Payload || + * | || + * | #1:(U32) | \ref Data::mAccepted | + * | #2:(U32) | \ref Data::mReason | + * + * \sa Data + * + *

Logging info

+ * | || + * | || + * | typeText | Event | + * | unitText | DG | + * | infoText | AdjustDGDateTimeResponse | + * + */ +class MAdjustDGDateTimeResponse : public MAbstract { + + // friends + friend class ::tst_models; + + QVariantList parameters() const override; + + struct { + Types::U32 mAccepted; + Types::U32 mReason ; + } _data; + +public: + + Type_Enum typeText () const override { return Type_Enum::eEvent ; } + Unit_Enum unitText () const override { return Unit_Enum::eDG ; } + QString infoText () const override { return QString("AdjustDGDateTimeResponse") ; } + + struct Data { + bool mAccepted = 0; /*!< Accepted value of type quint32 extracted out */ + quint32 mReason = 0; /*!< Reason value of type quint32 extracted out */ + }; + + MAdjustDGDateTimeResponse () { } + + bool fromByteArray (const QByteArray &vByteArray , int *vIndex = nullptr) override; + Data data ( ) const ; +}; +} + +typedef Model::MAdjustDGDateTimeResponse::Data AdjustDGDateTimeResponseData; Index: sources/model/hd/adjustment/MAdjustHDDateTimeResponse.cpp =================================================================== diff -u --- sources/model/hd/adjustment/MAdjustHDDateTimeResponse.cpp (revision 0) +++ sources/model/hd/adjustment/MAdjustHDDateTimeResponse.cpp (revision b5a7852d2637f7969680fbd3d2c821a6a74a8ccd) @@ -0,0 +1,45 @@ +/*! + * + * 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 MTreatmentAdjustSalineResponse.cpp + * \author (last) Behrouz NematiPour + * \date (last) 08-Sep-2020 + * \author (original) Behrouz NematiPour + * \date (original) 10-Aug-2020 + * + */ +#include "MAdjustHDDateTimeResponse.h" + +using namespace Model; + +QVariantList MAdjustHDDateTimeResponse::parameters() const { + return { + _data.mAccepted.value, + _data.mReason .value, + }; +} + +bool MAdjustHDDateTimeResponse::fromByteArray(const QByteArray &vByteArray, int *vIndex) { + int index = 0; // message data start position + if (GetValue(vByteArray, index, _data.mAccepted )) + if (GetValue(vByteArray, index, _data.mReason )) + return true ; + else { if(vIndex) *vIndex = index; return false; } + else { if(vIndex) *vIndex = index; return false; } +} + +/*! + * \brief MAdjustHDDateTimeResponse::data + * \details Provides model's Data from the received messages data values + * \return Data + */ +AdjustHDDateTimeResponseData MAdjustHDDateTimeResponse::data() const { + Data data; + data.mAccepted = _data.mAccepted.value; + data.mReason = _data.mReason .value; + return data; +} Index: sources/model/hd/adjustment/MAdjustHDDateTimeResponse.h =================================================================== diff -u --- sources/model/hd/adjustment/MAdjustHDDateTimeResponse.h (revision 0) +++ sources/model/hd/adjustment/MAdjustHDDateTimeResponse.h (revision b5a7852d2637f7969680fbd3d2c821a6a74a8ccd) @@ -0,0 +1,82 @@ +/*! + * + * 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 MTreatmentAdjustSalineResponse.h + * \author (last) Behrouz NematiPour + * \date (last) 25-Sep-2020 + * \author (original) Behrouz NematiPour + * \date (original) 10-Aug-2020 + * + */ +#pragma once + +// Qt +#include + +// Project +#include "MAbstract.h" +#include "types.h" + +// forward declarations +class tst_models; + +namespace Model { + +/*! + * \brief The MAdjustHDDateTimeResponse class + * \details The HD Date and Time adjustment response model + * + * | MSG | CAN ID | M.Box | Type | Ack | Src | Dest | Description | + * |:----:|:------:|:-----:|:----:|:---:|:---:|:----:|:---------------------:| + * |0x6E00| 0x020 | | Rsp | Y | HD | UI | Set RTC Response | + * + * | Payload || + * | || + * | #1:(U32) | \ref Data::mAccepted | + * | #2:(U32) | \ref Data::mReason | + * + * \sa Data + * + *

Logging info

+ * | || + * | || + * | typeText | Event | + * | unitText | DG | + * | infoText | AdjustHDDateTimeResponse | + * + */ +class MAdjustHDDateTimeResponse : public MAbstract { + + // friends + friend class ::tst_models; + + QVariantList parameters() const override; + + struct { + Types::U32 mAccepted; + Types::U32 mReason ; + } _data; + +public: + + Type_Enum typeText () const override { return Type_Enum::eEvent ; } + Unit_Enum unitText () const override { return Unit_Enum::eHD ; } + QString infoText () const override { return QString("AdjustHDDateTimeResponse") ; } + + struct Data { + bool mAccepted = 0; /*!< Accepted value of type quint32 extracted out */ + quint32 mReason = 0; /*!< Reason value of type quint32 extracted out */ + }; + + MAdjustHDDateTimeResponse () { } + + bool fromByteArray (const QByteArray &vByteArray , int *vIndex = nullptr) override; + Data data ( ) const ; +}; +} + +typedef Model::MAdjustHDDateTimeResponse::Data AdjustHDDateTimeResponseData; Index: sources/model/hd/adjustment/MTreatmentAdjustRequests.h =================================================================== diff -u -r179783b8085cac87e0fe9f247b475f2c64886174 -rb5a7852d2637f7969680fbd3d2c821a6a74a8ccd --- sources/model/hd/adjustment/MTreatmentAdjustRequests.h (.../MTreatmentAdjustRequests.h) (revision 179783b8085cac87e0fe9f247b475f2c64886174) +++ sources/model/hd/adjustment/MTreatmentAdjustRequests.h (.../MTreatmentAdjustRequests.h) (revision b5a7852d2637f7969680fbd3d2c821a6a74a8ccd) @@ -722,6 +722,59 @@ return MModel::toString("AdjustTreatmentParametersRequest", vParameters); } }; + +/*! + * \brief The MAdjustHDDateTime class + * \details The model to request starting a treatment + * + * | MSG | CAN ID | M.Box | Type | Ack | Src | Dest | Description | + * |:----:|:------:|:-----:|:----:|:---:|:---:|:----:|:-------------------------:| + * | 109 | 0x100 | | Req | Y | UI | HD | Set RTC Date and Time | + * + * | Payload || + * | || + * | #1:(U32) | \ref mEpoch | + * + */ +class MAdjustHDDateTimeReq : public MModel { +public: + quint32 mEpoch; + // coco begin validated : Has been validated manually. + QString toString() { + return toString({mEpoch}); + } + // coco end + static QString toString(const QVariantList &vParameters) { + return MModel::toString("AdjustHDDateTime", vParameters); + } +}; + + +/*! + * \brief The MAdjustDGDateTime class + * \details The model to request starting a treatment + * + * | MSG | CAN ID | M.Box | Type | Ack | Src | Dest | Description | + * |:----:|:------:|:-----:|:----:|:---:|:---:|:----:|:-------------------------:| + * | 111 | 0x110 | | Req | Y | UI | DG | Set RTC Date and Time | + * + * | Payload || + * | || + * | #1:(U32) | \ref mEpoch | + * + */ +class MAdjustDGDateTimeReq : public MModel { +public: + quint32 mEpoch; + // coco begin validated : Has been validated manually. + QString toString() { + return toString({mEpoch}); + } + // coco end + static QString toString(const QVariantList &vParameters) { + return MModel::toString("AdjustDGDateTime", vParameters); + } +}; } typedef Model:: MAdjustPowerOffReq AdjustPowerOffRequestData; @@ -741,6 +794,8 @@ typedef Model:: MTreatmentConfirmReq TreatmentConfirmRequestData; typedef Model:: MAdjustTreatmentParametersReq AdjustTreatmentParametersRequestData; typedef Model:: MAdjustVersionsReq AdjustVersionsRequestData; +typedef Model:: MAdjustHDDateTimeReq AdjustHDDateTimeRequestData; +typedef Model:: MAdjustDGDateTimeReq AdjustDGDateTimeRequestData; // Alarms typedef Model:: MAlarmSilenceReq AlarmSilenceRequestData; typedef Model:: MAlarmClearedConditionReq AlarmClearedConditionRequestData; Index: sources/view/VAlert.cpp =================================================================== diff -u -r5384b4f5833568db90b988b11bbd502386d2f9b2 -rb5a7852d2637f7969680fbd3d2c821a6a74a8ccd --- sources/view/VAlert.cpp (.../VAlert.cpp) (revision 5384b4f5833568db90b988b11bbd502386d2f9b2) +++ sources/view/VAlert.cpp (.../VAlert.cpp) (revision b5a7852d2637f7969680fbd3d2c821a6a74a8ccd) @@ -52,6 +52,7 @@ alertID(request.id); title(request.title); description(request.description); + acknowledgeOnly(request.acknowledgeOnly); didRequestShowAlert(); } Index: sources/view/VAlert.h =================================================================== diff -u -rfdb48ba3fba8e95027ebf573325c8f25db74c070 -rb5a7852d2637f7969680fbd3d2c821a6a74a8ccd --- sources/view/VAlert.h (.../VAlert.h) (revision fdb48ba3fba8e95027ebf573325c8f25db74c070) +++ sources/view/VAlert.h (.../VAlert.h) (revision b5a7852d2637f7969680fbd3d2c821a6a74a8ccd) @@ -47,6 +47,7 @@ // coco begin validated: Has been validated manually PROPERTY(QString , title, "") PROPERTY(QString , description, "") + PROPERTY(bool , acknowledgeOnly, false) PROPERTY(GuiAlertID , alertID, GuiAlertID::ID_Alert_None) // coco end Index: sources/view/VDateTime.cpp =================================================================== diff -u --- sources/view/VDateTime.cpp (revision 0) +++ sources/view/VDateTime.cpp (revision b5a7852d2637f7969680fbd3d2c821a6a74a8ccd) @@ -0,0 +1,173 @@ + +// Qt + +// Project +#include "VDateTime.h" +#include "Logger.h" + +using namespace View; +using namespace Gui; + +VIEW_DEF_CLASS(VDateTime) + +/*! + * \brief VDateTime::initConnections + * Makes the necessary connections. Called inside VIEW_DEF_CLASS + */ +void VDateTime::initConnections() +{ + // outgoing + connect(this, SIGNAL(didAdjustment(const AdjustHDDateTimeRequestData)), + &_GuiController, SLOT(doAdjustment(const AdjustHDDateTimeRequestData))); + + connect(this, SIGNAL(didAdjustment(const AdjustDGDateTimeRequestData)), + &_GuiController, SLOT(doAdjustment(const AdjustDGDateTimeRequestData))); + + connect(this, SIGNAL(didRequestShowAlert(const GuiAlertRequestData)), + &_GuiController, SLOT(doAlertRequest(const GuiAlertRequestData))); + + // incoming + connect(&_GuiController, SIGNAL(didActionReceive(const AdjustHDDateTimeResponseData)), + this, SLOT(doActionReceive(const AdjustHDDateTimeResponseData))); + + connect(&_GuiController, SIGNAL(didActionReceive(const AdjustDGDateTimeResponseData)), + this, SLOT(doActionReceive(const AdjustDGDateTimeResponseData))); + + startTimer(_timerInterval); +} + +/*! + * \brief VDateTime::timerEvent + * Reads and displays the current date and time + * \param event (QTimerEvent*) the timer event + */ +void VDateTime::timerEvent(QTimerEvent *event) +{ + Q_UNUSED(event); + _currentTime = QDateTime::currentDateTime(); + hour (_currentTime.toString("hh")); + minute(_currentTime.toString("mm")); + second(_currentTime.toString("ss")); + month (_currentTime.toString("MM")); + day (_currentTime.toString("dd")); + year (_currentTime.toString("yyyy")); +} + +/*! + * \brief doSetHour + * Sets the hour + * \param vHour (int) - the hour + */ +void VDateTime::doSetHour(const int &vHour) +{ + hour(QStringLiteral("%1").arg(vHour, 2, 10, QLatin1Char('0'))); +} + +/*! + * \brief doSetMinute + * Sets the minute + * \param vMinute (int) - the minute + */ +void VDateTime::doSetMinute(const int &vMinute) +{ + minute(QStringLiteral("%1").arg(vMinute, 2, 10, QLatin1Char('0'))); +} + +/*! + * \brief doSetMonth + * Sets the month + * \param vMonth (int) - the month + */ +void VDateTime::doSetMonth(const int &vMonth) +{ + month(QStringLiteral("%1").arg(vMonth, 2, 10, QLatin1Char('0'))); +} + +/*! + * \brief doSetday + * Sets the day + * \param vDay (int) - the day + */ +void VDateTime::doSetDay(const int &vDay) +{ + day(QStringLiteral("%1").arg(vDay, 2, 10, QLatin1Char('0'))); +} + +/*! + * \brief doSetyear + * Sets the year + * \param vYear (int) - the year + */ +void VDateTime::doSetYear(const int &vYear) +{ + year(QStringLiteral("%1").arg(vYear, 4, 10, QLatin1Char('0'))); +} + +/*! + * \brief doSave + * Issues request to save the current date and time to UI, HD and DG + */ +void VDateTime::doSave() +{ + quint32 epoch = QDateTime(QDate(year().toInt(), + month().toInt(), + day().toInt()), + QTime(hour().toInt(), + minute().toInt())).toSecsSinceEpoch(); + AdjustHDDateTimeRequestData hdDateTimeReq; + hdDateTimeReq.mEpoch = epoch; + AdjustDGDateTimeRequestData dgDateTimeReq; + dgDateTimeReq.mEpoch = epoch; + emit didAdjustment(hdDateTimeReq); + emit didAdjustment(dgDateTimeReq); +} + +/*! + * \brief VDateTime::doActionReceive + * Called when we receive a response back from the HD after requesting to + * set the epoch + * \param vResponse (AdjustHDDateTimeResponseData) - the response + */ +void VDateTime::doActionReceive(const AdjustHDDateTimeResponseData &vResponse) +{ + GuiAlertRequestData alert; + alert.acknowledgeOnly = true; + alert.id = GuiAlertID::ID_Alert_Set_DG_RTC_Response; + if (vResponse.mAccepted == 1) + { + // alert the user that the request was successful. + alert.title = tr("Success"); + alert.description = tr("Successfully set the HD date and time."); + didRequestShowAlert(alert); + } else + { + alert.title = tr("Failure"); + alert.description = tr("The HD rejected the date and time setting."); + didRequestShowAlert(alert); + } +} + +/*! + * \brief VDateTime::doActionReceive + * Called when we receive a response back from the DG after requesting to + * set the epoch + * \param vResponse (AdjustDGDateTimeResponseData) - the response + */ +void VDateTime::doActionReceive(const AdjustDGDateTimeResponseData &vResponse) +{ + GuiAlertRequestData alert; + alert.acknowledgeOnly = true; + alert.id = GuiAlertID::ID_Alert_Set_DG_RTC_Response; + if (vResponse.mAccepted == 1) + { + alert.title = tr("Success"); + alert.description = tr("Successfully set the DG date and time."); + didRequestShowAlert(alert); + } else + { + alert.title = tr("Failure"); + alert.description = tr("The DG rejected the date and time setting."); + didRequestShowAlert(alert); + } + +} Index: sources/view/VDateTime.h =================================================================== diff -u --- sources/view/VDateTime.h (revision 0) +++ sources/view/VDateTime.h (revision b5a7852d2637f7969680fbd3d2c821a6a74a8ccd) @@ -0,0 +1,63 @@ + +#pragma once + +// Qt +#include +#include + +// Project +#include "VView.h" +#include "main.h" +#include "GuiController.h" +#include "MAdjustHDDateTimeResponse.h" +#include "MAdjustDGDateTimeResponse.h" + +// forward declarations +class tst_views; + +namespace View { + +/*! + * \brief The VDateTime class + * \details View for handling the date and time + * + */ +class VDateTime : public QObject +{ + Q_OBJECT +private: + + // friends + friend class ::tst_views; + int _timerInterval = 1000; // ms + QDateTime _currentTime; + + void timerEvent(QTimerEvent *event); + +VIEW_DEC_CLASS(VDateTime) + +protected: + // coco begin validated: Has been validated manually + PROPERTY(QString, hour, 0) + PROPERTY(QString, minute, 0) + PROPERTY(QString, second, 0) + PROPERTY(QString, month, 0) + PROPERTY(QString, day, 0) + PROPERTY(QString, year, 0) + // coco end +public slots: + void doSetHour(const int &vHour); + void doSetMinute(const int &vMinute); + void doSetMonth(const int &vMonth); + void doSetDay(const int &vDay); + void doSetYear(const int &vYear); + void doSave(); +signals: + void didAdjustment(const AdjustHDDateTimeRequestData); + void didAdjustment(const AdjustDGDateTimeRequestData); + void didRequestShowAlert(const GuiAlertRequestData); +private slots: + void doActionReceive(const AdjustHDDateTimeResponseData &vResponse); + void doActionReceive(const AdjustDGDateTimeResponseData &vResponse); +}; +} Index: sources/view/VView.h =================================================================== diff -u -re5a802bc26647388cfea4f1d46ae22570ec2dba3 -rb5a7852d2637f7969680fbd3d2c821a6a74a8ccd --- sources/view/VView.h (.../VView.h) (revision e5a802bc26647388cfea4f1d46ae22570ec2dba3) +++ sources/view/VView.h (.../VView.h) (revision b5a7852d2637f7969680fbd3d2c821a6a74a8ccd) @@ -151,6 +151,7 @@ REGISTER_TYPE( VTreatmentAdjustmentSaline ) \ REGISTER_TYPE( VVitals ) \ REGISTER_TYPE( VAlert ) \ - REGISTER_TYPE( VNetworkModel ) + REGISTER_TYPE( VNetworkModel ) \ + REGISTER_TYPE( VDateTime ) //--------------------------------------------------------------------------------//