2022-11-02 10:26:45 +01:00
|
|
|
#ifndef MISSION_TMTC_TMFUNNELBASE_H_
|
|
|
|
#define MISSION_TMTC_TMFUNNELBASE_H_
|
|
|
|
|
|
|
|
#include <fsfw/objectmanager/SystemObject.h>
|
|
|
|
#include <fsfw/storagemanager/StorageManagerIF.h>
|
2022-12-14 13:19:14 +01:00
|
|
|
#include <fsfw/tmstorage/TmStoreFrontendSimpleIF.h>
|
2022-11-02 10:26:45 +01:00
|
|
|
#include <fsfw/tmtcservices/AcceptsTelemetryIF.h>
|
2022-12-19 14:40:27 +01:00
|
|
|
#include <fsfw/tmtcservices/TmTcMessage.h>
|
2023-06-25 12:41:20 +02:00
|
|
|
#include <mission/memory/SdCardMountedIF.h>
|
2023-03-09 11:46:13 +01:00
|
|
|
#include <mission/tmtc/PusLiveDemux.h>
|
2022-11-02 10:26:45 +01:00
|
|
|
|
2023-06-25 12:41:20 +02:00
|
|
|
#include <atomic>
|
2022-11-02 10:26:45 +01:00
|
|
|
#include <vector>
|
|
|
|
|
2023-02-21 20:43:16 +01:00
|
|
|
class TmFunnelBase : public AcceptsTelemetryIF, public SystemObject {
|
2022-11-02 10:26:45 +01:00
|
|
|
public:
|
2023-02-08 17:43:43 +01:00
|
|
|
struct FunnelCfg {
|
2023-03-02 17:35:36 +01:00
|
|
|
FunnelCfg(object_id_t objId, const char* name, StorageManagerIF& tmStore,
|
2023-06-25 12:41:20 +02:00
|
|
|
StorageManagerIF& ipcStore, uint32_t tmMsgDepth, SdCardMountedIF& sdcMan,
|
|
|
|
const char* sequenceCounterFilename, std::atomic_bool& saveSequenceCount)
|
2023-03-02 17:35:36 +01:00
|
|
|
: objectId(objId),
|
|
|
|
name(name),
|
|
|
|
tmStore(tmStore),
|
|
|
|
ipcStore(ipcStore),
|
2023-06-25 12:41:20 +02:00
|
|
|
tmMsgDepth(tmMsgDepth),
|
|
|
|
sdcMan(sdcMan),
|
|
|
|
sequenceCounterFilename(sequenceCounterFilename),
|
|
|
|
saveSequenceCount(saveSequenceCount) {}
|
2023-02-08 17:43:43 +01:00
|
|
|
object_id_t objectId;
|
2023-03-02 17:35:36 +01:00
|
|
|
const char* name;
|
2023-02-08 17:43:43 +01:00
|
|
|
StorageManagerIF& tmStore;
|
|
|
|
StorageManagerIF& ipcStore;
|
|
|
|
uint32_t tmMsgDepth;
|
2023-06-25 12:41:20 +02:00
|
|
|
SdCardMountedIF& sdcMan;
|
|
|
|
const char* sequenceCounterFilename;
|
|
|
|
std::atomic_bool& saveSequenceCount;
|
2023-02-08 17:43:43 +01:00
|
|
|
};
|
2023-02-21 20:43:16 +01:00
|
|
|
explicit TmFunnelBase(FunnelCfg cfg);
|
2022-11-02 10:26:45 +01:00
|
|
|
[[nodiscard]] MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel) const override;
|
2023-09-11 20:16:54 +02:00
|
|
|
virtual uint32_t addLiveDestinationByRawId(const char* name, MessageQueueId_t downlinkDestination,
|
|
|
|
uint8_t vcid = 0);
|
2023-09-11 19:23:48 +02:00
|
|
|
virtual uint32_t addLiveDestination(const char* name,
|
|
|
|
const AcceptsTelemetryIF& downlinkDestination,
|
|
|
|
uint8_t vcid = 0);
|
2023-03-09 11:46:13 +01:00
|
|
|
ReturnValue_t demultiplexLivePackets(store_address_t origStoreId, const uint8_t* tmData,
|
|
|
|
size_t tmSize);
|
2023-06-25 12:41:20 +02:00
|
|
|
ReturnValue_t initialize() override;
|
|
|
|
|
|
|
|
ReturnValue_t saveSequenceCountToFile();
|
2022-11-02 10:26:45 +01:00
|
|
|
|
2023-02-21 20:43:16 +01:00
|
|
|
~TmFunnelBase() override;
|
2022-11-02 10:26:45 +01:00
|
|
|
|
|
|
|
protected:
|
2023-03-02 17:35:36 +01:00
|
|
|
const char* name;
|
2022-11-02 10:26:45 +01:00
|
|
|
StorageManagerIF& tmStore;
|
2022-12-19 13:57:05 +01:00
|
|
|
StorageManagerIF& ipcStore;
|
2022-11-02 10:26:45 +01:00
|
|
|
MessageQueueIF* tmQueue = nullptr;
|
2023-03-09 11:46:13 +01:00
|
|
|
PusLiveDemux liveDemux;
|
2023-06-25 12:41:20 +02:00
|
|
|
SdCardMountedIF& sdcMan;
|
|
|
|
const char* sequenceCounterFilename;
|
|
|
|
std::atomic_bool& saveSequenceCount;
|
|
|
|
uint16_t sourceSequenceCount = 0;
|
2022-11-02 10:26:45 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* MISSION_TMTC_TMFUNNELBASE_H_ */
|