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;
48 TlmChanComponentBase::init(queueDepth, instance);
52 return (
id % TLMCHAN_HASH_MOD_VALUE) % TLMCHAN_NUM_TLM_HASH_SLOTS;
57 this->pingOut_out(0, key);
66 TlmEntry* entryToUse = this->m_tlmEntries[this->m_activeBuffer].slots[index];
69 if (entryToUse->id ==
id) {
72 entryToUse = entryToUse->next;
80 val = entryToUse->buffer;
81 timeTag = entryToUse->lastUpdate;
91 TlmEntry* entryToUse =
nullptr;
92 TlmEntry* prevEntry =
nullptr;
95 if (this->m_tlmEntries[this->m_activeBuffer].slots[index]) {
96 entryToUse = this->m_tlmEntries[this->m_activeBuffer].slots[index];
99 if (entryToUse->id ==
id) {
102 prevEntry = entryToUse;
103 entryToUse = entryToUse->next;
107 FW_ASSERT(this->m_tlmEntries[this->m_activeBuffer].free < TLMCHAN_HASH_BUCKETS);
110 &this->m_tlmEntries[this->m_activeBuffer].buckets[this->m_tlmEntries[this->m_activeBuffer].free++];
112 prevEntry->next = entryToUse;
114 entryToUse->next =
nullptr;
120 FW_ASSERT(this->m_tlmEntries[this->m_activeBuffer].free < TLMCHAN_HASH_BUCKETS);
122 this->m_tlmEntries[this->m_activeBuffer].slots[index] =
123 &this->m_tlmEntries[this->m_activeBuffer].buckets[this->m_tlmEntries[this->m_activeBuffer].free++];
124 entryToUse = this->m_tlmEntries[this->m_activeBuffer].slots[index];
125 entryToUse->next =
nullptr;
130 entryToUse->used =
true;
132 entryToUse->updated =
true;
133 entryToUse->lastUpdate = timeTag;
134 entryToUse->buffer = val;
139 if (not this->isConnected_PktSend_OutputPort(0)) {
146 this->m_activeBuffer = 1 - this->m_activeBuffer;
148 for (U32 entry = 0; entry < TLMCHAN_HASH_BUCKETS; entry++) {
149 this->m_tlmEntries[this->m_activeBuffer].buckets[entry].updated =
false;
157 for (U32 entry = 0; entry < TLMCHAN_HASH_BUCKETS; entry++) {
158 TlmEntry* p_entry = &this->m_tlmEntries[1 - this->m_activeBuffer].buckets[entry];
159 if ((p_entry->updated) && (p_entry->used)) {
164 this->PktSend_out(0, pkt.
getBuffer(), 0);
179 p_entry->updated =
false;
185 this->PktSend_out(0, pkt.
getBuffer(), 0);
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.
virtual NATIVE_UINT_TYPE doHash(FwChanIdType id)
void init(NATIVE_INT_TYPE queueDepth, NATIVE_INT_TYPE instance)
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.