21 for (
NATIVE_UINT_TYPE entry = 0; entry < TLMCHAN_NUM_TLM_HASH_SLOTS; entry++) {
22 this->m_tlmEntries[0].slots[entry] =
nullptr;
23 this->m_tlmEntries[1].slots[entry] =
nullptr;
27 this->m_tlmEntries[0].buckets[entry].used =
false;
28 this->m_tlmEntries[0].buckets[entry].updated =
false;
29 this->m_tlmEntries[0].buckets[entry].bucketNo = entry;
30 this->m_tlmEntries[0].buckets[entry].next =
nullptr;
31 this->m_tlmEntries[0].buckets[entry].id = 0;
32 this->m_tlmEntries[1].buckets[entry].used =
false;
33 this->m_tlmEntries[1].buckets[entry].updated =
false;
34 this->m_tlmEntries[1].buckets[entry].bucketNo = entry;
35 this->m_tlmEntries[1].buckets[entry].next =
nullptr;
36 this->m_tlmEntries[1].buckets[entry].id = 0;
39 this->m_tlmEntries[0].free = 0;
40 this->m_tlmEntries[1].free = 0;
46 return (
id % TLMCHAN_HASH_MOD_VALUE) % TLMCHAN_NUM_TLM_HASH_SLOTS;
60 TlmEntry* entryToUse = this->m_tlmEntries[this->m_activeBuffer].slots[index];
63 if (entryToUse->id ==
id) {
66 entryToUse = entryToUse->next;
74 val = entryToUse->buffer;
75 timeTag = entryToUse->lastUpdate;
85 TlmEntry* entryToUse =
nullptr;
86 TlmEntry* prevEntry =
nullptr;
89 if (this->m_tlmEntries[this->m_activeBuffer].slots[index]) {
90 entryToUse = this->m_tlmEntries[this->m_activeBuffer].slots[index];
93 if (entryToUse->id ==
id) {
96 prevEntry = entryToUse;
97 entryToUse = entryToUse->next;
101 FW_ASSERT(this->m_tlmEntries[this->m_activeBuffer].free < TLMCHAN_HASH_BUCKETS);
104 &this->m_tlmEntries[this->m_activeBuffer].buckets[this->m_tlmEntries[this->m_activeBuffer].free++];
106 prevEntry->next = entryToUse;
108 entryToUse->next =
nullptr;
114 FW_ASSERT(this->m_tlmEntries[this->m_activeBuffer].free < TLMCHAN_HASH_BUCKETS);
116 this->m_tlmEntries[this->m_activeBuffer].slots[index] =
117 &this->m_tlmEntries[this->m_activeBuffer].buckets[this->m_tlmEntries[this->m_activeBuffer].free++];
118 entryToUse = this->m_tlmEntries[this->m_activeBuffer].slots[index];
119 entryToUse->next =
nullptr;
124 entryToUse->used =
true;
126 entryToUse->updated =
true;
127 entryToUse->lastUpdate = timeTag;
128 entryToUse->buffer = val;
140 this->m_activeBuffer = 1 - this->m_activeBuffer;
142 for (U32 entry = 0; entry < TLMCHAN_HASH_BUCKETS; entry++) {
143 this->m_tlmEntries[this->m_activeBuffer].buckets[entry].updated =
false;
151 for (U32 entry = 0; entry < TLMCHAN_HASH_BUCKETS; entry++) {
152 TlmEntry* p_entry = &this->m_tlmEntries[1 - this->m_activeBuffer].buckets[entry];
153 if ((p_entry->updated) && (p_entry->used)) {
162 stat = pkt.
addValue(p_entry->id, p_entry->lastUpdate, p_entry->buffer);
173 p_entry->updated =
false;
PlatformIntType NATIVE_INT_TYPE
PlatformUIntType NATIVE_UINT_TYPE
C++-compatible configuration header for fprime configuration.
Component that stores telemetry channel values.
void resetSer()
reset to beginning of buffer to reuse for serialization
NATIVE_UINT_TYPE getNumEntries()
get the number of packets added via addValue()
SerializeStatus resetPktSer()
Reset serialization of values. This should be done when starting to accumulate a new set of values.
Fw::ComBuffer & getBuffer()
get buffer to send to the ground
SerializeStatus addValue(FwChanIdType id, Time &timeTag, TlmBuffer &buffer)
Add telemetry value to buffer.
Auto-generated base for TlmChan component.
virtual void unLock()
Unlock the guarded mutex.
void PktSend_out(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Invoke output port PktSend.
bool isConnected_PktSend_OutputPort(FwIndexType portNum)
void pingOut_out(FwIndexType portNum, U32 key)
Invoke output port pingOut.
virtual void lock()
Lock the guarded mutex.
virtual NATIVE_UINT_TYPE doHash(FwChanIdType id)
TlmChan(const char *compName)
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.
@ FW_SERIALIZE_NO_ROOM_LEFT
No room left in the buffer to serialize data.