fprime/Fw/Tlm/TlmPacket.hpp
Vince Woo 48e4720419
Created new SerialBufferBase as a parent of SerializeBufferBase (now renamed LinearBufferBase). (#4288)
* Created new SerialBufferBase as a parent of SerializeBufferBase. Renaming interface functions to be less confusing.

* Deprecating copyRawOffset. No direct use-cases in F' core.

* Make SerialBufferBase a true pure virtual interface.

* Changing Serializable to work with SerialBufferBase parent interface.

* Changing copyRaw and copyRawOffset to work with SerialBufferBase

* Updating documentation for SerialBufferBase usage

* Adding some documentation. Adding missing ASSERT in copyRaw. Fixing some bugs that new ASSERT uncovered.

* Renaming SerializeBufferBase to LinearBufferBase. Add a using declaration to maintain backwards compatability. Properly mark LinearBufferBase functions as override.

* Filling in the rest of the docstrings for the classes in Serializable

* Removing redundant virtual keyword on override function

* Applying clang formatting

* Incorporating PR comments

* Fix compile issues

* Bump version to alpha

* Format

* v

---------

Co-authored-by: M Starch <LeStarch@googlemail.com>
2025-11-06 16:23:20 -08:00

53 lines
1.7 KiB
C++

/*
* TlmPacket.hpp
*
* Created on: May 24, 2014
* Author: Timothy Canham
*/
#ifndef TLMPACKET_HPP_
#define TLMPACKET_HPP_
#include <Fw/Com/ComBuffer.hpp>
#include <Fw/Com/ComPacket.hpp>
#include <Fw/Time/Time.hpp>
#include <Fw/Tlm/TlmBuffer.hpp>
namespace Fw {
class TlmPacket : public ComPacket {
public:
//! Constructor
TlmPacket();
//! Destructor
virtual ~TlmPacket();
SerializeStatus serializeTo(SerialBufferBase& buffer,
Fw::Endianness mode = Fw::Endianness::BIG) const override; //!< serialize contents
SerializeStatus deserializeFrom(SerialBufferBase& buffer, Fw::Endianness mode = Fw::Endianness::BIG) override;
//! Add telemetry value to buffer.
SerializeStatus addValue(FwChanIdType id, Time& timeTag, TlmBuffer& buffer);
//! extract telemetry value - since there are potentially multiple channel values in the packet,
//! the size of the entry must be known
SerializeStatus extractValue(FwChanIdType& id, Time& timeTag, TlmBuffer& buffer, FwSizeType bufferSize);
//! Reset serialization of values. This should be done when starting to accumulate a new set of values.
SerializeStatus resetPktSer();
//! Reset deserialization. This should be done before extracting values.
SerializeStatus resetPktDeser();
//! get buffer to send to the ground
Fw::ComBuffer& getBuffer();
//! set the internal buffer for deserializing values
void setBuffer(Fw::ComBuffer& buffer);
//! get the number of packets added via addValue()
FwSizeType getNumEntries();
private:
ComBuffer m_tlmBuffer; //!< serialized data
FwSizeType m_numEntries; //!< number of entries stored during addValue()
};
} /* namespace Fw */
#endif /* TLMPACKET_HPP_ */