diff --git a/mission/devices/ScexDeviceHandler.cpp b/mission/devices/ScexDeviceHandler.cpp index 5dddec3e..156dd9b8 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,9 +197,8 @@ 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); if (out.bad()) { sif::error << "ScexDeviceHandler::interpretDeviceReply: Could not open file " << fileName @@ -212,10 +213,8 @@ 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 fileNameSet = true; ofstream out(fileName, ofstream::binary); if (out.bad()) { @@ -349,4 +348,18 @@ void ScexDeviceHandler::modeChanged() {} void ScexDeviceHandler::setPowerSwitcher(PowerSwitchIF& powerSwitcher, power::Switch_t switchId) { DeviceHandlerBase::setPowerSwitcher(&powerSwitcher); this->switchId = switchId; + +} + +ReturnValue_t ScexDeviceHandler::initializeAfterTaskCreation() { + + 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 ce051b89..0c02ded8 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; };