scexDataHandler
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit

This commit is contained in:
Irini Kosmidou
2022-04-29 15:46:16 +02:00
parent 57f3103e52
commit f2cb43a52f
10 changed files with 246 additions and 20 deletions

View File

@ -17,6 +17,7 @@
#include "fsfw/globalfunctions/DleEncoder.h"
#include "fsfw/globalfunctions/arrayprinter.h"
#include "fsfw/serviceinterface.h"
#include "mission/devices/devicedefinitions/ScexDefinitions.h"
#define GPS_REPLY_WIRETAPPING 0
@ -28,7 +29,7 @@ UartTestClass::UartTestClass(object_id_t objectId, ScexUartReader* reader)
: TestTask(objectId), reader(reader) {
mode = TestModes::SCEX;
scexMode = ScexModes::READER_TASK;
currCmd = scex::ScexCmds::FRAM;
currCmd = scex::Cmds::FRAM;
if (scexMode == ScexModes::SIMPLE) {
auto encodingBuf = new std::array<uint8_t, 4096>;
DleParser::BufPair encodingBufPair{encodingBuf->data(), encodingBuf->size()};
@ -219,7 +220,7 @@ void UartTestClass::scexPeriodic() {
// helper.getTotalPacketCounter()) { nach 2min reader->finish();
if (helper.getCmd() == FRAM) {
if (not fileNameSet) {
fileId = random_string(12);
fileId = random_string(6);
fileName = "/tmp/scex-fram_" + fileId + ".bin";
fileNameSet = true;
}
@ -235,8 +236,9 @@ void UartTestClass::scexPeriodic() {
}
if (finishCountdown.hasTimedOut()) {
triggerEvent(scex::EXPERIMENT_TIMEDOUT, currCmd, 0);
reader->finish();
sif::warning << "Reader countdown expired" << endl;
sif::warning << "Reader timeout" << endl;
cmdDone = true;
fileNameSet = false;
}
@ -247,7 +249,7 @@ void UartTestClass::scexPeriodic() {
sif::info << "Reader is finished" << endl;
cmdDone = true;
fileNameSet = false;
if (helper.getCmd() == scex::ScexCmds::PING) {
if (helper.getCmd() == scex::Cmds::PING) {
cmdSent = false;
fileNameSet = true; // to not generate everytime new file
}
@ -344,7 +346,7 @@ void UartTestClass::scexSimplePeriodic() {
<< bytesRead << std::endl;
} else if (bytesRead > 0) {
dleParser->passData(recBuf.data(), bytesRead);
if (currCmd == ScexCmds::PING) {
if (currCmd == Cmds::PING) {
cmdDone = true;
cmdSent = false;
}
@ -353,8 +355,7 @@ void UartTestClass::scexSimplePeriodic() {
}
}
int UartTestClass::prepareScexCmd(scex::ScexCmds cmd, bool tempCheck, uint8_t* cmdBuf,
size_t* len) {
int UartTestClass::prepareScexCmd(scex::Cmds cmd, bool tempCheck, uint8_t* cmdBuf, size_t* len) {
using namespace scex;
// Send command
cmdBuf[0] = scex::createCmdByte(cmd, false);