12 return sizeof(m_buff);
40 #if FW_OBJECT_TO_STRING == 1 41 const char* ActiveComponentBase::getToStringFormatString() {
49 #if FW_OBJECT_NAMES == 1 50 taskName = this->getObjName();
57 Os::Task::Arguments arguments(taskName, routine,
this, priority, stackSize, cpuAffinity, static_cast<PlatformUIntType>(identifier));
66 (void)this->
m_queue.
send(exitBuff,0,Os::Queue::BlockingType::NONBLOCKING);
77 void ActiveComponentBase::s_taskStateMachine(
void* component_pointer) {
85 switch (component->m_stage) {
88 case Lifecycle::CREATED:
89 component->preamble();
90 component->m_stage = Lifecycle::DISPATCHING;
94 case Lifecycle::DISPATCHING:
95 if (component->dispatch() == MsgDispatchStatus::MSG_DISPATCH_EXIT) {
96 component->m_stage = Lifecycle::FINALIZING;
101 case Lifecycle::FINALIZING:
102 component->finalizer();
103 component->m_stage = Lifecycle::DONE;
106 case Lifecycle::DONE:
114 void ActiveComponentBase::s_taskLoop(
void* component_pointer) {
119 while (component->m_stage != ActiveComponentBase::Lifecycle::DONE) {
120 ActiveComponentBase::s_taskStateMachine(component);
127 return MsgDispatchStatus::MSG_DISPATCH_EMPTY;
Serialization/Deserialization operation was successful.
Os::Task m_task
task object for active component
PlatformSizeType FwSizeType
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
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.
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
message to exit active component task
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 ParamType
backwards-compatible parameter type
FwSizeType getMessagesAvailable() const override
get number of messages available
MsgDispatchStatus dispatch()
The function that will dispatching messages.
void start(FwTaskPriorityType priority=Os::Task::TASK_PRIORITY_DEFAULT, Os::Task::ParamType stackSize=Os::Task::TASK_DEFAULT, Os::Task::ParamType cpuAffinity=Os::Task::TASK_DEFAULT, Os::Task::ParamType identifier=Os::Task::TASK_DEFAULT)
called by instantiator when task is to be started
virtual ~ActiveComponentBase()
Destructor.
Os::Task::Status join()
Join the thread.
U8 * getBuffAddr()
gets buffer address for data filling
FwSizeType getBuffCapacity() const
returns capacity, not current size, of buffer
const U8 * getBuffAddr() const
gets buffer address for data reading, const version
void(* taskRoutine)(void *ptr)
Prototype for task routine started in task context.