WIP: SCEX Init #272
@ -217,11 +217,13 @@ void UartTestClass::scexPeriodic() {
|
|||||||
if (helper.getPacketCounter() == 1) {
|
if (helper.getPacketCounter() == 1) {
|
||||||
//countdown starten
|
//countdown starten
|
||||||
finishCountdown.resetTimer();
|
finishCountdown.resetTimer();
|
||||||
ofstream out("/tmp/scex-fram.bin",
|
fileId = gen_random(12);
|
||||||
ofstream::binary); // neues file anlegen wie oben ping
|
fileName = "/tmp/scex-fram_"+fileId+".bin";
|
||||||
|
ofstream out(fileName,
|
||||||
|
ofstream::binary); // neues file anlegen
|
||||||
} else {
|
} else {
|
||||||
ofstream out("/tmp/scex-fram.bin",
|
ofstream out(fileName,
|
||||||
ofstream::binary | ofstream::app); // an bestehendes file hinzufügen
|
ofstream::binary | ofstream::app); // an bestehendes file appenden
|
||||||
out << helper;
|
out << helper;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,3 +372,19 @@ void UartTestClass::foundDlePacketHandler(const DleParser::Context& ctx) {
|
|||||||
void UartTestClass::handleFoundDlePacket(uint8_t* packet, size_t len) {
|
void UartTestClass::handleFoundDlePacket(uint8_t* packet, size_t len) {
|
||||||
sif::info << "Detected DLE encoded packet with decoded size " << len << std::endl;
|
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);
|
static void foundDlePacketHandler(const DleParser::Context& ctx);
|
||||||
void handleFoundDlePacket(uint8_t* packet, size_t len);
|
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);
|
Countdown finishCountdown = Countdown(180 * 1000);
|
||||||
bool cmdSent = false;
|
bool cmdSent = false;
|
||||||
bool cmdDone = false;
|
bool cmdDone = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user