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] # [unreleased]
## Changed
- SCEX filename updates. Also use T as the file ID / date separator between date and time.
# [v1.41.0] 2023-03-28 # [v1.41.0] 2023-03-28
eive-tmtc: v2.20.0 eive-tmtc: v2.20.0

View File

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

View File

@ -13,6 +13,14 @@ class SdCardMountedIF;
class ScexDeviceHandler : public DeviceHandlerBase { class ScexDeviceHandler : public DeviceHandlerBase {
public: 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, ScexDeviceHandler(object_id_t objectId, ScexUartReader &reader, CookieIF *cookie,
SdCardMountedIF &sdcMan); SdCardMountedIF &sdcMan);
void setPowerSwitcher(PowerSwitchIF &powerSwitcher, power::Switch_t switchId); void setPowerSwitcher(PowerSwitchIF &powerSwitcher, power::Switch_t switchId);