With *event handler* here we mean anything that can continuously read from an event queue and process the received events.
With _event handler_ here we mean anything that can continuously read from an event queue and process the received events.
## EventHandlerBase
...
...
@@ -22,8 +22,8 @@ In fact an EventHandler is a special ActiveObject that periodically checks a syn
### Methods
EventHadler offers two main methods:
-**virtual void postEvent(const Event& ev)**: overridden from EventHandlerBase, it enqueues the event passed as a parameters.
-**virtual void handleEvent(const Event& ev)**: protected method that is periodically called in the active objects thread. In fact in the *run()* method, whenever an event is present in the queue, it gets removed and the *handleEvent* method is called. The *handleEvent* method has to be overridden and implemented by any class that extends EventHandler.
-**virtual void handleEvent(const Event& ev)**: protected method that is periodically called in the active objects thread. In fact in the _run()_ method, whenever an event is present in the queue, it gets removed and the _handleEvent_ method is called. The _handleEvent_ method has to be overridden and implemented by any class that extends EventHandler.
You can find the complete implementation of EventHandler in `src/shared/events/EventHandler.h`.
### Example
...
...
@@ -45,7 +45,7 @@ enum ExampleEvents : uint8_t
};
```
Then, we can define a class that extends EventHandler.
We need at least to override the *handleEvent()* method, which processes incoming events.
We need at least to override the _handleEvent()_ method, which processes incoming events.
In this example we simply produce some output strings and keep track of the last event that has been recevied.