diff --git a/fsfw b/fsfw index f4c4f994..007f958a 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit f4c4f9946c7fb9fd050178baa4865da654366b70 +Subproject commit 007f958a0b787a572bf1bd98b348c3a632799bf7 diff --git a/mission/controller/AcsController.h b/mission/controller/AcsController.h index 35503c48..c5b43288 100644 --- a/mission/controller/AcsController.h +++ b/mission/controller/AcsController.h @@ -45,6 +45,7 @@ class AcsController : public ExtendedControllerBase { PoolEntry mgm3PoolVec = PoolEntry(3); PoolEntry imtqMgmPoolVec = PoolEntry(3); PoolEntry imtqCalActStatus = PoolEntry(); + void copyMgmData(); // Initial delay to make sure all pool variables have been initialized their owners diff --git a/mission/controller/ThermalController.cpp b/mission/controller/ThermalController.cpp index 9e0fbd5a..abb46f48 100644 --- a/mission/controller/ThermalController.cpp +++ b/mission/controller/ThermalController.cpp @@ -200,10 +200,12 @@ ReturnValue_t ThermalController::initializeLocalDataPool(localpool::DataPool& lo localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_ADC_PAYLOAD_PCDU, new PoolEntry({0.0})); - poolManager.subscribeForPeriodicPacket(sensorTemperatures.getSid(), false, 1.0, false); - poolManager.subscribeForPeriodicPacket(susTemperatures.getSid(), false, 1.0, false); - poolManager.subscribeForPeriodicPacket(deviceTemperatures.getSid(), false, 1.0, false); - + poolManager.subscribeForRegularPeriodicPacket( + subdp::RegularHkPeriodicParams(sensorTemperatures.getSid(), false, 10.0)); + poolManager.subscribeForRegularPeriodicPacket( + subdp::RegularHkPeriodicParams(susTemperatures.getSid(), false, 10.0)); + poolManager.subscribeForRegularPeriodicPacket( + subdp::RegularHkPeriodicParams(deviceTemperatures.getSid(), false, 10.0)); return RETURN_OK; } diff --git a/mission/core/GenericFactory.cpp b/mission/core/GenericFactory.cpp index 1be91594..fbfb16f2 100644 --- a/mission/core/GenericFactory.cpp +++ b/mission/core/GenericFactory.cpp @@ -15,8 +15,8 @@ #include #include #include -#include -#include +#include +#include #include #include "OBSWConfig.h" @@ -54,7 +54,7 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) { *healthTable_ = healthTable; } new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER); - new TimeStamper(objects::TIME_STAMPER); + auto* timeStamper = new CdsShortTimeStamper(objects::TIME_STAMPER); { PoolManager::LocalPoolConfig poolCfg = {{300, 16}, {300, 32}, {200, 64}, @@ -75,15 +75,14 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) { } auto* ccsdsDistrib = new CCSDSDistributor(apid::EIVE_OBSW, objects::CCSDS_PACKET_DISTRIBUTOR); - new PUSDistributor(apid::EIVE_OBSW, objects::PUS_PACKET_DISTRIBUTOR, - objects::CCSDS_PACKET_DISTRIBUTOR); + new PusDistributor(apid::EIVE_OBSW, objects::PUS_PACKET_DISTRIBUTOR, ccsdsDistrib); uint8_t vc = 0; #if OBSW_TM_TO_PTME == 1 vc = config::LIVE_TM; #endif // Every TM packet goes through this funnel - new TmFunnel(objects::TM_FUNNEL, 50, vc); + new TmFunnel(objects::TM_FUNNEL, *timeStamper, 50, vc); // PUS service stack new Service1TelecommandVerification(objects::PUS_SERVICE_1_VERIFICATION, apid::EIVE_OBSW, @@ -92,15 +91,15 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) { pus::PUS_SERVICE_2, 3, 10); new Service3Housekeeping(objects::PUS_SERVICE_3_HOUSEKEEPING, apid::EIVE_OBSW, pus::PUS_SERVICE_3); - new Service5EventReporting(objects::PUS_SERVICE_5_EVENT_REPORTING, apid::EIVE_OBSW, - pus::PUS_SERVICE_5, 15, 45); + new Service5EventReporting(PsbParams(objects::PUS_SERVICE_5_EVENT_REPORTING, apid::EIVE_OBSW, + pus::PUS_SERVICE_5), 15, 45); new Service8FunctionManagement(objects::PUS_SERVICE_8_FUNCTION_MGMT, apid::EIVE_OBSW, pus::PUS_SERVICE_8, 3, 60); - new Service9TimeManagement(objects::PUS_SERVICE_9_TIME_MGMT, apid::EIVE_OBSW, pus::PUS_SERVICE_9); + new Service9TimeManagement(PsbParams(objects::PUS_SERVICE_9_TIME_MGMT, apid::EIVE_OBSW, pus::PUS_SERVICE_9)); new Service11TelecommandScheduling( - objects::PUS_SERVICE_11_TC_SCHEDULER, apid::EIVE_OBSW, pus::PUS_SERVICE_11, ccsdsDistrib); - new Service17Test(objects::PUS_SERVICE_17_TEST, apid::EIVE_OBSW, pus::PUS_SERVICE_17); + PsbParams(objects::PUS_SERVICE_11_TC_SCHEDULER, apid::EIVE_OBSW, pus::PUS_SERVICE_11), ccsdsDistrib); + new Service17Test(PsbParams(objects::PUS_SERVICE_17_TEST, apid::EIVE_OBSW, pus::PUS_SERVICE_17)); new Service20ParameterManagement(objects::PUS_SERVICE_20_PARAMETERS, apid::EIVE_OBSW, pus::PUS_SERVICE_20); new CService200ModeCommanding(objects::PUS_SERVICE_200_MODE_MGMT, apid::EIVE_OBSW, diff --git a/mission/devices/ACUHandler.cpp b/mission/devices/ACUHandler.cpp index c62b7b0d..35f8e2dd 100644 --- a/mission/devices/ACUHandler.cpp +++ b/mission/devices/ACUHandler.cpp @@ -170,8 +170,10 @@ ReturnValue_t ACUHandler::initializeLocalDataPool(localpool::DataPool &localData localDataPoolMap.emplace(pool::ACU_WDT_CNT_GND, new PoolEntry({0})); localDataPoolMap.emplace(pool::ACU_WDT_GND_LEFT, new PoolEntry({0})); - poolManager.subscribeForPeriodicPacket(coreHk.getSid(), false, 10.0, true); - poolManager.subscribeForPeriodicPacket(auxHk.getSid(), false, 30.0, false); + poolManager.subscribeForDiagPeriodicPacket( + subdp::DiagnosticsHkPeriodicParams(coreHk.getSid(), false, 10.0)); + poolManager.subscribeForRegularPeriodicPacket( + subdp::RegularHkPeriodicParams(auxHk.getSid(), false, 30.0)); return HasReturnvaluesIF::RETURN_OK; } diff --git a/mission/devices/BpxBatteryHandler.cpp b/mission/devices/BpxBatteryHandler.cpp index 4ae7b962..d121fc8c 100644 --- a/mission/devices/BpxBatteryHandler.cpp +++ b/mission/devices/BpxBatteryHandler.cpp @@ -270,7 +270,8 @@ ReturnValue_t BpxBatteryHandler::initializeLocalDataPool(localpool::DataPool& lo localDataPoolMap.emplace(BpxBattery::BATTERY_HEATER_MODE, &battheatMode); localDataPoolMap.emplace(BpxBattery::BATTHEAT_LOW_LIMIT, &battheatLow); localDataPoolMap.emplace(BpxBattery::BATTHEAT_HIGH_LIMIT, &battheatHigh); - poolManager.subscribeForPeriodicPacket(hkSet.getSid(), false, 30.0, false); + poolManager.subscribeForRegularPeriodicPacket( + subdp::RegularHkPeriodicParams(hkSet.getSid(), false, 30.0)); return HasReturnvaluesIF::RETURN_OK; } diff --git a/mission/devices/GyroADIS1650XHandler.cpp b/mission/devices/GyroADIS1650XHandler.cpp index 77862bfb..3e798f04 100644 --- a/mission/devices/GyroADIS1650XHandler.cpp +++ b/mission/devices/GyroADIS1650XHandler.cpp @@ -363,7 +363,8 @@ ReturnValue_t GyroADIS1650XHandler::initializeLocalDataPool(localpool::DataPool localDataPoolMap.emplace(ADIS1650X::FILTER_SETTINGS, new PoolEntry()); localDataPoolMap.emplace(ADIS1650X::MSC_CTRL_REGISTER, new PoolEntry()); localDataPoolMap.emplace(ADIS1650X::DEC_RATE_REGISTER, new PoolEntry()); - poolManager.subscribeForPeriodicPacket(primaryDataset.getSid(), false, 5.0, true); + poolManager.subscribeForRegularPeriodicPacket( + subdp::RegularHkPeriodicParams(primaryDataset.getSid(), false, 5.0)); return HasReturnvaluesIF::RETURN_OK; } diff --git a/mission/devices/IMTQHandler.cpp b/mission/devices/IMTQHandler.cpp index ea7a3177..98b67e96 100644 --- a/mission/devices/IMTQHandler.cpp +++ b/mission/devices/IMTQHandler.cpp @@ -604,9 +604,12 @@ ReturnValue_t IMTQHandler::initializeLocalDataPool(localpool::DataPool& localDat localDataPoolMap.emplace(IMTQ::FINA_NEG_Z_COIL_Y_TEMPERATURE, new PoolEntry({0})); localDataPoolMap.emplace(IMTQ::FINA_NEG_Z_COIL_Z_TEMPERATURE, new PoolEntry({0})); - poolManager.subscribeForPeriodicPacket(engHkDataset.getSid(), false, 10.0, true); - poolManager.subscribeForPeriodicPacket(calMtmMeasurementSet.getSid(), false, 10.0, true); - poolManager.subscribeForPeriodicPacket(rawMtmMeasurementSet.getSid(), false, 10.0, true); + poolManager.subscribeForDiagPeriodicPacket( + subdp::DiagnosticsHkPeriodicParams(engHkDataset.getSid(), false, 10.0)); + poolManager.subscribeForDiagPeriodicPacket( + subdp::DiagnosticsHkPeriodicParams(calMtmMeasurementSet.getSid(), false, 10.0)); + poolManager.subscribeForDiagPeriodicPacket( + subdp::DiagnosticsHkPeriodicParams(rawMtmMeasurementSet.getSid(), false, 10.0)); return HasReturnvaluesIF::RETURN_OK; } diff --git a/mission/devices/Max31865EiveHandler.cpp b/mission/devices/Max31865EiveHandler.cpp index 6f6760ad..7ad15670 100644 --- a/mission/devices/Max31865EiveHandler.cpp +++ b/mission/devices/Max31865EiveHandler.cpp @@ -184,7 +184,8 @@ ReturnValue_t Max31865EiveHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap.emplace(static_cast(PoolIds::LAST_FAULT_BYTE), new PoolEntry({0})); localDataPoolMap.emplace(static_cast(PoolIds::FAULT_BYTE), new PoolEntry({0})); - poolManager.subscribeForPeriodicPacket(sensorDataset.getSid(), false, 30.0, false); + poolManager.subscribeForRegularPeriodicPacket( + subdp::RegularHkPeriodicParams(sensorDataset.getSid(), false, 30.0)); return RETURN_OK; } diff --git a/mission/devices/Max31865PT1000Handler.cpp b/mission/devices/Max31865PT1000Handler.cpp index 354fe1c5..a5f6aa4f 100644 --- a/mission/devices/Max31865PT1000Handler.cpp +++ b/mission/devices/Max31865PT1000Handler.cpp @@ -514,7 +514,8 @@ ReturnValue_t Max31865PT1000Handler::initializeLocalDataPool(localpool::DataPool localDataPoolMap.emplace(static_cast(PoolIds::LAST_FAULT_BYTE), new PoolEntry({0})); localDataPoolMap.emplace(static_cast(PoolIds::FAULT_BYTE), new PoolEntry({0})); - poolManager.subscribeForPeriodicPacket(sensorDataset.getSid(), false, 30.0, false); + poolManager.subscribeForRegularPeriodicPacket( + subdp::RegularHkPeriodicParams(sensorDataset.getSid(), false, 30.0)); return HasReturnvaluesIF::RETURN_OK; } diff --git a/mission/devices/P60DockHandler.cpp b/mission/devices/P60DockHandler.cpp index 975e069d..f059a1d7 100644 --- a/mission/devices/P60DockHandler.cpp +++ b/mission/devices/P60DockHandler.cpp @@ -225,8 +225,10 @@ ReturnValue_t P60DockHandler::initializeLocalDataPool(localpool::DataPool &local localDataPoolMap.emplace(pool::P60DOCK_ANT6_DEPL, new PoolEntry({0})); localDataPoolMap.emplace(pool::P60DOCK_AR6_DEPL, new PoolEntry({0})); - poolManager.subscribeForPeriodicPacket(coreHk.getSid(), false, 10.0, false); - poolManager.subscribeForPeriodicPacket(auxHk.getSid(), false, 30.0, false); + poolManager.subscribeForDiagPeriodicPacket( + subdp::DiagnosticsHkPeriodicParams(coreHk.getSid(), false, 10.0)); + poolManager.subscribeForRegularPeriodicPacket( + subdp::RegularHkPeriodicParams(auxHk.getSid(), false, 30.0)); return HasReturnvaluesIF::RETURN_OK; } diff --git a/mission/devices/PCDUHandler.cpp b/mission/devices/PCDUHandler.cpp index 8e9f1918..70952cea 100644 --- a/mission/devices/PCDUHandler.cpp +++ b/mission/devices/PCDUHandler.cpp @@ -394,7 +394,8 @@ ReturnValue_t PCDUHandler::initializeLocalDataPool(localpool::DataPool& localDat using namespace pcdu; localDataPoolMap.emplace(PoolIds::PDU1_SWITCHES, &pdu1Switches); localDataPoolMap.emplace(PoolIds::PDU2_SWITCHES, &pdu2Switches); - poolManager.subscribeForPeriodicPacket(switcherSet.getSid(), false, 5.0, true); + poolManager.subscribeForRegularPeriodicPacket( + subdp::RegularHkPeriodicParams(switcherSet.getSid(), false, 5.0)); return HasReturnvaluesIF::RETURN_OK; } diff --git a/mission/devices/PCDUHandler.h b/mission/devices/PCDUHandler.h index 8f589751..98be1f38 100644 --- a/mission/devices/PCDUHandler.h +++ b/mission/devices/PCDUHandler.h @@ -31,7 +31,7 @@ class PCDUHandler : public PowerSwitchIF, virtual ReturnValue_t initialize() override; virtual ReturnValue_t performOperation(uint8_t counter) override; virtual void handleChangedDataset(sid_t sid, - store_address_t storeId = storeId::INVALID_STORE_ADDRESS, + store_address_t storeId = store_address_t::invalid(), bool* clearMessage = nullptr) override; virtual ReturnValue_t sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) override; diff --git a/mission/devices/PDU1Handler.cpp b/mission/devices/PDU1Handler.cpp index fca0fbeb..9c2f845c 100644 --- a/mission/devices/PDU1Handler.cpp +++ b/mission/devices/PDU1Handler.cpp @@ -86,8 +86,10 @@ void PDU1Handler::parseHkTableReply(const uint8_t *packet) { ReturnValue_t PDU1Handler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { initializePduPool(localDataPoolMap, poolManager, pcdu::INIT_SWITCHES_PDU1); - poolManager.subscribeForPeriodicPacket(coreHk.getSid(), false, 10.0, true); - poolManager.subscribeForPeriodicPacket(auxHk.getSid(), false, 30.0, false); + poolManager.subscribeForDiagPeriodicPacket( + subdp::DiagnosticsHkPeriodicParams(coreHk.getSid(), false, 10.0)); + poolManager.subscribeForRegularPeriodicPacket( + subdp::RegularHkPeriodicParams(auxHk.getSid(), false, 30.0)); return HasReturnvaluesIF::RETURN_OK; } diff --git a/mission/devices/PDU2Handler.cpp b/mission/devices/PDU2Handler.cpp index d0cef3f5..073ccb23 100644 --- a/mission/devices/PDU2Handler.cpp +++ b/mission/devices/PDU2Handler.cpp @@ -49,8 +49,10 @@ void PDU2Handler::parseHkTableReply(const uint8_t *packet) { ReturnValue_t PDU2Handler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { initializePduPool(localDataPoolMap, poolManager, pcdu::INIT_SWITCHES_PDU2); - poolManager.subscribeForPeriodicPacket(coreHk.getSid(), false, 10.0, true); - poolManager.subscribeForPeriodicPacket(auxHk.getSid(), false, 30.0, false); + poolManager.subscribeForDiagPeriodicPacket( + subdp::DiagnosticsHkPeriodicParams(coreHk.getSid(), false, 10.0)); + poolManager.subscribeForRegularPeriodicPacket( + subdp::RegularHkPeriodicParams(auxHk.getSid(), false, 30.0)); return HasReturnvaluesIF::RETURN_OK; } diff --git a/mission/devices/PayloadPcduHandler.cpp b/mission/devices/PayloadPcduHandler.cpp index 3e18a94e..d45b2c95 100644 --- a/mission/devices/PayloadPcduHandler.cpp +++ b/mission/devices/PayloadPcduHandler.cpp @@ -295,7 +295,8 @@ ReturnValue_t PayloadPcduHandler::initializeLocalDataPool(localpool::DataPool& l localDataPoolMap.emplace(plpcdu::PlPcduPoolIds::CHANNEL_VEC, &channelValues); localDataPoolMap.emplace(plpcdu::PlPcduPoolIds::PROCESSED_VEC, &processedValues); localDataPoolMap.emplace(plpcdu::PlPcduPoolIds::TEMP, &tempC); - poolManager.subscribeForPeriodicPacket(adcSet.getSid(), false, 5.0, true); + poolManager.subscribeForDiagPeriodicPacket( + subdp::DiagnosticsHkPeriodicParams(adcSet.getSid(), false, 5.0)); return HasReturnvaluesIF::RETURN_OK; } diff --git a/mission/devices/RadiationSensorHandler.cpp b/mission/devices/RadiationSensorHandler.cpp index d94e9197..716b54a5 100644 --- a/mission/devices/RadiationSensorHandler.cpp +++ b/mission/devices/RadiationSensorHandler.cpp @@ -204,7 +204,8 @@ ReturnValue_t RadiationSensorHandler::initializeLocalDataPool(localpool::DataPoo localDataPoolMap.emplace(RAD_SENSOR::AIN5, new PoolEntry({0})); localDataPoolMap.emplace(RAD_SENSOR::AIN6, new PoolEntry({0})); localDataPoolMap.emplace(RAD_SENSOR::AIN7, new PoolEntry({0})); - poolManager.subscribeForPeriodicPacket(dataset.getSid(), false, 20.0, false); + poolManager.subscribeForRegularPeriodicPacket( + subdp::RegularHkPeriodicParams(dataset.getSid(), false, 20.0)); return HasReturnvaluesIF::RETURN_OK; } diff --git a/mission/devices/RwHandler.cpp b/mission/devices/RwHandler.cpp index e8e04932..44dbac0d 100644 --- a/mission/devices/RwHandler.cpp +++ b/mission/devices/RwHandler.cpp @@ -277,9 +277,12 @@ ReturnValue_t RwHandler::initializeLocalDataPool(localpool::DataPool& localDataP localDataPoolMap.emplace(RwDefinitions::SPI_BYTES_READ, new PoolEntry({0})); localDataPoolMap.emplace(RwDefinitions::SPI_REG_OVERRUN_ERRORS, new PoolEntry({0})); localDataPoolMap.emplace(RwDefinitions::SPI_TOTAL_ERRORS, new PoolEntry({0})); - poolManager.subscribeForPeriodicPacket(statusSet.getSid(), false, 5.0, true); - poolManager.subscribeForPeriodicPacket(tmDataset.getSid(), false, 30.0, false); - poolManager.subscribeForPeriodicPacket(lastResetStatusSet.getSid(), false, 30.0, false); + poolManager.subscribeForDiagPeriodicPacket( + subdp::DiagnosticsHkPeriodicParams(statusSet.getSid(), false, 5.0)); + poolManager.subscribeForRegularPeriodicPacket( + subdp::RegularHkPeriodicParams(tmDataset.getSid(), false, 30.0)); + poolManager.subscribeForRegularPeriodicPacket( + subdp::RegularHkPeriodicParams(lastResetStatusSet.getSid(), false, 30.0)); return RETURN_OK; } diff --git a/mission/devices/SusHandler.cpp b/mission/devices/SusHandler.cpp index 3cc10339..102613c7 100644 --- a/mission/devices/SusHandler.cpp +++ b/mission/devices/SusHandler.cpp @@ -202,7 +202,8 @@ ReturnValue_t SusHandler::initializeLocalDataPool(localpool::DataPool &localData LocalDataPoolManager &poolManager) { localDataPoolMap.emplace(SUS::TEMPERATURE_C, &tempC); localDataPoolMap.emplace(SUS::CHANNEL_VEC, &channelVec); - poolManager.subscribeForPeriodicPacket(dataset.getSid(), false, 5.0, true); + poolManager.subscribeForDiagPeriodicPacket( + subdp::DiagnosticsHkPeriodicParams(dataset.getSid(), false, 5.0)); return HasReturnvaluesIF::RETURN_OK; } diff --git a/mission/devices/SyrlinksHkHandler.cpp b/mission/devices/SyrlinksHkHandler.cpp index 20d72995..67a015ec 100644 --- a/mission/devices/SyrlinksHkHandler.cpp +++ b/mission/devices/SyrlinksHkHandler.cpp @@ -621,9 +621,12 @@ ReturnValue_t SyrlinksHkHandler::initializeLocalDataPool(localpool::DataPool& lo localDataPoolMap.emplace(syrlinks::TEMP_BASEBAND_BOARD, new PoolEntry({0})); localDataPoolMap.emplace(syrlinks::TEMP_POWER_AMPLIFIER, new PoolEntry({0})); - poolManager.subscribeForPeriodicPacket(txDataset.getSid(), false, 5.0, true); - poolManager.subscribeForPeriodicPacket(rxDataset.getSid(), false, 5.0, true); - poolManager.subscribeForPeriodicPacket(temperatureSet.getSid(), false, 10.0, false); + poolManager.subscribeForDiagPeriodicPacket( + subdp::DiagnosticsHkPeriodicParams(txDataset.getSid(), false, 5.0)); + poolManager.subscribeForDiagPeriodicPacket( + subdp::DiagnosticsHkPeriodicParams(rxDataset.getSid(), false, 5.0)); + poolManager.subscribeForRegularPeriodicPacket( + subdp::RegularHkPeriodicParams(temperatureSet.getSid(), false, 10.0)); return HasReturnvaluesIF::RETURN_OK; } diff --git a/mission/devices/Tmp1075Handler.cpp b/mission/devices/Tmp1075Handler.cpp index 8cc99ee6..995b4f81 100644 --- a/mission/devices/Tmp1075Handler.cpp +++ b/mission/devices/Tmp1075Handler.cpp @@ -123,6 +123,7 @@ uint32_t Tmp1075Handler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { ReturnValue_t Tmp1075Handler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { localDataPoolMap.emplace(TMP1075::TEMPERATURE_C_TMP1075, new PoolEntry({0.0})); - poolManager.subscribeForPeriodicPacket(dataset.getSid(), false, 30.0, false); + poolManager.subscribeForRegularPeriodicPacket( + subdp::RegularHkPeriodicParams(dataset.getSid(), false, 30.0)); return HasReturnvaluesIF::RETURN_OK; } diff --git a/mission/tmtc/TmFunnel.cpp b/mission/tmtc/TmFunnel.cpp index 2eada527..30caa1c5 100644 --- a/mission/tmtc/TmFunnel.cpp +++ b/mission/tmtc/TmFunnel.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include @@ -9,8 +10,9 @@ object_id_t TmFunnel::downlinkDestination = objects::NO_OBJECT; object_id_t TmFunnel::storageDestination = objects::NO_OBJECT; -TmFunnel::TmFunnel(object_id_t objectId, uint32_t messageDepth, uint8_t reportReceptionVc) - : SystemObject(objectId), messageDepth(messageDepth), reportReceptionVc(reportReceptionVc) { +TmFunnel::TmFunnel(object_id_t objectId, CdsShortTimeStamper& timeReader, uint32_t messageDepth, + uint8_t reportReceptionVc) + : SystemObject(objectId), timeReader(timeReader), messageDepth(messageDepth), reportReceptionVc(reportReceptionVc) { auto mqArgs = MqArgs(objectId, static_cast(this)); tmQueue = QueueFactory::instance()->createMessageQueue( messageDepth, MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs); @@ -49,11 +51,16 @@ ReturnValue_t TmFunnel::handlePacket(TmTcMessage* message) { if (result != HasReturnvaluesIF::RETURN_OK) { return result; } - TmPacketPusC packet(packetData); - packet.setPacketSequenceCount(this->sourceSequenceCount); - sourceSequenceCount++; - sourceSequenceCount = sourceSequenceCount % SpacePacketBase::LIMIT_SEQUENCE_COUNT; - packet.setErrorControl(); + + PusTmZeroCopyWriter packet(timeReader, packetData, size); + result = packet.parseDataWithoutCrcCheck(); + if(result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + packet.setSequenceCount(sourceSequenceCount++); + sourceSequenceCount = sourceSequenceCount % ccsds::LIMIT_SEQUENCE_COUNT; + packet.updateErrorControl(); + result = tmQueue->sendToDefault(message); if (result != HasReturnvaluesIF::RETURN_OK) { @@ -107,7 +114,7 @@ ReturnValue_t TmFunnel::initialize() { AcceptsTelemetryIF* storageTarget = ObjectManager::instance()->get(storageDestination); if (storageTarget != nullptr) { - storageQueue->setDefaultDestination(storageTarget->getReportReceptionQueue()); + storageQueue->setDefaultDestination(storageTarget->getReportReceptionQueue(0)); } return SystemObject::initialize(); diff --git a/mission/tmtc/TmFunnel.h b/mission/tmtc/TmFunnel.h index f11dce63..98e581e9 100644 --- a/mission/tmtc/TmFunnel.h +++ b/mission/tmtc/TmFunnel.h @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -23,7 +24,7 @@ class TmFunnel : public AcceptsTelemetryIF, public ExecutableObjectIF, public Sy friend void(Factory::setStaticFrameworkObjectIds)(); public: - TmFunnel(object_id_t objectId, uint32_t messageDepth = 20, uint8_t reportReceptionVc = 0); + TmFunnel(object_id_t objectId, CdsShortTimeStamper& timeReader, uint32_t messageDepth = 20, uint8_t reportReceptionVc = 0); virtual ~TmFunnel(); virtual MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel = 0) override; @@ -35,6 +36,7 @@ class TmFunnel : public AcceptsTelemetryIF, public ExecutableObjectIF, public Sy static object_id_t storageDestination; private: + CdsShortTimeStamper& timeReader; uint32_t messageDepth = 0; uint8_t reportReceptionVc = 0; uint16_t sourceSequenceCount = 0;