Index: sources/gui/guiglobals.h =================================================================== diff -u -r4a6abe765f03feae8100ec660aa04aa218d4dfa3 -radf89000bad1a50ec33114ea76d65621a1d351d5 --- sources/gui/guiglobals.h (.../guiglobals.h) (revision 4a6abe765f03feae8100ec660aa04aa218d4dfa3) +++ sources/gui/guiglobals.h (.../guiglobals.h) (revision adf89000bad1a50ec33114ea76d65621a1d351d5) @@ -1,58 +1,129 @@ /*! - * + * * 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 guiglobals.h - * date 10/27/2019 - * author Behrouz NematiPour - * + * \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 guiglobals.h + * \author (last) Behrouz NematiPour + * \date (last) 25-Aug-2020 + * \author (original) Behrouz NematiPour + * \date (original) 28-Oct-2019 + * */ #pragma once // Qt #include +// Project + namespace Gui { - extern QQuickView *_viewer; + class MainView : public QQuickView { + Q_OBJECT + + bool event(QEvent* vEvent) override + { + emit eventSpy(vEvent); + return QQuickView::event(vEvent); + } + signals: + void eventSpy(QEvent* vEvent); + }; + extern MainView *_viewer; + class GuiActions { Q_GADGET explicit GuiActions(); public: - enum /*class*/ GuiActionsType_Enum /*: quint16 QML doesn't support enum types */ { - Unknown = 0x0000, - PowerOff = 0x0100, - KeepAlive = 0x0700, - BloodFlow = 0x0500, - DialysateInletFlow = 0x0800, - DialysateOutletFlow = 0x0B00, - TreatmentTime = 0x0D00, - PowerOffBroadcast = 0x0E00, + /*! + * \brief The GuiActionsType_Enum enum + * \details + * *** This enum could use the Msg_IDs enum in MsgDefs.h, ***\n + * *** But that enum has values in Normal (BigEndian) ***\n + * *** So it has to be converted, each time it is referenced. ***\n + * *** Since an enum is a constant value, ***\n + * *** There is no point in calculating it on each reference. ***\n + * *** Therefore it is preferred to keep them as constant values ***\n + * *** Exactly as it is going to be shown/used in denali messages ***\n + * *** then it can be compared exactly the way it is with no conversion.***\n + */ - AlarmStatus = 0x0200, - AlarmTriggered = 0x0300, - AlarmCleared = 0x0400, + enum GuiActionsType_Enum /* : quint16 QML doesn't support enum types */ { + ID_Unknown = 0x0000, + ID_CANBusFaultCount = 0x9909, - PressureOcclusion = 0x0900, + ID_RawData = 0xFFFE, - String = 0xFFFE, + ID_Acknow = 0xFFFF, + ID_AcknowGeneric = 0x0000, //< Generic Acknowledgment is not a unique message ID and inherits its Id from the actual message. Zero is a placeholder - Acknow = 0xFFFF, - }; + ID_HDDebugText = 0xF1FF, + ID_DGDebugText = 0xF2FF, - enum class GuiActionsIndx_Enum { - // ---- PowerOff - PowerOff_ShowHide = 0 , - PowerOff_Response = 0 , + ID_DGCheckIn = 0x0600, + ID_KeepAlive = 0x0700, + + ID_PowerOff = 0x0100, + ID_ShuttingDown = 0x0E00, + ID_TreatmentTime = 0x0D00, + ID_BloodFlow = 0x0500, + ID_DialysateInletFlow = 0x0800, + ID_DialysateOutletFlow = 0x0B00, + ID_TreatmentRanges = 0x1A00, // 26 + ID_PressureOcclusion = 0x0900, + ID_TreatmentStates = 0x0F00, // 15 + ID_Saline = 0x2F00, // 47 + + ID_AlarmStatus = 0x0200, + ID_AlarmTriggered = 0x0300, + ID_AlarmCleared = 0x0400, + ID_AlarmUserAckReq = 0x3F00, // 63 + ID_AlarmSilenceReq = 0x3200, // 50 + + ID_CreateTreatmentReq = 0x3500, // 53 + ID_CreateTreatmentRsp = 0x3600, // 54 + ID_StartTreatmentReq = 0x3800, // 56 + ID_StartTreatmentRsp = 0x3900, // 57 + ID_ConfirmTreatmentReq = 0x3A00, // 58 + ID_EndTreatmentReq = 0x3B00, // 59 + ID_EndTreatmentRsp = 0x3C00, // 60 + + ID_PrimingData = 0x3700, // 55 + + ID_HDOperationModeData = 0x2500, // 37 + + ID_DGROPumpData = 0x1F00, // 31 + ID_DGPressuresData = 0x2000, // 32 + ID_DGDrainPumpData = 0x2400, // 36 + ID_DGOperationModeData = 0x2700, // 39 + ID_DGReservoirData = 0x2800, // 40 + ID_DGValvesStatesData = 0x2A00, // 42 + ID_DGHeatersData = 0x2C00, // 44 + ID_DGLoadCellReadingsData = 0x0C00, // 12 + ID_DGTemperaturesData = 0x2D00, // 45 + + ID_AdjustBloodDialysateReq = 0x1700, // 23 + ID_AdjustBloodDialysateRsp = 0x1800, // 24 + + ID_AdjustUltrafiltrationStateReq = 0x1000, // 16 + // idAcknowGeneric : the response is the AcknowGeneric with the same msgID + + ID_AdjustUltrafiltrationEditReq = 0x1100, // 17 + ID_AdjustUltrafiltrationEditRsp = 0x1300, // 19 + + ID_AdjustUltrafiltrationConfirmReq = 0x1500, // 21 + ID_AdjustUltrafiltrationConfirmRsp = 0x2E00, // 46 + + ID_AdjustDurationReq = 0x1600, // 22 + ID_AdjustDurationRsp = 0x1B00, // 27 + + ID_AdjustSalineReq = 0x1200, // 18 + ID_AdjustSalineRsp = 0x1400, // 20 + }; enum class GuiActionsData_Enum /*: quint8 QML doesn't support*/ { @@ -61,81 +132,60 @@ Command = 0x00, // HD=>UI : should be handled in receive Request = 0x00, // UI=>HD : should be handled in transmit - // Power-Off Data // UI=>HD : should be handled in transmit + // UI=>HD : should be handled in transmit Accepted = 0x01, Rejected = 0x02, // Power-Off Data // HD=>UI : should be handled in receive Timeout = 0x01, }; - enum GuiAlarmPriority_Enum { // TODO : this code has to be in common repository soon. - ALARM_PRIORITY_NONE = 0, - ALARM_PRIORITY_LOW, - ALARM_PRIORITY_MEDIUM, - ALARM_PRIORITY_HIGH, - NUM_OF_ALARM_PRIORITIES + enum Saline_States { // FW currently doesn't have enum for Saline Bolus when provided better to be replaced. + SALINE_STOP_STATE = 0, ///< Saline is not delivered + SALINE_START_STATE , ///< Saline being Delivered + SALINE_DISABLE_STATE , ///< Saline cumulative volume delivery has reached the maximum }; - enum GuiAlarmID_Enum { // TODO : this code has to be in common repository soon. - ALARM_ID_NO_ALARM = 0, - ALARM_ID_SOFTWARE_FAULT, - ALARM_ID_STUCK_BUTTON_TEST_FAILED, - ALARM_ID_FPGA_POST_TEST_FAILED, - ALARM_ID_WATCHDOG_POST_TEST_FAILED, - ALARM_ID_UI_COMM_POST_FAILED, // 5 - ALARM_ID_BLOOD_PUMP_MC_CURRENT_CHECK, - ALARM_ID_BLOOD_PUMP_MC_SPEED_CHECK, - ALARM_ID_BLOOD_PUMP_MC_DIRECTION_CHECK, - ALARM_ID_BLOOD_PUMP_ROTOR_SPEED_CHECK, - ALARM_ID_DIAL_IN_PUMP_MC_CURRENT_CHECK, // 10 - ALARM_ID_DIAL_IN_PUMP_MC_SPEED_CHECK, - ALARM_ID_DIAL_IN_PUMP_MC_DIRECTION_CHECK, - ALARM_ID_DIAL_IN_PUMP_ROTOR_SPEED_CHECK, - ALARM_ID_DIAL_OUT_PUMP_MC_CURRENT_CHECK, - ALARM_ID_DIAL_OUT_PUMP_MC_SPEED_CHECK, // 15 - ALARM_ID_DIAL_OUT_PUMP_MC_DIRECTION_CHECK, - ALARM_ID_DIAL_OUT_PUMP_ROTOR_SPEED_CHECK, - ALARM_ID_WATCHDOG_EXPIRED, - ALARM_ID_RTC_COMM_ERROR, - ALARM_ID_RTC_CONFIG_ERROR, // 20 - ALARM_ID_DG_COMM_TIMEOUT, - ALARM_ID_UI_COMM_TIMEOUT, - ALARM_ID_COMM_TOO_MANY_BAD_CRCS, - ALARM_ID_TREATMENT_STOPPED_BY_USER, - ALARM_ID_BLOOD_SITTING_WARNING, // 25 - ALARM_ID_BLOOD_SITTING_TOO_LONG_NO_RESUME, - ALARM_ID_BLOOD_SITTING_TOO_LONG_NO_RINSEBACK, - ALARM_ID_CAN_MESSAGE_NOT_ACKED, - ALARM_ID_OCCLUSION_BLOOD_PUMP, - ALARM_ID_OCCLUSION_DIAL_IN_PUMP, // 30 - ALARM_ID_OCCLUSION_DIAL_OUT_PUMP, - ALARM_ID_ARTERIAL_PRESSURE_LOW, - ALARM_ID_ARTERIAL_PRESSURE_HIGH, - ALARM_ID_VENOUS_PRESSURE_LOW, - ALARM_ID_VENOUS_PRESSURE_HIGH, // 35 - NUM_OF_ALARM_IDS - }; - - Q_ENUM(GuiActionsType_Enum) Q_ENUM(GuiActionsData_Enum) - Q_ENUM(GuiActionsIndx_Enum) - Q_ENUM(GuiAlarmPriority_Enum) - Q_ENUM(GuiAlarmID_Enum) + #include "AlarmDefs.h" + Q_ENUM(Alarm_Priorities) + Q_ENUM(Alarm_List ) + + #include "MsgDefs.h" + Q_ENUM(Request_Reject_Reasons) + + #include "HDDefs.h" + Q_ENUM(HD_Op_Modes) + Q_ENUM(UF_Adjustments) + Q_ENUM(Treatment_States) + Q_ENUM(UF_States) + Q_ENUM(Saline_States) + + #include "DGDefs.h" + Q_ENUM(DG_Op_Modes) }; // to be able to use the enum as signal/slot parameter typedef GuiActions::GuiActionsType_Enum GuiActionType; typedef GuiActions::GuiActionsData_Enum GuiActionData; - typedef GuiActions::GuiActionsIndx_Enum GuiActionIndx; - typedef GuiActions::GuiAlarmPriority_Enum GuiAlarmPriority; - typedef GuiActions::GuiAlarmID_Enum GuiAlarmID; + typedef GuiActions::Alarm_Priorities GuiAlarmPriority; + typedef GuiActions::Alarm_List GuiAlarmID; + typedef GuiActions::Request_Reject_Reasons GuiRequestReasons; + + typedef GuiActions::HD_Op_Modes GuiHDOpModes; + typedef GuiActions::DG_Op_Modes GuiDGOpModes; + + typedef GuiActions::UF_Adjustments GuiUFAdjustment; + typedef GuiActions::Treatment_States GuiTreatment_States; + typedef GuiActions::UF_States GuiUFStates; + typedef GuiActions::Saline_States GuiSalineStates; + void registerTypes(); void registerQmlTypes(); - void startGui(); + bool startGui(); }