24 #if FW_OBJECT_TO_STRING == 1 25 const char* ActiveComponentBase::getToStringFormatString() {
36 #if FW_OBJECT_NAMES == 1 37 taskName = this->getObjName();
44 Os::Task::Arguments arguments(taskName, routine,
this, priority, stackSize, cpuAffinity, identifier);
53 (void)this->
m_queue.
send(exitBuff, 0, Os::Queue::BlockingType::NONBLOCKING);
64 void ActiveComponentBase::s_taskStateMachine(
void* component_pointer) {
72 switch (component->m_stage) {
75 case Lifecycle::CREATED:
76 component->preamble();
77 component->m_stage = Lifecycle::DISPATCHING;
81 case Lifecycle::DISPATCHING:
82 if (component->dispatch() == MsgDispatchStatus::MSG_DISPATCH_EXIT) {
83 component->m_stage = Lifecycle::FINALIZING;
88 case Lifecycle::FINALIZING:
89 component->finalizer();
90 component->m_stage = Lifecycle::DONE;
101 void ActiveComponentBase::s_taskLoop(
void* component_pointer) {
107 while (component->m_stage != ActiveComponentBase::Lifecycle::DONE) {
108 ActiveComponentBase::s_taskStateMachine(component);
115 return MsgDispatchStatus::MSG_DISPATCH_EMPTY;
Serialization/Deserialization operation was successful.
PlatformTaskIdType FwTaskIdType
The type of task priorities used.
Lifecycle
Tracks the lifecycle of the component.
Os::Task m_task
task object for active component
PlatformSizeType FwSizeType
ActiveComponentExitSerializableBuffer()
message to exit active component task
Status start(const Arguments &arguments) override
start the task
void exit()
exit task in active component
virtual MsgDispatchStatus doDispatch()=0
method to dispatch a single message in the queue.
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
Os::Queue m_queue
queue object for active component
void init()
Object initializer.
SerializeStatus
forward declaration for string
bool isCooperative() override
determine if the task is cooperative multitasking (implementation specific)
virtual void finalizer()
A function that will be called after exiting the loop.
ActiveComponentBase(const char *name)
Constructor.
Status join() override
block until the task has ended
static FwSizeType getNumTasks()
get the current number of tasks
Status send(const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override
send a message into the queue through delegate
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
PlatformTaskPriorityType FwTaskPriorityType
The type of task priorities used.
virtual void preamble()
A function that will be called before the event loop is entered.
uint8_t U8
8-bit unsigned integer
FwSizeType getMessagesAvailable() const override
get number of messages available
MsgDispatchStatus dispatch()
The function that will dispatching messages.
virtual ~ActiveComponentBase()
Destructor.
Os::Task::Status join()
Join the thread.
void start(FwTaskPriorityType priority=Os::Task::TASK_PRIORITY_DEFAULT, FwSizeType stackSize=Os::Task::TASK_DEFAULT, FwSizeType cpuAffinity=Os::Task::TASK_DEFAULT, FwTaskIdType identifier=static_cast< FwTaskIdType >(Os::Task::TASK_DEFAULT))
called by instantiator when task is to be started
Implementation of malloc based allocator.
void(* taskRoutine)(void *ptr)
Prototype for task routine started in task context.