F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
friend class ApidManagerTester
Friend class for testing.
Definition: ApidManager.hpp:35
static constexpr U16 SEQUENCE_COUNT_ERROR
Definition: ApidManager.hpp:39
F Prime unknown packet.
Definition: APIDEnumAc.hpp:49
The number of enumerated constants.
Definition: APIDEnumAc.hpp:69
Command packet type - incoming.
Definition: APIDEnumAc.hpp:33
T
The raw enum type.
Definition: APIDEnumAc.hpp:31
File type - incoming and outgoing.
Definition: APIDEnumAc.hpp:39
ApidManager(const char *const compName)
Construct ApidManager object.
Definition: ApidManager.cpp:18
Per Space Packet Standard, all 1s (11bits) is reserved for Idle Packets.
Definition: APIDEnumAc.hpp:51
static constexpr U16 MAX_TRACKED_APIDS
Definition: ApidManager.hpp:38
PlatformIndexType FwIndexType
~ApidManager()=default
Destroy ApidManager object.
APIDs are 11 bits in the Space Packet protocol, so we use U16. Max value 7FF.
Definition: APIDEnumAc.hpp:17
RateGroupDivider component implementation.
Auto-generated base for ApidManager component.
Anything equal or higher value is invalid and should not be used.
Definition: APIDEnumAc.hpp:53
Log type - outgoing.
Definition: APIDEnumAc.hpp:37
Telemetry packet type - outgoing.
Definition: APIDEnumAc.hpp:35
Packetized telemetry packet type.
Definition: APIDEnumAc.hpp:41