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;
PlatformUIntType NATIVE_UINT_TYPE
Serialization/Deserialization operation was successful.
Os::Task m_task
task object for active component
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
PlatformIntType NATIVE_INT_TYPE
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.
NATIVE_UINT_TYPE getBuffCapacity() const
returns capacity, not current size, of buffer
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
C++-compatible configuration header for fprime configuration.
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
void start(Os::Task::ParamType priority=Os::Task::TASK_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
MsgDispatchStatus dispatch()
The function that will dispatching messages.
virtual ~ActiveComponentBase()
Destructor.
message to exit active component task
Os::Task::Status join()
Join the thread.
U8 * getBuffAddr()
gets buffer address for data filling
const U8 * getBuffAddr() const
gets buffer address for data reading, const version
void(* taskRoutine)(void *ptr)
Prototype for task routine started in task context.