scexDataHandler
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
This commit is contained in:
@ -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);
|
||||
|
@ -39,7 +39,7 @@ class UartTestClass : public TestTask {
|
||||
|
||||
void scexInit();
|
||||
void scexPeriodic();
|
||||
int prepareScexCmd(scex::ScexCmds cmd, bool tempCheck, uint8_t* cmdBuf, size_t* len);
|
||||
int prepareScexCmd(scex::Cmds cmd, bool tempCheck, uint8_t* cmdBuf, size_t* len);
|
||||
|
||||
void scexSimplePeriodic();
|
||||
void scexSimpleInit();
|
||||
@ -54,7 +54,7 @@ class UartTestClass : public TestTask {
|
||||
Countdown finishCountdown = Countdown(180 * 1000);
|
||||
bool cmdSent = false;
|
||||
bool cmdDone = false;
|
||||
scex::ScexCmds currCmd = scex::ScexCmds::PING;
|
||||
scex::Cmds currCmd = scex::Cmds::PING;
|
||||
TestModes mode = TestModes::GPS;
|
||||
DleEncoder dleEncoder = DleEncoder();
|
||||
UartCookie* uartCookie = nullptr;
|
||||
@ -67,7 +67,7 @@ class UartTestClass : public TestTask {
|
||||
std::array<uint8_t, 64> cmdBuf = {};
|
||||
std::array<uint8_t, 4096> recBuf = {};
|
||||
ScexDleParser* dleParser;
|
||||
scex::ScexCmds cmdHelper;
|
||||
scex::Cmds cmdHelper;
|
||||
uint8_t recvCnt = 0;
|
||||
};
|
||||
|
||||
|
@ -23,7 +23,7 @@ ReturnValue_t ScexHelper::deSerialize(const uint8_t** buffer, size_t* size,
|
||||
}
|
||||
start = *buffer;
|
||||
cmdByteRaw = **buffer;
|
||||
cmd = static_cast<scex::ScexCmds>((cmdByteRaw >> 1) & 0b11111);
|
||||
cmd = static_cast<scex::Cmds>((cmdByteRaw >> 1) & 0b11111);
|
||||
|
||||
*buffer += 1;
|
||||
packetCounter = **buffer;
|
||||
@ -35,7 +35,7 @@ ReturnValue_t ScexHelper::deSerialize(const uint8_t** buffer, size_t* size,
|
||||
payloadLen = (**buffer << 8) | *(*buffer + 1);
|
||||
|
||||
*buffer += 2;
|
||||
totalPacketLen = payloadLen + HEADER_LEN + CRC_LEN;
|
||||
totalPacketLen = payloadLen + scex::HEADER_LEN + scex::CRC_LEN;
|
||||
if (totalPacketLen >= *size) {
|
||||
return STREAM_TOO_SHORT;
|
||||
}
|
||||
@ -47,7 +47,7 @@ ReturnValue_t ScexHelper::deSerialize(const uint8_t** buffer, size_t* size,
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
scex::ScexCmds ScexHelper::getCmd() const { return cmd; }
|
||||
scex::Cmds ScexHelper::getCmd() const { return cmd; }
|
||||
|
||||
uint8_t ScexHelper::getCmdByteRaw() const { return cmdByteRaw; }
|
||||
|
||||
|
@ -13,8 +13,7 @@
|
||||
class ScexHelper : public HasReturnvaluesIF, public SerializeIF {
|
||||
public:
|
||||
static const ReturnValue_t INVALID_CRC = HasReturnvaluesIF::makeReturnCode(0, 2);
|
||||
static constexpr uint8_t HEADER_LEN = 5;
|
||||
static constexpr uint8_t CRC_LEN = 2;
|
||||
|
||||
ScexHelper();
|
||||
ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
||||
Endianness streamEndianness) const override;
|
||||
@ -25,7 +24,7 @@ class ScexHelper : public HasReturnvaluesIF, public SerializeIF {
|
||||
friend std::ostream &operator<<(std::ostream &os, const ScexHelper &h);
|
||||
friend std::ofstream &operator<<(std::ofstream &os, const ScexHelper &h);
|
||||
|
||||
scex::ScexCmds getCmd() const;
|
||||
scex::Cmds getCmd() const;
|
||||
uint8_t getCmdByteRaw() const;
|
||||
uint16_t getCrc() const;
|
||||
size_t getExpectedPacketLen() const;
|
||||
@ -38,7 +37,7 @@ class ScexHelper : public HasReturnvaluesIF, public SerializeIF {
|
||||
const uint8_t *start = nullptr;
|
||||
uint16_t crc = 0;
|
||||
uint8_t cmdByteRaw = 0;
|
||||
scex::ScexCmds cmd = scex::ScexCmds::INVALID;
|
||||
scex::Cmds cmd = scex::Cmds::INVALID;
|
||||
int packetCounter = 0;
|
||||
int totalPacketCounter = 0;
|
||||
uint16_t payloadLen = 0;
|
||||
|
Reference in New Issue
Block a user