30 m_bufferMemory(nullptr),
33 m_waitForBuffer(false),
53 this->m_allocatorId = identifier;
55 bool recoverable =
false;
56 this->m_bufferMemory =
static_cast<Fw::Buffer*
>(
59 m_bufferQueue.init(this->m_bufferMemory, maxNumBuffers);
70 void BufferAccumulator ::bufferSendInFill_handler(
const NATIVE_INT_TYPE portNum,
73 const bool status = this->m_bufferQueue.enqueue(buffer);
75 if (this->m_numWarnings > 0) {
78 this->m_numWarnings = 0;
80 if (this->m_numWarnings == 0) {
86 this->sendStoredBuffer();
92 void BufferAccumulator ::bufferSendInReturn_handler(
96 this->m_waitForBuffer =
false;
98 (this->m_numDrained < this->m_numToDrain)) {
101 this->sendStoredBuffer();
114 void BufferAccumulator ::BA_SetMode_cmdHandler(
const FwOpcodeType opCode,
116 BufferAccumulator_OpState mode) {
119 if (this->m_numToDrain > 0) {
121 this->m_numToDrain = 0;
122 this->m_numDrained = 0;
129 if (!this->m_waitForBuffer) {
131 this->sendStoredBuffer();
134 this->m_send =
false;
139 void BufferAccumulator ::BA_DrainBuffers_cmdHandler(
140 const FwOpcodeType opCode,
const U32 cmdSeq, U32 numToDrain,
141 BufferAccumulator_BlockMode blockMode) {
143 if (this->m_numDrained < this->m_numToDrain) {
155 if (numToDrain == 0) {
161 this->m_opCode = opCode;
162 this->m_cmdSeq = cmdSeq;
163 this->m_numDrained = 0;
164 this->m_numToDrain = numToDrain;
167 U32 numBuffers = this->m_bufferQueue.getSize();
169 if (numBuffers < numToDrain) {
170 this->m_numToDrain = numBuffers;
177 if (0 == this->m_numToDrain) {
185 if (!this->m_waitForBuffer) {
187 this->sendStoredBuffer();
195 void BufferAccumulator ::sendStoredBuffer() {
199 if ((this->m_numToDrain == 0) ||
200 (this->m_numDrained < this->m_numToDrain)) {
202 const bool status = this->m_bufferQueue.dequeue(buffer);
204 this->m_numDrained++;
206 this->m_waitForBuffer =
true;
207 this->m_send =
false;
208 }
else if (this->m_numToDrain > 0) {
217 if ((this->m_numToDrain > 0) &&
218 (this->m_numDrained == this->m_numToDrain)) {
222 this->m_numToDrain = 0;
223 this->m_numDrained = 0;
224 this->m_send =
false;
PlatformIntType NATIVE_INT_TYPE
PlatformUIntType NATIVE_UINT_TYPE
C++ header for working with basic fprime types.
@ VALIDATION_ERROR
Command failed validation.
@ OK
Command successfully executed.
virtual void deallocate(const NATIVE_UINT_TYPE identifier, void *ptr)=0
Deallocate memory.
virtual void * allocate(const NATIVE_UINT_TYPE identifier, NATIVE_UINT_TYPE &size, bool &recoverable)=0
Allocate memory.
Auto-generated base for BufferAccumulator component.
void bufferSendOutReturn_out(FwIndexType portNum, Fw::Buffer &fwBuffer)
Invoke output port bufferSendOutReturn.
void log_WARNING_HI_BA_StillDraining(U32 numDrained, U32 numToDrain)
void log_ACTIVITY_HI_BA_PartialDrainDone(U32 numDrained)
void log_ACTIVITY_HI_BA_BufferAccepted()
void log_WARNING_HI_BA_QueueFull()
void bufferSendOutDrain_out(FwIndexType portNum, Fw::Buffer &fwBuffer)
Invoke output port bufferSendOutDrain.
void log_WARNING_HI_BA_AlreadyDraining()
void log_WARNING_LO_BA_NonBlockDrain(U32 numWillDrain, U32 numReqDrain)
void log_WARNING_HI_BA_DrainStalled(U32 numDrained, U32 numToDrain)
void pingOut_out(FwIndexType portNum, U32 key)
Invoke output port pingOut.
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
void tlmWrite_BA_NumQueuedBuffers(U32 arg, Fw::Time _tlmTime=Fw::Time())
void allocateQueue(NATIVE_INT_TYPE identifier, Fw::MemAllocator &allocator, NATIVE_UINT_TYPE maxNumBuffers)
void deallocateQueue(Fw::MemAllocator &allocator)
Return allocated queue. Should be done during shutdown.
BufferAccumulator(const char *const compName)