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 #if FW_ENABLE_TEXT_LOGGING == 1
19 #include "Fw/Log/LogTextPortAc.hpp"
20 #endif
21 #if !FW_DIRECT_PORT_CALLS
23 #endif
24 #if !FW_DIRECT_PORT_CALLS
26 #endif
27 #include "Fw/Prm/PrmGetPortAc.hpp"
28 #include "Fw/Prm/PrmSetPortAc.hpp"
29 #include "Fw/Time/TimePortAc.hpp"
30 #include "Fw/Tlm/TlmPortAc.hpp"
31 #include "Fw/Tlm/TlmString.hpp"
32 #include "Os/Mutex.hpp"
37 
38 namespace Svc {
39 
40  namespace Ccsds {
41 
53  {
54 
55  // ----------------------------------------------------------------------
56  // Friend classes
57  // ----------------------------------------------------------------------
58 
60  friend class AosDeframerTesterBase;
62  friend class AosDeframerTester;
63 
64  protected:
65 
66  // ----------------------------------------------------------------------
67  // Constants
68  // ----------------------------------------------------------------------
69 
71  enum {
74  };
75 
77  enum {
84  };
85 
87  enum {
93  };
94 
96  enum {
108  };
109 
111  enum {
116  };
117 
118  public:
119 
120  // ----------------------------------------------------------------------
121  // Component initialization
122  // ----------------------------------------------------------------------
123 
125  void init(
126  FwEnumStoreType instance = 0
127  );
128 
129 #if !FW_DIRECT_PORT_CALLS
130 
131  public:
132 
133  // ----------------------------------------------------------------------
134  // Getters for typed input ports
135  // ----------------------------------------------------------------------
136 
141  FwIndexType portNum
142  );
143 
148  FwIndexType portNum
149  );
150 
151 #endif
152 
153 #if !FW_DIRECT_PORT_CALLS
154 
155  public:
156 
157  // ----------------------------------------------------------------------
158  // Connect input ports to special output ports
159  // ----------------------------------------------------------------------
160 
163  FwIndexType portNum,
164  Fw::InputLogPort* port
165  );
166 
167 #if FW_ENABLE_TEXT_LOGGING == 1
168 
170  void set_logTextOut_OutputPort(
171  FwIndexType portNum,
172  Fw::InputLogTextPort* port
173  );
174 
175 #endif
176 
179  FwIndexType portNum,
180  Fw::InputPrmGetPort* port
181  );
182 
185  FwIndexType portNum,
186  Fw::InputPrmSetPort* port
187  );
188 
191  FwIndexType portNum,
192  Fw::InputTimePort* port
193  );
194 
197  FwIndexType portNum,
198  Fw::InputTlmPort* port
199  );
200 
201 #endif
202 
203 #if !FW_DIRECT_PORT_CALLS
204 
205  public:
206 
207  // ----------------------------------------------------------------------
208  // Connect typed input ports to typed output ports
209  // ----------------------------------------------------------------------
210 
213  FwIndexType portNum,
215  );
216 
219  FwIndexType portNum,
221  );
222 
225  FwIndexType portNum,
227  );
228 
231  FwIndexType portNum,
233  );
234 
237  FwIndexType portNum,
239  );
240 
241 #endif
242 
243 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
244 
245  public:
246 
247  // ----------------------------------------------------------------------
248  // Connect serial input ports to special output ports
249  // ----------------------------------------------------------------------
250 
253  FwIndexType portNum,
254  Fw::InputSerializePort* port
255  );
256 
257 #if FW_ENABLE_TEXT_LOGGING == 1
258 
260  void set_logTextOut_OutputPort(
261  FwIndexType portNum,
262  Fw::InputSerializePort* port
263  );
264 
265 #endif
266 
269  FwIndexType portNum,
270  Fw::InputSerializePort* port
271  );
272 
275  FwIndexType portNum,
276  Fw::InputSerializePort* port
277  );
278 
281  FwIndexType portNum,
282  Fw::InputSerializePort* port
283  );
284 
285 #endif
286 
287 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
288 
289  public:
290 
291  // ----------------------------------------------------------------------
292  // Connect serial input ports to typed output ports
293  // ----------------------------------------------------------------------
294 
297  FwIndexType portNum,
298  Fw::InputSerializePort* port
299  );
300 
303  FwIndexType portNum,
304  Fw::InputSerializePort* port
305  );
306 
309  FwIndexType portNum,
310  Fw::InputSerializePort* port
311  );
312 
315  FwIndexType portNum,
316  Fw::InputSerializePort* port
317  );
318 
319 #endif
320 
321  protected:
322 
323  // ----------------------------------------------------------------------
324  // Component construction and destruction
325  // ----------------------------------------------------------------------
326 
329  const char* compName = ""
330  );
331 
333  virtual ~AosDeframerComponentBase();
334 
335  protected:
336 
337  // ----------------------------------------------------------------------
338  // Getters for numbers of typed input ports
339  // ----------------------------------------------------------------------
340 
345  return NUM_DATAIN_INPUT_PORTS;
346  }
347 
353  }
354 
355  protected:
356 
357  // ----------------------------------------------------------------------
358  // Getters for numbers of special output ports
359  // ----------------------------------------------------------------------
360 
366  }
367 
368 #if FW_ENABLE_TEXT_LOGGING == 1
369 
373  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
375  }
376 
377 #endif
378 
384  }
385 
391  }
392 
398  }
399 
405  }
406 
407  protected:
408 
409  // ----------------------------------------------------------------------
410  // Getters for numbers of typed output ports
411  // ----------------------------------------------------------------------
412 
418  }
419 
425  }
426 
432  }
433 
439  }
440 
446  }
447 
448  protected:
449 
450  // ----------------------------------------------------------------------
451  // Connection status queries for special output ports
452  // ----------------------------------------------------------------------
453 
458  FwIndexType portNum
459  ) const;
460 
461 #if FW_ENABLE_TEXT_LOGGING == 1
462 
466  bool isConnected_logTextOut_OutputPort(
467  FwIndexType portNum
468  ) const;
469 
470 #endif
471 
476  FwIndexType portNum
477  ) const;
478 
483  FwIndexType portNum
484  ) const;
485 
490  FwIndexType portNum
491  ) const;
492 
497  FwIndexType portNum
498  ) const;
499 
500  protected:
501 
502  // ----------------------------------------------------------------------
503  // Connection status queries for typed output ports
504  // ----------------------------------------------------------------------
505 
510  FwIndexType portNum
511  ) const;
512 
517  FwIndexType portNum
518  ) const;
519 
524  FwIndexType portNum
525  ) const;
526 
531  FwIndexType portNum
532  ) const;
533 
538  FwIndexType portNum
539  ) const;
540 
541  protected:
542 
543  // ----------------------------------------------------------------------
544  // Handlers to implement for typed input ports
545  // ----------------------------------------------------------------------
546 
548  virtual void dataIn_handler(
549  FwIndexType portNum,
550  Fw::Buffer& data,
551  const ComCfg::FrameContext& context
552  ) = 0;
553 
555  virtual void dataReturnIn_handler(
556  FwIndexType portNum,
557  Fw::Buffer& data,
558  const ComCfg::FrameContext& context
559  ) = 0;
560 
561 #if FW_DIRECT_PORT_CALLS
562  public:
563 #else
564  protected:
565 #endif
566 
567  // ----------------------------------------------------------------------
568  // Port handler base-class functions for typed input ports
569  //
570  // Call these functions directly to bypass the corresponding ports
571  // ----------------------------------------------------------------------
572 
574  void dataIn_handlerBase(
575  FwIndexType portNum,
576  Fw::Buffer& data,
577  const ComCfg::FrameContext& context
578  );
579 
582  FwIndexType portNum,
583  Fw::Buffer& data,
584  const ComCfg::FrameContext& context
585  );
586 
587  protected:
588 
589  // ----------------------------------------------------------------------
590  // Invocation functions for typed output ports
591  // ----------------------------------------------------------------------
592 
595  FwIndexType portNum,
596  FwSizeType size
597  ) const;
598 
600  void dataOut_out(
601  FwIndexType portNum,
602  Fw::Buffer& data,
603  const ComCfg::FrameContext& context
604  ) const;
605 
607  void dataReturnOut_out(
608  FwIndexType portNum,
609  Fw::Buffer& data,
610  const ComCfg::FrameContext& context
611  ) const;
612 
614  void deallocate_out(
615  FwIndexType portNum,
616  Fw::Buffer& fwBuffer
617  ) const;
618 
620  void errorNotify_out(
621  FwIndexType portNum,
622  const Svc::Ccsds::FrameError& errorCode
623  ) const;
624 
625  protected:
626 
627  // ----------------------------------------------------------------------
628  // Event logging functions
629  // ----------------------------------------------------------------------
630 
635  U16 transmitted,
636  U16 configured
637  ) const;
638 
643  FwSizeType actual,
644  U32 expected
645  ) const;
646 
651  U8 transmitted,
652  U8 configured
653  ) const;
654 
659  U16 transmitted,
660  U16 computed
661  ) const;
662 
667  U8 transmitted,
668  U8 expected
669  ) const;
670 
675  U8 vcId,
676  U8 pvn
677  ) const;
678 
682  void log_ACTIVITY_LO_IdleFrame(U8 vcId) const;
683 
688  U8 vcId,
689  ComCfg::Pvn pvn,
690  FwSizeType packetSize
691  ) const;
692 
697  U8 vcId,
698  U32 received,
699  U32 expected
700  ) const;
701 
706  U8 vcId,
707  ComCfg::Pvn pvn,
708  FwSizeType bytesReceived,
709  FwSizeType bytesExpected
710  ) const;
711 
716  U8 vcId,
717  FwSizeType fhpReceived,
718  FwSizeType dataZoneSize
719  ) const;
720 
721  protected:
722 
723  // ----------------------------------------------------------------------
724  // Telemetry serialized write
725  // ----------------------------------------------------------------------
726 
731  void tlmWrite(
732  FwChanIdType id,
733  Fw::TlmBuffer& _tlmBuff,
734  Fw::Time _tlmTime = Fw::Time()
735  ) const;
736 
737  protected:
738 
739  // ----------------------------------------------------------------------
740  // Telemetry write functions
741  // ----------------------------------------------------------------------
742 
747  U32 arg,
748  Fw::Time _tlmTime = Fw::Time()
749  ) const;
750 
755  U32 arg,
756  Fw::Time _tlmTime = Fw::Time()
757  ) const;
758 
763  U32 arg,
764  Fw::Time _tlmTime = Fw::Time()
765  ) const;
766 
771  U32 arg,
772  Fw::Time _tlmTime = Fw::Time()
773  ) const;
774 
775  protected:
776 
777  // ----------------------------------------------------------------------
778  // Time
779  // ----------------------------------------------------------------------
780 
784  Fw::Time getTime() const;
785 
786  protected:
787 
788  // ----------------------------------------------------------------------
789  // Mutex operations for guarded ports
790  //
791  // You can override these operations to provide more sophisticated
792  // synchronization
793  // ----------------------------------------------------------------------
794 
796  virtual void lock();
797 
799  virtual void unLock();
800 
801  private:
802 
803  // ----------------------------------------------------------------------
804  // Calls for messages received on typed input ports
805  // ----------------------------------------------------------------------
806 
808  static void m_p_dataIn_in(
809  Fw::PassiveComponentBase* callComp,
810  FwIndexType portNum,
811  Fw::Buffer& data,
812  const ComCfg::FrameContext& context
813  );
814 
816  static void m_p_dataReturnIn_in(
817  Fw::PassiveComponentBase* callComp,
818  FwIndexType portNum,
819  Fw::Buffer& data,
820  const ComCfg::FrameContext& context
821  );
822 
823  private:
824 
825  // ----------------------------------------------------------------------
826  // Invocation functions for special output ports
827  // ----------------------------------------------------------------------
828 
830  void logOut_out(
831  FwIndexType portNum,
832  FwEventIdType id,
833  Fw::Time& timeTag,
834  const Fw::LogSeverity& severity,
835  Fw::LogBuffer& args
836  ) const;
837 
838 #if FW_ENABLE_TEXT_LOGGING
839 
841  void logTextOut_out(
842  FwIndexType portNum,
843  FwEventIdType id,
844  Fw::Time& timeTag,
845  const Fw::LogSeverity& severity,
846  Fw::TextLogString& text
847  ) const;
848 
849 #endif
850 
852  void timeCaller_out(
853  FwIndexType portNum,
854  Fw::Time& time
855  ) const;
856 
858  void tlmOut_out(
859  FwIndexType portNum,
860  FwChanIdType id,
861  Fw::Time& timeTag,
862  Fw::TlmBuffer& val
863  ) const;
864 
865 #if !FW_DIRECT_PORT_CALLS
866 
867  private:
868 
869  // ----------------------------------------------------------------------
870  // Typed input ports
871  // ----------------------------------------------------------------------
872 
875 
878 
879 #endif
880 
881 #if !FW_DIRECT_PORT_CALLS
882 
883  private:
884 
885  // ----------------------------------------------------------------------
886  // Special output ports
887  // ----------------------------------------------------------------------
888 
890  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
891 
892 #if FW_ENABLE_TEXT_LOGGING == 1
893 
895  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
896 
897 #endif
898 
900  Fw::OutputPrmGetPort m_prmGetOut_OutputPort[NUM_PRMGETOUT_OUTPUT_PORTS];
901 
903  Fw::OutputPrmSetPort m_prmSetOut_OutputPort[NUM_PRMSETOUT_OUTPUT_PORTS];
904 
906  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
907 
909  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
910 
911 #endif
912 
913 #if !FW_DIRECT_PORT_CALLS
914 
915  private:
916 
917  // ----------------------------------------------------------------------
918  // Typed output ports
919  // ----------------------------------------------------------------------
920 
922  Fw::OutputBufferGetPort m_allocate_OutputPort[NUM_ALLOCATE_OUTPUT_PORTS];
923 
926 
929 
931  Fw::OutputBufferSendPort m_deallocate_OutputPort[NUM_DEALLOCATE_OUTPUT_PORTS];
932 
935 
936 #endif
937 
938  private:
939 
940  // ----------------------------------------------------------------------
941  // Mutexes
942  // ----------------------------------------------------------------------
943 
945  Os::Mutex m_guardedPortMutex;
946 
947  };
948 
949  }
950 
951 }
952 
953 #endif
static constexpr FwIndexType getNum_dataOut_OutputPorts()
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].
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].
An invalid First Header Pointer (FHP) was received.
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)
Deframing received an invalid checksum (CCSDS 732.0-B-5 Section 4.1.6)
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()
Frame was received with idle-only data on a virtual channel (CCSDS 732.0-B-5 Section 4...
Deframing detected a gap/discontinuity in the AOS VC frame count sequence.
bool isConnected_allocate_OutputPort(FwIndexType portNum) const
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].
Spanning packet buffer allocation failed; packet dropped.
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
void log_WARNING_HI_InvalidFrameLength(FwSizeType actual, U32 expected) const
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.
void log_WARNING_HI_SpanningPacketAbandoned(U8 vcId, ComCfg::Pvn pvn, FwSizeType bytesReceived, FwSizeType bytesExpected) const
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:17
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()
A spanning packet was abandoned before receiving all expected bytes.
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:53
Deframing encountered a packet version number that is not enabled by configuration.
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 SCID (CCSDS 732.0-B-5 Section 4.1.2.2)
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)
Deframing received an invalid CCSDS Transfer Frame Version Number (CCSDS 732.0-B-5 Section 4...
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
void log_WARNING_HI_SpanningPacketAllocFailed(U8 vcId, ComCfg::Pvn pvn, FwSizeType packetSize) const
Type used to pass context info between components during framing/deframing.
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
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
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
Deframing received a VCID not in the accepted set (CCSDS 732.0-B-5 Section 4.1.2.3) ...
void log_WARNING_HI_InvalidTfvn(U8 transmitted, U8 expected) const
void log_WARNING_HI_VcFrameCountGap(U8 vcId, U32 received, U32 expected) const