SatDump 2.0.0-alpha-520736c72
Loading...
Searching...
No Matches
demuxer.h
1#pragma once
2
3#include "../ccsds.h"
4#include <vector>
5
6namespace ccsds
7{
8 namespace ccsds_tm
9 {
10 /*
11 Simple CCSDS demuxer building CCSDS frames from CADUs.
12 VCID filtering must be done beforehand!
13 */
14 class Demuxer
15 {
16 private:
17 const int MPDU_DATA_SIZE;
18 const bool HAS_INSERT_ZONE;
19 const int INSERT_ZONE_SIZE;
20 const int MPDU_INSERT_ZONE;
21 const bool SECONDARY_HEADER_EXTENDS_PKT;
22
23 private:
24 CCSDSPacket currentCCSDSPacket; // Current CCSDS
25 std::vector<CCSDSPacket> ccsdsBuffer; // Buffer to store what we're working on
26 void pushPacket(); // We're done with it, end it
27 void abortPacket(); // Abort this one!
28 void readPacket(uint8_t *h); // Start a new packet
29 void pushPayload(uint8_t *data, int length); // Fill a packet up
30 int currentPacketPayloadLength, totalPacketLength, remainingPacketLength, currentPacketEnd; // Few utils variables
31 bool workingOnPacket, inHeader; // Same
32 uint8_t headerBuffer[6]; // Buffer used to buffer a header overlaping 2 CADUs
33 int inHeaderBuffer; // Used to fill it up properly
34
35 public:
36 Demuxer(int mpdu_data_size = 884, bool hasInsertZone = false, int insertZoneSize = 2, int mpdu_insert_zone = 0, bool secondaryHeaderExtendsPkt = false);
37 std::vector<CCSDSPacket> work(uint8_t *cadu); // Main function
38 };
39 } // namespace ccsds_tm
40} // namespace ccsds
Space Packet definition.
Struct representing a CCSDS Space Packet.
Definition ccsds.h:39