This commit is contained in:
parent
e11c84a5ed
commit
e16e6c2d17
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user