Merge branch 'irini' into scex-additions
This commit is contained in:
commit
68fdb68fe6
@ -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();
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user