Merge branch 'irini' into scex-additions
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Irini Kosmidou 2022-09-29 23:38:59 +02:00
commit 68fdb68fe6
2 changed files with 19 additions and 5 deletions

View File

@ -6,7 +6,9 @@
#include <algorithm> #include <algorithm>
#include <ctime> #include <ctime>
#include <iostream> #include <iostream>
#include <fstream>
#include <random> #include <random>
#include <filesystem>
#include "fsfw/globalfunctions/CRC.h" #include "fsfw/globalfunctions/CRC.h"
#include "mission/devices/devicedefinitions/ScexDefinitions.h" #include "mission/devices/devicedefinitions/ScexDefinitions.h"
@ -195,9 +197,8 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons
fileId = date_time_string(); fileId = date_time_string();
std::ostringstream oss; std::ostringstream oss;
auto prefix = sdcMan.getCurrentMountPrefix(); auto prefix = sdcMan.getCurrentMountPrefix();
oss << prefix << "/scex-" << cmdName << fileId << ".bin"; oss << prefix << "/scex/scex-" << cmdName << fileId << ".bin";
fileName = oss.str(); fileName = oss.str();
sif::info << "ScexDeviceHandler::interpretDeviceReply: FileName: " << fileName << std::endl;
ofstream out(fileName, ofstream::binary); ofstream out(fileName, ofstream::binary);
if (out.bad()) { if (out.bad()) {
sif::error << "ScexDeviceHandler::interpretDeviceReply: Could not open file " << fileName 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(); fileId = date_time_string();
std::ostringstream oss; std::ostringstream oss;
auto prefix = sdcMan.getCurrentMountPrefix(); auto prefix = sdcMan.getCurrentMountPrefix();
oss << prefix << "/scex-" << cmdName << fileId << ".bin"; oss << prefix << "/scex/scex-" << cmdName << fileId << ".bin";
fileName = oss.str(); fileName = oss.str();
sif::info << "ScexDeviceHandler::interpretDeviceReply: FileName: " << fileName
<< std::endl; // TODO remove
fileNameSet = true; fileNameSet = true;
ofstream out(fileName, ofstream::binary); ofstream out(fileName, ofstream::binary);
if (out.bad()) { if (out.bad()) {
@ -349,4 +348,18 @@ void ScexDeviceHandler::modeChanged() {}
void ScexDeviceHandler::setPowerSwitcher(PowerSwitchIF& powerSwitcher, power::Switch_t switchId) { void ScexDeviceHandler::setPowerSwitcher(PowerSwitchIF& powerSwitcher, power::Switch_t switchId) {
DeviceHandlerBase::setPowerSwitcher(&powerSwitcher); DeviceHandlerBase::setPowerSwitcher(&powerSwitcher);
this->switchId = switchId; 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();
} }

View File

@ -57,6 +57,7 @@ class ScexDeviceHandler : public DeviceHandlerBase {
ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap, ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) override; LocalDataPoolManager &poolManager) override;
ReturnValue_t initializeAfterTaskCreation() override;
void modeChanged() override; void modeChanged() override;
}; };