29 #if FW_OBJECT_TO_STRING == 1 30 const char* ActiveComponentBase::getToStringFormatString() {
41 #if FW_OBJECT_NAMES == 1 42 taskName = this->getObjName();
49 Os::Task::Arguments arguments(taskName, routine,
this, priority, stackSize, cpuAffinity, identifier);
58 (void)this->
m_queue.
send(exitBuff, 0, Os::Queue::BlockingType::NONBLOCKING);
69 void ActiveComponentBase::s_taskStateMachine(
void* component_pointer) {
77 switch (component->m_stage) {
80 case Lifecycle::CREATED:
81 component->preamble();
82 component->m_stage = Lifecycle::DISPATCHING;
86 case Lifecycle::DISPATCHING:
87 if (component->dispatch() == MsgDispatchStatus::MSG_DISPATCH_EXIT) {
88 component->m_stage = Lifecycle::FINALIZING;
93 case Lifecycle::FINALIZING:
94 component->finalizer();
95 component->m_stage = Lifecycle::DONE;
106 void ActiveComponentBase::s_taskLoop(
void* component_pointer) {
111 while (component->m_stage != ActiveComponentBase::Lifecycle::DONE) {
112 ActiveComponentBase::s_taskStateMachine(component);
119 return MsgDispatchStatus::MSG_DISPATCH_EMPTY;
Serialization/Deserialization operation was successful.
PlatformTaskIdType FwTaskIdType
The type of task priorities used.
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
Os::Task m_task
task object for active component
PlatformSizeType FwSizeType
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.
FwSizeType getCapacity() const
Get buffer capacity.
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
DEPRECATED(FwSizeType getBuffCapacity() const, "Use getCapacity() instead")
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.
U8 * getBuffAddr()
Get buffer address for data filling (non-const version)
message to exit active component task
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.
const U8 * getBuffAddr() const
Get buffer address for data reading (const version)
void(* taskRoutine)(void *ptr)
Prototype for task routine started in task context.