F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
ApidManager.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title ApidManager.hpp
3 // \author thomas-bc
4 // \brief hpp file for ApidManager component implementation class
5 // ======================================================================
6 
7 #ifndef Svc_Ccsds_ApidManager_HPP
8 #define Svc_Ccsds_ApidManager_HPP
9 
10 #include "Fw/Com/ComPacket.hpp"
13 
14 namespace Svc {
15 
16 namespace Ccsds {
17 
18 static_assert(ComCfg::Apid::SPP_IDLE_PACKET == 0x07FF,
19  "SPP_IDLE_PACKET must exist and equal 0x07FF (as specified by standard)");
20 static_assert(ComCfg::Apid::INVALID_UNINITIALIZED == 0x0800,
21  "Invalid APID must be 0x0800 (11 bits values allow 0-2047)");
22 static_assert(ComCfg::Apid::FW_PACKET_COMMAND == Fw::ComPacketType::FW_PACKET_COMMAND,
23  "APID FW_PACKET_COMMAND must exist, used by the Framework");
24 static_assert(ComCfg::Apid::FW_PACKET_TELEM == Fw::ComPacketType::FW_PACKET_TELEM,
25  "APID FW_PACKET_TELEM must exist, used by the Framework");
26 static_assert(ComCfg::Apid::FW_PACKET_LOG == Fw::ComPacketType::FW_PACKET_LOG,
27  "APID FW_PACKET_LOG must exist, used by the Framework");
28 static_assert(ComCfg::Apid::FW_PACKET_FILE == Fw::ComPacketType::FW_PACKET_FILE,
29  "APID FW_PACKET_FILE must exist, used by the Framework");
30 static_assert(ComCfg::Apid::FW_PACKET_PACKETIZED_TLM == Fw::ComPacketType::FW_PACKET_PACKETIZED_TLM,
31  "APID FW_PACKET_PACKETIZED_TLM must exist, used by the Framework");
32 static_assert(ComCfg::Apid::FW_PACKET_UNKNOWN == Fw::ComPacketType::FW_PACKET_UNKNOWN,
33  "APID FW_PACKET_UNKNOWN must exist, used by the Framework");
34 
35 class ApidManager final : public ApidManagerComponentBase {
36  friend class ApidManagerTester;
37 
38  public:
40  // ----------------------------------------------------------------------
41  // Component construction and destruction
42  // ----------------------------------------------------------------------
43 
45  ApidManager(const char* const compName
46  );
47 
49  ~ApidManager() = default;
50 
51  private:
52  // ----------------------------------------------------------------------
53  // Handler implementations for typed input ports
54  // ----------------------------------------------------------------------
55 
57  U16 validateApidSeqCountIn_handler(FwIndexType portNum,
58  const ComCfg::Apid& apid,
59  U16 seqCount) override;
60 
62  U16 getApidSeqCountIn_handler(FwIndexType portNum,
63  const ComCfg::Apid& apid,
64  U16 seqCount) override;
65 
66  private:
67  // ----------------------------------------------------------------------
68  // Helpers
69  // ----------------------------------------------------------------------
72  U16 getAndIncrementSeqCount(ComCfg::Apid::T apid);
73 
75  U16 calculateNextSeqCount(const U16 seqCount) const;
76 
82 
83  private:
84  // ----------------------------------------------------------------------
85  // Member variables
86  // ----------------------------------------------------------------------
87  MapType m_apidSequences;
88 };
89 
90 } // namespace Ccsds
91 } // namespace Svc
92 
93 #endif
Packetized telemetry packet type.
Definition: ApidEnumAc.hpp:42
friend class ApidManagerTester
Friend class for testing.
Definition: ApidManager.hpp:36
The number of enumerated constants.
Definition: ApidEnumAc.hpp:72
T
The raw enum type.
Definition: ApidEnumAc.hpp:32
Telemetry packet type - outgoing.
Definition: ApidEnumAc.hpp:36
ApidManager(const char *const compName)
Construct ApidManager object.
Definition: ApidManager.cpp:18
static constexpr U16 MAX_TRACKED_APIDS
Definition: ApidManager.hpp:39
F Prime unknown packet.
Definition: ApidEnumAc.hpp:52
Anything equal or higher value is invalid and should not be used.
Definition: ApidEnumAc.hpp:56
PlatformIndexType FwIndexType
~ApidManager()=default
Destroy ApidManager object.
RateGroupDivider component implementation.
Auto-generated base for ApidManager component.
Per Space Packet Standard, all 1s (11bits) is reserved for Idle Packets.
Definition: ApidEnumAc.hpp:54
File type - incoming and outgoing.
Definition: ApidEnumAc.hpp:40
APIDs are 11 bits in the Space Packet protocol, so we use U16. Max value 7FF.
Definition: ApidEnumAc.hpp:18
Log type - outgoing.
Definition: ApidEnumAc.hpp:38
Command packet type - incoming.
Definition: ApidEnumAc.hpp:34