remove HDLC framing including CRC
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit

This commit is contained in:
2022-11-16 14:42:18 +01:00
parent 3510cc85fc
commit 5b770a6407
4 changed files with 32 additions and 7 deletions

View File

@ -1051,9 +1051,14 @@ ReturnValue_t PlocSupvUartManager::parseRecRingBufForHdlc(size_t& readSize, size
if (encodedBuf[idx] == HDLC_END_MARKER) {
if (startMarkerFound) {
// Probably a packet, so decode it
hdlc_remove_framing(encodedBuf.data() + startIdx, idx + 1 - startIdx, decodedBuf.data(),
&decodedLen);
int retval = hdlc_remove_framing_with_crc_check(
encodedBuf.data() + startIdx, idx + 1 - startIdx, decodedBuf.data(), &decodedLen);
readSize = idx + 1;
if (retval == -1 or retval == -2) {
triggerEvent(HDLC_FRAME_REMOVAL_ERROR, retval);
} else if (retval == 1) {
triggerEvent(HDLC_CRC_ERROR);
}
return returnvalue::OK;
} else {
readSize = ++idx;

View File

@ -114,6 +114,8 @@ class PlocSupvUartManager : public DeviceCommunicationIF,
//! [EXPORT] : [COMMENT] Will be triggered every 5 percent of the update progress.
//! P1: First byte percent, third and fourth byte Sequence Count, P2: Bytes written
static constexpr Event SUPV_UPDATE_PROGRESS = MAKE_EVENT(30, severity::INFO);
static constexpr Event HDLC_FRAME_REMOVAL_ERROR = MAKE_EVENT(31, severity::INFO);
static constexpr Event HDLC_CRC_ERROR = MAKE_EVENT(32, severity::INFO);
PlocSupvUartManager(object_id_t objectId);
virtual ~PlocSupvUartManager();
@ -167,6 +169,7 @@ class PlocSupvUartManager : public DeviceCommunicationIF,
static constexpr ReturnValue_t POSSIBLE_PACKET_LOSS_CONSECUTIVE_START =
returnvalue::makeCode(1, 3);
static constexpr ReturnValue_t POSSIBLE_PACKET_LOSS_CONSECUTIVE_END = returnvalue::makeCode(1, 4);
static constexpr ReturnValue_t HDLC_ERROR = returnvalue::makeCode(1, 5);
static const uint16_t CRC16_INIT = 0xFFFF;
// Event buffer reply will carry 24 space packets with 1016 bytes and one space packet with