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 
7 #include "Fw/Types/Assert.hpp"
9 #if FW_ENABLE_TEXT_LOGGING
10 #include "Fw/Types/String.hpp"
11 #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::BufferSendPortBuffer::CAPACITY];
32  BYTE pingInPortSize[Svc::PingPortBuffer::CAPACITY];
33  BYTE cmdPortSize[Fw::CmdPortBuffer::CAPACITY];
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 getCapacity() 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 #if !FW_DIRECT_PORT_CALLS
86  // Connect input port cmdIn
87  for (
88  FwIndexType port = 0;
89  port < static_cast<FwIndexType>(this->getNum_cmdIn_InputPorts());
90  port++
91  ) {
92  this->m_cmdIn_InputPort[port].init();
93  this->m_cmdIn_InputPort[port].addCallComp(
94  this,
95  m_p_cmdIn_in
96  );
97  this->m_cmdIn_InputPort[port].setPortNum(port);
98 
99 #if FW_OBJECT_NAMES == 1
100  Fw::ObjectName portName;
101  portName.format(
102  "%s_cmdIn_InputPort[%" PRI_FwIndexType "]",
103  this->m_objName.toChar(),
104  port
105  );
106  this->m_cmdIn_InputPort[port].setObjName(portName.toChar());
107 #endif
108  }
109 #endif
110 
111 #if !FW_DIRECT_PORT_CALLS
112  // Connect input port Run
113  for (
114  FwIndexType port = 0;
115  port < static_cast<FwIndexType>(this->getNum_Run_InputPorts());
116  port++
117  ) {
118  this->m_Run_InputPort[port].init();
119  this->m_Run_InputPort[port].addCallComp(
120  this,
121  m_p_Run_in
122  );
123  this->m_Run_InputPort[port].setPortNum(port);
124 
125 #if FW_OBJECT_NAMES == 1
126  Fw::ObjectName portName;
127  portName.format(
128  "%s_Run_InputPort[%" PRI_FwIndexType "]",
129  this->m_objName.toChar(),
130  port
131  );
132  this->m_Run_InputPort[port].setObjName(portName.toChar());
133 #endif
134  }
135 #endif
136 
137 #if !FW_DIRECT_PORT_CALLS
138  // Connect input port SendFile
139  for (
140  FwIndexType port = 0;
141  port < static_cast<FwIndexType>(this->getNum_SendFile_InputPorts());
142  port++
143  ) {
144  this->m_SendFile_InputPort[port].init();
145  this->m_SendFile_InputPort[port].addCallComp(
146  this,
147  m_p_SendFile_in
148  );
149  this->m_SendFile_InputPort[port].setPortNum(port);
150 
151 #if FW_OBJECT_NAMES == 1
152  Fw::ObjectName portName;
153  portName.format(
154  "%s_SendFile_InputPort[%" PRI_FwIndexType "]",
155  this->m_objName.toChar(),
156  port
157  );
158  this->m_SendFile_InputPort[port].setObjName(portName.toChar());
159 #endif
160  }
161 #endif
162 
163 #if !FW_DIRECT_PORT_CALLS
164  // Connect input port bufferReturn
165  for (
166  FwIndexType port = 0;
167  port < static_cast<FwIndexType>(this->getNum_bufferReturn_InputPorts());
168  port++
169  ) {
170  this->m_bufferReturn_InputPort[port].init();
171  this->m_bufferReturn_InputPort[port].addCallComp(
172  this,
173  m_p_bufferReturn_in
174  );
175  this->m_bufferReturn_InputPort[port].setPortNum(port);
176 
177 #if FW_OBJECT_NAMES == 1
178  Fw::ObjectName portName;
179  portName.format(
180  "%s_bufferReturn_InputPort[%" PRI_FwIndexType "]",
181  this->m_objName.toChar(),
182  port
183  );
184  this->m_bufferReturn_InputPort[port].setObjName(portName.toChar());
185 #endif
186  }
187 #endif
188 
189 #if !FW_DIRECT_PORT_CALLS
190  // Connect input port pingIn
191  for (
192  FwIndexType port = 0;
193  port < static_cast<FwIndexType>(this->getNum_pingIn_InputPorts());
194  port++
195  ) {
196  this->m_pingIn_InputPort[port].init();
197  this->m_pingIn_InputPort[port].addCallComp(
198  this,
199  m_p_pingIn_in
200  );
201  this->m_pingIn_InputPort[port].setPortNum(port);
202 
203 #if FW_OBJECT_NAMES == 1
204  Fw::ObjectName portName;
205  portName.format(
206  "%s_pingIn_InputPort[%" PRI_FwIndexType "]",
207  this->m_objName.toChar(),
208  port
209  );
210  this->m_pingIn_InputPort[port].setObjName(portName.toChar());
211 #endif
212  }
213 #endif
214 
215 #if !FW_DIRECT_PORT_CALLS
216  // Connect output port cmdRegOut
217  for (
218  FwIndexType port = 0;
219  port < static_cast<FwIndexType>(this->getNum_cmdRegOut_OutputPorts());
220  port++
221  ) {
222  this->m_cmdRegOut_OutputPort[port].init();
223 
224 #if FW_OBJECT_NAMES == 1
225  Fw::ObjectName portName;
226  portName.format(
227  "%s_cmdRegOut_OutputPort[%" PRI_FwIndexType "]",
228  this->m_objName.toChar(),
229  port
230  );
231  this->m_cmdRegOut_OutputPort[port].setObjName(portName.toChar());
232 #endif
233  }
234 #endif
235 
236 #if !FW_DIRECT_PORT_CALLS
237  // Connect output port cmdResponseOut
238  for (
239  FwIndexType port = 0;
240  port < static_cast<FwIndexType>(this->getNum_cmdResponseOut_OutputPorts());
241  port++
242  ) {
243  this->m_cmdResponseOut_OutputPort[port].init();
244 
245 #if FW_OBJECT_NAMES == 1
246  Fw::ObjectName portName;
247  portName.format(
248  "%s_cmdResponseOut_OutputPort[%" PRI_FwIndexType "]",
249  this->m_objName.toChar(),
250  port
251  );
252  this->m_cmdResponseOut_OutputPort[port].setObjName(portName.toChar());
253 #endif
254  }
255 #endif
256 
257 #if !FW_DIRECT_PORT_CALLS
258  // Connect output port eventOut
259  for (
260  FwIndexType port = 0;
261  port < static_cast<FwIndexType>(this->getNum_eventOut_OutputPorts());
262  port++
263  ) {
264  this->m_eventOut_OutputPort[port].init();
265 
266 #if FW_OBJECT_NAMES == 1
267  Fw::ObjectName portName;
268  portName.format(
269  "%s_eventOut_OutputPort[%" PRI_FwIndexType "]",
270  this->m_objName.toChar(),
271  port
272  );
273  this->m_eventOut_OutputPort[port].setObjName(portName.toChar());
274 #endif
275  }
276 #endif
277 
278 #if !FW_DIRECT_PORT_CALLS && FW_ENABLE_TEXT_LOGGING
279  // Connect output port textEventOut
280  for (
281  FwIndexType port = 0;
282  port < static_cast<FwIndexType>(this->getNum_textEventOut_OutputPorts());
283  port++
284  ) {
285  this->m_textEventOut_OutputPort[port].init();
286 
287 #if FW_OBJECT_NAMES == 1
288  Fw::ObjectName portName;
289  portName.format(
290  "%s_textEventOut_OutputPort[%" PRI_FwIndexType "]",
291  this->m_objName.toChar(),
292  port
293  );
294  this->m_textEventOut_OutputPort[port].setObjName(portName.toChar());
295 #endif
296  }
297 #endif
298 
299 #if !FW_DIRECT_PORT_CALLS
300  // Connect output port timeCaller
301  for (
302  FwIndexType port = 0;
303  port < static_cast<FwIndexType>(this->getNum_timeCaller_OutputPorts());
304  port++
305  ) {
306  this->m_timeCaller_OutputPort[port].init();
307 
308 #if FW_OBJECT_NAMES == 1
309  Fw::ObjectName portName;
310  portName.format(
311  "%s_timeCaller_OutputPort[%" PRI_FwIndexType "]",
312  this->m_objName.toChar(),
313  port
314  );
315  this->m_timeCaller_OutputPort[port].setObjName(portName.toChar());
316 #endif
317  }
318 #endif
319 
320 #if !FW_DIRECT_PORT_CALLS
321  // Connect output port tlmOut
322  for (
323  FwIndexType port = 0;
324  port < static_cast<FwIndexType>(this->getNum_tlmOut_OutputPorts());
325  port++
326  ) {
327  this->m_tlmOut_OutputPort[port].init();
328 
329 #if FW_OBJECT_NAMES == 1
330  Fw::ObjectName portName;
331  portName.format(
332  "%s_tlmOut_OutputPort[%" PRI_FwIndexType "]",
333  this->m_objName.toChar(),
334  port
335  );
336  this->m_tlmOut_OutputPort[port].setObjName(portName.toChar());
337 #endif
338  }
339 #endif
340 
341 #if !FW_DIRECT_PORT_CALLS
342  // Connect output port FileComplete
343  for (
344  FwIndexType port = 0;
345  port < static_cast<FwIndexType>(this->getNum_FileComplete_OutputPorts());
346  port++
347  ) {
348  this->m_FileComplete_OutputPort[port].init();
349 
350 #if FW_OBJECT_NAMES == 1
351  Fw::ObjectName portName;
352  portName.format(
353  "%s_FileComplete_OutputPort[%" PRI_FwIndexType "]",
354  this->m_objName.toChar(),
355  port
356  );
357  this->m_FileComplete_OutputPort[port].setObjName(portName.toChar());
358 #endif
359  }
360 #endif
361 
362 #if !FW_DIRECT_PORT_CALLS
363  // Connect output port bufferSendOut
364  for (
365  FwIndexType port = 0;
366  port < static_cast<FwIndexType>(this->getNum_bufferSendOut_OutputPorts());
367  port++
368  ) {
369  this->m_bufferSendOut_OutputPort[port].init();
370 
371 #if FW_OBJECT_NAMES == 1
372  Fw::ObjectName portName;
373  portName.format(
374  "%s_bufferSendOut_OutputPort[%" PRI_FwIndexType "]",
375  this->m_objName.toChar(),
376  port
377  );
378  this->m_bufferSendOut_OutputPort[port].setObjName(portName.toChar());
379 #endif
380  }
381 #endif
382 
383 #if !FW_DIRECT_PORT_CALLS
384  // Connect output port pingOut
385  for (
386  FwIndexType port = 0;
387  port < static_cast<FwIndexType>(this->getNum_pingOut_OutputPorts());
388  port++
389  ) {
390  this->m_pingOut_OutputPort[port].init();
391 
392 #if FW_OBJECT_NAMES == 1
393  Fw::ObjectName portName;
394  portName.format(
395  "%s_pingOut_OutputPort[%" PRI_FwIndexType "]",
396  this->m_objName.toChar(),
397  port
398  );
399  this->m_pingOut_OutputPort[port].setObjName(portName.toChar());
400 #endif
401  }
402 #endif
403 
404  // Create the queue
405  Os::Queue::Status qStat = this->createQueue(
406  queueDepth,
407  static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
408  );
409  FW_ASSERT(
410  Os::Queue::Status::OP_OK == qStat,
411  static_cast<FwAssertArgType>(qStat)
412  );
413  }
414 
415 #if !FW_DIRECT_PORT_CALLS
416 
417  // ----------------------------------------------------------------------
418  // Getters for special input ports
419  // ----------------------------------------------------------------------
420 
423  {
424  FW_ASSERT(
425  (0 <= portNum) && (portNum < this->getNum_cmdIn_InputPorts()),
426  static_cast<FwAssertArgType>(portNum)
427  );
428 
429  return &this->m_cmdIn_InputPort[portNum];
430  }
431 
432 #endif
433 
434 #if !FW_DIRECT_PORT_CALLS
435 
436  // ----------------------------------------------------------------------
437  // Getters for typed input ports
438  // ----------------------------------------------------------------------
439 
442  {
443  FW_ASSERT(
444  (0 <= portNum) && (portNum < this->getNum_Run_InputPorts()),
445  static_cast<FwAssertArgType>(portNum)
446  );
447 
448  return &this->m_Run_InputPort[portNum];
449  }
450 
453  {
454  FW_ASSERT(
455  (0 <= portNum) && (portNum < this->getNum_SendFile_InputPorts()),
456  static_cast<FwAssertArgType>(portNum)
457  );
458 
459  return &this->m_SendFile_InputPort[portNum];
460  }
461 
464  {
465  FW_ASSERT(
466  (0 <= portNum) && (portNum < this->getNum_bufferReturn_InputPorts()),
467  static_cast<FwAssertArgType>(portNum)
468  );
469 
470  return &this->m_bufferReturn_InputPort[portNum];
471  }
472 
475  {
476  FW_ASSERT(
477  (0 <= portNum) && (portNum < this->getNum_pingIn_InputPorts()),
478  static_cast<FwAssertArgType>(portNum)
479  );
480 
481  return &this->m_pingIn_InputPort[portNum];
482  }
483 
484 #endif
485 
486 #if !FW_DIRECT_PORT_CALLS
487 
488  // ----------------------------------------------------------------------
489  // Connect input ports to special output ports
490  // ----------------------------------------------------------------------
491 
494  FwIndexType portNum,
495  Fw::InputCmdRegPort* port
496  )
497  {
498  FW_ASSERT(
499  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
500  static_cast<FwAssertArgType>(portNum)
501  );
502 
503  this->m_cmdRegOut_OutputPort[portNum].addCallPort(port);
504  }
505 
508  FwIndexType portNum,
510  )
511  {
512  FW_ASSERT(
513  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
514  static_cast<FwAssertArgType>(portNum)
515  );
516 
517  this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port);
518  }
519 
522  FwIndexType portNum,
523  Fw::InputLogPort* port
524  )
525  {
526  FW_ASSERT(
527  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
528  static_cast<FwAssertArgType>(portNum)
529  );
530 
531  this->m_eventOut_OutputPort[portNum].addCallPort(port);
532  }
533 
534 #if FW_ENABLE_TEXT_LOGGING == 1
535 
536  void FileDownlinkComponentBase ::
537  set_textEventOut_OutputPort(
538  FwIndexType portNum,
540  )
541  {
542  FW_ASSERT(
543  (0 <= portNum) && (portNum < this->getNum_textEventOut_OutputPorts()),
544  static_cast<FwAssertArgType>(portNum)
545  );
546 
547  this->m_textEventOut_OutputPort[portNum].addCallPort(port);
548  }
549 
550 #endif
551 
554  FwIndexType portNum,
555  Fw::InputTimePort* port
556  )
557  {
558  FW_ASSERT(
559  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
560  static_cast<FwAssertArgType>(portNum)
561  );
562 
563  this->m_timeCaller_OutputPort[portNum].addCallPort(port);
564  }
565 
568  FwIndexType portNum,
569  Fw::InputTlmPort* port
570  )
571  {
572  FW_ASSERT(
573  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
574  static_cast<FwAssertArgType>(portNum)
575  );
576 
577  this->m_tlmOut_OutputPort[portNum].addCallPort(port);
578  }
579 
580 #endif
581 
582 #if !FW_DIRECT_PORT_CALLS
583 
584  // ----------------------------------------------------------------------
585  // Connect typed input ports to typed output ports
586  // ----------------------------------------------------------------------
587 
590  FwIndexType portNum,
592  )
593  {
594  FW_ASSERT(
595  (0 <= portNum) && (portNum < this->getNum_FileComplete_OutputPorts()),
596  static_cast<FwAssertArgType>(portNum)
597  );
598 
599  this->m_FileComplete_OutputPort[portNum].addCallPort(port);
600  }
601 
604  FwIndexType portNum,
606  )
607  {
608  FW_ASSERT(
609  (0 <= portNum) && (portNum < this->getNum_bufferSendOut_OutputPorts()),
610  static_cast<FwAssertArgType>(portNum)
611  );
612 
613  this->m_bufferSendOut_OutputPort[portNum].addCallPort(port);
614  }
615 
618  FwIndexType portNum,
619  Svc::InputPingPort* port
620  )
621  {
622  FW_ASSERT(
623  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
624  static_cast<FwAssertArgType>(portNum)
625  );
626 
627  this->m_pingOut_OutputPort[portNum].addCallPort(port);
628  }
629 
630 #endif
631 
632 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
633 
634  // ----------------------------------------------------------------------
635  // Connect serial input ports to special output ports
636  // ----------------------------------------------------------------------
637 
640  FwIndexType portNum,
641  Fw::InputSerializePort* port
642  )
643  {
644  FW_ASSERT(
645  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
646  static_cast<FwAssertArgType>(portNum)
647  );
648 
649  this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port);
650  }
651 
654  FwIndexType portNum,
655  Fw::InputSerializePort* port
656  )
657  {
658  FW_ASSERT(
659  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
660  static_cast<FwAssertArgType>(portNum)
661  );
662 
663  this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port);
664  }
665 
668  FwIndexType portNum,
669  Fw::InputSerializePort* port
670  )
671  {
672  FW_ASSERT(
673  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
674  static_cast<FwAssertArgType>(portNum)
675  );
676 
677  this->m_eventOut_OutputPort[portNum].registerSerialPort(port);
678  }
679 
680 #if FW_ENABLE_TEXT_LOGGING == 1
681 
682  void FileDownlinkComponentBase ::
683  set_textEventOut_OutputPort(
684  FwIndexType portNum,
685  Fw::InputSerializePort* port
686  )
687  {
688  FW_ASSERT(
689  (0 <= portNum) && (portNum < this->getNum_textEventOut_OutputPorts()),
690  static_cast<FwAssertArgType>(portNum)
691  );
692 
693  this->m_textEventOut_OutputPort[portNum].registerSerialPort(port);
694  }
695 
696 #endif
697 
700  FwIndexType portNum,
701  Fw::InputSerializePort* port
702  )
703  {
704  FW_ASSERT(
705  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
706  static_cast<FwAssertArgType>(portNum)
707  );
708 
709  this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
710  }
711 
714  FwIndexType portNum,
715  Fw::InputSerializePort* port
716  )
717  {
718  FW_ASSERT(
719  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
720  static_cast<FwAssertArgType>(portNum)
721  );
722 
723  this->m_tlmOut_OutputPort[portNum].registerSerialPort(port);
724  }
725 
726 #endif
727 
728 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
729 
730  // ----------------------------------------------------------------------
731  // Connect serial input ports to typed output ports
732  // ----------------------------------------------------------------------
733 
736  FwIndexType portNum,
737  Fw::InputSerializePort* port
738  )
739  {
740  FW_ASSERT(
741  (0 <= portNum) && (portNum < this->getNum_FileComplete_OutputPorts()),
742  static_cast<FwAssertArgType>(portNum)
743  );
744 
745  this->m_FileComplete_OutputPort[portNum].registerSerialPort(port);
746  }
747 
750  FwIndexType portNum,
751  Fw::InputSerializePort* port
752  )
753  {
754  FW_ASSERT(
755  (0 <= portNum) && (portNum < this->getNum_bufferSendOut_OutputPorts()),
756  static_cast<FwAssertArgType>(portNum)
757  );
758 
759  this->m_bufferSendOut_OutputPort[portNum].registerSerialPort(port);
760  }
761 
764  FwIndexType portNum,
765  Fw::InputSerializePort* port
766  )
767  {
768  FW_ASSERT(
769  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
770  static_cast<FwAssertArgType>(portNum)
771  );
772 
773  this->m_pingOut_OutputPort[portNum].registerSerialPort(port);
774  }
775 
776 #endif
777 
778  // ----------------------------------------------------------------------
779  // Command registration
780  // ----------------------------------------------------------------------
781 
784  {
786 
787  this->cmdRegOut_out(
788  0,
789  this->getIdBase() + OPCODE_SENDFILE
790  );
791 
792  this->cmdRegOut_out(
793  0,
794  this->getIdBase() + OPCODE_CANCEL
795  );
796 
797  this->cmdRegOut_out(
798  0,
799  this->getIdBase() + OPCODE_SENDPARTIAL
800  );
801  }
802 
803  // ----------------------------------------------------------------------
804  // Component construction and destruction
805  // ----------------------------------------------------------------------
806 
808  FileDownlinkComponentBase(const char* compName) :
809  Fw::ActiveComponentBase(compName)
810  {
811 
812  }
813 
816  {
817 
818  }
819 
820 #if !FW_DIRECT_PORT_CALLS
821 
822  // ----------------------------------------------------------------------
823  // Connection status queries for special output ports
824  // ----------------------------------------------------------------------
825 
828  {
829  FW_ASSERT(
830  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
831  static_cast<FwAssertArgType>(portNum)
832  );
833 
834  return this->m_cmdRegOut_OutputPort[portNum].isConnected();
835  }
836 
839  {
840  FW_ASSERT(
841  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
842  static_cast<FwAssertArgType>(portNum)
843  );
844 
845  return this->m_cmdResponseOut_OutputPort[portNum].isConnected();
846  }
847 
850  {
851  FW_ASSERT(
852  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
853  static_cast<FwAssertArgType>(portNum)
854  );
855 
856  return this->m_eventOut_OutputPort[portNum].isConnected();
857  }
858 
859 #if FW_ENABLE_TEXT_LOGGING == 1
860 
861  bool FileDownlinkComponentBase ::
862  isConnected_textEventOut_OutputPort(FwIndexType portNum) const
863  {
864  FW_ASSERT(
865  (0 <= portNum) && (portNum < this->getNum_textEventOut_OutputPorts()),
866  static_cast<FwAssertArgType>(portNum)
867  );
868 
869  return this->m_textEventOut_OutputPort[portNum].isConnected();
870  }
871 
872 #endif
873 
876  {
877  FW_ASSERT(
878  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
879  static_cast<FwAssertArgType>(portNum)
880  );
881 
882  return this->m_timeCaller_OutputPort[portNum].isConnected();
883  }
884 
887  {
888  FW_ASSERT(
889  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
890  static_cast<FwAssertArgType>(portNum)
891  );
892 
893  return this->m_tlmOut_OutputPort[portNum].isConnected();
894  }
895 
896 #endif
897 
898 #if !FW_DIRECT_PORT_CALLS
899 
900  // ----------------------------------------------------------------------
901  // Connection status queries for typed output ports
902  // ----------------------------------------------------------------------
903 
906  {
907  FW_ASSERT(
908  (0 <= portNum) && (portNum < this->getNum_FileComplete_OutputPorts()),
909  static_cast<FwAssertArgType>(portNum)
910  );
911 
912  return this->m_FileComplete_OutputPort[portNum].isConnected();
913  }
914 
917  {
918  FW_ASSERT(
919  (0 <= portNum) && (portNum < this->getNum_bufferSendOut_OutputPorts()),
920  static_cast<FwAssertArgType>(portNum)
921  );
922 
923  return this->m_bufferSendOut_OutputPort[portNum].isConnected();
924  }
925 
928  {
929  FW_ASSERT(
930  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
931  static_cast<FwAssertArgType>(portNum)
932  );
933 
934  return this->m_pingOut_OutputPort[portNum].isConnected();
935  }
936 
937 #endif
938 
939  // ----------------------------------------------------------------------
940  // Port handler base-class functions for special input ports
941  //
942  // Call these functions directly to bypass the corresponding ports
943  // ----------------------------------------------------------------------
944 
947  FwIndexType portNum,
948  FwOpcodeType opCode,
949  U32 cmdSeq,
950  Fw::CmdArgBuffer& args
951  )
952  {
953 
954  const U32 idBase = this->getIdBase();
955  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
956 
957  // Select base class function based on opcode
958  switch (opCode - idBase) {
959  case OPCODE_SENDFILE: {
961  opCode,
962  cmdSeq,
963  args
964  );
965  break;
966  }
967 
968  case OPCODE_CANCEL: {
969  this->Cancel_cmdHandlerBase(
970  opCode,
971  cmdSeq,
972  args
973  );
974  break;
975  }
976 
977  case OPCODE_SENDPARTIAL: {
979  opCode,
980  cmdSeq,
981  args
982  );
983  break;
984  }
985  default:
986  // Unknown opcode: ignore it
987  break;
988  }
989  }
990 
991  // ----------------------------------------------------------------------
992  // Port handler base-class functions for typed input ports
993  //
994  // Call these functions directly to bypass the corresponding ports
995  // ----------------------------------------------------------------------
996 
999  FwIndexType portNum,
1000  U32 context
1001  )
1002  {
1003  // Make sure port number is valid
1004  FW_ASSERT(
1005  (0 <= portNum) && (portNum < this->getNum_Run_InputPorts()),
1006  static_cast<FwAssertArgType>(portNum)
1007  );
1008 
1009  // Call pre-message hook
1011  portNum,
1012  context
1013  );
1014  ComponentIpcSerializableBuffer msg;
1016 
1017  // Serialize message ID
1018  _status = msg.serializeFrom(
1019  static_cast<FwEnumStoreType>(RUN_SCHED)
1020  );
1021  FW_ASSERT(
1022  _status == Fw::FW_SERIALIZE_OK,
1023  static_cast<FwAssertArgType>(_status)
1024  );
1025 
1026  // Serialize port number
1027  _status = msg.serializeFrom(portNum);
1028  FW_ASSERT(
1029  _status == Fw::FW_SERIALIZE_OK,
1030  static_cast<FwAssertArgType>(_status)
1031  );
1032 
1033  // Serialize argument context
1034  _status = msg.serializeFrom(context);
1035  FW_ASSERT(
1036  _status == Fw::FW_SERIALIZE_OK,
1037  static_cast<FwAssertArgType>(_status)
1038  );
1039 
1040  // Send message
1042  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1043 
1044  FW_ASSERT(
1045  qStatus == Os::Queue::OP_OK,
1046  static_cast<FwAssertArgType>(qStatus)
1047  );
1048  }
1049 
1052  FwIndexType portNum,
1053  const Fw::StringBase& sourceFileName,
1054  const Fw::StringBase& destFileName,
1055  U32 offset,
1056  U32 length
1057  )
1058  {
1059  // Make sure port number is valid
1060  FW_ASSERT(
1061  (0 <= portNum) && (portNum < this->getNum_SendFile_InputPorts()),
1062  static_cast<FwAssertArgType>(portNum)
1063  );
1064 
1065  Svc::SendFileResponse retVal;
1066 
1067  // Lock guard mutex before calling
1068  this->lock();
1069 
1070  // Call handler function
1071  retVal = this->SendFile_handler(
1072  portNum,
1073  sourceFileName,
1074  destFileName,
1075  offset,
1076  length
1077  );
1078 
1079  // Unlock guard mutex
1080  this->unLock();
1081 
1082  return retVal;
1083  }
1084 
1087  FwIndexType portNum,
1088  Fw::Buffer& fwBuffer
1089  )
1090  {
1091  // Make sure port number is valid
1092  FW_ASSERT(
1093  (0 <= portNum) && (portNum < this->getNum_bufferReturn_InputPorts()),
1094  static_cast<FwAssertArgType>(portNum)
1095  );
1096 
1097  // Call pre-message hook
1099  portNum,
1100  fwBuffer
1101  );
1102  ComponentIpcSerializableBuffer msg;
1104 
1105  // Serialize message ID
1106  _status = msg.serializeFrom(
1107  static_cast<FwEnumStoreType>(BUFFERRETURN_BUFFERSEND)
1108  );
1109  FW_ASSERT(
1110  _status == Fw::FW_SERIALIZE_OK,
1111  static_cast<FwAssertArgType>(_status)
1112  );
1113 
1114  // Serialize port number
1115  _status = msg.serializeFrom(portNum);
1116  FW_ASSERT(
1117  _status == Fw::FW_SERIALIZE_OK,
1118  static_cast<FwAssertArgType>(_status)
1119  );
1120 
1121  // Serialize argument fwBuffer
1122  _status = msg.serializeFrom(fwBuffer);
1123  FW_ASSERT(
1124  _status == Fw::FW_SERIALIZE_OK,
1125  static_cast<FwAssertArgType>(_status)
1126  );
1127 
1128  // Send message
1130  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1131 
1132  FW_ASSERT(
1133  qStatus == Os::Queue::OP_OK,
1134  static_cast<FwAssertArgType>(qStatus)
1135  );
1136  }
1137 
1140  FwIndexType portNum,
1141  U32 key
1142  )
1143  {
1144  // Make sure port number is valid
1145  FW_ASSERT(
1146  (0 <= portNum) && (portNum < this->getNum_pingIn_InputPorts()),
1147  static_cast<FwAssertArgType>(portNum)
1148  );
1149 
1150  // Call pre-message hook
1152  portNum,
1153  key
1154  );
1155  ComponentIpcSerializableBuffer msg;
1157 
1158  // Serialize message ID
1159  _status = msg.serializeFrom(
1160  static_cast<FwEnumStoreType>(PINGIN_PING)
1161  );
1162  FW_ASSERT(
1163  _status == Fw::FW_SERIALIZE_OK,
1164  static_cast<FwAssertArgType>(_status)
1165  );
1166 
1167  // Serialize port number
1168  _status = msg.serializeFrom(portNum);
1169  FW_ASSERT(
1170  _status == Fw::FW_SERIALIZE_OK,
1171  static_cast<FwAssertArgType>(_status)
1172  );
1173 
1174  // Serialize argument key
1175  _status = msg.serializeFrom(key);
1176  FW_ASSERT(
1177  _status == Fw::FW_SERIALIZE_OK,
1178  static_cast<FwAssertArgType>(_status)
1179  );
1180 
1181  // Send message
1183  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1184 
1185  FW_ASSERT(
1186  qStatus == Os::Queue::OP_OK,
1187  static_cast<FwAssertArgType>(qStatus)
1188  );
1189  }
1190 
1191  // ----------------------------------------------------------------------
1192  // Pre-message hooks for typed async input ports
1193  //
1194  // Each of these functions is invoked just before processing a message
1195  // on the corresponding port. By default, they do nothing. You can
1196  // override them to provide specific pre-message behavior.
1197  // ----------------------------------------------------------------------
1198 
1201  FwIndexType portNum,
1202  U32 context
1203  )
1204  {
1205  // Default: no-op
1206  }
1207 
1210  FwIndexType portNum,
1211  Fw::Buffer& fwBuffer
1212  )
1213  {
1214  // Default: no-op
1215  }
1216 
1219  FwIndexType portNum,
1220  U32 key
1221  )
1222  {
1223  // Default: no-op
1224  }
1225 
1226 #if !FW_DIRECT_PORT_CALLS
1227 
1228  // ----------------------------------------------------------------------
1229  // Invocation functions for typed output ports
1230  // ----------------------------------------------------------------------
1231 
1234  FwIndexType portNum,
1235  const Svc::SendFileResponse& resp
1236  ) const
1237  {
1238  FW_ASSERT(
1239  (0 <= portNum) && (portNum < this->getNum_FileComplete_OutputPorts()),
1240  static_cast<FwAssertArgType>(portNum)
1241  );
1242 
1243  FW_ASSERT(
1244  this->m_FileComplete_OutputPort[portNum].isConnected(),
1245  static_cast<FwAssertArgType>(portNum)
1246  );
1247  this->m_FileComplete_OutputPort[portNum].invoke(
1248  resp
1249  );
1250  }
1251 
1254  FwIndexType portNum,
1255  Fw::Buffer& fwBuffer
1256  ) const
1257  {
1258  FW_ASSERT(
1259  (0 <= portNum) && (portNum < this->getNum_bufferSendOut_OutputPorts()),
1260  static_cast<FwAssertArgType>(portNum)
1261  );
1262 
1263  FW_ASSERT(
1264  this->m_bufferSendOut_OutputPort[portNum].isConnected(),
1265  static_cast<FwAssertArgType>(portNum)
1266  );
1267  this->m_bufferSendOut_OutputPort[portNum].invoke(
1268  fwBuffer
1269  );
1270  }
1271 
1274  FwIndexType portNum,
1275  U32 key
1276  ) const
1277  {
1278  FW_ASSERT(
1279  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
1280  static_cast<FwAssertArgType>(portNum)
1281  );
1282 
1283  FW_ASSERT(
1284  this->m_pingOut_OutputPort[portNum].isConnected(),
1285  static_cast<FwAssertArgType>(portNum)
1286  );
1287  this->m_pingOut_OutputPort[portNum].invoke(
1288  key
1289  );
1290  }
1291 
1292 #endif
1293 
1294  // ----------------------------------------------------------------------
1295  // Command response
1296  // ----------------------------------------------------------------------
1297 
1300  FwOpcodeType opCode,
1301  U32 cmdSeq,
1302  Fw::CmdResponse response
1303  )
1304  {
1306  this->cmdResponseOut_out(0, opCode, cmdSeq, response);
1307  }
1308 
1309  // ----------------------------------------------------------------------
1310  // Command handler base-class functions
1311  //
1312  // Call these functions directly to bypass the command input port
1313  // ----------------------------------------------------------------------
1314 
1317  FwOpcodeType opCode,
1318  U32 cmdSeq,
1319  Fw::CmdArgBuffer& args
1320  )
1321  {
1322  // Call pre-message hook
1323  this->SendFile_preMsgHook(opCode,cmdSeq);
1324 
1325  // Defer deserializing arguments to the message dispatcher
1326  // to avoid deserializing and reserializing just for IPC
1327  ComponentIpcSerializableBuffer msg;
1329 
1330  // Serialize for IPC
1331  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_SENDFILE));
1332  FW_ASSERT (
1333  _status == Fw::FW_SERIALIZE_OK,
1334  static_cast<FwAssertArgType>(_status)
1335  );
1336 
1337  // Fake port number to make message dequeue work
1338  FwIndexType port = 0;
1339 
1340  _status = msg.serializeFrom(port);
1341  FW_ASSERT (
1342  _status == Fw::FW_SERIALIZE_OK,
1343  static_cast<FwAssertArgType>(_status)
1344  );
1345 
1346  _status = msg.serializeFrom(opCode);
1347  FW_ASSERT (
1348  _status == Fw::FW_SERIALIZE_OK,
1349  static_cast<FwAssertArgType>(_status)
1350  );
1351 
1352  _status = msg.serializeFrom(cmdSeq);
1353  FW_ASSERT (
1354  _status == Fw::FW_SERIALIZE_OK,
1355  static_cast<FwAssertArgType>(_status)
1356  );
1357 
1358  _status = msg.serializeFrom(args);
1359  FW_ASSERT (
1360  _status == Fw::FW_SERIALIZE_OK,
1361  static_cast<FwAssertArgType>(_status)
1362  );
1363 
1364  // Send message
1366  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1367 
1368  FW_ASSERT(
1369  qStatus == Os::Queue::OP_OK,
1370  static_cast<FwAssertArgType>(qStatus)
1371  );
1372  }
1373 
1376  FwOpcodeType opCode,
1377  U32 cmdSeq,
1378  Fw::CmdArgBuffer& args
1379  )
1380  {
1381  // Call pre-message hook
1382  this->Cancel_preMsgHook(opCode,cmdSeq);
1383 
1384  // Defer deserializing arguments to the message dispatcher
1385  // to avoid deserializing and reserializing just for IPC
1386  ComponentIpcSerializableBuffer msg;
1388 
1389  // Serialize for IPC
1390  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_CANCEL));
1391  FW_ASSERT (
1392  _status == Fw::FW_SERIALIZE_OK,
1393  static_cast<FwAssertArgType>(_status)
1394  );
1395 
1396  // Fake port number to make message dequeue work
1397  FwIndexType port = 0;
1398 
1399  _status = msg.serializeFrom(port);
1400  FW_ASSERT (
1401  _status == Fw::FW_SERIALIZE_OK,
1402  static_cast<FwAssertArgType>(_status)
1403  );
1404 
1405  _status = msg.serializeFrom(opCode);
1406  FW_ASSERT (
1407  _status == Fw::FW_SERIALIZE_OK,
1408  static_cast<FwAssertArgType>(_status)
1409  );
1410 
1411  _status = msg.serializeFrom(cmdSeq);
1412  FW_ASSERT (
1413  _status == Fw::FW_SERIALIZE_OK,
1414  static_cast<FwAssertArgType>(_status)
1415  );
1416 
1417  _status = msg.serializeFrom(args);
1418  FW_ASSERT (
1419  _status == Fw::FW_SERIALIZE_OK,
1420  static_cast<FwAssertArgType>(_status)
1421  );
1422 
1423  // Send message
1425  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1426 
1427  FW_ASSERT(
1428  qStatus == Os::Queue::OP_OK,
1429  static_cast<FwAssertArgType>(qStatus)
1430  );
1431  }
1432 
1435  FwOpcodeType opCode,
1436  U32 cmdSeq,
1437  Fw::CmdArgBuffer& args
1438  )
1439  {
1440  // Call pre-message hook
1441  this->SendPartial_preMsgHook(opCode,cmdSeq);
1442 
1443  // Defer deserializing arguments to the message dispatcher
1444  // to avoid deserializing and reserializing just for IPC
1445  ComponentIpcSerializableBuffer msg;
1447 
1448  // Serialize for IPC
1449  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_SENDPARTIAL));
1450  FW_ASSERT (
1451  _status == Fw::FW_SERIALIZE_OK,
1452  static_cast<FwAssertArgType>(_status)
1453  );
1454 
1455  // Fake port number to make message dequeue work
1456  FwIndexType port = 0;
1457 
1458  _status = msg.serializeFrom(port);
1459  FW_ASSERT (
1460  _status == Fw::FW_SERIALIZE_OK,
1461  static_cast<FwAssertArgType>(_status)
1462  );
1463 
1464  _status = msg.serializeFrom(opCode);
1465  FW_ASSERT (
1466  _status == Fw::FW_SERIALIZE_OK,
1467  static_cast<FwAssertArgType>(_status)
1468  );
1469 
1470  _status = msg.serializeFrom(cmdSeq);
1471  FW_ASSERT (
1472  _status == Fw::FW_SERIALIZE_OK,
1473  static_cast<FwAssertArgType>(_status)
1474  );
1475 
1476  _status = msg.serializeFrom(args);
1477  FW_ASSERT (
1478  _status == Fw::FW_SERIALIZE_OK,
1479  static_cast<FwAssertArgType>(_status)
1480  );
1481 
1482  // Send message
1484  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1485 
1486  FW_ASSERT(
1487  qStatus == Os::Queue::OP_OK,
1488  static_cast<FwAssertArgType>(qStatus)
1489  );
1490  }
1491 
1492  // ----------------------------------------------------------------------
1493  // Pre-message hooks for async commands
1494  //
1495  // Each of these functions is invoked just before processing the
1496  // corresponding command. By default they do nothing. You can
1497  // override them to provide specific pre-command behavior.
1498  // ----------------------------------------------------------------------
1499 
1502  FwOpcodeType opCode,
1503  U32 cmdSeq
1504  )
1505  {
1506  // Defaults to no-op; can be overridden
1507  (void) opCode;
1508  (void) cmdSeq;
1509  }
1510 
1513  FwOpcodeType opCode,
1514  U32 cmdSeq
1515  )
1516  {
1517  // Defaults to no-op; can be overridden
1518  (void) opCode;
1519  (void) cmdSeq;
1520  }
1521 
1524  FwOpcodeType opCode,
1525  U32 cmdSeq
1526  )
1527  {
1528  // Defaults to no-op; can be overridden
1529  (void) opCode;
1530  (void) cmdSeq;
1531  }
1532 
1533  // ----------------------------------------------------------------------
1534  // Event logging functions
1535  // ----------------------------------------------------------------------
1536 
1539  {
1540  // Get the time
1541  Fw::Time _logTime;
1542  if (this->isConnected_timeCaller_OutputPort(0)) {
1543  this->timeCaller_out(0, _logTime);
1544  }
1545 
1546  const FwEventIdType _id = this->getIdBase() + EVENTID_FILEOPENERROR;
1547 
1548  // Emit the event on the log port
1549  if (this->isConnected_eventOut_OutputPort(0)) {
1550  Fw::LogBuffer _logBuff;
1552 
1553 #if FW_AMPCS_COMPATIBLE
1554  // Serialize the number of arguments
1555  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1556  FW_ASSERT(
1557  _status == Fw::FW_SERIALIZE_OK,
1558  static_cast<FwAssertArgType>(_status)
1559  );
1560 #endif
1561 
1562  _status = fileName.serializeTo(
1563  _logBuff,
1564  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 100)
1565  );
1566  FW_ASSERT(
1567  _status == Fw::FW_SERIALIZE_OK,
1568  static_cast<FwAssertArgType>(_status)
1569  );
1570 
1571  this->eventOut_out(
1572  0,
1573  _id,
1574  _logTime,
1576  _logBuff
1577  );
1578  }
1579 
1580  // Emit the event on the text log port
1581 #if FW_ENABLE_TEXT_LOGGING
1582  if (this->isConnected_textEventOut_OutputPort(0)) {
1583 #if FW_OBJECT_NAMES == 1
1584  const char* _formatString =
1585  "(%s) %s: Could not open file %s";
1586 #else
1587  const char* _formatString =
1588  "%s: Could not open file %s";
1589 #endif
1590 
1591  Fw::TextLogString _logString;
1592  _logString.format(
1593  _formatString,
1594 #if FW_OBJECT_NAMES == 1
1595  this->m_objName.toChar(),
1596 #endif
1597  "FileOpenError ",
1598  fileName.toChar()
1599  );
1600 
1601  this->textEventOut_out(
1602  0,
1603  _id,
1604  _logTime,
1606  _logString
1607  );
1608  }
1609 #endif
1610  }
1611 
1614  const Fw::StringBase& fileName,
1615  I32 status
1616  ) const
1617  {
1618  // Get the time
1619  Fw::Time _logTime;
1620  if (this->isConnected_timeCaller_OutputPort(0)) {
1621  this->timeCaller_out(0, _logTime);
1622  }
1623 
1624  const FwEventIdType _id = this->getIdBase() + EVENTID_FILEREADERROR;
1625 
1626  // Emit the event on the log port
1627  if (this->isConnected_eventOut_OutputPort(0)) {
1628  Fw::LogBuffer _logBuff;
1630 
1631 #if FW_AMPCS_COMPATIBLE
1632  // Serialize the number of arguments
1633  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1634  FW_ASSERT(
1635  _status == Fw::FW_SERIALIZE_OK,
1636  static_cast<FwAssertArgType>(_status)
1637  );
1638 #endif
1639 
1640  _status = fileName.serializeTo(
1641  _logBuff,
1642  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 100)
1643  );
1644  FW_ASSERT(
1645  _status == Fw::FW_SERIALIZE_OK,
1646  static_cast<FwAssertArgType>(_status)
1647  );
1648 
1649 #if FW_AMPCS_COMPATIBLE
1650  // Serialize the argument size
1651  _status = _logBuff.serializeFrom(
1652  static_cast<U8>(sizeof(I32))
1653  );
1654  FW_ASSERT(
1655  _status == Fw::FW_SERIALIZE_OK,
1656  static_cast<FwAssertArgType>(_status)
1657  );
1658 #endif
1659  _status = _logBuff.serializeFrom(status);
1660  FW_ASSERT(
1661  _status == Fw::FW_SERIALIZE_OK,
1662  static_cast<FwAssertArgType>(_status)
1663  );
1664 
1665  this->eventOut_out(
1666  0,
1667  _id,
1668  _logTime,
1670  _logBuff
1671  );
1672  }
1673 
1674  // Emit the event on the text log port
1675 #if FW_ENABLE_TEXT_LOGGING
1676  if (this->isConnected_textEventOut_OutputPort(0)) {
1677 #if FW_OBJECT_NAMES == 1
1678  const char* _formatString =
1679  "(%s) %s: Could not read file %s with status %" PRIi32 "";
1680 #else
1681  const char* _formatString =
1682  "%s: Could not read file %s with status %" PRIi32 "";
1683 #endif
1684 
1685  Fw::TextLogString _logString;
1686  _logString.format(
1687  _formatString,
1688 #if FW_OBJECT_NAMES == 1
1689  this->m_objName.toChar(),
1690 #endif
1691  "FileReadError ",
1692  fileName.toChar(),
1693  status
1694  );
1695 
1696  this->textEventOut_out(
1697  0,
1698  _id,
1699  _logTime,
1701  _logString
1702  );
1703  }
1704 #endif
1705  }
1706 
1709  const Fw::StringBase& sourceFileName,
1710  const Fw::StringBase& destFileName
1711  ) const
1712  {
1713  // Get the time
1714  Fw::Time _logTime;
1715  if (this->isConnected_timeCaller_OutputPort(0)) {
1716  this->timeCaller_out(0, _logTime);
1717  }
1718 
1719  const FwEventIdType _id = this->getIdBase() + EVENTID_FILESENT;
1720 
1721  // Emit the event on the log port
1722  if (this->isConnected_eventOut_OutputPort(0)) {
1723  Fw::LogBuffer _logBuff;
1725 
1726 #if FW_AMPCS_COMPATIBLE
1727  // Serialize the number of arguments
1728  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1729  FW_ASSERT(
1730  _status == Fw::FW_SERIALIZE_OK,
1731  static_cast<FwAssertArgType>(_status)
1732  );
1733 #endif
1734 
1735  _status = sourceFileName.serializeTo(
1736  _logBuff,
1737  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 100)
1738  );
1739  FW_ASSERT(
1740  _status == Fw::FW_SERIALIZE_OK,
1741  static_cast<FwAssertArgType>(_status)
1742  );
1743 
1744  _status = destFileName.serializeTo(
1745  _logBuff,
1746  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 100)
1747  );
1748  FW_ASSERT(
1749  _status == Fw::FW_SERIALIZE_OK,
1750  static_cast<FwAssertArgType>(_status)
1751  );
1752 
1753  this->eventOut_out(
1754  0,
1755  _id,
1756  _logTime,
1758  _logBuff
1759  );
1760  }
1761 
1762  // Emit the event on the text log port
1763 #if FW_ENABLE_TEXT_LOGGING
1764  if (this->isConnected_textEventOut_OutputPort(0)) {
1765 #if FW_OBJECT_NAMES == 1
1766  const char* _formatString =
1767  "(%s) %s: Sent file %s to file %s";
1768 #else
1769  const char* _formatString =
1770  "%s: Sent file %s to file %s";
1771 #endif
1772 
1773  Fw::TextLogString _logString;
1774  _logString.format(
1775  _formatString,
1776 #if FW_OBJECT_NAMES == 1
1777  this->m_objName.toChar(),
1778 #endif
1779  "FileSent ",
1780  sourceFileName.toChar(),
1781  destFileName.toChar()
1782  );
1783 
1784  this->textEventOut_out(
1785  0,
1786  _id,
1787  _logTime,
1789  _logString
1790  );
1791  }
1792 #endif
1793  }
1794 
1797  const Fw::StringBase& sourceFileName,
1798  const Fw::StringBase& destFileName
1799  ) const
1800  {
1801  // Get the time
1802  Fw::Time _logTime;
1803  if (this->isConnected_timeCaller_OutputPort(0)) {
1804  this->timeCaller_out(0, _logTime);
1805  }
1806 
1807  const FwEventIdType _id = this->getIdBase() + EVENTID_DOWNLINKCANCELED;
1808 
1809  // Emit the event on the log port
1810  if (this->isConnected_eventOut_OutputPort(0)) {
1811  Fw::LogBuffer _logBuff;
1813 
1814 #if FW_AMPCS_COMPATIBLE
1815  // Serialize the number of arguments
1816  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1817  FW_ASSERT(
1818  _status == Fw::FW_SERIALIZE_OK,
1819  static_cast<FwAssertArgType>(_status)
1820  );
1821 #endif
1822 
1823  _status = sourceFileName.serializeTo(
1824  _logBuff,
1825  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 100)
1826  );
1827  FW_ASSERT(
1828  _status == Fw::FW_SERIALIZE_OK,
1829  static_cast<FwAssertArgType>(_status)
1830  );
1831 
1832  _status = destFileName.serializeTo(
1833  _logBuff,
1834  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 100)
1835  );
1836  FW_ASSERT(
1837  _status == Fw::FW_SERIALIZE_OK,
1838  static_cast<FwAssertArgType>(_status)
1839  );
1840 
1841  this->eventOut_out(
1842  0,
1843  _id,
1844  _logTime,
1846  _logBuff
1847  );
1848  }
1849 
1850  // Emit the event on the text log port
1851 #if FW_ENABLE_TEXT_LOGGING
1852  if (this->isConnected_textEventOut_OutputPort(0)) {
1853 #if FW_OBJECT_NAMES == 1
1854  const char* _formatString =
1855  "(%s) %s: Canceled downlink of file %s to file %s";
1856 #else
1857  const char* _formatString =
1858  "%s: Canceled downlink of file %s to file %s";
1859 #endif
1860 
1861  Fw::TextLogString _logString;
1862  _logString.format(
1863  _formatString,
1864 #if FW_OBJECT_NAMES == 1
1865  this->m_objName.toChar(),
1866 #endif
1867  "DownlinkCanceled ",
1868  sourceFileName.toChar(),
1869  destFileName.toChar()
1870  );
1871 
1872  this->textEventOut_out(
1873  0,
1874  _id,
1875  _logTime,
1877  _logString
1878  );
1879  }
1880 #endif
1881  }
1882 
1885  U32 startOffset,
1886  U32 length,
1887  U32 filesize,
1888  const Fw::StringBase& sourceFileName,
1889  const Fw::StringBase& destFileName
1890  ) const
1891  {
1892  // Get the time
1893  Fw::Time _logTime;
1894  if (this->isConnected_timeCaller_OutputPort(0)) {
1895  this->timeCaller_out(0, _logTime);
1896  }
1897 
1899 
1900  // Emit the event on the log port
1901  if (this->isConnected_eventOut_OutputPort(0)) {
1902  Fw::LogBuffer _logBuff;
1904 
1905 #if FW_AMPCS_COMPATIBLE
1906  // Serialize the number of arguments
1907  _status = _logBuff.serializeFrom(static_cast<U8>(5));
1908  FW_ASSERT(
1909  _status == Fw::FW_SERIALIZE_OK,
1910  static_cast<FwAssertArgType>(_status)
1911  );
1912 #endif
1913 
1914 #if FW_AMPCS_COMPATIBLE
1915  // Serialize the argument size
1916  _status = _logBuff.serializeFrom(
1917  static_cast<U8>(sizeof(U32))
1918  );
1919  FW_ASSERT(
1920  _status == Fw::FW_SERIALIZE_OK,
1921  static_cast<FwAssertArgType>(_status)
1922  );
1923 #endif
1924  _status = _logBuff.serializeFrom(startOffset);
1925  FW_ASSERT(
1926  _status == Fw::FW_SERIALIZE_OK,
1927  static_cast<FwAssertArgType>(_status)
1928  );
1929 
1930 #if FW_AMPCS_COMPATIBLE
1931  // Serialize the argument size
1932  _status = _logBuff.serializeFrom(
1933  static_cast<U8>(sizeof(U32))
1934  );
1935  FW_ASSERT(
1936  _status == Fw::FW_SERIALIZE_OK,
1937  static_cast<FwAssertArgType>(_status)
1938  );
1939 #endif
1940  _status = _logBuff.serializeFrom(length);
1941  FW_ASSERT(
1942  _status == Fw::FW_SERIALIZE_OK,
1943  static_cast<FwAssertArgType>(_status)
1944  );
1945 
1946 #if FW_AMPCS_COMPATIBLE
1947  // Serialize the argument size
1948  _status = _logBuff.serializeFrom(
1949  static_cast<U8>(sizeof(U32))
1950  );
1951  FW_ASSERT(
1952  _status == Fw::FW_SERIALIZE_OK,
1953  static_cast<FwAssertArgType>(_status)
1954  );
1955 #endif
1956  _status = _logBuff.serializeFrom(filesize);
1957  FW_ASSERT(
1958  _status == Fw::FW_SERIALIZE_OK,
1959  static_cast<FwAssertArgType>(_status)
1960  );
1961 
1962  _status = sourceFileName.serializeTo(
1963  _logBuff,
1964  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 100)
1965  );
1966  FW_ASSERT(
1967  _status == Fw::FW_SERIALIZE_OK,
1968  static_cast<FwAssertArgType>(_status)
1969  );
1970 
1971  _status = destFileName.serializeTo(
1972  _logBuff,
1973  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 100)
1974  );
1975  FW_ASSERT(
1976  _status == Fw::FW_SERIALIZE_OK,
1977  static_cast<FwAssertArgType>(_status)
1978  );
1979 
1980  this->eventOut_out(
1981  0,
1982  _id,
1983  _logTime,
1985  _logBuff
1986  );
1987  }
1988 
1989  // Emit the event on the text log port
1990 #if FW_ENABLE_TEXT_LOGGING
1991  if (this->isConnected_textEventOut_OutputPort(0)) {
1992 #if FW_OBJECT_NAMES == 1
1993  const char* _formatString =
1994  "(%s) %s: Offset %" PRIu32 " plus length %" PRIu32 " is greater than source size %" PRIu32 " for partial downlink of file %s to file %s. ";
1995 #else
1996  const char* _formatString =
1997  "%s: Offset %" PRIu32 " plus length %" PRIu32 " is greater than source size %" PRIu32 " for partial downlink of file %s to file %s. ";
1998 #endif
1999 
2000  Fw::TextLogString _logString;
2001  _logString.format(
2002  _formatString,
2003 #if FW_OBJECT_NAMES == 1
2004  this->m_objName.toChar(),
2005 #endif
2006  "DownlinkPartialWarning ",
2007  startOffset,
2008  length,
2009  filesize,
2010  sourceFileName.toChar(),
2011  destFileName.toChar()
2012  );
2013 
2014  this->textEventOut_out(
2015  0,
2016  _id,
2017  _logTime,
2019  _logString
2020  );
2021  }
2022 #endif
2023  }
2024 
2027  const Fw::StringBase& sourceFileName,
2028  const Fw::StringBase& destFileName,
2029  U32 startOffset,
2030  U32 filesize
2031  ) const
2032  {
2033  // Get the time
2034  Fw::Time _logTime;
2035  if (this->isConnected_timeCaller_OutputPort(0)) {
2036  this->timeCaller_out(0, _logTime);
2037  }
2038 
2039  const FwEventIdType _id = this->getIdBase() + EVENTID_DOWNLINKPARTIALFAIL;
2040 
2041  // Emit the event on the log port
2042  if (this->isConnected_eventOut_OutputPort(0)) {
2043  Fw::LogBuffer _logBuff;
2045 
2046 #if FW_AMPCS_COMPATIBLE
2047  // Serialize the number of arguments
2048  _status = _logBuff.serializeFrom(static_cast<U8>(4));
2049  FW_ASSERT(
2050  _status == Fw::FW_SERIALIZE_OK,
2051  static_cast<FwAssertArgType>(_status)
2052  );
2053 #endif
2054 
2055  _status = sourceFileName.serializeTo(
2056  _logBuff,
2057  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 100)
2058  );
2059  FW_ASSERT(
2060  _status == Fw::FW_SERIALIZE_OK,
2061  static_cast<FwAssertArgType>(_status)
2062  );
2063 
2064  _status = destFileName.serializeTo(
2065  _logBuff,
2066  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 100)
2067  );
2068  FW_ASSERT(
2069  _status == Fw::FW_SERIALIZE_OK,
2070  static_cast<FwAssertArgType>(_status)
2071  );
2072 
2073 #if FW_AMPCS_COMPATIBLE
2074  // Serialize the argument size
2075  _status = _logBuff.serializeFrom(
2076  static_cast<U8>(sizeof(U32))
2077  );
2078  FW_ASSERT(
2079  _status == Fw::FW_SERIALIZE_OK,
2080  static_cast<FwAssertArgType>(_status)
2081  );
2082 #endif
2083  _status = _logBuff.serializeFrom(startOffset);
2084  FW_ASSERT(
2085  _status == Fw::FW_SERIALIZE_OK,
2086  static_cast<FwAssertArgType>(_status)
2087  );
2088 
2089 #if FW_AMPCS_COMPATIBLE
2090  // Serialize the argument size
2091  _status = _logBuff.serializeFrom(
2092  static_cast<U8>(sizeof(U32))
2093  );
2094  FW_ASSERT(
2095  _status == Fw::FW_SERIALIZE_OK,
2096  static_cast<FwAssertArgType>(_status)
2097  );
2098 #endif
2099  _status = _logBuff.serializeFrom(filesize);
2100  FW_ASSERT(
2101  _status == Fw::FW_SERIALIZE_OK,
2102  static_cast<FwAssertArgType>(_status)
2103  );
2104 
2105  this->eventOut_out(
2106  0,
2107  _id,
2108  _logTime,
2110  _logBuff
2111  );
2112  }
2113 
2114  // Emit the event on the text log port
2115 #if FW_ENABLE_TEXT_LOGGING
2116  if (this->isConnected_textEventOut_OutputPort(0)) {
2117 #if FW_OBJECT_NAMES == 1
2118  const char* _formatString =
2119  "(%s) %s: Error occurred during partial downlink of file %s to file %s. Offset %" PRIu32 " greater than or equal to source filesize %" PRIu32 ".";
2120 #else
2121  const char* _formatString =
2122  "%s: Error occurred during partial downlink of file %s to file %s. Offset %" PRIu32 " greater than or equal to source filesize %" PRIu32 ".";
2123 #endif
2124 
2125  Fw::TextLogString _logString;
2126  _logString.format(
2127  _formatString,
2128 #if FW_OBJECT_NAMES == 1
2129  this->m_objName.toChar(),
2130 #endif
2131  "DownlinkPartialFail ",
2132  sourceFileName.toChar(),
2133  destFileName.toChar(),
2134  startOffset,
2135  filesize
2136  );
2137 
2138  this->textEventOut_out(
2139  0,
2140  _id,
2141  _logTime,
2143  _logString
2144  );
2145  }
2146 #endif
2147  }
2148 
2151  const Fw::StringBase& sourceFileName,
2152  U32 byteOffset
2153  ) const
2154  {
2155  // Get the time
2156  Fw::Time _logTime;
2157  if (this->isConnected_timeCaller_OutputPort(0)) {
2158  this->timeCaller_out(0, _logTime);
2159  }
2160 
2161  const FwEventIdType _id = this->getIdBase() + EVENTID_SENDDATAFAIL;
2162 
2163  // Emit the event on the log port
2164  if (this->isConnected_eventOut_OutputPort(0)) {
2165  Fw::LogBuffer _logBuff;
2167 
2168 #if FW_AMPCS_COMPATIBLE
2169  // Serialize the number of arguments
2170  _status = _logBuff.serializeFrom(static_cast<U8>(2));
2171  FW_ASSERT(
2172  _status == Fw::FW_SERIALIZE_OK,
2173  static_cast<FwAssertArgType>(_status)
2174  );
2175 #endif
2176 
2177  _status = sourceFileName.serializeTo(
2178  _logBuff,
2179  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 100)
2180  );
2181  FW_ASSERT(
2182  _status == Fw::FW_SERIALIZE_OK,
2183  static_cast<FwAssertArgType>(_status)
2184  );
2185 
2186 #if FW_AMPCS_COMPATIBLE
2187  // Serialize the argument size
2188  _status = _logBuff.serializeFrom(
2189  static_cast<U8>(sizeof(U32))
2190  );
2191  FW_ASSERT(
2192  _status == Fw::FW_SERIALIZE_OK,
2193  static_cast<FwAssertArgType>(_status)
2194  );
2195 #endif
2196  _status = _logBuff.serializeFrom(byteOffset);
2197  FW_ASSERT(
2198  _status == Fw::FW_SERIALIZE_OK,
2199  static_cast<FwAssertArgType>(_status)
2200  );
2201 
2202  this->eventOut_out(
2203  0,
2204  _id,
2205  _logTime,
2207  _logBuff
2208  );
2209  }
2210 
2211  // Emit the event on the text log port
2212 #if FW_ENABLE_TEXT_LOGGING
2213  if (this->isConnected_textEventOut_OutputPort(0)) {
2214 #if FW_OBJECT_NAMES == 1
2215  const char* _formatString =
2216  "(%s) %s: Failed to send data packet from file %s at byte offset %" PRIu32 ".";
2217 #else
2218  const char* _formatString =
2219  "%s: Failed to send data packet from file %s at byte offset %" PRIu32 ".";
2220 #endif
2221 
2222  Fw::TextLogString _logString;
2223  _logString.format(
2224  _formatString,
2225 #if FW_OBJECT_NAMES == 1
2226  this->m_objName.toChar(),
2227 #endif
2228  "SendDataFail ",
2229  sourceFileName.toChar(),
2230  byteOffset
2231  );
2232 
2233  this->textEventOut_out(
2234  0,
2235  _id,
2236  _logTime,
2238  _logString
2239  );
2240  }
2241 #endif
2242  }
2243 
2246  U32 fileSize,
2247  const Fw::StringBase& sourceFileName,
2248  const Fw::StringBase& destFileName
2249  ) const
2250  {
2251  // Get the time
2252  Fw::Time _logTime;
2253  if (this->isConnected_timeCaller_OutputPort(0)) {
2254  this->timeCaller_out(0, _logTime);
2255  }
2256 
2257  const FwEventIdType _id = this->getIdBase() + EVENTID_SENDSTARTED;
2258 
2259  // Emit the event on the log port
2260  if (this->isConnected_eventOut_OutputPort(0)) {
2261  Fw::LogBuffer _logBuff;
2263 
2264 #if FW_AMPCS_COMPATIBLE
2265  // Serialize the number of arguments
2266  _status = _logBuff.serializeFrom(static_cast<U8>(3));
2267  FW_ASSERT(
2268  _status == Fw::FW_SERIALIZE_OK,
2269  static_cast<FwAssertArgType>(_status)
2270  );
2271 #endif
2272 
2273 #if FW_AMPCS_COMPATIBLE
2274  // Serialize the argument size
2275  _status = _logBuff.serializeFrom(
2276  static_cast<U8>(sizeof(U32))
2277  );
2278  FW_ASSERT(
2279  _status == Fw::FW_SERIALIZE_OK,
2280  static_cast<FwAssertArgType>(_status)
2281  );
2282 #endif
2283  _status = _logBuff.serializeFrom(fileSize);
2284  FW_ASSERT(
2285  _status == Fw::FW_SERIALIZE_OK,
2286  static_cast<FwAssertArgType>(_status)
2287  );
2288 
2289  _status = sourceFileName.serializeTo(
2290  _logBuff,
2291  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 100)
2292  );
2293  FW_ASSERT(
2294  _status == Fw::FW_SERIALIZE_OK,
2295  static_cast<FwAssertArgType>(_status)
2296  );
2297 
2298  _status = destFileName.serializeTo(
2299  _logBuff,
2300  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 100)
2301  );
2302  FW_ASSERT(
2303  _status == Fw::FW_SERIALIZE_OK,
2304  static_cast<FwAssertArgType>(_status)
2305  );
2306 
2307  this->eventOut_out(
2308  0,
2309  _id,
2310  _logTime,
2312  _logBuff
2313  );
2314  }
2315 
2316  // Emit the event on the text log port
2317 #if FW_ENABLE_TEXT_LOGGING
2318  if (this->isConnected_textEventOut_OutputPort(0)) {
2319 #if FW_OBJECT_NAMES == 1
2320  const char* _formatString =
2321  "(%s) %s: Downlink of %" PRIu32 " bytes started from %s to %s";
2322 #else
2323  const char* _formatString =
2324  "%s: Downlink of %" PRIu32 " bytes started from %s to %s";
2325 #endif
2326 
2327  Fw::TextLogString _logString;
2328  _logString.format(
2329  _formatString,
2330 #if FW_OBJECT_NAMES == 1
2331  this->m_objName.toChar(),
2332 #endif
2333  "SendStarted ",
2334  fileSize,
2335  sourceFileName.toChar(),
2336  destFileName.toChar()
2337  );
2338 
2339  this->textEventOut_out(
2340  0,
2341  _id,
2342  _logTime,
2344  _logString
2345  );
2346  }
2347 #endif
2348  }
2349 
2352  {
2353  // Get the time
2354  Fw::Time _logTime;
2355  if (this->isConnected_timeCaller_OutputPort(0)) {
2356  this->timeCaller_out(0, _logTime);
2357  }
2358 
2360 
2361  // Emit the event on the log port
2362  if (this->isConnected_eventOut_OutputPort(0)) {
2363  Fw::LogBuffer _logBuff;
2365 
2366 #if FW_AMPCS_COMPATIBLE
2367  // Serialize the number of arguments
2368  _status = _logBuff.serializeFrom(static_cast<U8>(1));
2369  FW_ASSERT(
2370  _status == Fw::FW_SERIALIZE_OK,
2371  static_cast<FwAssertArgType>(_status)
2372  );
2373 #endif
2374 
2375  _status = sourceFileName.serializeTo(
2376  _logBuff,
2377  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 100)
2378  );
2379  FW_ASSERT(
2380  _status == Fw::FW_SERIALIZE_OK,
2381  static_cast<FwAssertArgType>(_status)
2382  );
2383 
2384  this->eventOut_out(
2385  0,
2386  _id,
2387  _logTime,
2389  _logBuff
2390  );
2391  }
2392 
2393  // Emit the event on the text log port
2394 #if FW_ENABLE_TEXT_LOGGING
2395  if (this->isConnected_textEventOut_OutputPort(0)) {
2396 #if FW_OBJECT_NAMES == 1
2397  const char* _formatString =
2398  "(%s) %s: Downlink of file %s stopped due to zero-size.";
2399 #else
2400  const char* _formatString =
2401  "%s: Downlink of file %s stopped due to zero-size.";
2402 #endif
2403 
2404  Fw::TextLogString _logString;
2405  _logString.format(
2406  _formatString,
2407 #if FW_OBJECT_NAMES == 1
2408  this->m_objName.toChar(),
2409 #endif
2410  "DownlinkZeroSizeFile ",
2411  sourceFileName.toChar()
2412  );
2413 
2414  this->textEventOut_out(
2415  0,
2416  _id,
2417  _logTime,
2419  _logString
2420  );
2421  }
2422 #endif
2423  }
2424 
2427  {
2428  // Get the time
2429  Fw::Time _logTime;
2430  if (this->isConnected_timeCaller_OutputPort(0)) {
2431  this->timeCaller_out(0, _logTime);
2432  }
2433 
2435 
2436  // Emit the event on the log port
2437  if (this->isConnected_eventOut_OutputPort(0)) {
2438  Fw::LogBuffer _logBuff;
2439 
2440 #if FW_AMPCS_COMPATIBLE
2442  // Serialize the number of arguments
2443  _status = _logBuff.serializeFrom(static_cast<U8>(0));
2444  FW_ASSERT(
2445  _status == Fw::FW_SERIALIZE_OK,
2446  static_cast<FwAssertArgType>(_status)
2447  );
2448 #endif
2449 
2450  this->eventOut_out(
2451  0,
2452  _id,
2453  _logTime,
2455  _logBuff
2456  );
2457  }
2458 
2459  // Emit the event on the text log port
2460 #if FW_ENABLE_TEXT_LOGGING
2461  if (this->isConnected_textEventOut_OutputPort(0)) {
2462 #if FW_OBJECT_NAMES == 1
2463  const char* _formatString =
2464  "(%s) %s: Commanded source filename too long";
2465 #else
2466  const char* _formatString =
2467  "%s: Commanded source filename too long";
2468 #endif
2469 
2470  Fw::TextLogString _logString;
2471  _logString.format(
2472  _formatString,
2473 #if FW_OBJECT_NAMES == 1
2474  this->m_objName.toChar(),
2475 #endif
2476  "FilenameSourceOverflow "
2477  );
2478 
2479  this->textEventOut_out(
2480  0,
2481  _id,
2482  _logTime,
2484  _logString
2485  );
2486  }
2487 #endif
2488  }
2489 
2492  {
2493  // Get the time
2494  Fw::Time _logTime;
2495  if (this->isConnected_timeCaller_OutputPort(0)) {
2496  this->timeCaller_out(0, _logTime);
2497  }
2498 
2500 
2501  // Emit the event on the log port
2502  if (this->isConnected_eventOut_OutputPort(0)) {
2503  Fw::LogBuffer _logBuff;
2504 
2505 #if FW_AMPCS_COMPATIBLE
2507  // Serialize the number of arguments
2508  _status = _logBuff.serializeFrom(static_cast<U8>(0));
2509  FW_ASSERT(
2510  _status == Fw::FW_SERIALIZE_OK,
2511  static_cast<FwAssertArgType>(_status)
2512  );
2513 #endif
2514 
2515  this->eventOut_out(
2516  0,
2517  _id,
2518  _logTime,
2520  _logBuff
2521  );
2522  }
2523 
2524  // Emit the event on the text log port
2525 #if FW_ENABLE_TEXT_LOGGING
2526  if (this->isConnected_textEventOut_OutputPort(0)) {
2527 #if FW_OBJECT_NAMES == 1
2528  const char* _formatString =
2529  "(%s) %s: Commanded destination filename too long";
2530 #else
2531  const char* _formatString =
2532  "%s: Commanded destination filename too long";
2533 #endif
2534 
2535  Fw::TextLogString _logString;
2536  _logString.format(
2537  _formatString,
2538 #if FW_OBJECT_NAMES == 1
2539  this->m_objName.toChar(),
2540 #endif
2541  "FilenameDestinationOverflow "
2542  );
2543 
2544  this->textEventOut_out(
2545  0,
2546  _id,
2547  _logTime,
2549  _logString
2550  );
2551  }
2552 #endif
2553  }
2554 
2557  {
2558  // Get the time
2559  Fw::Time _logTime;
2560  if (this->isConnected_timeCaller_OutputPort(0)) {
2561  this->timeCaller_out(0, _logTime);
2562  }
2563 
2564  const FwEventIdType _id = this->getIdBase() + EVENTID_SOURCEOUTOFSANDBOX;
2565 
2566  // Emit the event on the log port
2567  if (this->isConnected_eventOut_OutputPort(0)) {
2568  Fw::LogBuffer _logBuff;
2570 
2571 #if FW_AMPCS_COMPATIBLE
2572  // Serialize the number of arguments
2573  _status = _logBuff.serializeFrom(static_cast<U8>(1));
2574  FW_ASSERT(
2575  _status == Fw::FW_SERIALIZE_OK,
2576  static_cast<FwAssertArgType>(_status)
2577  );
2578 #endif
2579 
2580  _status = fileName.serializeTo(
2581  _logBuff,
2582  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 100)
2583  );
2584  FW_ASSERT(
2585  _status == Fw::FW_SERIALIZE_OK,
2586  static_cast<FwAssertArgType>(_status)
2587  );
2588 
2589  this->eventOut_out(
2590  0,
2591  _id,
2592  _logTime,
2594  _logBuff
2595  );
2596  }
2597 
2598  // Emit the event on the text log port
2599 #if FW_ENABLE_TEXT_LOGGING
2600  if (this->isConnected_textEventOut_OutputPort(0)) {
2601 #if FW_OBJECT_NAMES == 1
2602  const char* _formatString =
2603  "(%s) %s: Source file %s is outside the configured read sandbox";
2604 #else
2605  const char* _formatString =
2606  "%s: Source file %s is outside the configured read sandbox";
2607 #endif
2608 
2609  Fw::TextLogString _logString;
2610  _logString.format(
2611  _formatString,
2612 #if FW_OBJECT_NAMES == 1
2613  this->m_objName.toChar(),
2614 #endif
2615  "SourceOutOfSandbox ",
2616  fileName.toChar()
2617  );
2618 
2619  this->textEventOut_out(
2620  0,
2621  _id,
2622  _logTime,
2624  _logString
2625  );
2626  }
2627 #endif
2628  }
2629 
2630  // ----------------------------------------------------------------------
2631  // Telemetry serialized write
2632  // ----------------------------------------------------------------------
2633 
2636  FwChanIdType id,
2637  Fw::TlmBuffer& _tlmBuff,
2638  Fw::Time _tlmTime
2639  ) const
2640  {
2641  if (this->isConnected_tlmOut_OutputPort(0)) {
2642  if (
2644  (_tlmTime == Fw::ZERO_TIME)
2645  ) {
2646  this->timeCaller_out(0, _tlmTime);
2647  }
2648 
2649  FwChanIdType _id;
2650  _id = this->getIdBase() + id;
2651 
2652  this->tlmOut_out(
2653  0,
2654  _id,
2655  _tlmTime,
2656  _tlmBuff
2657  );
2658  }
2659  }
2660 
2661  // ----------------------------------------------------------------------
2662  // Telemetry write functions
2663  // ----------------------------------------------------------------------
2664 
2667  U32 arg,
2668  Fw::Time _tlmTime
2669  ) const
2670  {
2671  if (this->isConnected_tlmOut_OutputPort(0)) {
2672  Fw::TlmBuffer _tlmBuff;
2673  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
2674  FW_ASSERT(
2675  _stat == Fw::FW_SERIALIZE_OK,
2676  static_cast<FwAssertArgType>(_stat)
2677  );
2678 
2679  this->tlmWrite(
2681  _tlmBuff,
2682  _tlmTime
2683  );
2684  }
2685  }
2686 
2689  U32 arg,
2690  Fw::Time _tlmTime
2691  ) const
2692  {
2693  if (this->isConnected_tlmOut_OutputPort(0)) {
2694  Fw::TlmBuffer _tlmBuff;
2695  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
2696  FW_ASSERT(
2697  _stat == Fw::FW_SERIALIZE_OK,
2698  static_cast<FwAssertArgType>(_stat)
2699  );
2700 
2701  this->tlmWrite(
2703  _tlmBuff,
2704  _tlmTime
2705  );
2706  }
2707  }
2708 
2711  U32 arg,
2712  Fw::Time _tlmTime
2713  ) const
2714  {
2715  if (this->isConnected_tlmOut_OutputPort(0)) {
2716  Fw::TlmBuffer _tlmBuff;
2717  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
2718  FW_ASSERT(
2719  _stat == Fw::FW_SERIALIZE_OK,
2720  static_cast<FwAssertArgType>(_stat)
2721  );
2722 
2723  this->tlmWrite(
2725  _tlmBuff,
2726  _tlmTime
2727  );
2728  }
2729  }
2730 
2731  // ----------------------------------------------------------------------
2732  // Time
2733  // ----------------------------------------------------------------------
2734 
2736  getTime() const
2737  {
2738  if (this->isConnected_timeCaller_OutputPort(0)) {
2739  Fw::Time _time;
2740  this->timeCaller_out(0, _time);
2741  return _time;
2742  }
2743  else {
2744  return Fw::Time(TimeBase::TB_NONE, 0, 0);
2745  }
2746  }
2747 
2748  // ----------------------------------------------------------------------
2749  // Mutex operations for guarded ports
2750  //
2751  // You can override these operations to provide more sophisticated
2752  // synchronization
2753  // ----------------------------------------------------------------------
2754 
2757  {
2758  this->m_guardedPortMutex.lock();
2759  }
2760 
2763  {
2764  this->m_guardedPortMutex.unLock();
2765  }
2766 
2767  // ----------------------------------------------------------------------
2768  // Message dispatch functions
2769  // ----------------------------------------------------------------------
2770 
2771  Fw::QueuedComponentBase::MsgDispatchStatus FileDownlinkComponentBase ::
2772  doDispatch()
2773  {
2774  ComponentIpcSerializableBuffer _msg;
2775  FwQueuePriorityType _priority = 0;
2776 
2777  Os::Queue::Status _msgStatus = this->m_queue.receive(
2778  _msg,
2780  _priority
2781  );
2782  FW_ASSERT(
2783  _msgStatus == Os::Queue::OP_OK,
2784  static_cast<FwAssertArgType>(_msgStatus)
2785  );
2786 
2787  // Reset to beginning of buffer
2788  _msg.resetDeser();
2789 
2790  FwEnumStoreType _desMsg = 0;
2791  Fw::SerializeStatus _deserStatus = _msg.deserializeTo(_desMsg);
2792  FW_ASSERT(
2793  _deserStatus == Fw::FW_SERIALIZE_OK,
2794  static_cast<FwAssertArgType>(_deserStatus)
2795  );
2796 
2797  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
2798 
2799  if (_msgType == FILEDOWNLINK_COMPONENT_EXIT) {
2800  return MSG_DISPATCH_EXIT;
2801  }
2802 
2803  FwIndexType portNum = 0;
2804  _deserStatus = _msg.deserializeTo(portNum);
2805  FW_ASSERT(
2806  _deserStatus == Fw::FW_SERIALIZE_OK,
2807  static_cast<FwAssertArgType>(_deserStatus)
2808  );
2809 
2810  switch (_msgType) {
2811  // Handle async input port Run
2812  case RUN_SCHED: {
2813  // Deserialize argument context
2814  U32 context;
2815  _deserStatus = _msg.deserializeTo(context);
2816  FW_ASSERT(
2817  _deserStatus == Fw::FW_SERIALIZE_OK,
2818  static_cast<FwAssertArgType>(_deserStatus)
2819  );
2820  // Call handler function
2821  this->Run_handler(
2822  portNum,
2823  context
2824  );
2825 
2826  break;
2827  }
2828 
2829  // Handle async input port bufferReturn
2830  case BUFFERRETURN_BUFFERSEND: {
2831  // Deserialize argument fwBuffer
2832  Fw::Buffer fwBuffer;
2833  _deserStatus = _msg.deserializeTo(fwBuffer);
2834  FW_ASSERT(
2835  _deserStatus == Fw::FW_SERIALIZE_OK,
2836  static_cast<FwAssertArgType>(_deserStatus)
2837  );
2838  // Call handler function
2839  this->bufferReturn_handler(
2840  portNum,
2841  fwBuffer
2842  );
2843 
2844  break;
2845  }
2846 
2847  // Handle async input port pingIn
2848  case PINGIN_PING: {
2849  // Deserialize argument key
2850  U32 key;
2851  _deserStatus = _msg.deserializeTo(key);
2852  FW_ASSERT(
2853  _deserStatus == Fw::FW_SERIALIZE_OK,
2854  static_cast<FwAssertArgType>(_deserStatus)
2855  );
2856  // Call handler function
2857  this->pingIn_handler(
2858  portNum,
2859  key
2860  );
2861 
2862  break;
2863  }
2864 
2865  // Handle command SendFile
2866  case CMD_SENDFILE: {
2867  // Deserialize opcode
2868  FwOpcodeType _opCode = 0;
2869  _deserStatus = _msg.deserializeTo(_opCode);
2870  FW_ASSERT (
2871  _deserStatus == Fw::FW_SERIALIZE_OK,
2872  static_cast<FwAssertArgType>(_deserStatus)
2873  );
2874 
2875  // Deserialize command sequence
2876  U32 _cmdSeq = 0;
2877  _deserStatus = _msg.deserializeTo(_cmdSeq);
2878  FW_ASSERT (
2879  _deserStatus == Fw::FW_SERIALIZE_OK,
2880  static_cast<FwAssertArgType>(_deserStatus)
2881  );
2882 
2883  // Deserialize command argument buffer
2884  Fw::CmdArgBuffer args;
2885  _deserStatus = _msg.deserializeTo(args);
2886  FW_ASSERT (
2887  _deserStatus == Fw::FW_SERIALIZE_OK,
2888  static_cast<FwAssertArgType>(_deserStatus)
2889  );
2890 
2891  // Reset buffer
2892  args.resetDeser();
2893 
2894  // Deserialize argument sourceFileName
2895  Fw::CmdStringArg sourceFileName;
2896  _deserStatus = args.deserializeTo(sourceFileName);
2897  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2899  this->cmdResponse_out(
2900  _opCode,
2901  _cmdSeq,
2903  );
2904  }
2905  // Don't crash the task if bad arguments were passed from the ground
2906  break;
2907  }
2908 
2909  // Deserialize argument destFileName
2910  Fw::CmdStringArg destFileName;
2911  _deserStatus = args.deserializeTo(destFileName);
2912  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2914  this->cmdResponse_out(
2915  _opCode,
2916  _cmdSeq,
2918  );
2919  }
2920  // Don't crash the task if bad arguments were passed from the ground
2921  break;
2922  }
2923 
2924  // Make sure there was no data left over.
2925  // That means the argument buffer size was incorrect.
2926 #if FW_CMD_CHECK_RESIDUAL
2927  if (args.getDeserializeSizeLeft() != 0) {
2929  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2930  }
2931  // Don't crash the task if bad arguments were passed from the ground
2932  break;
2933  }
2934 #endif
2935 
2936  // Call handler function
2937  this->SendFile_cmdHandler(
2938  _opCode, _cmdSeq,
2939  sourceFileName,
2940  destFileName
2941  );
2942 
2943  break;
2944  }
2945 
2946  // Handle command Cancel
2947  case CMD_CANCEL: {
2948  // Deserialize opcode
2949  FwOpcodeType _opCode = 0;
2950  _deserStatus = _msg.deserializeTo(_opCode);
2951  FW_ASSERT (
2952  _deserStatus == Fw::FW_SERIALIZE_OK,
2953  static_cast<FwAssertArgType>(_deserStatus)
2954  );
2955 
2956  // Deserialize command sequence
2957  U32 _cmdSeq = 0;
2958  _deserStatus = _msg.deserializeTo(_cmdSeq);
2959  FW_ASSERT (
2960  _deserStatus == Fw::FW_SERIALIZE_OK,
2961  static_cast<FwAssertArgType>(_deserStatus)
2962  );
2963 
2964  // Deserialize command argument buffer
2965  Fw::CmdArgBuffer args;
2966  _deserStatus = _msg.deserializeTo(args);
2967  FW_ASSERT (
2968  _deserStatus == Fw::FW_SERIALIZE_OK,
2969  static_cast<FwAssertArgType>(_deserStatus)
2970  );
2971 
2972  // Reset buffer
2973  args.resetDeser();
2974 
2975  // Make sure there was no data left over.
2976  // That means the argument buffer size was incorrect.
2977 #if FW_CMD_CHECK_RESIDUAL
2978  if (args.getDeserializeSizeLeft() != 0) {
2980  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2981  }
2982  // Don't crash the task if bad arguments were passed from the ground
2983  break;
2984  }
2985 #endif
2986 
2987  // Call handler function
2988  this->Cancel_cmdHandler(_opCode, _cmdSeq);
2989 
2990  break;
2991  }
2992 
2993  // Handle command SendPartial
2994  case CMD_SENDPARTIAL: {
2995  // Deserialize opcode
2996  FwOpcodeType _opCode = 0;
2997  _deserStatus = _msg.deserializeTo(_opCode);
2998  FW_ASSERT (
2999  _deserStatus == Fw::FW_SERIALIZE_OK,
3000  static_cast<FwAssertArgType>(_deserStatus)
3001  );
3002 
3003  // Deserialize command sequence
3004  U32 _cmdSeq = 0;
3005  _deserStatus = _msg.deserializeTo(_cmdSeq);
3006  FW_ASSERT (
3007  _deserStatus == Fw::FW_SERIALIZE_OK,
3008  static_cast<FwAssertArgType>(_deserStatus)
3009  );
3010 
3011  // Deserialize command argument buffer
3012  Fw::CmdArgBuffer args;
3013  _deserStatus = _msg.deserializeTo(args);
3014  FW_ASSERT (
3015  _deserStatus == Fw::FW_SERIALIZE_OK,
3016  static_cast<FwAssertArgType>(_deserStatus)
3017  );
3018 
3019  // Reset buffer
3020  args.resetDeser();
3021 
3022  // Deserialize argument sourceFileName
3023  Fw::CmdStringArg sourceFileName;
3024  _deserStatus = args.deserializeTo(sourceFileName);
3025  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
3027  this->cmdResponse_out(
3028  _opCode,
3029  _cmdSeq,
3031  );
3032  }
3033  // Don't crash the task if bad arguments were passed from the ground
3034  break;
3035  }
3036 
3037  // Deserialize argument destFileName
3038  Fw::CmdStringArg destFileName;
3039  _deserStatus = args.deserializeTo(destFileName);
3040  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
3042  this->cmdResponse_out(
3043  _opCode,
3044  _cmdSeq,
3046  );
3047  }
3048  // Don't crash the task if bad arguments were passed from the ground
3049  break;
3050  }
3051 
3052  // Deserialize argument startOffset
3053  U32 startOffset;
3054  _deserStatus = args.deserializeTo(startOffset);
3055  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
3057  this->cmdResponse_out(
3058  _opCode,
3059  _cmdSeq,
3061  );
3062  }
3063  // Don't crash the task if bad arguments were passed from the ground
3064  break;
3065  }
3066 
3067  // Deserialize argument length
3068  U32 length;
3069  _deserStatus = args.deserializeTo(length);
3070  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
3072  this->cmdResponse_out(
3073  _opCode,
3074  _cmdSeq,
3076  );
3077  }
3078  // Don't crash the task if bad arguments were passed from the ground
3079  break;
3080  }
3081 
3082  // Make sure there was no data left over.
3083  // That means the argument buffer size was incorrect.
3084 #if FW_CMD_CHECK_RESIDUAL
3085  if (args.getDeserializeSizeLeft() != 0) {
3087  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
3088  }
3089  // Don't crash the task if bad arguments were passed from the ground
3090  break;
3091  }
3092 #endif
3093 
3094  // Call handler function
3095  this->SendPartial_cmdHandler(
3096  _opCode, _cmdSeq,
3097  sourceFileName,
3098  destFileName,
3099  startOffset,
3100  length
3101  );
3102 
3103  break;
3104  }
3105 
3106  default:
3107  return MSG_DISPATCH_ERROR;
3108  }
3109 
3110  return MSG_DISPATCH_OK;
3111  }
3112 
3113  // ----------------------------------------------------------------------
3114  // Calls for messages received on special input ports
3115  // ----------------------------------------------------------------------
3116 
3117  void FileDownlinkComponentBase ::
3118  m_p_cmdIn_in(
3119  Fw::PassiveComponentBase* callComp,
3120  FwIndexType portNum,
3121  FwOpcodeType opCode,
3122  U32 cmdSeq,
3123  Fw::CmdArgBuffer& args
3124  )
3125  {
3126  FW_ASSERT(callComp);
3127  FileDownlinkComponentBase* compPtr = static_cast<FileDownlinkComponentBase*>(callComp);
3128  compPtr->cmdIn_handlerBase(
3129  portNum,
3130  opCode,
3131  cmdSeq,
3132  args
3133  );
3134  }
3135 
3136  // ----------------------------------------------------------------------
3137  // Calls for messages received on typed input ports
3138  // ----------------------------------------------------------------------
3139 
3140  void FileDownlinkComponentBase ::
3141  m_p_Run_in(
3142  Fw::PassiveComponentBase* callComp,
3143  FwIndexType portNum,
3144  U32 context
3145  )
3146  {
3147  FW_ASSERT(callComp);
3148  FileDownlinkComponentBase* compPtr = static_cast<FileDownlinkComponentBase*>(callComp);
3149  compPtr->Run_handlerBase(
3150  portNum,
3151  context
3152  );
3153  }
3154 
3155  Svc::SendFileResponse FileDownlinkComponentBase ::
3156  m_p_SendFile_in(
3157  Fw::PassiveComponentBase* callComp,
3158  FwIndexType portNum,
3159  const Fw::StringBase& sourceFileName,
3160  const Fw::StringBase& destFileName,
3161  U32 offset,
3162  U32 length
3163  )
3164  {
3165  FW_ASSERT(callComp);
3166  FileDownlinkComponentBase* compPtr = static_cast<FileDownlinkComponentBase*>(callComp);
3167  return compPtr->SendFile_handlerBase(
3168  portNum,
3169  sourceFileName,
3170  destFileName,
3171  offset,
3172  length
3173  );
3174  }
3175 
3176  void FileDownlinkComponentBase ::
3177  m_p_bufferReturn_in(
3178  Fw::PassiveComponentBase* callComp,
3179  FwIndexType portNum,
3180  Fw::Buffer& fwBuffer
3181  )
3182  {
3183  FW_ASSERT(callComp);
3184  FileDownlinkComponentBase* compPtr = static_cast<FileDownlinkComponentBase*>(callComp);
3185  compPtr->bufferReturn_handlerBase(
3186  portNum,
3187  fwBuffer
3188  );
3189  }
3190 
3191  void FileDownlinkComponentBase ::
3192  m_p_pingIn_in(
3193  Fw::PassiveComponentBase* callComp,
3194  FwIndexType portNum,
3195  U32 key
3196  )
3197  {
3198  FW_ASSERT(callComp);
3199  FileDownlinkComponentBase* compPtr = static_cast<FileDownlinkComponentBase*>(callComp);
3200  compPtr->pingIn_handlerBase(
3201  portNum,
3202  key
3203  );
3204  }
3205 
3206 #if !FW_DIRECT_PORT_CALLS
3207 
3208  // ----------------------------------------------------------------------
3209  // Invocation functions for special output ports
3210  // ----------------------------------------------------------------------
3211 
3212  void FileDownlinkComponentBase ::
3213  cmdRegOut_out(
3214  FwIndexType portNum,
3215  FwOpcodeType opCode
3216  ) const
3217  {
3218  FW_ASSERT(
3219  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
3220  static_cast<FwAssertArgType>(portNum)
3221  );
3222 
3223  FW_ASSERT(
3224  this->m_cmdRegOut_OutputPort[portNum].isConnected(),
3225  static_cast<FwAssertArgType>(portNum)
3226  );
3227  this->m_cmdRegOut_OutputPort[portNum].invoke(
3228  opCode
3229  );
3230  }
3231 
3232  void FileDownlinkComponentBase ::
3233  cmdResponseOut_out(
3234  FwIndexType portNum,
3235  FwOpcodeType opCode,
3236  U32 cmdSeq,
3237  const Fw::CmdResponse& response
3238  ) const
3239  {
3240  FW_ASSERT(
3241  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
3242  static_cast<FwAssertArgType>(portNum)
3243  );
3244 
3245  FW_ASSERT(
3246  this->m_cmdResponseOut_OutputPort[portNum].isConnected(),
3247  static_cast<FwAssertArgType>(portNum)
3248  );
3249  this->m_cmdResponseOut_OutputPort[portNum].invoke(
3250  opCode,
3251  cmdSeq,
3252  response
3253  );
3254  }
3255 
3256  void FileDownlinkComponentBase ::
3257  eventOut_out(
3258  FwIndexType portNum,
3259  FwEventIdType id,
3260  Fw::Time& timeTag,
3261  const Fw::LogSeverity& severity,
3262  Fw::LogBuffer& args
3263  ) const
3264  {
3265  FW_ASSERT(
3266  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
3267  static_cast<FwAssertArgType>(portNum)
3268  );
3269 
3270  FW_ASSERT(
3271  this->m_eventOut_OutputPort[portNum].isConnected(),
3272  static_cast<FwAssertArgType>(portNum)
3273  );
3274  this->m_eventOut_OutputPort[portNum].invoke(
3275  id,
3276  timeTag,
3277  severity,
3278  args
3279  );
3280  }
3281 
3282 #if FW_ENABLE_TEXT_LOGGING
3283 
3284  void FileDownlinkComponentBase ::
3285  textEventOut_out(
3286  FwIndexType portNum,
3287  FwEventIdType id,
3288  Fw::Time& timeTag,
3289  const Fw::LogSeverity& severity,
3290  Fw::TextLogString& text
3291  ) const
3292  {
3293  FW_ASSERT(
3294  (0 <= portNum) && (portNum < this->getNum_textEventOut_OutputPorts()),
3295  static_cast<FwAssertArgType>(portNum)
3296  );
3297 
3298  FW_ASSERT(
3299  this->m_textEventOut_OutputPort[portNum].isConnected(),
3300  static_cast<FwAssertArgType>(portNum)
3301  );
3302  this->m_textEventOut_OutputPort[portNum].invoke(
3303  id,
3304  timeTag,
3305  severity,
3306  text
3307  );
3308  }
3309 
3310 #endif
3311 
3312  void FileDownlinkComponentBase ::
3313  timeCaller_out(
3314  FwIndexType portNum,
3315  Fw::Time& time
3316  ) const
3317  {
3318  FW_ASSERT(
3319  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
3320  static_cast<FwAssertArgType>(portNum)
3321  );
3322 
3323  FW_ASSERT(
3324  this->m_timeCaller_OutputPort[portNum].isConnected(),
3325  static_cast<FwAssertArgType>(portNum)
3326  );
3327  this->m_timeCaller_OutputPort[portNum].invoke(
3328  time
3329  );
3330  }
3331 
3332  void FileDownlinkComponentBase ::
3333  tlmOut_out(
3334  FwIndexType portNum,
3335  FwChanIdType id,
3336  Fw::Time& timeTag,
3337  Fw::TlmBuffer& val
3338  ) const
3339  {
3340  FW_ASSERT(
3341  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
3342  static_cast<FwAssertArgType>(portNum)
3343  );
3344 
3345  FW_ASSERT(
3346  this->m_tlmOut_OutputPort[portNum].isConnected(),
3347  static_cast<FwAssertArgType>(portNum)
3348  );
3349  this->m_tlmOut_OutputPort[portNum].invoke(
3350  id,
3351  timeTag,
3352  val
3353  );
3354  }
3355 
3356 #endif
3357 
3358 }
Serialization/Deserialization operation was successful.
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:157
static constexpr FwSizeType CAPACITY
Definition: CmdPortAc.hpp:36
FwIdType FwOpcodeType
The type of a command opcode.
Operation succeeded.
Definition: Os.hpp:27
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
PlatformSizeType FwSizeType
Status receive(U8 *destination, FwSizeType capacity, BlockingType blockType, FwSizeType &actualSize, FwQueuePriorityType &priority) override
receive a message from the queue through delegate
Definition: Queue.cpp:71
I32 FwEnumStoreType
Status
status returned from the queue send function
Definition: Queue.hpp:30
void init()
Initialization function.
Definition: SchedPortAc.cpp:73
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void init()
Initialization function.
Definition: CmdPortAc.cpp:89
static constexpr FwSizeType CAPACITY
void unLock()
unlock the mutex and assert success
Definition: Mutex.cpp:41
void invoke(U32 key) const
Invoke a port connection.
Definition: PingPortAc.cpp:170
virtual const CHAR * toChar() const =0
Convert to a C-style char*.
const Time ZERO_TIME
Definition: Time.cpp:5
void init()
Initialization function.
Definition: TlmPortAc.cpp:171
Enum representing a command response.
No time base has been established (Required)
void addCallPort(InputCmdRegPort *callPort)
Register an input port.
void init()
Initialization function.
Os::Queue m_queue
queue object for active component
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:177
void init()
Object initializer.
Definition: ObjBase.cpp:24
SerializeStatus
forward declaration for string
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: CmdPortAc.cpp:95
Message will block until space is available.
Definition: Queue.hpp:47
FwIdType FwEventIdType
The type of an event identifier.
void invoke(FwOpcodeType opCode) const
Invoke a port connection.
static constexpr FwSizeType CAPACITY
Definition: PingPortAc.hpp:34
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:40
void init()
Initialization function.
Definition: TimePortAc.cpp:151
Os::Queue::Status createQueue(FwSizeType depth, FwSizeType msgSize)
#define FW_MIN(a, b)
MIN macro (deprecated in C++, use std::min)
Definition: BasicTypes.h:99
A less serious but recoverable event.
void invoke(Fw::Buffer &fwBuffer) const
Invoke a port connection.
void init()
Initialization function.
Definition: PingPortAc.cpp:151
void init()
Initialization function.
void addCallPort(InputBufferSendPort *callPort)
Register an input port.
void invoke(Fw::Time &time) const
Invoke a port connection.
Definition: TimePortAc.cpp:170
Serializable::SizeType getDeserializeSizeLeft() const override
Get remaining deserialization buffer size.
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke a port connection.
FwIdType FwChanIdType
The type of a telemetry channel identifier.
FwSizeType SizeType
void addCallPort(InputPingPort *callPort)
Register an input port.
Definition: PingPortAc.cpp:157
Status send(const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override
send a message into the queue through delegate
Definition: Queue.cpp:54
void resetDeser() override
Reset deserialization pointer to beginning of buffer.
A serious but recoverable event.
void invoke(FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val) const
Invoke a port connection.
Definition: TlmPortAc.cpp:190
const char * toChar() const
Convert to a C-style char*.
bool isConnected() const
Definition: PortBase.cpp:38
Enum representing event severity.
#define PRI_FwIndexType
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:58
void init()
Initialization function.
Definition: LogPortAc.cpp:180
void setPortNum(FwIndexType portNum)
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:54
BlockingType
message type
Definition: Queue.hpp:46
void init()
Initialization function.
Command failed to deserialize.
PlatformQueuePriorityType FwQueuePriorityType
The type of queue priorities used.
Important informational events.
void init()
Initialization function.
message to exit active component task
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: SchedPortAc.cpp:79
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args) const
Invoke a port connection.
Definition: LogPortAc.cpp:199
A message was sent requesting an exit of the loop.
PlatformIndexType FwIndexType
Send file response struct.
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:186
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void init()
Initialization function.
void init()
Initialization function.
Definition: PingPortAc.cpp:73
RateGroupDivider component implementation.
message sent/received okay
Definition: Queue.hpp:31
SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG) override
Deserialize an 8-bit unsigned integer value.
U8 BYTE
byte type
Definition: BasicTypes.h:57
void invoke(const Svc::SendFileResponse &resp) const
Invoke a port connection.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: PingPortAc.cpp:79
Message will return with status when space is unavailable.
Definition: Queue.hpp:48
Implementation of malloc based allocator.
void init()
Initialization function.
void addCallPort(InputSendFileCompletePort *callPort)
Register an input port.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
static constexpr FwSizeType CAPACITY
Definition: SchedPortAc.hpp:34
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.
void lock()
lock the mutex and assert success
Definition: Mutex.cpp:34
SerializeStatus serializeTo(SerialBufferBase &buffer, Endianness mode=Endianness::BIG) const override
Serialize the contents of this object to a buffer.