F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 "FpConfig.hpp"
12 #include "Fw/Cmd/CmdPortAc.hpp"
13 #include "Fw/Cmd/CmdRegPortAc.hpp"
15 #include "Fw/Cmd/CmdString.hpp"
17 #include "Fw/Log/LogPortAc.hpp"
18 #include "Fw/Log/LogString.hpp"
19 #if FW_ENABLE_TEXT_LOGGING == 1
20 #include "Fw/Log/LogTextPortAc.hpp"
21 #endif
24 #include "Fw/Time/TimePortAc.hpp"
25 #include "Fw/Tlm/TlmPortAc.hpp"
26 #include "Fw/Tlm/TlmString.hpp"
27 #include "Os/Mutex.hpp"
30 #include "Svc/Ping/PingPortAc.hpp"
32 
33 namespace Svc {
34 
41  {
42 
43  // ----------------------------------------------------------------------
44  // Friend classes
45  // ----------------------------------------------------------------------
46 
49 
50  PROTECTED:
51 
52  // ----------------------------------------------------------------------
53  // Constants
54  // ----------------------------------------------------------------------
55 
57  enum {
59  };
60 
62  enum {
67  };
68 
70  enum {
77  };
78 
80  enum {
84  };
85 
87  enum {
89  OPCODE_CANCEL = 0x1,
91  };
92 
94  enum {
104  };
105 
107  enum {
111  };
112 
113  public:
114 
115  // ----------------------------------------------------------------------
116  // Component initialization
117  // ----------------------------------------------------------------------
118 
120  void init(
121  FwSizeType queueDepth,
122  FwEnumStoreType instance = 0
123  );
124 
125  public:
126 
127  // ----------------------------------------------------------------------
128  // Getters for special input ports
129  // ----------------------------------------------------------------------
130 
135  FwIndexType portNum
136  );
137 
138  public:
139 
140  // ----------------------------------------------------------------------
141  // Getters for typed input ports
142  // ----------------------------------------------------------------------
143 
148  FwIndexType portNum
149  );
150 
155  FwIndexType portNum
156  );
157 
162  FwIndexType portNum
163  );
164 
169  FwIndexType portNum
170  );
171 
172  public:
173 
174  // ----------------------------------------------------------------------
175  // Connect input ports to special output ports
176  // ----------------------------------------------------------------------
177 
180  FwIndexType portNum,
181  Fw::InputCmdRegPort* port
182  );
183 
186  FwIndexType portNum,
188  );
189 
192  FwIndexType portNum,
193  Fw::InputLogPort* port
194  );
195 
196 #if FW_ENABLE_TEXT_LOGGING == 1
197 
199  void set_textEventOut_OutputPort(
200  FwIndexType portNum,
201  Fw::InputLogTextPort* port
202  );
203 
204 #endif
205 
208  FwIndexType portNum,
209  Fw::InputTimePort* port
210  );
211 
214  FwIndexType portNum,
215  Fw::InputTlmPort* port
216  );
217 
218  public:
219 
220  // ----------------------------------------------------------------------
221  // Connect typed input ports to typed output ports
222  // ----------------------------------------------------------------------
223 
226  FwIndexType portNum,
228  );
229 
232  FwIndexType portNum,
234  );
235 
238  FwIndexType portNum,
239  Svc::InputPingPort* port
240  );
241 
242 #if FW_PORT_SERIALIZATION
243 
244  public:
245 
246  // ----------------------------------------------------------------------
247  // Connect serial input ports to special output ports
248  // ----------------------------------------------------------------------
249 
252  FwIndexType portNum,
253  Fw::InputSerializePort* port
254  );
255 
258  FwIndexType portNum,
259  Fw::InputSerializePort* port
260  );
261 
264  FwIndexType portNum,
265  Fw::InputSerializePort* port
266  );
267 
268 #if FW_ENABLE_TEXT_LOGGING == 1
269 
271  void set_textEventOut_OutputPort(
272  FwIndexType portNum,
273  Fw::InputSerializePort* port
274  );
275 
276 #endif
277 
280  FwIndexType portNum,
281  Fw::InputSerializePort* port
282  );
283 
286  FwIndexType portNum,
287  Fw::InputSerializePort* port
288  );
289 
290 #endif
291 
292 #if FW_PORT_SERIALIZATION
293 
294  public:
295 
296  // ----------------------------------------------------------------------
297  // Connect serial input ports to typed output ports
298  // ----------------------------------------------------------------------
299 
302  FwIndexType portNum,
303  Fw::InputSerializePort* port
304  );
305 
308  FwIndexType portNum,
309  Fw::InputSerializePort* port
310  );
311 
314  FwIndexType portNum,
315  Fw::InputSerializePort* port
316  );
317 
318 #endif
319 
320  public:
321 
322  // ----------------------------------------------------------------------
323  // Command registration
324  // ----------------------------------------------------------------------
325 
329  void regCommands();
330 
331  PROTECTED:
332 
333  // ----------------------------------------------------------------------
334  // Component construction and destruction
335  // ----------------------------------------------------------------------
336 
339  const char* compName = ""
340  );
341 
343  virtual ~FileDownlinkComponentBase();
344 
345  PROTECTED:
346 
347  // ----------------------------------------------------------------------
348  // Getters for numbers of special input ports
349  // ----------------------------------------------------------------------
350 
355 
356  PROTECTED:
357 
358  // ----------------------------------------------------------------------
359  // Getters for numbers of typed input ports
360  // ----------------------------------------------------------------------
361 
366 
371 
376 
381 
382  PROTECTED:
383 
384  // ----------------------------------------------------------------------
385  // Getters for numbers of special output ports
386  // ----------------------------------------------------------------------
387 
392 
397 
402 
403 #if FW_ENABLE_TEXT_LOGGING == 1
404 
408  FwIndexType getNum_textEventOut_OutputPorts() const;
409 
410 #endif
411 
416 
421 
422  PROTECTED:
423 
424  // ----------------------------------------------------------------------
425  // Getters for numbers of typed output ports
426  // ----------------------------------------------------------------------
427 
432 
437 
442 
443  PROTECTED:
444 
445  // ----------------------------------------------------------------------
446  // Connection status queries for special output ports
447  // ----------------------------------------------------------------------
448 
453  FwIndexType portNum
454  );
455 
460  FwIndexType portNum
461  );
462 
467  FwIndexType portNum
468  );
469 
470 #if FW_ENABLE_TEXT_LOGGING == 1
471 
475  bool isConnected_textEventOut_OutputPort(
476  FwIndexType portNum
477  );
478 
479 #endif
480 
485  FwIndexType portNum
486  );
487 
492  FwIndexType portNum
493  );
494 
495  PROTECTED:
496 
497  // ----------------------------------------------------------------------
498  // Connection status queries for typed output ports
499  // ----------------------------------------------------------------------
500 
505  FwIndexType portNum
506  );
507 
512  FwIndexType portNum
513  );
514 
519  FwIndexType portNum
520  );
521 
522  PROTECTED:
523 
524  // ----------------------------------------------------------------------
525  // Handlers to implement for typed input ports
526  // ----------------------------------------------------------------------
527 
529  virtual void Run_handler(
530  FwIndexType portNum,
531  U32 context
532  ) = 0;
533 
536  FwIndexType portNum,
537  const Fw::StringBase& sourceFileName,
538  const Fw::StringBase& destFileName,
539  U32 offset,
540  U32 length
541  ) = 0;
542 
544  virtual void bufferReturn_handler(
545  FwIndexType portNum,
546  Fw::Buffer& fwBuffer
547  ) = 0;
548 
550  virtual void pingIn_handler(
551  FwIndexType portNum,
552  U32 key
553  ) = 0;
554 
555  PROTECTED:
556 
557  // ----------------------------------------------------------------------
558  // Port handler base-class functions for typed input ports
559  //
560  // Call these functions directly to bypass the corresponding ports
561  // ----------------------------------------------------------------------
562 
564  void Run_handlerBase(
565  FwIndexType portNum,
566  U32 context
567  );
568 
571  FwIndexType portNum,
572  const Fw::StringBase& sourceFileName,
573  const Fw::StringBase& destFileName,
574  U32 offset,
575  U32 length
576  );
577 
580  FwIndexType portNum,
581  Fw::Buffer& fwBuffer
582  );
583 
585  void pingIn_handlerBase(
586  FwIndexType portNum,
587  U32 key
588  );
589 
590  PROTECTED:
591 
592  // ----------------------------------------------------------------------
593  // Pre-message hooks for typed async input ports
594  //
595  // Each of these functions is invoked just before processing a message
596  // on the corresponding port. By default, they do nothing. You can
597  // override them to provide specific pre-message behavior.
598  // ----------------------------------------------------------------------
599 
601  virtual void Run_preMsgHook(
602  FwIndexType portNum,
603  U32 context
604  );
605 
607  virtual void bufferReturn_preMsgHook(
608  FwIndexType portNum,
609  Fw::Buffer& fwBuffer
610  );
611 
613  virtual void pingIn_preMsgHook(
614  FwIndexType portNum,
615  U32 key
616  );
617 
618  PROTECTED:
619 
620  // ----------------------------------------------------------------------
621  // Invocation functions for typed output ports
622  // ----------------------------------------------------------------------
623 
625  void FileComplete_out(
626  FwIndexType portNum,
627  const Svc::SendFileResponse& resp
628  );
629 
631  void bufferSendOut_out(
632  FwIndexType portNum,
633  Fw::Buffer& fwBuffer
634  );
635 
637  void pingOut_out(
638  FwIndexType portNum,
639  U32 key
640  );
641 
642  PROTECTED:
643 
644  // ----------------------------------------------------------------------
645  // Command response
646  // ----------------------------------------------------------------------
647 
649  void cmdResponse_out(
650  FwOpcodeType opCode,
651  U32 cmdSeq,
652  Fw::CmdResponse response
653  );
654 
655  PROTECTED:
656 
657  // ----------------------------------------------------------------------
658  // Command handlers to implement
659  // ----------------------------------------------------------------------
660 
664  virtual void SendFile_cmdHandler(
665  FwOpcodeType opCode,
666  U32 cmdSeq,
667  const Fw::CmdStringArg& sourceFileName,
668  const Fw::CmdStringArg& destFileName
669  ) = 0;
670 
674  virtual void Cancel_cmdHandler(
675  FwOpcodeType opCode,
676  U32 cmdSeq
677  ) = 0;
678 
683  FwOpcodeType opCode,
684  U32 cmdSeq,
685  const Fw::CmdStringArg& sourceFileName,
686  const Fw::CmdStringArg& destFileName,
687  U32 startOffset,
688  U32 length
689  ) = 0;
690 
691  PROTECTED:
692 
693  // ----------------------------------------------------------------------
694  // Command handler base-class functions
695  //
696  // Call these functions directly to bypass the command input port
697  // ----------------------------------------------------------------------
698 
703  FwOpcodeType opCode,
704  U32 cmdSeq,
705  Fw::CmdArgBuffer& args
706  );
707 
712  FwOpcodeType opCode,
713  U32 cmdSeq,
714  Fw::CmdArgBuffer& args
715  );
716 
721  FwOpcodeType opCode,
722  U32 cmdSeq,
723  Fw::CmdArgBuffer& args
724  );
725 
726  PROTECTED:
727 
728  // ----------------------------------------------------------------------
729  // Pre-message hooks for async commands
730  //
731  // Each of these functions is invoked just before processing the
732  // corresponding command. By default they do nothing. You can
733  // override them to provide specific pre-command behavior.
734  // ----------------------------------------------------------------------
735 
737  virtual void SendFile_preMsgHook(
738  FwOpcodeType opCode,
739  U32 cmdSeq
740  );
741 
743  virtual void Cancel_preMsgHook(
744  FwOpcodeType opCode,
745  U32 cmdSeq
746  );
747 
749  virtual void SendPartial_preMsgHook(
750  FwOpcodeType opCode,
751  U32 cmdSeq
752  );
753 
754  PROTECTED:
755 
756  // ----------------------------------------------------------------------
757  // Event logging functions
758  // ----------------------------------------------------------------------
759 
764  const Fw::StringBase& fileName
765  );
766 
771  const Fw::StringBase& fileName,
772  I32 status
773  );
774 
779  const Fw::StringBase& sourceFileName,
780  const Fw::StringBase& destFileName
781  );
782 
787  const Fw::StringBase& sourceFileName,
788  const Fw::StringBase& destFileName
789  );
790 
795  const Fw::StringBase& sourceFileName,
796  const Fw::StringBase& destFileName
797  );
798 
803  U32 startOffset,
804  U32 length,
805  U32 filesize,
806  const Fw::StringBase& sourceFileName,
807  const Fw::StringBase& destFileName
808  );
809 
814  const Fw::StringBase& sourceFileName,
815  const Fw::StringBase& destFileName,
816  U32 startOffset,
817  U32 filesize
818  );
819 
824  const Fw::StringBase& sourceFileName,
825  U32 byteOffset
826  );
827 
832  U32 fileSize,
833  const Fw::StringBase& sourceFileName,
834  const Fw::StringBase& destFileName
835  );
836 
837  PROTECTED:
838 
839  // ----------------------------------------------------------------------
840  // Telemetry write functions
841  // ----------------------------------------------------------------------
842 
846  void tlmWrite_FilesSent(
847  U32 arg,
848  Fw::Time _tlmTime = Fw::Time()
849  );
850 
855  U32 arg,
856  Fw::Time _tlmTime = Fw::Time()
857  );
858 
862  void tlmWrite_Warnings(
863  U32 arg,
864  Fw::Time _tlmTime = Fw::Time()
865  );
866 
867  PROTECTED:
868 
869  // ----------------------------------------------------------------------
870  // Time
871  // ----------------------------------------------------------------------
872 
876  Fw::Time getTime();
877 
878  PROTECTED:
879 
880  // ----------------------------------------------------------------------
881  // Mutex operations for guarded ports
882  //
883  // You can override these operations to provide more sophisticated
884  // synchronization
885  // ----------------------------------------------------------------------
886 
888  virtual void lock();
889 
891  virtual void unLock();
892 
893  PRIVATE:
894 
895  // ----------------------------------------------------------------------
896  // Message dispatch functions
897  // ----------------------------------------------------------------------
898 
900  virtual MsgDispatchStatus doDispatch();
901 
902  PRIVATE:
903 
904  // ----------------------------------------------------------------------
905  // Calls for messages received on special input ports
906  // ----------------------------------------------------------------------
907 
909  static void m_p_cmdIn_in(
910  Fw::PassiveComponentBase* callComp,
911  FwIndexType portNum,
912  FwOpcodeType opCode,
913  U32 cmdSeq,
914  Fw::CmdArgBuffer& args
915  );
916 
917  PRIVATE:
918 
919  // ----------------------------------------------------------------------
920  // Calls for messages received on typed input ports
921  // ----------------------------------------------------------------------
922 
924  static void m_p_Run_in(
925  Fw::PassiveComponentBase* callComp,
926  FwIndexType portNum,
927  U32 context
928  );
929 
931  static Svc::SendFileResponse m_p_SendFile_in(
932  Fw::PassiveComponentBase* callComp,
933  FwIndexType portNum,
934  const Fw::StringBase& sourceFileName,
935  const Fw::StringBase& destFileName,
936  U32 offset,
937  U32 length
938  );
939 
941  static void m_p_bufferReturn_in(
942  Fw::PassiveComponentBase* callComp,
943  FwIndexType portNum,
944  Fw::Buffer& fwBuffer
945  );
946 
948  static void m_p_pingIn_in(
949  Fw::PassiveComponentBase* callComp,
950  FwIndexType portNum,
951  U32 key
952  );
953 
954  PRIVATE:
955 
956  // ----------------------------------------------------------------------
957  // Special input ports
958  // ----------------------------------------------------------------------
959 
961  Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS];
962 
963  PRIVATE:
964 
965  // ----------------------------------------------------------------------
966  // Typed input ports
967  // ----------------------------------------------------------------------
968 
970  Svc::InputSchedPort m_Run_InputPort[NUM_RUN_INPUT_PORTS];
971 
974 
976  Fw::InputBufferSendPort m_bufferReturn_InputPort[NUM_BUFFERRETURN_INPUT_PORTS];
977 
979  Svc::InputPingPort m_pingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
980 
981  PRIVATE:
982 
983  // ----------------------------------------------------------------------
984  // Special output ports
985  // ----------------------------------------------------------------------
986 
988  Fw::OutputCmdRegPort m_cmdRegOut_OutputPort[NUM_CMDREGOUT_OUTPUT_PORTS];
989 
991  Fw::OutputCmdResponsePort m_cmdResponseOut_OutputPort[NUM_CMDRESPONSEOUT_OUTPUT_PORTS];
992 
994  Fw::OutputLogPort m_eventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS];
995 
996 #if FW_ENABLE_TEXT_LOGGING == 1
997 
999  Fw::OutputLogTextPort m_textEventOut_OutputPort[NUM_TEXTEVENTOUT_OUTPUT_PORTS];
1000 
1001 #endif
1002 
1004  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
1005 
1007  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
1008 
1009  PRIVATE:
1010 
1011  // ----------------------------------------------------------------------
1012  // Typed output ports
1013  // ----------------------------------------------------------------------
1014 
1017 
1019  Fw::OutputBufferSendPort m_bufferSendOut_OutputPort[NUM_BUFFERSENDOUT_OUTPUT_PORTS];
1020 
1022  Svc::OutputPingPort m_pingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
1023 
1024  PRIVATE:
1025 
1026  // ----------------------------------------------------------------------
1027  // Mutexes
1028  // ----------------------------------------------------------------------
1029 
1031  Os::Mutex m_guardedPortMutex;
1032 
1033  };
1034 
1035 }
1036 
1037 #endif
I32 FwEnumStoreType
Definition: FpConfig.h:64
U32 FwOpcodeType
Definition: FpConfig.h:91
PlatformSizeType FwSizeType
Definition: FpConfig.h:35
PlatformIndexType FwIndexType
Definition: FpConfig.h:25
C++-compatible configuration header for fprime configuration.
Enum representing a command response.
void init()
Object initializer.
Definition: ObjBase.cpp:27
Definition: Time.hpp:9