|
|
|
|
|
## Post events
|
|
## Post Events
|
|
|
|
|
|
Two types of events can be posted: "standard" events are posted at the moment of the function call, while delayed events are posted after a specified amount of time.
|
|
Two types of events can be posted: _"normal" events_ are posted at the moment of the function call, while _delayed events_ are posted after a specified amount of time.
|
|
|
|
|
|
### Standard events
|
|
#### Normal Events
|
|
|
|
|
|
To post a "standard" event the following code is used:
|
|
To post a "normal" event the following code is used:
|
|
```cpp
|
|
```cpp
|
|
// Include the event broker
|
|
// Include the event broker
|
|
#include <events/EventBroker.h>
|
|
#include <events/EventBroker.h>
|
... | @@ -23,7 +23,7 @@ void someFunction() |
... | @@ -23,7 +23,7 @@ void someFunction() |
|
}
|
|
}
|
|
```
|
|
```
|
|
|
|
|
|
### Delayed events
|
|
#### Delayed Events
|
|
|
|
|
|
The delayed events are posted in a very similar way:
|
|
The delayed events are posted in a very similar way:
|
|
```cpp
|
|
```cpp
|
... | @@ -124,7 +124,8 @@ void someFunction() |
... | @@ -124,7 +124,8 @@ void someFunction() |
|
## Troubleshooting
|
|
## Troubleshooting
|
|
|
|
|
|
Check all the following points before beating your head against the wall :)
|
|
Check all the following points before beating your head against the wall :)
|
|
- Call the `.start()` method on all the `FSM` subclasses used and on `sEventBroker`:
|
|
- Do not post events with payload: the current [EventBroker](EventBroker) implementation does not support them.
|
|
|
|
- Call the `.start()` method on all the [EventHandler](EventHandler), [FSM](FSM) or [HSM](HSM) subclasses used and on `sEventBroker`:
|
|
|
|
|
|
```cpp
|
|
```cpp
|
|
#include <events/EventBroker.h>
|
|
#include <events/EventBroker.h>
|
... | @@ -137,4 +138,3 @@ int main() |
... | @@ -137,4 +138,3 @@ int main() |
|
ada.start();
|
|
ada.start();
|
|
}
|
|
}
|
|
``` |
|
``` |
|
- Don't post events with payload using `postDelayed`(see warning above) |
|
|