/*! * * 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 * \author (last) Behrouz NematiPour * \date (last) 16-Oct-2020 * \author (original) Behrouz NematiPour * \date (original) 26-Aug-2020 * */ #pragma once // Qt #include // Project namespace Gui { /*! * \brief The MainView class * \details A QQuickView inherited child. * Main entry of the QML. * It's not usual to inherit from QQuickView and most of the time the class QQuickView, itself, is used. * It's been inherited to grab all the events which is send/received to/from QML. * \sa VEventSpy */ 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: /*! * \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 */ enum GuiActionsType_Enum /* : quint16 QML doesn't support enum types */ { ID_Unknown = 0x0000, ID_CANBusFaultCount = 0x9909, ID_RawData = 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 ID_HDDebugText = 0xF1FF, ID_DGDebugText = 0xF2FF, ID_DGCheckIn = 0x0600, ID_KeepAlive = 0x0700, // HD Data Messages ID_PowerOff = 0x0100, ID_ShuttingDown = 0x0E00, ID_TreatmentTime = 0x0D00, ID_BloodFlow = 0x0500, ID_DialysateInletFlow = 0x0800, ID_DialysateOutletFlow = 0x0B00, ID_TreatmentRanges = 0x1A00, // 26 ID_TreatmentStates = 0x0F00, // 15 ID_HDOperationModeData = 0x2500, // 37 ID_PressureOcclusion = 0x0900, ID_Saline = 0x2F00, // 47 ID_Heparin = 0x4D00, // 77 // Alarm Messages ID_AlarmStatus = 0x0200, ID_AlarmTriggered = 0x0300, ID_AlarmCleared = 0x0400, ID_AlarmClearedConditionReq = 0x3F00, // 63 // the same code is used for every unit to send and receive over the CANBus ID_AlarmClearedConditionRsp = 0x3F00, // 63 // the same code is used for every unit to send and receive over the CANBus ID_AlarmSilenceReq = 0x3200, // 50 ID_AlarmUserActionReq = 0x4000, // 64 // there is no response since it is kind of the response to the ID_AlarmStatus from UI to HD // Pre-Treatment Parameters ID_CreateTreatmentReq = 0x3500, // 53 ID_CreateTreatmentRsp = 0x3600, // 54 ID_StartTreatmentReq = 0x3800, // 56 ID_StartTreatmentRsp = 0x3900, // 57 ID_ConfirmTreatmentReq = 0x3B00, // 59 ID_EndTreatmentReq = 0x3C00, // 60 ID_EndTreatmentRsp = 0x3D00, // 61 ID_PrimingData = 0x4300, // 67 // DG Data Messages 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 // In-Treatment Adjustables ID_AdjustDurationReq = 0x1600, // 22 ID_AdjustDurationRsp = 0x1B00, // 27 ID_AdjustBloodDialysateReq = 0x1700, // 23 ID_AdjustBloodDialysateRsp = 0x1800, // 24 ID_AdjustPressuresLimitsReq = 0x4600, // 70 ID_AdjustPressuresLimitsRsp = 0x4700, // 71 ID_AdjustSalineReq = 0x1200, // 18 ID_AdjustSalineRsp = 0x1400, // 20 ID_AdjustHeparinReq = 0x4B00, // 75 ID_AdjustHeparinRsp = 0x4C00, // 76 // Ultrafiltration: has also In-Treatment Adjustables but kept together ID_AdjustUltrafiltrationInitReq = 0x4F00, // 79 ID_AdjustUltrafiltrationInitRsp = 0x5000, // 80 ID_AdjustUltrafiltrationStateReq = 0x1000, // 16 ID_AdjustUltrafiltrationStateRsp = 0x4100, // 65 ID_AdjustUltrafiltrationEditReq = 0x1100, // 17 ID_AdjustUltrafiltrationEditRsp = 0x1300, // 19 ID_AdjustUltrafiltrationConfirmReq = 0x1500, // 21 ID_AdjustUltrafiltrationConfirmRsp = 0x2E00, // 46 }; enum class GuiActionsData_Enum /*: quint8 QML doesn't support*/ { NoData = 0x00, Command = 0x00, // HD=>UI : should be handled in receive Request = 0x00, // 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, }; Q_ENUM(GuiActionsType_Enum) Q_ENUM(GuiActionsData_Enum) #include "AlarmDefs.h" Q_ENUM(Alarm_Priorities) Q_ENUM(Alarm_List ) Q_ENUM(Alarm_State_Flag_Bit_Positions) Q_ENUM(Alarm_User_Actions) #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_Commands) Q_ENUM(UF_States) Q_ENUM(Saline_Commands) Q_ENUM(Saline_Bolus_States) // Heparin Q_ENUM(Heparin_Commands) Q_ENUM(Heparin_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::Alarm_Priorities GuiAlarmPriority; typedef GuiActions::Alarm_List GuiAlarmID; typedef GuiActions::Alarm_State_Flag_Bit_Positions GuiAlarmFlags; typedef GuiActions::Alarm_User_Actions GuiAlarmUserActions; 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 GuiTreatmentStates; typedef GuiActions::UF_Commands GuiUFCommands; typedef GuiActions::UF_States GuiUFStates; typedef GuiActions::Saline_Commands GuiSalineCommands; typedef GuiActions::Saline_Bolus_States GuiSalineStates; typedef GuiActions::Heparin_Commands GuiHeparinCommands; typedef GuiActions::Heparin_States GuiHeparinStates; void registerTypes(); void registerQmlTypes(); bool startGui(); }