/*! * * 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 "guiglobals.h" #include "messageglobals.h" #include "types.h" using namespace Gui; 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 bool interpretMessage_HD(const Message &vMessage, GuiActionType &vActionId, QVariantList &vData) __attribute_warn_unused_result__; bool interpretMessage_DG(const Message &vMessage, GuiActionType &vActionId, QVariantList &vData) __attribute_warn_unused_result__; bool getBloodFlowData (const Message &vMessage , types::S32 &vFlowSetPoint , types::F32 &vMeasuredFlow , types::F32 &vRotorSpeed , types::F32 &vMotorSpeed, types::F32 &vMotorCtlSpeed , types::F32 &vMotorCtlCurrent , types::F32 &vPWMDtCycle) __attribute_warn_unused_result__; bool getPowerOffData (const Message &vMessage, quint8 &vShowHide) __attribute_warn_unused_result__; void printUnhandled (const Message &vMessage); public: explicit MessageInterpreter(QObject *parent = nullptr); // interpret the data into GUI understandable Actions/Data bool interpretMessage(const Can_Id vCan_Id, const Message &vMessage, GuiActionType &vActionId, QVariantList &vData) __attribute_warn_unused_result__; bool interpretMessage(const GuiActionType &vActionId, const QVariantList &vData, QByteArray &vPayload) __attribute_warn_unused_result__; signals: public slots: }; }