diff --git a/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h b/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h index cd128ca0..4d8dbb46 100644 --- a/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h +++ b/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h @@ -226,7 +226,7 @@ static const size_t MAX_DATA_CAPACITY = 1016; static const size_t MAX_PACKET_SIZE = 1024; static constexpr size_t MIN_PAYLOAD_LEN = SECONDARY_HEADER_LEN + CRC_LEN; -static constexpr size_t MIN_TC_LEN = ccsds::HEADER_LEN + MIN_PAYLOAD_LEN; +static constexpr size_t MIN_TMTC_LEN = ccsds::HEADER_LEN + MIN_PAYLOAD_LEN; static constexpr size_t PAYLOAD_OFFSET = ccsds::HEADER_LEN + SECONDARY_HEADER_LEN; struct UpdateParams { @@ -386,6 +386,25 @@ class TcBase : public ploc::SpTcBase { } }; +class TmBase: public ploc::SpTmReader { +public: + TmBase(const uint8_t* data, size_t maxSize): ploc::SpTmReader(data, maxSize) { + if(maxSize < MIN_TMTC_LEN) { + sif::error << "SupvTcBase::SupvTcBase: Passed buffer is too small" << std::endl; + } + } + + uint8_t getServiceId() { + return getPacketData()[TIMESTAMP_LEN]; + } + + const uint8_t* getPayloadStart() { + return getPacketData() + SECONDARY_HEADER_LEN; + } +private: + +}; + class NoPayloadPacket : public TcBase { public: NoPayloadPacket(TcParams params, uint16_t apid, uint8_t serviceId) diff --git a/linux/devices/ploc/PlocSupvUartMan.cpp b/linux/devices/ploc/PlocSupvUartMan.cpp index 3632a21f..604a6c5e 100644 --- a/linux/devices/ploc/PlocSupvUartMan.cpp +++ b/linux/devices/ploc/PlocSupvUartMan.cpp @@ -859,8 +859,9 @@ ReturnValue_t PlocSupvHelper::handleEventBufferReception(ploc::SpTmReader& reade file.close(); return EVENT_BUFFER_REPLY_INVALID_APID; } - file.write(reinterpret_cast(reader.getPacketData()), - reader.getPayloadDataLength()); + // TODO: Fix +// file.write(reinterpret_cast(reader.getPacketData()), +// reader.getPayloadDataLength()); } return result; } diff --git a/mission/devices/devicedefinitions/SpBase.h b/mission/devices/devicedefinitions/SpBase.h index da2f4cd4..6cd4a803 100644 --- a/mission/devices/devicedefinitions/SpBase.h +++ b/mission/devices/devicedefinitions/SpBase.h @@ -102,11 +102,6 @@ class SpTmReader : public SpacePacketReader { return setReadOnlyData(buf, maxSize); } - /** - * @brief Returns the payload data length (data field length without CRC) - */ - uint16_t getPayloadDataLength() { return getPacketDataLen() - 2; } - ReturnValue_t checkCrc() { if (CRC::crc16ccitt(getFullData(), getFullPacketLen()) != 0) { return returnvalue::FAILED;