F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
AosDeframerComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title AosDeframerComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for AosDeframer component base class
5 // ======================================================================
6 
7 #ifndef Svc_Ccsds_AosDeframerComponentAc_HPP
8 #define Svc_Ccsds_AosDeframerComponentAc_HPP
9 
10 #include <atomic>
11 
15 #include "Fw/FPrimeBasicTypes.hpp"
16 #include "Fw/Log/LogPortAc.hpp"
17 #include "Fw/Log/LogString.hpp"
18 #include "Fw/Log/LogTextPortAc.hpp"
19 #if !FW_DIRECT_PORT_CALLS
21 #endif
22 #if !FW_DIRECT_PORT_CALLS
24 #endif
25 #include "Fw/Prm/PrmGetPortAc.hpp"
26 #include "Fw/Prm/PrmSetPortAc.hpp"
27 #include "Fw/Time/TimePortAc.hpp"
28 #include "Fw/Tlm/TlmPortAc.hpp"
29 #include "Fw/Tlm/TlmString.hpp"
30 #include "Os/Mutex.hpp"
35 
36 namespace Svc {
37 
38  namespace Ccsds {
39 
51  {
52 
53  // ----------------------------------------------------------------------
54  // Friend classes
55  // ----------------------------------------------------------------------
56 
58  friend class AosDeframerTesterBase;
60  friend class AosDeframerTester;
61 
62  protected:
63 
64  // ----------------------------------------------------------------------
65  // Constants
66  // ----------------------------------------------------------------------
67 
69  enum {
72  };
73 
75  enum {
82  };
83 
85  enum {
91  };
92 
94  enum {
106  };
107 
109  enum {
114  };
115 
116  public:
117 
118  // ----------------------------------------------------------------------
119  // Component initialization
120  // ----------------------------------------------------------------------
121 
123  void init(
124  FwEnumStoreType instance = 0
125  );
126 
127 #if !FW_DIRECT_PORT_CALLS
128 
129  public:
130 
131  // ----------------------------------------------------------------------
132  // Getters for typed input ports
133  // ----------------------------------------------------------------------
134 
139  FwIndexType portNum
140  );
141 
146  FwIndexType portNum
147  );
148 
149 #endif
150 
151 #if !FW_DIRECT_PORT_CALLS
152 
153  public:
154 
155  // ----------------------------------------------------------------------
156  // Connect input ports to special output ports
157  // ----------------------------------------------------------------------
158 
161  FwIndexType portNum,
162  Fw::InputLogPort* port
163  );
164 
165 #if FW_ENABLE_TEXT_LOGGING == 1
166 
168  void set_logTextOut_OutputPort(
169  FwIndexType portNum,
170  Fw::InputLogTextPort* port
171  );
172 
173 #endif
174 
177  FwIndexType portNum,
178  Fw::InputPrmGetPort* port
179  );
180 
183  FwIndexType portNum,
184  Fw::InputPrmSetPort* port
185  );
186 
189  FwIndexType portNum,
190  Fw::InputTimePort* port
191  );
192 
195  FwIndexType portNum,
196  Fw::InputTlmPort* port
197  );
198 
199 #endif
200 
201 #if !FW_DIRECT_PORT_CALLS
202 
203  public:
204 
205  // ----------------------------------------------------------------------
206  // Connect typed input ports to typed output ports
207  // ----------------------------------------------------------------------
208 
211  FwIndexType portNum,
213  );
214 
217  FwIndexType portNum,
219  );
220 
223  FwIndexType portNum,
225  );
226 
229  FwIndexType portNum,
231  );
232 
235  FwIndexType portNum,
237  );
238 
239 #endif
240 
241 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
242 
243  public:
244 
245  // ----------------------------------------------------------------------
246  // Connect serial input ports to special output ports
247  // ----------------------------------------------------------------------
248 
251  FwIndexType portNum,
252  Fw::InputSerializePort* port
253  );
254 
255 #if FW_ENABLE_TEXT_LOGGING == 1
256 
258  void set_logTextOut_OutputPort(
259  FwIndexType portNum,
260  Fw::InputSerializePort* port
261  );
262 
263 #endif
264 
267  FwIndexType portNum,
268  Fw::InputSerializePort* port
269  );
270 
273  FwIndexType portNum,
274  Fw::InputSerializePort* port
275  );
276 
279  FwIndexType portNum,
280  Fw::InputSerializePort* port
281  );
282 
283 #endif
284 
285 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
286 
287  public:
288 
289  // ----------------------------------------------------------------------
290  // Connect serial input ports to typed output ports
291  // ----------------------------------------------------------------------
292 
295  FwIndexType portNum,
296  Fw::InputSerializePort* port
297  );
298 
301  FwIndexType portNum,
302  Fw::InputSerializePort* port
303  );
304 
307  FwIndexType portNum,
308  Fw::InputSerializePort* port
309  );
310 
313  FwIndexType portNum,
314  Fw::InputSerializePort* port
315  );
316 
317 #endif
318 
319  protected:
320 
321  // ----------------------------------------------------------------------
322  // Component construction and destruction
323  // ----------------------------------------------------------------------
324 
327  const char* compName = ""
328  );
329 
331  virtual ~AosDeframerComponentBase();
332 
333  protected:
334 
335  // ----------------------------------------------------------------------
336  // Getters for numbers of typed input ports
337  // ----------------------------------------------------------------------
338 
343  return NUM_DATAIN_INPUT_PORTS;
344  }
345 
351  }
352 
353  protected:
354 
355  // ----------------------------------------------------------------------
356  // Getters for numbers of special output ports
357  // ----------------------------------------------------------------------
358 
364  }
365 
366 #if FW_ENABLE_TEXT_LOGGING == 1
367 
371  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
373  }
374 
375 #endif
376 
382  }
383 
389  }
390 
396  }
397 
403  }
404 
405  protected:
406 
407  // ----------------------------------------------------------------------
408  // Getters for numbers of typed output ports
409  // ----------------------------------------------------------------------
410 
416  }
417 
423  }
424 
430  }
431 
437  }
438 
444  }
445 
446  protected:
447 
448  // ----------------------------------------------------------------------
449  // Connection status queries for special output ports
450  // ----------------------------------------------------------------------
451 
456  FwIndexType portNum
457  ) const;
458 
459 #if FW_ENABLE_TEXT_LOGGING == 1
460 
464  bool isConnected_logTextOut_OutputPort(
465  FwIndexType portNum
466  ) const;
467 
468 #endif
469 
474  FwIndexType portNum
475  ) const;
476 
481  FwIndexType portNum
482  ) const;
483 
488  FwIndexType portNum
489  ) const;
490 
495  FwIndexType portNum
496  ) const;
497 
498  protected:
499 
500  // ----------------------------------------------------------------------
501  // Connection status queries for typed output ports
502  // ----------------------------------------------------------------------
503 
508  FwIndexType portNum
509  ) const;
510 
515  FwIndexType portNum
516  ) const;
517 
522  FwIndexType portNum
523  ) const;
524 
529  FwIndexType portNum
530  ) const;
531 
536  FwIndexType portNum
537  ) const;
538 
539  protected:
540 
541  // ----------------------------------------------------------------------
542  // Handlers to implement for typed input ports
543  // ----------------------------------------------------------------------
544 
546  virtual void dataIn_handler(
547  FwIndexType portNum,
548  Fw::Buffer& data,
549  const ComCfg::FrameContext& context
550  ) = 0;
551 
553  virtual void dataReturnIn_handler(
554  FwIndexType portNum,
555  Fw::Buffer& data,
556  const ComCfg::FrameContext& context
557  ) = 0;
558 
559 #if FW_DIRECT_PORT_CALLS
560  public:
561 #else
562  protected:
563 #endif
564 
565  // ----------------------------------------------------------------------
566  // Port handler base-class functions for typed input ports
567  //
568  // Call these functions directly to bypass the corresponding ports
569  // ----------------------------------------------------------------------
570 
572  void dataIn_handlerBase(
573  FwIndexType portNum,
574  Fw::Buffer& data,
575  const ComCfg::FrameContext& context
576  );
577 
580  FwIndexType portNum,
581  Fw::Buffer& data,
582  const ComCfg::FrameContext& context
583  );
584 
585  protected:
586 
587  // ----------------------------------------------------------------------
588  // Invocation functions for typed output ports
589  // ----------------------------------------------------------------------
590 
593  FwIndexType portNum,
594  FwSizeType size
595  ) const;
596 
598  void dataOut_out(
599  FwIndexType portNum,
600  Fw::Buffer& data,
601  const ComCfg::FrameContext& context
602  ) const;
603 
605  void dataReturnOut_out(
606  FwIndexType portNum,
607  Fw::Buffer& data,
608  const ComCfg::FrameContext& context
609  ) const;
610 
612  void deallocate_out(
613  FwIndexType portNum,
614  Fw::Buffer& fwBuffer
615  ) const;
616 
618  void errorNotify_out(
619  FwIndexType portNum,
620  const Svc::Ccsds::FrameError& errorCode
621  ) const;
622 
623  protected:
624 
625  // ----------------------------------------------------------------------
626  // Event logging functions
627  // ----------------------------------------------------------------------
628 
633  U16 transmitted,
634  U16 configured
635  ) const;
636 
641  FwSizeType actual,
642  U32 expected
643  ) const;
644 
649  U8 transmitted,
650  U8 configured
651  ) const;
652 
657  U16 transmitted,
658  U16 computed
659  ) const;
660 
665  U8 transmitted,
666  U8 expected
667  ) const;
668 
673  U8 vcId,
674  U8 pvn
675  ) const;
676 
680  void log_ACTIVITY_LO_IdleFrame(U8 vcId) const;
681 
686  U8 vcId,
687  const ComCfg::Pvn& pvn,
688  FwSizeType packetSize
689  ) const;
690 
695  U8 vcId,
696  U32 received,
697  U32 expected
698  ) const;
699 
704  U8 vcId,
705  const ComCfg::Pvn& pvn,
706  FwSizeType bytesReceived,
707  FwSizeType bytesExpected
708  ) const;
709 
714  U8 vcId,
715  FwSizeType fhpReceived,
716  FwSizeType dataZoneSize
717  ) const;
718 
719  protected:
720 
721  // ----------------------------------------------------------------------
722  // Telemetry serialized write
723  // ----------------------------------------------------------------------
724 
729  void tlmWrite(
730  FwChanIdType id,
731  Fw::TlmBuffer& _tlmBuff,
732  Fw::Time _tlmTime = Fw::Time()
733  ) const;
734 
735  protected:
736 
737  // ----------------------------------------------------------------------
738  // Telemetry write functions
739  // ----------------------------------------------------------------------
740 
745  U32 arg,
746  Fw::Time _tlmTime = Fw::Time()
747  ) const;
748 
753  U32 arg,
754  Fw::Time _tlmTime = Fw::Time()
755  ) const;
756 
761  U32 arg,
762  Fw::Time _tlmTime = Fw::Time()
763  ) const;
764 
769  U32 arg,
770  Fw::Time _tlmTime = Fw::Time()
771  ) const;
772 
773  protected:
774 
775  // ----------------------------------------------------------------------
776  // Time
777  // ----------------------------------------------------------------------
778 
782  Fw::Time getTime() const;
783 
784  protected:
785 
786  // ----------------------------------------------------------------------
787  // Mutex operations for guarded ports
788  //
789  // You can override these operations to provide more sophisticated
790  // synchronization
791  // ----------------------------------------------------------------------
792 
794  virtual void lock();
795 
797  virtual void unLock();
798 
799  private:
800 
801  // ----------------------------------------------------------------------
802  // Calls for messages received on typed input ports
803  // ----------------------------------------------------------------------
804 
806  static void m_p_dataIn_in(
807  Fw::PassiveComponentBase* callComp,
808  FwIndexType portNum,
809  Fw::Buffer& data,
810  const ComCfg::FrameContext& context
811  );
812 
814  static void m_p_dataReturnIn_in(
815  Fw::PassiveComponentBase* callComp,
816  FwIndexType portNum,
817  Fw::Buffer& data,
818  const ComCfg::FrameContext& context
819  );
820 
821  private:
822 
823  // ----------------------------------------------------------------------
824  // Invocation functions for special output ports
825  // ----------------------------------------------------------------------
826 
828  void logOut_out(
829  FwIndexType portNum,
830  FwEventIdType id,
831  Fw::Time& timeTag,
832  const Fw::LogSeverity& severity,
833  Fw::LogBuffer& args
834  ) const;
835 
836 #if FW_ENABLE_TEXT_LOGGING
837 
839  void logTextOut_out(
840  FwIndexType portNum,
841  FwEventIdType id,
842  Fw::Time& timeTag,
843  const Fw::LogSeverity& severity,
844  Fw::TextLogString& text
845  ) const;
846 
847 #endif
848 
850  void timeCaller_out(
851  FwIndexType portNum,
852  Fw::Time& time
853  ) const;
854 
856  void tlmOut_out(
857  FwIndexType portNum,
858  FwChanIdType id,
859  Fw::Time& timeTag,
860  Fw::TlmBuffer& val
861  ) const;
862 
863 #if !FW_DIRECT_PORT_CALLS
864 
865  private:
866 
867  // ----------------------------------------------------------------------
868  // Typed input ports
869  // ----------------------------------------------------------------------
870 
873 
876 
877 #endif
878 
879 #if !FW_DIRECT_PORT_CALLS
880 
881  private:
882 
883  // ----------------------------------------------------------------------
884  // Special output ports
885  // ----------------------------------------------------------------------
886 
888  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
889 
890 #if FW_ENABLE_TEXT_LOGGING == 1
891 
893  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
894 
895 #endif
896 
898  Fw::OutputPrmGetPort m_prmGetOut_OutputPort[NUM_PRMGETOUT_OUTPUT_PORTS];
899 
901  Fw::OutputPrmSetPort m_prmSetOut_OutputPort[NUM_PRMSETOUT_OUTPUT_PORTS];
902 
904  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
905 
907  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
908 
909 #endif
910 
911 #if !FW_DIRECT_PORT_CALLS
912 
913  private:
914 
915  // ----------------------------------------------------------------------
916  // Typed output ports
917  // ----------------------------------------------------------------------
918 
920  Fw::OutputBufferGetPort m_allocate_OutputPort[NUM_ALLOCATE_OUTPUT_PORTS];
921 
924 
927 
929  Fw::OutputBufferSendPort m_deallocate_OutputPort[NUM_DEALLOCATE_OUTPUT_PORTS];
930 
933 
934 #endif
935 
936  private:
937 
938  // ----------------------------------------------------------------------
939  // Mutexes
940  // ----------------------------------------------------------------------
941 
943  Os::Mutex m_guardedPortMutex;
944 
945  };
946 
947  }
948 
949 }
950 
951 #endif
static constexpr FwIndexType getNum_dataOut_OutputPorts()
void log_WARNING_HI_SpanningPacketAbandoned(U8 vcId, const ComCfg::Pvn &pvn, FwSizeType bytesReceived, FwSizeType bytesExpected) const
static constexpr FwIndexType getNum_prmGetOut_OutputPorts()
virtual void dataReturnIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataReturnIn.
friend class AosDeframerTesterBase
Friend class tester to support autocoded test harness.
void log_WARNING_HI_InvalidFhp(U8 vcId, FwSizeType fhpReceived, FwSizeType dataZoneSize) const
static constexpr FwIndexType getNum_allocate_OutputPorts()
void dataOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port dataOut.
static constexpr FwIndexType getNum_dataIn_InputPorts()
PlatformSizeType FwSizeType
void set_errorNotify_OutputPort(FwIndexType portNum, Svc::Ccsds::InputErrorNotifyPort *port)
Connect port to errorNotify[portNum].
Deframing detected a gap/discontinuity in the AOS VC frame count sequence.
I32 FwEnumStoreType
friend class AosDeframerTester
Friend class tester implementation to support white-box testing.
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
void set_allocate_OutputPort(FwIndexType portNum, Fw::InputBufferGetPort *port)
Connect port to allocate[portNum].
void dataReturnIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataReturnIn.
static constexpr FwIndexType getNum_timeCaller_OutputPorts()
void tlmWrite_CrcErrorCount(U32 arg, Fw::Time _tlmTime=Fw::Time()) const
bool isConnected_errorNotify_OutputPort(FwIndexType portNum) const
Auto-generated base for AosDeframer component.
Svc::InputComDataWithContextPort * get_dataReturnIn_InputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_errorNotify_OutputPorts()
void log_WARNING_LO_InvalidSpacecraftId(U16 transmitted, U16 configured) const
bool isConnected_prmGetOut_OutputPort(FwIndexType portNum) const
void init()
Object initializer.
Definition: ObjBase.cpp:24
static constexpr FwIndexType getNum_deallocate_OutputPorts()
Deframing received a VCID not in the accepted set (CCSDS 732.0-B-5 Section 4.1.2.3) ...
bool isConnected_allocate_OutputPort(FwIndexType portNum) const
Deframing received an invalid checksum (CCSDS 732.0-B-5 Section 4.1.6)
FwIdType FwEventIdType
The type of an event identifier.
virtual void lock()
Lock the guarded mutex.
void tlmWrite_FramesProcessed(U32 arg, Fw::Time _tlmTime=Fw::Time()) const
static constexpr FwIndexType getNum_dataReturnIn_InputPorts()
void tlmWrite(FwChanIdType id, Fw::TlmBuffer &_tlmBuff, Fw::Time _tlmTime=Fw::Time()) const
void set_deallocate_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to deallocate[portNum].
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
void log_WARNING_HI_InvalidFrameLength(FwSizeType actual, U32 expected) const
Deframing received an invalid SCID (CCSDS 732.0-B-5 Section 4.1.2.2)
virtual void unLock()
Unlock the guarded mutex.
void set_prmGetOut_OutputPort(FwIndexType portNum, Fw::InputPrmGetPort *port)
Connect port to prmGetOut[portNum].
FwIdType FwChanIdType
The type of a telemetry channel identifier.
virtual ~AosDeframerComponentBase()
Destroy AosDeframerComponentBase object.
void deallocate_out(FwIndexType portNum, Fw::Buffer &fwBuffer) const
Invoke output port deallocate.
Frame was received with idle-only data on a virtual channel (CCSDS 732.0-B-5 Section 4...
Enum representing event severity.
AosDeframerComponentBase(const char *compName="")
Construct AosDeframerComponentBase object.
Packet Version Numbers are 3 bits with only 2 currently valid values.
Definition: PvnEnumAc.hpp:18
bool isConnected_deallocate_OutputPort(FwIndexType portNum) const
void tlmWrite_LatestVcFrameCount(U32 arg, Fw::Time _tlmTime=Fw::Time()) const
Fw::Buffer allocate_out(FwIndexType portNum, FwSizeType size) const
Invoke output port allocate.
static constexpr FwIndexType getNum_prmSetOut_OutputPorts()
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:54
void dataIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataIn.
void errorNotify_out(FwIndexType portNum, const Svc::Ccsds::FrameError &errorCode) const
Invoke output port errorNotify.
Deframing received an invalid CCSDS Transfer Frame Version Number (CCSDS 732.0-B-5 Section 4...
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
virtual void dataIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataIn.
void log_WARNING_HI_DisabledPvn(U8 vcId, U8 pvn) const
bool isConnected_dataReturnOut_OutputPort(FwIndexType portNum) const
bool isConnected_prmSetOut_OutputPort(FwIndexType portNum) const
Svc::InputComDataWithContextPort * get_dataIn_InputPort(FwIndexType portNum)
void log_WARNING_HI_SpanningPacketAllocFailed(U8 vcId, const ComCfg::Pvn &pvn, FwSizeType packetSize) const
void set_dataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataOut[portNum].
PlatformIndexType FwIndexType
static constexpr FwIndexType getNum_tlmOut_OutputPorts()
void log_ACTIVITY_LO_InvalidVcId(U8 transmitted, U8 configured) const
Type used to pass context info between components during framing/deframing.
Deframing encountered a packet version number that is not enabled by configuration.
RateGroupDivider component implementation.
static constexpr FwIndexType getNum_logOut_OutputPorts()
void set_prmSetOut_OutputPort(FwIndexType portNum, Fw::InputPrmSetPort *port)
Connect port to prmSetOut[portNum].
bool isConnected_logOut_OutputPort(FwIndexType portNum) const
Spanning packet buffer allocation failed; packet dropped.
void dataReturnOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port dataReturnOut.
void log_WARNING_HI_InvalidFecf(U16 transmitted, U16 computed) const
void tlmWrite_PacketsExtracted(U32 arg, Fw::Time _tlmTime=Fw::Time()) const
static constexpr FwIndexType getNum_dataReturnOut_OutputPorts()
bool isConnected_dataOut_OutputPort(FwIndexType portNum) const
A spanning packet was abandoned before receiving all expected bytes.
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
bool isConnected_tlmOut_OutputPort(FwIndexType portNum) const
bool isConnected_timeCaller_OutputPort(FwIndexType portNum) const
An invalid First Header Pointer (FHP) was received.
void log_WARNING_HI_InvalidTfvn(U8 transmitted, U8 expected) const
void log_WARNING_HI_VcFrameCountGap(U8 vcId, U32 received, U32 expected) const