Index: drydemo.pro =================================================================== diff -u -rc0b30f1fa82d0121706351057ab52b3bb1141459 -rc8da96049610870d3a8c9c00edc04f80ae62085f --- drydemo.pro (.../drydemo.pro) (revision c0b30f1fa82d0121706351057ab52b3bb1141459) +++ drydemo.pro (.../drydemo.pro) (revision c8da96049610870d3a8c9c00edc04f80ae62085f) @@ -71,6 +71,8 @@ sources/storage/Settings.h \ \ # sources/storage/TreatmentLog.h # TODO is this needed? \ # ---------- Models ---------- + \ # ---------- States ---------- + sources/DryDemoStates.h \ \ # sources/model/MModel.h # TODO is this needed? sources/model/MAbstract.h \ # TODO is this needed? \ # sources/model/MAbstractDynamic.h # TODO is this needed? @@ -145,7 +147,9 @@ \ # Controllers sources/ApplicationController.cpp \ sources/storage/Settings.cpp \ + \ # ---------- States ---------- \ # ---------- Models ---------- + sources/DryDemoStates.cpp \ sources/model/MAbstract.cpp \ \ # ---------- Models - CONFIRM \ # ---------- Models - POST @@ -237,4 +241,4 @@ ui_build_history.log STATECHARTS += \ - drydemostates.scxml + drydemoxmlstates.scxml Index: drydemo.pro.user =================================================================== diff -u -r5a248f0a45889844aa027f4f4a0661aa539975f0 -rc8da96049610870d3a8c9c00edc04f80ae62085f --- drydemo.pro.user (.../drydemo.pro.user) (revision 5a248f0a45889844aa027f4f4a0661aa539975f0) +++ drydemo.pro.user (.../drydemo.pro.user) (revision c8da96049610870d3a8c9c00edc04f80ae62085f) @@ -1,6 +1,6 @@ - + EnvironmentId @@ -106,7 +106,7 @@ true - "" 0 + 0 0 /home/denali/Projects/application/imake.sh %{sourceDir} ProjectExplorer.ProcessStep @@ -272,7 +272,6 @@ 2 - drydemo2 Qt4ProjectManager.Qt4RunConfiguration:/home/denali/Projects/drydemo/drydemo.pro /home/denali/Projects/drydemo/drydemo.pro -L Fisheye: Tag c8da96049610870d3a8c9c00edc04f80ae62085f refers to a dead (removed) revision in file `drydemostates.scxml'. Fisheye: No comparison available. Pass `N' to diff? Index: drydemoxmlstates.scxml =================================================================== diff -u --- drydemoxmlstates.scxml (revision 0) +++ drydemoxmlstates.scxml (revision c8da96049610870d3a8c9c00edc04f80ae62085f) @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + Index: main.cpp =================================================================== diff -u -r5a248f0a45889844aa027f4f4a0661aa539975f0 -rc8da96049610870d3a8c9c00edc04f80ae62085f --- main.cpp (.../main.cpp) (revision 5a248f0a45889844aa027f4f4a0661aa539975f0) +++ main.cpp (.../main.cpp) (revision c8da96049610870d3a8c9c00edc04f80ae62085f) @@ -47,13 +47,9 @@ #include "ApplicationController.h" #include "Logger.h" -//AMIR #include "Settings.h" - #include "Threads.h" -#include "drydemostates.h" - // kernel #include @@ -534,6 +530,7 @@ signal(SIGTERM, signalhandler); #endif + /* drydemostates dryStates; dryStates.start(); @@ -548,6 +545,7 @@ dryStates.connectToState("Treatment", QScxmlStateMachine::onEntry([&]() { qDebug() << "In Treatment";})); + */ // setting the environment for the keyboard. qputenv("QT_IM_MODULE" , QByteArray("qtvirtualkeyboard" )); Index: sources/ApplicationController.cpp =================================================================== diff -u -r5a248f0a45889844aa027f4f4a0661aa539975f0 -rc8da96049610870d3a8c9c00edc04f80ae62085f --- sources/ApplicationController.cpp (.../ApplicationController.cpp) (revision 5a248f0a45889844aa027f4f4a0661aa539975f0) +++ sources/ApplicationController.cpp (.../ApplicationController.cpp) (revision c8da96049610870d3a8c9c00edc04f80ae62085f) @@ -25,6 +25,9 @@ #include "Settings.h" #include "MSettings.h" + +// TODO: Clean up APPLICATION CONTROLLER + /*! * \brief ApplicationController::ApplicationController * \details Constructor @@ -75,6 +78,12 @@ // it has been tested and works perfectly fine in normal run. quitThread(); // validated } + +void ApplicationController::onUnhandledReceived(QString msg) +{ + qDebug() << "Test Slot" << msg; + emit isUnhandledMsgReady(msg); +} // disabled coco end /*! @@ -102,6 +111,9 @@ connect(&_settingsWatcher, SIGNAL(finished ()), this , SLOT(onSettingsUpdate())); + + connect(this , SIGNAL(isUnhandledMsgReady(QString)), + &_dryDemoStates, SLOT(onMsgReceived(QString))); } /*! @@ -394,30 +406,8 @@ */ void ApplicationController::onSettingsUpdate() { - // TODO add new things - /* - onActionReceive(SettingsData()); - - /// POST /// - //call initialization functions when setting's ready. - //TODO move the initSettig in the Application POST since it is part of the post. _settingsError = _settingsWatcher.result(); - //DEBUG qDebug() << " ***** " << sender() << _settingsError; - _post.isDone( ! _settingsError ); - if ( _settingsError ) { - LOG_APPED_PO(QString("Settings read failed")); - alarmTrigger(Gui::GuiAlarmID::ALARM_ID_HD_UI_POST_FAILURE_SETTINGS_BAD); - } else { - _Settings.datetimeFormat(); - } - - // this singal can be emmited here [ others are postponed to the onTreatmentRangesDone ] - // here we know the CRC was fine with not empty configuration and all files can be read. - emit didSettingsDone( ); // MessageDispatcher -> MessageInterpreter : updateUnhandledMessages - */ - qDebug() << "Call"; - _settingsError = _settingsWatcher.result(); - emit didSettingsDone( ); // MessageDispatcher -> MessageInterpreter : updateUnhandledMessag + emit didSettingsDone(); // MessageDispatcher -> MessageInterpreter : updateUnhandledMessag } /*! Index: sources/ApplicationController.h =================================================================== diff -u -r5a248f0a45889844aa027f4f4a0661aa539975f0 -rc8da96049610870d3a8c9c00edc04f80ae62085f --- sources/ApplicationController.h (.../ApplicationController.h) (revision 5a248f0a45889844aa027f4f4a0661aa539975f0) +++ sources/ApplicationController.h (.../ApplicationController.h) (revision c8da96049610870d3a8c9c00edc04f80ae62085f) @@ -22,6 +22,9 @@ #include "ApplicationPost.h" #include "MessageGlobals.h" +#include "DryDemoStates.h" +#include "MessageInterpreter.h" + // define #define _ApplicationController ApplicationController::I() @@ -56,6 +59,8 @@ ApplicationPost _post; // I may need to be put in a concurrent. + DryDemoStates _dryDemoStates; + public: void initSettings(); @@ -64,6 +69,8 @@ bool init(QThread &vThread); void quit(); + void onUnhandledReceived(QString msg); + private: void initConnections(); @@ -77,9 +84,6 @@ void createFakeSequencedLongMessage (QVariantList &vData, const int vFakeDataLen); void createFakeSeqAtBeginLongMessage(QVariantList &vData, const int vFakeDataLen); - void versionsRequest(); - void institutionalRequest(); - private slots: // Should be private for thread safety and is connected internally. void onMainTimerTimeout(); @@ -141,5 +145,7 @@ */ void didQuitApplication (); + void isUnhandledMsgReady(QString msg); + SAFE_CALL(startPOST) }; Index: sources/DryDemoStates.cpp =================================================================== diff -u --- sources/DryDemoStates.cpp (revision 0) +++ sources/DryDemoStates.cpp (revision c8da96049610870d3a8c9c00edc04f80ae62085f) @@ -0,0 +1,19 @@ + +#include "DryDemoStates.h" + + +DryDemoStates::DryDemoStates(drydemoXMLstates *parent) : drydemoXMLstates(parent) { + //start(); +} + + +void DryDemoStates::onMsgReceived(QString msg) +{ + // TODO call the state machine + qDebug() << "Msg Received" << msg; + + start(); + connectToState("Idle", onEntry([&]() { + qDebug() << "In onEntry"; + submitEvent("Tx_Start_Rqst");})); +} Index: sources/DryDemoStates.h =================================================================== diff -u --- sources/DryDemoStates.h (revision 0) +++ sources/DryDemoStates.h (revision c8da96049610870d3a8c9c00edc04f80ae62085f) @@ -0,0 +1,21 @@ +#pragma once + + +#include + +#include "MessageGlobals.h" +#include "drydemoxmlstates.h" + + +// TODO maybe the DryDemoStates in the scxml not needed? + +class DryDemoStates : public drydemoXMLstates { + Q_OBJECT + +public: + DryDemoStates(drydemoXMLstates *parent = nullptr); + +public slots: + void onMsgReceived(QString msg); + +}; Index: sources/canbus/MessageDispatcher.cpp =================================================================== diff -u -rc0b30f1fa82d0121706351057ab52b3bb1141459 -rc8da96049610870d3a8c9c00edc04f80ae62085f --- sources/canbus/MessageDispatcher.cpp (.../MessageDispatcher.cpp) (revision c0b30f1fa82d0121706351057ab52b3bb1141459) +++ sources/canbus/MessageDispatcher.cpp (.../MessageDispatcher.cpp) (revision c8da96049610870d3a8c9c00edc04f80ae62085f) @@ -102,6 +102,9 @@ // Application Settings are ready connect(&_ApplicationController, SIGNAL(didSettingsDone ()), this , SLOT( onSettingsDone ())); + + connect(&_interpreter, SIGNAL(onUnhandledMsgReady(QString)), + &_ApplicationController, SLOT(onUnhandledReceived(QString))); } /*! @@ -481,3 +484,8 @@ return ok; } + +void MessageDispatcher::testInterp() +{ + qDebug() << "In interp"; +} Index: sources/canbus/MessageDispatcher.h =================================================================== diff -u -rc0b30f1fa82d0121706351057ab52b3bb1141459 -rc8da96049610870d3a8c9c00edc04f80ae62085f --- sources/canbus/MessageDispatcher.h (.../MessageDispatcher.h) (revision c0b30f1fa82d0121706351057ab52b3bb1141459) +++ sources/canbus/MessageDispatcher.h (.../MessageDispatcher.h) (revision c8da96049610870d3a8c9c00edc04f80ae62085f) @@ -109,6 +109,8 @@ bool init(QThread &vThread); void quit(); + void testInterp(); + public: void enableConsoleOut(bool vEnable) { _builder.enableConsoleOut(vEnable); } Index: sources/canbus/MessageInterpreter.cpp =================================================================== diff -u -rc0b30f1fa82d0121706351057ab52b3bb1141459 -rc8da96049610870d3a8c9c00edc04f80ae62085f --- sources/canbus/MessageInterpreter.cpp (.../MessageInterpreter.cpp) (revision c0b30f1fa82d0121706351057ab52b3bb1141459) +++ sources/canbus/MessageInterpreter.cpp (.../MessageInterpreter.cpp) (revision c8da96049610870d3a8c9c00edc04f80ae62085f) @@ -22,6 +22,7 @@ #include "Logger.h" #include "format.h" #include "Settings.h" +#include "DryDemoStates.h" using namespace Can; @@ -53,7 +54,7 @@ * \param parent - QObject parent owner object. * Qt handles the children destruction by their parent objects life-cycle. */ -MessageInterpreter::MessageInterpreter(QObject *parent) : QObject(parent) { } +MessageInterpreter::MessageInterpreter(QObject *parent) : QObject(parent) {} /*! * \brief MessageInterpreter::notify @@ -410,7 +411,7 @@ { QString category = Storage::Settings_Category_MessagesUnhandled; QStringList groups = _Settings.groups(category); - qDebug() << "cat"; + // DEBUG: qDebug() << groups; for(const auto &group: qAsConst(groups)) { bool ok; @@ -492,6 +493,7 @@ } LOG_APPED(logString); qDebug() << "Message" << logString; + emit onUnhandledMsgReady(logString); } else { if ( gDisableUnhandledReport ) { // if the unhandled message error has been disabled, return. Index: sources/canbus/MessageInterpreter.h =================================================================== diff -u -rc0b30f1fa82d0121706351057ab52b3bb1141459 -rc8da96049610870d3a8c9c00edc04f80ae62085f --- sources/canbus/MessageInterpreter.h (.../MessageInterpreter.h) (revision c0b30f1fa82d0121706351057ab52b3bb1141459) +++ sources/canbus/MessageInterpreter.h (.../MessageInterpreter.h) (revision c8da96049610870d3a8c9c00edc04f80ae62085f) @@ -82,5 +82,8 @@ static Can_Source identifySource (Can_Id vCanId, QString *vText = nullptr); static Can_Id identifyDestination(Can_Id vCanId, QString *vText = nullptr); + +signals: + void onUnhandledMsgReady( QString msg) const; }; }