v1.17.0 #327

Merged
muellerr merged 131 commits from develop into main 2022-11-28 18:29:31 +01:00
2 changed files with 40 additions and 42 deletions
Showing only changes of commit af0853a42b - Show all commits

View File

@ -11,6 +11,7 @@
#include <fstream>
#include "OBSWConfig.h"
#include "tas/hdlc.h"
#ifdef XIPHOS_Q7S
#include "bsp_q7s/fs/FilesystemHelper.h"
#include "bsp_q7s/fs/SdCardManager.h"
@ -911,7 +912,7 @@ ReturnValue_t PlocSupvHelper::readReceivedMessage(CookieIF* cookie, uint8_t** bu
return returnvalue::OK;
}
ReturnValue_t PlocSupvHelper::parseRecRingBufForHdlc() {
ReturnValue_t PlocSupvHelper::parseRecRingBufForHdlc(size_t& readSize) {
size_t availableData = recRingBuf.getAvailableReadData();
if (availableData == 0) {
return NO_PACKET_FOUND;
@ -926,29 +927,23 @@ ReturnValue_t PlocSupvHelper::parseRecRingBufForHdlc() {
bool startMarkerFound = false;
size_t startIdx = 0;
return returnvalue::OK;
// if (result != returnvalue::OK) {
// ErrorInfo info;
// info.res = result;
// setErrorContext(ErrorTypes::RING_BUF_ERROR, info);
// return result;
// }
// bool stxFound = false;
// size_t stxIdx = 0;
// for (size_t vectorIdx = 0; vectorIdx < availableData; vectorIdx++) {
// // handle STX char
// if (encodedBuf.first[vectorIdx] == DleEncoder::STX_CHAR) {
// if (not stxFound) {
// stxFound = true;
// stxIdx = vectorIdx;
// } else {
// // might be lost packet, so we should advance the read pointer
// // without skipping the STX
// readSize = vectorIdx;
// ErrorInfo info;
// setErrorContext(ErrorTypes::CONSECUTIVE_STX_CHARS, info);
// return POSSIBLE_PACKET_LOSS;
// }
// }
for (size_t idx = 0; idx < availableData; idx++) {
// handle start marker
if (encodedBuf[idx] == HDLC_START_MARKER) {
if (not startMarkerFound) {
startMarkerFound = true;
startIdx = idx;
} else {
readSize = idx;
return POSSIBLE_PACKET_LOSS_CONSECUTIVE_START;
}
}
if (encodedBuf[idx] == HDLC_END_MARKER) {
if (startMarkerFound) {
// Probably a packet, so decode it
}
}
}
// // handle ETX char
// if (encodedBuf.first[vectorIdx] == DleEncoder::ETX_CHAR) {
// if (stxFound) {
@ -959,8 +954,8 @@ ReturnValue_t PlocSupvHelper::parseRecRingBufForHdlc() {
// ReturnValue_t result =
// decoder.decode(&encodedBuf.first[stxIdx], availableData - stxIdx, &dummy,
// decodedBuf.first, decodedBuf.second,
//&decodedLen); if (result == returnvalue::OK) { ctx.setType(ContextType::PACKET_FOUND);
// ctx.decodedPacket.first = decodedBuf.first;
//&decodedLen); if (result == returnvalue::OK) {
//ctx.setType(ContextType::PACKET_FOUND); ctx.decodedPacket.first = decodedBuf.first;
// ctx.decodedPacket.second = decodedLen;
// readSize = ++vectorIdx;
// return returnvalue::OK;

View File

@ -157,9 +157,12 @@ class PlocSupvHelper : public DeviceCommunicationIF,
static uint32_t buildProgParams1(uint8_t percent, uint16_t seqCount);
private:
static constexpr ReturnValue_t NO_PACKET_FOUND = returnvalue::makeCode(1, 0);
static constexpr ReturnValue_t DECODE_BUF_TOO_SMALL = returnvalue::makeCode(1, 1);
static constexpr ReturnValue_t POSSIBLE_PACKET_LOSS_CONSECUTIVE_START =
returnvalue::makeCode(1, 2);
static constexpr ReturnValue_t POSSIBLE_PACKET_LOSS_CONSECUTIVE_END = returnvalue::makeCode(1, 3);
static const uint16_t CRC16_INIT = 0xFFFF;
// Event buffer reply will carry 24 space packets with 1016 bytes and one space packet with
// 192 bytes
@ -246,7 +249,7 @@ class PlocSupvHelper : public DeviceCommunicationIF,
void executeFullCheckMemoryCommand();
ReturnValue_t parseRecRingBufForHdlc();
ReturnValue_t parseRecRingBufForHdlc(size_t& readSize);
ReturnValue_t executeUpdate();
ReturnValue_t continueUpdate();
ReturnValue_t updateOperation();