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,44 +912,38 @@ 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;
return NO_PACKET_FOUND;
}
if(availableData > encodedBuf.size()) {
return DECODE_BUF_TOO_SMALL;
if (availableData > encodedBuf.size()) {
return DECODE_BUF_TOO_SMALL;
}
ReturnValue_t result = recRingBuf.readData(encodedBuf.data(), availableData);
if(result != returnvalue::OK) {
return result;
if (result != returnvalue::OK) {
return result;
}
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

@ -28,16 +28,16 @@ class PlocSupvHelper : public DeviceCommunicationIF,
public SystemObject,
public ExecutableObjectIF {
public:
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_SUPV_HELPER;
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_SUPV_HELPER;
//! [EXPORT] : [COMMENT] File accidentally close
static const ReturnValue_t FILE_CLOSED_ACCIDENTALLY = MAKE_RETURN_CODE(0xA0);
//! [EXPORT] : [COMMENT] Process has been terminated by command
static const ReturnValue_t PROCESS_TERMINATED = MAKE_RETURN_CODE(0xA1);
//! [EXPORT] : [COMMENT] Received command with invalid pathname
static const ReturnValue_t PATH_NOT_EXISTS = MAKE_RETURN_CODE(0xA2);
//! [EXPORT] : [COMMENT] Expected event buffer TM but received space packet with other APID
static const ReturnValue_t EVENT_BUFFER_REPLY_INVALID_APID = MAKE_RETURN_CODE(0xA3);
//! [EXPORT] : [COMMENT] File accidentally close
static const ReturnValue_t FILE_CLOSED_ACCIDENTALLY = MAKE_RETURN_CODE(0xA0);
//! [EXPORT] : [COMMENT] Process has been terminated by command
static const ReturnValue_t PROCESS_TERMINATED = MAKE_RETURN_CODE(0xA1);
//! [EXPORT] : [COMMENT] Received command with invalid pathname
static const ReturnValue_t PATH_NOT_EXISTS = MAKE_RETURN_CODE(0xA2);
//! [EXPORT] : [COMMENT] Expected event buffer TM but received space packet with other APID
static const ReturnValue_t EVENT_BUFFER_REPLY_INVALID_APID = MAKE_RETURN_CODE(0xA3);
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_SUPV_HELPER;
@ -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();