WIP: somethings wrong.. #19
@ -75,6 +75,5 @@ ReturnValue_t TcSocketPollingTask::initialize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t TcSocketPollingTask::handleSuccessfullTcRead() {
|
ReturnValue_t TcSocketPollingTask::handleSuccessfullTcRead() {
|
||||||
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,6 @@ private:
|
|||||||
|
|
||||||
ReturnValue_t handleSuccessfullTcRead();
|
ReturnValue_t handleSuccessfullTcRead();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* FRAMEWORK_OSAL_LINUX_TCSOCKETPOLLINGTASK_H_ */
|
#endif /* FRAMEWORK_OSAL_LINUX_TCSOCKETPOLLINGTASK_H_ */
|
||||||
|
10
tmtcservices/PusParser.cpp
Normal file
10
tmtcservices/PusParser.cpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#include <framework/tmtcservices/PusParser.h>
|
||||||
|
|
||||||
|
PusParser::PusParser(uint16_t maxExpectedPusPackets,
|
||||||
|
bool storeSplitPackets): indexSizePairFIFO(maxExpectedPusPackets) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t PusParser::parsePusPackets(const uint8_t *frame,
|
||||||
|
size_t frameSize) {
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
51
tmtcservices/PusParser.h
Normal file
51
tmtcservices/PusParser.h
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#ifndef FRAMEWORK_TMTCSERVICES_PUSPARSER_H_
|
||||||
|
#define FRAMEWORK_TMTCSERVICES_PUSPARSER_H_
|
||||||
|
|
||||||
|
#include <framework/container/FIFO.h>
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This small helper class scans a given buffer for PUS packets.
|
||||||
|
* Can be used if PUS packets are serialized in a tightly packed frame.
|
||||||
|
* @details
|
||||||
|
* The parser uses the payload length field of PUS packets to find
|
||||||
|
* the respective PUS packet sizes.
|
||||||
|
*
|
||||||
|
* The parser parses a buffer by taking a pointer and the maximum size to scan.
|
||||||
|
* If PUS packets are found, they are stored in a FIFO which stores pairs
|
||||||
|
* consisting of the index in the buffer and the respective packet sizes.
|
||||||
|
*
|
||||||
|
* If the parser detects split packets (which means that the size of the
|
||||||
|
* next packet is larger than the remaining size to scan), it can either
|
||||||
|
* store that split packet or throw away the packet.
|
||||||
|
*/
|
||||||
|
class PusParser {
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Parser constructor.
|
||||||
|
* @param maxExpectedPusPackets
|
||||||
|
* Maximum expected number of PUS packets. A good estimate is to divide
|
||||||
|
* the frame size by the minimum size of a PUS packet (12 bytes)
|
||||||
|
* @param storeSplitPackets
|
||||||
|
* Specifies whether split packets are also stored inside the FIFO,
|
||||||
|
* with the size being the remaining frame size.
|
||||||
|
*/
|
||||||
|
PusParser(uint16_t maxExpectedPusPackets, bool storeSplitPackets);
|
||||||
|
|
||||||
|
ReturnValue_t parsePusPackets(const uint8_t* frame, size_t frameSize);
|
||||||
|
private:
|
||||||
|
//! The first entry is the index inside the buffer while the second index
|
||||||
|
//! is the size of the PUS packet starting at that index.
|
||||||
|
using indexSizePair = std::pair<size_t, size_t>;
|
||||||
|
//! A FIFO is used to store information about multiple PUS packets
|
||||||
|
//! inside the receive buffer. The maximum number of entries is defined
|
||||||
|
//! by the first constructor argument.
|
||||||
|
FIFO<indexSizePair> indexSizePairFIFO;
|
||||||
|
|
||||||
|
bool storeSplitPackets = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* FRAMEWORK_TMTCSERVICES_PUSPARSER_H_ */
|
Loading…
Reference in New Issue
Block a user