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"
12 
13 namespace Svc {
14 
15 namespace Ccsds {
16 
17 static_assert(ComCfg::Apid::SPP_IDLE_PACKET == 0x07FF,
18  "SPP_IDLE_PACKET must exist and equal 0x07FF (as specified by standard)");
19 static_assert(ComCfg::Apid::INVALID_UNINITIALIZED == 0x0800,
20  "Invalid APID must be 0x0800 (11 bits values allow 0-2047)");
21 static_assert(ComCfg::Apid::FW_PACKET_COMMAND == Fw::ComPacketType::FW_PACKET_COMMAND,
22  "APID FW_PACKET_COMMAND must exist, used by the Framework");
23 static_assert(ComCfg::Apid::FW_PACKET_TELEM == Fw::ComPacketType::FW_PACKET_TELEM,
24  "APID FW_PACKET_TELEM must exist, used by the Framework");
25 static_assert(ComCfg::Apid::FW_PACKET_LOG == Fw::ComPacketType::FW_PACKET_LOG,
26  "APID FW_PACKET_LOG must exist, used by the Framework");
27 static_assert(ComCfg::Apid::FW_PACKET_FILE == Fw::ComPacketType::FW_PACKET_FILE,
28  "APID FW_PACKET_FILE must exist, used by the Framework");
29 static_assert(ComCfg::Apid::FW_PACKET_PACKETIZED_TLM == Fw::ComPacketType::FW_PACKET_PACKETIZED_TLM,
30  "APID FW_PACKET_PACKETIZED_TLM must exist, used by the Framework");
31 static_assert(ComCfg::Apid::FW_PACKET_UNKNOWN == Fw::ComPacketType::FW_PACKET_UNKNOWN,
32  "APID FW_PACKET_UNKNOWN must exist, used by the Framework");
33 
34 class ApidManager final : public ApidManagerComponentBase {
35  friend class ApidManagerTester;
36 
37  public:
39  static constexpr U16 SEQUENCE_COUNT_ERROR = std::numeric_limits<U16>::max();
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  void setNextSeqCount(ComCfg::Apid::T apid, U16 seqCount);
76 
79  struct ApidSequenceEntry {
81  U16 sequenceCount = 0;
82  };
83 
84  private:
85  // ----------------------------------------------------------------------
86  // Member variables
87  // ----------------------------------------------------------------------
88  ApidSequenceEntry m_apidSequences[MAX_TRACKED_APIDS];
89 };
90 
91 } // namespace Ccsds
92 } // namespace Svc
93 
94 #endif
Packetized telemetry packet type.
Definition: ApidEnumAc.hpp:41
friend class ApidManagerTester
Friend class for testing.
Definition: ApidManager.hpp:35
static constexpr U16 SEQUENCE_COUNT_ERROR
Definition: ApidManager.hpp:39
The number of enumerated constants.
Definition: ApidEnumAc.hpp:69
T
The raw enum type.
Definition: ApidEnumAc.hpp:31
Telemetry packet type - outgoing.
Definition: ApidEnumAc.hpp:35
ApidManager(const char *const compName)
Construct ApidManager object.
Definition: ApidManager.cpp:18
static constexpr U16 MAX_TRACKED_APIDS
Definition: ApidManager.hpp:38
F Prime unknown packet.
Definition: ApidEnumAc.hpp:49
Anything equal or higher value is invalid and should not be used.
Definition: ApidEnumAc.hpp:53
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:51
File type - incoming and outgoing.
Definition: ApidEnumAc.hpp:39
APIDs are 11 bits in the Space Packet protocol, so we use U16. Max value 7FF.
Definition: ApidEnumAc.hpp:17
Log type - outgoing.
Definition: ApidEnumAc.hpp:37
Command packet type - incoming.
Definition: ApidEnumAc.hpp:33