F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
FileDownlinkComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title FileDownlinkComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for FileDownlink component base class
5 // ======================================================================
6 
7 #ifndef Svc_FileDownlinkComponentAc_HPP
8 #define Svc_FileDownlinkComponentAc_HPP
9 
10 #include <atomic>
11 
13 #include "Fw/Cmd/CmdPortAc.hpp"
14 #include "Fw/Cmd/CmdRegPortAc.hpp"
16 #include "Fw/Cmd/CmdString.hpp"
18 #include "Fw/FPrimeBasicTypes.hpp"
19 #include "Fw/Log/LogPortAc.hpp"
20 #include "Fw/Log/LogString.hpp"
21 #if FW_ENABLE_TEXT_LOGGING == 1
22 #include "Fw/Log/LogTextPortAc.hpp"
23 #endif
26 #include "Fw/Time/TimePortAc.hpp"
27 #include "Fw/Tlm/TlmPortAc.hpp"
28 #include "Fw/Tlm/TlmString.hpp"
29 #include "Os/Mutex.hpp"
32 #include "Svc/Ping/PingPortAc.hpp"
34 
35 namespace Svc {
36 
43  {
44 
45  // ----------------------------------------------------------------------
46  // Friend classes
47  // ----------------------------------------------------------------------
48 
52  friend class FileDownlinkTesterBase;
53 
54  PROTECTED:
55 
56  // ----------------------------------------------------------------------
57  // Constants
58  // ----------------------------------------------------------------------
59 
61  enum {
63  };
64 
66  enum {
71  };
72 
74  enum {
81  };
82 
84  enum {
88  };
89 
91  enum {
93  OPCODE_CANCEL = 0x1,
95  };
96 
98  enum {
108  };
109 
111  enum {
115  };
116 
117  public:
118 
119  // ----------------------------------------------------------------------
120  // Component initialization
121  // ----------------------------------------------------------------------
122 
124  void init(
125  FwSizeType queueDepth,
126  FwEnumStoreType instance = 0
127  );
128 
129  public:
130 
131  // ----------------------------------------------------------------------
132  // Getters for special input ports
133  // ----------------------------------------------------------------------
134 
139  FwIndexType portNum
140  );
141 
142  public:
143 
144  // ----------------------------------------------------------------------
145  // Getters for typed input ports
146  // ----------------------------------------------------------------------
147 
152  FwIndexType portNum
153  );
154 
159  FwIndexType portNum
160  );
161 
166  FwIndexType portNum
167  );
168 
173  FwIndexType portNum
174  );
175 
176  public:
177 
178  // ----------------------------------------------------------------------
179  // Connect input ports to special output ports
180  // ----------------------------------------------------------------------
181 
184  FwIndexType portNum,
185  Fw::InputCmdRegPort* port
186  );
187 
190  FwIndexType portNum,
192  );
193 
196  FwIndexType portNum,
197  Fw::InputLogPort* port
198  );
199 
200 #if FW_ENABLE_TEXT_LOGGING == 1
201 
203  void set_textEventOut_OutputPort(
204  FwIndexType portNum,
205  Fw::InputLogTextPort* port
206  );
207 
208 #endif
209 
212  FwIndexType portNum,
213  Fw::InputTimePort* port
214  );
215 
218  FwIndexType portNum,
219  Fw::InputTlmPort* port
220  );
221 
222  public:
223 
224  // ----------------------------------------------------------------------
225  // Connect typed input ports to typed output ports
226  // ----------------------------------------------------------------------
227 
230  FwIndexType portNum,
232  );
233 
236  FwIndexType portNum,
238  );
239 
242  FwIndexType portNum,
243  Svc::InputPingPort* port
244  );
245 
246 #if FW_PORT_SERIALIZATION
247 
248  public:
249 
250  // ----------------------------------------------------------------------
251  // Connect serial input ports to special output ports
252  // ----------------------------------------------------------------------
253 
256  FwIndexType portNum,
257  Fw::InputSerializePort* port
258  );
259 
262  FwIndexType portNum,
263  Fw::InputSerializePort* port
264  );
265 
268  FwIndexType portNum,
269  Fw::InputSerializePort* port
270  );
271 
272 #if FW_ENABLE_TEXT_LOGGING == 1
273 
275  void set_textEventOut_OutputPort(
276  FwIndexType portNum,
277  Fw::InputSerializePort* port
278  );
279 
280 #endif
281 
284  FwIndexType portNum,
285  Fw::InputSerializePort* port
286  );
287 
290  FwIndexType portNum,
291  Fw::InputSerializePort* port
292  );
293 
294 #endif
295 
296 #if FW_PORT_SERIALIZATION
297 
298  public:
299 
300  // ----------------------------------------------------------------------
301  // Connect serial input ports to typed output ports
302  // ----------------------------------------------------------------------
303 
306  FwIndexType portNum,
307  Fw::InputSerializePort* port
308  );
309 
312  FwIndexType portNum,
313  Fw::InputSerializePort* port
314  );
315 
318  FwIndexType portNum,
319  Fw::InputSerializePort* port
320  );
321 
322 #endif
323 
324  public:
325 
326  // ----------------------------------------------------------------------
327  // Command registration
328  // ----------------------------------------------------------------------
329 
333  void regCommands();
334 
335  PROTECTED:
336 
337  // ----------------------------------------------------------------------
338  // Component construction and destruction
339  // ----------------------------------------------------------------------
340 
343  const char* compName = ""
344  );
345 
347  virtual ~FileDownlinkComponentBase();
348 
349  PROTECTED:
350 
351  // ----------------------------------------------------------------------
352  // Getters for numbers of special input ports
353  // ----------------------------------------------------------------------
354 
359 
360  PROTECTED:
361 
362  // ----------------------------------------------------------------------
363  // Getters for numbers of typed input ports
364  // ----------------------------------------------------------------------
365 
370 
375 
380 
385 
386  PROTECTED:
387 
388  // ----------------------------------------------------------------------
389  // Getters for numbers of special output ports
390  // ----------------------------------------------------------------------
391 
396 
401 
406 
407 #if FW_ENABLE_TEXT_LOGGING == 1
408 
412  FwIndexType getNum_textEventOut_OutputPorts() const;
413 
414 #endif
415 
420 
425 
426  PROTECTED:
427 
428  // ----------------------------------------------------------------------
429  // Getters for numbers of typed output ports
430  // ----------------------------------------------------------------------
431 
436 
441 
446 
447  PROTECTED:
448 
449  // ----------------------------------------------------------------------
450  // Connection status queries for special output ports
451  // ----------------------------------------------------------------------
452 
457  FwIndexType portNum
458  );
459 
464  FwIndexType portNum
465  );
466 
471  FwIndexType portNum
472  );
473 
474 #if FW_ENABLE_TEXT_LOGGING == 1
475 
479  bool isConnected_textEventOut_OutputPort(
480  FwIndexType portNum
481  );
482 
483 #endif
484 
489  FwIndexType portNum
490  );
491 
496  FwIndexType portNum
497  );
498 
499  PROTECTED:
500 
501  // ----------------------------------------------------------------------
502  // Connection status queries for typed output ports
503  // ----------------------------------------------------------------------
504 
509  FwIndexType portNum
510  );
511 
516  FwIndexType portNum
517  );
518 
523  FwIndexType portNum
524  );
525 
526  PROTECTED:
527 
528  // ----------------------------------------------------------------------
529  // Handlers to implement for typed input ports
530  // ----------------------------------------------------------------------
531 
533  virtual void Run_handler(
534  FwIndexType portNum,
535  U32 context
536  ) = 0;
537 
540  FwIndexType portNum,
541  const Fw::StringBase& sourceFileName,
542  const Fw::StringBase& destFileName,
543  U32 offset,
544  U32 length
545  ) = 0;
546 
548  virtual void bufferReturn_handler(
549  FwIndexType portNum,
550  Fw::Buffer& fwBuffer
551  ) = 0;
552 
554  virtual void pingIn_handler(
555  FwIndexType portNum,
556  U32 key
557  ) = 0;
558 
559  PROTECTED:
560 
561  // ----------------------------------------------------------------------
562  // Port handler base-class functions for typed input ports
563  //
564  // Call these functions directly to bypass the corresponding ports
565  // ----------------------------------------------------------------------
566 
568  void Run_handlerBase(
569  FwIndexType portNum,
570  U32 context
571  );
572 
575  FwIndexType portNum,
576  const Fw::StringBase& sourceFileName,
577  const Fw::StringBase& destFileName,
578  U32 offset,
579  U32 length
580  );
581 
584  FwIndexType portNum,
585  Fw::Buffer& fwBuffer
586  );
587 
589  void pingIn_handlerBase(
590  FwIndexType portNum,
591  U32 key
592  );
593 
594  PROTECTED:
595 
596  // ----------------------------------------------------------------------
597  // Pre-message hooks for typed async input ports
598  //
599  // Each of these functions is invoked just before processing a message
600  // on the corresponding port. By default, they do nothing. You can
601  // override them to provide specific pre-message behavior.
602  // ----------------------------------------------------------------------
603 
605  virtual void Run_preMsgHook(
606  FwIndexType portNum,
607  U32 context
608  );
609 
611  virtual void bufferReturn_preMsgHook(
612  FwIndexType portNum,
613  Fw::Buffer& fwBuffer
614  );
615 
617  virtual void pingIn_preMsgHook(
618  FwIndexType portNum,
619  U32 key
620  );
621 
622  PROTECTED:
623 
624  // ----------------------------------------------------------------------
625  // Invocation functions for typed output ports
626  // ----------------------------------------------------------------------
627 
629  void FileComplete_out(
630  FwIndexType portNum,
631  const Svc::SendFileResponse& resp
632  );
633 
635  void bufferSendOut_out(
636  FwIndexType portNum,
637  Fw::Buffer& fwBuffer
638  );
639 
641  void pingOut_out(
642  FwIndexType portNum,
643  U32 key
644  );
645 
646  PROTECTED:
647 
648  // ----------------------------------------------------------------------
649  // Command response
650  // ----------------------------------------------------------------------
651 
653  void cmdResponse_out(
654  FwOpcodeType opCode,
655  U32 cmdSeq,
656  Fw::CmdResponse response
657  );
658 
659  PROTECTED:
660 
661  // ----------------------------------------------------------------------
662  // Command handlers to implement
663  // ----------------------------------------------------------------------
664 
668  virtual void SendFile_cmdHandler(
669  FwOpcodeType opCode,
670  U32 cmdSeq,
671  const Fw::CmdStringArg& sourceFileName,
672  const Fw::CmdStringArg& destFileName
673  ) = 0;
674 
678  virtual void Cancel_cmdHandler(
679  FwOpcodeType opCode,
680  U32 cmdSeq
681  ) = 0;
682 
686  virtual void SendPartial_cmdHandler(
687  FwOpcodeType opCode,
688  U32 cmdSeq,
689  const Fw::CmdStringArg& sourceFileName,
690  const Fw::CmdStringArg& destFileName,
691  U32 startOffset,
692  U32 length
693  ) = 0;
694 
695  PROTECTED:
696 
697  // ----------------------------------------------------------------------
698  // Command handler base-class functions
699  //
700  // Call these functions directly to bypass the command input port
701  // ----------------------------------------------------------------------
702 
707  FwOpcodeType opCode,
708  U32 cmdSeq,
709  Fw::CmdArgBuffer& args
710  );
711 
716  FwOpcodeType opCode,
717  U32 cmdSeq,
718  Fw::CmdArgBuffer& args
719  );
720 
725  FwOpcodeType opCode,
726  U32 cmdSeq,
727  Fw::CmdArgBuffer& args
728  );
729 
730  PROTECTED:
731 
732  // ----------------------------------------------------------------------
733  // Pre-message hooks for async commands
734  //
735  // Each of these functions is invoked just before processing the
736  // corresponding command. By default they do nothing. You can
737  // override them to provide specific pre-command behavior.
738  // ----------------------------------------------------------------------
739 
741  virtual void SendFile_preMsgHook(
742  FwOpcodeType opCode,
743  U32 cmdSeq
744  );
745 
747  virtual void Cancel_preMsgHook(
748  FwOpcodeType opCode,
749  U32 cmdSeq
750  );
751 
753  virtual void SendPartial_preMsgHook(
754  FwOpcodeType opCode,
755  U32 cmdSeq
756  );
757 
758  PROTECTED:
759 
760  // ----------------------------------------------------------------------
761  // Event logging functions
762  // ----------------------------------------------------------------------
763 
768  const Fw::StringBase& fileName
769  ) const;
770 
775  const Fw::StringBase& fileName,
776  I32 status
777  ) const;
778 
783  const Fw::StringBase& sourceFileName,
784  const Fw::StringBase& destFileName
785  ) const;
786 
791  const Fw::StringBase& sourceFileName,
792  const Fw::StringBase& destFileName
793  ) const;
794 
799  const Fw::StringBase& sourceFileName,
800  const Fw::StringBase& destFileName
801  ) const;
802 
807  U32 startOffset,
808  U32 length,
809  U32 filesize,
810  const Fw::StringBase& sourceFileName,
811  const Fw::StringBase& destFileName
812  ) const;
813 
818  const Fw::StringBase& sourceFileName,
819  const Fw::StringBase& destFileName,
820  U32 startOffset,
821  U32 filesize
822  ) const;
823 
828  const Fw::StringBase& sourceFileName,
829  U32 byteOffset
830  ) const;
831 
836  U32 fileSize,
837  const Fw::StringBase& sourceFileName,
838  const Fw::StringBase& destFileName
839  ) const;
840 
841  PROTECTED:
842 
843  // ----------------------------------------------------------------------
844  // Telemetry write functions
845  // ----------------------------------------------------------------------
846 
850  void tlmWrite_FilesSent(
851  U32 arg,
852  Fw::Time _tlmTime = Fw::Time()
853  ) const;
854 
859  U32 arg,
860  Fw::Time _tlmTime = Fw::Time()
861  ) const;
862 
866  void tlmWrite_Warnings(
867  U32 arg,
868  Fw::Time _tlmTime = Fw::Time()
869  ) const;
870 
871  PROTECTED:
872 
873  // ----------------------------------------------------------------------
874  // Time
875  // ----------------------------------------------------------------------
876 
880  Fw::Time getTime() const;
881 
882  PROTECTED:
883 
884  // ----------------------------------------------------------------------
885  // Mutex operations for guarded ports
886  //
887  // You can override these operations to provide more sophisticated
888  // synchronization
889  // ----------------------------------------------------------------------
890 
892  virtual void lock();
893 
895  virtual void unLock();
896 
897  PRIVATE:
898 
899  // ----------------------------------------------------------------------
900  // Message dispatch functions
901  // ----------------------------------------------------------------------
902 
904  virtual MsgDispatchStatus doDispatch();
905 
906  PRIVATE:
907 
908  // ----------------------------------------------------------------------
909  // Calls for messages received on special input ports
910  // ----------------------------------------------------------------------
911 
913  static void m_p_cmdIn_in(
914  Fw::PassiveComponentBase* callComp,
915  FwIndexType portNum,
916  FwOpcodeType opCode,
917  U32 cmdSeq,
918  Fw::CmdArgBuffer& args
919  );
920 
921  PRIVATE:
922 
923  // ----------------------------------------------------------------------
924  // Calls for messages received on typed input ports
925  // ----------------------------------------------------------------------
926 
928  static void m_p_Run_in(
929  Fw::PassiveComponentBase* callComp,
930  FwIndexType portNum,
931  U32 context
932  );
933 
935  static Svc::SendFileResponse m_p_SendFile_in(
936  Fw::PassiveComponentBase* callComp,
937  FwIndexType portNum,
938  const Fw::StringBase& sourceFileName,
939  const Fw::StringBase& destFileName,
940  U32 offset,
941  U32 length
942  );
943 
945  static void m_p_bufferReturn_in(
946  Fw::PassiveComponentBase* callComp,
947  FwIndexType portNum,
948  Fw::Buffer& fwBuffer
949  );
950 
952  static void m_p_pingIn_in(
953  Fw::PassiveComponentBase* callComp,
954  FwIndexType portNum,
955  U32 key
956  );
957 
958  PRIVATE:
959 
960  // ----------------------------------------------------------------------
961  // Special input ports
962  // ----------------------------------------------------------------------
963 
965  Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS];
966 
967  PRIVATE:
968 
969  // ----------------------------------------------------------------------
970  // Typed input ports
971  // ----------------------------------------------------------------------
972 
974  Svc::InputSchedPort m_Run_InputPort[NUM_RUN_INPUT_PORTS];
975 
978 
980  Fw::InputBufferSendPort m_bufferReturn_InputPort[NUM_BUFFERRETURN_INPUT_PORTS];
981 
983  Svc::InputPingPort m_pingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
984 
985  PRIVATE:
986 
987  // ----------------------------------------------------------------------
988  // Special output ports
989  // ----------------------------------------------------------------------
990 
992  Fw::OutputCmdRegPort m_cmdRegOut_OutputPort[NUM_CMDREGOUT_OUTPUT_PORTS];
993 
995  Fw::OutputCmdResponsePort m_cmdResponseOut_OutputPort[NUM_CMDRESPONSEOUT_OUTPUT_PORTS];
996 
998  Fw::OutputLogPort m_eventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS];
999 
1000 #if FW_ENABLE_TEXT_LOGGING == 1
1001 
1003  Fw::OutputLogTextPort m_textEventOut_OutputPort[NUM_TEXTEVENTOUT_OUTPUT_PORTS];
1004 
1005 #endif
1006 
1008  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
1009 
1011  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
1012 
1013  PRIVATE:
1014 
1015  // ----------------------------------------------------------------------
1016  // Typed output ports
1017  // ----------------------------------------------------------------------
1018 
1021 
1023  Fw::OutputBufferSendPort m_bufferSendOut_OutputPort[NUM_BUFFERSENDOUT_OUTPUT_PORTS];
1024 
1026  Svc::OutputPingPort m_pingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
1027 
1028  PRIVATE:
1029 
1030  // ----------------------------------------------------------------------
1031  // Mutexes
1032  // ----------------------------------------------------------------------
1033 
1035  Os::Mutex m_guardedPortMutex;
1036 
1037  };
1038 
1039 }
1040 
1041 #endif
Definition: Time.hpp:9
PlatformSizeType FwSizeType
I32 FwEnumStoreType
Enum representing a command response.
void init()
Object initializer.
Definition: ObjBase.cpp:26
U32 FwOpcodeType
The type of a command opcode.
PlatformIndexType FwIndexType
Send file response struct.
RateGroupDivider component implementation.