8 #define DEBUG_PRINT(...)
16 return sizeof(m_buff);
38 DEBUG_PRINT(
"ActiveComponent %s destructor.\n",this->getObjName());
45 #if FW_OBJECT_TO_STRING == 1 && FW_OBJECT_NAMES == 1
46 void ActiveComponentBase::toString(
char* buffer,
NATIVE_INT_TYPE size) {
49 PlatformIntType status = snprintf(buffer,
static_cast<size_t>(size),
"ActComp: %s", this->m_objName.toChar());
59 #if FW_OBJECT_NAMES == 1
60 taskName = this->getObjName();
64 taskName = taskNameChar;
78 (void)this->
m_queue.
send(exitBuff,0,Os::Queue::BlockingType::NONBLOCKING);
91 void ActiveComponentBase::s_taskStateMachine(
void* component_pointer) {
99 switch (component->m_stage) {
102 case Lifecycle::CREATED:
103 component->preamble();
104 component->m_stage = Lifecycle::DISPATCHING;
108 case Lifecycle::DISPATCHING:
109 if (component->dispatch() == MsgDispatchStatus::MSG_DISPATCH_EXIT) {
110 component->m_stage = Lifecycle::FINALIZING;
115 case Lifecycle::FINALIZING:
116 component->finalizer();
117 component->m_stage = Lifecycle::DONE;
120 case Lifecycle::DONE:
128 void ActiveComponentBase::s_taskLoop(
void* component_pointer) {
133 while (component->m_stage != ActiveComponentBase::Lifecycle::DONE) {
134 ActiveComponentBase::s_taskStateMachine(component);
141 return MsgDispatchStatus::MSG_DISPATCH_EMPTY;
PlatformIntType NATIVE_INT_TYPE
uint8_t U8
8-bit unsigned integer
PlatformUIntType NATIVE_UINT_TYPE
unsigned int PlatformUIntType
int PlatformIntType
DefaultTypes.hpp provides fallback defaults for the platform types.
#define FW_TASK_NAME_BUFFER_SIZE
Max size of task name.
C++-compatible configuration header for fprime configuration.
Os::Task::Status join()
Join the thread.
@ ACTIVE_COMPONENT_EXIT
message to exit active component task
Os::Task m_task
task object for active component
ActiveComponentBase(const char *name)
Constructor.
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
void exit()
exit task in active component
virtual ~ActiveComponentBase()
Destructor.
MsgDispatchStatus dispatch()
The function that will dispatching messages.
virtual void finalizer()
A function that will be called after exiting the loop.
virtual void preamble()
A function that will be called before the event loop is entered.
const U8 * getBuffAddr() const
gets buffer address for data reading, const version
NATIVE_UINT_TYPE getBuffCapacity() const
returns capacity, not current size, of buffer
U8 * getBuffAddr()
gets buffer address for data filling
void init()
Object initializer.
virtual MsgDispatchStatus doDispatch()=0
method to dispatch a single message in the queue.
Os::Queue m_queue
queue object for active component
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
Status send(const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override
send a message into the queue through delegate
FwSizeType getMessagesAvailable() const override
get number of messages available
static FwSizeType getNumTasks()
get the current number of tasks
bool isCooperative() override
determine if the task is cooperative multitasking (implementation specific)
FwSizeType ParamType
backwards-compatible parameter type
Status start(const Arguments &arguments) override
start the task
Status join() override
block until the task has ended
void(* taskRoutine)(void *ptr)
Prototype for task routine started in task context.
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.
@ OP_OK
Operation succeeded.