Merge branch 'develop' into str_tweaks_param_update
Some checks are pending
EIVE/eive-obsw/pipeline/pr-develop Build queued...
Some checks are pending
EIVE/eive-obsw/pipeline/pr-develop Build queued...
This commit is contained in:
commit
d2f11b1860
@ -34,6 +34,8 @@ will consitute of a breaking change warranting a new major release:
|
|||||||
- Bugfix for side lane transitions of the dual lane assemblies, which only worked when the
|
- Bugfix for side lane transitions of the dual lane assemblies, which only worked when the
|
||||||
assembly was directly commanded.
|
assembly was directly commanded.
|
||||||
- Syrlinks Handler: Bugfix so transition command is only sent once.
|
- Syrlinks Handler: Bugfix so transition command is only sent once.
|
||||||
|
- SCEX file name bug: Create file name time stamp with `strftime` similarly to how it's done
|
||||||
|
for the persistent TM store.
|
||||||
|
|
||||||
## Added
|
## Added
|
||||||
|
|
||||||
|
@ -15,6 +15,9 @@ static constexpr char OBSW_VERSION_FILE_NAME[] = "obsw_version.txt";
|
|||||||
static constexpr char OBSW_PATH[] = "/usr/bin/eive-obsw";
|
static constexpr char OBSW_PATH[] = "/usr/bin/eive-obsw";
|
||||||
static constexpr char OBSW_VERSION_FILE_PATH[] = "/usr/share/eive-obsw/obsw_version.txt";
|
static constexpr char OBSW_VERSION_FILE_PATH[] = "/usr/share/eive-obsw/obsw_version.txt";
|
||||||
|
|
||||||
|
// ISO8601 timestamp.
|
||||||
|
static constexpr char FILE_DATE_FORMAT[] = "%FT%H%M%SZ";
|
||||||
|
|
||||||
static constexpr uint16_t EIVE_PUS_APID = 0x65;
|
static constexpr uint16_t EIVE_PUS_APID = 0x65;
|
||||||
static constexpr uint16_t EIVE_CFDP_APID = 0x66;
|
static constexpr uint16_t EIVE_CFDP_APID = 0x66;
|
||||||
static constexpr uint16_t EIVE_LOCAL_CFDP_ENTITY_ID = EIVE_CFDP_APID;
|
static constexpr uint16_t EIVE_LOCAL_CFDP_ENTITY_ID = EIVE_CFDP_APID;
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
|
#include "eive/definitions.h"
|
||||||
#include "fsfw/globalfunctions/CRC.h"
|
#include "fsfw/globalfunctions/CRC.h"
|
||||||
|
|
||||||
using std::ofstream;
|
using std::ofstream;
|
||||||
@ -27,6 +28,7 @@ void ScexDeviceHandler::doStartUp() { setMode(MODE_ON); }
|
|||||||
void ScexDeviceHandler::doShutDown() {
|
void ScexDeviceHandler::doShutDown() {
|
||||||
reader.reset();
|
reader.reset();
|
||||||
commandActive = false;
|
commandActive = false;
|
||||||
|
fileNameSet = false;
|
||||||
multiFileFinishOutstanding = false;
|
multiFileFinishOutstanding = false;
|
||||||
setMode(_MODE_POWER_DOWN);
|
setMode(_MODE_POWER_DOWN);
|
||||||
}
|
}
|
||||||
@ -205,50 +207,13 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons
|
|||||||
using namespace scex;
|
using namespace scex;
|
||||||
|
|
||||||
ReturnValue_t status = OK;
|
ReturnValue_t status = OK;
|
||||||
auto oneFileHandler = [&](const char* cmdName) {
|
|
||||||
auto activeSd = sdcMan.getActiveSdCard();
|
|
||||||
if (not activeSd) {
|
|
||||||
return HasFileSystemIF::FILESYSTEM_INACTIVE;
|
|
||||||
}
|
|
||||||
fileId = date_time_string();
|
|
||||||
std::ostringstream oss;
|
|
||||||
auto prefix = sdcMan.getCurrentMountPrefix();
|
|
||||||
if (prefix == nullptr) {
|
|
||||||
return returnvalue::FAILED;
|
|
||||||
}
|
|
||||||
oss << prefix << "/scex/scex-" << cmdName << "-" << fileId << ".bin";
|
|
||||||
fileName = oss.str();
|
|
||||||
ofstream out(fileName, ofstream::binary);
|
|
||||||
if (out.bad()) {
|
|
||||||
sif::error << "ScexDeviceHandler::interpretDeviceReply: Could not open file " << fileName
|
|
||||||
<< std::endl;
|
|
||||||
return FAILED;
|
|
||||||
}
|
|
||||||
out << helper;
|
|
||||||
return OK;
|
|
||||||
};
|
|
||||||
auto multiFileHandler = [&](const char* cmdName) {
|
auto multiFileHandler = [&](const char* cmdName) {
|
||||||
if ((helper.getPacketCounter() == 1) or (not fileNameSet)) {
|
if ((helper.getPacketCounter() == 1) or (not fileNameSet)) {
|
||||||
auto activeSd = sdcMan.getActiveSdCard();
|
status = generateNewScexFile(cmdName);
|
||||||
if (not activeSd) {
|
if(status != returnvalue::OK) {
|
||||||
return HasFileSystemIF::FILESYSTEM_INACTIVE;
|
return status;
|
||||||
}
|
}
|
||||||
fileId = date_time_string();
|
|
||||||
std::ostringstream oss;
|
|
||||||
auto prefix = sdcMan.getCurrentMountPrefix();
|
|
||||||
if (prefix == nullptr) {
|
|
||||||
return returnvalue::FAILED;
|
|
||||||
}
|
|
||||||
oss << prefix << "/scex/scex-" << cmdName << fileId << ".bin";
|
|
||||||
fileName = oss.str();
|
|
||||||
fileNameSet = true;
|
fileNameSet = true;
|
||||||
ofstream out(fileName, ofstream::binary);
|
|
||||||
if (out.bad()) {
|
|
||||||
sif::error << "ScexDeviceHandler::handleValidReply: Could not open file " << fileName
|
|
||||||
<< std::endl;
|
|
||||||
return FAILED;
|
|
||||||
}
|
|
||||||
out << helper;
|
|
||||||
} else {
|
} else {
|
||||||
ofstream out(fileName,
|
ofstream out(fileName,
|
||||||
ofstream::binary | ofstream::app); // append
|
ofstream::binary | ofstream::app); // append
|
||||||
@ -264,19 +229,19 @@ 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_IDLE_BASE_NAME);
|
status = generateNewScexFile(PING_IDLE_BASE_NAME);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (ION_CMD): {
|
case (ION_CMD): {
|
||||||
status = oneFileHandler(ION_BASE_NAME);
|
status = generateNewScexFile(ION_BASE_NAME);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (TEMP_CMD): {
|
case (TEMP_CMD): {
|
||||||
status = oneFileHandler(TEMPERATURE_BASE_NAME);
|
status = generateNewScexFile(TEMPERATURE_BASE_NAME);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (EXP_STATUS_CMD): {
|
case (EXP_STATUS_CMD): {
|
||||||
status = oneFileHandler(EXP_STATUS_BASE_NAME);
|
status = generateNewScexFile(EXP_STATUS_BASE_NAME);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (FRAM): {
|
case (FRAM): {
|
||||||
@ -354,36 +319,40 @@ ReturnValue_t ScexDeviceHandler::initializeLocalDataPool(localpool::DataPool& lo
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ScexDeviceHandler::date_time_string() {
|
ReturnValue_t ScexDeviceHandler::generateNewScexFile(const char* cmdName) {
|
||||||
using namespace std;
|
char timeString[64]{};
|
||||||
string date_time;
|
auto activeSd = sdcMan.getActiveSdCard();
|
||||||
Clock::TimeOfDay_t tod;
|
if (not activeSd) {
|
||||||
Clock::getDateAndTime(&tod);
|
return HasFileSystemIF::FILESYSTEM_INACTIVE;
|
||||||
ostringstream oss(std::ostringstream::ate);
|
|
||||||
|
|
||||||
if (tod.hour < 10) {
|
|
||||||
oss << tod.year << tod.month << tod.day << "T0" << tod.hour;
|
|
||||||
} else {
|
|
||||||
oss << tod.year << tod.month << tod.day << "T" << tod.hour;
|
|
||||||
}
|
|
||||||
if (tod.minute < 10) {
|
|
||||||
oss << 0 << tod.minute;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
oss << tod.minute;
|
|
||||||
}
|
|
||||||
if (tod.second < 10) {
|
|
||||||
oss << 0 << tod.second;
|
|
||||||
} else {
|
|
||||||
oss << tod.second;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
date_time = oss.str();
|
std::ostringstream oss;
|
||||||
|
auto prefix = sdcMan.getCurrentMountPrefix();
|
||||||
return date_time;
|
if (prefix == nullptr) {
|
||||||
|
return returnvalue::FAILED;
|
||||||
|
}
|
||||||
|
timeval tv;
|
||||||
|
Clock::getClock_timeval(&tv);
|
||||||
|
time_t epoch = tv.tv_sec;
|
||||||
|
struct tm* time = gmtime(&epoch);
|
||||||
|
size_t writtenBytes = strftime(reinterpret_cast<char*>(timeString), sizeof(timeString),
|
||||||
|
config::FILE_DATE_FORMAT, time);
|
||||||
|
if (writtenBytes == 0) {
|
||||||
|
sif::error << "PersistentTmStore::createMostRecentFile: Could not create file timestamp"
|
||||||
|
<< std::endl;
|
||||||
|
return returnvalue::FAILED;
|
||||||
|
}
|
||||||
|
oss << prefix << "/scex/scex-" << cmdName << "-" << timeString << ".bin";
|
||||||
|
fileName = oss.str();
|
||||||
|
ofstream out(fileName, ofstream::binary);
|
||||||
|
if (out.bad()) {
|
||||||
|
sif::error << "ScexDeviceHandler::interpretDeviceReply: Could not open file " << fileName
|
||||||
|
<< std::endl;
|
||||||
|
return FAILED;
|
||||||
|
}
|
||||||
|
out << helper;
|
||||||
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
@ -43,8 +43,6 @@ class ScexDeviceHandler : public DeviceHandlerBase {
|
|||||||
SdCardMountedIF &sdcMan;
|
SdCardMountedIF &sdcMan;
|
||||||
Countdown finishCountdown = Countdown(LONG_CD);
|
Countdown finishCountdown = Countdown(LONG_CD);
|
||||||
|
|
||||||
std::string date_time_string();
|
|
||||||
|
|
||||||
// DeviceHandlerBase private function implementation
|
// DeviceHandlerBase private function implementation
|
||||||
void doStartUp() override;
|
void doStartUp() override;
|
||||||
void doShutDown() override;
|
void doShutDown() override;
|
||||||
@ -67,7 +65,8 @@ 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;
|
ReturnValue_t initializeAfterTaskCreation() override;
|
||||||
void modeChanged() override;
|
|
||||||
|
ReturnValue_t generateNewScexFile(const char *cmdName);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* MISSION_PAYLOAD_SCEXDEVICEHANDLER_H_ */
|
#endif /* MISSION_PAYLOAD_SCEXDEVICEHANDLER_H_ */
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
#include "eive/definitions.h"
|
||||||
#include "fsfw/ipc/CommandMessage.h"
|
#include "fsfw/ipc/CommandMessage.h"
|
||||||
#include "fsfw/ipc/QueueFactory.h"
|
#include "fsfw/ipc/QueueFactory.h"
|
||||||
#include "fsfw/tmstorage/TmStoreMessage.h"
|
#include "fsfw/tmstorage/TmStoreMessage.h"
|
||||||
@ -289,7 +290,7 @@ ReturnValue_t PersistentTmStore::pathToTime(const std::filesystem::path& path, s
|
|||||||
auto pathStr = path.string();
|
auto pathStr = path.string();
|
||||||
size_t splitChar = pathStr.find('_');
|
size_t splitChar = pathStr.find('_');
|
||||||
auto timeOnlyStr = pathStr.substr(splitChar + 1);
|
auto timeOnlyStr = pathStr.substr(splitChar + 1);
|
||||||
if (nullptr == strptime(timeOnlyStr.c_str(), FILE_DATE_FORMAT, &time)) {
|
if (nullptr == strptime(timeOnlyStr.c_str(), config::FILE_DATE_FORMAT, &time)) {
|
||||||
return returnvalue::FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
@ -306,7 +307,7 @@ ReturnValue_t PersistentTmStore::createMostRecentFile(std::optional<uint8_t> suf
|
|||||||
time_t epoch = currentTv.tv_sec;
|
time_t epoch = currentTv.tv_sec;
|
||||||
struct tm* time = gmtime(&epoch);
|
struct tm* time = gmtime(&epoch);
|
||||||
size_t writtenBytes = strftime(reinterpret_cast<char*>(fileBuf.data() + currentIdx),
|
size_t writtenBytes = strftime(reinterpret_cast<char*>(fileBuf.data() + currentIdx),
|
||||||
fileBuf.size(), FILE_DATE_FORMAT, time);
|
fileBuf.size(), config::FILE_DATE_FORMAT, time);
|
||||||
if (writtenBytes == 0) {
|
if (writtenBytes == 0) {
|
||||||
sif::error << "PersistentTmStore::createMostRecentFile: Could not create file timestamp"
|
sif::error << "PersistentTmStore::createMostRecentFile: Could not create file timestamp"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
@ -85,8 +85,6 @@ class PersistentTmStore : public TmStoreFrontendSimpleIF, public SystemObject {
|
|||||||
private:
|
private:
|
||||||
static constexpr uint8_t MAX_FILES_IN_ONE_SECOND = 10;
|
static constexpr uint8_t MAX_FILES_IN_ONE_SECOND = 10;
|
||||||
static constexpr size_t MAX_FILESIZE = 8192;
|
static constexpr size_t MAX_FILESIZE = 8192;
|
||||||
// ISO8601 timestamp.
|
|
||||||
static constexpr char FILE_DATE_FORMAT[] = "%FT%H%M%SZ";
|
|
||||||
|
|
||||||
//! [EXPORT] : [SKIP]
|
//! [EXPORT] : [SKIP]
|
||||||
static constexpr ReturnValue_t INVALID_FILE_DETECTED_AND_DELETED = returnvalue::makeCode(2, 1);
|
static constexpr ReturnValue_t INVALID_FILE_DETECTED_AND_DELETED = returnvalue::makeCode(2, 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user