F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
FileDispatcherComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title FileDispatcherComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for FileDispatcher 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  FILEDISPATCHER_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT,
19  FILEANNOUNCERECV_FILEANNOUNCE,
20  PINGIN_PING,
21  CMD_ENABLE_DISPATCH,
22  };
23 
24  // Get the max size by constructing a union of the async input, command, and
25  // internal port serialization sizes
26  union BuffUnion {
27  BYTE fileAnnounceRecvPortSize[Svc::FileAnnouncePortBuffer::CAPACITY];
30  };
31 
32  // Define a message buffer class large enough to handle all the
33  // asynchronous inputs to the component
34  class ComponentIpcSerializableBuffer :
36  {
37 
38  public:
39 
40  enum {
41  // Offset into data in buffer: Size of message ID and port number
42  DATA_OFFSET = sizeof(FwEnumStoreType) + sizeof(FwIndexType),
43  // Max data size
44  MAX_DATA_SIZE = sizeof(BuffUnion),
45  // Max message size: Size of message id + size of port + max data size
46  SERIALIZATION_SIZE = DATA_OFFSET + MAX_DATA_SIZE
47  };
48 
49  ComponentIpcSerializableBuffer() : Fw::LinearBufferBase(m_buff, sizeof(m_buff)) {
50 
51  }
52 
53  private:
54  // Should be the max of all the input ports serialized sizes...
55  U8 m_buff[SERIALIZATION_SIZE];
56 
57  };
58  }
59 
60  // ----------------------------------------------------------------------
61  // Component initialization
62  // ----------------------------------------------------------------------
63 
66  FwSizeType queueDepth,
67  FwEnumStoreType instance
68  )
69  {
70  // Initialize base class
72 
73 #if !FW_DIRECT_PORT_CALLS
74  // Connect input port cmdIn
75  for (
76  FwIndexType port = 0;
77  port < static_cast<FwIndexType>(this->getNum_cmdIn_InputPorts());
78  port++
79  ) {
80  this->m_cmdIn_InputPort[port].init();
81  this->m_cmdIn_InputPort[port].addCallComp(
82  this,
83  m_p_cmdIn_in
84  );
85  this->m_cmdIn_InputPort[port].setPortNum(port);
86 
87 #if FW_OBJECT_NAMES == 1
88  Fw::ObjectName portName;
89  portName.format(
90  "%s_cmdIn_InputPort[%" PRI_FwIndexType "]",
91  this->m_objName.toChar(),
92  port
93  );
94  this->m_cmdIn_InputPort[port].setObjName(portName.toChar());
95 #endif
96  }
97 #endif
98 
99 #if !FW_DIRECT_PORT_CALLS
100  // Connect input port fileAnnounceRecv
101  for (
102  FwIndexType port = 0;
103  port < static_cast<FwIndexType>(this->getNum_fileAnnounceRecv_InputPorts());
104  port++
105  ) {
106  this->m_fileAnnounceRecv_InputPort[port].init();
107  this->m_fileAnnounceRecv_InputPort[port].addCallComp(
108  this,
109  m_p_fileAnnounceRecv_in
110  );
111  this->m_fileAnnounceRecv_InputPort[port].setPortNum(port);
112 
113 #if FW_OBJECT_NAMES == 1
114  Fw::ObjectName portName;
115  portName.format(
116  "%s_fileAnnounceRecv_InputPort[%" PRI_FwIndexType "]",
117  this->m_objName.toChar(),
118  port
119  );
120  this->m_fileAnnounceRecv_InputPort[port].setObjName(portName.toChar());
121 #endif
122  }
123 #endif
124 
125 #if !FW_DIRECT_PORT_CALLS
126  // Connect input port pingIn
127  for (
128  FwIndexType port = 0;
129  port < static_cast<FwIndexType>(this->getNum_pingIn_InputPorts());
130  port++
131  ) {
132  this->m_pingIn_InputPort[port].init();
133  this->m_pingIn_InputPort[port].addCallComp(
134  this,
135  m_p_pingIn_in
136  );
137  this->m_pingIn_InputPort[port].setPortNum(port);
138 
139 #if FW_OBJECT_NAMES == 1
140  Fw::ObjectName portName;
141  portName.format(
142  "%s_pingIn_InputPort[%" PRI_FwIndexType "]",
143  this->m_objName.toChar(),
144  port
145  );
146  this->m_pingIn_InputPort[port].setObjName(portName.toChar());
147 #endif
148  }
149 #endif
150 
151 #if !FW_DIRECT_PORT_CALLS
152  // Connect output port cmdRegOut
153  for (
154  FwIndexType port = 0;
155  port < static_cast<FwIndexType>(this->getNum_cmdRegOut_OutputPorts());
156  port++
157  ) {
158  this->m_cmdRegOut_OutputPort[port].init();
159 
160 #if FW_OBJECT_NAMES == 1
161  Fw::ObjectName portName;
162  portName.format(
163  "%s_cmdRegOut_OutputPort[%" PRI_FwIndexType "]",
164  this->m_objName.toChar(),
165  port
166  );
167  this->m_cmdRegOut_OutputPort[port].setObjName(portName.toChar());
168 #endif
169  }
170 #endif
171 
172 #if !FW_DIRECT_PORT_CALLS
173  // Connect output port cmdResponseOut
174  for (
175  FwIndexType port = 0;
176  port < static_cast<FwIndexType>(this->getNum_cmdResponseOut_OutputPorts());
177  port++
178  ) {
179  this->m_cmdResponseOut_OutputPort[port].init();
180 
181 #if FW_OBJECT_NAMES == 1
182  Fw::ObjectName portName;
183  portName.format(
184  "%s_cmdResponseOut_OutputPort[%" PRI_FwIndexType "]",
185  this->m_objName.toChar(),
186  port
187  );
188  this->m_cmdResponseOut_OutputPort[port].setObjName(portName.toChar());
189 #endif
190  }
191 #endif
192 
193 #if !FW_DIRECT_PORT_CALLS
194  // Connect output port logOut
195  for (
196  FwIndexType port = 0;
197  port < static_cast<FwIndexType>(this->getNum_logOut_OutputPorts());
198  port++
199  ) {
200  this->m_logOut_OutputPort[port].init();
201 
202 #if FW_OBJECT_NAMES == 1
203  Fw::ObjectName portName;
204  portName.format(
205  "%s_logOut_OutputPort[%" PRI_FwIndexType "]",
206  this->m_objName.toChar(),
207  port
208  );
209  this->m_logOut_OutputPort[port].setObjName(portName.toChar());
210 #endif
211  }
212 #endif
213 
214 #if !FW_DIRECT_PORT_CALLS && FW_ENABLE_TEXT_LOGGING
215  // Connect output port logTextOut
216  for (
217  FwIndexType port = 0;
218  port < static_cast<FwIndexType>(this->getNum_logTextOut_OutputPorts());
219  port++
220  ) {
221  this->m_logTextOut_OutputPort[port].init();
222 
223 #if FW_OBJECT_NAMES == 1
224  Fw::ObjectName portName;
225  portName.format(
226  "%s_logTextOut_OutputPort[%" PRI_FwIndexType "]",
227  this->m_objName.toChar(),
228  port
229  );
230  this->m_logTextOut_OutputPort[port].setObjName(portName.toChar());
231 #endif
232  }
233 #endif
234 
235 #if !FW_DIRECT_PORT_CALLS
236  // Connect output port timeCaller
237  for (
238  FwIndexType port = 0;
239  port < static_cast<FwIndexType>(this->getNum_timeCaller_OutputPorts());
240  port++
241  ) {
242  this->m_timeCaller_OutputPort[port].init();
243 
244 #if FW_OBJECT_NAMES == 1
245  Fw::ObjectName portName;
246  portName.format(
247  "%s_timeCaller_OutputPort[%" PRI_FwIndexType "]",
248  this->m_objName.toChar(),
249  port
250  );
251  this->m_timeCaller_OutputPort[port].setObjName(portName.toChar());
252 #endif
253  }
254 #endif
255 
256 #if !FW_DIRECT_PORT_CALLS
257  // Connect output port fileDispatch
258  for (
259  FwIndexType port = 0;
260  port < static_cast<FwIndexType>(this->getNum_fileDispatch_OutputPorts());
261  port++
262  ) {
263  this->m_fileDispatch_OutputPort[port].init();
264 
265 #if FW_OBJECT_NAMES == 1
266  Fw::ObjectName portName;
267  portName.format(
268  "%s_fileDispatch_OutputPort[%" PRI_FwIndexType "]",
269  this->m_objName.toChar(),
270  port
271  );
272  this->m_fileDispatch_OutputPort[port].setObjName(portName.toChar());
273 #endif
274  }
275 #endif
276 
277 #if !FW_DIRECT_PORT_CALLS
278  // Connect output port pingOut
279  for (
280  FwIndexType port = 0;
281  port < static_cast<FwIndexType>(this->getNum_pingOut_OutputPorts());
282  port++
283  ) {
284  this->m_pingOut_OutputPort[port].init();
285 
286 #if FW_OBJECT_NAMES == 1
287  Fw::ObjectName portName;
288  portName.format(
289  "%s_pingOut_OutputPort[%" PRI_FwIndexType "]",
290  this->m_objName.toChar(),
291  port
292  );
293  this->m_pingOut_OutputPort[port].setObjName(portName.toChar());
294 #endif
295  }
296 #endif
297 
298  // Create the queue
299  Os::Queue::Status qStat = this->createQueue(
300  queueDepth,
301  static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
302  );
303  FW_ASSERT(
304  Os::Queue::Status::OP_OK == qStat,
305  static_cast<FwAssertArgType>(qStat)
306  );
307  }
308 
309 #if !FW_DIRECT_PORT_CALLS
310 
311  // ----------------------------------------------------------------------
312  // Getters for special input ports
313  // ----------------------------------------------------------------------
314 
317  {
318  FW_ASSERT(
319  (0 <= portNum) && (portNum < this->getNum_cmdIn_InputPorts()),
320  static_cast<FwAssertArgType>(portNum)
321  );
322 
323  return &this->m_cmdIn_InputPort[portNum];
324  }
325 
326 #endif
327 
328 #if !FW_DIRECT_PORT_CALLS
329 
330  // ----------------------------------------------------------------------
331  // Getters for typed input ports
332  // ----------------------------------------------------------------------
333 
336  {
337  FW_ASSERT(
338  (0 <= portNum) && (portNum < this->getNum_fileAnnounceRecv_InputPorts()),
339  static_cast<FwAssertArgType>(portNum)
340  );
341 
342  return &this->m_fileAnnounceRecv_InputPort[portNum];
343  }
344 
347  {
348  FW_ASSERT(
349  (0 <= portNum) && (portNum < this->getNum_pingIn_InputPorts()),
350  static_cast<FwAssertArgType>(portNum)
351  );
352 
353  return &this->m_pingIn_InputPort[portNum];
354  }
355 
356 #endif
357 
358 #if !FW_DIRECT_PORT_CALLS
359 
360  // ----------------------------------------------------------------------
361  // Connect input ports to special output ports
362  // ----------------------------------------------------------------------
363 
366  FwIndexType portNum,
367  Fw::InputCmdRegPort* port
368  )
369  {
370  FW_ASSERT(
371  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
372  static_cast<FwAssertArgType>(portNum)
373  );
374 
375  this->m_cmdRegOut_OutputPort[portNum].addCallPort(port);
376  }
377 
380  FwIndexType portNum,
382  )
383  {
384  FW_ASSERT(
385  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
386  static_cast<FwAssertArgType>(portNum)
387  );
388 
389  this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port);
390  }
391 
394  FwIndexType portNum,
395  Fw::InputLogPort* port
396  )
397  {
398  FW_ASSERT(
399  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
400  static_cast<FwAssertArgType>(portNum)
401  );
402 
403  this->m_logOut_OutputPort[portNum].addCallPort(port);
404  }
405 
406 #if FW_ENABLE_TEXT_LOGGING == 1
407 
408  void FileDispatcherComponentBase ::
409  set_logTextOut_OutputPort(
410  FwIndexType portNum,
412  )
413  {
414  FW_ASSERT(
415  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
416  static_cast<FwAssertArgType>(portNum)
417  );
418 
419  this->m_logTextOut_OutputPort[portNum].addCallPort(port);
420  }
421 
422 #endif
423 
426  FwIndexType portNum,
427  Fw::InputTimePort* port
428  )
429  {
430  FW_ASSERT(
431  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
432  static_cast<FwAssertArgType>(portNum)
433  );
434 
435  this->m_timeCaller_OutputPort[portNum].addCallPort(port);
436  }
437 
438 #endif
439 
440 #if !FW_DIRECT_PORT_CALLS
441 
442  // ----------------------------------------------------------------------
443  // Connect typed input ports to typed output ports
444  // ----------------------------------------------------------------------
445 
448  FwIndexType portNum,
450  )
451  {
452  FW_ASSERT(
453  (0 <= portNum) && (portNum < this->getNum_fileDispatch_OutputPorts()),
454  static_cast<FwAssertArgType>(portNum)
455  );
456 
457  this->m_fileDispatch_OutputPort[portNum].addCallPort(port);
458  }
459 
462  FwIndexType portNum,
463  Svc::InputPingPort* port
464  )
465  {
466  FW_ASSERT(
467  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
468  static_cast<FwAssertArgType>(portNum)
469  );
470 
471  this->m_pingOut_OutputPort[portNum].addCallPort(port);
472  }
473 
474 #endif
475 
476 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
477 
478  // ----------------------------------------------------------------------
479  // Connect serial input ports to special output ports
480  // ----------------------------------------------------------------------
481 
484  FwIndexType portNum,
485  Fw::InputSerializePort* port
486  )
487  {
488  FW_ASSERT(
489  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
490  static_cast<FwAssertArgType>(portNum)
491  );
492 
493  this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port);
494  }
495 
498  FwIndexType portNum,
499  Fw::InputSerializePort* port
500  )
501  {
502  FW_ASSERT(
503  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
504  static_cast<FwAssertArgType>(portNum)
505  );
506 
507  this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port);
508  }
509 
512  FwIndexType portNum,
513  Fw::InputSerializePort* port
514  )
515  {
516  FW_ASSERT(
517  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
518  static_cast<FwAssertArgType>(portNum)
519  );
520 
521  this->m_logOut_OutputPort[portNum].registerSerialPort(port);
522  }
523 
524 #if FW_ENABLE_TEXT_LOGGING == 1
525 
526  void FileDispatcherComponentBase ::
527  set_logTextOut_OutputPort(
528  FwIndexType portNum,
529  Fw::InputSerializePort* port
530  )
531  {
532  FW_ASSERT(
533  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
534  static_cast<FwAssertArgType>(portNum)
535  );
536 
537  this->m_logTextOut_OutputPort[portNum].registerSerialPort(port);
538  }
539 
540 #endif
541 
544  FwIndexType portNum,
545  Fw::InputSerializePort* port
546  )
547  {
548  FW_ASSERT(
549  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
550  static_cast<FwAssertArgType>(portNum)
551  );
552 
553  this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
554  }
555 
556 #endif
557 
558 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
559 
560  // ----------------------------------------------------------------------
561  // Connect serial input ports to typed output ports
562  // ----------------------------------------------------------------------
563 
566  FwIndexType portNum,
567  Fw::InputSerializePort* port
568  )
569  {
570  FW_ASSERT(
571  (0 <= portNum) && (portNum < this->getNum_fileDispatch_OutputPorts()),
572  static_cast<FwAssertArgType>(portNum)
573  );
574 
575  this->m_fileDispatch_OutputPort[portNum].registerSerialPort(port);
576  }
577 
580  FwIndexType portNum,
581  Fw::InputSerializePort* port
582  )
583  {
584  FW_ASSERT(
585  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
586  static_cast<FwAssertArgType>(portNum)
587  );
588 
589  this->m_pingOut_OutputPort[portNum].registerSerialPort(port);
590  }
591 
592 #endif
593 
594  // ----------------------------------------------------------------------
595  // Command registration
596  // ----------------------------------------------------------------------
597 
600  {
602 
603  this->cmdRegOut_out(
604  0,
606  );
607  }
608 
609  // ----------------------------------------------------------------------
610  // Component construction and destruction
611  // ----------------------------------------------------------------------
612 
614  FileDispatcherComponentBase(const char* compName) :
615  Fw::ActiveComponentBase(compName)
616  {
617  this->m_FileDispatchPortNotConnectedThrottle = 0;
618  }
619 
622  {
623 
624  }
625 
626 #if !FW_DIRECT_PORT_CALLS
627 
628  // ----------------------------------------------------------------------
629  // Connection status queries for special output ports
630  // ----------------------------------------------------------------------
631 
634  {
635  FW_ASSERT(
636  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
637  static_cast<FwAssertArgType>(portNum)
638  );
639 
640  return this->m_cmdRegOut_OutputPort[portNum].isConnected();
641  }
642 
645  {
646  FW_ASSERT(
647  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
648  static_cast<FwAssertArgType>(portNum)
649  );
650 
651  return this->m_cmdResponseOut_OutputPort[portNum].isConnected();
652  }
653 
656  {
657  FW_ASSERT(
658  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
659  static_cast<FwAssertArgType>(portNum)
660  );
661 
662  return this->m_logOut_OutputPort[portNum].isConnected();
663  }
664 
665 #if FW_ENABLE_TEXT_LOGGING == 1
666 
667  bool FileDispatcherComponentBase ::
668  isConnected_logTextOut_OutputPort(FwIndexType portNum) const
669  {
670  FW_ASSERT(
671  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
672  static_cast<FwAssertArgType>(portNum)
673  );
674 
675  return this->m_logTextOut_OutputPort[portNum].isConnected();
676  }
677 
678 #endif
679 
682  {
683  FW_ASSERT(
684  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
685  static_cast<FwAssertArgType>(portNum)
686  );
687 
688  return this->m_timeCaller_OutputPort[portNum].isConnected();
689  }
690 
691 #endif
692 
693 #if !FW_DIRECT_PORT_CALLS
694 
695  // ----------------------------------------------------------------------
696  // Connection status queries for typed output ports
697  // ----------------------------------------------------------------------
698 
701  {
702  FW_ASSERT(
703  (0 <= portNum) && (portNum < this->getNum_fileDispatch_OutputPorts()),
704  static_cast<FwAssertArgType>(portNum)
705  );
706 
707  return this->m_fileDispatch_OutputPort[portNum].isConnected();
708  }
709 
712  {
713  FW_ASSERT(
714  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
715  static_cast<FwAssertArgType>(portNum)
716  );
717 
718  return this->m_pingOut_OutputPort[portNum].isConnected();
719  }
720 
721 #endif
722 
723  // ----------------------------------------------------------------------
724  // Port handler base-class functions for special input ports
725  //
726  // Call these functions directly to bypass the corresponding ports
727  // ----------------------------------------------------------------------
728 
731  FwIndexType portNum,
732  FwOpcodeType opCode,
733  U32 cmdSeq,
734  Fw::CmdArgBuffer& args
735  )
736  {
737 
738  const U32 idBase = this->getIdBase();
739  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
740 
741  // Select base class function based on opcode
742  switch (opCode - idBase) {
743  case OPCODE_ENABLE_DISPATCH: {
745  opCode,
746  cmdSeq,
747  args
748  );
749  break;
750  }
751  default:
752  // Unknown opcode: ignore it
753  break;
754  }
755  }
756 
757  // ----------------------------------------------------------------------
758  // Port handler base-class functions for typed input ports
759  //
760  // Call these functions directly to bypass the corresponding ports
761  // ----------------------------------------------------------------------
762 
765  FwIndexType portNum,
766  Fw::StringBase& file_name
767  )
768  {
769  // Make sure port number is valid
770  FW_ASSERT(
771  (0 <= portNum) && (portNum < this->getNum_fileAnnounceRecv_InputPorts()),
772  static_cast<FwAssertArgType>(portNum)
773  );
774 
775  // Call pre-message hook
777  portNum,
778  file_name
779  );
780  ComponentIpcSerializableBuffer msg;
782 
783  // Serialize message ID
784  _status = msg.serializeFrom(
785  static_cast<FwEnumStoreType>(FILEANNOUNCERECV_FILEANNOUNCE)
786  );
787  FW_ASSERT(
788  _status == Fw::FW_SERIALIZE_OK,
789  static_cast<FwAssertArgType>(_status)
790  );
791 
792  // Serialize port number
793  _status = msg.serializeFrom(portNum);
794  FW_ASSERT(
795  _status == Fw::FW_SERIALIZE_OK,
796  static_cast<FwAssertArgType>(_status)
797  );
798 
799  // Serialize argument file_name
800  _status = file_name.serializeTo(msg, static_cast<FwSizeType>(FW_FIXED_LENGTH_STRING_SIZE));
801  FW_ASSERT(
802  _status == Fw::FW_SERIALIZE_OK,
803  static_cast<FwAssertArgType>(_status)
804  );
805 
806  // Send message
808  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
809 
810  FW_ASSERT(
811  qStatus == Os::Queue::OP_OK,
812  static_cast<FwAssertArgType>(qStatus)
813  );
814  }
815 
818  FwIndexType portNum,
819  U32 key
820  )
821  {
822  // Make sure port number is valid
823  FW_ASSERT(
824  (0 <= portNum) && (portNum < this->getNum_pingIn_InputPorts()),
825  static_cast<FwAssertArgType>(portNum)
826  );
827 
828  // Call pre-message hook
830  portNum,
831  key
832  );
833  ComponentIpcSerializableBuffer msg;
835 
836  // Serialize message ID
837  _status = msg.serializeFrom(
838  static_cast<FwEnumStoreType>(PINGIN_PING)
839  );
840  FW_ASSERT(
841  _status == Fw::FW_SERIALIZE_OK,
842  static_cast<FwAssertArgType>(_status)
843  );
844 
845  // Serialize port number
846  _status = msg.serializeFrom(portNum);
847  FW_ASSERT(
848  _status == Fw::FW_SERIALIZE_OK,
849  static_cast<FwAssertArgType>(_status)
850  );
851 
852  // Serialize argument key
853  _status = msg.serializeFrom(key);
854  FW_ASSERT(
855  _status == Fw::FW_SERIALIZE_OK,
856  static_cast<FwAssertArgType>(_status)
857  );
858 
859  // Send message
861  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
862 
863  FW_ASSERT(
864  qStatus == Os::Queue::OP_OK,
865  static_cast<FwAssertArgType>(qStatus)
866  );
867  }
868 
869  // ----------------------------------------------------------------------
870  // Pre-message hooks for typed async input ports
871  //
872  // Each of these functions is invoked just before processing a message
873  // on the corresponding port. By default, they do nothing. You can
874  // override them to provide specific pre-message behavior.
875  // ----------------------------------------------------------------------
876 
879  FwIndexType portNum,
880  Fw::StringBase& file_name
881  )
882  {
883  // Default: no-op
884  }
885 
888  FwIndexType portNum,
889  U32 key
890  )
891  {
892  // Default: no-op
893  }
894 
895 #if !FW_DIRECT_PORT_CALLS
896 
897  // ----------------------------------------------------------------------
898  // Invocation functions for typed output ports
899  // ----------------------------------------------------------------------
900 
903  FwIndexType portNum,
904  Fw::StringBase& file_name
905  ) const
906  {
907  FW_ASSERT(
908  (0 <= portNum) && (portNum < this->getNum_fileDispatch_OutputPorts()),
909  static_cast<FwAssertArgType>(portNum)
910  );
911 
912  FW_ASSERT(
913  this->m_fileDispatch_OutputPort[portNum].isConnected(),
914  static_cast<FwAssertArgType>(portNum)
915  );
916  this->m_fileDispatch_OutputPort[portNum].invoke(
917  file_name
918  );
919  }
920 
923  FwIndexType portNum,
924  U32 key
925  ) const
926  {
927  FW_ASSERT(
928  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
929  static_cast<FwAssertArgType>(portNum)
930  );
931 
932  FW_ASSERT(
933  this->m_pingOut_OutputPort[portNum].isConnected(),
934  static_cast<FwAssertArgType>(portNum)
935  );
936  this->m_pingOut_OutputPort[portNum].invoke(
937  key
938  );
939  }
940 
941 #endif
942 
943  // ----------------------------------------------------------------------
944  // Command response
945  // ----------------------------------------------------------------------
946 
949  FwOpcodeType opCode,
950  U32 cmdSeq,
951  Fw::CmdResponse response
952  )
953  {
955  this->cmdResponseOut_out(0, opCode, cmdSeq, response);
956  }
957 
958  // ----------------------------------------------------------------------
959  // Command handler base-class functions
960  //
961  // Call these functions directly to bypass the command input port
962  // ----------------------------------------------------------------------
963 
966  FwOpcodeType opCode,
967  U32 cmdSeq,
968  Fw::CmdArgBuffer& args
969  )
970  {
971  // Call pre-message hook
972  this->ENABLE_DISPATCH_preMsgHook(opCode,cmdSeq);
973 
974  // Defer deserializing arguments to the message dispatcher
975  // to avoid deserializing and reserializing just for IPC
976  ComponentIpcSerializableBuffer msg;
978 
979  // Serialize for IPC
980  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_ENABLE_DISPATCH));
981  FW_ASSERT (
982  _status == Fw::FW_SERIALIZE_OK,
983  static_cast<FwAssertArgType>(_status)
984  );
985 
986  // Fake port number to make message dequeue work
987  FwIndexType port = 0;
988 
989  _status = msg.serializeFrom(port);
990  FW_ASSERT (
991  _status == Fw::FW_SERIALIZE_OK,
992  static_cast<FwAssertArgType>(_status)
993  );
994 
995  _status = msg.serializeFrom(opCode);
996  FW_ASSERT (
997  _status == Fw::FW_SERIALIZE_OK,
998  static_cast<FwAssertArgType>(_status)
999  );
1000 
1001  _status = msg.serializeFrom(cmdSeq);
1002  FW_ASSERT (
1003  _status == Fw::FW_SERIALIZE_OK,
1004  static_cast<FwAssertArgType>(_status)
1005  );
1006 
1007  _status = msg.serializeFrom(args);
1008  FW_ASSERT (
1009  _status == Fw::FW_SERIALIZE_OK,
1010  static_cast<FwAssertArgType>(_status)
1011  );
1012 
1013  // Send message
1015  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1016 
1017  FW_ASSERT(
1018  qStatus == Os::Queue::OP_OK,
1019  static_cast<FwAssertArgType>(qStatus)
1020  );
1021  }
1022 
1023  // ----------------------------------------------------------------------
1024  // Pre-message hooks for async commands
1025  //
1026  // Each of these functions is invoked just before processing the
1027  // corresponding command. By default they do nothing. You can
1028  // override them to provide specific pre-command behavior.
1029  // ----------------------------------------------------------------------
1030 
1033  FwOpcodeType opCode,
1034  U32 cmdSeq
1035  )
1036  {
1037  // Defaults to no-op; can be overridden
1038  (void) opCode;
1039  (void) cmdSeq;
1040  }
1041 
1042  // ----------------------------------------------------------------------
1043  // Event logging functions
1044  // ----------------------------------------------------------------------
1045 
1049  const Fw::Enabled& enabled
1050  ) const
1051  {
1052  // Get the time
1053  Fw::Time _logTime;
1054  if (this->isConnected_timeCaller_OutputPort(0)) {
1055  this->timeCaller_out(0, _logTime);
1056  }
1057 
1058  const FwEventIdType _id = this->getIdBase() + EVENTID_FILEDISPATCHSTATE;
1059 
1060  // Emit the event on the log port
1061  if (this->isConnected_logOut_OutputPort(0)) {
1062  Fw::LogBuffer _logBuff;
1064 
1065 #if FW_AMPCS_COMPATIBLE
1066  // Serialize the number of arguments
1067  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1068  FW_ASSERT(
1069  _status == Fw::FW_SERIALIZE_OK,
1070  static_cast<FwAssertArgType>(_status)
1071  );
1072 #endif
1073 
1074 #if FW_AMPCS_COMPATIBLE
1075  // Serialize the argument size
1076  _status = _logBuff.serializeFrom(
1078  );
1079  FW_ASSERT(
1080  _status == Fw::FW_SERIALIZE_OK,
1081  static_cast<FwAssertArgType>(_status)
1082  );
1083 #endif
1084  _status = _logBuff.serializeFrom(file_type);
1085  FW_ASSERT(
1086  _status == Fw::FW_SERIALIZE_OK,
1087  static_cast<FwAssertArgType>(_status)
1088  );
1089 
1090 #if FW_AMPCS_COMPATIBLE
1091  // Serialize the argument size
1092  _status = _logBuff.serializeFrom(
1093  static_cast<U8>(Fw::Enabled::SERIALIZED_SIZE)
1094  );
1095  FW_ASSERT(
1096  _status == Fw::FW_SERIALIZE_OK,
1097  static_cast<FwAssertArgType>(_status)
1098  );
1099 #endif
1100  _status = _logBuff.serializeFrom(enabled);
1101  FW_ASSERT(
1102  _status == Fw::FW_SERIALIZE_OK,
1103  static_cast<FwAssertArgType>(_status)
1104  );
1105 
1106  this->logOut_out(
1107  0,
1108  _id,
1109  _logTime,
1111  _logBuff
1112  );
1113  }
1114 
1115  // Emit the event on the text log port
1116 #if FW_ENABLE_TEXT_LOGGING
1117  if (this->isConnected_logTextOut_OutputPort(0)) {
1118 #if FW_OBJECT_NAMES == 1
1119  const char* _formatString =
1120  "(%s) %s: File dispatch %s state changed: to %s";
1121 #else
1122  const char* _formatString =
1123  "%s: File dispatch %s state changed: to %s";
1124 #endif
1125 
1126  Fw::String file_typeStr;
1127  file_type.toString(file_typeStr);
1128  Fw::String enabledStr;
1129  enabled.toString(enabledStr);
1130 
1131  Fw::TextLogString _logString;
1132  (void) _logString.format(
1133  _formatString,
1134 #if FW_OBJECT_NAMES == 1
1135  this->m_objName.toChar(),
1136 #endif
1137  "FileDispatchState ",
1138  file_typeStr.toChar(),
1139  enabledStr.toChar()
1140  );
1141 
1142  this->logTextOut_out(
1143  0,
1144  _id,
1145  _logTime,
1147  _logString
1148  );
1149  }
1150 #endif
1151  }
1152 
1155  const Fw::StringBase& file_name,
1157  ) const
1158  {
1159  // Get the time
1160  Fw::Time _logTime;
1161  if (this->isConnected_timeCaller_OutputPort(0)) {
1162  this->timeCaller_out(0, _logTime);
1163  }
1164 
1165  const FwEventIdType _id = this->getIdBase() + EVENTID_FILEDISPATCHED;
1166 
1167  // Emit the event on the log port
1168  if (this->isConnected_logOut_OutputPort(0)) {
1169  Fw::LogBuffer _logBuff;
1171 
1172 #if FW_AMPCS_COMPATIBLE
1173  // Serialize the number of arguments
1174  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1175  FW_ASSERT(
1176  _status == Fw::FW_SERIALIZE_OK,
1177  static_cast<FwAssertArgType>(_status)
1178  );
1179 #endif
1180 
1181  _status = file_name.serializeTo(
1182  _logBuff,
1183  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 240)
1184  );
1185  FW_ASSERT(
1186  _status == Fw::FW_SERIALIZE_OK,
1187  static_cast<FwAssertArgType>(_status)
1188  );
1189 
1190 #if FW_AMPCS_COMPATIBLE
1191  // Serialize the argument size
1192  _status = _logBuff.serializeFrom(
1194  );
1195  FW_ASSERT(
1196  _status == Fw::FW_SERIALIZE_OK,
1197  static_cast<FwAssertArgType>(_status)
1198  );
1199 #endif
1200  _status = _logBuff.serializeFrom(file_type);
1201  FW_ASSERT(
1202  _status == Fw::FW_SERIALIZE_OK,
1203  static_cast<FwAssertArgType>(_status)
1204  );
1205 
1206  this->logOut_out(
1207  0,
1208  _id,
1209  _logTime,
1211  _logBuff
1212  );
1213  }
1214 
1215  // Emit the event on the text log port
1216 #if FW_ENABLE_TEXT_LOGGING
1217  if (this->isConnected_logTextOut_OutputPort(0)) {
1218 #if FW_OBJECT_NAMES == 1
1219  const char* _formatString =
1220  "(%s) %s: File %s dispatched to %s";
1221 #else
1222  const char* _formatString =
1223  "%s: File %s dispatched to %s";
1224 #endif
1225 
1226  Fw::String file_typeStr;
1227  file_type.toString(file_typeStr);
1228 
1229  Fw::TextLogString _logString;
1230  (void) _logString.format(
1231  _formatString,
1232 #if FW_OBJECT_NAMES == 1
1233  this->m_objName.toChar(),
1234 #endif
1235  "FileDispatched ",
1236  file_name.toChar(),
1237  file_typeStr.toChar()
1238  );
1239 
1240  this->logTextOut_out(
1241  0,
1242  _id,
1243  _logTime,
1245  _logString
1246  );
1247  }
1248 #endif
1249  }
1250 
1253  const Fw::StringBase& file_name,
1255  )
1256  {
1257  // Check throttle value
1258  if (this->m_FileDispatchPortNotConnectedThrottle >= EVENTID_FILEDISPATCHPORTNOTCONNECTED_THROTTLE) {
1259  return;
1260  }
1261  else {
1262  this->m_FileDispatchPortNotConnectedThrottle++;
1263  }
1264 
1265  // Get the time
1266  Fw::Time _logTime;
1267  if (this->isConnected_timeCaller_OutputPort(0)) {
1268  this->timeCaller_out(0, _logTime);
1269  }
1270 
1272 
1273  // Emit the event on the log port
1274  if (this->isConnected_logOut_OutputPort(0)) {
1275  Fw::LogBuffer _logBuff;
1277 
1278 #if FW_AMPCS_COMPATIBLE
1279  // Serialize the number of arguments
1280  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1281  FW_ASSERT(
1282  _status == Fw::FW_SERIALIZE_OK,
1283  static_cast<FwAssertArgType>(_status)
1284  );
1285 #endif
1286 
1287  _status = file_name.serializeTo(
1288  _logBuff,
1289  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 240)
1290  );
1291  FW_ASSERT(
1292  _status == Fw::FW_SERIALIZE_OK,
1293  static_cast<FwAssertArgType>(_status)
1294  );
1295 
1296 #if FW_AMPCS_COMPATIBLE
1297  // Serialize the argument size
1298  _status = _logBuff.serializeFrom(
1300  );
1301  FW_ASSERT(
1302  _status == Fw::FW_SERIALIZE_OK,
1303  static_cast<FwAssertArgType>(_status)
1304  );
1305 #endif
1306  _status = _logBuff.serializeFrom(file_type);
1307  FW_ASSERT(
1308  _status == Fw::FW_SERIALIZE_OK,
1309  static_cast<FwAssertArgType>(_status)
1310  );
1311 
1312  this->logOut_out(
1313  0,
1314  _id,
1315  _logTime,
1317  _logBuff
1318  );
1319  }
1320 
1321  // Emit the event on the text log port
1322 #if FW_ENABLE_TEXT_LOGGING
1323  if (this->isConnected_logTextOut_OutputPort(0)) {
1324 #if FW_OBJECT_NAMES == 1
1325  const char* _formatString =
1326  "(%s) %s: File %s matched %s but the dispatch port is not connected";
1327 #else
1328  const char* _formatString =
1329  "%s: File %s matched %s but the dispatch port is not connected";
1330 #endif
1331 
1332  Fw::String file_typeStr;
1333  file_type.toString(file_typeStr);
1334 
1335  Fw::TextLogString _logString;
1336  (void) _logString.format(
1337  _formatString,
1338 #if FW_OBJECT_NAMES == 1
1339  this->m_objName.toChar(),
1340 #endif
1341  "FileDispatchPortNotConnected ",
1342  file_name.toChar(),
1343  file_typeStr.toChar()
1344  );
1345 
1346  this->logTextOut_out(
1347  0,
1348  _id,
1349  _logTime,
1351  _logString
1352  );
1353  }
1354 #endif
1355  }
1356 
1357  // ----------------------------------------------------------------------
1358  // Event throttle reset functions
1359  // ----------------------------------------------------------------------
1360 
1363  {
1364  // Reset throttle counter
1365  this->m_FileDispatchPortNotConnectedThrottle = 0;
1366  }
1367 
1368  // ----------------------------------------------------------------------
1369  // Time
1370  // ----------------------------------------------------------------------
1371 
1373  getTime() const
1374  {
1375  if (this->isConnected_timeCaller_OutputPort(0)) {
1376  Fw::Time _time;
1377  this->timeCaller_out(0, _time);
1378  return _time;
1379  }
1380  else {
1381  return Fw::Time(TimeBase::TB_NONE, 0, 0);
1382  }
1383  }
1384 
1385  // ----------------------------------------------------------------------
1386  // Message dispatch functions
1387  // ----------------------------------------------------------------------
1388 
1389  Fw::QueuedComponentBase::MsgDispatchStatus FileDispatcherComponentBase ::
1390  doDispatch()
1391  {
1392  ComponentIpcSerializableBuffer _msg;
1393  FwQueuePriorityType _priority = 0;
1394 
1395  Os::Queue::Status _msgStatus = this->m_queue.receive(
1396  _msg,
1398  _priority
1399  );
1400  FW_ASSERT(
1401  _msgStatus == Os::Queue::OP_OK,
1402  static_cast<FwAssertArgType>(_msgStatus)
1403  );
1404 
1405  // Reset to beginning of buffer
1406  _msg.resetDeser();
1407 
1408  FwEnumStoreType _desMsg = 0;
1409  Fw::SerializeStatus _deserStatus = _msg.deserializeTo(_desMsg);
1410  FW_ASSERT(
1411  _deserStatus == Fw::FW_SERIALIZE_OK,
1412  static_cast<FwAssertArgType>(_deserStatus)
1413  );
1414 
1415  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
1416 
1417  if (_msgType == FILEDISPATCHER_COMPONENT_EXIT) {
1418  return MSG_DISPATCH_EXIT;
1419  }
1420 
1421  FwIndexType portNum = 0;
1422  _deserStatus = _msg.deserializeTo(portNum);
1423  FW_ASSERT(
1424  _deserStatus == Fw::FW_SERIALIZE_OK,
1425  static_cast<FwAssertArgType>(_deserStatus)
1426  );
1427 
1428  switch (_msgType) {
1429  // Handle async input port fileAnnounceRecv
1430  case FILEANNOUNCERECV_FILEANNOUNCE: {
1431  // Deserialize argument file_name
1432  char __fprime_ac_file_name_buffer[Fw::StringBase::BUFFER_SIZE(static_cast<FwSizeType>(FW_FIXED_LENGTH_STRING_SIZE))];
1433  Fw::ExternalString file_name(__fprime_ac_file_name_buffer, sizeof __fprime_ac_file_name_buffer);
1434  _deserStatus = _msg.deserializeTo(file_name);
1435  FW_ASSERT(
1436  _deserStatus == Fw::FW_SERIALIZE_OK,
1437  static_cast<FwAssertArgType>(_deserStatus)
1438  );
1439  // Call handler function
1441  portNum,
1442  file_name
1443  );
1444 
1445  break;
1446  }
1447 
1448  // Handle async input port pingIn
1449  case PINGIN_PING: {
1450  // Deserialize argument key
1451  U32 key;
1452  _deserStatus = _msg.deserializeTo(key);
1453  FW_ASSERT(
1454  _deserStatus == Fw::FW_SERIALIZE_OK,
1455  static_cast<FwAssertArgType>(_deserStatus)
1456  );
1457  // Call handler function
1458  this->pingIn_handler(
1459  portNum,
1460  key
1461  );
1462 
1463  break;
1464  }
1465 
1466  // Handle command ENABLE_DISPATCH
1467  case CMD_ENABLE_DISPATCH: {
1468  // Deserialize opcode
1469  FwOpcodeType _opCode = 0;
1470  _deserStatus = _msg.deserializeTo(_opCode);
1471  FW_ASSERT (
1472  _deserStatus == Fw::FW_SERIALIZE_OK,
1473  static_cast<FwAssertArgType>(_deserStatus)
1474  );
1475 
1476  // Deserialize command sequence
1477  U32 _cmdSeq = 0;
1478  _deserStatus = _msg.deserializeTo(_cmdSeq);
1479  FW_ASSERT (
1480  _deserStatus == Fw::FW_SERIALIZE_OK,
1481  static_cast<FwAssertArgType>(_deserStatus)
1482  );
1483 
1484  // Deserialize command argument buffer
1485  Fw::CmdArgBuffer args;
1486  _deserStatus = _msg.deserializeTo(args);
1487  FW_ASSERT (
1488  _deserStatus == Fw::FW_SERIALIZE_OK,
1489  static_cast<FwAssertArgType>(_deserStatus)
1490  );
1491 
1492  // Reset buffer
1493  args.resetDeser();
1494 
1495  // Deserialize argument file_type
1497  _deserStatus = args.deserializeTo(file_type);
1498  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
1500  this->cmdResponse_out(
1501  _opCode,
1502  _cmdSeq,
1504  );
1505  }
1506  // Don't crash the task if bad arguments were passed from the ground
1507  break;
1508  }
1509 
1510  // Deserialize argument enable
1511  Fw::Enabled enable;
1512  _deserStatus = args.deserializeTo(enable);
1513  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
1515  this->cmdResponse_out(
1516  _opCode,
1517  _cmdSeq,
1519  );
1520  }
1521  // Don't crash the task if bad arguments were passed from the ground
1522  break;
1523  }
1524 
1525  // Make sure there was no data left over.
1526  // That means the argument buffer size was incorrect.
1527 #if FW_CMD_CHECK_RESIDUAL
1528  if (args.getDeserializeSizeLeft() != 0) {
1530  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
1531  }
1532  // Don't crash the task if bad arguments were passed from the ground
1533  break;
1534  }
1535 #endif
1536 
1537  // Call handler function
1539  _opCode, _cmdSeq,
1540  file_type,
1541  enable
1542  );
1543 
1544  break;
1545  }
1546 
1547  default:
1548  return MSG_DISPATCH_ERROR;
1549  }
1550 
1551  return MSG_DISPATCH_OK;
1552  }
1553 
1554  // ----------------------------------------------------------------------
1555  // Calls for messages received on special input ports
1556  // ----------------------------------------------------------------------
1557 
1558  void FileDispatcherComponentBase ::
1559  m_p_cmdIn_in(
1560  Fw::PassiveComponentBase* callComp,
1561  FwIndexType portNum,
1562  FwOpcodeType opCode,
1563  U32 cmdSeq,
1564  Fw::CmdArgBuffer& args
1565  )
1566  {
1567  FW_ASSERT(callComp != nullptr);
1568  FileDispatcherComponentBase* compPtr = static_cast<FileDispatcherComponentBase*>(callComp);
1569  compPtr->cmdIn_handlerBase(
1570  portNum,
1571  opCode,
1572  cmdSeq,
1573  args
1574  );
1575  }
1576 
1577  // ----------------------------------------------------------------------
1578  // Calls for messages received on typed input ports
1579  // ----------------------------------------------------------------------
1580 
1581  void FileDispatcherComponentBase ::
1582  m_p_fileAnnounceRecv_in(
1583  Fw::PassiveComponentBase* callComp,
1584  FwIndexType portNum,
1585  Fw::StringBase& file_name
1586  )
1587  {
1588  FW_ASSERT(callComp != nullptr);
1589  FileDispatcherComponentBase* compPtr = static_cast<FileDispatcherComponentBase*>(callComp);
1590  compPtr->fileAnnounceRecv_handlerBase(
1591  portNum,
1592  file_name
1593  );
1594  }
1595 
1596  void FileDispatcherComponentBase ::
1597  m_p_pingIn_in(
1598  Fw::PassiveComponentBase* callComp,
1599  FwIndexType portNum,
1600  U32 key
1601  )
1602  {
1603  FW_ASSERT(callComp != nullptr);
1604  FileDispatcherComponentBase* compPtr = static_cast<FileDispatcherComponentBase*>(callComp);
1605  compPtr->pingIn_handlerBase(
1606  portNum,
1607  key
1608  );
1609  }
1610 
1611 #if !FW_DIRECT_PORT_CALLS
1612 
1613  // ----------------------------------------------------------------------
1614  // Invocation functions for special output ports
1615  // ----------------------------------------------------------------------
1616 
1617  void FileDispatcherComponentBase ::
1618  cmdRegOut_out(
1619  FwIndexType portNum,
1620  FwOpcodeType opCode
1621  ) const
1622  {
1623  FW_ASSERT(
1624  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
1625  static_cast<FwAssertArgType>(portNum)
1626  );
1627 
1628  FW_ASSERT(
1629  this->m_cmdRegOut_OutputPort[portNum].isConnected(),
1630  static_cast<FwAssertArgType>(portNum)
1631  );
1632  this->m_cmdRegOut_OutputPort[portNum].invoke(
1633  opCode
1634  );
1635  }
1636 
1637  void FileDispatcherComponentBase ::
1638  cmdResponseOut_out(
1639  FwIndexType portNum,
1640  FwOpcodeType opCode,
1641  U32 cmdSeq,
1642  const Fw::CmdResponse& response
1643  ) const
1644  {
1645  FW_ASSERT(
1646  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
1647  static_cast<FwAssertArgType>(portNum)
1648  );
1649 
1650  FW_ASSERT(
1651  this->m_cmdResponseOut_OutputPort[portNum].isConnected(),
1652  static_cast<FwAssertArgType>(portNum)
1653  );
1654  this->m_cmdResponseOut_OutputPort[portNum].invoke(
1655  opCode,
1656  cmdSeq,
1657  response
1658  );
1659  }
1660 
1661  void FileDispatcherComponentBase ::
1662  logOut_out(
1663  FwIndexType portNum,
1664  FwEventIdType id,
1665  Fw::Time& timeTag,
1666  const Fw::LogSeverity& severity,
1667  Fw::LogBuffer& args
1668  ) const
1669  {
1670  FW_ASSERT(
1671  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
1672  static_cast<FwAssertArgType>(portNum)
1673  );
1674 
1675  FW_ASSERT(
1676  this->m_logOut_OutputPort[portNum].isConnected(),
1677  static_cast<FwAssertArgType>(portNum)
1678  );
1679  this->m_logOut_OutputPort[portNum].invoke(
1680  id,
1681  timeTag,
1682  severity,
1683  args
1684  );
1685  }
1686 
1687 #if FW_ENABLE_TEXT_LOGGING
1688 
1689  void FileDispatcherComponentBase ::
1690  logTextOut_out(
1691  FwIndexType portNum,
1692  FwEventIdType id,
1693  Fw::Time& timeTag,
1694  const Fw::LogSeverity& severity,
1695  Fw::TextLogString& text
1696  ) const
1697  {
1698  FW_ASSERT(
1699  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
1700  static_cast<FwAssertArgType>(portNum)
1701  );
1702 
1703  FW_ASSERT(
1704  this->m_logTextOut_OutputPort[portNum].isConnected(),
1705  static_cast<FwAssertArgType>(portNum)
1706  );
1707  this->m_logTextOut_OutputPort[portNum].invoke(
1708  id,
1709  timeTag,
1710  severity,
1711  text
1712  );
1713  }
1714 
1715 #endif
1716 
1717  void FileDispatcherComponentBase ::
1718  timeCaller_out(
1719  FwIndexType portNum,
1720  Fw::Time& time
1721  ) const
1722  {
1723  FW_ASSERT(
1724  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
1725  static_cast<FwAssertArgType>(portNum)
1726  );
1727 
1728  FW_ASSERT(
1729  this->m_timeCaller_OutputPort[portNum].isConnected(),
1730  static_cast<FwAssertArgType>(portNum)
1731  );
1732  this->m_timeCaller_OutputPort[portNum].invoke(
1733  time
1734  );
1735  }
1736 
1737 #endif
1738 
1739 }
Serialization/Deserialization operation was successful.
void set_pingOut_OutputPort(FwIndexType portNum, Svc::InputPingPort *port)
Connect port to pingOut[portNum].
bool isConnected_pingOut_OutputPort(FwIndexType portNum) const
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:157
static constexpr FwSizeType CAPACITY
Definition: CmdPortAc.hpp:36
static constexpr FwIndexType getNum_cmdResponseOut_OutputPorts()
virtual void pingIn_handler(FwIndexType portNum, U32 key)=0
Handler for input port pingIn.
FwIdType FwOpcodeType
The type of a command opcode.
Operation succeeded.
Definition: Os.hpp:27
static constexpr FwIndexType getNum_cmdRegOut_OutputPorts()
bool isConnected_fileDispatch_OutputPort(FwIndexType portNum) const
PlatformSizeType FwSizeType
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
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
static constexpr FwIndexType getNum_timeCaller_OutputPorts()
Status
status returned from the queue send function
Definition: Queue.hpp:30
message to exit active component task
BYTE pingInPortSize[Svc::PingPortBuffer::CAPACITY]
void fileAnnounceRecv_handlerBase(FwIndexType portNum, Fw::StringBase &file_name)
Handler base-class function for input port fileAnnounceRecv.
void init()
Initialization function.
Definition: CmdPortAc.cpp:89
SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG) override
Deserialize an 8-bit unsigned integer value.
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*.
FileDispatcherComponentBase(const char *compName="")
Construct FileDispatcherComponentBase object.
Enum representing a command response.
void pingIn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port pingIn.
No time base has been established (Required)
void init()
Initialization function.
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
void addCallPort(InputCmdRegPort *callPort)
Register an input port.
Fw::InputCmdPort * get_cmdIn_InputPort(FwIndexType portNum)
void cmdIn_handlerBase(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Handler base-class function for input port cmdIn.
virtual void fileAnnounceRecv_handler(FwIndexType portNum, Fw::StringBase &file_name)=0
Handler for input port fileAnnounceRecv.
void init()
Initialization function.
Os::Queue m_queue
queue object for active component
void set_cmdResponseOut_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to cmdResponseOut[portNum].
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
virtual void ENABLE_DISPATCH_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command ENABLE_DISPATCH.
void init()
Object initializer.
Definition: ObjBase.cpp:24
void regCommands()
Register commands with the Command Dispatcher.
SerializeStatus
forward declaration for string
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: CmdPortAc.cpp:95
static constexpr FwSizeType CAPACITY
Message will block until space is available.
Definition: Queue.hpp:47
bool isConnected_cmdRegOut_OutputPort(FwIndexType portNum) const
static constexpr FwIndexType getNum_fileDispatch_OutputPorts()
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
virtual void pingIn_preMsgHook(FwIndexType portNum, U32 key)
Pre-message hook for async input port pingIn.
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.
static constexpr FwIndexType getNum_logOut_OutputPorts()
void init()
Initialization function.
Definition: PingPortAc.cpp:151
void log_WARNING_LO_FileDispatchPortNotConnected(const Fw::StringBase &file_name, const Svc::FileDispatcherCfg::FileDispatchPort &file_type)
Log event FileDispatchPortNotConnected.
void invoke(Fw::Time &time) const
Invoke a port connection.
Definition: TimePortAc.cpp:170
void log_ACTIVITY_HI_FileDispatchState(const Svc::FileDispatcherCfg::FileDispatchPort &file_type, const Fw::Enabled &enabled) const
Log event FileDispatchState.
Serializable::SizeType getDeserializeSizeLeft() const override
Get remaining deserialization buffer size.
static constexpr FwIndexType getNum_pingIn_InputPorts()
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke a port connection.
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
bool isConnected_timeCaller_OutputPort(FwIndexType portNum) const
static constexpr FwIndexType getNum_cmdIn_InputPorts()
void resetDeser() override
Reset deserialization pointer to beginning of buffer.
A string backed by an external buffer.
void ENABLE_DISPATCH_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Base-class handler function for command ENABLE_DISPATCH.
const char * toChar() const
Convert to a C-style char*.
bool isConnected() const
Definition: PortBase.cpp:38
void pingOut_out(FwIndexType portNum, U32 key) const
Invoke output port pingOut.
Enum representing event severity.
virtual void fileAnnounceRecv_preMsgHook(FwIndexType portNum, Fw::StringBase &file_name)
Pre-message hook for async input port fileAnnounceRecv.
bool isConnected_logOut_OutputPort(FwIndexType portNum) const
#define PRI_FwIndexType
Enabled and disabled states.
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:58
void init()
Initialization function.
Definition: LogPortAc.cpp:180
bool isConnected_cmdResponseOut_OutputPort(FwIndexType portNum) const
void setPortNum(FwIndexType portNum)
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:54
BlockingType
message type
Definition: Queue.hpp:46
Command failed to deserialize.
PlatformQueuePriorityType FwQueuePriorityType
The type of queue priorities used.
void log_ACTIVITY_HI_FileDispatched(const Fw::StringBase &file_name, const Svc::FileDispatcherCfg::FileDispatchPort &file_type) const
Log event FileDispatched.
Important informational events.
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args) const
Invoke a port connection.
Definition: LogPortAc.cpp:199
void set_fileDispatch_OutputPort(FwIndexType portNum, Svc::InputFileDispatchPort *port)
Connect port to fileDispatch[portNum].
A message was sent requesting an exit of the loop.
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
Svc::InputFileAnnouncePort * get_fileAnnounceRecv_InputPort(FwIndexType portNum)
void log_WARNING_LO_FileDispatchPortNotConnected_ThrottleClear()
Reset throttle value for FileDispatchPortNotConnected.
virtual ~FileDispatcherComponentBase()
Destroy FileDispatcherComponentBase object.
PlatformIndexType FwIndexType
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:186
The size of the serial representation.
void init()
Initialization function.
void init()
Initialization function.
Definition: PingPortAc.cpp:73
void addCallPort(InputFileDispatchPort *callPort)
Register an input port.
RateGroupDivider component implementation.
message sent/received okay
Definition: Queue.hpp:31
U8 BYTE
byte type
Definition: BasicTypes.h:57
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
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 set_cmdRegOut_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to cmdRegOut[portNum].
virtual void ENABLE_DISPATCH_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Svc::FileDispatcherCfg::FileDispatchPort &file_type, const Fw::Enabled &enable)=0
Handler for command ENABLE_DISPATCH.
static constexpr SizeType BUFFER_SIZE(SizeType maxLength)
Get the size of a null-terminated string buffer.
static constexpr FwIndexType getNum_pingOut_OutputPorts()
void init()
Initialization function.
void fileDispatch_out(FwIndexType portNum, Fw::StringBase &file_name) const
Invoke output port fileDispatch.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
void invoke(Fw::StringBase &file_name) const
Invoke a port connection.
static constexpr FwIndexType getNum_fileAnnounceRecv_InputPorts()
Svc::InputPingPort * get_pingIn_InputPort(FwIndexType portNum)
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.
SerializeStatus serializeTo(SerialBufferBase &buffer, Endianness mode=Endianness::BIG) const override
Serialize the contents of this object to a buffer.
BYTE cmdPortSize[Fw::CmdPortBuffer::CAPACITY]