Merge pull request 'SCEX update' (#538) from tweaks_scex_filenames into develop
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

Reviewed-on: #538
This commit is contained in:
Robin Müller 2023-03-29 17:37:06 +02:00
commit 5903b3ef60
3 changed files with 24 additions and 12 deletions

View File

@ -16,6 +16,10 @@ will consitute of a breaking change warranting a new major release:
# [unreleased]
## Changed
- SCEX filename updates. Also use T as the file ID / date separator between date and time.
# [v1.41.0] 2023-03-28
eive-tmtc: v2.20.0

View File

@ -205,7 +205,7 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons
using namespace scex;
ReturnValue_t status = OK;
auto oneFileHandler = [&](std::string cmdName) {
auto oneFileHandler = [&](const char* cmdName) {
auto activeSd = sdcMan.getActiveSdCard();
if (not activeSd) {
return HasFileSystemIF::FILESYSTEM_INACTIVE;
@ -216,7 +216,7 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons
if (prefix == nullptr) {
return returnvalue::FAILED;
}
oss << prefix << "/scex/scex-" << cmdName << fileId << ".bin";
oss << prefix << "/scex/scex-" << cmdName << "-" << fileId << ".bin";
fileName = oss.str();
ofstream out(fileName, ofstream::binary);
if (out.bad()) {
@ -227,7 +227,7 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons
out << helper;
return OK;
};
auto multiFileHandler = [&](std::string cmdName) {
auto multiFileHandler = [&](const char* cmdName) {
if ((helper.getPacketCounter() == 1) or (not fileNameSet)) {
auto activeSd = sdcMan.getActiveSdCard();
if (not activeSd) {
@ -264,31 +264,31 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons
id = helper.getCmd();
switch (id) {
case (PING): {
status = oneFileHandler("ping_");
status = oneFileHandler(PING_IDLE_BASE_NAME);
break;
}
case (ION_CMD): {
status = oneFileHandler("ion_");
status = oneFileHandler(ION_BASE_NAME);
break;
}
case (TEMP_CMD): {
status = oneFileHandler("temp_");
status = oneFileHandler(TEMPERATURE_BASE_NAME);
break;
}
case (EXP_STATUS_CMD): {
status = oneFileHandler("exp_status_");
status = oneFileHandler(EXP_STATUS_BASE_NAME);
break;
}
case (FRAM): {
status = multiFileHandler("fram_");
status = multiFileHandler(FRAM_BASE_NAME);
break;
}
case (ONE_CELL): {
status = multiFileHandler("one_cell_");
status = multiFileHandler(ONE_CELL_BASE_NAME);
break;
}
case (ALL_CELLS_CMD): {
status = multiFileHandler("multi_cell_");
status = multiFileHandler(ALL_CELLS_BASE_NAME);
break;
}
default:
@ -362,9 +362,9 @@ std::string ScexDeviceHandler::date_time_string() {
ostringstream oss(std::ostringstream::ate);
if (tod.hour < 10) {
oss << tod.year << tod.month << tod.day << "_0" << tod.hour;
oss << tod.year << tod.month << tod.day << "T0" << tod.hour;
} else {
oss << tod.year << tod.month << tod.day << "_" << tod.hour;
oss << tod.year << tod.month << tod.day << "T" << tod.hour;
}
if (tod.minute < 10) {
oss << 0 << tod.minute;

View File

@ -13,6 +13,14 @@ class SdCardMountedIF;
class ScexDeviceHandler : public DeviceHandlerBase {
public:
static constexpr char *FRAM_BASE_NAME = "framContent";
static constexpr char *ION_BASE_NAME = "ion";
static constexpr char *TEMPERATURE_BASE_NAME = "temperature";
static constexpr char *EXP_STATUS_BASE_NAME = "expStatus";
static constexpr char *ONE_CELL_BASE_NAME = "oneCell";
static constexpr char *ALL_CELLS_BASE_NAME = "allCells";
static constexpr char *PING_IDLE_BASE_NAME = "pingIdle";
ScexDeviceHandler(object_id_t objectId, ScexUartReader &reader, CookieIF *cookie,
SdCardMountedIF &sdcMan);
void setPowerSwitcher(PowerSwitchIF &powerSwitcher, power::Switch_t switchId);