Compare commits
38 Commits
922c58d611
...
render
Author | SHA1 | Date | |
---|---|---|---|
c9d2c05b73 | |||
c07c47385e | |||
68fd8440fc | |||
c1b4baeb2e | |||
09ea237a13 | |||
26ef097d86 | |||
9b56357770 | |||
57720e50f7 | |||
05f186188f | |||
20fd0631c6 | |||
268c270a4d | |||
9059d77b3e | |||
92c2faa858 | |||
2ee12ca042 | |||
3d5f026a94 | |||
54265d70d1 | |||
f26d9803ac | |||
a327899e11 | |||
0978fdb7a5 | |||
5c889da959 | |||
a1960d7f3b | |||
a86d9b1dfc | |||
e302dab670 | |||
f809d4f647 | |||
208ab5ec63 | |||
08ad191f2e | |||
dd9498f38d | |||
4002757765 | |||
c1e65d41ee | |||
b3cec6c926 | |||
820aff5af4 | |||
3ef80d2187 | |||
ed95e01cf3 | |||
25f77289d7 | |||
6bfe6ee059 | |||
79aab9999f | |||
dc5912187a | |||
eeb8e22117 |
64
.gitignore
vendored
@ -1 +1,63 @@
|
|||||||
test-bench/test1/build-test1-idf-Desktop_Qt_6_3_0_MinGW_64_bit-Debug
|
# C++ objects and libs
|
||||||
|
*.slo
|
||||||
|
*.lo
|
||||||
|
*.o
|
||||||
|
*.a
|
||||||
|
*.la
|
||||||
|
*.lai
|
||||||
|
*.so
|
||||||
|
*.so.*
|
||||||
|
*.dll
|
||||||
|
*.dylib
|
||||||
|
|
||||||
|
# Qt-es
|
||||||
|
object_script.*.Release
|
||||||
|
object_script.*.Debug
|
||||||
|
*_plugin_import.cpp
|
||||||
|
/.qmake.cache
|
||||||
|
/.qmake.stash
|
||||||
|
*.pro.user
|
||||||
|
*.pro.user.*
|
||||||
|
*.qbs.user
|
||||||
|
*.qbs.user.*
|
||||||
|
*.moc
|
||||||
|
moc_*.cpp
|
||||||
|
moc_*.h
|
||||||
|
qrc_*.cpp
|
||||||
|
ui_*.h
|
||||||
|
*.qmlc
|
||||||
|
*.jsc
|
||||||
|
Makefile*
|
||||||
|
*build-*
|
||||||
|
*.qm
|
||||||
|
*.prl
|
||||||
|
|
||||||
|
# Qt unit tests
|
||||||
|
target_wrapper.*
|
||||||
|
|
||||||
|
# QtCreator
|
||||||
|
*.autosave
|
||||||
|
|
||||||
|
# QtCreator Qml
|
||||||
|
*.qmlproject.user
|
||||||
|
*.qmlproject.user.*
|
||||||
|
|
||||||
|
# QtCreator CMake
|
||||||
|
CMakeLists.txt.user*
|
||||||
|
|
||||||
|
# QtCreator 4.8< compilation database
|
||||||
|
compile_commands.json
|
||||||
|
|
||||||
|
# QtCreator local machine specific files for imported projects
|
||||||
|
*creator.user*
|
||||||
|
|
||||||
|
*_qmlcache.qrc
|
||||||
|
*.user
|
||||||
|
test-bench/test1/ide-cubeide-test1-idf/Debug
|
||||||
|
test-bench/test5/ide-cubeide-test5-idf/.settings/language.settings.xml
|
||||||
|
test-bench/test1/ide-cubeide-test1-idf/.settings/language.settings.xml
|
||||||
|
test-bench/test2/ide-cubeide-test2-idf/.settings/language.settings.xml
|
||||||
|
test-bench/test2/ide-cubeide-test2-idf/Debug
|
||||||
|
test-bench/test4/ide-cubeide-test4-idf/.settings/language.settings.xml
|
||||||
|
test-bench/test3/ide-cubeide-test3-idf/.settings/language.settings.xml
|
||||||
|
.idea
|
||||||
|
BIN
UML/event.png
Normal file
After Width: | Height: | Size: 44 KiB |
55
UML/event.puml
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
@startuml
|
||||||
|
|
||||||
|
participant Behavior as b
|
||||||
|
participant Dispatcher as d
|
||||||
|
entity Event as e
|
||||||
|
participant EventQueue as eq
|
||||||
|
queue "EventQueue::queue_" as q
|
||||||
|
|
||||||
|
== Create an Event ==
|
||||||
|
|||
|
||||||
|
?->> b ++ : GEN
|
||||||
|
b -> e ** : new
|
||||||
|
b -> b --++ : pushEvent
|
||||||
|
e -> b : getBehavior
|
||||||
|
b --> e ++: setBehavior
|
||||||
|
e --> b --
|
||||||
|
b -> d ++ : getDispatcher
|
||||||
|
d --> b
|
||||||
|
b -> d -- : pushEvent
|
||||||
|
d ->? -- : push
|
||||||
|
|
||||||
|
|
||||||
|
|||
|
||||||
|
|||
|
||||||
|
== Push Event ==
|
||||||
|
|||
|
||||||
|
?->> d ++: pushEvent
|
||||||
|
d -> eq--++: push
|
||||||
|
eq -> q ++
|
||||||
|
q --> eq
|
||||||
|
eq -> q -- : pushEndQueue
|
||||||
|
|
||||||
|
|||
|
||||||
|
|||
|
||||||
|
== Dispatch ==
|
||||||
|
|||
|
||||||
|
?->> d ++: executeOnce
|
||||||
|
d -> q : getFront
|
||||||
|
q -> e ++
|
||||||
|
e --> q
|
||||||
|
q --> d : event
|
||||||
|
d -> q : pop
|
||||||
|
deactivate q
|
||||||
|
d -> d --++ : dispatchEvent
|
||||||
|
d -> b ++ : getBehavior
|
||||||
|
b --> d
|
||||||
|
d -> b -- : process
|
||||||
|
b -> b--: processEvent
|
||||||
|
|
||||||
|
destroy e
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@enduml
|
BIN
UML/timeAlgorithme.png
Normal file
After Width: | Height: | Size: 28 KiB |
27
UML/timeAlgorithme.puml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
@startuml
|
||||||
|
|
||||||
|
start
|
||||||
|
:newTime = 0
|
||||||
|
totalTime = 0
|
||||||
|
isEnd = it == list.end()
|
||||||
|
lastTime = 0;
|
||||||
|
|
||||||
|
#tomato:if (!isEnd) then (not end)
|
||||||
|
#tomato:totalTime += it.getRelTicks();
|
||||||
|
endif
|
||||||
|
|
||||||
|
while ( !isEnd && (totalTime <= newTime) ) is (goForward)
|
||||||
|
:isEnd = (++it == list.end());
|
||||||
|
:lastTime = totalTime;
|
||||||
|
#tomato:if (!isEnd) then (not end)
|
||||||
|
#tomato:totalTime += it.getRelTicks();
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
#tomato:if (!isEnd) then (not end)
|
||||||
|
#tomato:subRelTicks(newTime- lastTime);
|
||||||
|
endif
|
||||||
|
:it.setRelTicks(newTime - lastTime);
|
||||||
|
:insert(it, newTimeout);
|
||||||
|
|
||||||
|
@enduml
|
BIN
UML/timeout.png
Normal file
After Width: | Height: | Size: 63 KiB |
62
UML/timeout.puml
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
@startuml
|
||||||
|
|
||||||
|
participant "Behavior::StateMachine" as sm
|
||||||
|
participant Dispatcher as d
|
||||||
|
participant TimeoutManager as tm
|
||||||
|
entity "Event::Timeout" as t
|
||||||
|
queue "TimeoutManager::timeouts_" as timeouts
|
||||||
|
|
||||||
|
autoactivate off
|
||||||
|
|||
|
||||||
|
|||
|
||||||
|
== Schedule timeout ==
|
||||||
|
|||
|
||||||
|
sm -> sm++ : scheduleTimeout
|
||||||
|
sm -> d ++: getDispatcher
|
||||||
|
d --> sm --: dispatcher
|
||||||
|
sm -> d --++ : scheduleTimeout
|
||||||
|
d -> tm ++: getTimeoutManager
|
||||||
|
tm --> d --: timeoutManager
|
||||||
|
d -> tm --++ : scheduleTimeout
|
||||||
|
tm -> t ** : new
|
||||||
|
t --> tm
|
||||||
|
tm -> timeouts --++: insert
|
||||||
|
|
||||||
|
|||
|
||||||
|
|||
|
||||||
|
== Decrement timeout (and dispatch) ==
|
||||||
|
|||
|
||||||
|
loop every tickInterval
|
||||||
|
?->> tm ++: tick
|
||||||
|
tm -> timeouts : getFront
|
||||||
|
timeouts -> t ++
|
||||||
|
t --> timeouts
|
||||||
|
timeouts --> tm : timeout
|
||||||
|
tm -> t --: decrement
|
||||||
|
end
|
||||||
|
|||
|
||||||
|
note left t
|
||||||
|
When timeout is 0,
|
||||||
|
dispatch event
|
||||||
|
end note
|
||||||
|
t -> timeouts : pop
|
||||||
|
deactivate timeouts
|
||||||
|
t ->? --: pushEvent
|
||||||
|
|
||||||
|
|||
|
||||||
|
|||
|
||||||
|
== Unschedule timeout ==
|
||||||
|
|||
|
||||||
|
sm -> sm++ : unscheduleTimeout
|
||||||
|
sm -> d ++: getDispatcher
|
||||||
|
d --> sm --: dispatcher
|
||||||
|
sm -> d --++ : unscheduleTimeout
|
||||||
|
d -> tm ++: getTimeoutManager
|
||||||
|
tm --> d --: timeoutManager
|
||||||
|
d -> tm --++ : unscheduleTimeout
|
||||||
|
tm -> timeouts --: erase
|
||||||
|
timeouts -> t !!
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@enduml
|
119
readme.md
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
# Goal of this project
|
||||||
|
- Design an algorithm which lets the `XFTimeoutManager` behave in the same timely manner independent of whether it handles one or nn timeouts
|
||||||
|
- Implement the core classes of the XF
|
||||||
|
- Implement the port classes for following ports: *common*, *idf-qt*, *idf-stm32*
|
||||||
|
- Test and comment the code of the XF
|
||||||
|
- The tests provided need to run using Qt and on the *Embedded System* platform
|
||||||
|
- Demonstrate the right functioning of the XF by comparing and documenting the output created by the tests running on the *Embedded System*
|
||||||
|
|
||||||
|
# Time Algorithm
|
||||||
|
|
||||||
|
|
||||||
|
<img src="./UML/timeAlgorithme.png">
|
||||||
|
|
||||||
|
# Sequence Diagrams
|
||||||
|
## Timeout
|
||||||
|
|
||||||
|
<img src="./UML/timeout.png">
|
||||||
|
|
||||||
|
## Event
|
||||||
|
|
||||||
|
<img src="./UML/event.png">
|
||||||
|
|
||||||
|
# Tests
|
||||||
|
## Test 1
|
||||||
|
This test launches an instance of the Task01Tm class and produces some output. Optionally, multiple instances of Task01Tm can be created to test the XF.
|
||||||
|
|
||||||
|
The Test Factory (TestFactory01) instantiates 2 objects:
|
||||||
|
- An object of Task01Tm which outputs the text "Say Hello" every second
|
||||||
|
- An object of Task01Tm which outputs the text "Echo" every half second
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>QT result ✅</summary>
|
||||||
|
|
||||||
|
<img src="./test-bench/test1/ide-qtcreator-test1-idf/result.PNG">
|
||||||
|
|
||||||
|
This test is successfully passed
|
||||||
|
|
||||||
|
</details>
|
||||||
|
<details>
|
||||||
|
<summary>STM result ✅</summary>
|
||||||
|
|
||||||
|
<img src="./test-bench/test1/ide-cubeide-test1-idf/result.png">
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## Test 2
|
||||||
|
This test checks again timeout handling and proper termination of a state machine. In case the state machine was statically/globally created, the XF must not delete the object, when requested to terminate the behavior. If the state-machine was created on the heap (dynamic allocation), the XF must delete the state machine upon request to terminate.
|
||||||
|
|
||||||
|
Weather or not the state machine should be deleted is handled with the 'deleteOnTerminate()' method provided by the XFReactive interface.
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>QT result ✅</summary>
|
||||||
|
|
||||||
|
<img src="./test-bench/test2/ide-qtcreator-test2-idf/result.PNG">
|
||||||
|
|
||||||
|
This test is successfully passed
|
||||||
|
|
||||||
|
</details>
|
||||||
|
<details>
|
||||||
|
<summary>STM result ✅</summary>
|
||||||
|
|
||||||
|
<img src="./test-bench/test2/ide-cubeide-test2-idf/result.png">
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## Test 3
|
||||||
|
This test checks basic event handling in state machines. In this example the StateMachine03 class sends itself an evRestart event to change from one state to another.
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>QT result ✅</summary>
|
||||||
|
|
||||||
|
<img src="./test-bench/test3/ide-qtcreator-test3-idf/result.PNG">
|
||||||
|
|
||||||
|
This test is successfully passed
|
||||||
|
|
||||||
|
</details>
|
||||||
|
<details>
|
||||||
|
<summary>STM result ✅</summary>
|
||||||
|
|
||||||
|
<img src="./test-bench/test3/ide-cubeide-test3-idf/result.png">
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## Test 4
|
||||||
|
Tests if timeouts are correctly cancelled. When leaving a state with a transition having a timeout, without the timeout raises, the timeout must be cancelled (unscheduled).
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>QT result ✅</summary>
|
||||||
|
|
||||||
|
<img src="./test-bench/test4/ide-qtcreator-test4-idf/result.PNG">
|
||||||
|
|
||||||
|
This test is successfully passed
|
||||||
|
|
||||||
|
</details>
|
||||||
|
<details>
|
||||||
|
<summary>STM result ✅</summary>
|
||||||
|
|
||||||
|
<img src="./test-bench/test4/ide-cubeide-test4-idf/result.png">
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## Test 5
|
||||||
|
With this test multiple timeouts are added to the XFTimeoutManager list at the same time. This tests the way how new timeouts are added in relation to other timeouts (with the same timeout value) already added to the list. For more details how the objects are created, please refere to the implementation of the TestFactory05 class.
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>QT result ✅</summary>
|
||||||
|
|
||||||
|
<img src="./test-bench/test5/ide-qtcreator-test5-idf/result.PNG">
|
||||||
|
|
||||||
|
This test is successfully passed
|
||||||
|
|
||||||
|
</details>
|
||||||
|
<details>
|
||||||
|
<summary>STM result ✅</summary>
|
||||||
|
|
||||||
|
<img src="./test-bench/test5/ide-cubeide-test5-idf/result.png">
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
@ -2,5 +2,98 @@
|
|||||||
#include "xf/timeout.h"
|
#include "xf/timeout.h"
|
||||||
#include "xf/initialevent.h"
|
#include "xf/initialevent.h"
|
||||||
#include "xf/behavior.h"
|
#include "xf/behavior.h"
|
||||||
|
#include "trace/trace.h"
|
||||||
|
|
||||||
// TODO: Implement code for XFBehavior class
|
|
||||||
|
XFBehavior::XFBehavior() {
|
||||||
|
this->deleteOnTerminate_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
XFBehavior::~XFBehavior() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void XFBehavior::startBehavior() {
|
||||||
|
GEN(XFInitialEvent());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Pushes the given event to the dispatcher.
|
||||||
|
*
|
||||||
|
* If the event has no behavior assigned, the behavior of this object is assigned.
|
||||||
|
* @param pEvent Event to push to the dispatcher.
|
||||||
|
*/
|
||||||
|
void XFBehavior::pushEvent(XFEvent *pEvent) {
|
||||||
|
if(pEvent->getBehavior()==nullptr) {
|
||||||
|
pEvent->setBehavior(this);
|
||||||
|
}
|
||||||
|
this->getDispatcher()->pushEvent(pEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool XFBehavior::deleteOnTerminate() const {
|
||||||
|
return this->deleteOnTerminate_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void XFBehavior::setDeleteOnTerminate(bool deleteBehaviour) {
|
||||||
|
this->deleteOnTerminate_ = deleteBehaviour;
|
||||||
|
}
|
||||||
|
|
||||||
|
const XFEvent *XFBehavior::getCurrentEvent() const {
|
||||||
|
return this->pCurrentEvent_;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface::XFDispatcher *XFBehavior::getDispatcher() {
|
||||||
|
return interface::XFDispatcher::getInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns a reference to the actually processed timeout.
|
||||||
|
*
|
||||||
|
* Will work only if the current event is of type IXFEvent::Timeout.
|
||||||
|
*
|
||||||
|
* @return Pointer to the currently processed timeout or nullptr if the current event is not a timeout.
|
||||||
|
*/
|
||||||
|
const XFTimeout *XFBehavior::getCurrentTimeout() {
|
||||||
|
if(pCurrentEvent_->getEventType() == XFEvent::Timeout) {
|
||||||
|
return (XFTimeout*) this->pCurrentEvent_;
|
||||||
|
} else {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void XFBehavior::setCurrentEvent(const XFEvent *pEvent) {
|
||||||
|
this->pCurrentEvent_ = pEvent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Processes the given event.
|
||||||
|
*
|
||||||
|
* The dispatcher calls this method every time a new event
|
||||||
|
* or timeout arrives. The process method stores the actual
|
||||||
|
* event using the #_pCurrentEvent and then calls
|
||||||
|
* processEvent().
|
||||||
|
*
|
||||||
|
* In case you intend to call process() inside your state machine you
|
||||||
|
* are doing something wrong! Call GEN() or pushEvent() instead!
|
||||||
|
*
|
||||||
|
* @param pEvent Event to process
|
||||||
|
* @return if the behavior is terminated (basically a boolean)
|
||||||
|
*/
|
||||||
|
XFBehavior::TerminateBehavior XFBehavior::process(const XFEvent *pEvent) {
|
||||||
|
this->setCurrentEvent(pEvent);
|
||||||
|
|
||||||
|
// Get status of the event processing
|
||||||
|
XFEventStatus status = XFEventStatus::Unknown;
|
||||||
|
status = this->processEvent();
|
||||||
|
|
||||||
|
// Check if event was consumed and if it should be deleted
|
||||||
|
if(status == XFEventStatus::Consumed && pEvent->deleteAfterConsume()) {
|
||||||
|
delete pEvent;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the behavior is terminated and return the result
|
||||||
|
XFBehavior::TerminateBehavior terminateBehavior = false;
|
||||||
|
if(status == XFEventStatus::Terminate) {
|
||||||
|
terminateBehavior = true;
|
||||||
|
}
|
||||||
|
return terminateBehavior;
|
||||||
|
}
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
#include "xf/customevent.h"
|
#include "xf/customevent.h"
|
||||||
|
|
||||||
// TODO: Implement code for XFCustomEvent class
|
|
||||||
|
XFCustomEvent::XFCustomEvent(int id, interface::XFBehavior *pBehavior):
|
||||||
|
XFEvent(XFEventType::Event, id){
|
||||||
|
setBehavior(pBehavior);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
#include "xf/defaulttransition.h"
|
#include "xf/defaulttransition.h"
|
||||||
|
|
||||||
// TODO: Implement code for XFDefaultTransition class
|
XFDefaultTransition::XFDefaultTransition():
|
||||||
|
XFEvent(XFEventType::DefaultTransition) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool XFDefaultTransition::deleteAfterConsume() const {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
#include "xf/initialevent.h"
|
#include "xf/initialevent.h"
|
||||||
|
|
||||||
// TODO: Implement code for XFInitialEvent class
|
XFInitialEvent::XFInitialEvent():
|
||||||
|
XFEvent(XFEventType::Initial) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool XFInitialEvent::deleteAfterConsume() const {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@ -1,9 +1,17 @@
|
|||||||
#include "xf/timeout.h"
|
#include "xf/timeout.h"
|
||||||
|
|
||||||
// TODO: Implement code for XFTimeout class
|
|
||||||
|
|
||||||
XFTimeout::XFTimeout(int id, int interval, interface::XFBehavior *pBehavior):
|
XFTimeout::XFTimeout(int id, int interval, interface::XFBehavior *pBehavior):
|
||||||
XFEvent(XFEventType::Timeout, id), interval_(interval) {
|
XFEvent(XFEventType::Timeout, id), interval_(interval) {
|
||||||
|
this->setRelTicks(this->getInterval());
|
||||||
|
setBehavior(pBehavior);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool XFTimeout::operator ==(const XFTimeout &timeout) const {
|
||||||
|
bool i = (id_ == timeout.id_);
|
||||||
|
bool b = (pBehavior_ == timeout.pBehavior_);
|
||||||
|
return (i && b);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool XFTimeout::deleteAfterConsume() const {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -19,12 +19,63 @@ using Mutex = interface::XFMutex; // Rename XFMutex interface class to Mut
|
|||||||
// Note: The implementation is done here because only in this file the real XFDispatcher
|
// Note: The implementation is done here because only in this file the real XFDispatcher
|
||||||
// class is known (port specific class). An instance of the XFDispatcher class is
|
// class is known (port specific class). An instance of the XFDispatcher class is
|
||||||
// returned by the 'interface::XFDispatcher' class.
|
// returned by the 'interface::XFDispatcher' class.
|
||||||
interface::XFDispatcher * interface::XFDispatcher::getInstance()
|
interface::XFDispatcher * interface::XFDispatcher::getInstance() {
|
||||||
{
|
|
||||||
static ::XFDispatcher dispatcher;
|
static ::XFDispatcher dispatcher;
|
||||||
return &dispatcher;
|
return &dispatcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Implement code for XFDispatcher class
|
XFDispatcher::XFDispatcher() {
|
||||||
|
this->pMutex_ = interface::XFMutex::create();
|
||||||
|
}
|
||||||
|
|
||||||
|
XFDispatcher::~XFDispatcher() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void XFDispatcher::dispatchEvent(const XFEvent *pEvent) const {
|
||||||
|
XFBehavior::TerminateBehavior terminateBehavior;
|
||||||
|
terminateBehavior = pEvent->getBehavior()->process(pEvent);
|
||||||
|
if(terminateBehavior && pEvent->getBehavior()->deleteOnTerminate()) {
|
||||||
|
delete pEvent->getBehavior();
|
||||||
|
if(pEvent->deleteAfterConsume()) {
|
||||||
|
delete pEvent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void XFDispatcher::pushEvent(XFEvent *pEvent) {
|
||||||
|
this->pMutex_->lock();
|
||||||
|
events_.push(pEvent, false);
|
||||||
|
this->pMutex_->unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
void XFDispatcher::scheduleTimeout(int timeoutId, int interval, interface::XFBehavior *pBehavior) {
|
||||||
|
XFTimeoutManager::getInstance()->scheduleTimeout(timeoutId, interval, pBehavior);
|
||||||
|
}
|
||||||
|
|
||||||
|
void XFDispatcher::unscheduleTimeout(int timeoutId, interface::XFBehavior *pBehavior) {
|
||||||
|
XFTimeoutManager::getInstance()->unscheduleTimeout(timeoutId, pBehavior);
|
||||||
|
}
|
||||||
|
|
||||||
|
void XFDispatcher::executeOnce() {
|
||||||
|
if(!this->events_.empty()) {
|
||||||
|
|
||||||
|
this->pMutex_->lock();
|
||||||
|
const XFEvent *ev = this->events_.front();
|
||||||
|
this->events_.pop();
|
||||||
|
this->pMutex_->unlock();
|
||||||
|
|
||||||
|
dispatchEvent(ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int XFDispatcher::execute(const void *param) {
|
||||||
|
(void) param;
|
||||||
|
while(true){
|
||||||
|
this->executeOnce();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // USE_XF_COMMON_DISPATCHER_CLASS
|
#endif // USE_XF_COMMON_DISPATCHER_CLASS
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
|
|
||||||
|
#include "common/dispatcher.h"
|
||||||
#include <config/xf-config.h>
|
#include <config/xf-config.h>
|
||||||
|
|
||||||
#if (USE_XF_COMMON_TIMEOUTMANAGER_CLASS != 0)
|
#if (USE_XF_COMMON_TIMEOUTMANAGER_CLASS != 0)
|
||||||
@ -7,6 +8,9 @@
|
|||||||
#include "xf/interface/behavior.h"
|
#include "xf/interface/behavior.h"
|
||||||
#include "xf/interface/mutex.h"
|
#include "xf/interface/mutex.h"
|
||||||
#include "timeoutmanager.h"
|
#include "timeoutmanager.h"
|
||||||
|
#if defined(XF_TRACE_EVENT_PUSH_POP) && (XF_TRACE_EVENT_PUSH_POP != 0)
|
||||||
|
#include "trace/trace.h"
|
||||||
|
#endif // XF_TRACE_EVENT_PUSH_POP
|
||||||
|
|
||||||
using Mutex = interface::XFMutex; // Rename XFMutex interface class to Mutex for easier use.
|
using Mutex = interface::XFMutex; // Rename XFMutex interface class to Mutex for easier use.
|
||||||
|
|
||||||
@ -20,30 +24,98 @@ interface::XFTimeoutManager * interface::XFTimeoutManager::getInstance() {
|
|||||||
return &timeoutManager;
|
return &timeoutManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Implement code for XFTimeoutManager class
|
|
||||||
|
|
||||||
XFTimeoutManager::XFTimeoutManager() {
|
XFTimeoutManager::XFTimeoutManager() {
|
||||||
|
this->pMutex_ = interface::XFMutex::create();
|
||||||
}
|
}
|
||||||
|
|
||||||
XFTimeoutManager::~XFTimeoutManager() {
|
XFTimeoutManager::~XFTimeoutManager() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void XFTimeoutManager::addTimeout(XFTimeout *pNewTimeout) {
|
||||||
|
|
||||||
|
const int newTime = pNewTimeout->getInterval();
|
||||||
|
int totalTime = 0;
|
||||||
|
bool isEnd = true;
|
||||||
|
int lastTime = 0;
|
||||||
|
|
||||||
|
this->pMutex_->lock();
|
||||||
|
TimeoutList::iterator it = this->timeouts_.begin();
|
||||||
|
isEnd = (it == this->timeouts_.end());
|
||||||
|
|
||||||
|
if(!isEnd) totalTime += (*it)->getRelTicks();
|
||||||
|
|
||||||
|
while(!isEnd && (totalTime <= newTime)) {
|
||||||
|
isEnd = (++it == this->timeouts_.end());
|
||||||
|
lastTime = totalTime;
|
||||||
|
if(!isEnd) totalTime += (*it)->getRelTicks();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isEnd) (*it)->substractFromRelTicks(newTime-lastTime);
|
||||||
|
|
||||||
|
pNewTimeout->setRelTicks(newTime-lastTime);
|
||||||
|
this->timeouts_.insert(it, pNewTimeout);
|
||||||
|
|
||||||
|
this->pMutex_->unlock();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void XFTimeoutManager::returnTimeout(XFTimeout *pTimeout) {
|
||||||
|
this->pMutex_->lock();
|
||||||
|
XFDispatcher::getInstance()->pushEvent(pTimeout);
|
||||||
|
this->timeouts_.remove(pTimeout);
|
||||||
|
this->pMutex_->unlock();
|
||||||
|
}
|
||||||
|
|
||||||
void XFTimeoutManager::start(std::function<void (uint32_t)> startTimeoutManagerTimer) {
|
void XFTimeoutManager::start(std::function<void (uint32_t)> startTimeoutManagerTimer) {
|
||||||
startTimeoutManagerTimer(tickInterval_);
|
startTimeoutManagerTimer(this->tickInterval_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XFTimeoutManager::scheduleTimeout(int32_t timeoutId, int32_t interval, interface::XFBehavior *pBehavior) {
|
void XFTimeoutManager::scheduleTimeout(int32_t timeoutId, int32_t interval, interface::XFBehavior *pBehavior) {
|
||||||
::XFTimeout* timeout = new XFTimeout(timeoutId, interval, pBehavior);
|
::XFTimeout* timeout = new XFTimeout(timeoutId, interval, pBehavior);
|
||||||
timeouts_.push_front(timeout);
|
addTimeout(timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t timeoutIdComparison;
|
|
||||||
bool myPredicate(XFTimeout* timeout) {return (timeout->getId()==timeoutIdComparison);}
|
|
||||||
void XFTimeoutManager::unscheduleTimeout(int32_t timeoutId, interface::XFBehavior *pBehavior) {
|
void XFTimeoutManager::unscheduleTimeout(int32_t timeoutId, interface::XFBehavior *pBehavior) {
|
||||||
timeoutIdComparison = timeoutId;
|
this->pMutex_->lock();
|
||||||
timeouts_.remove_if(myPredicate);
|
TimeoutList::iterator it;
|
||||||
|
for(it = this->timeouts_.begin(); it != this->timeouts_.end(); it++){
|
||||||
|
|
||||||
|
if((*it)->getId()==timeoutId && (*it)->getBehavior() == pBehavior) {
|
||||||
|
it = this->timeouts_.erase(it);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
this->pMutex_->unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
void XFTimeoutManager::tick() {
|
||||||
|
|
||||||
|
bool isEmpty = this->timeouts_.empty();
|
||||||
|
int rTime;
|
||||||
|
|
||||||
|
if(!isEmpty) {
|
||||||
|
|
||||||
|
this->pMutex_->lock();
|
||||||
|
|
||||||
|
XFTimeout* timeout = this->timeouts_.front();
|
||||||
|
timeout->substractFromRelTicks(tickInterval_);
|
||||||
|
rTime = timeout->getRelTicks();
|
||||||
|
|
||||||
|
while (!isEmpty && (rTime <= 0) ) {
|
||||||
|
|
||||||
|
XFDispatcher::getInstance()->pushEvent(timeout);
|
||||||
|
this->timeouts_.pop_front();
|
||||||
|
|
||||||
|
timeout = this->timeouts_.front();
|
||||||
|
isEmpty = this->timeouts_.empty();
|
||||||
|
if(!isEmpty) rTime = timeout->getRelTicks();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
this->pMutex_->unlock();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // USE_XF_COMMON_TIMEOUTMANAGER_CLASS
|
#endif // USE_XF_COMMON_TIMEOUTMANAGER_CLASS
|
||||||
|
@ -7,23 +7,19 @@
|
|||||||
#include <QMutexLocker>
|
#include <QMutexLocker>
|
||||||
#include "eventqueue.h"
|
#include "eventqueue.h"
|
||||||
|
|
||||||
XFEventQueue::XFEventQueue()
|
XFEventQueue::XFEventQueue() {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XFEventQueue::~XFEventQueue()
|
XFEventQueue::~XFEventQueue() {
|
||||||
{
|
|
||||||
newEvents_.wakeAll();
|
newEvents_.wakeAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool XFEventQueue::empty() const
|
bool XFEventQueue::empty() const {
|
||||||
{
|
|
||||||
return queue_.isEmpty();
|
return queue_.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool XFEventQueue::push(const XFEvent * pEvent, bool fromISR)
|
bool XFEventQueue::push(const XFEvent * pEvent, bool fromISR) {
|
||||||
{
|
(void)fromISR; // Just for don't have the warning
|
||||||
(void)fromISR;
|
|
||||||
QMutexLocker locker(&mutex_);
|
QMutexLocker locker(&mutex_);
|
||||||
queue_.enqueue(pEvent);
|
queue_.enqueue(pEvent);
|
||||||
// Tell waiting thread(s) there is again an event present
|
// Tell waiting thread(s) there is again an event present
|
||||||
@ -31,19 +27,16 @@ bool XFEventQueue::push(const XFEvent * pEvent, bool fromISR)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const XFEvent * XFEventQueue::front()
|
const XFEvent * XFEventQueue::front() {
|
||||||
{
|
|
||||||
return queue_.front();
|
return queue_.front();
|
||||||
}
|
}
|
||||||
|
|
||||||
void XFEventQueue::pop()
|
void XFEventQueue::pop() {
|
||||||
{
|
|
||||||
QMutexLocker locker(&mutex_);
|
QMutexLocker locker(&mutex_);
|
||||||
queue_.dequeue();
|
queue_.dequeue();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool XFEventQueue::pend()
|
bool XFEventQueue::pend() {
|
||||||
{
|
|
||||||
QMutexLocker locker(&mutex_);
|
QMutexLocker locker(&mutex_);
|
||||||
// Wait for new events. Mutex needs to be in lock-state
|
// Wait for new events. Mutex needs to be in lock-state
|
||||||
// prior to call wait()!
|
// prior to call wait()!
|
||||||
|
@ -5,10 +5,40 @@
|
|||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include "eventqueue.h"
|
#include "eventqueue.h"
|
||||||
|
|
||||||
// TODO: Implement code for XFEventQueue class
|
// TODO done: Implement code for XFEventQueue class
|
||||||
|
|
||||||
bool XFEventQueue::pend()
|
XFEventQueue::XFEventQueue(){
|
||||||
{
|
|
||||||
|
}
|
||||||
|
|
||||||
|
XFEventQueue::~XFEventQueue(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool XFEventQueue::empty() const {
|
||||||
|
return queue_.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool XFEventQueue::push(const XFEvent *pEvent, bool fromISR) {
|
||||||
|
(void) fromISR;
|
||||||
|
mutex_.lock();
|
||||||
|
queue_.push(pEvent);
|
||||||
|
mutex_.unlock();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const XFEvent* XFEventQueue::front() {
|
||||||
|
return queue_.front();
|
||||||
|
}
|
||||||
|
|
||||||
|
void XFEventQueue::pop() {
|
||||||
|
mutex_.lock();
|
||||||
|
queue_.pop();
|
||||||
|
mutex_.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool XFEventQueue::pend() {
|
||||||
// Method cannot be used in an IDF! Waiting within
|
// Method cannot be used in an IDF! Waiting within
|
||||||
// this method would block the whole XF
|
// this method would block the whole XF
|
||||||
return false;
|
return false;
|
||||||
|
@ -8,11 +8,23 @@
|
|||||||
/**
|
/**
|
||||||
* @brief Implementation of interface::XFMutex::create method.
|
* @brief Implementation of interface::XFMutex::create method.
|
||||||
*/
|
*/
|
||||||
interface::XFMutex * interface::XFMutex::create()
|
interface::XFMutex * interface::XFMutex::create() {
|
||||||
{
|
|
||||||
return new ::XFMutex;
|
return new ::XFMutex;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Implement code for XFMutex class
|
void XFMutex::lock() {
|
||||||
|
enterCritical();
|
||||||
|
}
|
||||||
|
|
||||||
|
void XFMutex::unlock() {
|
||||||
|
exitCritical();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool XFMutex::tryLock(int32_t timeout) {
|
||||||
|
XFMutex::lock();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO done: Implement code for XFMutex class
|
||||||
|
|
||||||
#endif // USE_XF_IDF_STM32_MUTEX_CLASS
|
#endif // USE_XF_IDF_STM32_MUTEX_CLASS
|
||||||
|
@ -9,21 +9,47 @@
|
|||||||
|
|
||||||
using interface::XFTimeoutManager;
|
using interface::XFTimeoutManager;
|
||||||
|
|
||||||
void XF_initialize(int timeInterval)
|
void XF_initialize(int timeInterval) {
|
||||||
{
|
|
||||||
XF::initialize(timeInterval);
|
XF::initialize(timeInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XF_exec()
|
void XF_exec() {
|
||||||
{
|
|
||||||
XF::exec();
|
XF::exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void XF_execOnce()
|
void XF_execOnce() {
|
||||||
{
|
|
||||||
XF::execOnce();
|
XF::execOnce();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Implement code for XF class
|
// TODO: Implement code for XF class
|
||||||
|
|
||||||
|
bool XF::isInitialized_ = false;
|
||||||
|
bool XF::isRunning_ = false;
|
||||||
|
|
||||||
|
void XF::initialize(int timeInterval, int argc, char *argv[]){
|
||||||
|
|
||||||
|
if(!isInitialized_) {
|
||||||
|
interface::XFTimeoutManager::getInstance()->initialize(timeInterval);
|
||||||
|
|
||||||
|
isInitialized_ = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int XF::exec(){
|
||||||
|
int foo;
|
||||||
|
foo = interface::XFDispatcher::getInstance()->execute();
|
||||||
|
isRunning_ = true;
|
||||||
|
return foo;
|
||||||
|
}
|
||||||
|
|
||||||
|
int XF::execOnce() {
|
||||||
|
interface::XFDispatcher::getInstance()->executeOnce();
|
||||||
|
isRunning_ = true;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool XF::isRunning() {
|
||||||
|
return isRunning_;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // USE_XF_IDF_STM32_XF_CLASS
|
#endif // USE_XF_IDF_STM32_XF_CLASS
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
#define USE_XF_IDF_QT_EVENT_QUEUE_CLASS 1
|
#define USE_XF_IDF_QT_EVENT_QUEUE_CLASS 1
|
||||||
#define USE_XF_IDF_QT_MUTEX_CLASS 1
|
#define USE_XF_IDF_QT_MUTEX_CLASS 1
|
||||||
|
|
||||||
|
#define XF_TRACE_EVENT_PUSH_POP 1
|
||||||
|
|
||||||
#include "idf-qt/eventqueue.h"
|
#include "idf-qt/eventqueue.h"
|
||||||
#endif // PORT_IDF_QT
|
#endif // PORT_IDF_QT
|
||||||
|
|
||||||
|
BIN
test-bench/test1/ide-cubeide-test1-idf/result.png
Normal file
After Width: | Height: | Size: 37 KiB |
BIN
test-bench/test1/ide-qtcreator-test1-idf/result.PNG
Normal file
After Width: | Height: | Size: 15 KiB |
@ -1,261 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE QtCreatorProject>
|
|
||||||
<!-- Written by QtCreator 10.0.1, 2023-09-19T15:51:57. -->
|
|
||||||
<qtcreator>
|
|
||||||
<data>
|
|
||||||
<variable>EnvironmentId</variable>
|
|
||||||
<value type="QByteArray">{74b183cb-db41-45ea-a596-751d95cc40a2}</value>
|
|
||||||
</data>
|
|
||||||
<data>
|
|
||||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
|
||||||
<value type="qlonglong">0</value>
|
|
||||||
</data>
|
|
||||||
<data>
|
|
||||||
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
|
||||||
<valuemap type="QVariantMap">
|
|
||||||
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
|
|
||||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
|
|
||||||
<value type="QString" key="language">Cpp</value>
|
|
||||||
<valuemap type="QVariantMap" key="value">
|
|
||||||
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
|
|
||||||
</valuemap>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
|
|
||||||
<value type="QString" key="language">QmlJS</value>
|
|
||||||
<valuemap type="QVariantMap" key="value">
|
|
||||||
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
|
|
||||||
</valuemap>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="EditorConfiguration.CodeStyle.Count">2</value>
|
|
||||||
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
|
|
||||||
<value type="int" key="EditorConfiguration.IndentSize">4</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
|
|
||||||
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
|
|
||||||
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.PreferSingleLineComments">false</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
|
|
||||||
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
|
|
||||||
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
|
|
||||||
<value type="int" key="EditorConfiguration.TabSize">8</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.UseIndenter">false</value>
|
|
||||||
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
|
|
||||||
<value type="QString" key="EditorConfiguration.ignoreFileTypes">*.md, *.MD, Makefile</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.skipTrailingWhitespace">true</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.tintMarginArea">true</value>
|
|
||||||
</valuemap>
|
|
||||||
</data>
|
|
||||||
<data>
|
|
||||||
<variable>ProjectExplorer.Project.PluginSettings</variable>
|
|
||||||
<valuemap type="QVariantMap">
|
|
||||||
<valuemap type="QVariantMap" key="AutoTest.ActiveFrameworks">
|
|
||||||
<value type="bool" key="AutoTest.Framework.Boost">true</value>
|
|
||||||
<value type="bool" key="AutoTest.Framework.CTest">false</value>
|
|
||||||
<value type="bool" key="AutoTest.Framework.Catch">true</value>
|
|
||||||
<value type="bool" key="AutoTest.Framework.GTest">true</value>
|
|
||||||
<value type="bool" key="AutoTest.Framework.QtQuickTest">true</value>
|
|
||||||
<value type="bool" key="AutoTest.Framework.QtTest">true</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="AutoTest.CheckStates"/>
|
|
||||||
<value type="int" key="AutoTest.RunAfterBuild">0</value>
|
|
||||||
<value type="bool" key="AutoTest.UseGlobal">true</value>
|
|
||||||
<valuemap type="QVariantMap" key="ClangTools">
|
|
||||||
<value type="bool" key="ClangTools.AnalyzeOpenFiles">true</value>
|
|
||||||
<value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value>
|
|
||||||
<value type="QString" key="ClangTools.DiagnosticConfig">Builtin.DefaultTidyAndClazy</value>
|
|
||||||
<value type="int" key="ClangTools.ParallelJobs">4</value>
|
|
||||||
<valuelist type="QVariantList" key="ClangTools.SelectedDirs"/>
|
|
||||||
<valuelist type="QVariantList" key="ClangTools.SelectedFiles"/>
|
|
||||||
<valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
|
|
||||||
<value type="bool" key="ClangTools.UseGlobalSettings">true</value>
|
|
||||||
</valuemap>
|
|
||||||
</valuemap>
|
|
||||||
</data>
|
|
||||||
<data>
|
|
||||||
<variable>ProjectExplorer.Project.Target.0</variable>
|
|
||||||
<valuemap type="QVariantMap">
|
|
||||||
<value type="QString" key="DeviceType">Desktop</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 6.5.1 GCC 64bit</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 6.5.1 GCC 64bit</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt6.651.gcc_64_kit</value>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
|
||||||
<value type="int" key="EnableQmlDebugging">0</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/remi/GIT/XFlabo/test-bench/test1/build-test1-idf-Desktop_Qt_6_5_1_GCC_64bit-Debug</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/remi/GIT/XFlabo/test-bench/test1/build-test1-idf-Desktop_Qt_6_5_1_GCC_64bit-Debug</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
|
||||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Compiler</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Compiler</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Nettoyer</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Nettoyer</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/remi/GIT/XFlabo/test-bench/test1/build-test1-idf-Desktop_Qt_6_5_1_GCC_64bit-Release</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/remi/GIT/XFlabo/test-bench/test1/build-test1-idf-Desktop_Qt_6_5_1_GCC_64bit-Release</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
|
||||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Compiler</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Compiler</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Nettoyer</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Nettoyer</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
|
||||||
<value type="int" key="QtQuickCompiler">0</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
|
||||||
<value type="int" key="EnableQmlDebugging">0</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/remi/GIT/XFlabo/test-bench/test1/build-test1-idf-Desktop_Qt_6_5_1_GCC_64bit-Profile</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/remi/GIT/XFlabo/test-bench/test1/build-test1-idf-Desktop_Qt_6_5_1_GCC_64bit-Profile</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
|
||||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Compiler</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Compiler</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Nettoyer</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Nettoyer</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
|
||||||
<value type="int" key="QtQuickCompiler">0</value>
|
|
||||||
<value type="int" key="SeparateDebugInfo">0</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Déploiement</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Déploiement</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
|
|
||||||
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
|
||||||
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
|
|
||||||
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
|
|
||||||
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
|
||||||
<valuelist type="QVariantList" key="CustomOutputParsers"/>
|
|
||||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
|
||||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
|
||||||
</valuemap>
|
|
||||||
</data>
|
|
||||||
<data>
|
|
||||||
<variable>ProjectExplorer.Project.TargetCount</variable>
|
|
||||||
<value type="qlonglong">1</value>
|
|
||||||
</data>
|
|
||||||
<data>
|
|
||||||
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
|
||||||
<value type="int">22</value>
|
|
||||||
</data>
|
|
||||||
<data>
|
|
||||||
<variable>Version</variable>
|
|
||||||
<value type="int">22</value>
|
|
||||||
</data>
|
|
||||||
</qtcreator>
|
|
@ -10,26 +10,21 @@
|
|||||||
*/
|
*/
|
||||||
StateMachine01::StateMachine01(int repeatInterval, string text)
|
StateMachine01::StateMachine01(int repeatInterval, string text)
|
||||||
: repeatInterval_(repeatInterval),
|
: repeatInterval_(repeatInterval),
|
||||||
text_(text)
|
text_(text) {
|
||||||
{
|
|
||||||
currentState_ = STATE_INITIAL;
|
currentState_ = STATE_INITIAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
StateMachine01::~StateMachine01()
|
StateMachine01::~StateMachine01() {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XFEventStatus StateMachine01::processEvent()
|
XFEventStatus StateMachine01::processEvent() {
|
||||||
{
|
|
||||||
eEventStatus eventStatus = XFEventStatus::Unknown;
|
eEventStatus eventStatus = XFEventStatus::Unknown;
|
||||||
|
|
||||||
switch (currentState_)
|
switch (currentState_) {
|
||||||
{
|
|
||||||
case STATE_INITIAL:
|
case STATE_INITIAL:
|
||||||
{
|
{
|
||||||
if (getCurrentEvent()->getEventType() == XFEvent::Initial)
|
if (getCurrentEvent()->getEventType() == XFEvent::Initial) {
|
||||||
{
|
|
||||||
GEN(XFDefaultTransition());
|
GEN(XFDefaultTransition());
|
||||||
|
|
||||||
currentState_ = STATE_SAY_HELLO;
|
currentState_ = STATE_SAY_HELLO;
|
||||||
|
@ -2,31 +2,26 @@
|
|||||||
#include "trace/trace.h"
|
#include "trace/trace.h"
|
||||||
#include "testfactory01.h"
|
#include "testfactory01.h"
|
||||||
|
|
||||||
void Factory_initialize()
|
void Factory_initialize() {
|
||||||
{
|
|
||||||
TestFactory01::initialize();
|
TestFactory01::initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Factory_build()
|
void Factory_build() {
|
||||||
{
|
|
||||||
TestFactory01::build();
|
TestFactory01::build();
|
||||||
}
|
}
|
||||||
|
|
||||||
StateMachine01 TestFactory01::task01_(1000, "Say Hello");
|
StateMachine01 TestFactory01::task01_(1000, "Say Hello");
|
||||||
StateMachine01 TestFactory01::task02_(500, "Echo");
|
StateMachine01 TestFactory01::task02_(500, "Echo");
|
||||||
|
|
||||||
TestFactory01::TestFactory01()
|
TestFactory01::TestFactory01() {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void TestFactory01::initialize()
|
void TestFactory01::initialize() {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void TestFactory01::build()
|
void TestFactory01::build() {
|
||||||
{
|
|
||||||
Trace::out("Starting test1...");
|
Trace::out("Starting test1...");
|
||||||
Trace::out("---------------------");
|
Trace::out("---------------------");
|
||||||
|
|
||||||
|
BIN
test-bench/test2/ide-cubeide-test2-idf/result.png
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
test-bench/test2/ide-qtcreator-test2-idf/result.PNG
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
test-bench/test3/ide-cubeide-test3-idf/result.png
Normal file
After Width: | Height: | Size: 36 KiB |
BIN
test-bench/test3/ide-qtcreator-test3-idf/result.PNG
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
test-bench/test4/ide-cubeide-test4-idf/result.png
Normal file
After Width: | Height: | Size: 38 KiB |
BIN
test-bench/test4/ide-qtcreator-test4-idf/result.PNG
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
test-bench/test5/ide-cubeide-test5-idf/result.png
Normal file
After Width: | Height: | Size: 35 KiB |
BIN
test-bench/test5/ide-qtcreator-test5-idf/result.PNG
Normal file
After Width: | Height: | Size: 20 KiB |