Class HsmEventDispatcherFreeRTOS
Defined in File HsmEventDispatcherFreeRTOS.hpp
Public Member Functions
virtual void | emitEvent (const HandlerID_t handlerID) |
See IHsmEventDispatcher::emitEvent() | |
virtual bool | start () |
See IHsmEventDispatcher::start() | |
virtual void | stop () |
Stop dispatching events. | |
void | join () |
Blocks current thread until dispatcher is stopped. | |
static std::shared_ptr<HsmEventDispatcherFreeRTOS> | create (const configSTACK_DEPTH_TYPE stackDepth = configMINIMAL_STACK_SIZE, const UBaseType_t priority = tskIDLE_PRIORITY, const size_t eventsCacheSize = (10)) |
Create dispatcher instance. | |
Inheritance Relationships
Base Type
public hsmcpp::HsmEventDispatcherBase
(Class HsmEventDispatcherBase)
Class Documentation
-
class HsmEventDispatcherFreeRTOS : public hsmcpp::HsmEventDispatcherBase
HsmEventDispatcherFreeRTOS provides dispatcher implementation for FreeRTOS platform.
Events dispatching is done using a custom Task. See HsmEventDispatcherFreeRTOS for details.
Warning
Dispatcher methods should be called only from Tasks. Dispatcher instance should never be deleted from an ISR.
Public Functions
-
virtual void emitEvent(const HandlerID_t handlerID) override
See IHsmEventDispatcher::emitEvent()
Concurrency
- thread-safe
Only for systems with single core CPU
-
virtual bool start() override
See IHsmEventDispatcher::start()
Not Thread Safe
Thread safety is not required by HierarchicalStateMachine::initialize() which uses this API.
-
virtual void stop()
Stop dispatching events.
Future calls to dispatchEvents() will have no effect.
Wakes up dispatcher Task and instructs it to stop. Has no effect if Task is not running.
Remark
Operation is performed asynchronously. It does not interrupt currently handled event, but will cancel all other pending events.
Public Static Functions
-
static std::shared_ptr<HsmEventDispatcherFreeRTOS> create(const configSTACK_DEPTH_TYPE stackDepth = configMINIMAL_STACK_SIZE, const UBaseType_t priority = tskIDLE_PRIORITY, const size_t eventsCacheSize = (10))
Create dispatcher instance.
- Parameters
stackDepth – The number of words (not bytes!) to allocate for use as the task’s stack. For example, if the stack is 16-bits wide and usStackDepth is 100, then 200 bytes will be allocated for use as the task’s stack. As another example, if the stack is 32-bits wide and usStackDepth is 400 then 1600 bytes will be allocated for use as the task’s stack. The stack depth multiplied by the stack width must not exceed the maximum value that can be contained in a variable of type size_t.
priority – The priority at which the created task will execute. Systems that include MPU support can optionally create a task in a privileged (system) mode by setting the bit portPRIVILEGE_BIT in uxPriority. For example, to create a privileged task at priority 2 set uxPriority to ( 2 | portPRIVILEGE_BIT ). Priorities are asserted to be less than configMAX_PRIORITIES. If configASSERT is undefined, priorities are silently capped at (configMAX_PRIORITIES - 1).
eventsCacheSize – size of the queue preallocated for delayed events
- Returns
New dispatcher instance.
-
virtual void emitEvent(const HandlerID_t handlerID) override