From 816dc43214da8b4b765c91373f2c1e6973c1d777 Mon Sep 17 00:00:00 2001 From: Cleanroom Laptop L15 Date: Fri, 29 Apr 2022 23:34:28 +0200 Subject: [PATCH] restructuring execution report handling --- linux/devices/ploc/PlocSupervisorHandler.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/linux/devices/ploc/PlocSupervisorHandler.cpp b/linux/devices/ploc/PlocSupervisorHandler.cpp index ebebcb44..90b9c14f 100644 --- a/linux/devices/ploc/PlocSupervisorHandler.cpp +++ b/linux/devices/ploc/PlocSupervisorHandler.cpp @@ -827,10 +827,14 @@ ReturnValue_t PlocSupervisorHandler::verifyPacket(const uint8_t* start, size_t f } ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) { - ReturnValue_t result = RETURN_OK; + using namespace supv; + ReturnValue_t result = RETURN_OK; - result = verifyPacket(data, supv::SIZE_ACK_REPORT); - if (result == SupvReturnValuesIF::CRC_FAILURE) { + AcknowledgmentReport ack; + ack.addWholeData(data, SIZE_ACK_REPORT); + + result = ack.checkCrc(); + if (result != RETURN_OK) { sif::error << "PlocSupervisorHandler::handleAckReport: CRC failure" << std::endl; nextReplyId = supv::NONE; replyRawReplyIfnotWiretapped(data, supv::SIZE_ACK_REPORT); @@ -842,7 +846,9 @@ ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) { uint16_t apid = (*(data) << 8 | *(data + 1)) & APID_MASK; - switch (apid) { + result = ack.checkApid(); + + switch (result) { case supv::APID_ACK_FAILURE: { // TODO: Interpretation of status field in acknowledgment report sif::debug << "PlocSupervisorHandler::handleAckReport: Received Ack failure report"