WIP: SCEX Init #272

Closed
muellerr wants to merge 62 commits from irini into develop
7 changed files with 20 additions and 11 deletions
Showing only changes of commit d00cb6d4a5 - Show all commits

2
fsfw

@ -1 +1 @@
Subproject commit bdddee4f81fbdff7f207fd03b3c592522e04c5aa Subproject commit 4e242aa9547dfc6d7abc0cdd405440547239016b

View File

@ -290,9 +290,13 @@ int UartTestClass::prepareScexCmd(scex::ScexCmds cmd, bool tempCheck, uint8_t* c
return 0; return 0;
} }
void UartTestClass::foundDlePacketHandler(uint8_t* packet, size_t len, void* args) { void UartTestClass::foundDlePacketHandler(const DleParser::Context& ctx) {
UartTestClass* obj = reinterpret_cast<UartTestClass*>(args); UartTestClass* obj = reinterpret_cast<UartTestClass*>(ctx.userArgs);
obj->handleFoundDlePacket(packet, len); if (ctx.getType() == DleParser::ContextType::PACKET_FOUND) {
obj->handleFoundDlePacket(ctx.decodedPacket.first, ctx.decodedPacket.second);
} else {
DleParser::defaultErrorHandler(ctx.error.first, ctx.error.second);
}
} }
void UartTestClass::handleFoundDlePacket(uint8_t* packet, size_t len) { void UartTestClass::handleFoundDlePacket(uint8_t* packet, size_t len) {

View File

@ -3,6 +3,7 @@
#include <fsfw/container/SimpleRingBuffer.h> #include <fsfw/container/SimpleRingBuffer.h>
#include <fsfw/globalfunctions/DleEncoder.h> #include <fsfw/globalfunctions/DleEncoder.h>
#include <fsfw/globalfunctions/DleParser.h>
#include <fsfw_hal/linux/uart/UartCookie.h> #include <fsfw_hal/linux/uart/UartCookie.h>
#include <termios.h> // Contains POSIX terminal control definitions #include <termios.h> // Contains POSIX terminal control definitions
@ -42,7 +43,7 @@ class UartTestClass : public TestTask {
void scexSimplePeriodic(); void scexSimplePeriodic();
void scexSimpleInit(); void scexSimpleInit();
static void foundDlePacketHandler(uint8_t* packet, size_t len, void* args); static void foundDlePacketHandler(const DleParser::Context& ctx);
void handleFoundDlePacket(uint8_t* packet, size_t len); void handleFoundDlePacket(uint8_t* packet, size_t len);
bool cmdSent = false; bool cmdSent = false;

View File

@ -1,6 +1,6 @@
#include "ScexDleParser.h" #include "ScexDleParser.h"
ScexDleParser::ScexDleParser(SimpleRingBuffer &decodeRingBuf, DleEncoder &decoder, ScexDleParser::ScexDleParser(SimpleRingBuffer &decodeRingBuf, DleEncoder &decoder,
BufPair encodedBuf, BufPair decodedBuf, FoundPacketHandler handler, BufPair encodedBuf, BufPair decodedBuf, UserHandler handler,
void *args) void *args)
: DleParser(decodeRingBuf, decoder, encodedBuf, decodedBuf, handler, args) {} : DleParser(decodeRingBuf, decoder, encodedBuf, decodedBuf, handler, args) {}

View File

@ -6,7 +6,7 @@
class ScexDleParser : public DleParser { class ScexDleParser : public DleParser {
public: public:
ScexDleParser(SimpleRingBuffer& decodeRingBuf, DleEncoder& decoder, BufPair encodedBuf, ScexDleParser(SimpleRingBuffer& decodeRingBuf, DleEncoder& decoder, BufPair encodedBuf,
BufPair decodedBuf, FoundPacketHandler handler, void* args); BufPair decodedBuf, UserHandler handler, void* args);
}; };
#endif /* LINUX_DEVICES_SCEXDLEPARSER_H_ */ #endif /* LINUX_DEVICES_SCEXDLEPARSER_H_ */

View File

@ -162,9 +162,13 @@ ReturnValue_t ScexUartReader::finish() {
return RETURN_OK; return RETURN_OK;
} }
void ScexUartReader::foundDlePacketHandler(uint8_t *packet, size_t len, void *args) { void ScexUartReader::foundDlePacketHandler(const DleParser::Context &ctx) {
ScexUartReader *obj = reinterpret_cast<ScexUartReader *>(args); ScexUartReader *obj = reinterpret_cast<ScexUartReader *>(ctx.userArgs);
obj->handleFoundDlePacket(packet, len); if (ctx.getType() == DleParser::ContextType::PACKET_FOUND) {
obj->handleFoundDlePacket(ctx.decodedPacket.first, ctx.decodedPacket.second);
} else {
DleParser::defaultErrorHandler(ctx.error.first, ctx.error.second);
}
} }
void ScexUartReader::handleFoundDlePacket(uint8_t *packet, size_t len) { void ScexUartReader::handleFoundDlePacket(uint8_t *packet, size_t len) {

View File

@ -47,7 +47,7 @@ class ScexUartReader : public SystemObject, // strg+shift+n
DynamicFIFO<size_t> ipcQueue; DynamicFIFO<size_t> ipcQueue;
ScexDleParser dleParser; ScexDleParser dleParser;
static void foundDlePacketHandler(uint8_t *packet, size_t len, void *args); static void foundDlePacketHandler(const DleParser::Context &ctx);
void handleFoundDlePacket(uint8_t *packet, size_t len); void handleFoundDlePacket(uint8_t *packet, size_t len);
ReturnValue_t performOperation(uint8_t operationCode = 0) override; ReturnValue_t performOperation(uint8_t operationCode = 0) override;