start groundwork for new TM downlink arch
This commit is contained in:
@ -12,48 +12,14 @@
|
||||
|
||||
PusTmFunnel::PusTmFunnel(TmFunnelBase::FunnelCfg cfg, TimeReaderIF &timeReader,
|
||||
SdCardMountedIF &sdcMan)
|
||||
: TmFunnelBase(cfg),
|
||||
timeReader(timeReader),
|
||||
miscStore(objects::MISC_TM_STORE, "tm", "misc", RolloverInterval::HOURLY, 2, tmStore, sdcMan),
|
||||
okStore(objects::OK_TM_STORE, "tm", "ok", RolloverInterval::MINUTELY, 30, tmStore, sdcMan),
|
||||
notOkStore(objects::NOT_OK_TM_STORE, "tm", "nok", RolloverInterval::MINUTELY, 30, tmStore,
|
||||
sdcMan),
|
||||
hkStore(objects::HK_TM_STORE, "tm", "hk", RolloverInterval::MINUTELY, 15, tmStore, sdcMan),
|
||||
sdcMan(sdcMan) {
|
||||
Clock::getClock_timeval(¤tTv);
|
||||
Clock::getUptime(&lastTvUpdate);
|
||||
hkStore.addApid(config::EIVE_PUS_APID);
|
||||
hkStore.addService(pus::PUS_SERVICE_3);
|
||||
miscStore.addApid(config::EIVE_PUS_APID);
|
||||
miscStore.addService(pus::PUS_SERVICE_17);
|
||||
miscStore.addService(pus::PUS_SERVICE_2);
|
||||
miscStore.addService(pus::PUS_SERVICE_200);
|
||||
miscStore.addService(pus::PUS_SERVICE_201);
|
||||
miscStore.addService(pus::PUS_SERVICE_9);
|
||||
miscStore.addService(pus::PUS_SERVICE_20);
|
||||
okStore.addApid(config::EIVE_PUS_APID);
|
||||
okStore.addServiceSubservice(pus::PUS_SERVICE_5,
|
||||
Service5EventReporting::Subservice::NORMAL_REPORT);
|
||||
okStore.addService(pus::PUS_SERVICE_8);
|
||||
okStore.addServiceSubservice(pus::PUS_SERVICE_1, 1);
|
||||
okStore.addServiceSubservice(pus::PUS_SERVICE_1, 3);
|
||||
okStore.addServiceSubservice(pus::PUS_SERVICE_1, 5);
|
||||
okStore.addServiceSubservice(pus::PUS_SERVICE_1, 7);
|
||||
notOkStore.addApid(config::EIVE_PUS_APID);
|
||||
notOkStore.addServiceSubservice(pus::PUS_SERVICE_5, 2);
|
||||
notOkStore.addServiceSubservice(pus::PUS_SERVICE_5, 3);
|
||||
notOkStore.addServiceSubservice(pus::PUS_SERVICE_5, 4);
|
||||
notOkStore.addServiceSubservice(pus::PUS_SERVICE_1, 2);
|
||||
notOkStore.addServiceSubservice(pus::PUS_SERVICE_1, 4);
|
||||
notOkStore.addServiceSubservice(pus::PUS_SERVICE_1, 6);
|
||||
notOkStore.addServiceSubservice(pus::PUS_SERVICE_1, 8);
|
||||
}
|
||||
: TmFunnelBase(cfg), timeReader(timeReader), sdcMan(sdcMan) {}
|
||||
|
||||
PusTmFunnel::~PusTmFunnel() = default;
|
||||
|
||||
ReturnValue_t PusTmFunnel::performOperation(uint8_t) {
|
||||
CommandMessage cmdMessage;
|
||||
ReturnValue_t result;
|
||||
/*
|
||||
try {
|
||||
result = okStore.handleCommandQueue(ipcStore, *this);
|
||||
if (result != returnvalue::OK) {
|
||||
@ -75,6 +41,7 @@ ReturnValue_t PusTmFunnel::performOperation(uint8_t) {
|
||||
} catch (const std::bad_optional_access &e) {
|
||||
sif::error << e.what() << "when handling TM store command" << std::endl;
|
||||
}
|
||||
*/
|
||||
|
||||
TmTcMessage currentMessage;
|
||||
unsigned int count = 0;
|
||||
@ -119,38 +86,45 @@ ReturnValue_t PusTmFunnel::handleTmPacket(TmTcMessage &message) {
|
||||
sourceSequenceCount = sourceSequenceCount % ccsds::LIMIT_SEQUENCE_COUNT;
|
||||
packet.updateErrorControl();
|
||||
|
||||
timeval currentUptime{};
|
||||
Clock::getUptime(¤tUptime);
|
||||
if (currentUptime.tv_sec - lastTvUpdate.tv_sec >
|
||||
static_cast<signed int>(TV_UPDATE_INTERVAL_SECS)) {
|
||||
Clock::getClock_timeval(¤tTv);
|
||||
lastTvUpdate = currentUptime;
|
||||
}
|
||||
|
||||
bool sdcUsable = sdcMan.isSdCardUsable(std::nullopt);
|
||||
initStoresIfPossible(sdcUsable);
|
||||
if (sdcUsable) {
|
||||
miscStore.passPacket(packet);
|
||||
okStore.passPacket(packet);
|
||||
notOkStore.passPacket(packet);
|
||||
hkStore.passPacket(packet);
|
||||
}
|
||||
// TODO: 1. Send packet to persistent TM store when applicable.
|
||||
// 2. Send packet to live TM VC
|
||||
// 3. Send packet to TCP/IP destination
|
||||
return sendPacketToDestinations(origStoreId, message, packetData, size);
|
||||
// timeval currentUptime{};
|
||||
// Clock::getUptime(¤tUptime);
|
||||
// if (currentUptime.tv_sec - lastTvUpdate.tv_sec >
|
||||
// static_cast<signed int>(TV_UPDATE_INTERVAL_SECS)) {
|
||||
// Clock::getClock_timeval(¤tTv);
|
||||
// lastTvUpdate = currentUptime;
|
||||
// }
|
||||
|
||||
// bool sdcUsable = sdcMan.isSdCardUsable(std::nullopt);
|
||||
// initStoresIfPossible(sdcUsable);
|
||||
// if (sdcUsable) {
|
||||
// miscStore.passPacket(packet);
|
||||
// okStore.passPacket(packet);
|
||||
// notOkStore.passPacket(packet);
|
||||
// hkStore.passPacket(packet);
|
||||
// }
|
||||
}
|
||||
|
||||
const char *PusTmFunnel::getName() const { return "PUS TM Funnel"; }
|
||||
|
||||
void PusTmFunnel::initStoresIfPossible(bool sdCardUsable) {
|
||||
if (not storesInitialized and sdCardUsable and sdcMan.getCurrentMountPrefix() != nullptr) {
|
||||
miscStore.initializeTmStore();
|
||||
okStore.initializeTmStore();
|
||||
hkStore.initializeTmStore();
|
||||
notOkStore.initializeTmStore();
|
||||
// miscStore.initializeTmStore();
|
||||
// okStore.initializeTmStore();
|
||||
// hkStore.initializeTmStore();
|
||||
// notOkStore.initializeTmStore();
|
||||
storesInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t PusTmFunnel::initialize() {
|
||||
initStoresIfPossible(sdcMan.isSdCardUsable(std::nullopt));
|
||||
// initStoresIfPossible(sdcMan.isSdCardUsable(std::nullopt));
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
void PusTmFunnel::addPersistentTmStoreRouting(PusPacketFilter filter, MessageQueueId_t dest) {
|
||||
router.addRouting(filter, dest);
|
||||
}
|
||||
|
Reference in New Issue
Block a user