continue rework
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
This commit is contained in:
@ -5,8 +5,16 @@
|
||||
#include "fsfw/ipc/QueueFactory.h"
|
||||
|
||||
TmFunnelBase::TmFunnelBase(FunnelCfg cfg)
|
||||
: SystemObject(cfg.objectId), name(cfg.name), tmStore(cfg.tmStore), ipcStore(cfg.ipcStore) {
|
||||
tmQueue = QueueFactory::instance()->createMessageQueue(cfg.tmMsgDepth);
|
||||
: SystemObject(cfg.objectId),
|
||||
name(cfg.name),
|
||||
tmStore(cfg.tmStore),
|
||||
ipcStore(cfg.ipcStore),
|
||||
tmQueue(QueueFactory::instance()->createMessageQueue(cfg.tmMsgDepth)),
|
||||
liveDemux(*tmQueue) {}
|
||||
|
||||
ReturnValue_t TmFunnelBase::demultiplexLivePackets(store_address_t origStoreId,
|
||||
const uint8_t *tmData, size_t tmSize) {
|
||||
return liveDemux.demultiplexPackets(tmStore, origStoreId, tmData, tmSize);
|
||||
}
|
||||
|
||||
TmFunnelBase::~TmFunnelBase() { QueueFactory::instance()->deleteMessageQueue(tmQueue); }
|
||||
@ -15,43 +23,7 @@ MessageQueueId_t TmFunnelBase::getReportReceptionQueue(uint8_t virtualChannel) c
|
||||
return tmQueue->getId();
|
||||
}
|
||||
|
||||
void TmFunnelBase::addDestination(const char *name, const AcceptsTelemetryIF &downlinkDestination,
|
||||
uint8_t vcid) {
|
||||
auto queueId = downlinkDestination.getReportReceptionQueue(vcid);
|
||||
destinations.emplace_back(name, queueId, vcid);
|
||||
}
|
||||
|
||||
ReturnValue_t TmFunnelBase::sendPacketToDestinations(store_address_t origStoreId,
|
||||
TmTcMessage &message,
|
||||
const uint8_t *packetData, size_t size) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
for (unsigned int idx = 0; idx < destinations.size(); idx++) {
|
||||
const auto &dest = destinations[idx];
|
||||
if (destinations.size() > 1) {
|
||||
if (idx < destinations.size() - 1) {
|
||||
// Create copy of data to ensure each TM recipient has its own copy. That way, we don't need
|
||||
// to bother with send order and where the data is deleted.
|
||||
store_address_t storeId;
|
||||
result = tmStore.addData(&storeId, packetData, size);
|
||||
if (result == returnvalue::OK) {
|
||||
message.setStorageId(storeId);
|
||||
} else {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << name << "::handlePacket: Store too full to create data copy" << std::endl;
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
message.setStorageId(origStoreId);
|
||||
}
|
||||
}
|
||||
result = tmQueue->sendMessage(dest.queueId, &message);
|
||||
if (result != returnvalue::OK) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << name << "::handlePacket: Error sending TM to downlink handler " << dest.name
|
||||
<< std::endl;
|
||||
#endif
|
||||
tmStore.deleteData(message.getStorageId());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
void TmFunnelBase::addLiveDestination(const char *name,
|
||||
const AcceptsTelemetryIF &downlinkDestination, uint8_t vcid) {
|
||||
liveDemux.addDestination(name, downlinkDestination, vcid);
|
||||
}
|
||||
|
Reference in New Issue
Block a user