Index: sources/model/MAbstract.h =================================================================== diff -u -r618891879f5cdc68e37ee68eea005afb76dd4e5b -r84c5373209a1a488c00917995f5553d442d159a4 --- sources/model/MAbstract.h (.../MAbstract.h) (revision 618891879f5cdc68e37ee68eea005afb76dd4e5b) +++ sources/model/MAbstract.h (.../MAbstract.h) (revision 84c5373209a1a488c00917995f5553d442d159a4) @@ -2,13 +2,14 @@ * * 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. + * 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 MAbstract.h - * \date 7/2/2020 - * \author Behrouz NematiPour + * \file MAbstract.h + * \author (last) Behrouz NematiPour + * \date (last) 20-Aug-2020 + * \author (original) Behrouz NemaiPour + * \date (original) 02-Jul-2020 * */ @@ -22,6 +23,36 @@ namespace Model { +/*! + * \page GeneralModelsDescription General Models Description + * The Models are the entities which keep the data and methods to manipulate the data. + * The UI Application is using different types of models in different situations. + * One use case, as the Denali Device is using the Denali Message Protocol over the CANBus for all the messaging transactions + * and almost all the Messages carrying data payloads of a model object for each message, + * is keeping the data for that specific message. + * So for each message there is a model to keep the structured data. + * Each model has been described in its class. + * + * The Models using for Denali Messaging depending on the Unit on the CANBus and the type of the messages categorized into : + * + * **Units on the CANBus :** + * | | | | + * |:-----:|:-----:|:---:| + * | UI | HD | DG | + * + * **Type of messages known at the moment :** + * | | | | | + * |:------:|:----:|:-----------:|:------:| + * | Events | Data | Adjustments | Alarms | + * + */ + +/*! + * \brief The MAbstract class + * \details All the Message Models has to be inherited from MAbstract. + * As this class is abstract it dictates children to implement required methods. + * And also implements some share methods to ease implementing Models. + */ class MAbstract { private: @@ -32,7 +63,8 @@ enum class Type_Enum { eDatum, eEvent, - }; + }; + enum class Unit_Enum { eUI, eHD, @@ -52,18 +84,43 @@ }; public: - // the model needs to implement these since each model have different meaning of the bytes from different source(unit). + + /*! + * \brief fromByteArray + * \details converts the values from Byte Arrays to the Model data. + * \param vByteArray - the byte array input + * \param vIndex - current index of each data section in byte array + * \return true on successful conversion + */ virtual bool fromByteArray(const QByteArray &vByteArray , int *vIndex = nullptr) = 0; + /*! + * \brief typeText + * \details type of the model which can be Data or Event which is mostly used in logging. + * \return Enum of Types + */ virtual Type_Enum typeText ( ) const = 0; + /*! + * \brief unitText + * \details the unit which UI communicates with by using this model and is used in Logging mostly + * \return Enum of Units + */ virtual Unit_Enum unitText ( ) const = 0; + /*! + * \brief infoText + * \details the text description of the model which will be used in the logging. + * \return QString + */ virtual QString infoText ( ) const = 0; + /*! + * \brief parameters + * \return current data values of the models. + */ virtual QVariantList parameters ( ) const = 0; - // Non-virtuals which working with parameters virtual method. + // Non-virtual methods which working with parameters virtual method. void toVariantList(QVariantList &vData) const; QString toString ( ) const; QString description ( ) const; }; - }