#pragma once #include #include "eive/resultClassIds.h" #include "fsfw/container/SimpleRingBuffer.h" #include "fsfw/returnvalues/returnvalue.h" #include "fsfw/tmtcpacket/ccsds/SpacePacketReader.h" #include "linux/payload/SerialCommunicationHelper.h" static constexpr bool MPSOC_LOW_LEVEL_RX_WIRETAPPING = true; class MpsocCommunication : public SystemObject { public: static const uint8_t CLASS_ID = CLASS_ID::PLOC_MPSOC_COM; static constexpr ReturnValue_t PACKET_RECEIVED = returnvalue::makeCode(CLASS_ID, 0); static constexpr ReturnValue_t FAULTY_PACKET_SIZE = returnvalue::makeCode(CLASS_ID, 1); static constexpr ReturnValue_t CRC_CHECK_FAILED = returnvalue::makeCode(CLASS_ID, 2); MpsocCommunication(object_id_t objectId, SerialConfig cfg); ReturnValue_t initialize() override; ReturnValue_t send(const uint8_t* data, size_t dataLen); // Should be called periodically to transfer the received data from the MPSoC from the Linux // buffer to the internal ring buffer for further processing. ReturnValue_t readSerialInterface(); // Parses the internal ring buffer for packets and checks whether a packet was received. ReturnValue_t parseAndRetrieveNextPacket(); // Can be used to read the parse packet, if one was received. const SpacePacketReader& getSpReader() const; SerialCommunicationHelper& getComHelper(); private: SpacePacketReader spReader; uint8_t readBuf[4096]; SimpleRingBuffer readRingBuf; SerialCommunicationHelper helper; };