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];
28  BYTE pingInPortSize[Svc::PingPortBuffer::CAPACITY];
29  BYTE cmdPortSize[Fw::CmdPortBuffer::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  Fw::Serializable::SizeType getCapacity() const {
50  return sizeof(m_buff);
51  }
52 
53  U8* getBuffAddr() {
54  return m_buff;
55  }
56 
57  const U8* getBuffAddr() const {
58  return m_buff;
59  }
60 
61  private:
62  // Should be the max of all the input ports serialized sizes...
63  U8 m_buff[SERIALIZATION_SIZE];
64 
65  };
66  }
67 
68  // ----------------------------------------------------------------------
69  // Component initialization
70  // ----------------------------------------------------------------------
71 
74  FwSizeType queueDepth,
75  FwEnumStoreType instance
76  )
77  {
78  // Initialize base class
80 
81 #if !FW_DIRECT_PORT_CALLS
82  // Connect input port cmdIn
83  for (
84  FwIndexType port = 0;
85  port < static_cast<FwIndexType>(this->getNum_cmdIn_InputPorts());
86  port++
87  ) {
88  this->m_cmdIn_InputPort[port].init();
89  this->m_cmdIn_InputPort[port].addCallComp(
90  this,
91  m_p_cmdIn_in
92  );
93  this->m_cmdIn_InputPort[port].setPortNum(port);
94 
95 #if FW_OBJECT_NAMES == 1
96  Fw::ObjectName portName;
97  portName.format(
98  "%s_cmdIn_InputPort[%" PRI_FwIndexType "]",
99  this->m_objName.toChar(),
100  port
101  );
102  this->m_cmdIn_InputPort[port].setObjName(portName.toChar());
103 #endif
104  }
105 #endif
106 
107 #if !FW_DIRECT_PORT_CALLS
108  // Connect input port fileAnnounceRecv
109  for (
110  FwIndexType port = 0;
111  port < static_cast<FwIndexType>(this->getNum_fileAnnounceRecv_InputPorts());
112  port++
113  ) {
114  this->m_fileAnnounceRecv_InputPort[port].init();
115  this->m_fileAnnounceRecv_InputPort[port].addCallComp(
116  this,
117  m_p_fileAnnounceRecv_in
118  );
119  this->m_fileAnnounceRecv_InputPort[port].setPortNum(port);
120 
121 #if FW_OBJECT_NAMES == 1
122  Fw::ObjectName portName;
123  portName.format(
124  "%s_fileAnnounceRecv_InputPort[%" PRI_FwIndexType "]",
125  this->m_objName.toChar(),
126  port
127  );
128  this->m_fileAnnounceRecv_InputPort[port].setObjName(portName.toChar());
129 #endif
130  }
131 #endif
132 
133 #if !FW_DIRECT_PORT_CALLS
134  // Connect input port pingIn
135  for (
136  FwIndexType port = 0;
137  port < static_cast<FwIndexType>(this->getNum_pingIn_InputPorts());
138  port++
139  ) {
140  this->m_pingIn_InputPort[port].init();
141  this->m_pingIn_InputPort[port].addCallComp(
142  this,
143  m_p_pingIn_in
144  );
145  this->m_pingIn_InputPort[port].setPortNum(port);
146 
147 #if FW_OBJECT_NAMES == 1
148  Fw::ObjectName portName;
149  portName.format(
150  "%s_pingIn_InputPort[%" PRI_FwIndexType "]",
151  this->m_objName.toChar(),
152  port
153  );
154  this->m_pingIn_InputPort[port].setObjName(portName.toChar());
155 #endif
156  }
157 #endif
158 
159 #if !FW_DIRECT_PORT_CALLS
160  // Connect output port cmdRegOut
161  for (
162  FwIndexType port = 0;
163  port < static_cast<FwIndexType>(this->getNum_cmdRegOut_OutputPorts());
164  port++
165  ) {
166  this->m_cmdRegOut_OutputPort[port].init();
167 
168 #if FW_OBJECT_NAMES == 1
169  Fw::ObjectName portName;
170  portName.format(
171  "%s_cmdRegOut_OutputPort[%" PRI_FwIndexType "]",
172  this->m_objName.toChar(),
173  port
174  );
175  this->m_cmdRegOut_OutputPort[port].setObjName(portName.toChar());
176 #endif
177  }
178 #endif
179 
180 #if !FW_DIRECT_PORT_CALLS
181  // Connect output port cmdResponseOut
182  for (
183  FwIndexType port = 0;
184  port < static_cast<FwIndexType>(this->getNum_cmdResponseOut_OutputPorts());
185  port++
186  ) {
187  this->m_cmdResponseOut_OutputPort[port].init();
188 
189 #if FW_OBJECT_NAMES == 1
190  Fw::ObjectName portName;
191  portName.format(
192  "%s_cmdResponseOut_OutputPort[%" PRI_FwIndexType "]",
193  this->m_objName.toChar(),
194  port
195  );
196  this->m_cmdResponseOut_OutputPort[port].setObjName(portName.toChar());
197 #endif
198  }
199 #endif
200 
201 #if !FW_DIRECT_PORT_CALLS
202  // Connect output port logOut
203  for (
204  FwIndexType port = 0;
205  port < static_cast<FwIndexType>(this->getNum_logOut_OutputPorts());
206  port++
207  ) {
208  this->m_logOut_OutputPort[port].init();
209 
210 #if FW_OBJECT_NAMES == 1
211  Fw::ObjectName portName;
212  portName.format(
213  "%s_logOut_OutputPort[%" PRI_FwIndexType "]",
214  this->m_objName.toChar(),
215  port
216  );
217  this->m_logOut_OutputPort[port].setObjName(portName.toChar());
218 #endif
219  }
220 #endif
221 
222 #if !FW_DIRECT_PORT_CALLS && FW_ENABLE_TEXT_LOGGING
223  // Connect output port logTextOut
224  for (
225  FwIndexType port = 0;
226  port < static_cast<FwIndexType>(this->getNum_logTextOut_OutputPorts());
227  port++
228  ) {
229  this->m_logTextOut_OutputPort[port].init();
230 
231 #if FW_OBJECT_NAMES == 1
232  Fw::ObjectName portName;
233  portName.format(
234  "%s_logTextOut_OutputPort[%" PRI_FwIndexType "]",
235  this->m_objName.toChar(),
236  port
237  );
238  this->m_logTextOut_OutputPort[port].setObjName(portName.toChar());
239 #endif
240  }
241 #endif
242 
243 #if !FW_DIRECT_PORT_CALLS
244  // Connect output port timeCaller
245  for (
246  FwIndexType port = 0;
247  port < static_cast<FwIndexType>(this->getNum_timeCaller_OutputPorts());
248  port++
249  ) {
250  this->m_timeCaller_OutputPort[port].init();
251 
252 #if FW_OBJECT_NAMES == 1
253  Fw::ObjectName portName;
254  portName.format(
255  "%s_timeCaller_OutputPort[%" PRI_FwIndexType "]",
256  this->m_objName.toChar(),
257  port
258  );
259  this->m_timeCaller_OutputPort[port].setObjName(portName.toChar());
260 #endif
261  }
262 #endif
263 
264 #if !FW_DIRECT_PORT_CALLS
265  // Connect output port fileDispatch
266  for (
267  FwIndexType port = 0;
268  port < static_cast<FwIndexType>(this->getNum_fileDispatch_OutputPorts());
269  port++
270  ) {
271  this->m_fileDispatch_OutputPort[port].init();
272 
273 #if FW_OBJECT_NAMES == 1
274  Fw::ObjectName portName;
275  portName.format(
276  "%s_fileDispatch_OutputPort[%" PRI_FwIndexType "]",
277  this->m_objName.toChar(),
278  port
279  );
280  this->m_fileDispatch_OutputPort[port].setObjName(portName.toChar());
281 #endif
282  }
283 #endif
284 
285 #if !FW_DIRECT_PORT_CALLS
286  // Connect output port pingOut
287  for (
288  FwIndexType port = 0;
289  port < static_cast<FwIndexType>(this->getNum_pingOut_OutputPorts());
290  port++
291  ) {
292  this->m_pingOut_OutputPort[port].init();
293 
294 #if FW_OBJECT_NAMES == 1
295  Fw::ObjectName portName;
296  portName.format(
297  "%s_pingOut_OutputPort[%" PRI_FwIndexType "]",
298  this->m_objName.toChar(),
299  port
300  );
301  this->m_pingOut_OutputPort[port].setObjName(portName.toChar());
302 #endif
303  }
304 #endif
305 
306  // Create the queue
307  Os::Queue::Status qStat = this->createQueue(
308  queueDepth,
309  static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
310  );
311  FW_ASSERT(
312  Os::Queue::Status::OP_OK == qStat,
313  static_cast<FwAssertArgType>(qStat)
314  );
315  }
316 
317 #if !FW_DIRECT_PORT_CALLS
318 
319  // ----------------------------------------------------------------------
320  // Getters for special input ports
321  // ----------------------------------------------------------------------
322 
325  {
326  FW_ASSERT(
327  (0 <= portNum) && (portNum < this->getNum_cmdIn_InputPorts()),
328  static_cast<FwAssertArgType>(portNum)
329  );
330 
331  return &this->m_cmdIn_InputPort[portNum];
332  }
333 
334 #endif
335 
336 #if !FW_DIRECT_PORT_CALLS
337 
338  // ----------------------------------------------------------------------
339  // Getters for typed input ports
340  // ----------------------------------------------------------------------
341 
344  {
345  FW_ASSERT(
346  (0 <= portNum) && (portNum < this->getNum_fileAnnounceRecv_InputPorts()),
347  static_cast<FwAssertArgType>(portNum)
348  );
349 
350  return &this->m_fileAnnounceRecv_InputPort[portNum];
351  }
352 
355  {
356  FW_ASSERT(
357  (0 <= portNum) && (portNum < this->getNum_pingIn_InputPorts()),
358  static_cast<FwAssertArgType>(portNum)
359  );
360 
361  return &this->m_pingIn_InputPort[portNum];
362  }
363 
364 #endif
365 
366 #if !FW_DIRECT_PORT_CALLS
367 
368  // ----------------------------------------------------------------------
369  // Connect input ports to special output ports
370  // ----------------------------------------------------------------------
371 
374  FwIndexType portNum,
375  Fw::InputCmdRegPort* port
376  )
377  {
378  FW_ASSERT(
379  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
380  static_cast<FwAssertArgType>(portNum)
381  );
382 
383  this->m_cmdRegOut_OutputPort[portNum].addCallPort(port);
384  }
385 
388  FwIndexType portNum,
390  )
391  {
392  FW_ASSERT(
393  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
394  static_cast<FwAssertArgType>(portNum)
395  );
396 
397  this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port);
398  }
399 
402  FwIndexType portNum,
403  Fw::InputLogPort* port
404  )
405  {
406  FW_ASSERT(
407  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
408  static_cast<FwAssertArgType>(portNum)
409  );
410 
411  this->m_logOut_OutputPort[portNum].addCallPort(port);
412  }
413 
414 #if FW_ENABLE_TEXT_LOGGING == 1
415 
416  void FileDispatcherComponentBase ::
417  set_logTextOut_OutputPort(
418  FwIndexType portNum,
420  )
421  {
422  FW_ASSERT(
423  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
424  static_cast<FwAssertArgType>(portNum)
425  );
426 
427  this->m_logTextOut_OutputPort[portNum].addCallPort(port);
428  }
429 
430 #endif
431 
434  FwIndexType portNum,
435  Fw::InputTimePort* port
436  )
437  {
438  FW_ASSERT(
439  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
440  static_cast<FwAssertArgType>(portNum)
441  );
442 
443  this->m_timeCaller_OutputPort[portNum].addCallPort(port);
444  }
445 
446 #endif
447 
448 #if !FW_DIRECT_PORT_CALLS
449 
450  // ----------------------------------------------------------------------
451  // Connect typed input ports to typed output ports
452  // ----------------------------------------------------------------------
453 
456  FwIndexType portNum,
458  )
459  {
460  FW_ASSERT(
461  (0 <= portNum) && (portNum < this->getNum_fileDispatch_OutputPorts()),
462  static_cast<FwAssertArgType>(portNum)
463  );
464 
465  this->m_fileDispatch_OutputPort[portNum].addCallPort(port);
466  }
467 
470  FwIndexType portNum,
471  Svc::InputPingPort* port
472  )
473  {
474  FW_ASSERT(
475  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
476  static_cast<FwAssertArgType>(portNum)
477  );
478 
479  this->m_pingOut_OutputPort[portNum].addCallPort(port);
480  }
481 
482 #endif
483 
484 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
485 
486  // ----------------------------------------------------------------------
487  // Connect serial input ports to special output ports
488  // ----------------------------------------------------------------------
489 
492  FwIndexType portNum,
493  Fw::InputSerializePort* port
494  )
495  {
496  FW_ASSERT(
497  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
498  static_cast<FwAssertArgType>(portNum)
499  );
500 
501  this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port);
502  }
503 
506  FwIndexType portNum,
507  Fw::InputSerializePort* port
508  )
509  {
510  FW_ASSERT(
511  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
512  static_cast<FwAssertArgType>(portNum)
513  );
514 
515  this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port);
516  }
517 
520  FwIndexType portNum,
521  Fw::InputSerializePort* port
522  )
523  {
524  FW_ASSERT(
525  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
526  static_cast<FwAssertArgType>(portNum)
527  );
528 
529  this->m_logOut_OutputPort[portNum].registerSerialPort(port);
530  }
531 
532 #if FW_ENABLE_TEXT_LOGGING == 1
533 
534  void FileDispatcherComponentBase ::
535  set_logTextOut_OutputPort(
536  FwIndexType portNum,
537  Fw::InputSerializePort* port
538  )
539  {
540  FW_ASSERT(
541  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
542  static_cast<FwAssertArgType>(portNum)
543  );
544 
545  this->m_logTextOut_OutputPort[portNum].registerSerialPort(port);
546  }
547 
548 #endif
549 
552  FwIndexType portNum,
553  Fw::InputSerializePort* port
554  )
555  {
556  FW_ASSERT(
557  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
558  static_cast<FwAssertArgType>(portNum)
559  );
560 
561  this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
562  }
563 
564 #endif
565 
566 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
567 
568  // ----------------------------------------------------------------------
569  // Connect serial input ports to typed output ports
570  // ----------------------------------------------------------------------
571 
574  FwIndexType portNum,
575  Fw::InputSerializePort* port
576  )
577  {
578  FW_ASSERT(
579  (0 <= portNum) && (portNum < this->getNum_fileDispatch_OutputPorts()),
580  static_cast<FwAssertArgType>(portNum)
581  );
582 
583  this->m_fileDispatch_OutputPort[portNum].registerSerialPort(port);
584  }
585 
588  FwIndexType portNum,
589  Fw::InputSerializePort* port
590  )
591  {
592  FW_ASSERT(
593  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
594  static_cast<FwAssertArgType>(portNum)
595  );
596 
597  this->m_pingOut_OutputPort[portNum].registerSerialPort(port);
598  }
599 
600 #endif
601 
602  // ----------------------------------------------------------------------
603  // Command registration
604  // ----------------------------------------------------------------------
605 
608  {
610 
611  this->cmdRegOut_out(
612  0,
614  );
615  }
616 
617  // ----------------------------------------------------------------------
618  // Component construction and destruction
619  // ----------------------------------------------------------------------
620 
622  FileDispatcherComponentBase(const char* compName) :
623  Fw::ActiveComponentBase(compName)
624  {
625 
626  }
627 
630  {
631 
632  }
633 
634 #if !FW_DIRECT_PORT_CALLS
635 
636  // ----------------------------------------------------------------------
637  // Connection status queries for special output ports
638  // ----------------------------------------------------------------------
639 
642  {
643  FW_ASSERT(
644  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
645  static_cast<FwAssertArgType>(portNum)
646  );
647 
648  return this->m_cmdRegOut_OutputPort[portNum].isConnected();
649  }
650 
653  {
654  FW_ASSERT(
655  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
656  static_cast<FwAssertArgType>(portNum)
657  );
658 
659  return this->m_cmdResponseOut_OutputPort[portNum].isConnected();
660  }
661 
664  {
665  FW_ASSERT(
666  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
667  static_cast<FwAssertArgType>(portNum)
668  );
669 
670  return this->m_logOut_OutputPort[portNum].isConnected();
671  }
672 
673 #if FW_ENABLE_TEXT_LOGGING == 1
674 
675  bool FileDispatcherComponentBase ::
676  isConnected_logTextOut_OutputPort(FwIndexType portNum) const
677  {
678  FW_ASSERT(
679  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
680  static_cast<FwAssertArgType>(portNum)
681  );
682 
683  return this->m_logTextOut_OutputPort[portNum].isConnected();
684  }
685 
686 #endif
687 
690  {
691  FW_ASSERT(
692  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
693  static_cast<FwAssertArgType>(portNum)
694  );
695 
696  return this->m_timeCaller_OutputPort[portNum].isConnected();
697  }
698 
699 #endif
700 
701 #if !FW_DIRECT_PORT_CALLS
702 
703  // ----------------------------------------------------------------------
704  // Connection status queries for typed output ports
705  // ----------------------------------------------------------------------
706 
709  {
710  FW_ASSERT(
711  (0 <= portNum) && (portNum < this->getNum_fileDispatch_OutputPorts()),
712  static_cast<FwAssertArgType>(portNum)
713  );
714 
715  return this->m_fileDispatch_OutputPort[portNum].isConnected();
716  }
717 
720  {
721  FW_ASSERT(
722  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
723  static_cast<FwAssertArgType>(portNum)
724  );
725 
726  return this->m_pingOut_OutputPort[portNum].isConnected();
727  }
728 
729 #endif
730 
731  // ----------------------------------------------------------------------
732  // Port handler base-class functions for special input ports
733  //
734  // Call these functions directly to bypass the corresponding ports
735  // ----------------------------------------------------------------------
736 
739  FwIndexType portNum,
740  FwOpcodeType opCode,
741  U32 cmdSeq,
742  Fw::CmdArgBuffer& args
743  )
744  {
745 
746  const U32 idBase = this->getIdBase();
747  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
748 
749  // Select base class function based on opcode
750  switch (opCode - idBase) {
751  case OPCODE_ENABLE_DISPATCH: {
753  opCode,
754  cmdSeq,
755  args
756  );
757  break;
758  }
759  default:
760  // Unknown opcode: ignore it
761  break;
762  }
763  }
764 
765  // ----------------------------------------------------------------------
766  // Port handler base-class functions for typed input ports
767  //
768  // Call these functions directly to bypass the corresponding ports
769  // ----------------------------------------------------------------------
770 
773  FwIndexType portNum,
774  Fw::StringBase& file_name
775  )
776  {
777  // Make sure port number is valid
778  FW_ASSERT(
779  (0 <= portNum) && (portNum < this->getNum_fileAnnounceRecv_InputPorts()),
780  static_cast<FwAssertArgType>(portNum)
781  );
782 
783  // Call pre-message hook
785  portNum,
786  file_name
787  );
788  ComponentIpcSerializableBuffer msg;
790 
791  // Serialize message ID
792  _status = msg.serializeFrom(
793  static_cast<FwEnumStoreType>(FILEANNOUNCERECV_FILEANNOUNCE)
794  );
795  FW_ASSERT(
796  _status == Fw::FW_SERIALIZE_OK,
797  static_cast<FwAssertArgType>(_status)
798  );
799 
800  // Serialize port number
801  _status = msg.serializeFrom(portNum);
802  FW_ASSERT(
803  _status == Fw::FW_SERIALIZE_OK,
804  static_cast<FwAssertArgType>(_status)
805  );
806 
807  // Serialize argument file_name
808  _status = file_name.serializeTo(msg, static_cast<FwSizeType>(FW_FIXED_LENGTH_STRING_SIZE));
809  FW_ASSERT(
810  _status == Fw::FW_SERIALIZE_OK,
811  static_cast<FwAssertArgType>(_status)
812  );
813 
814  // Send message
816  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
817 
818  FW_ASSERT(
819  qStatus == Os::Queue::OP_OK,
820  static_cast<FwAssertArgType>(qStatus)
821  );
822  }
823 
826  FwIndexType portNum,
827  U32 key
828  )
829  {
830  // Make sure port number is valid
831  FW_ASSERT(
832  (0 <= portNum) && (portNum < this->getNum_pingIn_InputPorts()),
833  static_cast<FwAssertArgType>(portNum)
834  );
835 
836  // Call pre-message hook
838  portNum,
839  key
840  );
841  ComponentIpcSerializableBuffer msg;
843 
844  // Serialize message ID
845  _status = msg.serializeFrom(
846  static_cast<FwEnumStoreType>(PINGIN_PING)
847  );
848  FW_ASSERT(
849  _status == Fw::FW_SERIALIZE_OK,
850  static_cast<FwAssertArgType>(_status)
851  );
852 
853  // Serialize port number
854  _status = msg.serializeFrom(portNum);
855  FW_ASSERT(
856  _status == Fw::FW_SERIALIZE_OK,
857  static_cast<FwAssertArgType>(_status)
858  );
859 
860  // Serialize argument key
861  _status = msg.serializeFrom(key);
862  FW_ASSERT(
863  _status == Fw::FW_SERIALIZE_OK,
864  static_cast<FwAssertArgType>(_status)
865  );
866 
867  // Send message
869  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
870 
871  FW_ASSERT(
872  qStatus == Os::Queue::OP_OK,
873  static_cast<FwAssertArgType>(qStatus)
874  );
875  }
876 
877  // ----------------------------------------------------------------------
878  // Pre-message hooks for typed async input ports
879  //
880  // Each of these functions is invoked just before processing a message
881  // on the corresponding port. By default, they do nothing. You can
882  // override them to provide specific pre-message behavior.
883  // ----------------------------------------------------------------------
884 
887  FwIndexType portNum,
888  Fw::StringBase& file_name
889  )
890  {
891  // Default: no-op
892  }
893 
896  FwIndexType portNum,
897  U32 key
898  )
899  {
900  // Default: no-op
901  }
902 
903 #if !FW_DIRECT_PORT_CALLS
904 
905  // ----------------------------------------------------------------------
906  // Invocation functions for typed output ports
907  // ----------------------------------------------------------------------
908 
911  FwIndexType portNum,
912  Fw::StringBase& file_name
913  ) const
914  {
915  FW_ASSERT(
916  (0 <= portNum) && (portNum < this->getNum_fileDispatch_OutputPorts()),
917  static_cast<FwAssertArgType>(portNum)
918  );
919 
920  FW_ASSERT(
921  this->m_fileDispatch_OutputPort[portNum].isConnected(),
922  static_cast<FwAssertArgType>(portNum)
923  );
924  this->m_fileDispatch_OutputPort[portNum].invoke(
925  file_name
926  );
927  }
928 
931  FwIndexType portNum,
932  U32 key
933  ) const
934  {
935  FW_ASSERT(
936  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
937  static_cast<FwAssertArgType>(portNum)
938  );
939 
940  FW_ASSERT(
941  this->m_pingOut_OutputPort[portNum].isConnected(),
942  static_cast<FwAssertArgType>(portNum)
943  );
944  this->m_pingOut_OutputPort[portNum].invoke(
945  key
946  );
947  }
948 
949 #endif
950 
951  // ----------------------------------------------------------------------
952  // Command response
953  // ----------------------------------------------------------------------
954 
957  FwOpcodeType opCode,
958  U32 cmdSeq,
959  Fw::CmdResponse response
960  )
961  {
963  this->cmdResponseOut_out(0, opCode, cmdSeq, response);
964  }
965 
966  // ----------------------------------------------------------------------
967  // Command handler base-class functions
968  //
969  // Call these functions directly to bypass the command input port
970  // ----------------------------------------------------------------------
971 
974  FwOpcodeType opCode,
975  U32 cmdSeq,
976  Fw::CmdArgBuffer& args
977  )
978  {
979  // Call pre-message hook
980  this->ENABLE_DISPATCH_preMsgHook(opCode,cmdSeq);
981 
982  // Defer deserializing arguments to the message dispatcher
983  // to avoid deserializing and reserializing just for IPC
984  ComponentIpcSerializableBuffer msg;
986 
987  // Serialize for IPC
988  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_ENABLE_DISPATCH));
989  FW_ASSERT (
990  _status == Fw::FW_SERIALIZE_OK,
991  static_cast<FwAssertArgType>(_status)
992  );
993 
994  // Fake port number to make message dequeue work
995  FwIndexType port = 0;
996 
997  _status = msg.serializeFrom(port);
998  FW_ASSERT (
999  _status == Fw::FW_SERIALIZE_OK,
1000  static_cast<FwAssertArgType>(_status)
1001  );
1002 
1003  _status = msg.serializeFrom(opCode);
1004  FW_ASSERT (
1005  _status == Fw::FW_SERIALIZE_OK,
1006  static_cast<FwAssertArgType>(_status)
1007  );
1008 
1009  _status = msg.serializeFrom(cmdSeq);
1010  FW_ASSERT (
1011  _status == Fw::FW_SERIALIZE_OK,
1012  static_cast<FwAssertArgType>(_status)
1013  );
1014 
1015  _status = msg.serializeFrom(args);
1016  FW_ASSERT (
1017  _status == Fw::FW_SERIALIZE_OK,
1018  static_cast<FwAssertArgType>(_status)
1019  );
1020 
1021  // Send message
1023  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1024 
1025  FW_ASSERT(
1026  qStatus == Os::Queue::OP_OK,
1027  static_cast<FwAssertArgType>(qStatus)
1028  );
1029  }
1030 
1031  // ----------------------------------------------------------------------
1032  // Pre-message hooks for async commands
1033  //
1034  // Each of these functions is invoked just before processing the
1035  // corresponding command. By default they do nothing. You can
1036  // override them to provide specific pre-command behavior.
1037  // ----------------------------------------------------------------------
1038 
1041  FwOpcodeType opCode,
1042  U32 cmdSeq
1043  )
1044  {
1045  // Defaults to no-op; can be overridden
1046  (void) opCode;
1047  (void) cmdSeq;
1048  }
1049 
1050  // ----------------------------------------------------------------------
1051  // Event logging functions
1052  // ----------------------------------------------------------------------
1053 
1057  Fw::Enabled enabled
1058  ) const
1059  {
1060  // Get the time
1061  Fw::Time _logTime;
1062  if (this->isConnected_timeCaller_OutputPort(0)) {
1063  this->timeCaller_out(0, _logTime);
1064  }
1065 
1066  const FwEventIdType _id = this->getIdBase() + EVENTID_FILEDISPATCHSTATE;
1067 
1068  // Emit the event on the log port
1069  if (this->isConnected_logOut_OutputPort(0)) {
1070  Fw::LogBuffer _logBuff;
1072 
1073 #if FW_AMPCS_COMPATIBLE
1074  // Serialize the number of arguments
1075  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1076  FW_ASSERT(
1077  _status == Fw::FW_SERIALIZE_OK,
1078  static_cast<FwAssertArgType>(_status)
1079  );
1080 #endif
1081 
1082 #if FW_AMPCS_COMPATIBLE
1083  // Serialize the argument size
1084  _status = _logBuff.serializeFrom(
1086  );
1087  FW_ASSERT(
1088  _status == Fw::FW_SERIALIZE_OK,
1089  static_cast<FwAssertArgType>(_status)
1090  );
1091 #endif
1092  _status = _logBuff.serializeFrom(file_type);
1093  FW_ASSERT(
1094  _status == Fw::FW_SERIALIZE_OK,
1095  static_cast<FwAssertArgType>(_status)
1096  );
1097 
1098 #if FW_AMPCS_COMPATIBLE
1099  // Serialize the argument size
1100  _status = _logBuff.serializeFrom(
1101  static_cast<U8>(Fw::Enabled::SERIALIZED_SIZE)
1102  );
1103  FW_ASSERT(
1104  _status == Fw::FW_SERIALIZE_OK,
1105  static_cast<FwAssertArgType>(_status)
1106  );
1107 #endif
1108  _status = _logBuff.serializeFrom(enabled);
1109  FW_ASSERT(
1110  _status == Fw::FW_SERIALIZE_OK,
1111  static_cast<FwAssertArgType>(_status)
1112  );
1113 
1114  this->logOut_out(
1115  0,
1116  _id,
1117  _logTime,
1119  _logBuff
1120  );
1121  }
1122 
1123  // Emit the event on the text log port
1124 #if FW_ENABLE_TEXT_LOGGING
1125  if (this->isConnected_logTextOut_OutputPort(0)) {
1126 #if FW_OBJECT_NAMES == 1
1127  const char* _formatString =
1128  "(%s) %s: File dispatch %s state changed: to %s";
1129 #else
1130  const char* _formatString =
1131  "%s: File dispatch %s state changed: to %s";
1132 #endif
1133 
1134  Fw::String file_typeStr;
1135  file_type.toString(file_typeStr);
1136  Fw::String enabledStr;
1137  enabled.toString(enabledStr);
1138 
1139  Fw::TextLogString _logString;
1140  _logString.format(
1141  _formatString,
1142 #if FW_OBJECT_NAMES == 1
1143  this->m_objName.toChar(),
1144 #endif
1145  "FileDispatchState ",
1146  file_typeStr.toChar(),
1147  enabledStr.toChar()
1148  );
1149 
1150  this->logTextOut_out(
1151  0,
1152  _id,
1153  _logTime,
1155  _logString
1156  );
1157  }
1158 #endif
1159  }
1160 
1163  const Fw::StringBase& file_name,
1165  ) const
1166  {
1167  // Get the time
1168  Fw::Time _logTime;
1169  if (this->isConnected_timeCaller_OutputPort(0)) {
1170  this->timeCaller_out(0, _logTime);
1171  }
1172 
1173  const FwEventIdType _id = this->getIdBase() + EVENTID_FILEDISPATCHED;
1174 
1175  // Emit the event on the log port
1176  if (this->isConnected_logOut_OutputPort(0)) {
1177  Fw::LogBuffer _logBuff;
1179 
1180 #if FW_AMPCS_COMPATIBLE
1181  // Serialize the number of arguments
1182  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1183  FW_ASSERT(
1184  _status == Fw::FW_SERIALIZE_OK,
1185  static_cast<FwAssertArgType>(_status)
1186  );
1187 #endif
1188 
1189  _status = file_name.serializeTo(
1190  _logBuff,
1191  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 240)
1192  );
1193  FW_ASSERT(
1194  _status == Fw::FW_SERIALIZE_OK,
1195  static_cast<FwAssertArgType>(_status)
1196  );
1197 
1198 #if FW_AMPCS_COMPATIBLE
1199  // Serialize the argument size
1200  _status = _logBuff.serializeFrom(
1202  );
1203  FW_ASSERT(
1204  _status == Fw::FW_SERIALIZE_OK,
1205  static_cast<FwAssertArgType>(_status)
1206  );
1207 #endif
1208  _status = _logBuff.serializeFrom(file_type);
1209  FW_ASSERT(
1210  _status == Fw::FW_SERIALIZE_OK,
1211  static_cast<FwAssertArgType>(_status)
1212  );
1213 
1214  this->logOut_out(
1215  0,
1216  _id,
1217  _logTime,
1219  _logBuff
1220  );
1221  }
1222 
1223  // Emit the event on the text log port
1224 #if FW_ENABLE_TEXT_LOGGING
1225  if (this->isConnected_logTextOut_OutputPort(0)) {
1226 #if FW_OBJECT_NAMES == 1
1227  const char* _formatString =
1228  "(%s) %s: File %s dispatched to %s";
1229 #else
1230  const char* _formatString =
1231  "%s: File %s dispatched to %s";
1232 #endif
1233 
1234  Fw::String file_typeStr;
1235  file_type.toString(file_typeStr);
1236 
1237  Fw::TextLogString _logString;
1238  _logString.format(
1239  _formatString,
1240 #if FW_OBJECT_NAMES == 1
1241  this->m_objName.toChar(),
1242 #endif
1243  "FileDispatched ",
1244  file_name.toChar(),
1245  file_typeStr.toChar()
1246  );
1247 
1248  this->logTextOut_out(
1249  0,
1250  _id,
1251  _logTime,
1253  _logString
1254  );
1255  }
1256 #endif
1257  }
1258 
1259  // ----------------------------------------------------------------------
1260  // Time
1261  // ----------------------------------------------------------------------
1262 
1264  getTime() const
1265  {
1266  if (this->isConnected_timeCaller_OutputPort(0)) {
1267  Fw::Time _time;
1268  this->timeCaller_out(0, _time);
1269  return _time;
1270  }
1271  else {
1272  return Fw::Time(TimeBase::TB_NONE, 0, 0);
1273  }
1274  }
1275 
1276  // ----------------------------------------------------------------------
1277  // Message dispatch functions
1278  // ----------------------------------------------------------------------
1279 
1280  Fw::QueuedComponentBase::MsgDispatchStatus FileDispatcherComponentBase ::
1281  doDispatch()
1282  {
1283  ComponentIpcSerializableBuffer _msg;
1284  FwQueuePriorityType _priority = 0;
1285 
1286  Os::Queue::Status _msgStatus = this->m_queue.receive(
1287  _msg,
1289  _priority
1290  );
1291  FW_ASSERT(
1292  _msgStatus == Os::Queue::OP_OK,
1293  static_cast<FwAssertArgType>(_msgStatus)
1294  );
1295 
1296  // Reset to beginning of buffer
1297  _msg.resetDeser();
1298 
1299  FwEnumStoreType _desMsg = 0;
1300  Fw::SerializeStatus _deserStatus = _msg.deserializeTo(_desMsg);
1301  FW_ASSERT(
1302  _deserStatus == Fw::FW_SERIALIZE_OK,
1303  static_cast<FwAssertArgType>(_deserStatus)
1304  );
1305 
1306  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
1307 
1308  if (_msgType == FILEDISPATCHER_COMPONENT_EXIT) {
1309  return MSG_DISPATCH_EXIT;
1310  }
1311 
1312  FwIndexType portNum = 0;
1313  _deserStatus = _msg.deserializeTo(portNum);
1314  FW_ASSERT(
1315  _deserStatus == Fw::FW_SERIALIZE_OK,
1316  static_cast<FwAssertArgType>(_deserStatus)
1317  );
1318 
1319  switch (_msgType) {
1320  // Handle async input port fileAnnounceRecv
1321  case FILEANNOUNCERECV_FILEANNOUNCE: {
1322  // Deserialize argument file_name
1323  char __fprime_ac_file_name_buffer[Fw::StringBase::BUFFER_SIZE(static_cast<FwSizeType>(FW_FIXED_LENGTH_STRING_SIZE))];
1324  Fw::ExternalString file_name(__fprime_ac_file_name_buffer, sizeof __fprime_ac_file_name_buffer);
1325  _deserStatus = _msg.deserializeTo(file_name);
1326  FW_ASSERT(
1327  _deserStatus == Fw::FW_SERIALIZE_OK,
1328  static_cast<FwAssertArgType>(_deserStatus)
1329  );
1330  // Call handler function
1332  portNum,
1333  file_name
1334  );
1335 
1336  break;
1337  }
1338 
1339  // Handle async input port pingIn
1340  case PINGIN_PING: {
1341  // Deserialize argument key
1342  U32 key;
1343  _deserStatus = _msg.deserializeTo(key);
1344  FW_ASSERT(
1345  _deserStatus == Fw::FW_SERIALIZE_OK,
1346  static_cast<FwAssertArgType>(_deserStatus)
1347  );
1348  // Call handler function
1349  this->pingIn_handler(
1350  portNum,
1351  key
1352  );
1353 
1354  break;
1355  }
1356 
1357  // Handle command ENABLE_DISPATCH
1358  case CMD_ENABLE_DISPATCH: {
1359  // Deserialize opcode
1360  FwOpcodeType _opCode = 0;
1361  _deserStatus = _msg.deserializeTo(_opCode);
1362  FW_ASSERT (
1363  _deserStatus == Fw::FW_SERIALIZE_OK,
1364  static_cast<FwAssertArgType>(_deserStatus)
1365  );
1366 
1367  // Deserialize command sequence
1368  U32 _cmdSeq = 0;
1369  _deserStatus = _msg.deserializeTo(_cmdSeq);
1370  FW_ASSERT (
1371  _deserStatus == Fw::FW_SERIALIZE_OK,
1372  static_cast<FwAssertArgType>(_deserStatus)
1373  );
1374 
1375  // Deserialize command argument buffer
1376  Fw::CmdArgBuffer args;
1377  _deserStatus = _msg.deserializeTo(args);
1378  FW_ASSERT (
1379  _deserStatus == Fw::FW_SERIALIZE_OK,
1380  static_cast<FwAssertArgType>(_deserStatus)
1381  );
1382 
1383  // Reset buffer
1384  args.resetDeser();
1385 
1386  // Deserialize argument file_type
1388  _deserStatus = args.deserializeTo(file_type);
1389  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
1391  this->cmdResponse_out(
1392  _opCode,
1393  _cmdSeq,
1395  );
1396  }
1397  // Don't crash the task if bad arguments were passed from the ground
1398  break;
1399  }
1400 
1401  // Deserialize argument enable
1402  Fw::Enabled enable;
1403  _deserStatus = args.deserializeTo(enable);
1404  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
1406  this->cmdResponse_out(
1407  _opCode,
1408  _cmdSeq,
1410  );
1411  }
1412  // Don't crash the task if bad arguments were passed from the ground
1413  break;
1414  }
1415 
1416  // Make sure there was no data left over.
1417  // That means the argument buffer size was incorrect.
1418 #if FW_CMD_CHECK_RESIDUAL
1419  if (args.getDeserializeSizeLeft() != 0) {
1421  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
1422  }
1423  // Don't crash the task if bad arguments were passed from the ground
1424  break;
1425  }
1426 #endif
1427 
1428  // Call handler function
1430  _opCode, _cmdSeq,
1431  file_type,
1432  enable
1433  );
1434 
1435  break;
1436  }
1437 
1438  default:
1439  return MSG_DISPATCH_ERROR;
1440  }
1441 
1442  return MSG_DISPATCH_OK;
1443  }
1444 
1445  // ----------------------------------------------------------------------
1446  // Calls for messages received on special input ports
1447  // ----------------------------------------------------------------------
1448 
1449  void FileDispatcherComponentBase ::
1450  m_p_cmdIn_in(
1451  Fw::PassiveComponentBase* callComp,
1452  FwIndexType portNum,
1453  FwOpcodeType opCode,
1454  U32 cmdSeq,
1455  Fw::CmdArgBuffer& args
1456  )
1457  {
1458  FW_ASSERT(callComp);
1459  FileDispatcherComponentBase* compPtr = static_cast<FileDispatcherComponentBase*>(callComp);
1460  compPtr->cmdIn_handlerBase(
1461  portNum,
1462  opCode,
1463  cmdSeq,
1464  args
1465  );
1466  }
1467 
1468  // ----------------------------------------------------------------------
1469  // Calls for messages received on typed input ports
1470  // ----------------------------------------------------------------------
1471 
1472  void FileDispatcherComponentBase ::
1473  m_p_fileAnnounceRecv_in(
1474  Fw::PassiveComponentBase* callComp,
1475  FwIndexType portNum,
1476  Fw::StringBase& file_name
1477  )
1478  {
1479  FW_ASSERT(callComp);
1480  FileDispatcherComponentBase* compPtr = static_cast<FileDispatcherComponentBase*>(callComp);
1481  compPtr->fileAnnounceRecv_handlerBase(
1482  portNum,
1483  file_name
1484  );
1485  }
1486 
1487  void FileDispatcherComponentBase ::
1488  m_p_pingIn_in(
1489  Fw::PassiveComponentBase* callComp,
1490  FwIndexType portNum,
1491  U32 key
1492  )
1493  {
1494  FW_ASSERT(callComp);
1495  FileDispatcherComponentBase* compPtr = static_cast<FileDispatcherComponentBase*>(callComp);
1496  compPtr->pingIn_handlerBase(
1497  portNum,
1498  key
1499  );
1500  }
1501 
1502 #if !FW_DIRECT_PORT_CALLS
1503 
1504  // ----------------------------------------------------------------------
1505  // Invocation functions for special output ports
1506  // ----------------------------------------------------------------------
1507 
1508  void FileDispatcherComponentBase ::
1509  cmdRegOut_out(
1510  FwIndexType portNum,
1511  FwOpcodeType opCode
1512  ) const
1513  {
1514  FW_ASSERT(
1515  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
1516  static_cast<FwAssertArgType>(portNum)
1517  );
1518 
1519  FW_ASSERT(
1520  this->m_cmdRegOut_OutputPort[portNum].isConnected(),
1521  static_cast<FwAssertArgType>(portNum)
1522  );
1523  this->m_cmdRegOut_OutputPort[portNum].invoke(
1524  opCode
1525  );
1526  }
1527 
1528  void FileDispatcherComponentBase ::
1529  cmdResponseOut_out(
1530  FwIndexType portNum,
1531  FwOpcodeType opCode,
1532  U32 cmdSeq,
1533  const Fw::CmdResponse& response
1534  ) const
1535  {
1536  FW_ASSERT(
1537  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
1538  static_cast<FwAssertArgType>(portNum)
1539  );
1540 
1541  FW_ASSERT(
1542  this->m_cmdResponseOut_OutputPort[portNum].isConnected(),
1543  static_cast<FwAssertArgType>(portNum)
1544  );
1545  this->m_cmdResponseOut_OutputPort[portNum].invoke(
1546  opCode,
1547  cmdSeq,
1548  response
1549  );
1550  }
1551 
1552  void FileDispatcherComponentBase ::
1553  logOut_out(
1554  FwIndexType portNum,
1555  FwEventIdType id,
1556  Fw::Time& timeTag,
1557  const Fw::LogSeverity& severity,
1558  Fw::LogBuffer& args
1559  ) const
1560  {
1561  FW_ASSERT(
1562  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
1563  static_cast<FwAssertArgType>(portNum)
1564  );
1565 
1566  FW_ASSERT(
1567  this->m_logOut_OutputPort[portNum].isConnected(),
1568  static_cast<FwAssertArgType>(portNum)
1569  );
1570  this->m_logOut_OutputPort[portNum].invoke(
1571  id,
1572  timeTag,
1573  severity,
1574  args
1575  );
1576  }
1577 
1578 #if FW_ENABLE_TEXT_LOGGING
1579 
1580  void FileDispatcherComponentBase ::
1581  logTextOut_out(
1582  FwIndexType portNum,
1583  FwEventIdType id,
1584  Fw::Time& timeTag,
1585  const Fw::LogSeverity& severity,
1586  Fw::TextLogString& text
1587  ) const
1588  {
1589  FW_ASSERT(
1590  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
1591  static_cast<FwAssertArgType>(portNum)
1592  );
1593 
1594  FW_ASSERT(
1595  this->m_logTextOut_OutputPort[portNum].isConnected(),
1596  static_cast<FwAssertArgType>(portNum)
1597  );
1598  this->m_logTextOut_OutputPort[portNum].invoke(
1599  id,
1600  timeTag,
1601  severity,
1602  text
1603  );
1604  }
1605 
1606 #endif
1607 
1608  void FileDispatcherComponentBase ::
1609  timeCaller_out(
1610  FwIndexType portNum,
1611  Fw::Time& time
1612  ) const
1613  {
1614  FW_ASSERT(
1615  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
1616  static_cast<FwAssertArgType>(portNum)
1617  );
1618 
1619  FW_ASSERT(
1620  this->m_timeCaller_OutputPort[portNum].isConnected(),
1621  static_cast<FwAssertArgType>(portNum)
1622  );
1623  this->m_timeCaller_OutputPort[portNum].invoke(
1624  time
1625  );
1626  }
1627 
1628 #endif
1629 
1630 }
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
message to exit active component task
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
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
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
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
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.
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 log_ACTIVITY_HI_FileDispatchState(Svc::FileDispatcherCfg::FileDispatchPort file_type, Fw::Enabled enabled) const
Log event FileDispatchState.
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
static constexpr FwIndexType getNum_logOut_OutputPorts()
void init()
Initialization function.
Definition: PingPortAc.cpp:151
void invoke(Fw::Time &time) const
Invoke a port connection.
Definition: TimePortAc.cpp:170
Serializable::SizeType getDeserializeSizeLeft() const override
Get remaining deserialization buffer size.
static constexpr FwIndexType getNum_pingIn_InputPorts()
virtual void ENABLE_DISPATCH_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Svc::FileDispatcherCfg::FileDispatchPort file_type, Fw::Enabled enable)=0
Handler for command ENABLE_DISPATCH.
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke a port connection.
FwSizeType SizeType
void addCallPort(InputPingPort *callPort)
Register an input port.
Definition: PingPortAc.cpp:157
Status send(const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override
send a message into the queue through delegate
Definition: Queue.cpp:54
The size of the serial representation.
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:39
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.
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)
virtual ~FileDispatcherComponentBase()
Destroy FileDispatcherComponentBase object.
PlatformIndexType FwIndexType
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:186
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
SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG) override
Deserialize an 8-bit unsigned integer value.
U8 BYTE
byte type
Definition: BasicTypes.h:57
void 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].
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.
void log_ACTIVITY_HI_FileDispatched(const Fw::StringBase &file_name, Svc::FileDispatcherCfg::FileDispatchPort file_type) const
Log event FileDispatched.
#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.