From 43cda300e32c4d0685e74697c97c02ff2b66a717 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Thu, 29 Sep 2022 19:38:19 +0200 Subject: [PATCH 1/2] scex directory --- fsfw | 2 +- mission/devices/ScexDeviceHandler.cpp | 20 ++++++++++++++++++-- mission/devices/ScexDeviceHandler.h | 1 + tmtc | 2 +- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/fsfw b/fsfw index 808e3e04..7e0a5d5a 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 808e3e0462999d7caa1b6834174140dbbeb8b01c +Subproject commit 7e0a5d5a9e4f38c6d818bbdd5b44d34d8007eb1e diff --git a/mission/devices/ScexDeviceHandler.cpp b/mission/devices/ScexDeviceHandler.cpp index 5dddec3e..d1f18138 100644 --- a/mission/devices/ScexDeviceHandler.cpp +++ b/mission/devices/ScexDeviceHandler.cpp @@ -6,7 +6,9 @@ #include #include #include +#include #include +#include #include "fsfw/globalfunctions/CRC.h" #include "mission/devices/devicedefinitions/ScexDefinitions.h" @@ -195,7 +197,7 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons fileId = date_time_string(); std::ostringstream oss; auto prefix = sdcMan.getCurrentMountPrefix(); - oss << prefix << "/scex-" << cmdName << fileId << ".bin"; + oss << prefix << "/scex/scex-" << cmdName << fileId << ".bin"; fileName = oss.str(); sif::info << "ScexDeviceHandler::interpretDeviceReply: FileName: " << fileName << std::endl; ofstream out(fileName, ofstream::binary); @@ -212,7 +214,7 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons fileId = date_time_string(); std::ostringstream oss; auto prefix = sdcMan.getCurrentMountPrefix(); - oss << prefix << "/scex-" << cmdName << fileId << ".bin"; + oss << prefix << "/scex/scex-" << cmdName << fileId << ".bin"; fileName = oss.str(); sif::info << "ScexDeviceHandler::interpretDeviceReply: FileName: " << fileName << std::endl; // TODO remove @@ -349,4 +351,18 @@ void ScexDeviceHandler::modeChanged() {} void ScexDeviceHandler::setPowerSwitcher(PowerSwitchIF& powerSwitcher, power::Switch_t switchId) { DeviceHandlerBase::setPowerSwitcher(&powerSwitcher); this->switchId = switchId; + +} + +ReturnValue_t ScexDeviceHandler::initializeAfterTaskCreation() { + // hier checken ob `/ordner` existiert und wenn nicht erstellen + auto mntPrefix = sdcMan.getCurrentMountPrefix(); + std::filesystem::path fullFilePath = mntPrefix; + fullFilePath /= "scex"; + bool fileExists = std::filesystem::exists(fullFilePath); + + if(not fileExists){ + std::filesystem::create_directory(fullFilePath); + } + return DeviceHandlerBase::initializeAfterTaskCreation(); } diff --git a/mission/devices/ScexDeviceHandler.h b/mission/devices/ScexDeviceHandler.h index 6cf2492b..92136781 100644 --- a/mission/devices/ScexDeviceHandler.h +++ b/mission/devices/ScexDeviceHandler.h @@ -57,6 +57,7 @@ class ScexDeviceHandler : public DeviceHandlerBase { ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) override; + ReturnValue_t initializeAfterTaskCreation() override; void modeChanged() override; }; diff --git a/tmtc b/tmtc index a7714747..6caf0624 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit a7714747bc45dfa6a9ccb41cc6eb890b21ca0481 +Subproject commit 6caf06248b73f9328c9069d627a5b387a3ac14b3 From 9c07a266155b36dcf4b8b1b297219dec9e1372ea Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Thu, 29 Sep 2022 19:50:12 +0200 Subject: [PATCH 2/2] commets removed --- mission/devices/ScexDeviceHandler.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mission/devices/ScexDeviceHandler.cpp b/mission/devices/ScexDeviceHandler.cpp index d1f18138..156dd9b8 100644 --- a/mission/devices/ScexDeviceHandler.cpp +++ b/mission/devices/ScexDeviceHandler.cpp @@ -199,7 +199,6 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons auto prefix = sdcMan.getCurrentMountPrefix(); oss << prefix << "/scex/scex-" << cmdName << fileId << ".bin"; fileName = oss.str(); - sif::info << "ScexDeviceHandler::interpretDeviceReply: FileName: " << fileName << std::endl; ofstream out(fileName, ofstream::binary); if (out.bad()) { sif::error << "ScexDeviceHandler::interpretDeviceReply: Could not open file " << fileName @@ -216,8 +215,6 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons auto prefix = sdcMan.getCurrentMountPrefix(); oss << prefix << "/scex/scex-" << cmdName << fileId << ".bin"; fileName = oss.str(); - sif::info << "ScexDeviceHandler::interpretDeviceReply: FileName: " << fileName - << std::endl; // TODO remove fileNameSet = true; ofstream out(fileName, ofstream::binary); if (out.bad()) { @@ -355,7 +352,7 @@ void ScexDeviceHandler::setPowerSwitcher(PowerSwitchIF& powerSwitcher, power::Sw } ReturnValue_t ScexDeviceHandler::initializeAfterTaskCreation() { - // hier checken ob `/ordner` existiert und wenn nicht erstellen + auto mntPrefix = sdcMan.getCurrentMountPrefix(); std::filesystem::path fullFilePath = mntPrefix; fullFilePath /= "scex";