simplified DLE parser

This commit is contained in:
2022-10-04 20:52:11 +02:00
parent 0c389177e3
commit b930af52b0
5 changed files with 19 additions and 36 deletions

View File

@ -37,8 +37,9 @@ UartTestClass::UartTestClass(object_id_t objectId) : TestTask(objectId) {
DleParser::BufPair encodingBufPair{encodingBuf->data(), encodingBuf->size()};
auto decodedBuf = new std::array<uint8_t, 4096>;
DleParser::BufPair decodingBufPair{decodedBuf->data(), decodedBuf->size()};
// TODO: Code changes but this test class has not, might not work like this anymore
dleParser = new ScexDleParser(*(new SimpleRingBuffer(4096, true)), dleEncoder, encodingBufPair,
decodingBufPair, &foundDlePacketHandler, this);
decodingBufPair);
} else {
reader = new ScexUartReader(objects::SCEX_UART_READER);
}
@ -380,15 +381,6 @@ int UartTestClass::prepareScexCmd(scex::Cmds cmd, bool tempCheck, uint8_t* cmdBu
return 0;
}
void UartTestClass::foundDlePacketHandler(const DleParser::Context& ctx) {
UartTestClass* obj = reinterpret_cast<UartTestClass*>(ctx.userArgs);
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) {
sif::info << "UartTestClass::handleFoundDlePacket: Detected DLE encoded packet with decoded size "
<< len << std::endl;