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, 240);
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  if (qStatus == Os::Queue::Status::FULL) {
864  this->incNumMsgDropped();
865  return;
866  }
867 
868  FW_ASSERT(
869  qStatus == Os::Queue::OP_OK,
870  static_cast<FwAssertArgType>(qStatus)
871  );
872  }
873 
874  // ----------------------------------------------------------------------
875  // Pre-message hooks for typed async input ports
876  //
877  // Each of these functions is invoked just before processing a message
878  // on the corresponding port. By default, they do nothing. You can
879  // override them to provide specific pre-message behavior.
880  // ----------------------------------------------------------------------
881 
884  FwIndexType portNum,
885  Fw::StringBase& file_name
886  )
887  {
888  // Default: no-op
889  }
890 
893  FwIndexType portNum,
894  U32 key
895  )
896  {
897  // Default: no-op
898  }
899 
900 #if !FW_DIRECT_PORT_CALLS
901 
902  // ----------------------------------------------------------------------
903  // Invocation functions for typed output ports
904  // ----------------------------------------------------------------------
905 
908  FwIndexType portNum,
909  Fw::StringBase& file_name
910  ) const
911  {
912  FW_ASSERT(
913  (0 <= portNum) && (portNum < this->getNum_fileDispatch_OutputPorts()),
914  static_cast<FwAssertArgType>(portNum)
915  );
916 
917  FW_ASSERT(
918  this->m_fileDispatch_OutputPort[portNum].isConnected(),
919  static_cast<FwAssertArgType>(portNum)
920  );
921  this->m_fileDispatch_OutputPort[portNum].invoke(
922  file_name
923  );
924  }
925 
928  FwIndexType portNum,
929  U32 key
930  ) const
931  {
932  FW_ASSERT(
933  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
934  static_cast<FwAssertArgType>(portNum)
935  );
936 
937  FW_ASSERT(
938  this->m_pingOut_OutputPort[portNum].isConnected(),
939  static_cast<FwAssertArgType>(portNum)
940  );
941  this->m_pingOut_OutputPort[portNum].invoke(
942  key
943  );
944  }
945 
946 #endif
947 
948  // ----------------------------------------------------------------------
949  // Command response
950  // ----------------------------------------------------------------------
951 
954  FwOpcodeType opCode,
955  U32 cmdSeq,
956  Fw::CmdResponse response
957  )
958  {
960  this->cmdResponseOut_out(0, opCode, cmdSeq, response);
961  }
962 
963  // ----------------------------------------------------------------------
964  // Command handler base-class functions
965  //
966  // Call these functions directly to bypass the command input port
967  // ----------------------------------------------------------------------
968 
971  FwOpcodeType opCode,
972  U32 cmdSeq,
973  Fw::CmdArgBuffer& args
974  )
975  {
976  // Call pre-message hook
977  this->ENABLE_DISPATCH_preMsgHook(opCode,cmdSeq);
978 
979  // Defer deserializing arguments to the message dispatcher
980  // to avoid deserializing and reserializing just for IPC
981  ComponentIpcSerializableBuffer msg;
983 
984  // Serialize for IPC
985  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_ENABLE_DISPATCH));
986  FW_ASSERT (
987  _status == Fw::FW_SERIALIZE_OK,
988  static_cast<FwAssertArgType>(_status)
989  );
990 
991  // Fake port number to make message dequeue work
992  FwIndexType port = 0;
993 
994  _status = msg.serializeFrom(port);
995  FW_ASSERT (
996  _status == Fw::FW_SERIALIZE_OK,
997  static_cast<FwAssertArgType>(_status)
998  );
999 
1000  _status = msg.serializeFrom(opCode);
1001  FW_ASSERT (
1002  _status == Fw::FW_SERIALIZE_OK,
1003  static_cast<FwAssertArgType>(_status)
1004  );
1005 
1006  _status = msg.serializeFrom(cmdSeq);
1007  FW_ASSERT (
1008  _status == Fw::FW_SERIALIZE_OK,
1009  static_cast<FwAssertArgType>(_status)
1010  );
1011 
1012  _status = msg.serializeFrom(args);
1013  FW_ASSERT (
1014  _status == Fw::FW_SERIALIZE_OK,
1015  static_cast<FwAssertArgType>(_status)
1016  );
1017 
1018  // Send message
1020  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1021 
1022  FW_ASSERT(
1023  qStatus == Os::Queue::OP_OK,
1024  static_cast<FwAssertArgType>(qStatus)
1025  );
1026  }
1027 
1028  // ----------------------------------------------------------------------
1029  // Pre-message hooks for async commands
1030  //
1031  // Each of these functions is invoked just before processing the
1032  // corresponding command. By default they do nothing. You can
1033  // override them to provide specific pre-command behavior.
1034  // ----------------------------------------------------------------------
1035 
1038  FwOpcodeType opCode,
1039  U32 cmdSeq
1040  )
1041  {
1042  // Defaults to no-op; can be overridden
1043  (void) opCode;
1044  (void) cmdSeq;
1045  }
1046 
1047  // ----------------------------------------------------------------------
1048  // Event logging functions
1049  // ----------------------------------------------------------------------
1050 
1054  const Fw::Enabled& enabled
1055  ) const
1056  {
1057  // Get the time
1058  Fw::Time _logTime;
1059  if (this->isConnected_timeCaller_OutputPort(0)) {
1060  this->timeCaller_out(0, _logTime);
1061  }
1062 
1063  const FwEventIdType _id = this->getIdBase() + EVENTID_FILEDISPATCHSTATE;
1064 
1065  // Emit the event on the log port
1066  if (this->isConnected_logOut_OutputPort(0)) {
1067  Fw::LogBuffer _logBuff;
1069 
1070 #if FW_AMPCS_COMPATIBLE
1071  // Serialize the number of arguments
1072  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1073  FW_ASSERT(
1074  _status == Fw::FW_SERIALIZE_OK,
1075  static_cast<FwAssertArgType>(_status)
1076  );
1077 #endif
1078 
1079 #if FW_AMPCS_COMPATIBLE
1080  // Serialize the argument size
1081  _status = _logBuff.serializeFrom(
1083  );
1084  FW_ASSERT(
1085  _status == Fw::FW_SERIALIZE_OK,
1086  static_cast<FwAssertArgType>(_status)
1087  );
1088 #endif
1089  _status = _logBuff.serializeFrom(file_type);
1090  FW_ASSERT(
1091  _status == Fw::FW_SERIALIZE_OK,
1092  static_cast<FwAssertArgType>(_status)
1093  );
1094 
1095 #if FW_AMPCS_COMPATIBLE
1096  // Serialize the argument size
1097  _status = _logBuff.serializeFrom(
1098  static_cast<U8>(Fw::Enabled::SERIALIZED_SIZE)
1099  );
1100  FW_ASSERT(
1101  _status == Fw::FW_SERIALIZE_OK,
1102  static_cast<FwAssertArgType>(_status)
1103  );
1104 #endif
1105  _status = _logBuff.serializeFrom(enabled);
1106  FW_ASSERT(
1107  _status == Fw::FW_SERIALIZE_OK,
1108  static_cast<FwAssertArgType>(_status)
1109  );
1110 
1111  this->logOut_out(
1112  0,
1113  _id,
1114  _logTime,
1116  _logBuff
1117  );
1118  }
1119 
1120  // Emit the event on the text log port
1121 #if FW_ENABLE_TEXT_LOGGING
1122  if (this->isConnected_logTextOut_OutputPort(0)) {
1123 #if FW_OBJECT_NAMES == 1
1124  const char* _formatString =
1125  "(%s) %s: File dispatch %s state changed: to %s";
1126 #else
1127  const char* _formatString =
1128  "%s: File dispatch %s state changed: to %s";
1129 #endif
1130 
1131  Fw::String file_typeStr;
1132  file_type.toString(file_typeStr);
1133  Fw::String enabledStr;
1134  enabled.toString(enabledStr);
1135 
1136  Fw::TextLogString _logString;
1137  (void) _logString.format(
1138  _formatString,
1139 #if FW_OBJECT_NAMES == 1
1140  this->m_objName.toChar(),
1141 #endif
1142  "FileDispatchState ",
1143  file_typeStr.toChar(),
1144  enabledStr.toChar()
1145  );
1146 
1147  this->logTextOut_out(
1148  0,
1149  _id,
1150  _logTime,
1152  _logString
1153  );
1154  }
1155 #endif
1156  }
1157 
1160  const Fw::StringBase& file_name,
1162  ) const
1163  {
1164  // Get the time
1165  Fw::Time _logTime;
1166  if (this->isConnected_timeCaller_OutputPort(0)) {
1167  this->timeCaller_out(0, _logTime);
1168  }
1169 
1170  const FwEventIdType _id = this->getIdBase() + EVENTID_FILEDISPATCHED;
1171 
1172  // Emit the event on the log port
1173  if (this->isConnected_logOut_OutputPort(0)) {
1174  Fw::LogBuffer _logBuff;
1176 
1177 #if FW_AMPCS_COMPATIBLE
1178  // Serialize the number of arguments
1179  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1180  FW_ASSERT(
1181  _status == Fw::FW_SERIALIZE_OK,
1182  static_cast<FwAssertArgType>(_status)
1183  );
1184 #endif
1185 
1186  _status = file_name.serializeTo(
1187  _logBuff,
1188  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 240)
1189  );
1190  FW_ASSERT(
1191  _status == Fw::FW_SERIALIZE_OK,
1192  static_cast<FwAssertArgType>(_status)
1193  );
1194 
1195 #if FW_AMPCS_COMPATIBLE
1196  // Serialize the argument size
1197  _status = _logBuff.serializeFrom(
1199  );
1200  FW_ASSERT(
1201  _status == Fw::FW_SERIALIZE_OK,
1202  static_cast<FwAssertArgType>(_status)
1203  );
1204 #endif
1205  _status = _logBuff.serializeFrom(file_type);
1206  FW_ASSERT(
1207  _status == Fw::FW_SERIALIZE_OK,
1208  static_cast<FwAssertArgType>(_status)
1209  );
1210 
1211  this->logOut_out(
1212  0,
1213  _id,
1214  _logTime,
1216  _logBuff
1217  );
1218  }
1219 
1220  // Emit the event on the text log port
1221 #if FW_ENABLE_TEXT_LOGGING
1222  if (this->isConnected_logTextOut_OutputPort(0)) {
1223 #if FW_OBJECT_NAMES == 1
1224  const char* _formatString =
1225  "(%s) %s: File %s dispatched to %s";
1226 #else
1227  const char* _formatString =
1228  "%s: File %s dispatched to %s";
1229 #endif
1230 
1231  Fw::String file_typeStr;
1232  file_type.toString(file_typeStr);
1233 
1234  Fw::TextLogString _logString;
1235  (void) _logString.format(
1236  _formatString,
1237 #if FW_OBJECT_NAMES == 1
1238  this->m_objName.toChar(),
1239 #endif
1240  "FileDispatched ",
1241  file_name.toChar(),
1242  file_typeStr.toChar()
1243  );
1244 
1245  this->logTextOut_out(
1246  0,
1247  _id,
1248  _logTime,
1250  _logString
1251  );
1252  }
1253 #endif
1254  }
1255 
1258  const Fw::StringBase& file_name,
1260  )
1261  {
1262  // Check throttle value
1263  if (this->m_FileDispatchPortNotConnectedThrottle >= EVENTID_FILEDISPATCHPORTNOTCONNECTED_THROTTLE) {
1264  return;
1265  }
1266  else {
1267  this->m_FileDispatchPortNotConnectedThrottle++;
1268  }
1269 
1270  // Get the time
1271  Fw::Time _logTime;
1272  if (this->isConnected_timeCaller_OutputPort(0)) {
1273  this->timeCaller_out(0, _logTime);
1274  }
1275 
1277 
1278  // Emit the event on the log port
1279  if (this->isConnected_logOut_OutputPort(0)) {
1280  Fw::LogBuffer _logBuff;
1282 
1283 #if FW_AMPCS_COMPATIBLE
1284  // Serialize the number of arguments
1285  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1286  FW_ASSERT(
1287  _status == Fw::FW_SERIALIZE_OK,
1288  static_cast<FwAssertArgType>(_status)
1289  );
1290 #endif
1291 
1292  _status = file_name.serializeTo(
1293  _logBuff,
1294  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 240)
1295  );
1296  FW_ASSERT(
1297  _status == Fw::FW_SERIALIZE_OK,
1298  static_cast<FwAssertArgType>(_status)
1299  );
1300 
1301 #if FW_AMPCS_COMPATIBLE
1302  // Serialize the argument size
1303  _status = _logBuff.serializeFrom(
1305  );
1306  FW_ASSERT(
1307  _status == Fw::FW_SERIALIZE_OK,
1308  static_cast<FwAssertArgType>(_status)
1309  );
1310 #endif
1311  _status = _logBuff.serializeFrom(file_type);
1312  FW_ASSERT(
1313  _status == Fw::FW_SERIALIZE_OK,
1314  static_cast<FwAssertArgType>(_status)
1315  );
1316 
1317  this->logOut_out(
1318  0,
1319  _id,
1320  _logTime,
1322  _logBuff
1323  );
1324  }
1325 
1326  // Emit the event on the text log port
1327 #if FW_ENABLE_TEXT_LOGGING
1328  if (this->isConnected_logTextOut_OutputPort(0)) {
1329 #if FW_OBJECT_NAMES == 1
1330  const char* _formatString =
1331  "(%s) %s: File %s matched %s but the dispatch port is not connected";
1332 #else
1333  const char* _formatString =
1334  "%s: File %s matched %s but the dispatch port is not connected";
1335 #endif
1336 
1337  Fw::String file_typeStr;
1338  file_type.toString(file_typeStr);
1339 
1340  Fw::TextLogString _logString;
1341  (void) _logString.format(
1342  _formatString,
1343 #if FW_OBJECT_NAMES == 1
1344  this->m_objName.toChar(),
1345 #endif
1346  "FileDispatchPortNotConnected ",
1347  file_name.toChar(),
1348  file_typeStr.toChar()
1349  );
1350 
1351  this->logTextOut_out(
1352  0,
1353  _id,
1354  _logTime,
1356  _logString
1357  );
1358  }
1359 #endif
1360  }
1361 
1362  // ----------------------------------------------------------------------
1363  // Event throttle reset functions
1364  // ----------------------------------------------------------------------
1365 
1368  {
1369  // Reset throttle counter
1370  this->m_FileDispatchPortNotConnectedThrottle = 0;
1371  }
1372 
1373  // ----------------------------------------------------------------------
1374  // Time
1375  // ----------------------------------------------------------------------
1376 
1378  getTime() const
1379  {
1380  if (this->isConnected_timeCaller_OutputPort(0)) {
1381  Fw::Time _time;
1382  this->timeCaller_out(0, _time);
1383  return _time;
1384  }
1385  else {
1386  return Fw::Time(TimeBase::TB_NONE, 0, 0);
1387  }
1388  }
1389 
1390  // ----------------------------------------------------------------------
1391  // Message dispatch functions
1392  // ----------------------------------------------------------------------
1393 
1394  Fw::QueuedComponentBase::MsgDispatchStatus FileDispatcherComponentBase ::
1395  doDispatch()
1396  {
1397  ComponentIpcSerializableBuffer _msg;
1398  FwQueuePriorityType _priority = 0;
1399 
1400  Os::Queue::Status _msgStatus = this->m_queue.receive(
1401  _msg,
1403  _priority
1404  );
1405  FW_ASSERT(
1406  _msgStatus == Os::Queue::OP_OK,
1407  static_cast<FwAssertArgType>(_msgStatus)
1408  );
1409 
1410  // Reset to beginning of buffer
1411  _msg.resetDeser();
1412 
1413  FwEnumStoreType _desMsg = 0;
1414  Fw::SerializeStatus _deserStatus = _msg.deserializeTo(_desMsg);
1415  FW_ASSERT(
1416  _deserStatus == Fw::FW_SERIALIZE_OK,
1417  static_cast<FwAssertArgType>(_deserStatus)
1418  );
1419 
1420  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
1421 
1422  if (_msgType == FILEDISPATCHER_COMPONENT_EXIT) {
1423  return MSG_DISPATCH_EXIT;
1424  }
1425 
1426  FwIndexType portNum = 0;
1427  _deserStatus = _msg.deserializeTo(portNum);
1428  FW_ASSERT(
1429  _deserStatus == Fw::FW_SERIALIZE_OK,
1430  static_cast<FwAssertArgType>(_deserStatus)
1431  );
1432 
1433  switch (_msgType) {
1434  // Handle async input port fileAnnounceRecv
1435  case FILEANNOUNCERECV_FILEANNOUNCE: {
1436  // Deserialize argument file_name
1437  char __fprime_ac_file_name_buffer[Fw::StringBase::BUFFER_SIZE(240)];
1438  Fw::ExternalString file_name(__fprime_ac_file_name_buffer, sizeof __fprime_ac_file_name_buffer);
1439  _deserStatus = _msg.deserializeTo(file_name);
1440  FW_ASSERT(
1441  _deserStatus == Fw::FW_SERIALIZE_OK,
1442  static_cast<FwAssertArgType>(_deserStatus)
1443  );
1444  // Call handler function
1446  portNum,
1447  file_name
1448  );
1449 
1450  break;
1451  }
1452 
1453  // Handle async input port pingIn
1454  case PINGIN_PING: {
1455  // Deserialize argument key
1456  U32 key;
1457  _deserStatus = _msg.deserializeTo(key);
1458  FW_ASSERT(
1459  _deserStatus == Fw::FW_SERIALIZE_OK,
1460  static_cast<FwAssertArgType>(_deserStatus)
1461  );
1462  // Call handler function
1463  this->pingIn_handler(
1464  portNum,
1465  key
1466  );
1467 
1468  break;
1469  }
1470 
1471  // Handle command ENABLE_DISPATCH
1472  case CMD_ENABLE_DISPATCH: {
1473  // Deserialize opcode
1474  FwOpcodeType _opCode = 0;
1475  _deserStatus = _msg.deserializeTo(_opCode);
1476  FW_ASSERT (
1477  _deserStatus == Fw::FW_SERIALIZE_OK,
1478  static_cast<FwAssertArgType>(_deserStatus)
1479  );
1480 
1481  // Deserialize command sequence
1482  U32 _cmdSeq = 0;
1483  _deserStatus = _msg.deserializeTo(_cmdSeq);
1484  FW_ASSERT (
1485  _deserStatus == Fw::FW_SERIALIZE_OK,
1486  static_cast<FwAssertArgType>(_deserStatus)
1487  );
1488 
1489  // Deserialize command argument buffer
1490  Fw::CmdArgBuffer args;
1491  _deserStatus = _msg.deserializeTo(args);
1492  FW_ASSERT (
1493  _deserStatus == Fw::FW_SERIALIZE_OK,
1494  static_cast<FwAssertArgType>(_deserStatus)
1495  );
1496 
1497  // Reset buffer
1498  args.resetDeser();
1499 
1500  // Deserialize argument file_type
1502  _deserStatus = args.deserializeTo(file_type);
1503  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
1505  this->cmdResponse_out(
1506  _opCode,
1507  _cmdSeq,
1509  );
1510  }
1511  // Don't crash the task if bad arguments were passed from the ground
1512  break;
1513  }
1514 
1515  // Deserialize argument enable
1516  Fw::Enabled enable;
1517  _deserStatus = args.deserializeTo(enable);
1518  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
1520  this->cmdResponse_out(
1521  _opCode,
1522  _cmdSeq,
1524  );
1525  }
1526  // Don't crash the task if bad arguments were passed from the ground
1527  break;
1528  }
1529 
1530  // Make sure there was no data left over.
1531  // That means the argument buffer size was incorrect.
1532 #if FW_CMD_CHECK_RESIDUAL
1533  if (args.getDeserializeSizeLeft() != 0) {
1535  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
1536  }
1537  // Don't crash the task if bad arguments were passed from the ground
1538  break;
1539  }
1540 #endif
1541 
1542  // Call handler function
1544  _opCode, _cmdSeq,
1545  file_type,
1546  enable
1547  );
1548 
1549  break;
1550  }
1551 
1552  default:
1553  return MSG_DISPATCH_ERROR;
1554  }
1555 
1556  return MSG_DISPATCH_OK;
1557  }
1558 
1559  // ----------------------------------------------------------------------
1560  // Calls for messages received on special input ports
1561  // ----------------------------------------------------------------------
1562 
1563  void FileDispatcherComponentBase ::
1564  m_p_cmdIn_in(
1565  Fw::PassiveComponentBase* callComp,
1566  FwIndexType portNum,
1567  FwOpcodeType opCode,
1568  U32 cmdSeq,
1569  Fw::CmdArgBuffer& args
1570  )
1571  {
1572  FW_ASSERT(callComp != nullptr);
1573  FileDispatcherComponentBase* compPtr = static_cast<FileDispatcherComponentBase*>(callComp);
1574  compPtr->cmdIn_handlerBase(
1575  portNum,
1576  opCode,
1577  cmdSeq,
1578  args
1579  );
1580  }
1581 
1582  // ----------------------------------------------------------------------
1583  // Calls for messages received on typed input ports
1584  // ----------------------------------------------------------------------
1585 
1586  void FileDispatcherComponentBase ::
1587  m_p_fileAnnounceRecv_in(
1588  Fw::PassiveComponentBase* callComp,
1589  FwIndexType portNum,
1590  Fw::StringBase& file_name
1591  )
1592  {
1593  FW_ASSERT(callComp != nullptr);
1594  FileDispatcherComponentBase* compPtr = static_cast<FileDispatcherComponentBase*>(callComp);
1595  compPtr->fileAnnounceRecv_handlerBase(
1596  portNum,
1597  file_name
1598  );
1599  }
1600 
1601  void FileDispatcherComponentBase ::
1602  m_p_pingIn_in(
1603  Fw::PassiveComponentBase* callComp,
1604  FwIndexType portNum,
1605  U32 key
1606  )
1607  {
1608  FW_ASSERT(callComp != nullptr);
1609  FileDispatcherComponentBase* compPtr = static_cast<FileDispatcherComponentBase*>(callComp);
1610  compPtr->pingIn_handlerBase(
1611  portNum,
1612  key
1613  );
1614  }
1615 
1616 #if !FW_DIRECT_PORT_CALLS
1617 
1618  // ----------------------------------------------------------------------
1619  // Invocation functions for special output ports
1620  // ----------------------------------------------------------------------
1621 
1622  void FileDispatcherComponentBase ::
1623  cmdRegOut_out(
1624  FwIndexType portNum,
1625  FwOpcodeType opCode
1626  ) const
1627  {
1628  FW_ASSERT(
1629  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
1630  static_cast<FwAssertArgType>(portNum)
1631  );
1632 
1633  FW_ASSERT(
1634  this->m_cmdRegOut_OutputPort[portNum].isConnected(),
1635  static_cast<FwAssertArgType>(portNum)
1636  );
1637  this->m_cmdRegOut_OutputPort[portNum].invoke(
1638  opCode
1639  );
1640  }
1641 
1642  void FileDispatcherComponentBase ::
1643  cmdResponseOut_out(
1644  FwIndexType portNum,
1645  FwOpcodeType opCode,
1646  U32 cmdSeq,
1647  const Fw::CmdResponse& response
1648  ) const
1649  {
1650  FW_ASSERT(
1651  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
1652  static_cast<FwAssertArgType>(portNum)
1653  );
1654 
1655  FW_ASSERT(
1656  this->m_cmdResponseOut_OutputPort[portNum].isConnected(),
1657  static_cast<FwAssertArgType>(portNum)
1658  );
1659  this->m_cmdResponseOut_OutputPort[portNum].invoke(
1660  opCode,
1661  cmdSeq,
1662  response
1663  );
1664  }
1665 
1666  void FileDispatcherComponentBase ::
1667  logOut_out(
1668  FwIndexType portNum,
1669  FwEventIdType id,
1670  Fw::Time& timeTag,
1671  const Fw::LogSeverity& severity,
1672  Fw::LogBuffer& args
1673  ) const
1674  {
1675  FW_ASSERT(
1676  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
1677  static_cast<FwAssertArgType>(portNum)
1678  );
1679 
1680  FW_ASSERT(
1681  this->m_logOut_OutputPort[portNum].isConnected(),
1682  static_cast<FwAssertArgType>(portNum)
1683  );
1684  this->m_logOut_OutputPort[portNum].invoke(
1685  id,
1686  timeTag,
1687  severity,
1688  args
1689  );
1690  }
1691 
1692 #if FW_ENABLE_TEXT_LOGGING
1693 
1694  void FileDispatcherComponentBase ::
1695  logTextOut_out(
1696  FwIndexType portNum,
1697  FwEventIdType id,
1698  Fw::Time& timeTag,
1699  const Fw::LogSeverity& severity,
1700  Fw::TextLogString& text
1701  ) const
1702  {
1703  FW_ASSERT(
1704  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
1705  static_cast<FwAssertArgType>(portNum)
1706  );
1707 
1708  FW_ASSERT(
1709  this->m_logTextOut_OutputPort[portNum].isConnected(),
1710  static_cast<FwAssertArgType>(portNum)
1711  );
1712  this->m_logTextOut_OutputPort[portNum].invoke(
1713  id,
1714  timeTag,
1715  severity,
1716  text
1717  );
1718  }
1719 
1720 #endif
1721 
1722  void FileDispatcherComponentBase ::
1723  timeCaller_out(
1724  FwIndexType portNum,
1725  Fw::Time& time
1726  ) const
1727  {
1728  FW_ASSERT(
1729  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
1730  static_cast<FwAssertArgType>(portNum)
1731  );
1732 
1733  FW_ASSERT(
1734  this->m_timeCaller_OutputPort[portNum].isConnected(),
1735  static_cast<FwAssertArgType>(portNum)
1736  );
1737  this->m_timeCaller_OutputPort[portNum].invoke(
1738  time
1739  );
1740  }
1741 
1742 #endif
1743 
1744 }
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
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
The size of the serial representation.
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
message to exit active component task
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
void init()
Initialization function.
void incNumMsgDropped()
increment the number of messages dropped
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]