Index: sources/applicationcontroller.cpp =================================================================== diff -u -rd6c7d6c382fe56e19d132f6ba0bcbbc1e6b2060f -r2085b749d1d0aafe823e840f5aa0bc88a340798a --- sources/applicationcontroller.cpp (.../applicationcontroller.cpp) (revision d6c7d6c382fe56e19d132f6ba0bcbbc1e6b2060f) +++ sources/applicationcontroller.cpp (.../applicationcontroller.cpp) (revision 2085b749d1d0aafe823e840f5aa0bc88a340798a) @@ -41,84 +41,47 @@ { if (!_fileHandler ->init()) return false; if (!_applicationPost->init()) return false; - connection(); + initConnections(); return true; } /*! * \brief GUI Controller connections definition */ -void ApplicationController::connection() +void ApplicationController::initConnections() { // From GUI - connect(_GuiController , SIGNAL(didActionRequest(GuiActionType)), - this , SLOT( onActionRequest(GuiActionType))); - // From GUI - connect(_GuiController , SIGNAL(didActionPerform(GuiActionType,GuiActionData)), - this , SLOT( onActionPerform(GuiActionType, GuiActionData))); - + connect(_GuiController , SIGNAL(didActionTransmit(GuiActionType, GuiActionData)), + this , SLOT( onActionTransmit(GuiActionType, GuiActionData))); // From HD/DG - connect(_MessageHandler, SIGNAL(didActionCommand(GuiActionType)), - this , SLOT( onActionCommand(GuiActionType))); - // From HD/DG - connect(_MessageHandler, SIGNAL(didActionConfirm(GuiActionType,GuiActionData)), - this , SLOT( onActionConfirm(GuiActionType, GuiActionData))); + connect(_MessageHandler, SIGNAL(didActionReceive (GuiActionType, GuiActionData)), + this , SLOT( onActionReceive (GuiActionType, GuiActionData))); } - /*! * \brief Process the requested action * \details Processes the requested action * \param vAction - User requested Action */ -void ApplicationController::onActionRequest(GuiActionType vAction) +void ApplicationController::onActionTransmit(GuiActionType vAction, GuiActionData vData) { - // qDebug() << "ApplicationController.actionRequested : " << vAction; - // Process the requested action by GUI - // Process ... - emit didActionRequest(vAction); -} - -/*! - * \brief Process the performed action - * \details An action which has been commanded by HD has been performed by GUI.\n - * GUI notifies that the action has been performed - * \param vAction - * \param vData - */ -void ApplicationController::onActionPerform(GuiActionType vAction, GuiActionData vData) -{ // qDebug() << "ApplicationController.actionPerformed : " << vAction << vData; // Process the performed action by GUI // Process ... - emit didActionPerform(vAction, vData); + emit didActionTransmit(vAction, vData); } /*! - * \brief Action commanded by HD - * \details An action has been commanded by HD, - * GUI requires to be notified to perform the action. - * \param vAction - */ -void ApplicationController::onActionCommand(GuiActionType vAction) -{ - // qDebug() << "ApplicationController.actionCommanded : " << vAction; - // Process the command and notify GUI Controller - // Process ... - emit didActionCommand(vAction); -} - -/*! * \brief An action has been confirmed * \details GUI requested an action. * In response HD confirmed the action. * \param vAction * \param vData */ -void ApplicationController::onActionConfirm(GuiActionType vAction, GuiActionData vData) +void ApplicationController::onActionReceive (GuiActionType vAction, GuiActionData vData) { // qDebug() << "ApplicationController.actionConfirmed : " << vAction; // Process the command and notify GUI Controller // Process ... - emit didActionConfirm(vAction, vData); + emit didActionReceive (vAction, vData); } Index: sources/applicationcontroller.h =================================================================== diff -u -rd6c7d6c382fe56e19d132f6ba0bcbbc1e6b2060f -r2085b749d1d0aafe823e840f5aa0bc88a340798a --- sources/applicationcontroller.h (.../applicationcontroller.h) (revision d6c7d6c382fe56e19d132f6ba0bcbbc1e6b2060f) +++ sources/applicationcontroller.h (.../applicationcontroller.h) (revision 2085b749d1d0aafe823e840f5aa0bc88a340798a) @@ -45,22 +45,16 @@ bool init(); private: - void connection(); + void initConnections(); private slots: // Should be private for thread safety and is connected internally. - void onActionRequest (GuiActionType vAction); // UI => HD/DG - void onActionConfirm (GuiActionType vAction, GuiActionData vData); // UI <= HD/DG + void onActionReceive (GuiActionType vAction, GuiActionData vData); // UI <= HD/DG + void onActionTransmit(GuiActionType vAction, GuiActionData vData); // UI => HD/DG - void onActionCommand (GuiActionType vAction); // UI <= HD/DG - void onActionPerform (GuiActionType vAction, GuiActionData vData); // UI => HD/DG - signals: - void didActionRequest(GuiActionType vAction ); // UI => HD/DG - void didActionConfirm(GuiActionType vAction, GuiActionData vData); // UI <= HD/DG + void didActionReceive (GuiActionType vAction, GuiActionData vData); // UI <= HD/DG + void didActionTransmit(GuiActionType vAction, GuiActionData vData); // UI => HD/DG - void didActionCommand(GuiActionType vAction ); // UI <= HD/DG - void didActionPerform(GuiActionType vAction, GuiActionData vData); // UI => HD/DG - void quit(int retcode=0); }; Index: sources/canbus/caninterface.cpp =================================================================== diff -u -rd6c7d6c382fe56e19d132f6ba0bcbbc1e6b2060f -r2085b749d1d0aafe823e840f5aa0bc88a340798a --- sources/canbus/caninterface.cpp (.../caninterface.cpp) (revision d6c7d6c382fe56e19d132f6ba0bcbbc1e6b2060f) +++ sources/canbus/caninterface.cpp (.../caninterface.cpp) (revision 2085b749d1d0aafe823e840f5aa0bc88a340798a) @@ -47,7 +47,7 @@ _numberFramesWritten = 0; - connection(); + initConnections(); if (!_canDevice->connectDevice()) { status(tr("Error: Connection")); @@ -74,18 +74,17 @@ * \details Initializes the required signal/slot connection between this class and other objects\n * to be able to communicate. */ -void CanInterface::connection() +void CanInterface::initConnections() { if (_canDevice) { - connect(_canDevice, SIGNAL(framesReceived()), - this , SLOT ( onRead())); - connect(_canDevice, SIGNAL(errorOccurred(QCanBusDevice::CanBusError)), - this , SLOT ( onError(QCanBusDevice::CanBusError))); + connect(_canDevice, SIGNAL( framesReceived()), + this , SLOT (onFrameReceive ())); + + connect(_canDevice, SIGNAL( errorOccurred(QCanBusDevice::CanBusError)), + this , SLOT (onError (QCanBusDevice::CanBusError))); } - connect(_MessageHandler, SIGNAL(didActionPerform(QCanBusFrame)), - this , SLOT( onActionPerform(QCanBusFrame))); - connect(_MessageHandler, SIGNAL(didActionRequest(QCanBusFrame)), - this , SLOT( onActionRequest(QCanBusFrame))); + connect(_MessageHandler, SIGNAL(didFrameTransmit(QCanBusFrame)), + this , SLOT( onFrameTransmit(QCanBusFrame))); } /*! @@ -116,7 +115,7 @@ * \details send a frame over the CAN Bus * \param vFrame CAN message frame */ -void CanInterface::send(const QCanBusFrame &vFrame) +void CanInterface::transmit(const QCanBusFrame &vFrame) { if( !_canDevice ) return; @@ -184,7 +183,7 @@ * \brief CanInterface onRead * \details CanBus read handler */ -void CanInterface::onRead() +void CanInterface::onFrameReceive () { if (!_canDevice) return; @@ -219,21 +218,8 @@ * This is a response from application UI to HD device * \param vFrame Can message frame */ -void CanInterface::onActionPerform(const QCanBusFrame &vFrame) +void CanInterface::onFrameTransmit(const QCanBusFrame &vFrame) { // TODO : Process Frame - send(vFrame); + transmit(vFrame); } - -/*! - * \brief CanInterface onActionRequest - * \details sends a Can message frame of the can message of the requested action - * This is a request for action from application UI to HD device - * \param vFrame Can message frame - */ -void CanInterface::onActionRequest(const QCanBusFrame &vFrame) -{ - // TODO : Process Frame - send(vFrame); -} - Index: sources/canbus/caninterface.h =================================================================== diff -u -rf623529d6ec25b555f3ac2248d71fc2b5e7063d6 -r2085b749d1d0aafe823e840f5aa0bc88a340798a --- sources/canbus/caninterface.h (.../caninterface.h) (revision f623529d6ec25b555f3ac2248d71fc2b5e7063d6) +++ sources/canbus/caninterface.h (.../caninterface.h) (revision 2085b749d1d0aafe823e840f5aa0bc88a340798a) @@ -62,21 +62,19 @@ QString status() const; private: - void connection(); + void initConnections(); void status(const QString &vDescription, QString vError = ""); - void send(const QCanBusFrame &vFrame); + void transmit(const QCanBusFrame &vFrame); signals: void didRead (const QCanBusFrame &vFrame ); void didError(const QString &vStatus); public slots: private slots: - - void onActionPerform(const QCanBusFrame &vFrame); - void onActionRequest(const QCanBusFrame &vFrame); - void onRead (); + void onFrameTransmit(const QCanBusFrame &vFrame); + void onFrameReceive (); void onError(QCanBusDevice::CanBusError vError); }; } Index: sources/canbus/messagehandler.cpp =================================================================== diff -u -ra288f091fb21c6cfccf7f7d2c500df1773ef083e -r2085b749d1d0aafe823e840f5aa0bc88a340798a --- sources/canbus/messagehandler.cpp (.../messagehandler.cpp) (revision a288f091fb21c6cfccf7f7d2c500df1773ef083e) +++ sources/canbus/messagehandler.cpp (.../messagehandler.cpp) (revision 2085b749d1d0aafe823e840f5aa0bc88a340798a) @@ -34,16 +34,14 @@ * \brief MessageHandler Constructor * \param parent */ -MessageHandler::MessageHandler(QObject *parent) : QObject(parent) -{ -} +MessageHandler::MessageHandler(QObject *parent) : QObject(parent) { } /*! * \brief Message Handler initializer */ void MessageHandler::init() { - connection(); + initConnections(); checked_in(); //startTimer(1000); } @@ -53,26 +51,27 @@ * \details Initializes the required signal/slot connection between this class and other objects\n * to be able to communicate. */ -void MessageHandler::connection() +void MessageHandler::initConnections() { // From GUI - connect(_ApplicationController, SIGNAL(didActionRequest(GuiActionType)), - this , SLOT( onActionRequest(GuiActionType))); - // From GUI - connect(_ApplicationController, SIGNAL(didActionPerform(GuiActionType,GuiActionData)), - this , SLOT( onActionPerform(GuiActionType, GuiActionData))); + connect(_ApplicationController, SIGNAL(didActionTransmit(GuiActionType, GuiActionData)), + this , SLOT( onActionTransmit(GuiActionType, GuiActionData))); // From HD/DG - connect(_CanInterface , SIGNAL(didRead(QCanBusFrame)), - this , SLOT( onRead(QCanBusFrame))); - + connect(_CanInterface , SIGNAL( didRead(QCanBusFrame)), + this , SLOT(onFrameReceive (QCanBusFrame))); } void MessageHandler::checked_in() { + transmitFrame(eChlid_UI, GuiActions::Check_In); +} + +void MessageHandler::transmitFrame(MessageHandler::Can_Id vCan_Id, GuiActionType vAction, GuiActionData vData) +{ QCanBusFrame mFrame; - mFrame.setFrameId(eChlid_UI); - mFrame.setPayload(buildMessage(GuiActions::Check_In)); - emit didActionPerform(mFrame); + mFrame.setFrameId(vCan_Id); + mFrame.setPayload(buildMessage(vAction,vData)); + emit didFrameTransmit(mFrame); } QByteArray MessageHandler::buildMessage(GuiActionType vAction, GuiActionData vData) @@ -186,38 +185,17 @@ * \details Processes the requested action * \param vAction - User requested Action */ -void MessageHandler::onActionRequest(GuiActionType vAction) +void MessageHandler::onActionTransmit(GuiActionType vAction, GuiActionData vData) { - // TODO : Test Code - QCanBusFrame mFrame; - mFrame.setFrameId(eChlid_UI); - mFrame.setPayload(buildMessage(vAction)); - emit didActionRequest(mFrame); + transmitFrame(eChlid_UI, vAction, vData); } /*! - * \brief Process the performed action - * \details An action which has been commanded by HD has been performed by GUI.\n - * GUI notifies that the action has been performed - * \param vAction - * \param vData - */ -void MessageHandler::onActionPerform(GuiActionType vAction, GuiActionData vData) -{ - // TODO : Test Code - QCanBusFrame mFrame; - mFrame.setFrameId(eChlid_UI); - mFrame.setPayload(buildMessage(vAction, vData)); - emit didActionPerform(mFrame); -} - -/*! * \brief MessageHandler::onRead * \param vFrame */ -void MessageHandler::onRead(const QCanBusFrame &vFrame) +void MessageHandler::onFrameReceive(const QCanBusFrame &vFrame) { - bool isCommand = true ; bool isUnknown = false; bool isIgnored = false; @@ -263,11 +241,7 @@ if (isUnknown || isIgnored) return; - if (isCommand) { - emit didActionCommand(message.actionId); - } else { - emit didActionConfirm(message.actionId, GuiActionData::Accepted); - } + emit didActionReceive (message.actionId, GuiActionData::Accepted); } void MessageHandler::timerEvent(QTimerEvent *event) Index: sources/canbus/messagehandler.h =================================================================== diff -u -r212de04bcfd9c0ec4c13faca1d4227a8ae30e978 -r2085b749d1d0aafe823e840f5aa0bc88a340798a --- sources/canbus/messagehandler.h (.../messagehandler.h) (revision 212de04bcfd9c0ec4c13faca1d4227a8ae30e978) +++ sources/canbus/messagehandler.h (.../messagehandler.h) (revision 2085b749d1d0aafe823e840f5aa0bc88a340798a) @@ -128,50 +128,39 @@ void init(); private: - void connection(); + void initConnections(); void checked_in(); // TODO : needs to be renamed and called from the main timer to tell HD, UI is alive + void transmitFrame(MessageHandler::Can_Id vCan_Id, GuiActionType vAction, GuiActionData vData = GuiActionData::NoData); + // build message to be sent - QByteArray buildMessage (GuiActionType vAction , GuiActionData vData = GuiActionData::NoData); - void addSyncByte (QByteArray &vPayload ); - void addActionId (QByteArray &vPayload , GuiActionType vAction); - void addLegth (QByteArray &vPayload , GuiActionType vAction); - void addData (QByteArray &vPayload , GuiActionData vData = GuiActionData::NoData); - void addCRC (QByteArray &vPayload ); - void addPadding (QByteArray &vPayload ); + QByteArray buildMessage (GuiActionType vAction , GuiActionData vData = GuiActionData::NoData); + void addSyncByte (QByteArray &vPayload); + void addActionId (QByteArray &vPayload, GuiActionType vAction); + void addLegth (QByteArray &vPayload, GuiActionType vAction); + void addData (QByteArray &vPayload, GuiActionData vData = GuiActionData::NoData); + void addCRC (QByteArray &vPayload); + void addPadding (QByteArray &vPayload); - quint8 calcCRC (const QByteArray &vData ); - bool checkCRC (const QByteArray &vData , quint8 vCRC); + quint8 calcCRC (const QByteArray &vData); + bool checkCRC (const QByteArray &vData, quint8 vCRC); // strip message to its parts QByteArray stripMessage (const QCanBusFrame &vFrame ); - bool hasSyncByte (QByteArray &vPayload ); - GuiActionType getActionId (QByteArray &vPayload ); - quint8 getLength (QByteArray &vPayload ); - QByteArray getData (QByteArray &vPayload , quint8 vLen , bool *ok = nullptr ); + bool hasSyncByte (QByteArray &vPayload); + GuiActionType getActionId (QByteArray &vPayload); + quint8 getLength (QByteArray &vPayload); + QByteArray getData (QByteArray &vPayload, quint8 vLen , bool *ok = nullptr ); - - // 0 - command definition - // 0.0- Can ID - // 0.1- command id - // 0.2- command payload length - // 1 - create, frame, schedule, send - // 2 - read, categorize, buffer, act - -private slots: // Should be private for thread safety and is connected internally. - void onActionRequest (GuiActionType vAction); // UI => HD/DG - void onActionPerform (GuiActionType vAction, GuiActionData vData); // UI <= HD/DG - - void onRead (const QCanBusFrame &vFrame); - protected: virtual void timerEvent(QTimerEvent *event) override; -signals: - void didActionConfirm(GuiActionType vAction, GuiActionData vData); // UI <= HD/DG - void didActionCommand(GuiActionType vAction ); // UI <= HD/DG +private slots: // Should be private for thread safety and is connected internally. + void onActionTransmit(GuiActionType vAction, GuiActionData vData); // UI => HD/DG + void onFrameReceive (const QCanBusFrame &vFrame ); // UI <= HD/DG - void didActionRequest(const QCanBusFrame &vFrame ); // UI => HD/DG - void didActionPerform(const QCanBusFrame &vFrame ); // UI => HD/DG +signals: + void didActionReceive (GuiActionType vAction, GuiActionData vData); // UI <= HD/DG + void didFrameTransmit (const QCanBusFrame &vFrame ); // UI => HD/DG }; } Index: sources/gui/guiactions.h =================================================================== diff -u -rd6c7d6c382fe56e19d132f6ba0bcbbc1e6b2060f -r2085b749d1d0aafe823e840f5aa0bc88a340798a --- sources/gui/guiactions.h (.../guiactions.h) (revision d6c7d6c382fe56e19d132f6ba0bcbbc1e6b2060f) +++ sources/gui/guiactions.h (.../guiactions.h) (revision 2085b749d1d0aafe823e840f5aa0bc88a340798a) @@ -30,7 +30,7 @@ enum GuiActionsData_Enum /*: quint8 QML doesn't support*/ { NoData = 0x00, Accepted = 0x01, - Rejected = 0x00, + Rejected = 0x02, }; Q_ENUM(GuiActionsType_Enum) Index: sources/gui/guicontroller.cpp =================================================================== diff -u -rd6c7d6c382fe56e19d132f6ba0bcbbc1e6b2060f -r2085b749d1d0aafe823e840f5aa0bc88a340798a --- sources/gui/guicontroller.cpp (.../guicontroller.cpp) (revision d6c7d6c382fe56e19d132f6ba0bcbbc1e6b2060f) +++ sources/gui/guicontroller.cpp (.../guicontroller.cpp) (revision 2085b749d1d0aafe823e840f5aa0bc88a340798a) @@ -34,15 +34,11 @@ /*! * \brief GuiController connections definition */ -void GuiController::connection() +void GuiController::initConnections() { // From HD/DG - connect(_ApplicationController, SIGNAL(didActionCommand(GuiActionType)), - this , SLOT( onActionCommand(GuiActionType))); - // From HD/DG - connect(_ApplicationController, SIGNAL(didActionConfirm(GuiActionType, GuiActionData)), - this , SLOT( onActionConfirm(GuiActionType, GuiActionData))); - + connect(_ApplicationController, SIGNAL(didActionReceive (GuiActionType, GuiActionData)), + this , SLOT( onActionReceive (GuiActionType, GuiActionData))); } @@ -51,7 +47,7 @@ */ void GuiController::init() { - connection(); + initConnections(); } /*! @@ -63,61 +59,35 @@ * Sometimes GuiController requires to investigate with the ApplicationController to get approval from HD device.\n * \param vAction - User requested Action */ -void GuiController::doActionRequest(GuiActionType vAction) +void GuiController::doActionTransmit(GuiActionType vAction, GuiActionData vData) { // Process the GuiView Request. // It can be processed in GuiController take action and notify GuiView - GuiActionData mData = GuiActionData::Accepted; switch (vAction) { case GuiActionType::PowerOff: - //GUI Controller decides (loop back) - //case Another_Command_Which_Doesn't_Require_HD_Approval: - emit didActionConfirm(vAction, mData); + //GUI Controller decides (loop back) + //case Another_Command_Which_Doesn't_Require_HD_Approval: + if (vData == GuiActionData::NoData) // PowerOff noData is a request + emit didActionReceive (vAction, GuiActionData::Accepted); + else + emit didActionTransmit(vAction, vData); break; default: // If it requires to be Confirmed by HD/DG send the request to ApplicationController - emit didActionRequest(vAction); + emit didActionTransmit(vAction, vData); break; } } /*! - * \brief Process the performed action - * \details An action which has been commanded by HD has been performed by Gui.\n - * Gui notifies that the action has been performed - * \param vAction - * \param vData - */ -void GuiController::doActionPerform(GuiActionType vAction, GuiActionData vData) -{ - // Process the performed action by Gui - // Process ... - emit didActionPerform(vAction, vData); -} - -/*! * \brief Action commanded by HD * \details An action has been commanded by HD, * Gui requires to be notified to perform the action. * \param vAction */ -void GuiController::onActionCommand(GuiActionType vAction) +void GuiController::onActionReceive (GuiActionType vAction, GuiActionData vData) { // Process the command and notify GuiView // Process ... - emit didActionCommand(vAction); + emit didActionReceive (vAction, vData); } - -/*! - * \brief An action has been confirmed - * \details Gui requested an action. - * In response HD confirmed the action. - * \param vAction - * \param vData - */ -void GuiController::onActionConfirm(GuiActionType vAction, GuiActionData vData) -{ - // Process the command and notify GuiView - // Process ... - emit didActionConfirm(vAction, vData); -} Index: sources/gui/guicontroller.h =================================================================== diff -u -rd6c7d6c382fe56e19d132f6ba0bcbbc1e6b2060f -r2085b749d1d0aafe823e840f5aa0bc88a340798a --- sources/gui/guicontroller.h (.../guicontroller.h) (revision d6c7d6c382fe56e19d132f6ba0bcbbc1e6b2060f) +++ sources/gui/guicontroller.h (.../guicontroller.h) (revision 2085b749d1d0aafe823e840f5aa0bc88a340798a) @@ -35,22 +35,17 @@ void init(); private: - void connection(); + void initConnections(); public slots: - void doActionRequest (GuiActionType vAction); // UI => HD/DG - void doActionPerform (GuiActionType vAction, GuiActionData vData); // UI => HD/DG + void doActionTransmit(GuiActionType vAction, GuiActionData vData); // UI => HD/DG private slots: // Should be private for thread safety and is connected internally. - void onActionConfirm (GuiActionType vAction, GuiActionData vData); // UI <= HD/DG - void onActionCommand (GuiActionType vAction); // UI <= HD/DG + void onActionReceive (GuiActionType vAction, GuiActionData vData); // UI <= HD/DG signals: - void didActionRequest(GuiActionType vAction ); // UI => HD/DG - void didActionConfirm(GuiActionType vAction, GuiActionData vData); // UI <= HD/DG - - void didActionCommand(GuiActionType vAction ); // UI <= HD/DG - void didActionPerform(GuiActionType vAction, GuiActionData vData); // UI => HD/DG + void didActionReceive (GuiActionType vAction, GuiActionData vData); // UI <= HD/DG + void didActionTransmit(GuiActionType vAction, GuiActionData vData); // UI => HD/DG }; } Index: sources/gui/guiview.cpp =================================================================== diff -u -rd6c7d6c382fe56e19d132f6ba0bcbbc1e6b2060f -r2085b749d1d0aafe823e840f5aa0bc88a340798a --- sources/gui/guiview.cpp (.../guiview.cpp) (revision d6c7d6c382fe56e19d132f6ba0bcbbc1e6b2060f) +++ sources/gui/guiview.cpp (.../guiview.cpp) (revision 2085b749d1d0aafe823e840f5aa0bc88a340798a) @@ -26,48 +26,29 @@ GuiView::GuiView(QQuickItem *parent) { Q_UNUSED(parent) - connection(); + initConnections(); } -void GuiView::connection() +void GuiView::initConnections() { - connect(_GuiController, SIGNAL(didActionConfirm(GuiActionType, GuiActionData)), - this , SLOT( onActionConfirm(GuiActionType, GuiActionData))); + connect(_GuiController, SIGNAL(didActionReceive (GuiActionType, GuiActionData)), + this , SLOT( onActionReceive (GuiActionType, GuiActionData))); - connect(_GuiController, SIGNAL(didActionCommand(GuiActionType )), - this , SLOT( onActionCommand(GuiActionType ))); - // since we don't have access to GuiView object because it is created in Qml. // Connection to the GuiController made here // It should be defined in the class which wants to connect to signal. - connect(this , SIGNAL(didActionRequest(GuiActionType)), - _GuiController, SLOT( doActionRequest(GuiActionType))); - - connect(this , SIGNAL(didActionPerform(GuiActionType,GuiActionData)), - _GuiController, SLOT( doActionPerform(GuiActionType,GuiActionData))); + connect(this , SIGNAL(didActionTransmit(GuiActionType,GuiActionData)), + _GuiController, SLOT( doActionTransmit(GuiActionType,GuiActionData))); } -void GuiView::onActionConfirm(GuiActionType vAction, GuiActionData vData) +void GuiView::onActionReceive (GuiActionType vAction, GuiActionData vData) { // process the evaluation and notify GUI // process ... - emit didActionConfirm(vAction, vData); + emit didActionReceive (vAction, vData); } -void GuiView::onActionCommand(GuiActionType vAction) +void GuiView::doActionTransmit(GuiActionType vAction, GuiActionData vData) { - // process the commanded action and notify GUI - // process ... - emit didActionCommand(vAction); - + emit didActionTransmit(vAction, vData); } - -void GuiView::doActionRequest(GuiActionType vAction) -{ - emit didActionRequest(vAction); -} - -void GuiView::doActionPerform(GuiActionType vAction, GuiActionData vData) -{ - emit didActionPerform(vAction, vData); -} Index: sources/gui/guiview.h =================================================================== diff -u -rd6c7d6c382fe56e19d132f6ba0bcbbc1e6b2060f -r2085b749d1d0aafe823e840f5aa0bc88a340798a --- sources/gui/guiview.h (.../guiview.h) (revision d6c7d6c382fe56e19d132f6ba0bcbbc1e6b2060f) +++ sources/gui/guiview.h (.../guiview.h) (revision 2085b749d1d0aafe823e840f5aa0bc88a340798a) @@ -33,22 +33,16 @@ explicit GuiView(QQuickItem *parent = nullptr); private: - void connection(); + void initConnections(); private slots: - void onActionConfirm (GuiActionType vAction, GuiActionData vData); // UI <= HD/DG - void onActionCommand (GuiActionType vAction ); // UI <= HD/DG + void onActionReceive (GuiActionType vAction, GuiActionData vData); // UI <= HD/DG public slots: // is public since will be used in the UI and is in the same thread. - void doActionRequest (GuiActionType vAction ); // UI => HD/DG - void doActionPerform (GuiActionType vAction, GuiActionData vData); // UI => HD/DG + void doActionTransmit(GuiActionType vAction, GuiActionData vData); // UI => HD/DG signals: - void didActionConfirm(GuiActionType vAction, GuiActionData vData); // UI <= HD/DG - void didActionCommand(GuiActionType vAction ); // UI <= HD/DG - - void didActionRequest(GuiActionType vAction ); // UI => HD/DG - void didActionPerform(GuiActionType vAction, GuiActionData vData); // UI => HD/DG - + void didActionReceive (GuiActionType vAction, GuiActionData vData); // UI <= HD/DG + void didActionTransmit(GuiActionType vAction, GuiActionData vData); // UI => HD/DG }; } Index: sources/gui/qml/main.qml =================================================================== diff -u -rd6c7d6c382fe56e19d132f6ba0bcbbc1e6b2060f -r2085b749d1d0aafe823e840f5aa0bc88a340798a --- sources/gui/qml/main.qml (.../main.qml) (revision d6c7d6c382fe56e19d132f6ba0bcbbc1e6b2060f) +++ sources/gui/qml/main.qml (.../main.qml) (revision 2085b749d1d0aafe823e840f5aa0bc88a340798a) @@ -36,21 +36,14 @@ property alias powerOffDialog: _powerOffDialog GuiView { id: _GuiView - onDidActionConfirm: { + onDidActionReceive: { switch(vAction) { case GuiActions.PowerOff: if (vData === GuiActions.Accepted) _powerOffDialog.open() break; } } - onDidActionCommand: { - switch(vAction) { - case GuiActions.PowerOff: - _powerOffDialog.open() - break; - } - } } // ----- Follow the below Z order ----- @@ -81,10 +74,10 @@ // 4 - Modals PowerOff { id: _powerOffDialog onAccepted: { - _GuiView.doActionPerform(GuiActions.PowerOff, GuiActions.Accepted) + _GuiView.doActionTransmit(GuiActions.PowerOff, GuiActions.Accepted) } onRejected: { - _GuiView.doActionPerform(GuiActions.PowerOff, GuiActions.Rejected) + _GuiView.doActionTransmit(GuiActions.PowerOff, GuiActions.Rejected) } } Index: sources/gui/qml/pages/SettingsHome.qml =================================================================== diff -u -rf623529d6ec25b555f3ac2248d71fc2b5e7063d6 -r2085b749d1d0aafe823e840f5aa0bc88a340798a --- sources/gui/qml/pages/SettingsHome.qml (.../SettingsHome.qml) (revision f623529d6ec25b555f3ac2248d71fc2b5e7063d6) +++ sources/gui/qml/pages/SettingsHome.qml (.../SettingsHome.qml) (revision 2085b749d1d0aafe823e840f5aa0bc88a340798a) @@ -39,7 +39,7 @@ } text.text: qsTr("Shutdown") button.onPressed: { - _GuiView.doActionRequest(GuiActions.PowerOff) + _GuiView.doActionTransmit(GuiActions.PowerOff, GuiActions.NoData) } } Column { Index: unittests/unittests.cpp =================================================================== diff -u -rd6c7d6c382fe56e19d132f6ba0bcbbc1e6b2060f -r2085b749d1d0aafe823e840f5aa0bc88a340798a --- unittests/unittests.cpp (.../unittests.cpp) (revision d6c7d6c382fe56e19d132f6ba0bcbbc1e6b2060f) +++ unittests/unittests.cpp (.../unittests.cpp) (revision 2085b749d1d0aafe823e840f5aa0bc88a340798a) @@ -52,7 +52,7 @@ QString mTr = tr("Connected"); QCOMPARE(Can::_CanInterface->status().left(mTr.length()), mTr); - Can::_CanInterface->onRead (); + Can::_CanInterface->onFrameReceive (); } void unittests::tst_MessageHandler_Init() @@ -124,8 +124,8 @@ void unittests::cleanup() { disconnect(Can::_MessageHandler); - Can::_CanInterface ->connection(); - Can::_MessageHandler->connection(); + Can::_CanInterface ->initConnections(); + Can::_MessageHandler->initConnections(); } void unittests::cleanupTestCase()