fileId
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Irini Kosmidou 2022-04-29 12:26:18 +02:00
parent e11c84a5ed
commit e16e6c2d17
2 changed files with 25 additions and 4 deletions

View File

@ -217,11 +217,13 @@ void UartTestClass::scexPeriodic() {
if (helper.getPacketCounter() == 1) {
//countdown starten
finishCountdown.resetTimer();
ofstream out("/tmp/scex-fram.bin",
ofstream::binary); // neues file anlegen wie oben ping
fileId = gen_random(12);
fileName = "/tmp/scex-fram_"+fileId+".bin";
ofstream out(fileName,
ofstream::binary); // neues file anlegen
} else {
ofstream out("/tmp/scex-fram.bin",
ofstream::binary | ofstream::app); // an bestehendes file hinzufügen
ofstream out(fileName,
ofstream::binary | ofstream::app); // an bestehendes file appenden
out << helper;
}
@ -370,3 +372,19 @@ void UartTestClass::foundDlePacketHandler(const DleParser::Context& ctx) {
void UartTestClass::handleFoundDlePacket(uint8_t* packet, size_t len) {
sif::info << "Detected DLE encoded packet with decoded size " << len << std::endl;
}
std::string gen_random(const int len) {
static const char alphanum[] =
"0123456789"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz";
std::string tmp_s;
tmp_s.reserve(len);
for (int i = 0; i < len; ++i) {
tmp_s += alphanum[rand() % (sizeof(alphanum) - 1)];
}
return tmp_s;
}

View File

@ -46,7 +46,10 @@ class UartTestClass : public TestTask {
static void foundDlePacketHandler(const DleParser::Context& ctx);
void handleFoundDlePacket(uint8_t* packet, size_t len);
std::string gen_random(const int len);
std::string fileId = "";
std::string fileName = "";
Countdown finishCountdown = Countdown(180 * 1000);
bool cmdSent = false;
bool cmdDone = false;