F´ Flight Software - C/C++ Documentation  NASA-v1.5.0
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 Auto-generated
4 // \brief hpp file for FileDownlink component base class
5 //
6 // \copyright
7 // Copyright 2009-2015, by the California Institute of Technology.
8 // ALL RIGHTS RESERVED. United States Government Sponsorship
9 // acknowledged.
10 //
11 // ======================================================================
12 
13 #ifndef FILEDOWNLINK_COMP_HPP_
14 #define FILEDOWNLINK_COMP_HPP_
15 
16 #include <FpConfig.hpp>
20 #include <Fw/Cmd/CmdString.hpp>
21 #include <Fw/Tlm/TlmString.hpp>
22 #include <Fw/Time/TimePortAc.hpp>
23 #include <Fw/Log/LogString.hpp>
24 #include <Fw/Time/Time.hpp>
25 #include <Fw/Cmd/CmdArgBuffer.hpp>
26 #include <Fw/Tlm/TlmBuffer.hpp>
27 #include <Fw/Log/LogBuffer.hpp>
28 #include <Fw/Log/TextLogString.hpp>
30 #include <Fw/Time/TimePortAc.hpp>
31 #include <Fw/Cmd/CmdPortAc.hpp>
33 #include <Fw/Tlm/TlmPortAc.hpp>
35 #include <Fw/Cmd/CmdRegPortAc.hpp>
36 #include <Fw/Log/LogPortAc.hpp>
37 #include <Svc/Ping/PingPortAc.hpp>
38 #if FW_ENABLE_TEXT_LOGGING == 1
39 #include <Fw/Log/LogTextPortAc.hpp>
40 #endif
41 
42 namespace Svc {
43 
49  {
50 
51  // ----------------------------------------------------------------------
52  // Friend classes
53  // ----------------------------------------------------------------------
54 
58 
59  public:
60 
61  // ----------------------------------------------------------------------
62  // Getters for typed input ports
63  // ----------------------------------------------------------------------
64 
71  );
72 
79  );
80 
81  public:
82 
83  // ----------------------------------------------------------------------
84  // Connect typed input ports to typed output ports
85  // ----------------------------------------------------------------------
86 
92  );
93 
98  Fw::InputTimePort *port
99  );
100 
106  );
107 
112  Fw::InputTlmPort *port
113  );
114 
120  );
121 
126  Fw::InputCmdRegPort *port
127  );
128 
133  Fw::InputLogPort *port
134  );
135 
140  Svc::InputPingPort *port
141  );
142 
143 #if FW_ENABLE_TEXT_LOGGING == 1
144  void set_LogText_OutputPort(
148  Fw::InputLogTextPort *port
149  );
150 #endif
151 
152 #if FW_PORT_SERIALIZATION
153 
154  public:
155 
156  // ----------------------------------------------------------------------
157  // Connect serialization input ports to typed output ports
158  // ----------------------------------------------------------------------
159 
164  Fw::InputSerializePort *port
165  );
166 
171  Fw::InputSerializePort *port
172  );
173 
178  Fw::InputSerializePort *port
179  );
180 
185  Fw::InputSerializePort *port
186  );
187 
192  Fw::InputSerializePort *port
193  );
194 
199  Fw::InputSerializePort *port
200  );
201 
206  Fw::InputSerializePort *port
207  );
208 
213  Fw::InputSerializePort *port
214  );
215 
216 #if FW_ENABLE_TEXT_LOGGING == 1
217  void set_LogText_OutputPort(
221  Fw::InputSerializePort *port
222  );
223 #endif
224 
225 #endif
226 
227  public:
228 
229  // ----------------------------------------------------------------------
230  // Command registration
231  // ----------------------------------------------------------------------
232 
237  void regCommands(void);
238 
240 
241  // ----------------------------------------------------------------------
242  // Component construction, initialization, and destruction
243  // ----------------------------------------------------------------------
244 
245 #if FW_OBJECT_NAMES == 1
249  const char* compName
250  );
251 #else
255 #endif
256 
259  void init(
260  NATIVE_INT_TYPE queueDepth,
261  NATIVE_INT_TYPE instance = 0
262  );
263 
266  virtual ~FileDownlinkComponentBase(void);
267 
269 
270  // ----------------------------------------------------------------------
271  // Handlers to implement for typed input ports
272  // ----------------------------------------------------------------------
273 
275  //
276  virtual void pingIn_handler(
278  U32 key
279  ) = 0;
280 
282 
283  // ----------------------------------------------------------------------
284  // Port handler base-class functions for typed input ports.
285  // ----------------------------------------------------------------------
286  // Call these functions directly to bypass the corresponding ports.
287  // ----------------------------------------------------------------------
288 
291  void pingIn_handlerBase(
293  U32 key
294  );
295 
297 
298  // ----------------------------------------------------------------------
299  // Pre-message hooks for typed async input ports.
300  // ----------------------------------------------------------------------
301  // Each of these functions is invoked just before processing a message
302  // on the corresponding port. By default they do nothing. You can
303  // override them to provide specific pre-message behavior.
304  // ----------------------------------------------------------------------
305 
308  virtual void pingIn_preMsgHook(
310  U32 key
311  );
312 
314 
315  // ----------------------------------------------------------------------
316  // Invocation functions for typed output ports
317  // ----------------------------------------------------------------------
318 
321  Fw::Buffer bufferGetCaller_out(
323  U32 size
324  );
325 
328  void bufferSendOut_out(
330  Fw::Buffer &fwBuffer
331  );
332 
335  void pingOut_out(
337  U32 key
338  );
339 
341 
342  // ----------------------------------------------------------------------
343  // Getters for numbers of input ports
344  // ----------------------------------------------------------------------
345 
350  NATIVE_INT_TYPE getNum_cmdIn_InputPorts(void);
351 
357 
358 
359  // ----------------------------------------------------------------------
360  // Enumerations for number of ports
361  // ----------------------------------------------------------------------
362 
363  enum {
366  };
367 
369 
370  // ----------------------------------------------------------------------
371  // Getters for numbers of output ports
372  // ----------------------------------------------------------------------
373 
378  NATIVE_INT_TYPE getNum_bufferGetCaller_OutputPorts(void);
379 
385 
391 
397 
403 
409 
415 
421 
422 #if FW_ENABLE_TEXT_LOGGING == 1
423  NATIVE_INT_TYPE getNum_LogText_OutputPorts(void);
428 #endif
429 
430 
431  enum {
441  };
442 
444 
445  // ----------------------------------------------------------------------
446  // Connection status queries for output ports
447  // ----------------------------------------------------------------------
448 
453  bool isConnected_bufferGetCaller_OutputPort(
455  );
456 
463  );
464 
471  );
472 
479  );
480 
487  );
488 
495  );
496 
503  );
504 
511  );
512 
513 #if FW_ENABLE_TEXT_LOGGING == 1
514  bool isConnected_LogText_OutputPort(
520  );
521 #endif
522 
524 
525  // ----------------------------------------------------------------------
526  // Command opcodes
527  // ----------------------------------------------------------------------
528 
529  enum {
530  OPCODE_FILEDOWNLINK_SENDFILE = 0, /* Read a named file off the disk. Divide it into packets and send the packets for transmission to the ground. */
531  OPCODE_FILEDOWNLINK_CANCEL = 1, /* Cancel the downlink in progress, if any */
532  };
533 
535 
536  // ----------------------------------------------------------------------
537  // Command handlers to implement
538  // ----------------------------------------------------------------------
539 
541  /* Read a named file off the disk. Divide it into packets and send the packets for transmission to the ground. */
542  virtual void FileDownlink_SendFile_cmdHandler(
544  U32 cmdSeq,
547  ) = 0;
548 
550  /* Cancel the downlink in progress, if any */
553  U32 cmdSeq
554  ) = 0;
555 
557 
558  // ----------------------------------------------------------------------
559  // Pre-message hooks for async commands.
560  // ----------------------------------------------------------------------
561  // Each of these functions is invoked just before processing the
562  // corresponding command. By default they do nothing. You can
563  // override them to provide specific pre-command behavior.
564  // ----------------------------------------------------------------------
565 
568  virtual void FileDownlink_SendFile_preMsgHook(
570  U32 cmdSeq
571  );
572 
574 
575  // ----------------------------------------------------------------------
576  // Command handler base-class functions.
577  // Call these functions directly to bypass the command input port.
578  // ----------------------------------------------------------------------
579 
582  void FileDownlink_SendFile_cmdHandlerBase(
584  U32 cmdSeq,
586  );
587 
592  U32 cmdSeq,
594  );
595 
597 
598  // ----------------------------------------------------------------------
599  // Command response
600  // ----------------------------------------------------------------------
601 
604  void cmdResponse_out(
606  U32 cmdSeq,
608  );
609 
611 
612  // ----------------------------------------------------------------------
613  // Event IDs
614  // ----------------------------------------------------------------------
615 
616  enum {
617  EVENTID_FILEDOWNLINK_FILEOPENERROR = 0, /* An error occurred opening a file */
618  EVENTID_FILEDOWNLINK_FILEREADERROR = 1, /* An error occurred reading a file */
619  EVENTID_FILEDOWNLINK_FILESENT = 2, /* The File Downlink component successfully sent a file */
620  EVENTID_FILEDOWNLINK_DOWNLINKCANCELED = 3, /* The File Downlink component canceled downlink of a file */
621  };
622 
623  PROTECTED:
624 
625  // ----------------------------------------------------------------------
626  // Event logging functions
627  // ----------------------------------------------------------------------
628 
631  /* An error occurred opening a file */
632  void log_WARNING_HI_FileDownlink_FileOpenError(
633  Fw::LogStringArg& fileName
634  );
635 
636 
639  /* An error occurred reading a file */
641  Fw::LogStringArg& fileName
642  );
643 
644 
647  /* The File Downlink component successfully sent a file */
651  );
652 
653 
656  /* The File Downlink component canceled downlink of a file */
660  );
661 
662 
664 
665  // ----------------------------------------------------------------------
666  // Channel IDs
667  // ----------------------------------------------------------------------
668 
669  enum {
670  CHANNELID_FILEDOWNLINK_FILESSENT = 0,
673  };
674 
675  PROTECTED:
676 
677  // ----------------------------------------------------------------------
678  // Telemetry write functions
679  // ----------------------------------------------------------------------
680 
683  /* The total number of files sent */
684  void tlmWrite_FileDownlink_FilesSent(
685  U32 arg
686  );
687 
690  /* The total number of packets sent */
692  U32 arg
693  );
694 
697  /* The total number of warnings */
699  U32 arg
700  );
701 
703 
704  // ----------------------------------------------------------------------
705  // Time
706  // ----------------------------------------------------------------------
707 
712  Fw::Time getTime(void);
713 
714 
716 
717  // ----------------------------------------------------------------------
718  // Typed input ports
719  // ----------------------------------------------------------------------
720 
723  Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS];
724 
728 
730 
731  // ----------------------------------------------------------------------
732  // Typed output ports
733  // ----------------------------------------------------------------------
734 
737  Fw::OutputBufferGetPort m_bufferGetCaller_OutputPort[NUM_BUFFERGETCALLER_OUTPUT_PORTS];
738 
742 
746 
750 
754 
758 
762 
766 
767 #if FW_ENABLE_TEXT_LOGGING == 1
768  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
771 #endif
772 
774 
775  // ----------------------------------------------------------------------
776  // Calls for messages received on typed input ports
777  // ----------------------------------------------------------------------
778 
781  static void m_p_cmdIn_in(
782  Fw::PassiveComponentBase* callComp,
785  U32 cmdSeq,
787  );
788 
791  static void m_p_pingIn_in(
792  Fw::PassiveComponentBase* callComp,
794  U32 key
795  );
796 
798 
799  // ----------------------------------------------------------------------
800  // Message dispatch functions
801  // ----------------------------------------------------------------------
802 
805  virtual MsgDispatchStatus doDispatch(void);
806 
807 
808  PRIVATE:
809  // ----------------------------------------------------------------------
810  // Counter values for event throttling
811  // ----------------------------------------------------------------------
812 
813  };
814 
815 } // end namespace Svc
816 #endif
Fw::InputTimePort
Definition: TimePortAc.hpp:28
Fw::InputTlmPort
Definition: TlmPortAc.hpp:29
LogBuffer.hpp
PRIVATE
#define PRIVATE
overridable private for unit testing
Definition: BasicTypes.hpp:118
Fw::Time
Definition: Time.hpp:10
TlmPortAc.hpp
Fw::QueuedComponentBase::doDispatch
virtual MsgDispatchStatus doDispatch(void)=0
method to dispatch a single message in the queue.
Fw::OutputTlmPort
Definition: TlmPortAc.hpp:50
Fw::CommandResponse
CommandResponse
Definition: CmdResponsePortAc.hpp:24
Fw::LogStringArg
Definition: LogString.hpp:11
Fw::OutputCmdResponsePort
Definition: CmdResponsePortAc.hpp:58
Fw::InputCmdRegPort
Definition: CmdRegPortAc.hpp:27
CmdRegPortAc.hpp
Fw::OutputBufferGetPort
Definition: BufferGetPortAc.hpp:49
Fw::OutputBufferSendPort
Definition: BufferSendPortAc.hpp:49
TextLogString.hpp
Fw::Buffer
Definition: BufferSerializableAc.hpp:24
InputSerializePort.hpp
Fw::CmdStringArg
Definition: CmdString.hpp:11
CmdPortAc.hpp
Fw::PassiveComponentBase
Definition: PassiveComponentBase.hpp:10
LogString.hpp
Fw::ObjBase::init
void init(void)
Object initializer.
Definition: ObjBase.cpp:26
Fw::OutputLogPort
Definition: LogPortAc.hpp:61
Svc::InputPingPort
Definition: PingPortAc.hpp:27
ActiveComponentBase.hpp
Svc::OutputPingPort
Definition: PingPortAc.hpp:48
Fw::InputBufferGetPort
Definition: BufferGetPortAc.hpp:28
TlmString.hpp
BufferGetPortAc.hpp
TlmBuffer.hpp
FwOpcodeType
#define FwOpcodeType
Type representation for a command opcode.
Definition: FpConfig.hpp:62
Fw::QueuedComponentBase::MsgDispatchStatus
MsgDispatchStatus
Definition: QueuedComponentBase.hpp:25
PingPortAc.hpp
Fw::CmdArgBuffer
Definition: CmdArgBuffer.hpp:22
CmdString.hpp
Fw::InputBufferSendPort
Definition: BufferSendPortAc.hpp:28
Fw::OutputCmdRegPort
Definition: CmdRegPortAc.hpp:48
Fw::ActiveComponentBase
Definition: ActiveComponentBase.hpp:20
CmdResponsePortAc.hpp
LogTextPortAc.hpp
Fw::InputCmdPort
Definition: CmdPortAc.hpp:28
FpConfig.hpp
ISF configuration file.
Svc
Definition: ActiveLoggerComponentAc.cpp:22
Fw::InputCmdResponsePort
Definition: CmdResponsePortAc.hpp:37
Fw::InputLogPort
Definition: LogPortAc.hpp:40
Fw::OutputTimePort
Definition: TimePortAc.hpp:49
Time.hpp
NATIVE_INT_TYPE
int NATIVE_INT_TYPE
native integer type declaration
Definition: BasicTypes.hpp:29
OutputSerializePort.hpp
BufferSendPortAc.hpp
TimePortAc.hpp
LogPortAc.hpp
Fw::OutputLogTextPort
Definition: LogTextPortAc.hpp:61
CmdArgBuffer.hpp
Fw::InputLogTextPort
Definition: LogTextPortAc.hpp:40