F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
FileDownlinkComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title FileDownlinkComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for FileDownlink component base class
5 // ======================================================================
6 
8 #include "Fw/Types/Assert.hpp"
10 #if FW_ENABLE_TEXT_LOGGING
11 #include "Fw/Types/String.hpp"
12 #endif
13 
14 namespace Svc {
15 
16  namespace {
17  enum MsgTypeEnum {
18  FILEDOWNLINK_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT,
19  RUN_SCHED,
20  BUFFERRETURN_BUFFERSEND,
21  PINGIN_PING,
22  CMD_SENDFILE,
23  CMD_CANCEL,
24  CMD_SENDPARTIAL,
25  };
26 
27  // Get the max size by constructing a union of the async input, command, and
28  // internal port serialization sizes
29  union BuffUnion {
31  BYTE bufferReturnPortSize[Fw::InputBufferSendPort::SERIALIZED_SIZE];
34  };
35 
36  // Define a message buffer class large enough to handle all the
37  // asynchronous inputs to the component
38  class ComponentIpcSerializableBuffer :
40  {
41 
42  public:
43 
44  enum {
45  // Offset into data in buffer: Size of message ID and port number
46  DATA_OFFSET = sizeof(FwEnumStoreType) + sizeof(FwIndexType),
47  // Max data size
48  MAX_DATA_SIZE = sizeof(BuffUnion),
49  // Max message size: Size of message id + size of port + max data size
50  SERIALIZATION_SIZE = DATA_OFFSET + MAX_DATA_SIZE
51  };
52 
53  Fw::Serializable::SizeType getBuffCapacity() const {
54  return sizeof(m_buff);
55  }
56 
57  U8* getBuffAddr() {
58  return m_buff;
59  }
60 
61  const U8* getBuffAddr() const {
62  return m_buff;
63  }
64 
65  private:
66  // Should be the max of all the input ports serialized sizes...
67  U8 m_buff[SERIALIZATION_SIZE];
68 
69  };
70  }
71 
72  // ----------------------------------------------------------------------
73  // Component initialization
74  // ----------------------------------------------------------------------
75 
78  FwSizeType queueDepth,
79  FwEnumStoreType instance
80  )
81  {
82  // Initialize base class
84 
85  // Connect input port cmdIn
86  for (
87  FwIndexType port = 0;
88  port < static_cast<FwIndexType>(this->getNum_cmdIn_InputPorts());
89  port++
90  ) {
91  this->m_cmdIn_InputPort[port].init();
92  this->m_cmdIn_InputPort[port].addCallComp(
93  this,
94  m_p_cmdIn_in
95  );
96  this->m_cmdIn_InputPort[port].setPortNum(port);
97 
98 #if FW_OBJECT_NAMES == 1
99  Fw::ObjectName portName;
100  portName.format(
101  "%s_cmdIn_InputPort[%" PRI_PlatformIntType "]",
102  this->m_objName.toChar(),
103  port
104  );
105  this->m_cmdIn_InputPort[port].setObjName(portName.toChar());
106 #endif
107  }
108 
109  // Connect input port Run
110  for (
111  FwIndexType port = 0;
112  port < static_cast<FwIndexType>(this->getNum_Run_InputPorts());
113  port++
114  ) {
115  this->m_Run_InputPort[port].init();
116  this->m_Run_InputPort[port].addCallComp(
117  this,
118  m_p_Run_in
119  );
120  this->m_Run_InputPort[port].setPortNum(port);
121 
122 #if FW_OBJECT_NAMES == 1
123  Fw::ObjectName portName;
124  portName.format(
125  "%s_Run_InputPort[%" PRI_PlatformIntType "]",
126  this->m_objName.toChar(),
127  port
128  );
129  this->m_Run_InputPort[port].setObjName(portName.toChar());
130 #endif
131  }
132 
133  // Connect input port SendFile
134  for (
135  FwIndexType port = 0;
136  port < static_cast<FwIndexType>(this->getNum_SendFile_InputPorts());
137  port++
138  ) {
139  this->m_SendFile_InputPort[port].init();
140  this->m_SendFile_InputPort[port].addCallComp(
141  this,
142  m_p_SendFile_in
143  );
144  this->m_SendFile_InputPort[port].setPortNum(port);
145 
146 #if FW_OBJECT_NAMES == 1
147  Fw::ObjectName portName;
148  portName.format(
149  "%s_SendFile_InputPort[%" PRI_PlatformIntType "]",
150  this->m_objName.toChar(),
151  port
152  );
153  this->m_SendFile_InputPort[port].setObjName(portName.toChar());
154 #endif
155  }
156 
157  // Connect input port bufferReturn
158  for (
159  FwIndexType port = 0;
160  port < static_cast<FwIndexType>(this->getNum_bufferReturn_InputPorts());
161  port++
162  ) {
163  this->m_bufferReturn_InputPort[port].init();
164  this->m_bufferReturn_InputPort[port].addCallComp(
165  this,
166  m_p_bufferReturn_in
167  );
168  this->m_bufferReturn_InputPort[port].setPortNum(port);
169 
170 #if FW_OBJECT_NAMES == 1
171  Fw::ObjectName portName;
172  portName.format(
173  "%s_bufferReturn_InputPort[%" PRI_PlatformIntType "]",
174  this->m_objName.toChar(),
175  port
176  );
177  this->m_bufferReturn_InputPort[port].setObjName(portName.toChar());
178 #endif
179  }
180 
181  // Connect input port pingIn
182  for (
183  FwIndexType port = 0;
184  port < static_cast<FwIndexType>(this->getNum_pingIn_InputPorts());
185  port++
186  ) {
187  this->m_pingIn_InputPort[port].init();
188  this->m_pingIn_InputPort[port].addCallComp(
189  this,
190  m_p_pingIn_in
191  );
192  this->m_pingIn_InputPort[port].setPortNum(port);
193 
194 #if FW_OBJECT_NAMES == 1
195  Fw::ObjectName portName;
196  portName.format(
197  "%s_pingIn_InputPort[%" PRI_PlatformIntType "]",
198  this->m_objName.toChar(),
199  port
200  );
201  this->m_pingIn_InputPort[port].setObjName(portName.toChar());
202 #endif
203  }
204 
205  // Connect output port cmdRegOut
206  for (
207  FwIndexType port = 0;
208  port < static_cast<FwIndexType>(this->getNum_cmdRegOut_OutputPorts());
209  port++
210  ) {
211  this->m_cmdRegOut_OutputPort[port].init();
212 
213 #if FW_OBJECT_NAMES == 1
214  Fw::ObjectName portName;
215  portName.format(
216  "%s_cmdRegOut_OutputPort[%" PRI_PlatformIntType "]",
217  this->m_objName.toChar(),
218  port
219  );
220  this->m_cmdRegOut_OutputPort[port].setObjName(portName.toChar());
221 #endif
222  }
223 
224  // Connect output port cmdResponseOut
225  for (
226  FwIndexType port = 0;
227  port < static_cast<FwIndexType>(this->getNum_cmdResponseOut_OutputPorts());
228  port++
229  ) {
230  this->m_cmdResponseOut_OutputPort[port].init();
231 
232 #if FW_OBJECT_NAMES == 1
233  Fw::ObjectName portName;
234  portName.format(
235  "%s_cmdResponseOut_OutputPort[%" PRI_PlatformIntType "]",
236  this->m_objName.toChar(),
237  port
238  );
239  this->m_cmdResponseOut_OutputPort[port].setObjName(portName.toChar());
240 #endif
241  }
242 
243  // Connect output port eventOut
244  for (
245  FwIndexType port = 0;
246  port < static_cast<FwIndexType>(this->getNum_eventOut_OutputPorts());
247  port++
248  ) {
249  this->m_eventOut_OutputPort[port].init();
250 
251 #if FW_OBJECT_NAMES == 1
252  Fw::ObjectName portName;
253  portName.format(
254  "%s_eventOut_OutputPort[%" PRI_PlatformIntType "]",
255  this->m_objName.toChar(),
256  port
257  );
258  this->m_eventOut_OutputPort[port].setObjName(portName.toChar());
259 #endif
260  }
261 
262 #if FW_ENABLE_TEXT_LOGGING == 1
263  // Connect output port textEventOut
264  for (
265  FwIndexType port = 0;
266  port < static_cast<FwIndexType>(this->getNum_textEventOut_OutputPorts());
267  port++
268  ) {
269  this->m_textEventOut_OutputPort[port].init();
270 
271 #if FW_OBJECT_NAMES == 1
272  Fw::ObjectName portName;
273  portName.format(
274  "%s_textEventOut_OutputPort[%" PRI_PlatformIntType "]",
275  this->m_objName.toChar(),
276  port
277  );
278  this->m_textEventOut_OutputPort[port].setObjName(portName.toChar());
279 #endif
280  }
281 #endif
282 
283  // Connect output port timeCaller
284  for (
285  FwIndexType port = 0;
286  port < static_cast<FwIndexType>(this->getNum_timeCaller_OutputPorts());
287  port++
288  ) {
289  this->m_timeCaller_OutputPort[port].init();
290 
291 #if FW_OBJECT_NAMES == 1
292  Fw::ObjectName portName;
293  portName.format(
294  "%s_timeCaller_OutputPort[%" PRI_PlatformIntType "]",
295  this->m_objName.toChar(),
296  port
297  );
298  this->m_timeCaller_OutputPort[port].setObjName(portName.toChar());
299 #endif
300  }
301 
302  // Connect output port tlmOut
303  for (
304  FwIndexType port = 0;
305  port < static_cast<FwIndexType>(this->getNum_tlmOut_OutputPorts());
306  port++
307  ) {
308  this->m_tlmOut_OutputPort[port].init();
309 
310 #if FW_OBJECT_NAMES == 1
311  Fw::ObjectName portName;
312  portName.format(
313  "%s_tlmOut_OutputPort[%" PRI_PlatformIntType "]",
314  this->m_objName.toChar(),
315  port
316  );
317  this->m_tlmOut_OutputPort[port].setObjName(portName.toChar());
318 #endif
319  }
320 
321  // Connect output port FileComplete
322  for (
323  FwIndexType port = 0;
324  port < static_cast<FwIndexType>(this->getNum_FileComplete_OutputPorts());
325  port++
326  ) {
327  this->m_FileComplete_OutputPort[port].init();
328 
329 #if FW_OBJECT_NAMES == 1
330  Fw::ObjectName portName;
331  portName.format(
332  "%s_FileComplete_OutputPort[%" PRI_PlatformIntType "]",
333  this->m_objName.toChar(),
334  port
335  );
336  this->m_FileComplete_OutputPort[port].setObjName(portName.toChar());
337 #endif
338  }
339 
340  // Connect output port bufferSendOut
341  for (
342  FwIndexType port = 0;
343  port < static_cast<FwIndexType>(this->getNum_bufferSendOut_OutputPorts());
344  port++
345  ) {
346  this->m_bufferSendOut_OutputPort[port].init();
347 
348 #if FW_OBJECT_NAMES == 1
349  Fw::ObjectName portName;
350  portName.format(
351  "%s_bufferSendOut_OutputPort[%" PRI_PlatformIntType "]",
352  this->m_objName.toChar(),
353  port
354  );
355  this->m_bufferSendOut_OutputPort[port].setObjName(portName.toChar());
356 #endif
357  }
358 
359  // Connect output port pingOut
360  for (
361  FwIndexType port = 0;
362  port < static_cast<FwIndexType>(this->getNum_pingOut_OutputPorts());
363  port++
364  ) {
365  this->m_pingOut_OutputPort[port].init();
366 
367 #if FW_OBJECT_NAMES == 1
368  Fw::ObjectName portName;
369  portName.format(
370  "%s_pingOut_OutputPort[%" PRI_PlatformIntType "]",
371  this->m_objName.toChar(),
372  port
373  );
374  this->m_pingOut_OutputPort[port].setObjName(portName.toChar());
375 #endif
376  }
377 
378  // Create the queue
379  Os::Queue::Status qStat = this->createQueue(
380  queueDepth,
381  static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
382  );
383  FW_ASSERT(
384  Os::Queue::Status::OP_OK == qStat,
385  static_cast<FwAssertArgType>(qStat)
386  );
387  }
388 
389  // ----------------------------------------------------------------------
390  // Getters for special input ports
391  // ----------------------------------------------------------------------
392 
395  {
396  FW_ASSERT(
397  portNum < this->getNum_cmdIn_InputPorts(),
398  static_cast<FwAssertArgType>(portNum)
399  );
400 
401  return &this->m_cmdIn_InputPort[portNum];
402  }
403 
404  // ----------------------------------------------------------------------
405  // Getters for typed input ports
406  // ----------------------------------------------------------------------
407 
410  {
411  FW_ASSERT(
412  portNum < this->getNum_Run_InputPorts(),
413  static_cast<FwAssertArgType>(portNum)
414  );
415 
416  return &this->m_Run_InputPort[portNum];
417  }
418 
421  {
422  FW_ASSERT(
423  portNum < this->getNum_SendFile_InputPorts(),
424  static_cast<FwAssertArgType>(portNum)
425  );
426 
427  return &this->m_SendFile_InputPort[portNum];
428  }
429 
432  {
433  FW_ASSERT(
434  portNum < this->getNum_bufferReturn_InputPorts(),
435  static_cast<FwAssertArgType>(portNum)
436  );
437 
438  return &this->m_bufferReturn_InputPort[portNum];
439  }
440 
443  {
444  FW_ASSERT(
445  portNum < this->getNum_pingIn_InputPorts(),
446  static_cast<FwAssertArgType>(portNum)
447  );
448 
449  return &this->m_pingIn_InputPort[portNum];
450  }
451 
452  // ----------------------------------------------------------------------
453  // Connect input ports to special output ports
454  // ----------------------------------------------------------------------
455 
458  FwIndexType portNum,
459  Fw::InputCmdRegPort* port
460  )
461  {
462  FW_ASSERT(
463  portNum < this->getNum_cmdRegOut_OutputPorts(),
464  static_cast<FwAssertArgType>(portNum)
465  );
466 
467  this->m_cmdRegOut_OutputPort[portNum].addCallPort(port);
468  }
469 
472  FwIndexType portNum,
474  )
475  {
476  FW_ASSERT(
477  portNum < this->getNum_cmdResponseOut_OutputPorts(),
478  static_cast<FwAssertArgType>(portNum)
479  );
480 
481  this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port);
482  }
483 
486  FwIndexType portNum,
487  Fw::InputLogPort* port
488  )
489  {
490  FW_ASSERT(
491  portNum < this->getNum_eventOut_OutputPorts(),
492  static_cast<FwAssertArgType>(portNum)
493  );
494 
495  this->m_eventOut_OutputPort[portNum].addCallPort(port);
496  }
497 
498 #if FW_ENABLE_TEXT_LOGGING == 1
499 
500  void FileDownlinkComponentBase ::
501  set_textEventOut_OutputPort(
502  FwIndexType portNum,
504  )
505  {
506  FW_ASSERT(
507  portNum < this->getNum_textEventOut_OutputPorts(),
508  static_cast<FwAssertArgType>(portNum)
509  );
510 
511  this->m_textEventOut_OutputPort[portNum].addCallPort(port);
512  }
513 
514 #endif
515 
518  FwIndexType portNum,
519  Fw::InputTimePort* port
520  )
521  {
522  FW_ASSERT(
523  portNum < this->getNum_timeCaller_OutputPorts(),
524  static_cast<FwAssertArgType>(portNum)
525  );
526 
527  this->m_timeCaller_OutputPort[portNum].addCallPort(port);
528  }
529 
532  FwIndexType portNum,
533  Fw::InputTlmPort* port
534  )
535  {
536  FW_ASSERT(
537  portNum < this->getNum_tlmOut_OutputPorts(),
538  static_cast<FwAssertArgType>(portNum)
539  );
540 
541  this->m_tlmOut_OutputPort[portNum].addCallPort(port);
542  }
543 
544  // ----------------------------------------------------------------------
545  // Connect typed input ports to typed output ports
546  // ----------------------------------------------------------------------
547 
550  FwIndexType portNum,
552  )
553  {
554  FW_ASSERT(
555  portNum < this->getNum_FileComplete_OutputPorts(),
556  static_cast<FwAssertArgType>(portNum)
557  );
558 
559  this->m_FileComplete_OutputPort[portNum].addCallPort(port);
560  }
561 
564  FwIndexType portNum,
566  )
567  {
568  FW_ASSERT(
569  portNum < this->getNum_bufferSendOut_OutputPorts(),
570  static_cast<FwAssertArgType>(portNum)
571  );
572 
573  this->m_bufferSendOut_OutputPort[portNum].addCallPort(port);
574  }
575 
578  FwIndexType portNum,
579  Svc::InputPingPort* port
580  )
581  {
582  FW_ASSERT(
583  portNum < this->getNum_pingOut_OutputPorts(),
584  static_cast<FwAssertArgType>(portNum)
585  );
586 
587  this->m_pingOut_OutputPort[portNum].addCallPort(port);
588  }
589 
590 #if FW_PORT_SERIALIZATION
591 
592  // ----------------------------------------------------------------------
593  // Connect serial input ports to special output ports
594  // ----------------------------------------------------------------------
595 
598  FwIndexType portNum,
599  Fw::InputSerializePort* port
600  )
601  {
602  FW_ASSERT(
603  portNum < this->getNum_cmdRegOut_OutputPorts(),
604  static_cast<FwAssertArgType>(portNum)
605  );
606 
607  this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port);
608  }
609 
612  FwIndexType portNum,
613  Fw::InputSerializePort* port
614  )
615  {
616  FW_ASSERT(
617  portNum < this->getNum_cmdResponseOut_OutputPorts(),
618  static_cast<FwAssertArgType>(portNum)
619  );
620 
621  this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port);
622  }
623 
626  FwIndexType portNum,
627  Fw::InputSerializePort* port
628  )
629  {
630  FW_ASSERT(
631  portNum < this->getNum_eventOut_OutputPorts(),
632  static_cast<FwAssertArgType>(portNum)
633  );
634 
635  this->m_eventOut_OutputPort[portNum].registerSerialPort(port);
636  }
637 
638 #if FW_ENABLE_TEXT_LOGGING == 1
639 
640  void FileDownlinkComponentBase ::
641  set_textEventOut_OutputPort(
642  FwIndexType portNum,
643  Fw::InputSerializePort* port
644  )
645  {
646  FW_ASSERT(
647  portNum < this->getNum_textEventOut_OutputPorts(),
648  static_cast<FwAssertArgType>(portNum)
649  );
650 
651  this->m_textEventOut_OutputPort[portNum].registerSerialPort(port);
652  }
653 
654 #endif
655 
658  FwIndexType portNum,
659  Fw::InputSerializePort* port
660  )
661  {
662  FW_ASSERT(
663  portNum < this->getNum_timeCaller_OutputPorts(),
664  static_cast<FwAssertArgType>(portNum)
665  );
666 
667  this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
668  }
669 
672  FwIndexType portNum,
673  Fw::InputSerializePort* port
674  )
675  {
676  FW_ASSERT(
677  portNum < this->getNum_tlmOut_OutputPorts(),
678  static_cast<FwAssertArgType>(portNum)
679  );
680 
681  this->m_tlmOut_OutputPort[portNum].registerSerialPort(port);
682  }
683 
684 #endif
685 
686 #if FW_PORT_SERIALIZATION
687 
688  // ----------------------------------------------------------------------
689  // Connect serial input ports to typed output ports
690  // ----------------------------------------------------------------------
691 
694  FwIndexType portNum,
695  Fw::InputSerializePort* port
696  )
697  {
698  FW_ASSERT(
699  portNum < this->getNum_FileComplete_OutputPorts(),
700  static_cast<FwAssertArgType>(portNum)
701  );
702 
703  this->m_FileComplete_OutputPort[portNum].registerSerialPort(port);
704  }
705 
708  FwIndexType portNum,
709  Fw::InputSerializePort* port
710  )
711  {
712  FW_ASSERT(
713  portNum < this->getNum_bufferSendOut_OutputPorts(),
714  static_cast<FwAssertArgType>(portNum)
715  );
716 
717  this->m_bufferSendOut_OutputPort[portNum].registerSerialPort(port);
718  }
719 
722  FwIndexType portNum,
723  Fw::InputSerializePort* port
724  )
725  {
726  FW_ASSERT(
727  portNum < this->getNum_pingOut_OutputPorts(),
728  static_cast<FwAssertArgType>(portNum)
729  );
730 
731  this->m_pingOut_OutputPort[portNum].registerSerialPort(port);
732  }
733 
734 #endif
735 
736  // ----------------------------------------------------------------------
737  // Command registration
738  // ----------------------------------------------------------------------
739 
742  {
743  FW_ASSERT(this->m_cmdRegOut_OutputPort[0].isConnected());
744 
745  this->m_cmdRegOut_OutputPort[0].invoke(
746  this->getIdBase() + OPCODE_SENDFILE
747  );
748 
749  this->m_cmdRegOut_OutputPort[0].invoke(
750  this->getIdBase() + OPCODE_CANCEL
751  );
752 
753  this->m_cmdRegOut_OutputPort[0].invoke(
754  this->getIdBase() + OPCODE_SENDPARTIAL
755  );
756  }
757 
758  // ----------------------------------------------------------------------
759  // Component construction and destruction
760  // ----------------------------------------------------------------------
761 
763  FileDownlinkComponentBase(const char* compName) :
764  Fw::ActiveComponentBase(compName)
765  {
766 
767  }
768 
771  {
772 
773  }
774 
775  // ----------------------------------------------------------------------
776  // Getters for numbers of special input ports
777  // ----------------------------------------------------------------------
778 
781  {
782  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_cmdIn_InputPort));
783  }
784 
785  // ----------------------------------------------------------------------
786  // Getters for numbers of typed input ports
787  // ----------------------------------------------------------------------
788 
791  {
792  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_Run_InputPort));
793  }
794 
797  {
798  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_SendFile_InputPort));
799  }
800 
803  {
804  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_bufferReturn_InputPort));
805  }
806 
809  {
810  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_pingIn_InputPort));
811  }
812 
813  // ----------------------------------------------------------------------
814  // Getters for numbers of special output ports
815  // ----------------------------------------------------------------------
816 
819  {
820  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_cmdRegOut_OutputPort));
821  }
822 
825  {
826  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_cmdResponseOut_OutputPort));
827  }
828 
831  {
832  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_eventOut_OutputPort));
833  }
834 
835 #if FW_ENABLE_TEXT_LOGGING == 1
836 
837  FwIndexType FileDownlinkComponentBase ::
838  getNum_textEventOut_OutputPorts() const
839  {
840  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_textEventOut_OutputPort));
841  }
842 
843 #endif
844 
847  {
848  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_timeCaller_OutputPort));
849  }
850 
853  {
854  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_tlmOut_OutputPort));
855  }
856 
857  // ----------------------------------------------------------------------
858  // Getters for numbers of typed output ports
859  // ----------------------------------------------------------------------
860 
863  {
864  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_FileComplete_OutputPort));
865  }
866 
869  {
870  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_bufferSendOut_OutputPort));
871  }
872 
875  {
876  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_pingOut_OutputPort));
877  }
878 
879  // ----------------------------------------------------------------------
880  // Connection status queries for special output ports
881  // ----------------------------------------------------------------------
882 
885  {
886  FW_ASSERT(
887  portNum < this->getNum_cmdRegOut_OutputPorts(),
888  static_cast<FwAssertArgType>(portNum)
889  );
890 
891  return this->m_cmdRegOut_OutputPort[portNum].isConnected();
892  }
893 
896  {
897  FW_ASSERT(
898  portNum < this->getNum_cmdResponseOut_OutputPorts(),
899  static_cast<FwAssertArgType>(portNum)
900  );
901 
902  return this->m_cmdResponseOut_OutputPort[portNum].isConnected();
903  }
904 
907  {
908  FW_ASSERT(
909  portNum < this->getNum_eventOut_OutputPorts(),
910  static_cast<FwAssertArgType>(portNum)
911  );
912 
913  return this->m_eventOut_OutputPort[portNum].isConnected();
914  }
915 
916 #if FW_ENABLE_TEXT_LOGGING == 1
917 
918  bool FileDownlinkComponentBase ::
919  isConnected_textEventOut_OutputPort(FwIndexType portNum)
920  {
921  FW_ASSERT(
922  portNum < this->getNum_textEventOut_OutputPorts(),
923  static_cast<FwAssertArgType>(portNum)
924  );
925 
926  return this->m_textEventOut_OutputPort[portNum].isConnected();
927  }
928 
929 #endif
930 
933  {
934  FW_ASSERT(
935  portNum < this->getNum_timeCaller_OutputPorts(),
936  static_cast<FwAssertArgType>(portNum)
937  );
938 
939  return this->m_timeCaller_OutputPort[portNum].isConnected();
940  }
941 
944  {
945  FW_ASSERT(
946  portNum < this->getNum_tlmOut_OutputPorts(),
947  static_cast<FwAssertArgType>(portNum)
948  );
949 
950  return this->m_tlmOut_OutputPort[portNum].isConnected();
951  }
952 
953  // ----------------------------------------------------------------------
954  // Connection status queries for typed output ports
955  // ----------------------------------------------------------------------
956 
959  {
960  FW_ASSERT(
961  portNum < this->getNum_FileComplete_OutputPorts(),
962  static_cast<FwAssertArgType>(portNum)
963  );
964 
965  return this->m_FileComplete_OutputPort[portNum].isConnected();
966  }
967 
970  {
971  FW_ASSERT(
972  portNum < this->getNum_bufferSendOut_OutputPorts(),
973  static_cast<FwAssertArgType>(portNum)
974  );
975 
976  return this->m_bufferSendOut_OutputPort[portNum].isConnected();
977  }
978 
981  {
982  FW_ASSERT(
983  portNum < this->getNum_pingOut_OutputPorts(),
984  static_cast<FwAssertArgType>(portNum)
985  );
986 
987  return this->m_pingOut_OutputPort[portNum].isConnected();
988  }
989 
990  // ----------------------------------------------------------------------
991  // Port handler base-class functions for typed input ports
992  //
993  // Call these functions directly to bypass the corresponding ports
994  // ----------------------------------------------------------------------
995 
998  FwIndexType portNum,
999  U32 context
1000  )
1001  {
1002  // Make sure port number is valid
1003  FW_ASSERT(
1004  portNum < this->getNum_Run_InputPorts(),
1005  static_cast<FwAssertArgType>(portNum)
1006  );
1007 
1008  // Call pre-message hook
1010  portNum,
1011  context
1012  );
1013  ComponentIpcSerializableBuffer msg;
1015 
1016  // Serialize message ID
1017  _status = msg.serialize(
1018  static_cast<FwEnumStoreType>(RUN_SCHED)
1019  );
1020  FW_ASSERT(
1021  _status == Fw::FW_SERIALIZE_OK,
1022  static_cast<FwAssertArgType>(_status)
1023  );
1024 
1025  // Serialize port number
1026  _status = msg.serialize(portNum);
1027  FW_ASSERT(
1028  _status == Fw::FW_SERIALIZE_OK,
1029  static_cast<FwAssertArgType>(_status)
1030  );
1031 
1032  // Serialize argument context
1033  _status = msg.serialize(context);
1034  FW_ASSERT(
1035  _status == Fw::FW_SERIALIZE_OK,
1036  static_cast<FwAssertArgType>(_status)
1037  );
1038 
1039  // Send message
1041  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1042 
1043  FW_ASSERT(
1044  qStatus == Os::Queue::OP_OK,
1045  static_cast<FwAssertArgType>(qStatus)
1046  );
1047  }
1048 
1051  FwIndexType portNum,
1052  const Fw::StringBase& sourceFileName,
1053  const Fw::StringBase& destFileName,
1054  U32 offset,
1055  U32 length
1056  )
1057  {
1058  // Make sure port number is valid
1059  FW_ASSERT(
1060  portNum < this->getNum_SendFile_InputPorts(),
1061  static_cast<FwAssertArgType>(portNum)
1062  );
1063 
1064  Svc::SendFileResponse retVal;
1065 
1066  // Lock guard mutex before calling
1067  this->lock();
1068 
1069  // Call handler function
1070  retVal = this->SendFile_handler(
1071  portNum,
1072  sourceFileName,
1073  destFileName,
1074  offset,
1075  length
1076  );
1077 
1078  // Unlock guard mutex
1079  this->unLock();
1080 
1081  return retVal;
1082  }
1083 
1086  FwIndexType portNum,
1087  Fw::Buffer& fwBuffer
1088  )
1089  {
1090  // Make sure port number is valid
1091  FW_ASSERT(
1092  portNum < this->getNum_bufferReturn_InputPorts(),
1093  static_cast<FwAssertArgType>(portNum)
1094  );
1095 
1096  // Call pre-message hook
1098  portNum,
1099  fwBuffer
1100  );
1101  ComponentIpcSerializableBuffer msg;
1103 
1104  // Serialize message ID
1105  _status = msg.serialize(
1106  static_cast<FwEnumStoreType>(BUFFERRETURN_BUFFERSEND)
1107  );
1108  FW_ASSERT(
1109  _status == Fw::FW_SERIALIZE_OK,
1110  static_cast<FwAssertArgType>(_status)
1111  );
1112 
1113  // Serialize port number
1114  _status = msg.serialize(portNum);
1115  FW_ASSERT(
1116  _status == Fw::FW_SERIALIZE_OK,
1117  static_cast<FwAssertArgType>(_status)
1118  );
1119 
1120  // Serialize argument fwBuffer
1121  _status = msg.serialize(fwBuffer);
1122  FW_ASSERT(
1123  _status == Fw::FW_SERIALIZE_OK,
1124  static_cast<FwAssertArgType>(_status)
1125  );
1126 
1127  // Send message
1129  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1130 
1131  FW_ASSERT(
1132  qStatus == Os::Queue::OP_OK,
1133  static_cast<FwAssertArgType>(qStatus)
1134  );
1135  }
1136 
1139  FwIndexType portNum,
1140  U32 key
1141  )
1142  {
1143  // Make sure port number is valid
1144  FW_ASSERT(
1145  portNum < this->getNum_pingIn_InputPorts(),
1146  static_cast<FwAssertArgType>(portNum)
1147  );
1148 
1149  // Call pre-message hook
1151  portNum,
1152  key
1153  );
1154  ComponentIpcSerializableBuffer msg;
1156 
1157  // Serialize message ID
1158  _status = msg.serialize(
1159  static_cast<FwEnumStoreType>(PINGIN_PING)
1160  );
1161  FW_ASSERT(
1162  _status == Fw::FW_SERIALIZE_OK,
1163  static_cast<FwAssertArgType>(_status)
1164  );
1165 
1166  // Serialize port number
1167  _status = msg.serialize(portNum);
1168  FW_ASSERT(
1169  _status == Fw::FW_SERIALIZE_OK,
1170  static_cast<FwAssertArgType>(_status)
1171  );
1172 
1173  // Serialize argument key
1174  _status = msg.serialize(key);
1175  FW_ASSERT(
1176  _status == Fw::FW_SERIALIZE_OK,
1177  static_cast<FwAssertArgType>(_status)
1178  );
1179 
1180  // Send message
1182  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1183 
1184  FW_ASSERT(
1185  qStatus == Os::Queue::OP_OK,
1186  static_cast<FwAssertArgType>(qStatus)
1187  );
1188  }
1189 
1190  // ----------------------------------------------------------------------
1191  // Pre-message hooks for typed async input ports
1192  //
1193  // Each of these functions is invoked just before processing a message
1194  // on the corresponding port. By default, they do nothing. You can
1195  // override them to provide specific pre-message behavior.
1196  // ----------------------------------------------------------------------
1197 
1200  FwIndexType portNum,
1201  U32 context
1202  )
1203  {
1204  // Default: no-op
1205  }
1206 
1209  FwIndexType portNum,
1210  Fw::Buffer& fwBuffer
1211  )
1212  {
1213  // Default: no-op
1214  }
1215 
1218  FwIndexType portNum,
1219  U32 key
1220  )
1221  {
1222  // Default: no-op
1223  }
1224 
1225  // ----------------------------------------------------------------------
1226  // Invocation functions for typed output ports
1227  // ----------------------------------------------------------------------
1228 
1231  FwIndexType portNum,
1232  const Svc::SendFileResponse& resp
1233  )
1234  {
1235  FW_ASSERT(
1236  portNum < this->getNum_FileComplete_OutputPorts(),
1237  static_cast<FwAssertArgType>(portNum)
1238  );
1239  this->m_FileComplete_OutputPort[portNum].invoke(
1240  resp
1241  );
1242  }
1243 
1246  FwIndexType portNum,
1247  Fw::Buffer& fwBuffer
1248  )
1249  {
1250  FW_ASSERT(
1251  portNum < this->getNum_bufferSendOut_OutputPorts(),
1252  static_cast<FwAssertArgType>(portNum)
1253  );
1254  this->m_bufferSendOut_OutputPort[portNum].invoke(
1255  fwBuffer
1256  );
1257  }
1258 
1261  FwIndexType portNum,
1262  U32 key
1263  )
1264  {
1265  FW_ASSERT(
1266  portNum < this->getNum_pingOut_OutputPorts(),
1267  static_cast<FwAssertArgType>(portNum)
1268  );
1269  this->m_pingOut_OutputPort[portNum].invoke(
1270  key
1271  );
1272  }
1273 
1274  // ----------------------------------------------------------------------
1275  // Command response
1276  // ----------------------------------------------------------------------
1277 
1280  FwOpcodeType opCode,
1281  U32 cmdSeq,
1282  Fw::CmdResponse response
1283  )
1284  {
1285  FW_ASSERT(this->m_cmdResponseOut_OutputPort[0].isConnected());
1286  this->m_cmdResponseOut_OutputPort[0].invoke(opCode, cmdSeq, response);
1287  }
1288 
1289  // ----------------------------------------------------------------------
1290  // Command handler base-class functions
1291  //
1292  // Call these functions directly to bypass the command input port
1293  // ----------------------------------------------------------------------
1294 
1297  FwOpcodeType opCode,
1298  U32 cmdSeq,
1299  Fw::CmdArgBuffer& args
1300  )
1301  {
1302  // Call pre-message hook
1303  this->SendFile_preMsgHook(opCode,cmdSeq);
1304 
1305  // Defer deserializing arguments to the message dispatcher
1306  // to avoid deserializing and reserializing just for IPC
1307  ComponentIpcSerializableBuffer msg;
1309 
1310  // Serialize for IPC
1311  _status = msg.serialize(static_cast<FwEnumStoreType>(CMD_SENDFILE));
1312  FW_ASSERT (
1313  _status == Fw::FW_SERIALIZE_OK,
1314  static_cast<FwAssertArgType>(_status)
1315  );
1316 
1317  // Fake port number to make message dequeue work
1318  FwIndexType port = 0;
1319 
1320  _status = msg.serialize(port);
1321  FW_ASSERT (
1322  _status == Fw::FW_SERIALIZE_OK,
1323  static_cast<FwAssertArgType>(_status)
1324  );
1325 
1326  _status = msg.serialize(opCode);
1327  FW_ASSERT (
1328  _status == Fw::FW_SERIALIZE_OK,
1329  static_cast<FwAssertArgType>(_status)
1330  );
1331 
1332  _status = msg.serialize(cmdSeq);
1333  FW_ASSERT (
1334  _status == Fw::FW_SERIALIZE_OK,
1335  static_cast<FwAssertArgType>(_status)
1336  );
1337 
1338  _status = msg.serialize(args);
1339  FW_ASSERT (
1340  _status == Fw::FW_SERIALIZE_OK,
1341  static_cast<FwAssertArgType>(_status)
1342  );
1343 
1344  // Send message
1346  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1347 
1348  FW_ASSERT(
1349  qStatus == Os::Queue::OP_OK,
1350  static_cast<FwAssertArgType>(qStatus)
1351  );
1352  }
1353 
1356  FwOpcodeType opCode,
1357  U32 cmdSeq,
1358  Fw::CmdArgBuffer& args
1359  )
1360  {
1361  // Call pre-message hook
1362  this->Cancel_preMsgHook(opCode,cmdSeq);
1363 
1364  // Defer deserializing arguments to the message dispatcher
1365  // to avoid deserializing and reserializing just for IPC
1366  ComponentIpcSerializableBuffer msg;
1368 
1369  // Serialize for IPC
1370  _status = msg.serialize(static_cast<FwEnumStoreType>(CMD_CANCEL));
1371  FW_ASSERT (
1372  _status == Fw::FW_SERIALIZE_OK,
1373  static_cast<FwAssertArgType>(_status)
1374  );
1375 
1376  // Fake port number to make message dequeue work
1377  FwIndexType port = 0;
1378 
1379  _status = msg.serialize(port);
1380  FW_ASSERT (
1381  _status == Fw::FW_SERIALIZE_OK,
1382  static_cast<FwAssertArgType>(_status)
1383  );
1384 
1385  _status = msg.serialize(opCode);
1386  FW_ASSERT (
1387  _status == Fw::FW_SERIALIZE_OK,
1388  static_cast<FwAssertArgType>(_status)
1389  );
1390 
1391  _status = msg.serialize(cmdSeq);
1392  FW_ASSERT (
1393  _status == Fw::FW_SERIALIZE_OK,
1394  static_cast<FwAssertArgType>(_status)
1395  );
1396 
1397  _status = msg.serialize(args);
1398  FW_ASSERT (
1399  _status == Fw::FW_SERIALIZE_OK,
1400  static_cast<FwAssertArgType>(_status)
1401  );
1402 
1403  // Send message
1405  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1406 
1407  FW_ASSERT(
1408  qStatus == Os::Queue::OP_OK,
1409  static_cast<FwAssertArgType>(qStatus)
1410  );
1411  }
1412 
1415  FwOpcodeType opCode,
1416  U32 cmdSeq,
1417  Fw::CmdArgBuffer& args
1418  )
1419  {
1420  // Call pre-message hook
1421  this->SendPartial_preMsgHook(opCode,cmdSeq);
1422 
1423  // Defer deserializing arguments to the message dispatcher
1424  // to avoid deserializing and reserializing just for IPC
1425  ComponentIpcSerializableBuffer msg;
1427 
1428  // Serialize for IPC
1429  _status = msg.serialize(static_cast<FwEnumStoreType>(CMD_SENDPARTIAL));
1430  FW_ASSERT (
1431  _status == Fw::FW_SERIALIZE_OK,
1432  static_cast<FwAssertArgType>(_status)
1433  );
1434 
1435  // Fake port number to make message dequeue work
1436  FwIndexType port = 0;
1437 
1438  _status = msg.serialize(port);
1439  FW_ASSERT (
1440  _status == Fw::FW_SERIALIZE_OK,
1441  static_cast<FwAssertArgType>(_status)
1442  );
1443 
1444  _status = msg.serialize(opCode);
1445  FW_ASSERT (
1446  _status == Fw::FW_SERIALIZE_OK,
1447  static_cast<FwAssertArgType>(_status)
1448  );
1449 
1450  _status = msg.serialize(cmdSeq);
1451  FW_ASSERT (
1452  _status == Fw::FW_SERIALIZE_OK,
1453  static_cast<FwAssertArgType>(_status)
1454  );
1455 
1456  _status = msg.serialize(args);
1457  FW_ASSERT (
1458  _status == Fw::FW_SERIALIZE_OK,
1459  static_cast<FwAssertArgType>(_status)
1460  );
1461 
1462  // Send message
1464  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1465 
1466  FW_ASSERT(
1467  qStatus == Os::Queue::OP_OK,
1468  static_cast<FwAssertArgType>(qStatus)
1469  );
1470  }
1471 
1472  // ----------------------------------------------------------------------
1473  // Pre-message hooks for async commands
1474  //
1475  // Each of these functions is invoked just before processing the
1476  // corresponding command. By default they do nothing. You can
1477  // override them to provide specific pre-command behavior.
1478  // ----------------------------------------------------------------------
1479 
1482  FwOpcodeType opCode,
1483  U32 cmdSeq
1484  )
1485  {
1486  // Defaults to no-op; can be overridden
1487  (void) opCode;
1488  (void) cmdSeq;
1489  }
1490 
1493  FwOpcodeType opCode,
1494  U32 cmdSeq
1495  )
1496  {
1497  // Defaults to no-op; can be overridden
1498  (void) opCode;
1499  (void) cmdSeq;
1500  }
1501 
1504  FwOpcodeType opCode,
1505  U32 cmdSeq
1506  )
1507  {
1508  // Defaults to no-op; can be overridden
1509  (void) opCode;
1510  (void) cmdSeq;
1511  }
1512 
1513  // ----------------------------------------------------------------------
1514  // Event logging functions
1515  // ----------------------------------------------------------------------
1516 
1519  {
1520  // Get the time
1521  Fw::Time _logTime;
1522  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1523  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1524  }
1525 
1526  FwEventIdType _id = static_cast<FwEventIdType>(0);
1527 
1528  _id = this->getIdBase() + EVENTID_FILEOPENERROR;
1529 
1530  // Emit the event on the log port
1531  if (this->m_eventOut_OutputPort[0].isConnected()) {
1532  Fw::LogBuffer _logBuff;
1534 
1535 #if FW_AMPCS_COMPATIBLE
1536  // Serialize the number of arguments
1537  _status = _logBuff.serialize(static_cast<U8>(1));
1538  FW_ASSERT(
1539  _status == Fw::FW_SERIALIZE_OK,
1540  static_cast<FwAssertArgType>(_status)
1541  );
1542 #endif
1543 
1544  _status = fileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 100));
1545  FW_ASSERT(
1546  _status == Fw::FW_SERIALIZE_OK,
1547  static_cast<FwAssertArgType>(_status)
1548  );
1549 
1550  this->m_eventOut_OutputPort[0].invoke(
1551  _id,
1552  _logTime,
1554  _logBuff
1555  );
1556  }
1557 
1558  // Emit the event on the text log port
1559 #if FW_ENABLE_TEXT_LOGGING
1560  if (this->m_textEventOut_OutputPort[0].isConnected()) {
1561 #if FW_OBJECT_NAMES == 1
1562  const char* _formatString =
1563  "(%s) %s: Could not open file %s";
1564 #else
1565  const char* _formatString =
1566  "%s: Could not open file %s";
1567 #endif
1568 
1569  Fw::TextLogString _logString;
1570  _logString.format(
1571  _formatString,
1572 #if FW_OBJECT_NAMES == 1
1573  this->m_objName.toChar(),
1574 #endif
1575  "FileOpenError ",
1576  fileName.toChar()
1577  );
1578 
1579  this->m_textEventOut_OutputPort[0].invoke(
1580  _id,
1581  _logTime,
1583  _logString
1584  );
1585  }
1586 #endif
1587  }
1588 
1591  const Fw::StringBase& fileName,
1592  I32 status
1593  ) const
1594  {
1595  // Get the time
1596  Fw::Time _logTime;
1597  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1598  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1599  }
1600 
1601  FwEventIdType _id = static_cast<FwEventIdType>(0);
1602 
1603  _id = this->getIdBase() + EVENTID_FILEREADERROR;
1604 
1605  // Emit the event on the log port
1606  if (this->m_eventOut_OutputPort[0].isConnected()) {
1607  Fw::LogBuffer _logBuff;
1609 
1610 #if FW_AMPCS_COMPATIBLE
1611  // Serialize the number of arguments
1612  _status = _logBuff.serialize(static_cast<U8>(2));
1613  FW_ASSERT(
1614  _status == Fw::FW_SERIALIZE_OK,
1615  static_cast<FwAssertArgType>(_status)
1616  );
1617 #endif
1618 
1619  _status = fileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 100));
1620  FW_ASSERT(
1621  _status == Fw::FW_SERIALIZE_OK,
1622  static_cast<FwAssertArgType>(_status)
1623  );
1624 
1625 #if FW_AMPCS_COMPATIBLE
1626  // Serialize the argument size
1627  _status = _logBuff.serialize(
1628  static_cast<U8>(sizeof(I32))
1629  );
1630  FW_ASSERT(
1631  _status == Fw::FW_SERIALIZE_OK,
1632  static_cast<FwAssertArgType>(_status)
1633  );
1634 #endif
1635  _status = _logBuff.serialize(status);
1636  FW_ASSERT(
1637  _status == Fw::FW_SERIALIZE_OK,
1638  static_cast<FwAssertArgType>(_status)
1639  );
1640 
1641  this->m_eventOut_OutputPort[0].invoke(
1642  _id,
1643  _logTime,
1645  _logBuff
1646  );
1647  }
1648 
1649  // Emit the event on the text log port
1650 #if FW_ENABLE_TEXT_LOGGING
1651  if (this->m_textEventOut_OutputPort[0].isConnected()) {
1652 #if FW_OBJECT_NAMES == 1
1653  const char* _formatString =
1654  "(%s) %s: Could not read file %s with status %" PRIi32 "";
1655 #else
1656  const char* _formatString =
1657  "%s: Could not read file %s with status %" PRIi32 "";
1658 #endif
1659 
1660  Fw::TextLogString _logString;
1661  _logString.format(
1662  _formatString,
1663 #if FW_OBJECT_NAMES == 1
1664  this->m_objName.toChar(),
1665 #endif
1666  "FileReadError ",
1667  fileName.toChar(),
1668  status
1669  );
1670 
1671  this->m_textEventOut_OutputPort[0].invoke(
1672  _id,
1673  _logTime,
1675  _logString
1676  );
1677  }
1678 #endif
1679  }
1680 
1683  const Fw::StringBase& sourceFileName,
1684  const Fw::StringBase& destFileName
1685  ) const
1686  {
1687  // Get the time
1688  Fw::Time _logTime;
1689  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1690  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1691  }
1692 
1693  FwEventIdType _id = static_cast<FwEventIdType>(0);
1694 
1695  _id = this->getIdBase() + EVENTID_FILESENT;
1696 
1697  // Emit the event on the log port
1698  if (this->m_eventOut_OutputPort[0].isConnected()) {
1699  Fw::LogBuffer _logBuff;
1701 
1702 #if FW_AMPCS_COMPATIBLE
1703  // Serialize the number of arguments
1704  _status = _logBuff.serialize(static_cast<U8>(2));
1705  FW_ASSERT(
1706  _status == Fw::FW_SERIALIZE_OK,
1707  static_cast<FwAssertArgType>(_status)
1708  );
1709 #endif
1710 
1711  _status = sourceFileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 100));
1712  FW_ASSERT(
1713  _status == Fw::FW_SERIALIZE_OK,
1714  static_cast<FwAssertArgType>(_status)
1715  );
1716 
1717  _status = destFileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 100));
1718  FW_ASSERT(
1719  _status == Fw::FW_SERIALIZE_OK,
1720  static_cast<FwAssertArgType>(_status)
1721  );
1722 
1723  this->m_eventOut_OutputPort[0].invoke(
1724  _id,
1725  _logTime,
1727  _logBuff
1728  );
1729  }
1730 
1731  // Emit the event on the text log port
1732 #if FW_ENABLE_TEXT_LOGGING
1733  if (this->m_textEventOut_OutputPort[0].isConnected()) {
1734 #if FW_OBJECT_NAMES == 1
1735  const char* _formatString =
1736  "(%s) %s: Sent file %s to file %s";
1737 #else
1738  const char* _formatString =
1739  "%s: Sent file %s to file %s";
1740 #endif
1741 
1742  Fw::TextLogString _logString;
1743  _logString.format(
1744  _formatString,
1745 #if FW_OBJECT_NAMES == 1
1746  this->m_objName.toChar(),
1747 #endif
1748  "FileSent ",
1749  sourceFileName.toChar(),
1750  destFileName.toChar()
1751  );
1752 
1753  this->m_textEventOut_OutputPort[0].invoke(
1754  _id,
1755  _logTime,
1757  _logString
1758  );
1759  }
1760 #endif
1761  }
1762 
1765  const Fw::StringBase& sourceFileName,
1766  const Fw::StringBase& destFileName
1767  ) const
1768  {
1769  // Get the time
1770  Fw::Time _logTime;
1771  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1772  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1773  }
1774 
1775  FwEventIdType _id = static_cast<FwEventIdType>(0);
1776 
1777  _id = this->getIdBase() + EVENTID_DOWNLINKCANCELED;
1778 
1779  // Emit the event on the log port
1780  if (this->m_eventOut_OutputPort[0].isConnected()) {
1781  Fw::LogBuffer _logBuff;
1783 
1784 #if FW_AMPCS_COMPATIBLE
1785  // Serialize the number of arguments
1786  _status = _logBuff.serialize(static_cast<U8>(2));
1787  FW_ASSERT(
1788  _status == Fw::FW_SERIALIZE_OK,
1789  static_cast<FwAssertArgType>(_status)
1790  );
1791 #endif
1792 
1793  _status = sourceFileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 100));
1794  FW_ASSERT(
1795  _status == Fw::FW_SERIALIZE_OK,
1796  static_cast<FwAssertArgType>(_status)
1797  );
1798 
1799  _status = destFileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 100));
1800  FW_ASSERT(
1801  _status == Fw::FW_SERIALIZE_OK,
1802  static_cast<FwAssertArgType>(_status)
1803  );
1804 
1805  this->m_eventOut_OutputPort[0].invoke(
1806  _id,
1807  _logTime,
1809  _logBuff
1810  );
1811  }
1812 
1813  // Emit the event on the text log port
1814 #if FW_ENABLE_TEXT_LOGGING
1815  if (this->m_textEventOut_OutputPort[0].isConnected()) {
1816 #if FW_OBJECT_NAMES == 1
1817  const char* _formatString =
1818  "(%s) %s: Canceled downlink of file %s to file %s";
1819 #else
1820  const char* _formatString =
1821  "%s: Canceled downlink of file %s to file %s";
1822 #endif
1823 
1824  Fw::TextLogString _logString;
1825  _logString.format(
1826  _formatString,
1827 #if FW_OBJECT_NAMES == 1
1828  this->m_objName.toChar(),
1829 #endif
1830  "DownlinkCanceled ",
1831  sourceFileName.toChar(),
1832  destFileName.toChar()
1833  );
1834 
1835  this->m_textEventOut_OutputPort[0].invoke(
1836  _id,
1837  _logTime,
1839  _logString
1840  );
1841  }
1842 #endif
1843  }
1844 
1847  const Fw::StringBase& sourceFileName,
1848  const Fw::StringBase& destFileName
1849  ) const
1850  {
1851  // Get the time
1852  Fw::Time _logTime;
1853  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1854  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1855  }
1856 
1857  FwEventIdType _id = static_cast<FwEventIdType>(0);
1858 
1859  _id = this->getIdBase() + EVENTID_DOWNLINKTIMEOUT;
1860 
1861  // Emit the event on the log port
1862  if (this->m_eventOut_OutputPort[0].isConnected()) {
1863  Fw::LogBuffer _logBuff;
1865 
1866 #if FW_AMPCS_COMPATIBLE
1867  // Serialize the number of arguments
1868  _status = _logBuff.serialize(static_cast<U8>(2));
1869  FW_ASSERT(
1870  _status == Fw::FW_SERIALIZE_OK,
1871  static_cast<FwAssertArgType>(_status)
1872  );
1873 #endif
1874 
1875  _status = sourceFileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 100));
1876  FW_ASSERT(
1877  _status == Fw::FW_SERIALIZE_OK,
1878  static_cast<FwAssertArgType>(_status)
1879  );
1880 
1881  _status = destFileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 100));
1882  FW_ASSERT(
1883  _status == Fw::FW_SERIALIZE_OK,
1884  static_cast<FwAssertArgType>(_status)
1885  );
1886 
1887  this->m_eventOut_OutputPort[0].invoke(
1888  _id,
1889  _logTime,
1891  _logBuff
1892  );
1893  }
1894 
1895  // Emit the event on the text log port
1896 #if FW_ENABLE_TEXT_LOGGING
1897  if (this->m_textEventOut_OutputPort[0].isConnected()) {
1898 #if FW_OBJECT_NAMES == 1
1899  const char* _formatString =
1900  "(%s) %s: Timeout occurred during downlink of file %s to file %s. Downlink has been canceled.";
1901 #else
1902  const char* _formatString =
1903  "%s: Timeout occurred during downlink of file %s to file %s. Downlink has been canceled.";
1904 #endif
1905 
1906  Fw::TextLogString _logString;
1907  _logString.format(
1908  _formatString,
1909 #if FW_OBJECT_NAMES == 1
1910  this->m_objName.toChar(),
1911 #endif
1912  "DownlinkTimeout ",
1913  sourceFileName.toChar(),
1914  destFileName.toChar()
1915  );
1916 
1917  this->m_textEventOut_OutputPort[0].invoke(
1918  _id,
1919  _logTime,
1921  _logString
1922  );
1923  }
1924 #endif
1925  }
1926 
1929  U32 startOffset,
1930  U32 length,
1931  U32 filesize,
1932  const Fw::StringBase& sourceFileName,
1933  const Fw::StringBase& destFileName
1934  ) const
1935  {
1936  // Get the time
1937  Fw::Time _logTime;
1938  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1939  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1940  }
1941 
1942  FwEventIdType _id = static_cast<FwEventIdType>(0);
1943 
1944  _id = this->getIdBase() + EVENTID_DOWNLINKPARTIALWARNING;
1945 
1946  // Emit the event on the log port
1947  if (this->m_eventOut_OutputPort[0].isConnected()) {
1948  Fw::LogBuffer _logBuff;
1950 
1951 #if FW_AMPCS_COMPATIBLE
1952  // Serialize the number of arguments
1953  _status = _logBuff.serialize(static_cast<U8>(5));
1954  FW_ASSERT(
1955  _status == Fw::FW_SERIALIZE_OK,
1956  static_cast<FwAssertArgType>(_status)
1957  );
1958 #endif
1959 
1960 #if FW_AMPCS_COMPATIBLE
1961  // Serialize the argument size
1962  _status = _logBuff.serialize(
1963  static_cast<U8>(sizeof(U32))
1964  );
1965  FW_ASSERT(
1966  _status == Fw::FW_SERIALIZE_OK,
1967  static_cast<FwAssertArgType>(_status)
1968  );
1969 #endif
1970  _status = _logBuff.serialize(startOffset);
1971  FW_ASSERT(
1972  _status == Fw::FW_SERIALIZE_OK,
1973  static_cast<FwAssertArgType>(_status)
1974  );
1975 
1976 #if FW_AMPCS_COMPATIBLE
1977  // Serialize the argument size
1978  _status = _logBuff.serialize(
1979  static_cast<U8>(sizeof(U32))
1980  );
1981  FW_ASSERT(
1982  _status == Fw::FW_SERIALIZE_OK,
1983  static_cast<FwAssertArgType>(_status)
1984  );
1985 #endif
1986  _status = _logBuff.serialize(length);
1987  FW_ASSERT(
1988  _status == Fw::FW_SERIALIZE_OK,
1989  static_cast<FwAssertArgType>(_status)
1990  );
1991 
1992 #if FW_AMPCS_COMPATIBLE
1993  // Serialize the argument size
1994  _status = _logBuff.serialize(
1995  static_cast<U8>(sizeof(U32))
1996  );
1997  FW_ASSERT(
1998  _status == Fw::FW_SERIALIZE_OK,
1999  static_cast<FwAssertArgType>(_status)
2000  );
2001 #endif
2002  _status = _logBuff.serialize(filesize);
2003  FW_ASSERT(
2004  _status == Fw::FW_SERIALIZE_OK,
2005  static_cast<FwAssertArgType>(_status)
2006  );
2007 
2008  _status = sourceFileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 100));
2009  FW_ASSERT(
2010  _status == Fw::FW_SERIALIZE_OK,
2011  static_cast<FwAssertArgType>(_status)
2012  );
2013 
2014  _status = destFileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 100));
2015  FW_ASSERT(
2016  _status == Fw::FW_SERIALIZE_OK,
2017  static_cast<FwAssertArgType>(_status)
2018  );
2019 
2020  this->m_eventOut_OutputPort[0].invoke(
2021  _id,
2022  _logTime,
2024  _logBuff
2025  );
2026  }
2027 
2028  // Emit the event on the text log port
2029 #if FW_ENABLE_TEXT_LOGGING
2030  if (this->m_textEventOut_OutputPort[0].isConnected()) {
2031 #if FW_OBJECT_NAMES == 1
2032  const char* _formatString =
2033  "(%s) %s: Offset %" PRIu32 " plus length %" PRIu32 " is greater than source size %" PRIu32 " for partial downlink of file %s to file %s. ";
2034 #else
2035  const char* _formatString =
2036  "%s: Offset %" PRIu32 " plus length %" PRIu32 " is greater than source size %" PRIu32 " for partial downlink of file %s to file %s. ";
2037 #endif
2038 
2039  Fw::TextLogString _logString;
2040  _logString.format(
2041  _formatString,
2042 #if FW_OBJECT_NAMES == 1
2043  this->m_objName.toChar(),
2044 #endif
2045  "DownlinkPartialWarning ",
2046  startOffset,
2047  length,
2048  filesize,
2049  sourceFileName.toChar(),
2050  destFileName.toChar()
2051  );
2052 
2053  this->m_textEventOut_OutputPort[0].invoke(
2054  _id,
2055  _logTime,
2057  _logString
2058  );
2059  }
2060 #endif
2061  }
2062 
2065  const Fw::StringBase& sourceFileName,
2066  const Fw::StringBase& destFileName,
2067  U32 startOffset,
2068  U32 filesize
2069  ) const
2070  {
2071  // Get the time
2072  Fw::Time _logTime;
2073  if (this->m_timeCaller_OutputPort[0].isConnected()) {
2074  this->m_timeCaller_OutputPort[0].invoke(_logTime);
2075  }
2076 
2077  FwEventIdType _id = static_cast<FwEventIdType>(0);
2078 
2079  _id = this->getIdBase() + EVENTID_DOWNLINKPARTIALFAIL;
2080 
2081  // Emit the event on the log port
2082  if (this->m_eventOut_OutputPort[0].isConnected()) {
2083  Fw::LogBuffer _logBuff;
2085 
2086 #if FW_AMPCS_COMPATIBLE
2087  // Serialize the number of arguments
2088  _status = _logBuff.serialize(static_cast<U8>(4));
2089  FW_ASSERT(
2090  _status == Fw::FW_SERIALIZE_OK,
2091  static_cast<FwAssertArgType>(_status)
2092  );
2093 #endif
2094 
2095  _status = sourceFileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 100));
2096  FW_ASSERT(
2097  _status == Fw::FW_SERIALIZE_OK,
2098  static_cast<FwAssertArgType>(_status)
2099  );
2100 
2101  _status = destFileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 100));
2102  FW_ASSERT(
2103  _status == Fw::FW_SERIALIZE_OK,
2104  static_cast<FwAssertArgType>(_status)
2105  );
2106 
2107 #if FW_AMPCS_COMPATIBLE
2108  // Serialize the argument size
2109  _status = _logBuff.serialize(
2110  static_cast<U8>(sizeof(U32))
2111  );
2112  FW_ASSERT(
2113  _status == Fw::FW_SERIALIZE_OK,
2114  static_cast<FwAssertArgType>(_status)
2115  );
2116 #endif
2117  _status = _logBuff.serialize(startOffset);
2118  FW_ASSERT(
2119  _status == Fw::FW_SERIALIZE_OK,
2120  static_cast<FwAssertArgType>(_status)
2121  );
2122 
2123 #if FW_AMPCS_COMPATIBLE
2124  // Serialize the argument size
2125  _status = _logBuff.serialize(
2126  static_cast<U8>(sizeof(U32))
2127  );
2128  FW_ASSERT(
2129  _status == Fw::FW_SERIALIZE_OK,
2130  static_cast<FwAssertArgType>(_status)
2131  );
2132 #endif
2133  _status = _logBuff.serialize(filesize);
2134  FW_ASSERT(
2135  _status == Fw::FW_SERIALIZE_OK,
2136  static_cast<FwAssertArgType>(_status)
2137  );
2138 
2139  this->m_eventOut_OutputPort[0].invoke(
2140  _id,
2141  _logTime,
2143  _logBuff
2144  );
2145  }
2146 
2147  // Emit the event on the text log port
2148 #if FW_ENABLE_TEXT_LOGGING
2149  if (this->m_textEventOut_OutputPort[0].isConnected()) {
2150 #if FW_OBJECT_NAMES == 1
2151  const char* _formatString =
2152  "(%s) %s: Error occurred during partial downlink of file %s to file %s. Offset %" PRIu32 " greater than or equal to source filesize %" PRIu32 ".";
2153 #else
2154  const char* _formatString =
2155  "%s: Error occurred during partial downlink of file %s to file %s. Offset %" PRIu32 " greater than or equal to source filesize %" PRIu32 ".";
2156 #endif
2157 
2158  Fw::TextLogString _logString;
2159  _logString.format(
2160  _formatString,
2161 #if FW_OBJECT_NAMES == 1
2162  this->m_objName.toChar(),
2163 #endif
2164  "DownlinkPartialFail ",
2165  sourceFileName.toChar(),
2166  destFileName.toChar(),
2167  startOffset,
2168  filesize
2169  );
2170 
2171  this->m_textEventOut_OutputPort[0].invoke(
2172  _id,
2173  _logTime,
2175  _logString
2176  );
2177  }
2178 #endif
2179  }
2180 
2183  const Fw::StringBase& sourceFileName,
2184  U32 byteOffset
2185  ) const
2186  {
2187  // Get the time
2188  Fw::Time _logTime;
2189  if (this->m_timeCaller_OutputPort[0].isConnected()) {
2190  this->m_timeCaller_OutputPort[0].invoke(_logTime);
2191  }
2192 
2193  FwEventIdType _id = static_cast<FwEventIdType>(0);
2194 
2195  _id = this->getIdBase() + EVENTID_SENDDATAFAIL;
2196 
2197  // Emit the event on the log port
2198  if (this->m_eventOut_OutputPort[0].isConnected()) {
2199  Fw::LogBuffer _logBuff;
2201 
2202 #if FW_AMPCS_COMPATIBLE
2203  // Serialize the number of arguments
2204  _status = _logBuff.serialize(static_cast<U8>(2));
2205  FW_ASSERT(
2206  _status == Fw::FW_SERIALIZE_OK,
2207  static_cast<FwAssertArgType>(_status)
2208  );
2209 #endif
2210 
2211  _status = sourceFileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 100));
2212  FW_ASSERT(
2213  _status == Fw::FW_SERIALIZE_OK,
2214  static_cast<FwAssertArgType>(_status)
2215  );
2216 
2217 #if FW_AMPCS_COMPATIBLE
2218  // Serialize the argument size
2219  _status = _logBuff.serialize(
2220  static_cast<U8>(sizeof(U32))
2221  );
2222  FW_ASSERT(
2223  _status == Fw::FW_SERIALIZE_OK,
2224  static_cast<FwAssertArgType>(_status)
2225  );
2226 #endif
2227  _status = _logBuff.serialize(byteOffset);
2228  FW_ASSERT(
2229  _status == Fw::FW_SERIALIZE_OK,
2230  static_cast<FwAssertArgType>(_status)
2231  );
2232 
2233  this->m_eventOut_OutputPort[0].invoke(
2234  _id,
2235  _logTime,
2237  _logBuff
2238  );
2239  }
2240 
2241  // Emit the event on the text log port
2242 #if FW_ENABLE_TEXT_LOGGING
2243  if (this->m_textEventOut_OutputPort[0].isConnected()) {
2244 #if FW_OBJECT_NAMES == 1
2245  const char* _formatString =
2246  "(%s) %s: Failed to send data packet from file %s at byte offset %" PRIu32 ".";
2247 #else
2248  const char* _formatString =
2249  "%s: Failed to send data packet from file %s at byte offset %" PRIu32 ".";
2250 #endif
2251 
2252  Fw::TextLogString _logString;
2253  _logString.format(
2254  _formatString,
2255 #if FW_OBJECT_NAMES == 1
2256  this->m_objName.toChar(),
2257 #endif
2258  "SendDataFail ",
2259  sourceFileName.toChar(),
2260  byteOffset
2261  );
2262 
2263  this->m_textEventOut_OutputPort[0].invoke(
2264  _id,
2265  _logTime,
2267  _logString
2268  );
2269  }
2270 #endif
2271  }
2272 
2275  U32 fileSize,
2276  const Fw::StringBase& sourceFileName,
2277  const Fw::StringBase& destFileName
2278  ) const
2279  {
2280  // Get the time
2281  Fw::Time _logTime;
2282  if (this->m_timeCaller_OutputPort[0].isConnected()) {
2283  this->m_timeCaller_OutputPort[0].invoke(_logTime);
2284  }
2285 
2286  FwEventIdType _id = static_cast<FwEventIdType>(0);
2287 
2288  _id = this->getIdBase() + EVENTID_SENDSTARTED;
2289 
2290  // Emit the event on the log port
2291  if (this->m_eventOut_OutputPort[0].isConnected()) {
2292  Fw::LogBuffer _logBuff;
2294 
2295 #if FW_AMPCS_COMPATIBLE
2296  // Serialize the number of arguments
2297  _status = _logBuff.serialize(static_cast<U8>(3));
2298  FW_ASSERT(
2299  _status == Fw::FW_SERIALIZE_OK,
2300  static_cast<FwAssertArgType>(_status)
2301  );
2302 #endif
2303 
2304 #if FW_AMPCS_COMPATIBLE
2305  // Serialize the argument size
2306  _status = _logBuff.serialize(
2307  static_cast<U8>(sizeof(U32))
2308  );
2309  FW_ASSERT(
2310  _status == Fw::FW_SERIALIZE_OK,
2311  static_cast<FwAssertArgType>(_status)
2312  );
2313 #endif
2314  _status = _logBuff.serialize(fileSize);
2315  FW_ASSERT(
2316  _status == Fw::FW_SERIALIZE_OK,
2317  static_cast<FwAssertArgType>(_status)
2318  );
2319 
2320  _status = sourceFileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 100));
2321  FW_ASSERT(
2322  _status == Fw::FW_SERIALIZE_OK,
2323  static_cast<FwAssertArgType>(_status)
2324  );
2325 
2326  _status = destFileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 100));
2327  FW_ASSERT(
2328  _status == Fw::FW_SERIALIZE_OK,
2329  static_cast<FwAssertArgType>(_status)
2330  );
2331 
2332  this->m_eventOut_OutputPort[0].invoke(
2333  _id,
2334  _logTime,
2336  _logBuff
2337  );
2338  }
2339 
2340  // Emit the event on the text log port
2341 #if FW_ENABLE_TEXT_LOGGING
2342  if (this->m_textEventOut_OutputPort[0].isConnected()) {
2343 #if FW_OBJECT_NAMES == 1
2344  const char* _formatString =
2345  "(%s) %s: Downlink of %" PRIu32 " bytes started from %s to %s";
2346 #else
2347  const char* _formatString =
2348  "%s: Downlink of %" PRIu32 " bytes started from %s to %s";
2349 #endif
2350 
2351  Fw::TextLogString _logString;
2352  _logString.format(
2353  _formatString,
2354 #if FW_OBJECT_NAMES == 1
2355  this->m_objName.toChar(),
2356 #endif
2357  "SendStarted ",
2358  fileSize,
2359  sourceFileName.toChar(),
2360  destFileName.toChar()
2361  );
2362 
2363  this->m_textEventOut_OutputPort[0].invoke(
2364  _id,
2365  _logTime,
2367  _logString
2368  );
2369  }
2370 #endif
2371  }
2372 
2373  // ----------------------------------------------------------------------
2374  // Telemetry write functions
2375  // ----------------------------------------------------------------------
2376 
2379  U32 arg,
2380  Fw::Time _tlmTime
2381  ) const
2382  {
2383  if (this->m_tlmOut_OutputPort[0].isConnected()) {
2384  if (
2385  this->m_timeCaller_OutputPort[0].isConnected() &&
2386  (_tlmTime == Fw::ZERO_TIME)
2387  ) {
2388  this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
2389  }
2390 
2391  Fw::TlmBuffer _tlmBuff;
2392  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
2393  FW_ASSERT(
2394  _stat == Fw::FW_SERIALIZE_OK,
2395  static_cast<FwAssertArgType>(_stat)
2396  );
2397 
2398  FwChanIdType _id;
2399 
2400  _id = this->getIdBase() + CHANNELID_FILESSENT;
2401 
2402  this->m_tlmOut_OutputPort[0].invoke(
2403  _id,
2404  _tlmTime,
2405  _tlmBuff
2406  );
2407  }
2408  }
2409 
2412  U32 arg,
2413  Fw::Time _tlmTime
2414  ) const
2415  {
2416  if (this->m_tlmOut_OutputPort[0].isConnected()) {
2417  if (
2418  this->m_timeCaller_OutputPort[0].isConnected() &&
2419  (_tlmTime == Fw::ZERO_TIME)
2420  ) {
2421  this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
2422  }
2423 
2424  Fw::TlmBuffer _tlmBuff;
2425  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
2426  FW_ASSERT(
2427  _stat == Fw::FW_SERIALIZE_OK,
2428  static_cast<FwAssertArgType>(_stat)
2429  );
2430 
2431  FwChanIdType _id;
2432 
2433  _id = this->getIdBase() + CHANNELID_PACKETSSENT;
2434 
2435  this->m_tlmOut_OutputPort[0].invoke(
2436  _id,
2437  _tlmTime,
2438  _tlmBuff
2439  );
2440  }
2441  }
2442 
2445  U32 arg,
2446  Fw::Time _tlmTime
2447  ) const
2448  {
2449  if (this->m_tlmOut_OutputPort[0].isConnected()) {
2450  if (
2451  this->m_timeCaller_OutputPort[0].isConnected() &&
2452  (_tlmTime == Fw::ZERO_TIME)
2453  ) {
2454  this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
2455  }
2456 
2457  Fw::TlmBuffer _tlmBuff;
2458  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
2459  FW_ASSERT(
2460  _stat == Fw::FW_SERIALIZE_OK,
2461  static_cast<FwAssertArgType>(_stat)
2462  );
2463 
2464  FwChanIdType _id;
2465 
2466  _id = this->getIdBase() + CHANNELID_WARNINGS;
2467 
2468  this->m_tlmOut_OutputPort[0].invoke(
2469  _id,
2470  _tlmTime,
2471  _tlmBuff
2472  );
2473  }
2474  }
2475 
2476  // ----------------------------------------------------------------------
2477  // Time
2478  // ----------------------------------------------------------------------
2479 
2482  {
2483  if (this->m_timeCaller_OutputPort[0].isConnected()) {
2484  Fw::Time _time;
2485  this->m_timeCaller_OutputPort[0].invoke(_time);
2486  return _time;
2487  }
2488  else {
2489  return Fw::Time(TB_NONE, 0, 0);
2490  }
2491  }
2492 
2493  // ----------------------------------------------------------------------
2494  // Mutex operations for guarded ports
2495  //
2496  // You can override these operations to provide more sophisticated
2497  // synchronization
2498  // ----------------------------------------------------------------------
2499 
2502  {
2503  this->m_guardedPortMutex.lock();
2504  }
2505 
2508  {
2509  this->m_guardedPortMutex.unLock();
2510  }
2511 
2512  // ----------------------------------------------------------------------
2513  // Message dispatch functions
2514  // ----------------------------------------------------------------------
2515 
2516  Fw::QueuedComponentBase::MsgDispatchStatus FileDownlinkComponentBase ::
2517  doDispatch()
2518  {
2519  ComponentIpcSerializableBuffer msg;
2520  FwQueuePriorityType priority = 0;
2521 
2522  Os::Queue::Status msgStatus = this->m_queue.receive(
2523  msg,
2525  priority
2526  );
2527  FW_ASSERT(
2528  msgStatus == Os::Queue::OP_OK,
2529  static_cast<FwAssertArgType>(msgStatus)
2530  );
2531 
2532  // Reset to beginning of buffer
2533  msg.resetDeser();
2534 
2535  FwEnumStoreType desMsg = 0;
2536  Fw::SerializeStatus deserStatus = msg.deserialize(desMsg);
2537  FW_ASSERT(
2538  deserStatus == Fw::FW_SERIALIZE_OK,
2539  static_cast<FwAssertArgType>(deserStatus)
2540  );
2541 
2542  MsgTypeEnum msgType = static_cast<MsgTypeEnum>(desMsg);
2543 
2544  if (msgType == FILEDOWNLINK_COMPONENT_EXIT) {
2545  return MSG_DISPATCH_EXIT;
2546  }
2547 
2548  FwIndexType portNum = 0;
2549  deserStatus = msg.deserialize(portNum);
2550  FW_ASSERT(
2551  deserStatus == Fw::FW_SERIALIZE_OK,
2552  static_cast<FwAssertArgType>(deserStatus)
2553  );
2554 
2555  switch (msgType) {
2556  // Handle async input port Run
2557  case RUN_SCHED: {
2558  // Deserialize argument context
2559  U32 context;
2560  deserStatus = msg.deserialize(context);
2561  FW_ASSERT(
2562  deserStatus == Fw::FW_SERIALIZE_OK,
2563  static_cast<FwAssertArgType>(deserStatus)
2564  );
2565  // Call handler function
2566  this->Run_handler(
2567  portNum,
2568  context
2569  );
2570 
2571  break;
2572  }
2573 
2574  // Handle async input port bufferReturn
2575  case BUFFERRETURN_BUFFERSEND: {
2576  // Deserialize argument fwBuffer
2577  Fw::Buffer fwBuffer;
2578  deserStatus = msg.deserialize(fwBuffer);
2579  FW_ASSERT(
2580  deserStatus == Fw::FW_SERIALIZE_OK,
2581  static_cast<FwAssertArgType>(deserStatus)
2582  );
2583  // Call handler function
2584  this->bufferReturn_handler(
2585  portNum,
2586  fwBuffer
2587  );
2588 
2589  break;
2590  }
2591 
2592  // Handle async input port pingIn
2593  case PINGIN_PING: {
2594  // Deserialize argument key
2595  U32 key;
2596  deserStatus = msg.deserialize(key);
2597  FW_ASSERT(
2598  deserStatus == Fw::FW_SERIALIZE_OK,
2599  static_cast<FwAssertArgType>(deserStatus)
2600  );
2601  // Call handler function
2602  this->pingIn_handler(
2603  portNum,
2604  key
2605  );
2606 
2607  break;
2608  }
2609 
2610  // Handle command SendFile
2611  case CMD_SENDFILE: {
2612  // Deserialize opcode
2613  FwOpcodeType opCode = 0;
2614  deserStatus = msg.deserialize(opCode);
2615  FW_ASSERT (
2616  deserStatus == Fw::FW_SERIALIZE_OK,
2617  static_cast<FwAssertArgType>(deserStatus)
2618  );
2619 
2620  // Deserialize command sequence
2621  U32 cmdSeq = 0;
2622  deserStatus = msg.deserialize(cmdSeq);
2623  FW_ASSERT (
2624  deserStatus == Fw::FW_SERIALIZE_OK,
2625  static_cast<FwAssertArgType>(deserStatus)
2626  );
2627 
2628  // Deserialize command argument buffer
2629  Fw::CmdArgBuffer args;
2630  deserStatus = msg.deserialize(args);
2631  FW_ASSERT (
2632  deserStatus == Fw::FW_SERIALIZE_OK,
2633  static_cast<FwAssertArgType>(deserStatus)
2634  );
2635 
2636  // Reset buffer
2637  args.resetDeser();
2638 
2639  // Deserialize argument sourceFileName
2640  Fw::CmdStringArg sourceFileName;
2641  deserStatus = args.deserialize(sourceFileName);
2642  if (deserStatus != Fw::FW_SERIALIZE_OK) {
2643  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
2644  this->cmdResponse_out(
2645  opCode,
2646  cmdSeq,
2648  );
2649  }
2650  // Don't crash the task if bad arguments were passed from the ground
2651  break;
2652  }
2653 
2654  // Deserialize argument destFileName
2655  Fw::CmdStringArg destFileName;
2656  deserStatus = args.deserialize(destFileName);
2657  if (deserStatus != Fw::FW_SERIALIZE_OK) {
2658  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
2659  this->cmdResponse_out(
2660  opCode,
2661  cmdSeq,
2663  );
2664  }
2665  // Don't crash the task if bad arguments were passed from the ground
2666  break;
2667  }
2668 
2669  // Make sure there was no data left over.
2670  // That means the argument buffer size was incorrect.
2671 #if FW_CMD_CHECK_RESIDUAL
2672  if (args.getBuffLeft() != 0) {
2673  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
2674  this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2675  }
2676  // Don't crash the task if bad arguments were passed from the ground
2677  break;
2678  }
2679 #endif
2680 
2681  // Call handler function
2682  this->SendFile_cmdHandler(
2683  opCode, cmdSeq,
2684  sourceFileName,
2685  destFileName
2686  );
2687 
2688  break;
2689  }
2690 
2691  // Handle command Cancel
2692  case CMD_CANCEL: {
2693  // Deserialize opcode
2694  FwOpcodeType opCode = 0;
2695  deserStatus = msg.deserialize(opCode);
2696  FW_ASSERT (
2697  deserStatus == Fw::FW_SERIALIZE_OK,
2698  static_cast<FwAssertArgType>(deserStatus)
2699  );
2700 
2701  // Deserialize command sequence
2702  U32 cmdSeq = 0;
2703  deserStatus = msg.deserialize(cmdSeq);
2704  FW_ASSERT (
2705  deserStatus == Fw::FW_SERIALIZE_OK,
2706  static_cast<FwAssertArgType>(deserStatus)
2707  );
2708 
2709  // Deserialize command argument buffer
2710  Fw::CmdArgBuffer args;
2711  deserStatus = msg.deserialize(args);
2712  FW_ASSERT (
2713  deserStatus == Fw::FW_SERIALIZE_OK,
2714  static_cast<FwAssertArgType>(deserStatus)
2715  );
2716 
2717  // Reset buffer
2718  args.resetDeser();
2719 
2720  // Make sure there was no data left over.
2721  // That means the argument buffer size was incorrect.
2722 #if FW_CMD_CHECK_RESIDUAL
2723  if (args.getBuffLeft() != 0) {
2724  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
2725  this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2726  }
2727  // Don't crash the task if bad arguments were passed from the ground
2728  break;
2729  }
2730 #endif
2731 
2732  // Call handler function
2733  this->Cancel_cmdHandler(opCode, cmdSeq);
2734 
2735  break;
2736  }
2737 
2738  // Handle command SendPartial
2739  case CMD_SENDPARTIAL: {
2740  // Deserialize opcode
2741  FwOpcodeType opCode = 0;
2742  deserStatus = msg.deserialize(opCode);
2743  FW_ASSERT (
2744  deserStatus == Fw::FW_SERIALIZE_OK,
2745  static_cast<FwAssertArgType>(deserStatus)
2746  );
2747 
2748  // Deserialize command sequence
2749  U32 cmdSeq = 0;
2750  deserStatus = msg.deserialize(cmdSeq);
2751  FW_ASSERT (
2752  deserStatus == Fw::FW_SERIALIZE_OK,
2753  static_cast<FwAssertArgType>(deserStatus)
2754  );
2755 
2756  // Deserialize command argument buffer
2757  Fw::CmdArgBuffer args;
2758  deserStatus = msg.deserialize(args);
2759  FW_ASSERT (
2760  deserStatus == Fw::FW_SERIALIZE_OK,
2761  static_cast<FwAssertArgType>(deserStatus)
2762  );
2763 
2764  // Reset buffer
2765  args.resetDeser();
2766 
2767  // Deserialize argument sourceFileName
2768  Fw::CmdStringArg sourceFileName;
2769  deserStatus = args.deserialize(sourceFileName);
2770  if (deserStatus != Fw::FW_SERIALIZE_OK) {
2771  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
2772  this->cmdResponse_out(
2773  opCode,
2774  cmdSeq,
2776  );
2777  }
2778  // Don't crash the task if bad arguments were passed from the ground
2779  break;
2780  }
2781 
2782  // Deserialize argument destFileName
2783  Fw::CmdStringArg destFileName;
2784  deserStatus = args.deserialize(destFileName);
2785  if (deserStatus != Fw::FW_SERIALIZE_OK) {
2786  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
2787  this->cmdResponse_out(
2788  opCode,
2789  cmdSeq,
2791  );
2792  }
2793  // Don't crash the task if bad arguments were passed from the ground
2794  break;
2795  }
2796 
2797  // Deserialize argument startOffset
2798  U32 startOffset;
2799  deserStatus = args.deserialize(startOffset);
2800  if (deserStatus != Fw::FW_SERIALIZE_OK) {
2801  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
2802  this->cmdResponse_out(
2803  opCode,
2804  cmdSeq,
2806  );
2807  }
2808  // Don't crash the task if bad arguments were passed from the ground
2809  break;
2810  }
2811 
2812  // Deserialize argument length
2813  U32 length;
2814  deserStatus = args.deserialize(length);
2815  if (deserStatus != Fw::FW_SERIALIZE_OK) {
2816  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
2817  this->cmdResponse_out(
2818  opCode,
2819  cmdSeq,
2821  );
2822  }
2823  // Don't crash the task if bad arguments were passed from the ground
2824  break;
2825  }
2826 
2827  // Make sure there was no data left over.
2828  // That means the argument buffer size was incorrect.
2829 #if FW_CMD_CHECK_RESIDUAL
2830  if (args.getBuffLeft() != 0) {
2831  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
2832  this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2833  }
2834  // Don't crash the task if bad arguments were passed from the ground
2835  break;
2836  }
2837 #endif
2838 
2839  // Call handler function
2840  this->SendPartial_cmdHandler(
2841  opCode, cmdSeq,
2842  sourceFileName,
2843  destFileName,
2844  startOffset,
2845  length
2846  );
2847 
2848  break;
2849  }
2850 
2851  default:
2852  return MSG_DISPATCH_ERROR;
2853  }
2854 
2855  return MSG_DISPATCH_OK;
2856  }
2857 
2858  // ----------------------------------------------------------------------
2859  // Calls for messages received on special input ports
2860  // ----------------------------------------------------------------------
2861 
2862  void FileDownlinkComponentBase ::
2863  m_p_cmdIn_in(
2864  Fw::PassiveComponentBase* callComp,
2865  FwIndexType portNum,
2866  FwOpcodeType opCode,
2867  U32 cmdSeq,
2868  Fw::CmdArgBuffer& args
2869  )
2870  {
2871  FW_ASSERT(callComp);
2872  FileDownlinkComponentBase* compPtr = static_cast<FileDownlinkComponentBase*>(callComp);
2873 
2874  const U32 idBase = callComp->getIdBase();
2875  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
2876 
2877  // Select base class function based on opcode
2878  switch (opCode - idBase) {
2879  case OPCODE_SENDFILE: {
2880  compPtr->SendFile_cmdHandlerBase(
2881  opCode,
2882  cmdSeq,
2883  args
2884  );
2885  break;
2886  }
2887 
2888  case OPCODE_CANCEL: {
2889  compPtr->Cancel_cmdHandlerBase(
2890  opCode,
2891  cmdSeq,
2892  args
2893  );
2894  break;
2895  }
2896 
2897  case OPCODE_SENDPARTIAL: {
2898  compPtr->SendPartial_cmdHandlerBase(
2899  opCode,
2900  cmdSeq,
2901  args
2902  );
2903  break;
2904  }
2905  }
2906  }
2907 
2908  // ----------------------------------------------------------------------
2909  // Calls for messages received on typed input ports
2910  // ----------------------------------------------------------------------
2911 
2912  void FileDownlinkComponentBase ::
2913  m_p_Run_in(
2914  Fw::PassiveComponentBase* callComp,
2915  FwIndexType portNum,
2916  U32 context
2917  )
2918  {
2919  FW_ASSERT(callComp);
2920  FileDownlinkComponentBase* compPtr = static_cast<FileDownlinkComponentBase*>(callComp);
2921  compPtr->Run_handlerBase(
2922  portNum,
2923  context
2924  );
2925  }
2926 
2927  Svc::SendFileResponse FileDownlinkComponentBase ::
2928  m_p_SendFile_in(
2929  Fw::PassiveComponentBase* callComp,
2930  FwIndexType portNum,
2931  const Fw::StringBase& sourceFileName,
2932  const Fw::StringBase& destFileName,
2933  U32 offset,
2934  U32 length
2935  )
2936  {
2937  FW_ASSERT(callComp);
2938  FileDownlinkComponentBase* compPtr = static_cast<FileDownlinkComponentBase*>(callComp);
2939  return compPtr->SendFile_handlerBase(
2940  portNum,
2941  sourceFileName,
2942  destFileName,
2943  offset,
2944  length
2945  );
2946  }
2947 
2948  void FileDownlinkComponentBase ::
2949  m_p_bufferReturn_in(
2950  Fw::PassiveComponentBase* callComp,
2951  FwIndexType portNum,
2952  Fw::Buffer& fwBuffer
2953  )
2954  {
2955  FW_ASSERT(callComp);
2956  FileDownlinkComponentBase* compPtr = static_cast<FileDownlinkComponentBase*>(callComp);
2957  compPtr->bufferReturn_handlerBase(
2958  portNum,
2959  fwBuffer
2960  );
2961  }
2962 
2963  void FileDownlinkComponentBase ::
2964  m_p_pingIn_in(
2965  Fw::PassiveComponentBase* callComp,
2966  FwIndexType portNum,
2967  U32 key
2968  )
2969  {
2970  FW_ASSERT(callComp);
2971  FileDownlinkComponentBase* compPtr = static_cast<FileDownlinkComponentBase*>(callComp);
2972  compPtr->pingIn_handlerBase(
2973  portNum,
2974  key
2975  );
2976  }
2977 
2978 }
Serialization/Deserialization operation was successful.
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:134
Definition: Time.hpp:9
Operation succeeded.
Definition: Os.hpp:26
NATIVE_UINT_TYPE SizeType
Status
status returned from the queue send function
Definition: Queue.hpp:30
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
void init()
Initialization function.
Definition: SchedPortAc.cpp:56
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void init()
Initialization function.
Definition: CmdPortAc.cpp:56
void unLock()
unlock the mutex and assert success
Definition: Mutex.cpp:40
PlatformSizeType FwSizeType
Definition: FpConfig.h:35
void invoke(U32 key) const
Invoke a port interface.
Definition: PingPortAc.cpp:147
const Time ZERO_TIME
Definition: Time.cpp:5
I32 FwEnumStoreType
Definition: FpConfig.h:64
void init()
Initialization function.
Definition: TlmPortAc.cpp:144
Enum representing a command response.
void addCallPort(InputCmdRegPort *callPort)
Register an input port.
void init()
Initialization function.
PlatformIndexType FwIndexType
Definition: FpConfig.h:25
Os::Queue m_queue
queue object for active component
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:150
void init()
Object initializer.
Definition: ObjBase.cpp:26
The size of the serial representations of the port arguments.
Definition: CmdPortAc.hpp:37
SerializeStatus
forward declaration for string
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: CmdPortAc.cpp:62
Message will block until space is available.
Definition: Queue.hpp:46
void invoke(FwOpcodeType opCode) const
Invoke a port interface.
Serializable::SizeType getBuffLeft() const
returns how much deserialization buffer is left
void init()
Initialization function.
Definition: TimePortAc.cpp:128
void setPortNum(NATIVE_INT_TYPE portNum)
Os::Queue::Status createQueue(FwSizeType depth, FwSizeType msgSize)
#define FW_MIN(a, b)
MIN macro.
Definition: BasicTypes.h:72
A less serious but recoverable event.
void invoke(Fw::Buffer &fwBuffer) const
Invoke a port interface.
void init()
Initialization function.
Definition: PingPortAc.cpp:128
void init()
Initialization function.
void addCallPort(InputBufferSendPort *callPort)
Register an input port.
The size of the serial representations of the port arguments.
Definition: PingPortAc.hpp:36
void invoke(Fw::Time &time) const
Invoke a port interface.
Definition: TimePortAc.cpp:147
U32 FwOpcodeType
Definition: FpConfig.h:91
The size of the serial representations of the port arguments.
const char * toChar() const
Definition: ObjectName.hpp:50
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke a port interface.
No time base has been established.
Definition: FpConfig.h:70
void addCallPort(InputPingPort *callPort)
Register an input port.
Definition: PingPortAc.cpp:134
Status send(const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override
send a message into the queue through delegate
void resetDeser()
reset deserialization to beginning
A serious but recoverable event.
void invoke(FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val) const
Invoke a port interface.
Definition: TlmPortAc.cpp:163
bool isConnected() const
Definition: PortBase.cpp:42
U32 FwEventIdType
Definition: FpConfig.h:103
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:55
void init()
Initialization function.
Definition: LogPortAc.cpp:151
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:30
BlockingType
message type
Definition: Queue.hpp:45
void init()
Initialization function.
#define PRI_PlatformIntType
Command failed to deserialize.
Important informational events.
void init()
Initialization function.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: SchedPortAc.cpp:62
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args) const
Invoke a port interface.
Definition: LogPortAc.cpp:170
PlatformQueuePriorityType FwQueuePriorityType
Definition: FpConfig.h:55
message to exit active component task
A message was sent requesting an exit of the loop.
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
Send file response struct.
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition: BasicTypes.h:70
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:157
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void init()
Initialization function.
void init()
Initialization function.
Definition: PingPortAc.cpp:56
message sent/received okay
Definition: Queue.hpp:31
U8 BYTE
byte type
Definition: BasicTypes.h:31
void invoke(const Svc::SendFileResponse &resp) const
Invoke a port interface.
virtual SerializeStatus serialize(SerializeBufferBase &buffer) const
serialization function
Definition: StringBase.cpp:142
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: PingPortAc.cpp:62
Message will return with status when space is unavailable.
Definition: Queue.hpp:47
The size of the serial representations of the port arguments.
Definition: SchedPortAc.hpp:36
Status receive(U8 *destination, FwSizeType capacity, BlockingType blockType, FwSizeType &actualSize, FwQueuePriorityType &priority) override
receive a message from the queue through delegate
void init()
Initialization function.
void addCallPort(InputSendFileCompletePort *callPort)
Register an input port.
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:148
#define FW_ASSERT(...)
Definition: Assert.hpp:14
#define FW_LOG_STRING_MAX_SIZE
Max size of log string parameter type.
Definition: FpConfig.h:319
virtual const CHAR * toChar() const =0
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.
void lock()
lock the mutex and assert success
Definition: Mutex.cpp:34
U32 FwChanIdType
Definition: FpConfig.h:95