29 this->m_flushTimeout = flushTimeout;
34 const Fw::Success started = this->startRecordingInternal(packetsPerContainer, priority);
38 this->m_enabled =
false;
52 if (!this->m_enabled) {
57 this->m_schedCallsSinceLastPacket = 0;
60 if ((this->m_currentPacketCount == 0) && (this->allocateAndSetupContainer() !=
Fw::Success::SUCCESS)) {
69 this->serializePacket(dataPtr, dataSize);
72 ++this->m_currentPacketCount;
73 ++this->m_numBuffersLogged;
76 if (this->m_currentPacketCount >= this->m_packetsPerContainer) {
77 this->finalizeContainer();
81 void ComLoggerDp ::pingIn_handler(
FwIndexType portNum, U32 key) {
86 void ComLoggerDp ::schedIn_handler(
FwIndexType portNum, U32 context) {
94 if (this->m_enabled && this->m_currentPacketCount > 0 && this->m_flushTimeout > 0) {
95 ++this->m_schedCallsSinceLastPacket;
97 if (this->m_schedCallsSinceLastPacket >= this->m_flushTimeout) {
99 this->finalizeContainer();
100 this->m_schedCallsSinceLastPacket = 0;
111 void ComLoggerDp ::startRecordingIn_handler(
FwIndexType portNum,
118 const Fw::Success success = this->startRecordingInternal(packetsPerContainer, priority);
126 void ComLoggerDp ::stopRecordingIn_handler(
FwIndexType portNum) {
131 (void)this->stopRecordingInternal();
141 constexpr
FwSizeType MAX_PACKETS_PER_CONTAINER =
143 if ((packetsPerContainer == 0) || (packetsPerContainer > MAX_PACKETS_PER_CONTAINER)) {
145 (void)this->sendContainerIfNonEmpty();
146 this->m_enabled =
false;
151 (void)this->sendContainerIfNonEmpty();
154 this->m_packetsPerContainer = packetsPerContainer;
155 this->m_priority = priority;
158 this->m_schedCallsSinceLastPacket = 0;
161 this->m_enabled =
true;
169 ComLoggerDp_PartialContainerStatus ComLoggerDp ::stopRecordingInternal() {
171 const ComLoggerDp_PartialContainerStatus partialContainer = this->sendContainerIfNonEmpty();
174 this->m_enabled =
false;
177 this->m_schedCallsSinceLastPacket = 0;
182 return partialContainer;
185 void ComLoggerDp ::handleBufferDrop(U32 size) {
187 ++this->m_numBuffersDropped;
190 Fw::Success ComLoggerDp ::allocateAndSetupContainer() {
201 this->handleBufferDrop(static_cast<U32>(containerSize));
210 void ComLoggerDp ::serializePacket(
const U8* dataPtr,
FwSizeType dataSize) {
214 const FwSizeType totalSize = sentrySize + dataSize;
230 ComLoggerDp_PartialContainerStatus ComLoggerDp ::sendContainerIfNonEmpty() {
233 if (this->m_enabled && this->m_currentPacketCount > 0) {
234 this->
dpSend(this->m_container);
236 this->m_currentPacketCount = 0;
242 void ComLoggerDp ::finalizeContainer() {
244 (void)this->sendContainerIfNonEmpty();
251 void ComLoggerDp ::StartComDp_cmdHandler(
FwOpcodeType opCode,
256 const Fw::Success success = this->startRecordingInternal(packetsPerContainer, priority);
270 this->m_priority = priority;
273 if (this->m_enabled && (this->m_currentPacketCount > 0)) {
283 void ComLoggerDp ::StopComDp_cmdHandler(
FwOpcodeType opCode, U32 cmdSeq) {
285 (void)this->stopRecordingInternal();
291 void ComLoggerDp ::CLEAR_COUNTERS_cmdHandler(
FwOpcodeType opCode, U32 cmdSeq) {
293 this->m_numBuffersLogged = 0;
296 this->m_numBuffersDropped = 0;
Serialization/Deserialization operation was successful.
FwIdType FwOpcodeType
The type of a command opcode.
PlatformSizeType FwSizeType
Fw::Success::T dpGet_ComBuffContainer(FwSizeType dataSize, DpContainer &container)
U32 FwDpPriorityType
The type of a data product priority.
void dpSend(DpContainer &container, Fw::Time timeTag=Fw::ZERO_TIME)
Send a data product.
void configure(bool enabled, FwSizeType packetsPerContainer, FwDpPriorityType priority, U32 flushTimeout)
static constexpr FwSizeType MIN_PACKET_SIZE
Serializable::SizeType getSize() const override
Get current buffer size.
void log_ACTIVITY_LO_CountersCleared() const
void tlmWrite_NumBuffersDropped(U32 arg, Fw::Time _tlmTime=Fw::Time()) const
A partial container was sent.
ComLoggerDp(const char *const compName)
Construct ComLoggerDp object.
SerializeStatus
forward declaration for string
void log_WARNING_HI_DpBufferError(U32 size)
Log event DpBufferError.
Auto-generated base for ComLoggerDp component.
~ComLoggerDp()
Destroy ComLoggerDp object.
FwSizeType getNumMsgsDropped()
return number of messages dropped
U8 * getBuffAddr()
Get buffer address for data filling (non-const version)
Omit length from serialization.
void log_ACTIVITY_LO_PriorityUpdated(FwDpPriorityType priority) const
External serialize buffer with no copy semantics.
Fw::SerializeStatus serializeRecord_ComBufferRecord(const U8 *array, FwSizeType size)
void pingOut_out(FwIndexType portNum, U32 key) const
Invoke output port pingOut.
Command successfully executed.
uint8_t U8
8-bit unsigned integer
constexpr U32 ComLoggerDpSentry
void log_WARNING_LO_StartRecordingFailed(FwSizeType packetsPerContainer) const
PlatformIndexType FwIndexType
Command failed validation.
RateGroupDivider component implementation.
No partial container was pending.
void tlmWrite_NumQueueDrops(U32 arg, Fw::Time _tlmTime=Fw::Time()) const
void log_ACTIVITY_HI_ComDpStarted(FwSizeType packetsPerContainer) const
void log_ACTIVITY_HI_ComDpStopped(const Svc::ComLoggerDp_PartialContainerStatus &partialContainer) const
void log_WARNING_HI_DpBufferError_ThrottleClear()
Reset throttle value for DpBufferError.
void setPriority(FwDpPriorityType priority)
Set the priority.
void tlmWrite_NumBuffersLogged(U32 arg, Fw::Time _tlmTime=Fw::Time()) const
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
void tlmWrite_LoggingEnabled(bool arg, Fw::Time _tlmTime=Fw::Time()) const
static constexpr FwSizeType RECORD_SIZE
Serialized size of one ComBufferRecord holding MAX_RECORD_DATA_SIZE bytes.