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) {
90 bool expected =
false;
91 if (this->m_schedInQueued.compare_exchange_strong(expected,
true)) {
96 void ComLoggerDp ::schedInInternal_overflowHook() {
97 this->m_schedInQueued =
false;
100 void ComLoggerDp ::schedInInternal_internalInterfaceHandler() {
101 this->m_schedInQueued =
false;
106 if (this->m_enabled && this->m_currentPacketCount > 0 && this->m_flushTimeout > 0) {
107 ++this->m_schedCallsSinceLastPacket;
109 if (this->m_schedCallsSinceLastPacket >= this->m_flushTimeout) {
111 this->finalizeContainer();
112 this->m_schedCallsSinceLastPacket = 0;
123 void ComLoggerDp ::startRecordingIn_handler(
FwIndexType portNum,
130 const Fw::Success success = this->startRecordingInternal(packetsPerContainer, priority);
138 void ComLoggerDp ::stopRecordingIn_handler(
FwIndexType portNum) {
143 (void)this->stopRecordingInternal();
153 constexpr
FwSizeType MAX_PACKETS_PER_CONTAINER =
155 if ((packetsPerContainer == 0) || (packetsPerContainer > MAX_PACKETS_PER_CONTAINER)) {
157 (void)this->sendContainerIfNonEmpty();
158 this->m_enabled =
false;
163 (void)this->sendContainerIfNonEmpty();
166 this->m_packetsPerContainer = packetsPerContainer;
167 this->m_priority = priority;
170 this->m_schedCallsSinceLastPacket = 0;
173 this->m_enabled =
true;
181 ComLoggerDp_PartialContainerStatus ComLoggerDp ::stopRecordingInternal() {
183 const ComLoggerDp_PartialContainerStatus partialContainer = this->sendContainerIfNonEmpty();
186 this->m_enabled =
false;
189 this->m_schedCallsSinceLastPacket = 0;
194 return partialContainer;
197 void ComLoggerDp ::handleBufferDrop(U32 size) {
199 ++this->m_numBuffersDropped;
202 Fw::Success ComLoggerDp ::allocateAndSetupContainer() {
213 this->handleBufferDrop(static_cast<U32>(containerSize));
222 void ComLoggerDp ::serializePacket(
const U8* dataPtr,
FwSizeType dataSize) {
226 const FwSizeType totalSize = sentrySize + dataSize;
242 ComLoggerDp_PartialContainerStatus ComLoggerDp ::sendContainerIfNonEmpty() {
245 if (this->m_enabled && this->m_currentPacketCount > 0) {
246 this->
dpSend(this->m_container);
248 this->m_currentPacketCount = 0;
254 void ComLoggerDp ::finalizeContainer() {
256 (void)this->sendContainerIfNonEmpty();
263 void ComLoggerDp ::StartComDp_cmdHandler(
FwOpcodeType opCode,
268 const Fw::Success success = this->startRecordingInternal(packetsPerContainer, priority);
282 this->m_priority = priority;
285 if (this->m_enabled && (this->m_currentPacketCount > 0)) {
295 void ComLoggerDp ::StopComDp_cmdHandler(
FwOpcodeType opCode, U32 cmdSeq) {
297 (void)this->stopRecordingInternal();
303 void ComLoggerDp ::CLEAR_COUNTERS_cmdHandler(
FwOpcodeType opCode, U32 cmdSeq) {
305 this->m_numBuffersLogged = 0;
308 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 schedInInternal_internalInterfaceInvoke()
Internal interface base-class function for schedInInternal.
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.