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_aos
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 bool SECONDARY_HEADER_EXTENDS_PKT;
21
22 private:
23 CCSDSPacket currentCCSDSPacket; // Current CCSDS
24 std::vector<CCSDSPacket> ccsdsBuffer; // Buffer to store what we're working on
25 void pushPacket(); // We're done with it, end it
26 void abortPacket(); // Abort this one!
27 void readPacket(uint8_t *h); // Start a new packet
28 void pushPayload(uint8_t *data, int length); // Fill a packet up
29 int currentPacketPayloadLength, totalPacketLength, remainingPacketLength, currentPacketEnd; // Few utils variables
30 bool workingOnPacket, inHeader; // Same
31 uint8_t headerBuffer[6]; // Buffer used to buffer a header overlaping 2 CADUs
32 int inHeaderBuffer; // Used to fill it up properly
33
34 public:
35 Demuxer(int mpdu_data_size = 884, bool hasInsertZone = false, int insertZoneSize = 2, bool secondaryHeaderExtendsPkt = false);
36 std::vector<CCSDSPacket> work(uint8_t *cadu); // Main function
37 };
38 } // namespace ccsds_aos
39} // namespace ccsds
Space Packet definition.
Struct representing a CCSDS Space Packet.
Definition ccsds.h:39