/*! * * 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 messageinterpreter.h * \date 12/11/2019 * \author Behrouz NematiPour * */ #pragma once // Qt #include // Project #include "messageglobals.h" #include "mmodel.h" // forward declaration class tst_messaging; class tst_logging; namespace Can { /*! * \brief The MessageInterpreter class * \details This the class that interprets the messages to/from frames. * UI only understands GuiActionType and QVariantList data types * And CANBUS only understands QCanBusFrame with Hex values in QByteArrays * This is the class which interpret this data to/from. */ class MessageInterpreter : public QObject { Q_OBJECT // friend friend class ::tst_messaging; friend class ::tst_logging; bool isType(const Message &vMessage, Gui::GuiActionType vType) const; bool isPayloadLenValid(const Message &vMessage, Gui::GuiActionType vType) const; void printUnhandled(const Message &vMessage); bool interpretMessage_HD(const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; bool interpretMessage_DG(const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; // ---- PowerOff bool getPowerOffData(const Message &vMessage, Model::MPowerOff &vData) __attribute_warn_unused_result__; bool powerOffData(const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; // ---- BloodFlowData bool getBloodFlowData(const Message &vMessage, Model::MBloodFlow &vData) __attribute_warn_unused_result__; bool bloodFlowData(const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; // ---- Dialysate Inlet FlowData bool getDialysateInletFlowData(const Message &vMessage, Model::MDialysateFlow &vData) __attribute_warn_unused_result__; bool dialysateInletFlowData(const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; // ---- Dialysate Outlet FlowData bool getDialysateOutletFlowData(const Message &vMessage, Model::MOutletFlow &vData) __attribute_warn_unused_result__; 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__; // ---- Treatment Time bool getTreatmentTime(const Message &vMessage, Model::MTreatmentTime &vData) __attribute_warn_unused_result__; bool treatmentTime(const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; // ---- Treatment Pressure/Occlusion bool getPressureOcclusionData(const Message &vMessage, Model::MPressureOcclusion &vData) __attribute_warn_unused_result__; bool pressureOcclusionData(const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; // ---- Treatment Ranges bool treatmentRangesData(const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; // ---- Load Cell Readings bool loadCellReadingsData(const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; // ---- Load Cell Readings bool canbusFaultCountData(const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; // ---- Temprature Sensors bool tempratureSensorsData(const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; // ~~~~ Adjustments ~~~~ // ---- Treatment Adjust response for Blood/Dialysate Flow Rate bool adjustBloodDialysateData (const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; // ---- Treatment Adjust response for Treatment Duration bool adjustDurationData (const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; // ---- Treatment Adjust response for Treatment Ultrafiltration bool adjustUltrafiltrationEditData (const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; // ---- Treatment Adjust response for Treatment Ultrafiltration bool adjustUltrafiltrationConfirmData (const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; // ---- Treatment Adjust response for Treatment Ultrafiltration state (Pause / Resume) change bool adjustUltrafiltrationStateData (const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; public: explicit MessageInterpreter(QObject *parent = nullptr); // interpret the data into GUI understandable Actions/Data bool interpretMessage(const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; bool interpretMessage(const Gui::GuiActionType &vActionId, const QVariantList &vData, QByteArray &vPayload) __attribute_warn_unused_result__; signals: ACTION_RECEIVE_SIGNALS public slots: }; }