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

@ -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; }

View File

@ -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;