event buffer request wip

This commit is contained in:
Jakob Meier
2022-04-13 11:56:37 +02:00
parent 7f51ffc8fb
commit bd8cd49117
12 changed files with 627 additions and 789 deletions

View File

@ -8,6 +8,7 @@
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
#include "mission/utility/ProgressPrinter.h"
#include "mission/utility/Timestamp.h"
#include "mission/utility/Filenaming.h"
StrHelper::StrHelper(object_id_t objectId) : SystemObject(objectId) {}
@ -181,7 +182,8 @@ ReturnValue_t StrHelper::performImageDownload() {
struct DownloadActionRequest downloadReq;
uint32_t size = 0;
uint32_t retries = 0;
std::string image = makeFullFilename(downloadImage.path, downloadImage.filename);
std::string image = Filenaming::generateAbsoluteFilename(downloadImage.path,
downloadImage.filename, timestamping);
std::ofstream file(image, std::ios_base::out);
if (not std::filesystem::exists(image)) {
return FILE_CREATION_FAILED;
@ -400,7 +402,8 @@ ReturnValue_t StrHelper::performFlashRead() {
uint32_t size = 0;
uint32_t retries = 0;
Timestamp timestamp;
std::string fullname = makeFullFilename(flashRead.path, flashRead.filename);
std::string fullname =
Filenaming::generateAbsoluteFilename(flashRead.path, flashRead.filename, timestamping);
std::ofstream file(fullname, std::ios_base::app | std::ios_base::out);
if (not std::filesystem::exists(fullname)) {
return FILE_CREATION_FAILED;
@ -588,14 +591,3 @@ ReturnValue_t StrHelper::unlockAndEraseRegions(uint32_t from, uint32_t to) {
}
return result;
}
std::string StrHelper::makeFullFilename(std::string path, std::string filename) {
std::string image;
Timestamp timestamp;
if (timestamping) {
image = path + "/" + timestamp.str() + filename;
} else {
image = path + "/" + filename;
}
return image;
}