Index: denali.pro =================================================================== diff -u -re58b907a69d4ca7daa77d69791593b886d1b80e8 -r8c69137f18382bdc55a5678e6ed44a7683fe4dea --- denali.pro (.../denali.pro) (revision e58b907a69d4ca7daa77d69791593b886d1b80e8) +++ denali.pro (.../denali.pro) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) @@ -14,12 +14,6 @@ DEFINES += DISABLE_KEEP_ALIVE } -#CONFIG += disable_sequence -disable_sequence { - message( *** IMPORTANT : DISABLED SEQUENCE *** ) - DEFINES += DISABLE_SEQUENCE -} - # The following define makes your compiler emit warnings if you use # any Qt feature that has been marked deprecated (the exact warnings # depend on your compiler). Refer to the documentation for the Index: denali.pro.user =================================================================== diff -u -re58b907a69d4ca7daa77d69791593b886d1b80e8 -r8c69137f18382bdc55a5678e6ed44a7683fe4dea --- denali.pro.user (.../denali.pro.user) (revision e58b907a69d4ca7daa77d69791593b886d1b80e8) +++ denali.pro.user (.../denali.pro.user) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) @@ -1,6 +1,6 @@ - + EnvironmentId Index: denali.qrc =================================================================== diff -u -r442d1c4f53c96991d4103485ff5ff683ed00d4f7 -r8c69137f18382bdc55a5678e6ed44a7683fe4dea --- denali.qrc (.../denali.qrc) (revision 442d1c4f53c96991d4103485ff5ff683ed00d4f7) +++ denali.qrc (.../denali.qrc) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) @@ -36,6 +36,7 @@ sources/gui/qml/components/TextRect.qml sources/gui/qml/components/Background.qml sources/gui/qml/components/Line.qml + sources/gui/qml/components/PlaceHolderText.qml qtquickcontrols2.conf Index: main.cpp =================================================================== diff -u -re58b907a69d4ca7daa77d69791593b886d1b80e8 -r8c69137f18382bdc55a5678e6ed44a7683fe4dea --- main.cpp (.../main.cpp) (revision e58b907a69d4ca7daa77d69791593b886d1b80e8) +++ main.cpp (.../main.cpp) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) @@ -38,8 +38,6 @@ #include "usbwatcher.h" #include "threads.h" -#include - #ifdef UNIT_TEST #include TEST_CLASS_INCLUDE QTEST_MAIN(TEST_CLASS_NAME) Index: sources/applicationcontroller.cpp =================================================================== diff -u -r227f28b202f81ab3dd04a81868697025ccab6220 -r8c69137f18382bdc55a5678e6ed44a7683fe4dea --- sources/applicationcontroller.cpp (.../applicationcontroller.cpp) (revision 227f28b202f81ab3dd04a81868697025ccab6220) +++ sources/applicationcontroller.cpp (.../applicationcontroller.cpp) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) @@ -25,8 +25,10 @@ #include "filehandler.h" /*! - * \brief ApplicationController Constructor - * \param parent + * \brief ApplicationController::ApplicationController + * \details Constructor + * \param parent - QObject parent owner object. + * Qt handles the children destruction by their parent objects life-cycle. */ ApplicationController::ApplicationController(QObject *parent) : QObject(parent) { @@ -141,6 +143,7 @@ * \brief Process the requested action * \details Processes the requested action * \param vAction - User requested Action + * \param vData - Action data to be transmitted. */ void ApplicationController::onActionTransmit(GuiActionType vAction, const QVariantList &vData) { Index: sources/applicationpost.cpp =================================================================== diff -u -r227f28b202f81ab3dd04a81868697025ccab6220 -r8c69137f18382bdc55a5678e6ed44a7683fe4dea --- sources/applicationpost.cpp (.../applicationpost.cpp) (revision 227f28b202f81ab3dd04a81868697025ccab6220) +++ sources/applicationpost.cpp (.../applicationpost.cpp) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) @@ -13,6 +13,12 @@ */ #include "applicationpost.h" +/*! + * \brief ApplicationPost::ApplicationPost + * \details Constructor + * \param parent - QObject parent owner object. + * Qt handles the children destruction by their parent objects life-cycle. + */ ApplicationPost::ApplicationPost(QObject *parent) : QObject(parent) { Index: sources/canbus/caninterface.cpp =================================================================== diff -u -re58b907a69d4ca7daa77d69791593b886d1b80e8 -r8c69137f18382bdc55a5678e6ed44a7683fe4dea --- sources/canbus/caninterface.cpp (.../caninterface.cpp) (revision e58b907a69d4ca7daa77d69791593b886d1b80e8) +++ sources/canbus/caninterface.cpp (.../caninterface.cpp) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) @@ -22,17 +22,21 @@ #include "messageglobals.h" #include "frameinterface.h" +// stl +#include + +#define FrameCount_MAX UINT64_MAX + // namespace using namespace Can; /*! - * \brief Caninterface Constructor - * \param parent object + * \brief CanInterface::CanInterface + * \details Constructor + * \param parent - QObject parent owner object. + * Qt handles the children destruction by their parent objects life-cycle. */ -CanInterface::CanInterface(QObject *parent) : QObject(parent) { - FrameCount _rxFrameCountMax = pow(2, 8 * sizeof(FrameCount)) - 1;; - FrameCount _txFrameCountMax = pow(2, 8 * sizeof(FrameCount)) - 1;; -} +CanInterface::CanInterface(QObject *parent) : QObject(parent) { } /*! * \brief CanInterface Initialization @@ -47,7 +51,6 @@ if ( ! initDevice() ) return false; if ( ! testDevice() ) return false; - _numberFramesWritten = 0; initConnections(); status(tr("Connected")); @@ -234,11 +237,11 @@ * for debugging purposes. * \param vFrame - The CANBUS frame to be sent out */ -void CanInterface::consoleOut(const QCanBusFrame &vFrame, QString vFrameCount) +void CanInterface::consoleOut(const QCanBusFrame &vFrame, const QString &vFrameCount) { if ( ! _enableConsoleOut ) return; - LOG_EVENT(QObject::tr("console out CanInterface Enabled")); + LOG_EVENT_ONCE(QObject::tr("console out CanInterface Enabled")); const QString time = QString::fromLatin1("%1.%2 ") .arg(vFrame.timeStamp().seconds(), 10, 10, QLatin1Char(' ')) @@ -251,7 +254,7 @@ else { view = vFrame.payload().toHex('.').replace(QByteArray("a5"),QByteArray("\033[1;33mA5\033[0m")); } - fprintf(stderr, "%s %s %s %i %s\n", vFrameCount.toLatin1(), time.toLatin1().constData(), flags.toLatin1().constData(), vFrame.frameId(), view.toLatin1().constData()); + fprintf(stderr, "%s %s %s %i %s\n", vFrameCount.toLatin1().constData(), time.toLatin1().constData(), flags.toLatin1().constData(), vFrame.frameId(), view.toLatin1().constData()); } /*! @@ -261,7 +264,7 @@ */ CanInterface::FrameCount CanInterface::rxCount() { - if ( _rxFrameCount <= _rxFrameCountMax) { + if ( _rxFrameCount <= FrameCount_MAX ) { ++_rxFrameCount; } else { _rxFrameCount = 1; @@ -276,7 +279,7 @@ */ CanInterface::FrameCount CanInterface::txCount() { - if ( _txFrameCount <= _rxFrameCountMax) { + if ( _txFrameCount <= FrameCount_MAX ) { ++_txFrameCount; } else { _txFrameCount = 1; @@ -335,7 +338,7 @@ */ void CanInterface::onFrameWrittern(qint64 /*vFramesCount*/) { - //_numberFramesWritten = vFramesCount; + //_txFrameCount = vFramesCount; //qDebug() << "onFrameWrittern::FramesCount : " << vFramesCount; } @@ -365,7 +368,7 @@ void CanInterface::onFrameTransmit(const QCanBusFrame &vFrame) { bool ok = transmit(vFrame); - rxCount(); + txCount(); if ( _enableConsoleOut ) consoleOut(vFrame, QString("Tx:%1").arg(_txFrameCount)); emit didFrameTransmit(ok); Index: sources/canbus/caninterface.h =================================================================== diff -u -re58b907a69d4ca7daa77d69791593b886d1b80e8 -r8c69137f18382bdc55a5678e6ed44a7683fe4dea --- sources/canbus/caninterface.h (.../caninterface.h) (revision e58b907a69d4ca7daa77d69791593b886d1b80e8) +++ sources/canbus/caninterface.h (.../caninterface.h) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) @@ -46,24 +46,21 @@ friend class ::tst_canbus; // constants - const char *_canType = "socketcan"; - QString _canInterface = "can0"; - const int _canBitRate = 250000; + const char *_canType = "socketcan"; + QString _canInterface = "can0"; + const int _canBitRate = 250000; // member variables QCanBusDevice *_canDevice = nullptr; - qint64 _numberFramesWritten = 0; QString _canStatus = ""; bool _enableConsoleOut = false; QThread *_thread = nullptr; bool _init = false; - typedef quint16 FrameCount; + typedef quint64 FrameCount; FrameCount _rxFrameCount = 0; - FrameCount _rxFrameCountMax = 0; FrameCount _txFrameCount = 0; - FrameCount _txFrameCountMax = 0; // Singleton SINGLETON(CanInterface) @@ -91,7 +88,7 @@ void status (const QString &vDescription, QString vError = ""); bool transmit (const QCanBusFrame &vFrame); - void consoleOut (const QCanBusFrame &vFrame, QString vFrameCount); + void consoleOut (const QCanBusFrame &vFrame, const QString &vFrameCount); FrameCount rxCount(); FrameCount txCount(); Index: sources/canbus/frameinterface.cpp =================================================================== diff -u -r227f28b202f81ab3dd04a81868697025ccab6220 -r8c69137f18382bdc55a5678e6ed44a7683fe4dea --- sources/canbus/frameinterface.cpp (.../frameinterface.cpp) (revision 227f28b202f81ab3dd04a81868697025ccab6220) +++ sources/canbus/frameinterface.cpp (.../frameinterface.cpp) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) @@ -25,9 +25,12 @@ // namespace using namespace Can; + /*! - * \brief FrameInterface Constructor - * \param parent + * \brief FrameInterface::FrameInterface + * \details Constructor + * \param parent - QObject parent owner object. + * Qt handles the children destruction by their parent objects life-cycle. */ FrameInterface::FrameInterface(QObject *parent) : QObject(parent) { } @@ -160,19 +163,18 @@ channelGroup = ChannelGroup::eChannel_Ignores; break; - case eChlid_HD : + case eChlid_HD_UI : case eChlid_HD_Alarm : case eChlid_DG_Alarm : case eChlid_HD_Sync : case eChlid_DG_Sync : //case eChlid_DG_UI : // has duplicate value as eChlid_DG_Alarm - //case eChlid_UI_DG : // has duplicate value as eChlid_UI_Sync channelGroup = ChannelGroup::eChannel_Listens; break; case eChlid_UI_Alarm : case eChlid_UI_Sync : - case eChlid_UI : + //case eChlid_UI_DG : channelGroup = ChannelGroup::eChannel_Outputs; break; @@ -190,12 +192,12 @@ * \details This the slot connected to the MessageDispatcher didFrameTransmit signal. * When a frame needs to be send to CANBUS, * this slot will call transmitFrame method to do the job. - * \param vCan_ID - CANBUS Can Id target of the frame. + * \param vCan_Id - CANBUS Can Id target of the frame. * \param vData - The data which this frame will carry. */ -void FrameInterface::onFrameTransmit(Can_Id vCan_ID, const QByteArray &vData) +void FrameInterface::onFrameTransmit(Can_Id vCan_Id, const QByteArray &vData) { - transmitFrame(vCan_ID, vData); + transmitFrame(vCan_Id, vData); } /*! @@ -222,6 +224,6 @@ return; } - Can_Id mCanId = static_cast(mFrameId); - emit didFrameReceive(mCanId, vFrame.payload()); + Can_Id mCan_Id = static_cast(mFrameId); + emit didFrameReceive(mCan_Id, vFrame.payload()); } Index: sources/canbus/frameinterface.h =================================================================== diff -u -r227f28b202f81ab3dd04a81868697025ccab6220 -r8c69137f18382bdc55a5678e6ed44a7683fe4dea --- sources/canbus/frameinterface.h (.../frameinterface.h) (revision 227f28b202f81ab3dd04a81868697025ccab6220) +++ sources/canbus/frameinterface.h (.../frameinterface.h) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) @@ -78,7 +78,7 @@ ChannelGroup checkChannel(quint32 vFrameId, bool *vOK = nullptr); private slots: // Should be private for thread safety and is connected internally. - void onFrameTransmit(Can_Id vCan_ID, const QByteArray &vData ); // GUI => CAN + void onFrameTransmit(Can_Id vCan_Id, const QByteArray &vData ); // GUI => CAN void onFrameReceive ( const QCanBusFrame &vFrame ); // GUI <= CAN signals: @@ -91,7 +91,7 @@ * and vPayload of the frame of type QByteArray has been extracted, * This signal will be emitted to notify MessageDispatcher to start collecting data * for this message over this channel. - * \param vCan_ID - Channel Id of the frame. + * \param vCan_Id - Channel Id of the frame. * \param vPayload - Payload of the frame. */ void didFrameReceive (Can_Id vCan_Id, const QByteArray &vPayload); // GUI <= CAN Index: sources/canbus/messagebuilder.cpp =================================================================== diff -u -re58b907a69d4ca7daa77d69791593b886d1b80e8 -r8c69137f18382bdc55a5678e6ed44a7683fe4dea --- sources/canbus/messagebuilder.cpp (.../messagebuilder.cpp) (revision e58b907a69d4ca7daa77d69791593b886d1b80e8) +++ sources/canbus/messagebuilder.cpp (.../messagebuilder.cpp) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) @@ -19,11 +19,16 @@ #include "logger.h" #include "crc.h" #include "format.h" -#include "types.h" // namespace using namespace Can; +/*! + * \brief MessageBuilder::MessageBuilder + * \details Constructor + * \param parent - QObject parent owner object. + * Qt handles the children destruction by their parent objects life-cycle. + */ MessageBuilder::MessageBuilder(QObject *parent) : QObject(parent) { } /*! @@ -32,17 +37,16 @@ * and vData of type QByteArray which has been requested to be sent by UI. * The message will be chopped into 8 bytes frames to be able to be send * by fixed length CANBUS protocol. - * \param vAction - The ActionID of the requested message. - * \param vData - The payload of the message. - * \param ok - Will be set if any error happens. - * This parameter has been defined as mandatory check - * so it has been passed and checked. - * \return list of frames of type FrameList + * \param vAction - The ActionID of the requested message. + * \param vData - The payload of the message. + * \param vFrameList - The list of frames which has been created by vAction and vData to be sent. + * \return false on error */ bool MessageBuilder::buildFrames(Gui::GuiActionType vAction, const QByteArray &vData, FrameList &vFrameList) { QByteArray mPayload ; addSyncByte (mPayload); // Sync Byte + addSequence (mPayload); // adding sequence if ( ! addActionId (mPayload, vAction) ) { // MessageID return false; } @@ -76,6 +80,13 @@ vPayload.append(ePayload_Sync); // Sync byte } +void MessageBuilder::addSequence(QByteArray &/*vPayload*/) +{ +// Types::S16 seq; +// seq.value = +// vPayload.append(); +} + /*! * \brief MessageBuilder::addActionId * \details Adds the sync/start byte at the end of the Payload vPayload of type QByteArray @@ -171,18 +182,20 @@ * \brief MessageBuilder::checkCRC * \details This method checks the crc8 of the vData of type QByteArray * by using the last byte as the crc8 of the rest of the data - * \param vData - The data of type QByteArray to be used for crc8 calculation. + * \param vData - The data of type QByteArray to be used for crc8 calculation. + * \param vExpected - The expected CRC value + * \param vActual - The actual value which has been read * \return returns false if the crc8 is not correct or the data is empty. */ -bool MessageBuilder::checkCRC(const QByteArray &vData, quint8 &vExpected, quint8 &vBeenRead) +bool MessageBuilder::checkCRC(const QByteArray &vData, quint8 &vExpected, quint8 &vActual) // TODO : This section better to be in the MessageModel { #ifndef DISABLE_CRC int len = vData.length(); if ( ! len ) return false; - vBeenRead = vData.back(); + vActual = vData.back(); vExpected = calcCRC(vData.mid(0, len - 1)); - bool ok = vExpected == vBeenRead; + bool ok = vExpected == vActual; // it's very good but I'm not sure if it's correct. //bool ok = calcCRC(vData) == 0; return ok; @@ -194,8 +207,8 @@ /*! * \brief MessageBuilder::checkCRC * \details Overloaded CheckCRC which checks the CRC and Log the error if there is. - * \param vMessage - * \return + * \param vMessage - The message to check for the CRC + * \return false if has error */ bool MessageBuilder::checkCRC(const Message &vMessage) { @@ -230,9 +243,7 @@ consoleOut(vPayload, true, vCan_Id); vMessage.can_id = vCan_Id; vMessage.head = getHeader (mPayload); // keep header before taking it out of the payload. doesn't affect payload -#ifndef DISABLE_SEQUENCE vMessage.sequence = getSequence (mPayload); -#endif vMessage.actionId = getActionId (mPayload); vMessage.length = getLength (mPayload); vMessage.data = getData (mPayload, vMessage.length); @@ -286,9 +297,10 @@ * \note Removes the 2 bytes of ActionID from vPayload * It starts from the first byte so those 2 bytes should be the first 2 bytes. */ -qint16 MessageBuilder::getSequence(QByteArray &vPayload) +Sequence MessageBuilder::getSequence(QByteArray &vPayload) { - Types::S16 mSequence; + // be careful about using the Types::S16 type and always check with the Sequence type. + Sequence_Bytes mSequence; int index = 0; Types::getValue<>(vPayload, index, mSequence); vPayload = vPayload.mid(eLenSequence); @@ -438,6 +450,8 @@ void MessageBuilder::consoleOut(const QByteArray &vPayload, bool vIsHeader, Can_Id vCan_Id, bool vUseColor) { if ( ! _enableConsoleOut) return; - LOG_EVENT(QObject::tr("console out MessageDispatcher Enabled")); + + LOG_EVENT_ONCE(QObject::tr("console out MessageDispatcher Enabled")); + printPayload(vPayload, vIsHeader, vCan_Id, vUseColor); } Index: sources/canbus/messagebuilder.h =================================================================== diff -u -re58b907a69d4ca7daa77d69791593b886d1b80e8 -r8c69137f18382bdc55a5678e6ed44a7683fe4dea --- sources/canbus/messagebuilder.h (.../messagebuilder.h) (revision e58b907a69d4ca7daa77d69791593b886d1b80e8) +++ sources/canbus/messagebuilder.h (.../messagebuilder.h) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) @@ -52,17 +52,18 @@ bool _enableConsoleOut = false; void addSyncByte ( QByteArray &vPayload); + void addSequence ( QByteArray &vPayload); bool addActionId ( QByteArray &vPayload, Gui::GuiActionType vAction) __attribute_warn_unused_result__; bool addData ( QByteArray &vPayload, Gui::GuiActionType vAction, const QByteArray &vData) __attribute_warn_unused_result__; void addCRC ( QByteArray &vPayload); void addPadding ( QByteArray &vPayload); quint8 calcCRC (const QByteArray &vData ); - bool checkCRC (const QByteArray &vData , quint8 &vExpected, quint8 &vBeenRead); + bool checkCRC (const QByteArray &vData , quint8 &vExpected, quint8 &vActual); bool checkCRC (const Message &vMessage); bool hasSyncByte ( QByteArray &vPayload); - qint16 getSequence(QByteArray &vPayload); + Sequence getSequence ( QByteArray &vPayload); QByteArray getHeader (const QByteArray &vPayload); Gui::GuiActionType getActionId ( QByteArray &vPayload); int getLength ( QByteArray &vPayload); Index: sources/canbus/messagedispatcher.cpp =================================================================== diff -u -re58b907a69d4ca7daa77d69791593b886d1b80e8 -r8c69137f18382bdc55a5678e6ed44a7683fe4dea --- sources/canbus/messagedispatcher.cpp (.../messagedispatcher.cpp) (revision e58b907a69d4ca7daa77d69791593b886d1b80e8) +++ sources/canbus/messagedispatcher.cpp (.../messagedispatcher.cpp) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) @@ -25,8 +25,10 @@ using namespace Can; /*! - * \brief MessageDispatcher Constructor - * \param parent + * \brief MessageDispatcher::MessageDispatcher + * \details Constructor + * \param parent - QObject parent owner object. + * Qt handles the children destruction by their parent objects life-cycle. */ MessageDispatcher::MessageDispatcher(QObject *parent) : QObject(parent) { } @@ -125,20 +127,21 @@ * Upon completion of collected all the required frames * on successful interpretation of the message, emits didActionReceived signal. * The message will be removed from list of the channel vCan_Id messages. - * \param vCanId - CANBUS channel of the frame + * \param vCan_Id - CANBUS channel of the frame * \param vPayload - Payload of the frame */ -void MessageDispatcher::onFrameReceive(Can_Id vCanId, const QByteArray &vPayload) +void MessageDispatcher::onFrameReceive(Can_Id vCan_Id, const QByteArray &vPayload) { // Append a message to the list - if (_messageList[vCanId].isEmpty() || _messageList[vCanId].last().isComplete()) { - _messageList[vCanId].append(Message()); + if (_messageList[vCan_Id].isEmpty() || _messageList[vCan_Id].last().isComplete()) { + _messageList[vCan_Id].append(Message()); } // build the message and check. - if (! buildMessage(vCanId, vPayload)) + if (! buildMessage(vCan_Id, vPayload)) { return; - Message mMessage = _messageList[vCanId].last(); + } + Message mMessage = _messageList[vCan_Id].last(); // TODO : must be moved to a MessageModel class if (mMessage.isComplete()) { @@ -166,7 +169,7 @@ * \param vActionId - The ActionID of the message * \param vData - The data of the Message */ -void MessageDispatcher::actionTransmit(GuiActionType vActionId, const QVariantList &vData) +void MessageDispatcher::actionTransmit(GuiActionType vActionId, const QVariantList &vData, Sequence /*vSequence*/) { QByteArray mData; if (! _interpreter.interpretMessage(vActionId, vData, mData)) { @@ -180,25 +183,25 @@ return; } for (const auto &frame : frameList) { - emit didFrameTransmit(eChlid_UI, frame); + emit didFrameTransmit(eChlid_UI_HD, frame); } } /*! * \brief MessageDispatcher::buildMessage * \details Calls the messageBuilder buildMessage method. - * \param vCanId - CANBUS channel of the frame + * \param vCan_Id - CANBUS channel of the frame * \param vPayload - Payload of the frame * \return false on error */ -bool MessageDispatcher::buildMessage(Can_Id vCanId, const QByteArray &vPayload) +bool MessageDispatcher::buildMessage(Can_Id vCan_Id, const QByteArray &vPayload) { if (vPayload.length() < eLenCanFrame) { LOG_ERROR(tr("Incorrect frame length. Exp:%1,got:%2").arg(eLenCanFrame).arg(vPayload.length())); return false; } - if (! _builder.buildMessage(vPayload, _messageList[vCanId].last(), vCanId)) { - _messageList[vCanId].removeLast(); + if (! _builder.buildMessage(vPayload, _messageList[vCan_Id].last(), vCan_Id)) { + _messageList[vCan_Id].removeLast(); return false; } return true; @@ -221,11 +224,11 @@ GuiActionType mActionId = vMessage.actionId; switch (mActionId) { case GuiActionType::Acknow: - emit didAcknowReceive(mData); + emit didAcknowReceive(vMessage.sequence); break; default: if (vMessage.sequence < 0) { - // actionTransmit(-vMessage.sequence, GuiActionType::Acknow,{}); + //actionTransmit(-vMessage.sequence, GuiActionType::Acknow,{}); } emit didActionReceive(mActionId, mData); break; Index: sources/canbus/messagedispatcher.h =================================================================== diff -u -re58b907a69d4ca7daa77d69791593b886d1b80e8 -r8c69137f18382bdc55a5678e6ed44a7683fe4dea --- sources/canbus/messagedispatcher.h (.../messagedispatcher.h) (revision e58b907a69d4ca7daa77d69791593b886d1b80e8) +++ sources/canbus/messagedispatcher.h (.../messagedispatcher.h) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) @@ -113,9 +113,9 @@ void initThread(QThread &vThread); void quitThread(); - void actionTransmit(GuiActionType vActionId, const QVariantList &vData); + void actionTransmit(GuiActionType vActionId, const QVariantList &vData, Sequence vSequence = 0); - bool buildMessage (Can_Id vCanId, const QByteArray &vPayload); + bool buildMessage (Can_Id vCan_Id, const QByteArray &vPayload); bool interpretMessage(const Message &vMessage); signals: /*! @@ -141,20 +141,20 @@ * @param vData - the data of the Acknow message which is the message Sequence * which we got the Ack for. */ - void didAcknowReceive(const QVariantList &vData); + void didAcknowReceive(const Sequence &vSequence); /*! * \brief didFrameTransmit * \details When a message is requested to be transmitted this signal is emitted * on successful interpretation and building the message into frames - * \param vCanId - Target channel of the CANBUS message + * \param vCan_Id - Target channel of the CANBUS message * \param vPayload - The payload of the message to be sent */ - void didFrameTransmit(Can_Id vCanId , const QByteArray &vPayload); + void didFrameTransmit(Can_Id vCan_Id , const QByteArray &vPayload); private slots: // A Frame has been received from CanInterface - void onFrameReceive (Can_Id vCanId , const QByteArray &vPayload); + void onFrameReceive (Can_Id vCan_Id , const QByteArray &vPayload); // An Action has been requested to be transmitted. void onActionTransmit(GuiActionType vActionId, const QVariantList &vData); Index: sources/canbus/messageglobals.h =================================================================== diff -u -re58b907a69d4ca7daa77d69791593b886d1b80e8 -r8c69137f18382bdc55a5678e6ed44a7683fe4dea --- sources/canbus/messageglobals.h (.../messageglobals.h) (revision e58b907a69d4ca7daa77d69791593b886d1b80e8) +++ sources/canbus/messageglobals.h (.../messageglobals.h) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) @@ -18,10 +18,19 @@ // Project #include "guiglobals.h" +#include "types.h" namespace Can { /*! + * \brief Sequence + * \details the messages sequence type + */ +typedef qint16 Sequence; +typedef Types::S16 Sequence_Bytes; +#define SEQUENCE_MAX INT16_MAX + +/*! * \brief Payload Length * \details List of each ActionID required data (in byte) length in the message. * So the data collector has to collect this amount of bytes as payload of a message. @@ -50,11 +59,7 @@ */ enum Frame_Data : quint8 { eLenCanFrame = 8, ///< The length of each can frame. Should be padded by 0x00 if is less. -#ifdef DISABLE_SEQUENCE - eLenHeaderInfo = 3, ///< The Header length witch is included in CRC after Sync byte -#else eLenHeaderInfo = 5, ///< The Header length witch is included in CRC after Sync byte (it's the sum of eLenSequence + eLenActionId + eLenLength) -#endif eLenMaxHeaderData = 3, ///< Maximum data byte can be in one frame as header data portion eLenMaxData = 255, ///< Maximum data length in a Can Message since data length value kept in one byte @@ -90,8 +95,8 @@ eChlid_DG_HD = 0x010, ///< DG => HD // UI is listening - eChlid_HD = 0x020, ///< HD => UI - eChlid_UI = 0x100, ///< UI => HD [Out] + eChlid_HD_UI = 0x020, ///< HD => UI + eChlid_UI_HD = 0x100, ///< UI => HD [Out] // UI lessens occasionally eChlid_DG_UI = eChlid_DG_Alarm, ///< No direct channel has been defined between DG&UI, May be required for logging @@ -104,7 +109,7 @@ */ struct Message { // TODO : Should be converted to MessageModel class // no time left for now !!! Can_Id can_id; - qint16 sequence = 0; // seq 0 is invalid + Sequence sequence = 0; // seq 0 is invalid Gui::GuiActionType actionId = Gui::GuiActionType::Unknown; int length = 0; QByteArray head; Index: sources/canbus/messageinterpreter.cpp =================================================================== diff -u -re58b907a69d4ca7daa77d69791593b886d1b80e8 -r8c69137f18382bdc55a5678e6ed44a7683fe4dea --- sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision e58b907a69d4ca7daa77d69791593b886d1b80e8) +++ sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) @@ -24,7 +24,9 @@ /*! * \brief MessageInterpreter::MessageInterpreter - * \param parent + * \details Constructor + * \param parent - QObject parent owner object. + * Qt handles the children destruction by their parent objects life-cycle. */ MessageInterpreter::MessageInterpreter(QObject *parent) : QObject(parent) { } @@ -94,11 +96,15 @@ { bool ok = false; switch (vMessage.can_id) { - case eChlid_HD: + case eChlid_HD_UI: case eChlid_HD_Alarm: case eChlid_HD_Sync: ok = interpretMessage_HD(vMessage, vData); break; + case eChlid_DG_UI: + //case eChlid_DG_Alarm: + //case eChlid_DG_Sync: + ok = interpretMessage_DG(vMessage, vData); default: break; } @@ -189,10 +195,9 @@ * \return true if the message CANBUS channel is in the range which can be interpreted, false otherwise. * This return value will be used later to emit MessageDispatcher::didActionReceive signal or not */ -bool MessageInterpreter::interpretMessage_DG(const Message &vMessage, Gui::GuiActionType vActionId, QVariantList &vData) +bool MessageInterpreter::interpretMessage_DG(const Message &vMessage, QVariantList &vData) { Q_UNUSED(vMessage ); - Q_UNUSED(vActionId); Q_UNUSED(vData ); // No data have been interpreted from DG yet return false; @@ -412,7 +417,7 @@ * \param vState - Alarm Priority value of type unsigned int as 4 bytes extracted out * \param vTop - Top value of type unsigned int as 4 bytes extracted out * \param vMuteTimeout - MuteTimeout value of type unsigned int as 4 bytes extracted out - * \param vEscalateTo - EscalateTo value of type unsigned int as 4 bytes extracted out + * \param vEscalatesIn - EscalatesIn value of type unsigned int as 4 bytes extracted out * \param vFlags - Flags value of type unsigned int as 1 byte extracted out * \return true if the data can be extracted as defined for PowerOff Message ID */ Index: sources/canbus/messageinterpreter.h =================================================================== diff -u -re58b907a69d4ca7daa77d69791593b886d1b80e8 -r8c69137f18382bdc55a5678e6ed44a7683fe4dea --- sources/canbus/messageinterpreter.h (.../messageinterpreter.h) (revision e58b907a69d4ca7daa77d69791593b886d1b80e8) +++ sources/canbus/messageinterpreter.h (.../messageinterpreter.h) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) @@ -18,7 +18,6 @@ // Project #include "messageglobals.h" -#include "types.h" namespace Can { @@ -35,8 +34,8 @@ void printUnhandled (const Message &vMessage); - bool interpretMessage_HD (const Message &vMessage , QVariantList &vData) __attribute_warn_unused_result__; - bool interpretMessage_DG (const Message &vMessage , Gui::GuiActionType vActionId, QVariantList &vData) __attribute_warn_unused_result__; + bool interpretMessage_HD (const Message &vMessage , QVariantList &vData) __attribute_warn_unused_result__; + bool interpretMessage_DG (const Message &vMessage , QVariantList &vData) __attribute_warn_unused_result__; bool getPowerOffData (const Message &vMessage , quint8 &vShowHide) __attribute_warn_unused_result__; @@ -67,7 +66,7 @@ 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 Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; bool interpretMessage(const Gui::GuiActionType &vActionId, const QVariantList &vData, QByteArray &vPayload) __attribute_warn_unused_result__; signals: Index: sources/configuration/display.cpp =================================================================== diff -u -r227f28b202f81ab3dd04a81868697025ccab6220 -r8c69137f18382bdc55a5678e6ed44a7683fe4dea --- sources/configuration/display.cpp (.../display.cpp) (revision 227f28b202f81ab3dd04a81868697025ccab6220) +++ sources/configuration/display.cpp (.../display.cpp) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) @@ -17,8 +17,9 @@ /*! * \brief display::display - * CTOR - * \param parent + * \details Constructor + * \param parent - QObject parent owner object. + * Qt handles the children destruction by their parent objects life-cycle. */ display::display(QObject *parent) : QObject(parent) { Index: sources/configuration/sound.cpp =================================================================== diff -u -r227f28b202f81ab3dd04a81868697025ccab6220 -r8c69137f18382bdc55a5678e6ed44a7683fe4dea --- sources/configuration/sound.cpp (.../sound.cpp) (revision 227f28b202f81ab3dd04a81868697025ccab6220) +++ sources/configuration/sound.cpp (.../sound.cpp) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) @@ -15,6 +15,12 @@ using namespace Configuration; +/*! + * \brief sound::sound + * \details Constructor + * \param parent - QObject parent owner object. + * Qt handles the children destruction by their parent objects life-cycle. + */ sound::sound(QObject *parent) : QObject(parent) { Index: sources/gui/guicontroller.cpp =================================================================== diff -u -r227f28b202f81ab3dd04a81868697025ccab6220 -r8c69137f18382bdc55a5678e6ed44a7683fe4dea --- sources/gui/guicontroller.cpp (.../guicontroller.cpp) (revision 227f28b202f81ab3dd04a81868697025ccab6220) +++ sources/gui/guicontroller.cpp (.../guicontroller.cpp) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) @@ -25,8 +25,10 @@ using namespace Gui; /*! - * \brief GuiController Constructor - * \param parent + * \brief GuiController::GuiController + * \details Constructor + * \param parent - QObject parent owner object. + * Qt handles the children destruction by their parent objects life-cycle. */ GuiController::GuiController(QObject *parent) : QObject(parent) {} @@ -124,13 +126,14 @@ } /*! - * \brief An Action has been requested - * \details This method Confirmed that if the action is accepted or not,\n - * Regarding the current state and the action.\n - * These actions are only user actions and there is only one user interaction,\n - * So no need to capture from which screen this action comes since we have the current state.\n - * Sometimes GuiController requires to investigate with the ApplicationController to get approval from HD device.\n - * \param vAction - User requested Action + * \brief An Action has been requested + * \details This method Confirmed that if the action is accepted or not, + * Regarding the current state and the action. + * These actions are only user actions and there is only one user interaction, + * So no need to capture from which screen this action comes since we have the current state. + * Sometimes GuiController requires to investigate with the ApplicationController to get approval from HD device. + * \param vAction - User requested Action + * \param vData - Message data to be transmitted. */ void GuiController::doActionTransmit(GuiActionType vAction, const QVariantList &vData) { @@ -153,7 +156,7 @@ Q_UNUSED(vAction) Q_UNUSED(vData) - // This is an example implementation of how to handle + // This is an example implementation of how to handle actions // which does not require HD approval in GuiController // Process the GuiView Request. // It can be processed in GuiController take action and notify GuiView @@ -178,10 +181,11 @@ } /*! - * \brief Action commanded by HD + * \brief Action commanded by HD * \details An action has been commanded by HD, - * Gui requires to be notified to perform the action. - * \param vAction + * Gui requires to be notified to perform the action. + * \param vAction - Message Action + * \param vData - The data to be translated. */ void GuiController::onActionReceive (GuiActionType vAction, const QVariantList &vData) { Index: sources/gui/guiview.cpp =================================================================== diff -u -r227f28b202f81ab3dd04a81868697025ccab6220 -r8c69137f18382bdc55a5678e6ed44a7683fe4dea --- sources/gui/guiview.cpp (.../guiview.cpp) (revision 227f28b202f81ab3dd04a81868697025ccab6220) +++ sources/gui/guiview.cpp (.../guiview.cpp) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) @@ -22,7 +22,9 @@ /*! * \brief GuiView::GuiView - * \param parent + * \details Constructor + * \param parent - QObject parent owner object. + * Qt handles the children destruction by their parent objects life-cycle. */ GuiView::GuiView(QQuickItem *parent) { Index: sources/gui/qml/components/PlaceHolderText.qml =================================================================== diff -u --- sources/gui/qml/components/PlaceHolderText.qml (revision 0) +++ sources/gui/qml/components/PlaceHolderText.qml (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) @@ -0,0 +1,36 @@ +/*! + * + * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * \copyright \n + * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, \n + * IN PART OR IN WHOLE, \n + * WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. \n + * + * \file BackButton.qml + * \date 2019/11/18 + * \author Behrouz NematiPour + * + */ + +// Qt +import QtQuick 2.12 +import QtQuick.Controls 2.12 + +// Project +// Qml imports +import "qrc:/globals" + +/*! + * \brief a text with the "Placeholder" text in the middle of the screen + */ +Item { + property string screenName: "" + Column { + spacing: Variables.columnSpacing + anchors.centerIn: parent + TitleText { id: _titleText + width: parent.width + text: screenName + qsTr(" Placeholder") + } + } +} Index: sources/gui/qml/pages/SettingsHome.qml =================================================================== diff -u -r442d1c4f53c96991d4103485ff5ff683ed00d4f7 -r8c69137f18382bdc55a5678e6ed44a7683fe4dea --- sources/gui/qml/pages/SettingsHome.qml (.../SettingsHome.qml) (revision 442d1c4f53c96991d4103485ff5ff683ed00d4f7) +++ sources/gui/qml/pages/SettingsHome.qml (.../SettingsHome.qml) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) @@ -64,12 +64,307 @@ _GuiView.doActionTransmit(GuiActions.PowerOff, GuiActions.NoData) } } - Column { - spacing: Variables.columnSpacing - anchors.centerIn: parent - TitleText { id: _titleText - width: parent.width - text: qsTr("Settings Home Placeholder") + + Column { id: _BloodFlowColumn + width: 150 + spacing: 20 + topPadding: 100 + leftPadding: 10 + Text { + id: _BloodFlow_Title + text: qsTr(" Blood ") + width: _BloodFlowColumn.width + horizontalAlignment: Text.AlignHCenter + color: Colors.textMain + font.pixelSize: Fonts.fontPixelTitle + font.underline: true } + Text { + id: _BloodFlow_S32 + text: qsTr("") + width: _BloodFlowColumn.width + horizontalAlignment: Text.AlignRight + color: Colors.textMain + font.pixelSize: Fonts.fontPixelTitle + } + Text { + id: _BloodFlow_F32_1 + text: qsTr("") + width: _BloodFlowColumn.width + horizontalAlignment: Text.AlignRight + color: Colors.textMain + font.pixelSize: Fonts.fontPixelTitle + } + Text { + id: _BloodFlow_F32_2 + text: qsTr("") + width: _BloodFlowColumn.width + horizontalAlignment: Text.AlignRight + color: Colors.textMain + font.pixelSize: Fonts.fontPixelTitle + } + Text { + id: _BloodFlow_F32_3 + text: qsTr("") + width: _BloodFlowColumn.width + horizontalAlignment: Text.AlignRight + color: Colors.textMain + font.pixelSize: Fonts.fontPixelTitle + } + Text { + id: _BloodFlow_F32_4 + text: qsTr("") + width: _BloodFlowColumn.width + horizontalAlignment: Text.AlignRight + color: Colors.textMain + font.pixelSize: Fonts.fontPixelTitle + } + Text { + id: _BloodFlow_F32_5 + text: qsTr("") + width: _BloodFlowColumn.width + horizontalAlignment: Text.AlignRight + color: Colors.textMain + font.pixelSize: Fonts.fontPixelTitle + } + Text { + id: _BloodFlow_F32_6 + text: qsTr("") + width: _BloodFlowColumn.width + horizontalAlignment: Text.AlignRight + color: Colors.textMain + font.pixelSize: Fonts.fontPixelTitle + } } + + Column { id: _DialysateFlowColumn + width: 150 + spacing: 20 + topPadding: 100 + leftPadding: 180 + Text { + id: _DialysateFlow_Title + text: qsTr(" Dialysate ") + width: _DialysateFlowColumn.width + horizontalAlignment: Text.AlignLeft + color: Colors.textMain + font.pixelSize: Fonts.fontPixelTitle + font.underline: true + } + Text { + id: _DialysateFlow_S32 + text: qsTr("") + width: _DialysateFlowColumn.width + horizontalAlignment: Text.AlignRight + color: Colors.textMain + font.pixelSize: Fonts.fontPixelTitle + } + Text { + id: _DialysateFlow_F32_1 + text: qsTr("") + width: _DialysateFlowColumn.width + horizontalAlignment: Text.AlignRight + color: Colors.textMain + font.pixelSize: Fonts.fontPixelTitle + } + Text { + id: _DialysateFlow_F32_2 + text: qsTr("") + width: _DialysateFlowColumn.width + horizontalAlignment: Text.AlignRight + color: Colors.textMain + font.pixelSize: Fonts.fontPixelTitle + } + Text { + id: _DialysateFlow_F32_3 + text: qsTr("") + width: _DialysateFlowColumn.width + horizontalAlignment: Text.AlignRight + color: Colors.textMain + font.pixelSize: Fonts.fontPixelTitle + } + Text { + id: _DialysateFlow_F32_4 + text: qsTr("") + width: _DialysateFlowColumn.width + horizontalAlignment: Text.AlignRight + color: Colors.textMain + font.pixelSize: Fonts.fontPixelTitle + } + Text { + id: _DialysateFlow_F32_5 + text: qsTr("") + width: _DialysateFlowColumn.width + horizontalAlignment: Text.AlignRight + color: Colors.textMain + font.pixelSize: Fonts.fontPixelTitle + } + Text { + id: _DialysateFlow_F32_6 + text: qsTr("") + width: _DialysateFlowColumn.width + horizontalAlignment: Text.AlignRight + color: Colors.textMain + font.pixelSize: Fonts.fontPixelTitle + } + } + + Column { id: _AlarmStatusColumn + width: 270 + spacing: 5 + topPadding: 100 + leftPadding: 400 + Text { + id: _AlarmStatus_Title + text: qsTr(" Alarm Status ") + width: _AlarmStatusColumn.width + horizontalAlignment: Text.AlignLeft + color: Colors.textMain + font.pixelSize: Fonts.fontPixelTitle + font.underline: true + } + Text { + id: _AlarmStatus_Priority + text: qsTr("") + width: _AlarmStatusColumn.width + horizontalAlignment: Text.AlignLeft + color: Colors.textMain + font.pixelSize: Fonts.fontPixelButton + } + Text { + id: _AlarmStatus_ID + text: qsTr("") + width: _AlarmStatusColumn.width + horizontalAlignment: Text.AlignLeft + color: Colors.textMain + font.pixelSize: Fonts.fontPixelButton + } + Text { + id: _AlarmStatus_EsclateIn + text: qsTr("") + width: _AlarmStatusColumn.width + horizontalAlignment: Text.AlignLeft + color: Colors.textMain + font.pixelSize: Fonts.fontPixelButton + } + Text { id: _AlarmStatus_MuteTimeout + text: qsTr("") + width: _AlarmStatusColumn.width + horizontalAlignment: Text.AlignLeft + color: Colors.textMain + font.pixelSize: Fonts.fontPixelButton + } + Text { id: _AlarmStatus_systemFault + text: qsTr("") + width: _AlarmStatusColumn.width + horizontalAlignment: Text.AlignLeft + color: Colors.textMain + font.pixelSize: Fonts.fontPixelButton + } + Text { id: _AlarmStatus_stop + text: qsTr("") + width: _AlarmStatusColumn.width + horizontalAlignment: Text.AlignLeft + color: Colors.textMain + font.pixelSize: Fonts.fontPixelButton + } + Text { id: _AlarmStatus_noClear + text: qsTr("") + width: _AlarmStatusColumn.width + horizontalAlignment: Text.AlignLeft + color: Colors.textMain + font.pixelSize: Fonts.fontPixelButton + } + Text { id: _AlarmStatus_noResume + text: qsTr("") + width: _AlarmStatusColumn.width + horizontalAlignment: Text.AlignLeft + color: Colors.textMain + font.pixelSize: Fonts.fontPixelButton + } + Text { id: _AlarmStatus_noRinseback + text: qsTr("") + width: _AlarmStatusColumn.width + horizontalAlignment: Text.AlignLeft + color: Colors.textMain + font.pixelSize: Fonts.fontPixelButton + } + Text { id: _AlarmStatus_noEndTreatment + text: qsTr("") + width: _AlarmStatusColumn.width + horizontalAlignment: Text.AlignLeft + color: Colors.textMain + font.pixelSize: Fonts.fontPixelButton + } + Text { id: _AlarmStatus_noNewTreatment + text: qsTr("") + width: _AlarmStatusColumn.width + horizontalAlignment: Text.AlignLeft + color: Colors.textMain + font.pixelSize: Fonts.fontPixelButton + } + Text { id: _AlarmStatus_bypassDialyzer + text: qsTr("") + width: _AlarmStatusColumn.width + horizontalAlignment: Text.AlignLeft + color: Colors.textMain + font.pixelSize: Fonts.fontPixelButton + } + Text { id: _AlarmStatus_alarmsToEscalate + text: qsTr("") + width: _AlarmStatusColumn.width + horizontalAlignment: Text.AlignLeft + color: Colors.textMain + font.pixelSize: Fonts.fontPixelButton + } + Text { id: _AlarmStatus_alarmsSilenced + text: qsTr("") + width: _AlarmStatusColumn.width + horizontalAlignment: Text.AlignLeft + color: Colors.textMain + font.pixelSize: Fonts.fontPixelButton + } + } + Connections { + target: _GuiView + onDidActionReceive: { + if ( ! visible ) return; + switch(vAction) { + case GuiActions.BloodFlow: + _BloodFlow_S32 .text = vData[GuiActions.BloodFlow_FlowSetPoint ]; + _BloodFlow_F32_1.text = vData[GuiActions.BloodFlow_MeasuredFlow ].toFixed(2); + _BloodFlow_F32_2.text = vData[GuiActions.BloodFlow_RotorSpeed ].toFixed(2); + _BloodFlow_F32_3.text = vData[GuiActions.BloodFlow_MotorSpeed ].toFixed(2); + _BloodFlow_F32_4.text = vData[GuiActions.BloodFlow_MotorCtlSpeed ].toFixed(2); + _BloodFlow_F32_5.text = vData[GuiActions.BloodFlow_MotorCtlCurrent].toFixed(2); + _BloodFlow_F32_6.text = vData[GuiActions.BloodFlow_PWMDtCycle ].toFixed(2) + "%"; + break; + case GuiActions.BloodFlow: + _DialysateFlow_S32 .text = vData[GuiActions.DialysateFlow_FlowSetPoint ]; + _DialysateFlow_F32_1.text = vData[GuiActions.DialysateFlow_MeasuredFlow ].toFixed(2); + _DialysateFlow_F32_2.text = vData[GuiActions.DialysateFlow_RotorSpeed ].toFixed(2); + _DialysateFlow_F32_3.text = vData[GuiActions.DialysateFlow_MotorSpeed ].toFixed(2); + _DialysateFlow_F32_4.text = vData[GuiActions.DialysateFlow_MotorCtlSpeed ].toFixed(2); + _DialysateFlow_F32_5.text = vData[GuiActions.DialysateFlow_MotorCtlCurrent].toFixed(2); + _DialysateFlow_F32_6.text = vData[GuiActions.DialysateFlow_PWMDtCycle ].toFixed(2) + "%"; + break; + case GuiActions.AlarmStatus: + _AlarmStatus_Priority .text = _GuiView.alarmPriorityName(vData[GuiActions.AlarmStatus_Priority ]) + _AlarmStatus_ID .text = _GuiView.alarmIDName (vData[GuiActions.AlarmStatus_AlarmID ]) + _AlarmStatus_EsclateIn .text = "Escalates In : " + vData[GuiActions.AlarmStatus_EscalateIn ] + _AlarmStatus_MuteTimeout .text = "MuteTimeout : " + vData[GuiActions.AlarmStatus_MuteTimeout ] + _AlarmStatus_systemFault .text = (vData[GuiActions.AlarmStatus_Flag_systemFault ] ? "1" : "0" ) + " : systemFault " + _AlarmStatus_stop .text = (vData[GuiActions.AlarmStatus_Flag_stop ] ? "1" : "0" ) + " : stop " + _AlarmStatus_noClear .text = (vData[GuiActions.AlarmStatus_Flag_noClear ] ? "1" : "0" ) + " : noClear " + _AlarmStatus_noResume .text = (vData[GuiActions.AlarmStatus_Flag_noResume ] ? "1" : "0" ) + " : noResume " + _AlarmStatus_noRinseback .text = (vData[GuiActions.AlarmStatus_Flag_noRinseback ] ? "1" : "0" ) + " : noRinseback " + _AlarmStatus_noEndTreatment .text = (vData[GuiActions.AlarmStatus_Flag_noEndTreatment ] ? "1" : "0" ) + " : noEndTreatment " + _AlarmStatus_noNewTreatment .text = (vData[GuiActions.AlarmStatus_Flag_noNewTreatment ] ? "1" : "0" ) + " : noNewTreatment " + _AlarmStatus_bypassDialyzer .text = (vData[GuiActions.AlarmStatus_Flag_bypassDialyzer ] ? "1" : "0" ) + " : bypassDialyzer " + _AlarmStatus_alarmsToEscalate.text = (vData[GuiActions.AlarmStatus_Flag_alarmsToEscalate] ? "1" : "0" ) + " : alarmsToEscalate " + _AlarmStatus_alarmsSilenced .text = (vData[GuiActions.AlarmStatus_Flag_alarmsSilenced ] ? "1" : "0" ) + " : alarmsSilenced " + break; + } + } + } } Index: sources/maintimer.cpp =================================================================== diff -u -r227f28b202f81ab3dd04a81868697025ccab6220 -r8c69137f18382bdc55a5678e6ed44a7683fe4dea --- sources/maintimer.cpp (.../maintimer.cpp) (revision 227f28b202f81ab3dd04a81868697025ccab6220) +++ sources/maintimer.cpp (.../maintimer.cpp) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) @@ -19,8 +19,10 @@ #include "logger.h" /*! - * \brief MainTimer Constructor - * \param parent + * \brief MainTimer::MainTimer + * \details Constructor + * \param parent - QObject parent owner object. + * Qt handles the children destruction by their parent objects life-cycle. */ MainTimer::MainTimer(QObject *parent) : QObject(parent) { } Index: sources/storage/logger.cpp =================================================================== diff -u -re58b907a69d4ca7daa77d69791593b886d1b80e8 -r8c69137f18382bdc55a5678e6ed44a7683fe4dea --- sources/storage/logger.cpp (.../logger.cpp) (revision e58b907a69d4ca7daa77d69791593b886d1b80e8) +++ sources/storage/logger.cpp (.../logger.cpp) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) @@ -28,6 +28,12 @@ using namespace Storage; +/*! + * \brief Logger::Logger + * \details Constructor + * \param parent - QObject parent owner object. + * Qt handles the children destruction by their parent objects life-cycle. + */ Logger::Logger(QObject *parent) : QObject(parent) { } /*! @@ -213,21 +219,17 @@ LOG_ERROR(tr("Incorrect type of logging").arg(vLogType)); } -#ifdef QT_DEBUG - if (vLogType == Logger::LogType::eLogError) { - mContent += QString("\033[1;31m --- %1 --- \033[0m").arg(_logPrefix[vLogType]); - } -#else mContent += _logPrefix[vLogType]; -#endif - mContent += _prefixSeparator; mContent += QTime::currentTime().toString(_timeFormat); mContent += _timeSeparator + vContent; QString fileName = date + _dateSeparator + Log_File_Name; _logFileName = _logPathNames[vLogType] + fileName; FileHandler::write(_logFileName, mContent + "\r\n", true); if (vLogType == eLogError) { +#ifdef QT_DEBUG + mContent.prepend("\033[1;31m --- @ --- \033[0m"); +#endif qDebug().noquote() << mContent; } } Index: sources/storage/logger.h =================================================================== diff -u -r227f28b202f81ab3dd04a81868697025ccab6220 -r8c69137f18382bdc55a5678e6ed44a7683fe4dea --- sources/storage/logger.h (.../logger.h) (revision 227f28b202f81ab3dd04a81868697025ccab6220) +++ sources/storage/logger.h (.../logger.h) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) @@ -25,10 +25,38 @@ // Define #define _Logger Storage::Logger::I() -#define LOG_EVENT(vCONTENT) emit Storage::Logger::I().didLog(vCONTENT, Storage::Logger::LogType::eLogEvent) -#define LOG_ERROR(vCONTENT) emit Storage::Logger::I().didLog(vCONTENT, Storage::Logger::LogType::eLogError) -#define LOG_DATUM(vCONTENT) emit Storage::Logger::I().didLog(vCONTENT, Storage::Logger::LogType::eLogDatum) +#define LOG_EVENT(vCONTENT) emit Storage::Logger::I().didLog(vCONTENT, Storage::Logger::LogType::eLogEvent) +#define LOG_EVENT_ONCE_LOGGED \ + bLOG_EVENT_ONCE_LOGGED +#define LOG_EVENT_ONCE(vCONTENT) \ + static bool LOG_EVENT_ONCE_LOGGED = false; \ + if ( ! LOG_EVENT_ONCE_LOGGED ) { \ + LOG_EVENT_ONCE_LOGGED = true; \ + LOG_EVENT(vCONTENT); \ + } + +#define LOG_ERROR(vCONTENT) emit Storage::Logger::I().didLog(vCONTENT, Storage::Logger::LogType::eLogError) +#define LOG_ERROR_ONCE_LOGGED \ + bLOG_ERROR_ONCE_LOGGED +#define LOG_ERROR_ONCE(vCONTENT) \ + static bool LOG_ERROR_ONCE_LOGGED = false; \ + if ( ! LOG_ERROR_ONCE_LOGGED ) { \ + LOG_ERROR_ONCE_LOGGED = true; \ + LOG_ERROR(vCONTENT); \ + } + +#define LOG_DATUM(vCONTENT) emit Storage::Logger::I().didLog(vCONTENT, Storage::Logger::LogType::eLogDatum) +#define LOG_DATUM_ONCE_LOGGED \ + bLOG_DATUM_ONCE_LOGGED +#define LOG_DATUM_ONCE(vCONTENT) \ + static bool LOG_DATUM_ONCE_LOGGED = false; \ + if ( ! LOG_DATUM_ONCE_LOGGED ) { \ + LOG_DATUM_ONCE_LOGGED = true; \ + LOG_DATUM(vCONTENT); \ + } + + // forward declarations class tst_logging; @@ -119,11 +147,11 @@ // ----- logging structure private slots: - void onLog(const QString &vContent, LogType vLogType); + void onLog (const QString &vContent, LogType vLogType); private: - void log (const QString &vContent, LogType vLogType); + void log (const QString &vContent, LogType vLogType); signals: - void didLog (const QString &vContent, LogType vLogType); + void didLog (const QString &vContent, LogType vLogType); }; } Index: sources/storage/settings.cpp =================================================================== diff -u -r227f28b202f81ab3dd04a81868697025ccab6220 -r8c69137f18382bdc55a5678e6ed44a7683fe4dea --- sources/storage/settings.cpp (.../settings.cpp) (revision 227f28b202f81ab3dd04a81868697025ccab6220) +++ sources/storage/settings.cpp (.../settings.cpp) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) @@ -15,6 +15,12 @@ using namespace Storage; +/*! + * \brief Settings::Settings + * \details Constructor + * \param parent - QObject parent owner object. + * Qt handles the children destruction by their parent objects life-cycle. + */ Settings::Settings(QObject *parent) : QObject(parent) { Index: sources/storage/usbwatcher.cpp =================================================================== diff -u -re58b907a69d4ca7daa77d69791593b886d1b80e8 -r8c69137f18382bdc55a5678e6ed44a7683fe4dea --- sources/storage/usbwatcher.cpp (.../usbwatcher.cpp) (revision e58b907a69d4ca7daa77d69791593b886d1b80e8) +++ sources/storage/usbwatcher.cpp (.../usbwatcher.cpp) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) @@ -29,6 +29,12 @@ // namespace using namespace Storage; +/*! + * \brief USBWatcher::USBWatcher + * \details Constructor + * \param parent - QObject parent owner object. + * Qt handles the children destruction by their parent objects life-cycle. + */ USBWatcher::USBWatcher(QObject *parent) : QObject(parent) { } /*! @@ -99,7 +105,6 @@ _thread->setObjectName(QString("%1_Thread").arg(metaObject()->className())); connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(quit())); _thread->start(); - _thread->setPriority(QThread::LowestPriority); moveToThread(_thread); } Index: unittests/tst_canbus.cpp =================================================================== diff -u -re58b907a69d4ca7daa77d69791593b886d1b80e8 -r8c69137f18382bdc55a5678e6ed44a7683fe4dea --- unittests/tst_canbus.cpp (.../tst_canbus.cpp) (revision e58b907a69d4ca7daa77d69791593b886d1b80e8) +++ unittests/tst_canbus.cpp (.../tst_canbus.cpp) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) @@ -20,6 +20,12 @@ using namespace Can; +/*! + * \brief tst_canbus::tst_canbus + * \details Constructor + * \param parent - QObject parent owner object. + * Qt handles the children destruction by their parent objects life-cycle. + */ tst_canbus::tst_canbus(QObject *parent) : QObject(parent) { } void tst_canbus::initTestCase() @@ -63,7 +69,7 @@ _MessageDispatcher .init(); _MessageDispatcher .enableConsoleOut(true); - connect(&_MessageDispatcher, &MessageDispatcher::didFrameTransmit, [=](Can::Can_Id vCanId , const QByteArray &vPayload) { + connect(&_MessageDispatcher, &MessageDispatcher::didFrameTransmit, [=](Can::Can_Id vCan_Id , const QByteArray &vPayload) { _emited = true; QCOMPARE(Format::toHexString(vPayload), _expected); }); @@ -99,7 +105,7 @@ void tst_canbus::tst_FrameInterface_TransmitFrame_LongerData() { _expected = QByteArray("123456789"); - _FrameInterface.transmitFrame(Can_Id::eChlid_HD, _expected); + _FrameInterface.transmitFrame(Can_Id::eChlid_HD_UI, _expected); QVERIFY( ! _emited ); //there is no signal call - Code Coverage only : Error : "Payload can't be larger than 8 bytes" } @@ -151,7 +157,7 @@ _data = {0}; QCanBusFrame mFrame; QString mPayload; - mFrame.setFrameId(Can_Id::eChlid_HD); + mFrame.setFrameId(Can_Id::eChlid_HD_UI); mPayload = "A5.01.00.01.00.6F.00.00"; mFrame.setPayload(QByteArray::fromHex(mPayload.remove(QLatin1Char('.')).toLatin1())); emit _CanInterface.didFrameReceive(mFrame); @@ -164,7 +170,7 @@ _data = {1}; QCanBusFrame mFrame; QString mPayload; - mFrame.setFrameId(Can_Id::eChlid_HD); + mFrame.setFrameId(Can_Id::eChlid_HD_UI); mPayload = "A5.01.00.01.01.5E.00.00"; mFrame.setPayload(QByteArray::fromHex(mPayload.remove(QLatin1Char('.')).toLatin1())); emit _CanInterface.didFrameReceive(mFrame); @@ -203,7 +209,7 @@ _data = {0}; QCanBusFrame mFrame; QString mPayload; - mFrame.setFrameId(Can_Id::eChlid_HD); + mFrame.setFrameId(Can_Id::eChlid_HD_UI); mPayload = "A5.01.00.01.00.66.00.00"; mFrame.setPayload(QByteArray::fromHex(mPayload.remove(QLatin1Char('.')).toLatin1())); emit _CanInterface.didFrameReceive(mFrame); @@ -216,7 +222,7 @@ _data = {0}; QCanBusFrame mFrame; QString mPayload; - mFrame.setFrameId(Can_Id::eChlid_HD); + mFrame.setFrameId(Can_Id::eChlid_HD_UI); mPayload = "A5.01.00.01.00.6F"; mFrame.setPayload(QByteArray::fromHex(mPayload.remove(QLatin1Char('.')).toLatin1())); emit _CanInterface.didFrameReceive(mFrame); @@ -229,7 +235,7 @@ _data = {0}; QCanBusFrame mFrame; QString mPayload; - mFrame.setFrameId(Can_Id::eChlid_HD); + mFrame.setFrameId(Can_Id::eChlid_HD_UI); mPayload = "A5.01.00.01.00.6F.FF.FF.FF"; mFrame.setPayload(QByteArray::fromHex(mPayload.remove(QLatin1Char('.')).toLatin1())); emit _CanInterface.didFrameReceive(mFrame); Index: unittests/tst_logging.cpp =================================================================== diff -u -rb9c5b0b3afc3b34d4980ecc4f023f498f80dafbc -r8c69137f18382bdc55a5678e6ed44a7683fe4dea --- unittests/tst_logging.cpp (.../tst_logging.cpp) (revision b9c5b0b3afc3b34d4980ecc4f023f498f80dafbc) +++ unittests/tst_logging.cpp (.../tst_logging.cpp) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) @@ -22,6 +22,12 @@ using namespace Storage; +/*! + * \brief tst_logging::tst_logging + * \details Constructor + * \param parent - QObject parent owner object. + * Qt handles the children destruction by their parent objects life-cycle. + */ tst_logging::tst_logging(QObject *parent) : QObject(parent) { } // void tst_logging::initTestCase_data() Index: unittests/tst_utilities.cpp =================================================================== diff -u -re02b2d465b145702dc41965b2e7da154857eea75 -r8c69137f18382bdc55a5678e6ed44a7683fe4dea --- unittests/tst_utilities.cpp (.../tst_utilities.cpp) (revision e02b2d465b145702dc41965b2e7da154857eea75) +++ unittests/tst_utilities.cpp (.../tst_utilities.cpp) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) @@ -18,6 +18,12 @@ // Project #include "types.h" +/*! + * \brief tst_utilities::tst_utilities + * \details Constructor + * \param parent - QObject parent owner object. + * Qt handles the children destruction by their parent objects life-cycle. + */ tst_utilities::tst_utilities(QObject *parent) : QObject(parent) { } // void tst_utilities::initTestCase_data()