F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
SeqDispatcherComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title SeqDispatcherComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for SeqDispatcher 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  SEQDISPATCHER_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT,
19  SEQDONEIN_CMDRESPONSE,
20  SEQRUNIN_CMDSEQIN,
21  SEQSTARTIN_CMDSEQIN,
22  CMD_RUN,
23  CMD_RUN_ARGS,
24  CMD_LOG_STATUS,
25  };
26 
27  // Get the max size by constructing a union of the async input, command, and
28  // internal port serialization sizes
29  union BuffUnion {
30  BYTE seqDoneInPortSize[Fw::CmdResponsePortBuffer::CAPACITY];
31  BYTE seqRunInPortSize[Svc::CmdSeqInPortBuffer::CAPACITY];
32  BYTE seqStartInPortSize[Svc::CmdSeqInPortBuffer::CAPACITY];
33  BYTE cmdPortSize[Fw::CmdPortBuffer::CAPACITY];
34  };
35 
36  // Define a message buffer class large enough to handle all the
37  // asynchronous inputs to the component
38  class ComponentIpcSerializableBuffer :
40  {
41 
42  public:
43 
44  enum {
45  // Offset into data in buffer: Size of message ID and port number
46  DATA_OFFSET = sizeof(FwEnumStoreType) + sizeof(FwIndexType),
47  // Max data size
48  MAX_DATA_SIZE = sizeof(BuffUnion),
49  // Max message size: Size of message id + size of port + max data size
50  SERIALIZATION_SIZE = DATA_OFFSET + MAX_DATA_SIZE
51  };
52 
53  Fw::Serializable::SizeType getCapacity() const {
54  return sizeof(m_buff);
55  }
56 
57  U8* getBuffAddr() {
58  return m_buff;
59  }
60 
61  const U8* getBuffAddr() const {
62  return m_buff;
63  }
64 
65  private:
66  // Should be the max of all the input ports serialized sizes...
67  U8 m_buff[SERIALIZATION_SIZE];
68 
69  };
70  }
71 
72  // ----------------------------------------------------------------------
73  // Component initialization
74  // ----------------------------------------------------------------------
75 
78  FwSizeType queueDepth,
79  FwEnumStoreType instance
80  )
81  {
82  // Initialize base class
84 
85 #if !FW_DIRECT_PORT_CALLS
86  // Connect input port cmdIn
87  for (
88  FwIndexType port = 0;
89  port < static_cast<FwIndexType>(this->getNum_cmdIn_InputPorts());
90  port++
91  ) {
92  this->m_cmdIn_InputPort[port].init();
93  this->m_cmdIn_InputPort[port].addCallComp(
94  this,
95  m_p_cmdIn_in
96  );
97  this->m_cmdIn_InputPort[port].setPortNum(port);
98 
99 #if FW_OBJECT_NAMES == 1
100  Fw::ObjectName portName;
101  portName.format(
102  "%s_cmdIn_InputPort[%" PRI_FwIndexType "]",
103  this->m_objName.toChar(),
104  port
105  );
106  this->m_cmdIn_InputPort[port].setObjName(portName.toChar());
107 #endif
108  }
109 #endif
110 
111 #if !FW_DIRECT_PORT_CALLS
112  // Connect input port seqDoneIn
113  for (
114  FwIndexType port = 0;
115  port < static_cast<FwIndexType>(this->getNum_seqDoneIn_InputPorts());
116  port++
117  ) {
118  this->m_seqDoneIn_InputPort[port].init();
119  this->m_seqDoneIn_InputPort[port].addCallComp(
120  this,
121  m_p_seqDoneIn_in
122  );
123  this->m_seqDoneIn_InputPort[port].setPortNum(port);
124 
125 #if FW_OBJECT_NAMES == 1
126  Fw::ObjectName portName;
127  portName.format(
128  "%s_seqDoneIn_InputPort[%" PRI_FwIndexType "]",
129  this->m_objName.toChar(),
130  port
131  );
132  this->m_seqDoneIn_InputPort[port].setObjName(portName.toChar());
133 #endif
134  }
135 #endif
136 
137 #if !FW_DIRECT_PORT_CALLS
138  // Connect input port seqRunIn
139  for (
140  FwIndexType port = 0;
141  port < static_cast<FwIndexType>(this->getNum_seqRunIn_InputPorts());
142  port++
143  ) {
144  this->m_seqRunIn_InputPort[port].init();
145  this->m_seqRunIn_InputPort[port].addCallComp(
146  this,
147  m_p_seqRunIn_in
148  );
149  this->m_seqRunIn_InputPort[port].setPortNum(port);
150 
151 #if FW_OBJECT_NAMES == 1
152  Fw::ObjectName portName;
153  portName.format(
154  "%s_seqRunIn_InputPort[%" PRI_FwIndexType "]",
155  this->m_objName.toChar(),
156  port
157  );
158  this->m_seqRunIn_InputPort[port].setObjName(portName.toChar());
159 #endif
160  }
161 #endif
162 
163 #if !FW_DIRECT_PORT_CALLS
164  // Connect input port seqStartIn
165  for (
166  FwIndexType port = 0;
167  port < static_cast<FwIndexType>(this->getNum_seqStartIn_InputPorts());
168  port++
169  ) {
170  this->m_seqStartIn_InputPort[port].init();
171  this->m_seqStartIn_InputPort[port].addCallComp(
172  this,
173  m_p_seqStartIn_in
174  );
175  this->m_seqStartIn_InputPort[port].setPortNum(port);
176 
177 #if FW_OBJECT_NAMES == 1
178  Fw::ObjectName portName;
179  portName.format(
180  "%s_seqStartIn_InputPort[%" PRI_FwIndexType "]",
181  this->m_objName.toChar(),
182  port
183  );
184  this->m_seqStartIn_InputPort[port].setObjName(portName.toChar());
185 #endif
186  }
187 #endif
188 
189 #if !FW_DIRECT_PORT_CALLS
190  // Connect output port cmdRegOut
191  for (
192  FwIndexType port = 0;
193  port < static_cast<FwIndexType>(this->getNum_cmdRegOut_OutputPorts());
194  port++
195  ) {
196  this->m_cmdRegOut_OutputPort[port].init();
197 
198 #if FW_OBJECT_NAMES == 1
199  Fw::ObjectName portName;
200  portName.format(
201  "%s_cmdRegOut_OutputPort[%" PRI_FwIndexType "]",
202  this->m_objName.toChar(),
203  port
204  );
205  this->m_cmdRegOut_OutputPort[port].setObjName(portName.toChar());
206 #endif
207  }
208 #endif
209 
210 #if !FW_DIRECT_PORT_CALLS
211  // Connect output port cmdResponseOut
212  for (
213  FwIndexType port = 0;
214  port < static_cast<FwIndexType>(this->getNum_cmdResponseOut_OutputPorts());
215  port++
216  ) {
217  this->m_cmdResponseOut_OutputPort[port].init();
218 
219 #if FW_OBJECT_NAMES == 1
220  Fw::ObjectName portName;
221  portName.format(
222  "%s_cmdResponseOut_OutputPort[%" PRI_FwIndexType "]",
223  this->m_objName.toChar(),
224  port
225  );
226  this->m_cmdResponseOut_OutputPort[port].setObjName(portName.toChar());
227 #endif
228  }
229 #endif
230 
231 #if !FW_DIRECT_PORT_CALLS
232  // Connect output port logOut
233  for (
234  FwIndexType port = 0;
235  port < static_cast<FwIndexType>(this->getNum_logOut_OutputPorts());
236  port++
237  ) {
238  this->m_logOut_OutputPort[port].init();
239 
240 #if FW_OBJECT_NAMES == 1
241  Fw::ObjectName portName;
242  portName.format(
243  "%s_logOut_OutputPort[%" PRI_FwIndexType "]",
244  this->m_objName.toChar(),
245  port
246  );
247  this->m_logOut_OutputPort[port].setObjName(portName.toChar());
248 #endif
249  }
250 #endif
251 
252 #if !FW_DIRECT_PORT_CALLS && FW_ENABLE_TEXT_LOGGING
253  // Connect output port logTextOut
254  for (
255  FwIndexType port = 0;
256  port < static_cast<FwIndexType>(this->getNum_logTextOut_OutputPorts());
257  port++
258  ) {
259  this->m_logTextOut_OutputPort[port].init();
260 
261 #if FW_OBJECT_NAMES == 1
262  Fw::ObjectName portName;
263  portName.format(
264  "%s_logTextOut_OutputPort[%" PRI_FwIndexType "]",
265  this->m_objName.toChar(),
266  port
267  );
268  this->m_logTextOut_OutputPort[port].setObjName(portName.toChar());
269 #endif
270  }
271 #endif
272 
273 #if !FW_DIRECT_PORT_CALLS
274  // Connect output port timeCaller
275  for (
276  FwIndexType port = 0;
277  port < static_cast<FwIndexType>(this->getNum_timeCaller_OutputPorts());
278  port++
279  ) {
280  this->m_timeCaller_OutputPort[port].init();
281 
282 #if FW_OBJECT_NAMES == 1
283  Fw::ObjectName portName;
284  portName.format(
285  "%s_timeCaller_OutputPort[%" PRI_FwIndexType "]",
286  this->m_objName.toChar(),
287  port
288  );
289  this->m_timeCaller_OutputPort[port].setObjName(portName.toChar());
290 #endif
291  }
292 #endif
293 
294 #if !FW_DIRECT_PORT_CALLS
295  // Connect output port tlmOut
296  for (
297  FwIndexType port = 0;
298  port < static_cast<FwIndexType>(this->getNum_tlmOut_OutputPorts());
299  port++
300  ) {
301  this->m_tlmOut_OutputPort[port].init();
302 
303 #if FW_OBJECT_NAMES == 1
304  Fw::ObjectName portName;
305  portName.format(
306  "%s_tlmOut_OutputPort[%" PRI_FwIndexType "]",
307  this->m_objName.toChar(),
308  port
309  );
310  this->m_tlmOut_OutputPort[port].setObjName(portName.toChar());
311 #endif
312  }
313 #endif
314 
315 #if !FW_DIRECT_PORT_CALLS
316  // Connect output port seqRunOut
317  for (
318  FwIndexType port = 0;
319  port < static_cast<FwIndexType>(this->getNum_seqRunOut_OutputPorts());
320  port++
321  ) {
322  this->m_seqRunOut_OutputPort[port].init();
323 
324 #if FW_OBJECT_NAMES == 1
325  Fw::ObjectName portName;
326  portName.format(
327  "%s_seqRunOut_OutputPort[%" PRI_FwIndexType "]",
328  this->m_objName.toChar(),
329  port
330  );
331  this->m_seqRunOut_OutputPort[port].setObjName(portName.toChar());
332 #endif
333  }
334 #endif
335 
336  // Create the queue
337  Os::Queue::Status qStat = this->createQueue(
338  queueDepth,
339  static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
340  );
341  FW_ASSERT(
342  Os::Queue::Status::OP_OK == qStat,
343  static_cast<FwAssertArgType>(qStat)
344  );
345  }
346 
347 #if !FW_DIRECT_PORT_CALLS
348 
349  // ----------------------------------------------------------------------
350  // Getters for special input ports
351  // ----------------------------------------------------------------------
352 
355  {
356  FW_ASSERT(
357  (0 <= portNum) && (portNum < this->getNum_cmdIn_InputPorts()),
358  static_cast<FwAssertArgType>(portNum)
359  );
360 
361  return &this->m_cmdIn_InputPort[portNum];
362  }
363 
364 #endif
365 
366 #if !FW_DIRECT_PORT_CALLS
367 
368  // ----------------------------------------------------------------------
369  // Getters for typed input ports
370  // ----------------------------------------------------------------------
371 
374  {
375  FW_ASSERT(
376  (0 <= portNum) && (portNum < this->getNum_seqDoneIn_InputPorts()),
377  static_cast<FwAssertArgType>(portNum)
378  );
379 
380  return &this->m_seqDoneIn_InputPort[portNum];
381  }
382 
385  {
386  FW_ASSERT(
387  (0 <= portNum) && (portNum < this->getNum_seqRunIn_InputPorts()),
388  static_cast<FwAssertArgType>(portNum)
389  );
390 
391  return &this->m_seqRunIn_InputPort[portNum];
392  }
393 
396  {
397  FW_ASSERT(
398  (0 <= portNum) && (portNum < this->getNum_seqStartIn_InputPorts()),
399  static_cast<FwAssertArgType>(portNum)
400  );
401 
402  return &this->m_seqStartIn_InputPort[portNum];
403  }
404 
405 #endif
406 
407 #if !FW_DIRECT_PORT_CALLS
408 
409  // ----------------------------------------------------------------------
410  // Connect input ports to special output ports
411  // ----------------------------------------------------------------------
412 
415  FwIndexType portNum,
416  Fw::InputCmdRegPort* port
417  )
418  {
419  FW_ASSERT(
420  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
421  static_cast<FwAssertArgType>(portNum)
422  );
423 
424  this->m_cmdRegOut_OutputPort[portNum].addCallPort(port);
425  }
426 
429  FwIndexType portNum,
431  )
432  {
433  FW_ASSERT(
434  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
435  static_cast<FwAssertArgType>(portNum)
436  );
437 
438  this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port);
439  }
440 
443  FwIndexType portNum,
444  Fw::InputLogPort* port
445  )
446  {
447  FW_ASSERT(
448  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
449  static_cast<FwAssertArgType>(portNum)
450  );
451 
452  this->m_logOut_OutputPort[portNum].addCallPort(port);
453  }
454 
455 #if FW_ENABLE_TEXT_LOGGING == 1
456 
457  void SeqDispatcherComponentBase ::
458  set_logTextOut_OutputPort(
459  FwIndexType portNum,
461  )
462  {
463  FW_ASSERT(
464  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
465  static_cast<FwAssertArgType>(portNum)
466  );
467 
468  this->m_logTextOut_OutputPort[portNum].addCallPort(port);
469  }
470 
471 #endif
472 
475  FwIndexType portNum,
476  Fw::InputTimePort* port
477  )
478  {
479  FW_ASSERT(
480  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
481  static_cast<FwAssertArgType>(portNum)
482  );
483 
484  this->m_timeCaller_OutputPort[portNum].addCallPort(port);
485  }
486 
489  FwIndexType portNum,
490  Fw::InputTlmPort* port
491  )
492  {
493  FW_ASSERT(
494  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
495  static_cast<FwAssertArgType>(portNum)
496  );
497 
498  this->m_tlmOut_OutputPort[portNum].addCallPort(port);
499  }
500 
501 #endif
502 
503 #if !FW_DIRECT_PORT_CALLS
504 
505  // ----------------------------------------------------------------------
506  // Connect typed input ports to typed output ports
507  // ----------------------------------------------------------------------
508 
511  FwIndexType portNum,
513  )
514  {
515  FW_ASSERT(
516  (0 <= portNum) && (portNum < this->getNum_seqRunOut_OutputPorts()),
517  static_cast<FwAssertArgType>(portNum)
518  );
519 
520  this->m_seqRunOut_OutputPort[portNum].addCallPort(port);
521  }
522 
523 #endif
524 
525 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
526 
527  // ----------------------------------------------------------------------
528  // Connect serial input ports to special output ports
529  // ----------------------------------------------------------------------
530 
533  FwIndexType portNum,
534  Fw::InputSerializePort* port
535  )
536  {
537  FW_ASSERT(
538  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
539  static_cast<FwAssertArgType>(portNum)
540  );
541 
542  this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port);
543  }
544 
547  FwIndexType portNum,
548  Fw::InputSerializePort* port
549  )
550  {
551  FW_ASSERT(
552  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
553  static_cast<FwAssertArgType>(portNum)
554  );
555 
556  this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port);
557  }
558 
561  FwIndexType portNum,
562  Fw::InputSerializePort* port
563  )
564  {
565  FW_ASSERT(
566  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
567  static_cast<FwAssertArgType>(portNum)
568  );
569 
570  this->m_logOut_OutputPort[portNum].registerSerialPort(port);
571  }
572 
573 #if FW_ENABLE_TEXT_LOGGING == 1
574 
575  void SeqDispatcherComponentBase ::
576  set_logTextOut_OutputPort(
577  FwIndexType portNum,
578  Fw::InputSerializePort* port
579  )
580  {
581  FW_ASSERT(
582  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
583  static_cast<FwAssertArgType>(portNum)
584  );
585 
586  this->m_logTextOut_OutputPort[portNum].registerSerialPort(port);
587  }
588 
589 #endif
590 
593  FwIndexType portNum,
594  Fw::InputSerializePort* port
595  )
596  {
597  FW_ASSERT(
598  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
599  static_cast<FwAssertArgType>(portNum)
600  );
601 
602  this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
603  }
604 
607  FwIndexType portNum,
608  Fw::InputSerializePort* port
609  )
610  {
611  FW_ASSERT(
612  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
613  static_cast<FwAssertArgType>(portNum)
614  );
615 
616  this->m_tlmOut_OutputPort[portNum].registerSerialPort(port);
617  }
618 
619 #endif
620 
621 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
622 
623  // ----------------------------------------------------------------------
624  // Connect serial input ports to typed output ports
625  // ----------------------------------------------------------------------
626 
629  FwIndexType portNum,
630  Fw::InputSerializePort* port
631  )
632  {
633  FW_ASSERT(
634  (0 <= portNum) && (portNum < this->getNum_seqRunOut_OutputPorts()),
635  static_cast<FwAssertArgType>(portNum)
636  );
637 
638  this->m_seqRunOut_OutputPort[portNum].registerSerialPort(port);
639  }
640 
641 #endif
642 
643  // ----------------------------------------------------------------------
644  // Command registration
645  // ----------------------------------------------------------------------
646 
649  {
651 
652  this->cmdRegOut_out(
653  0,
654  this->getIdBase() + OPCODE_RUN
655  );
656 
657  this->cmdRegOut_out(
658  0,
659  this->getIdBase() + OPCODE_RUN_ARGS
660  );
661 
662  this->cmdRegOut_out(
663  0,
664  this->getIdBase() + OPCODE_LOG_STATUS
665  );
666  }
667 
668  // ----------------------------------------------------------------------
669  // Component construction and destruction
670  // ----------------------------------------------------------------------
671 
673  SeqDispatcherComponentBase(const char* compName) :
674  Fw::ActiveComponentBase(compName)
675  {
676 
677  }
678 
681  {
682 
683  }
684 
685 #if !FW_DIRECT_PORT_CALLS
686 
687  // ----------------------------------------------------------------------
688  // Connection status queries for special output ports
689  // ----------------------------------------------------------------------
690 
693  {
694  FW_ASSERT(
695  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
696  static_cast<FwAssertArgType>(portNum)
697  );
698 
699  return this->m_cmdRegOut_OutputPort[portNum].isConnected();
700  }
701 
704  {
705  FW_ASSERT(
706  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
707  static_cast<FwAssertArgType>(portNum)
708  );
709 
710  return this->m_cmdResponseOut_OutputPort[portNum].isConnected();
711  }
712 
715  {
716  FW_ASSERT(
717  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
718  static_cast<FwAssertArgType>(portNum)
719  );
720 
721  return this->m_logOut_OutputPort[portNum].isConnected();
722  }
723 
724 #if FW_ENABLE_TEXT_LOGGING == 1
725 
726  bool SeqDispatcherComponentBase ::
727  isConnected_logTextOut_OutputPort(FwIndexType portNum) const
728  {
729  FW_ASSERT(
730  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
731  static_cast<FwAssertArgType>(portNum)
732  );
733 
734  return this->m_logTextOut_OutputPort[portNum].isConnected();
735  }
736 
737 #endif
738 
741  {
742  FW_ASSERT(
743  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
744  static_cast<FwAssertArgType>(portNum)
745  );
746 
747  return this->m_timeCaller_OutputPort[portNum].isConnected();
748  }
749 
752  {
753  FW_ASSERT(
754  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
755  static_cast<FwAssertArgType>(portNum)
756  );
757 
758  return this->m_tlmOut_OutputPort[portNum].isConnected();
759  }
760 
761 #endif
762 
763 #if !FW_DIRECT_PORT_CALLS
764 
765  // ----------------------------------------------------------------------
766  // Connection status queries for typed output ports
767  // ----------------------------------------------------------------------
768 
771  {
772  FW_ASSERT(
773  (0 <= portNum) && (portNum < this->getNum_seqRunOut_OutputPorts()),
774  static_cast<FwAssertArgType>(portNum)
775  );
776 
777  return this->m_seqRunOut_OutputPort[portNum].isConnected();
778  }
779 
780 #endif
781 
782  // ----------------------------------------------------------------------
783  // Port handler base-class functions for special input ports
784  //
785  // Call these functions directly to bypass the corresponding ports
786  // ----------------------------------------------------------------------
787 
790  FwIndexType portNum,
791  FwOpcodeType opCode,
792  U32 cmdSeq,
793  Fw::CmdArgBuffer& args
794  )
795  {
796 
797  const U32 idBase = this->getIdBase();
798  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
799 
800  // Select base class function based on opcode
801  switch (opCode - idBase) {
802  case OPCODE_RUN: {
803  this->RUN_cmdHandlerBase(
804  opCode,
805  cmdSeq,
806  args
807  );
808  break;
809  }
810 
811  case OPCODE_RUN_ARGS: {
813  opCode,
814  cmdSeq,
815  args
816  );
817  break;
818  }
819 
820  case OPCODE_LOG_STATUS: {
822  opCode,
823  cmdSeq,
824  args
825  );
826  break;
827  }
828  default:
829  // Unknown opcode: ignore it
830  break;
831  }
832  }
833 
834  // ----------------------------------------------------------------------
835  // Port handler base-class functions for typed input ports
836  //
837  // Call these functions directly to bypass the corresponding ports
838  // ----------------------------------------------------------------------
839 
842  FwIndexType portNum,
843  FwOpcodeType opCode,
844  U32 cmdSeq,
845  const Fw::CmdResponse& response
846  )
847  {
848  // Make sure port number is valid
849  FW_ASSERT(
850  (0 <= portNum) && (portNum < this->getNum_seqDoneIn_InputPorts()),
851  static_cast<FwAssertArgType>(portNum)
852  );
853 
854  // Call pre-message hook
856  portNum,
857  opCode,
858  cmdSeq,
859  response
860  );
861  ComponentIpcSerializableBuffer msg;
863 
864  // Serialize message ID
865  _status = msg.serializeFrom(
866  static_cast<FwEnumStoreType>(SEQDONEIN_CMDRESPONSE)
867  );
868  FW_ASSERT(
869  _status == Fw::FW_SERIALIZE_OK,
870  static_cast<FwAssertArgType>(_status)
871  );
872 
873  // Serialize port number
874  _status = msg.serializeFrom(portNum);
875  FW_ASSERT(
876  _status == Fw::FW_SERIALIZE_OK,
877  static_cast<FwAssertArgType>(_status)
878  );
879 
880  // Serialize argument opCode
881  _status = msg.serializeFrom(opCode);
882  FW_ASSERT(
883  _status == Fw::FW_SERIALIZE_OK,
884  static_cast<FwAssertArgType>(_status)
885  );
886 
887  // Serialize argument cmdSeq
888  _status = msg.serializeFrom(cmdSeq);
889  FW_ASSERT(
890  _status == Fw::FW_SERIALIZE_OK,
891  static_cast<FwAssertArgType>(_status)
892  );
893 
894  // Serialize argument response
895  _status = msg.serializeFrom(response);
896  FW_ASSERT(
897  _status == Fw::FW_SERIALIZE_OK,
898  static_cast<FwAssertArgType>(_status)
899  );
900 
901  // Send message
903  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
904 
905  FW_ASSERT(
906  qStatus == Os::Queue::OP_OK,
907  static_cast<FwAssertArgType>(qStatus)
908  );
909  }
910 
913  FwIndexType portNum,
914  const Fw::StringBase& filename,
915  const Svc::SeqArgs& args
916  )
917  {
918  // Make sure port number is valid
919  FW_ASSERT(
920  (0 <= portNum) && (portNum < this->getNum_seqRunIn_InputPorts()),
921  static_cast<FwAssertArgType>(portNum)
922  );
923 
924  // Call pre-message hook
926  portNum,
927  filename,
928  args
929  );
930  ComponentIpcSerializableBuffer msg;
932 
933  // Serialize message ID
934  _status = msg.serializeFrom(
935  static_cast<FwEnumStoreType>(SEQRUNIN_CMDSEQIN)
936  );
937  FW_ASSERT(
938  _status == Fw::FW_SERIALIZE_OK,
939  static_cast<FwAssertArgType>(_status)
940  );
941 
942  // Serialize port number
943  _status = msg.serializeFrom(portNum);
944  FW_ASSERT(
945  _status == Fw::FW_SERIALIZE_OK,
946  static_cast<FwAssertArgType>(_status)
947  );
948 
949  // Serialize argument filename
950  _status = filename.serializeTo(msg, 240);
951  FW_ASSERT(
952  _status == Fw::FW_SERIALIZE_OK,
953  static_cast<FwAssertArgType>(_status)
954  );
955 
956  // Serialize argument args
957  _status = msg.serializeFrom(args);
958  FW_ASSERT(
959  _status == Fw::FW_SERIALIZE_OK,
960  static_cast<FwAssertArgType>(_status)
961  );
962 
963  // Send message
965  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
966 
967  FW_ASSERT(
968  qStatus == Os::Queue::OP_OK,
969  static_cast<FwAssertArgType>(qStatus)
970  );
971  }
972 
975  FwIndexType portNum,
976  const Fw::StringBase& filename,
977  const Svc::SeqArgs& args
978  )
979  {
980  // Make sure port number is valid
981  FW_ASSERT(
982  (0 <= portNum) && (portNum < this->getNum_seqStartIn_InputPorts()),
983  static_cast<FwAssertArgType>(portNum)
984  );
985 
986  // Call pre-message hook
988  portNum,
989  filename,
990  args
991  );
992  ComponentIpcSerializableBuffer msg;
994 
995  // Serialize message ID
996  _status = msg.serializeFrom(
997  static_cast<FwEnumStoreType>(SEQSTARTIN_CMDSEQIN)
998  );
999  FW_ASSERT(
1000  _status == Fw::FW_SERIALIZE_OK,
1001  static_cast<FwAssertArgType>(_status)
1002  );
1003 
1004  // Serialize port number
1005  _status = msg.serializeFrom(portNum);
1006  FW_ASSERT(
1007  _status == Fw::FW_SERIALIZE_OK,
1008  static_cast<FwAssertArgType>(_status)
1009  );
1010 
1011  // Serialize argument filename
1012  _status = filename.serializeTo(msg, 240);
1013  FW_ASSERT(
1014  _status == Fw::FW_SERIALIZE_OK,
1015  static_cast<FwAssertArgType>(_status)
1016  );
1017 
1018  // Serialize argument args
1019  _status = msg.serializeFrom(args);
1020  FW_ASSERT(
1021  _status == Fw::FW_SERIALIZE_OK,
1022  static_cast<FwAssertArgType>(_status)
1023  );
1024 
1025  // Send message
1027  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1028 
1029  FW_ASSERT(
1030  qStatus == Os::Queue::OP_OK,
1031  static_cast<FwAssertArgType>(qStatus)
1032  );
1033  }
1034 
1035  // ----------------------------------------------------------------------
1036  // Pre-message hooks for typed async input ports
1037  //
1038  // Each of these functions is invoked just before processing a message
1039  // on the corresponding port. By default, they do nothing. You can
1040  // override them to provide specific pre-message behavior.
1041  // ----------------------------------------------------------------------
1042 
1045  FwIndexType portNum,
1046  FwOpcodeType opCode,
1047  U32 cmdSeq,
1048  const Fw::CmdResponse& response
1049  )
1050  {
1051  // Default: no-op
1052  }
1053 
1056  FwIndexType portNum,
1057  const Fw::StringBase& filename,
1058  const Svc::SeqArgs& args
1059  )
1060  {
1061  // Default: no-op
1062  }
1063 
1066  FwIndexType portNum,
1067  const Fw::StringBase& filename,
1068  const Svc::SeqArgs& args
1069  )
1070  {
1071  // Default: no-op
1072  }
1073 
1074 #if !FW_DIRECT_PORT_CALLS
1075 
1076  // ----------------------------------------------------------------------
1077  // Invocation functions for typed output ports
1078  // ----------------------------------------------------------------------
1079 
1082  FwIndexType portNum,
1083  const Fw::StringBase& filename,
1084  const Svc::SeqArgs& args
1085  ) const
1086  {
1087  FW_ASSERT(
1088  (0 <= portNum) && (portNum < this->getNum_seqRunOut_OutputPorts()),
1089  static_cast<FwAssertArgType>(portNum)
1090  );
1091 
1092  FW_ASSERT(
1093  this->m_seqRunOut_OutputPort[portNum].isConnected(),
1094  static_cast<FwAssertArgType>(portNum)
1095  );
1096  this->m_seqRunOut_OutputPort[portNum].invoke(
1097  filename,
1098  args
1099  );
1100  }
1101 
1102 #endif
1103 
1104  // ----------------------------------------------------------------------
1105  // Command response
1106  // ----------------------------------------------------------------------
1107 
1110  FwOpcodeType opCode,
1111  U32 cmdSeq,
1112  Fw::CmdResponse response
1113  )
1114  {
1116  this->cmdResponseOut_out(0, opCode, cmdSeq, response);
1117  }
1118 
1119  // ----------------------------------------------------------------------
1120  // Command handler base-class functions
1121  //
1122  // Call these functions directly to bypass the command input port
1123  // ----------------------------------------------------------------------
1124 
1127  FwOpcodeType opCode,
1128  U32 cmdSeq,
1129  Fw::CmdArgBuffer& args
1130  )
1131  {
1132  // Call pre-message hook
1133  this->RUN_preMsgHook(opCode,cmdSeq);
1134 
1135  // Defer deserializing arguments to the message dispatcher
1136  // to avoid deserializing and reserializing just for IPC
1137  ComponentIpcSerializableBuffer msg;
1139 
1140  // Serialize for IPC
1141  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_RUN));
1142  FW_ASSERT (
1143  _status == Fw::FW_SERIALIZE_OK,
1144  static_cast<FwAssertArgType>(_status)
1145  );
1146 
1147  // Fake port number to make message dequeue work
1148  FwIndexType port = 0;
1149 
1150  _status = msg.serializeFrom(port);
1151  FW_ASSERT (
1152  _status == Fw::FW_SERIALIZE_OK,
1153  static_cast<FwAssertArgType>(_status)
1154  );
1155 
1156  _status = msg.serializeFrom(opCode);
1157  FW_ASSERT (
1158  _status == Fw::FW_SERIALIZE_OK,
1159  static_cast<FwAssertArgType>(_status)
1160  );
1161 
1162  _status = msg.serializeFrom(cmdSeq);
1163  FW_ASSERT (
1164  _status == Fw::FW_SERIALIZE_OK,
1165  static_cast<FwAssertArgType>(_status)
1166  );
1167 
1168  _status = msg.serializeFrom(args);
1169  FW_ASSERT (
1170  _status == Fw::FW_SERIALIZE_OK,
1171  static_cast<FwAssertArgType>(_status)
1172  );
1173 
1174  // Send message
1176  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1177 
1178  FW_ASSERT(
1179  qStatus == Os::Queue::OP_OK,
1180  static_cast<FwAssertArgType>(qStatus)
1181  );
1182  }
1183 
1186  FwOpcodeType opCode,
1187  U32 cmdSeq,
1188  Fw::CmdArgBuffer& args
1189  )
1190  {
1191  // Call pre-message hook
1192  this->RUN_ARGS_preMsgHook(opCode,cmdSeq);
1193 
1194  // Defer deserializing arguments to the message dispatcher
1195  // to avoid deserializing and reserializing just for IPC
1196  ComponentIpcSerializableBuffer msg;
1198 
1199  // Serialize for IPC
1200  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_RUN_ARGS));
1201  FW_ASSERT (
1202  _status == Fw::FW_SERIALIZE_OK,
1203  static_cast<FwAssertArgType>(_status)
1204  );
1205 
1206  // Fake port number to make message dequeue work
1207  FwIndexType port = 0;
1208 
1209  _status = msg.serializeFrom(port);
1210  FW_ASSERT (
1211  _status == Fw::FW_SERIALIZE_OK,
1212  static_cast<FwAssertArgType>(_status)
1213  );
1214 
1215  _status = msg.serializeFrom(opCode);
1216  FW_ASSERT (
1217  _status == Fw::FW_SERIALIZE_OK,
1218  static_cast<FwAssertArgType>(_status)
1219  );
1220 
1221  _status = msg.serializeFrom(cmdSeq);
1222  FW_ASSERT (
1223  _status == Fw::FW_SERIALIZE_OK,
1224  static_cast<FwAssertArgType>(_status)
1225  );
1226 
1227  _status = msg.serializeFrom(args);
1228  FW_ASSERT (
1229  _status == Fw::FW_SERIALIZE_OK,
1230  static_cast<FwAssertArgType>(_status)
1231  );
1232 
1233  // Send message
1235  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1236 
1237  FW_ASSERT(
1238  qStatus == Os::Queue::OP_OK,
1239  static_cast<FwAssertArgType>(qStatus)
1240  );
1241  }
1242 
1245  FwOpcodeType opCode,
1246  U32 cmdSeq,
1247  Fw::CmdArgBuffer& args
1248  )
1249  {
1250  // Call pre-message hook
1251  this->LOG_STATUS_preMsgHook(opCode,cmdSeq);
1252 
1253  // Defer deserializing arguments to the message dispatcher
1254  // to avoid deserializing and reserializing just for IPC
1255  ComponentIpcSerializableBuffer msg;
1257 
1258  // Serialize for IPC
1259  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_LOG_STATUS));
1260  FW_ASSERT (
1261  _status == Fw::FW_SERIALIZE_OK,
1262  static_cast<FwAssertArgType>(_status)
1263  );
1264 
1265  // Fake port number to make message dequeue work
1266  FwIndexType port = 0;
1267 
1268  _status = msg.serializeFrom(port);
1269  FW_ASSERT (
1270  _status == Fw::FW_SERIALIZE_OK,
1271  static_cast<FwAssertArgType>(_status)
1272  );
1273 
1274  _status = msg.serializeFrom(opCode);
1275  FW_ASSERT (
1276  _status == Fw::FW_SERIALIZE_OK,
1277  static_cast<FwAssertArgType>(_status)
1278  );
1279 
1280  _status = msg.serializeFrom(cmdSeq);
1281  FW_ASSERT (
1282  _status == Fw::FW_SERIALIZE_OK,
1283  static_cast<FwAssertArgType>(_status)
1284  );
1285 
1286  _status = msg.serializeFrom(args);
1287  FW_ASSERT (
1288  _status == Fw::FW_SERIALIZE_OK,
1289  static_cast<FwAssertArgType>(_status)
1290  );
1291 
1292  // Send message
1294  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1295 
1296  FW_ASSERT(
1297  qStatus == Os::Queue::OP_OK,
1298  static_cast<FwAssertArgType>(qStatus)
1299  );
1300  }
1301 
1302  // ----------------------------------------------------------------------
1303  // Pre-message hooks for async commands
1304  //
1305  // Each of these functions is invoked just before processing the
1306  // corresponding command. By default they do nothing. You can
1307  // override them to provide specific pre-command behavior.
1308  // ----------------------------------------------------------------------
1309 
1312  FwOpcodeType opCode,
1313  U32 cmdSeq
1314  )
1315  {
1316  // Defaults to no-op; can be overridden
1317  (void) opCode;
1318  (void) cmdSeq;
1319  }
1320 
1323  FwOpcodeType opCode,
1324  U32 cmdSeq
1325  )
1326  {
1327  // Defaults to no-op; can be overridden
1328  (void) opCode;
1329  (void) cmdSeq;
1330  }
1331 
1334  FwOpcodeType opCode,
1335  U32 cmdSeq
1336  )
1337  {
1338  // Defaults to no-op; can be overridden
1339  (void) opCode;
1340  (void) cmdSeq;
1341  }
1342 
1343  // ----------------------------------------------------------------------
1344  // Event logging functions
1345  // ----------------------------------------------------------------------
1346 
1349  {
1350  // Get the time
1351  Fw::Time _logTime;
1352  if (this->isConnected_timeCaller_OutputPort(0)) {
1353  this->timeCaller_out(0, _logTime);
1354  }
1355 
1356  const FwEventIdType _id = this->getIdBase() + EVENTID_INVALIDSEQUENCER;
1357 
1358  // Emit the event on the log port
1359  if (this->isConnected_logOut_OutputPort(0)) {
1360  Fw::LogBuffer _logBuff;
1362 
1363 #if FW_AMPCS_COMPATIBLE
1364  // Serialize the number of arguments
1365  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1366  FW_ASSERT(
1367  _status == Fw::FW_SERIALIZE_OK,
1368  static_cast<FwAssertArgType>(_status)
1369  );
1370 #endif
1371 
1372 #if FW_AMPCS_COMPATIBLE
1373  // Serialize the argument size
1374  _status = _logBuff.serializeFrom(
1375  static_cast<U8>(sizeof(U16))
1376  );
1377  FW_ASSERT(
1378  _status == Fw::FW_SERIALIZE_OK,
1379  static_cast<FwAssertArgType>(_status)
1380  );
1381 #endif
1382  _status = _logBuff.serializeFrom(idx);
1383  FW_ASSERT(
1384  _status == Fw::FW_SERIALIZE_OK,
1385  static_cast<FwAssertArgType>(_status)
1386  );
1387 
1388  this->logOut_out(
1389  0,
1390  _id,
1391  _logTime,
1393  _logBuff
1394  );
1395  }
1396 
1397  // Emit the event on the text log port
1398 #if FW_ENABLE_TEXT_LOGGING
1399  if (this->isConnected_logTextOut_OutputPort(0)) {
1400 #if FW_OBJECT_NAMES == 1
1401  const char* _formatString =
1402  "(%s) %s: Invalid sequence index %" PRIu16 "";
1403 #else
1404  const char* _formatString =
1405  "%s: Invalid sequence index %" PRIu16 "";
1406 #endif
1407 
1408  Fw::TextLogString _logString;
1409  _logString.format(
1410  _formatString,
1411 #if FW_OBJECT_NAMES == 1
1412  this->m_objName.toChar(),
1413 #endif
1414  "InvalidSequencer ",
1415  idx
1416  );
1417 
1418  this->logTextOut_out(
1419  0,
1420  _id,
1421  _logTime,
1423  _logString
1424  );
1425  }
1426 #endif
1427  }
1428 
1431  {
1432  // Get the time
1433  Fw::Time _logTime;
1434  if (this->isConnected_timeCaller_OutputPort(0)) {
1435  this->timeCaller_out(0, _logTime);
1436  }
1437 
1439 
1440  // Emit the event on the log port
1441  if (this->isConnected_logOut_OutputPort(0)) {
1442  Fw::LogBuffer _logBuff;
1443 
1444 #if FW_AMPCS_COMPATIBLE
1446  // Serialize the number of arguments
1447  _status = _logBuff.serializeFrom(static_cast<U8>(0));
1448  FW_ASSERT(
1449  _status == Fw::FW_SERIALIZE_OK,
1450  static_cast<FwAssertArgType>(_status)
1451  );
1452 #endif
1453 
1454  this->logOut_out(
1455  0,
1456  _id,
1457  _logTime,
1459  _logBuff
1460  );
1461  }
1462 
1463  // Emit the event on the text log port
1464 #if FW_ENABLE_TEXT_LOGGING
1465  if (this->isConnected_logTextOut_OutputPort(0)) {
1466 #if FW_OBJECT_NAMES == 1
1467  const char* _formatString =
1468  "(%s) %s: No available cmd sequencers to dispatch a sequence to";
1469 #else
1470  const char* _formatString =
1471  "%s: No available cmd sequencers to dispatch a sequence to";
1472 #endif
1473 
1474  Fw::TextLogString _logString;
1475  _logString.format(
1476  _formatString,
1477 #if FW_OBJECT_NAMES == 1
1478  this->m_objName.toChar(),
1479 #endif
1480  "NoAvailableSequencers "
1481  );
1482 
1483  this->logTextOut_out(
1484  0,
1485  _id,
1486  _logTime,
1488  _logString
1489  );
1490  }
1491 #endif
1492  }
1493 
1496  {
1497  // Get the time
1498  Fw::Time _logTime;
1499  if (this->isConnected_timeCaller_OutputPort(0)) {
1500  this->timeCaller_out(0, _logTime);
1501  }
1502 
1504 
1505  // Emit the event on the log port
1506  if (this->isConnected_logOut_OutputPort(0)) {
1507  Fw::LogBuffer _logBuff;
1509 
1510 #if FW_AMPCS_COMPATIBLE
1511  // Serialize the number of arguments
1512  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1513  FW_ASSERT(
1514  _status == Fw::FW_SERIALIZE_OK,
1515  static_cast<FwAssertArgType>(_status)
1516  );
1517 #endif
1518 
1519 #if FW_AMPCS_COMPATIBLE
1520  // Serialize the argument size
1521  _status = _logBuff.serializeFrom(
1522  static_cast<U8>(sizeof(U16))
1523  );
1524  FW_ASSERT(
1525  _status == Fw::FW_SERIALIZE_OK,
1526  static_cast<FwAssertArgType>(_status)
1527  );
1528 #endif
1529  _status = _logBuff.serializeFrom(idx);
1530  FW_ASSERT(
1531  _status == Fw::FW_SERIALIZE_OK,
1532  static_cast<FwAssertArgType>(_status)
1533  );
1534 
1535  this->logOut_out(
1536  0,
1537  _id,
1538  _logTime,
1540  _logBuff
1541  );
1542  }
1543 
1544  // Emit the event on the text log port
1545 #if FW_ENABLE_TEXT_LOGGING
1546  if (this->isConnected_logTextOut_OutputPort(0)) {
1547 #if FW_OBJECT_NAMES == 1
1548  const char* _formatString =
1549  "(%s) %s: Sequencer %" PRIu16 " completed a sequence with no matching start notification";
1550 #else
1551  const char* _formatString =
1552  "%s: Sequencer %" PRIu16 " completed a sequence with no matching start notification";
1553 #endif
1554 
1555  Fw::TextLogString _logString;
1556  _logString.format(
1557  _formatString,
1558 #if FW_OBJECT_NAMES == 1
1559  this->m_objName.toChar(),
1560 #endif
1561  "UnknownSequenceFinished ",
1562  idx
1563  );
1564 
1565  this->logTextOut_out(
1566  0,
1567  _id,
1568  _logTime,
1570  _logString
1571  );
1572  }
1573 #endif
1574  }
1575 
1578  U16 idx,
1579  const Fw::StringBase& newSequence,
1580  const Fw::StringBase& sequenceInInternalState
1581  ) const
1582  {
1583  // Get the time
1584  Fw::Time _logTime;
1585  if (this->isConnected_timeCaller_OutputPort(0)) {
1586  this->timeCaller_out(0, _logTime);
1587  }
1588 
1590 
1591  // Emit the event on the log port
1592  if (this->isConnected_logOut_OutputPort(0)) {
1593  Fw::LogBuffer _logBuff;
1595 
1596 #if FW_AMPCS_COMPATIBLE
1597  // Serialize the number of arguments
1598  _status = _logBuff.serializeFrom(static_cast<U8>(3));
1599  FW_ASSERT(
1600  _status == Fw::FW_SERIALIZE_OK,
1601  static_cast<FwAssertArgType>(_status)
1602  );
1603 #endif
1604 
1605 #if FW_AMPCS_COMPATIBLE
1606  // Serialize the argument size
1607  _status = _logBuff.serializeFrom(
1608  static_cast<U8>(sizeof(U16))
1609  );
1610  FW_ASSERT(
1611  _status == Fw::FW_SERIALIZE_OK,
1612  static_cast<FwAssertArgType>(_status)
1613  );
1614 #endif
1615  _status = _logBuff.serializeFrom(idx);
1616  FW_ASSERT(
1617  _status == Fw::FW_SERIALIZE_OK,
1618  static_cast<FwAssertArgType>(_status)
1619  );
1620 
1621  _status = newSequence.serializeTo(
1622  _logBuff,
1623  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 240)
1624  );
1625  FW_ASSERT(
1626  _status == Fw::FW_SERIALIZE_OK,
1627  static_cast<FwAssertArgType>(_status)
1628  );
1629 
1630  _status = sequenceInInternalState.serializeTo(
1631  _logBuff,
1632  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 240)
1633  );
1634  FW_ASSERT(
1635  _status == Fw::FW_SERIALIZE_OK,
1636  static_cast<FwAssertArgType>(_status)
1637  );
1638 
1639  this->logOut_out(
1640  0,
1641  _id,
1642  _logTime,
1644  _logBuff
1645  );
1646  }
1647 
1648  // Emit the event on the text log port
1649 #if FW_ENABLE_TEXT_LOGGING
1650  if (this->isConnected_logTextOut_OutputPort(0)) {
1651 #if FW_OBJECT_NAMES == 1
1652  const char* _formatString =
1653  "(%s) %s: Sequencer %" PRIu16 " started a sequence %s while still running %s";
1654 #else
1655  const char* _formatString =
1656  "%s: Sequencer %" PRIu16 " started a sequence %s while still running %s";
1657 #endif
1658 
1659  Fw::TextLogString _logString;
1660  _logString.format(
1661  _formatString,
1662 #if FW_OBJECT_NAMES == 1
1663  this->m_objName.toChar(),
1664 #endif
1665  "ConflictingSequenceStarted ",
1666  idx,
1667  newSequence.toChar(),
1668  sequenceInInternalState.toChar()
1669  );
1670 
1671  this->logTextOut_out(
1672  0,
1673  _id,
1674  _logTime,
1676  _logString
1677  );
1678  }
1679 #endif
1680  }
1681 
1684  U16 idx,
1685  const Fw::StringBase& newSequence
1686  ) const
1687  {
1688  // Get the time
1689  Fw::Time _logTime;
1690  if (this->isConnected_timeCaller_OutputPort(0)) {
1691  this->timeCaller_out(0, _logTime);
1692  }
1693 
1695 
1696  // Emit the event on the log port
1697  if (this->isConnected_logOut_OutputPort(0)) {
1698  Fw::LogBuffer _logBuff;
1700 
1701 #if FW_AMPCS_COMPATIBLE
1702  // Serialize the number of arguments
1703  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1704  FW_ASSERT(
1705  _status == Fw::FW_SERIALIZE_OK,
1706  static_cast<FwAssertArgType>(_status)
1707  );
1708 #endif
1709 
1710 #if FW_AMPCS_COMPATIBLE
1711  // Serialize the argument size
1712  _status = _logBuff.serializeFrom(
1713  static_cast<U8>(sizeof(U16))
1714  );
1715  FW_ASSERT(
1716  _status == Fw::FW_SERIALIZE_OK,
1717  static_cast<FwAssertArgType>(_status)
1718  );
1719 #endif
1720  _status = _logBuff.serializeFrom(idx);
1721  FW_ASSERT(
1722  _status == Fw::FW_SERIALIZE_OK,
1723  static_cast<FwAssertArgType>(_status)
1724  );
1725 
1726  _status = newSequence.serializeTo(
1727  _logBuff,
1728  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 240)
1729  );
1730  FW_ASSERT(
1731  _status == Fw::FW_SERIALIZE_OK,
1732  static_cast<FwAssertArgType>(_status)
1733  );
1734 
1735  this->logOut_out(
1736  0,
1737  _id,
1738  _logTime,
1740  _logBuff
1741  );
1742  }
1743 
1744  // Emit the event on the text log port
1745 #if FW_ENABLE_TEXT_LOGGING
1746  if (this->isConnected_logTextOut_OutputPort(0)) {
1747 #if FW_OBJECT_NAMES == 1
1748  const char* _formatString =
1749  "(%s) %s: Sequencer %" PRIu16 " was externally commanded to start a sequence %s";
1750 #else
1751  const char* _formatString =
1752  "%s: Sequencer %" PRIu16 " was externally commanded to start a sequence %s";
1753 #endif
1754 
1755  Fw::TextLogString _logString;
1756  _logString.format(
1757  _formatString,
1758 #if FW_OBJECT_NAMES == 1
1759  this->m_objName.toChar(),
1760 #endif
1761  "UnexpectedSequenceStarted ",
1762  idx,
1763  newSequence.toChar()
1764  );
1765 
1766  this->logTextOut_out(
1767  0,
1768  _id,
1769  _logTime,
1771  _logString
1772  );
1773  }
1774 #endif
1775  }
1776 
1779  U16 idx,
1781  const Fw::StringBase& filename
1782  ) const
1783  {
1784  // Get the time
1785  Fw::Time _logTime;
1786  if (this->isConnected_timeCaller_OutputPort(0)) {
1787  this->timeCaller_out(0, _logTime);
1788  }
1789 
1790  const FwEventIdType _id = this->getIdBase() + EVENTID_LOGSEQUENCERSTATUS;
1791 
1792  // Emit the event on the log port
1793  if (this->isConnected_logOut_OutputPort(0)) {
1794  Fw::LogBuffer _logBuff;
1796 
1797 #if FW_AMPCS_COMPATIBLE
1798  // Serialize the number of arguments
1799  _status = _logBuff.serializeFrom(static_cast<U8>(3));
1800  FW_ASSERT(
1801  _status == Fw::FW_SERIALIZE_OK,
1802  static_cast<FwAssertArgType>(_status)
1803  );
1804 #endif
1805 
1806 #if FW_AMPCS_COMPATIBLE
1807  // Serialize the argument size
1808  _status = _logBuff.serializeFrom(
1809  static_cast<U8>(sizeof(U16))
1810  );
1811  FW_ASSERT(
1812  _status == Fw::FW_SERIALIZE_OK,
1813  static_cast<FwAssertArgType>(_status)
1814  );
1815 #endif
1816  _status = _logBuff.serializeFrom(idx);
1817  FW_ASSERT(
1818  _status == Fw::FW_SERIALIZE_OK,
1819  static_cast<FwAssertArgType>(_status)
1820  );
1821 
1822 #if FW_AMPCS_COMPATIBLE
1823  // Serialize the argument size
1824  _status = _logBuff.serializeFrom(
1826  );
1827  FW_ASSERT(
1828  _status == Fw::FW_SERIALIZE_OK,
1829  static_cast<FwAssertArgType>(_status)
1830  );
1831 #endif
1832  _status = _logBuff.serializeFrom(state);
1833  FW_ASSERT(
1834  _status == Fw::FW_SERIALIZE_OK,
1835  static_cast<FwAssertArgType>(_status)
1836  );
1837 
1838  _status = filename.serializeTo(
1839  _logBuff,
1840  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 240)
1841  );
1842  FW_ASSERT(
1843  _status == Fw::FW_SERIALIZE_OK,
1844  static_cast<FwAssertArgType>(_status)
1845  );
1846 
1847  this->logOut_out(
1848  0,
1849  _id,
1850  _logTime,
1852  _logBuff
1853  );
1854  }
1855 
1856  // Emit the event on the text log port
1857 #if FW_ENABLE_TEXT_LOGGING
1858  if (this->isConnected_logTextOut_OutputPort(0)) {
1859 #if FW_OBJECT_NAMES == 1
1860  const char* _formatString =
1861  "(%s) %s: Sequencer %" PRIu16 " with state %s is running file %s";
1862 #else
1863  const char* _formatString =
1864  "%s: Sequencer %" PRIu16 " with state %s is running file %s";
1865 #endif
1866 
1867  Fw::String stateStr;
1868  state.toString(stateStr);
1869 
1870  Fw::TextLogString _logString;
1871  _logString.format(
1872  _formatString,
1873 #if FW_OBJECT_NAMES == 1
1874  this->m_objName.toChar(),
1875 #endif
1876  "LogSequencerStatus ",
1877  idx,
1878  stateStr.toChar(),
1879  filename.toChar()
1880  );
1881 
1882  this->logTextOut_out(
1883  0,
1884  _id,
1885  _logTime,
1887  _logString
1888  );
1889  }
1890 #endif
1891  }
1892 
1893  // ----------------------------------------------------------------------
1894  // Telemetry serialized write
1895  // ----------------------------------------------------------------------
1896 
1899  FwChanIdType id,
1900  Fw::TlmBuffer& _tlmBuff,
1901  Fw::Time _tlmTime
1902  ) const
1903  {
1904  if (this->isConnected_tlmOut_OutputPort(0)) {
1905  if (
1907  (_tlmTime == Fw::ZERO_TIME)
1908  ) {
1909  this->timeCaller_out(0, _tlmTime);
1910  }
1911 
1912  FwChanIdType _id;
1913  _id = this->getIdBase() + id;
1914 
1915  this->tlmOut_out(
1916  0,
1917  _id,
1918  _tlmTime,
1919  _tlmBuff
1920  );
1921  }
1922  }
1923 
1924  // ----------------------------------------------------------------------
1925  // Telemetry write functions
1926  // ----------------------------------------------------------------------
1927 
1930  U32 arg,
1931  Fw::Time _tlmTime
1932  ) const
1933  {
1934  if (this->isConnected_tlmOut_OutputPort(0)) {
1935  Fw::TlmBuffer _tlmBuff;
1936  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1937  FW_ASSERT(
1938  _stat == Fw::FW_SERIALIZE_OK,
1939  static_cast<FwAssertArgType>(_stat)
1940  );
1941 
1942  this->tlmWrite(
1944  _tlmBuff,
1945  _tlmTime
1946  );
1947  }
1948  }
1949 
1952  U32 arg,
1953  Fw::Time _tlmTime
1954  ) const
1955  {
1956  if (this->isConnected_tlmOut_OutputPort(0)) {
1957  Fw::TlmBuffer _tlmBuff;
1958  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1959  FW_ASSERT(
1960  _stat == Fw::FW_SERIALIZE_OK,
1961  static_cast<FwAssertArgType>(_stat)
1962  );
1963 
1964  this->tlmWrite(
1966  _tlmBuff,
1967  _tlmTime
1968  );
1969  }
1970  }
1971 
1974  U32 arg,
1975  Fw::Time _tlmTime
1976  ) const
1977  {
1978  if (this->isConnected_tlmOut_OutputPort(0)) {
1979  Fw::TlmBuffer _tlmBuff;
1980  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1981  FW_ASSERT(
1982  _stat == Fw::FW_SERIALIZE_OK,
1983  static_cast<FwAssertArgType>(_stat)
1984  );
1985 
1986  this->tlmWrite(
1988  _tlmBuff,
1989  _tlmTime
1990  );
1991  }
1992  }
1993 
1994  // ----------------------------------------------------------------------
1995  // Time
1996  // ----------------------------------------------------------------------
1997 
1999  getTime() const
2000  {
2001  if (this->isConnected_timeCaller_OutputPort(0)) {
2002  Fw::Time _time;
2003  this->timeCaller_out(0, _time);
2004  return _time;
2005  }
2006  else {
2007  return Fw::Time(TimeBase::TB_NONE, 0, 0);
2008  }
2009  }
2010 
2011  // ----------------------------------------------------------------------
2012  // Message dispatch functions
2013  // ----------------------------------------------------------------------
2014 
2015  Fw::QueuedComponentBase::MsgDispatchStatus SeqDispatcherComponentBase ::
2016  doDispatch()
2017  {
2018  ComponentIpcSerializableBuffer _msg;
2019  FwQueuePriorityType _priority = 0;
2020 
2021  Os::Queue::Status _msgStatus = this->m_queue.receive(
2022  _msg,
2024  _priority
2025  );
2026  FW_ASSERT(
2027  _msgStatus == Os::Queue::OP_OK,
2028  static_cast<FwAssertArgType>(_msgStatus)
2029  );
2030 
2031  // Reset to beginning of buffer
2032  _msg.resetDeser();
2033 
2034  FwEnumStoreType _desMsg = 0;
2035  Fw::SerializeStatus _deserStatus = _msg.deserializeTo(_desMsg);
2036  FW_ASSERT(
2037  _deserStatus == Fw::FW_SERIALIZE_OK,
2038  static_cast<FwAssertArgType>(_deserStatus)
2039  );
2040 
2041  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
2042 
2043  if (_msgType == SEQDISPATCHER_COMPONENT_EXIT) {
2044  return MSG_DISPATCH_EXIT;
2045  }
2046 
2047  FwIndexType portNum = 0;
2048  _deserStatus = _msg.deserializeTo(portNum);
2049  FW_ASSERT(
2050  _deserStatus == Fw::FW_SERIALIZE_OK,
2051  static_cast<FwAssertArgType>(_deserStatus)
2052  );
2053 
2054  switch (_msgType) {
2055  // Handle async input port seqDoneIn
2056  case SEQDONEIN_CMDRESPONSE: {
2057  // Deserialize argument opCode
2058  FwOpcodeType opCode;
2059  _deserStatus = _msg.deserializeTo(opCode);
2060  FW_ASSERT(
2061  _deserStatus == Fw::FW_SERIALIZE_OK,
2062  static_cast<FwAssertArgType>(_deserStatus)
2063  );
2064 
2065  // Deserialize argument cmdSeq
2066  U32 cmdSeq;
2067  _deserStatus = _msg.deserializeTo(cmdSeq);
2068  FW_ASSERT(
2069  _deserStatus == Fw::FW_SERIALIZE_OK,
2070  static_cast<FwAssertArgType>(_deserStatus)
2071  );
2072 
2073  // Deserialize argument response
2074  Fw::CmdResponse response;
2075  _deserStatus = _msg.deserializeTo(response);
2076  FW_ASSERT(
2077  _deserStatus == Fw::FW_SERIALIZE_OK,
2078  static_cast<FwAssertArgType>(_deserStatus)
2079  );
2080  // Call handler function
2081  this->seqDoneIn_handler(
2082  portNum,
2083  opCode,
2084  cmdSeq,
2085  response
2086  );
2087 
2088  break;
2089  }
2090 
2091  // Handle async input port seqRunIn
2092  case SEQRUNIN_CMDSEQIN: {
2093  // Deserialize argument filename
2094  char __fprime_ac_filename_buffer[Fw::StringBase::BUFFER_SIZE(240)];
2095  Fw::ExternalString filename(__fprime_ac_filename_buffer, sizeof __fprime_ac_filename_buffer);
2096  _deserStatus = _msg.deserializeTo(filename);
2097  FW_ASSERT(
2098  _deserStatus == Fw::FW_SERIALIZE_OK,
2099  static_cast<FwAssertArgType>(_deserStatus)
2100  );
2101 
2102  // Deserialize argument args
2103  Svc::SeqArgs args;
2104  _deserStatus = _msg.deserializeTo(args);
2105  FW_ASSERT(
2106  _deserStatus == Fw::FW_SERIALIZE_OK,
2107  static_cast<FwAssertArgType>(_deserStatus)
2108  );
2109  // Call handler function
2110  this->seqRunIn_handler(
2111  portNum,
2112  filename,
2113  args
2114  );
2115 
2116  break;
2117  }
2118 
2119  // Handle async input port seqStartIn
2120  case SEQSTARTIN_CMDSEQIN: {
2121  // Deserialize argument filename
2122  char __fprime_ac_filename_buffer[Fw::StringBase::BUFFER_SIZE(240)];
2123  Fw::ExternalString filename(__fprime_ac_filename_buffer, sizeof __fprime_ac_filename_buffer);
2124  _deserStatus = _msg.deserializeTo(filename);
2125  FW_ASSERT(
2126  _deserStatus == Fw::FW_SERIALIZE_OK,
2127  static_cast<FwAssertArgType>(_deserStatus)
2128  );
2129 
2130  // Deserialize argument args
2131  Svc::SeqArgs args;
2132  _deserStatus = _msg.deserializeTo(args);
2133  FW_ASSERT(
2134  _deserStatus == Fw::FW_SERIALIZE_OK,
2135  static_cast<FwAssertArgType>(_deserStatus)
2136  );
2137  // Call handler function
2138  this->seqStartIn_handler(
2139  portNum,
2140  filename,
2141  args
2142  );
2143 
2144  break;
2145  }
2146 
2147  // Handle command RUN
2148  case CMD_RUN: {
2149  // Deserialize opcode
2150  FwOpcodeType _opCode = 0;
2151  _deserStatus = _msg.deserializeTo(_opCode);
2152  FW_ASSERT (
2153  _deserStatus == Fw::FW_SERIALIZE_OK,
2154  static_cast<FwAssertArgType>(_deserStatus)
2155  );
2156 
2157  // Deserialize command sequence
2158  U32 _cmdSeq = 0;
2159  _deserStatus = _msg.deserializeTo(_cmdSeq);
2160  FW_ASSERT (
2161  _deserStatus == Fw::FW_SERIALIZE_OK,
2162  static_cast<FwAssertArgType>(_deserStatus)
2163  );
2164 
2165  // Deserialize command argument buffer
2166  Fw::CmdArgBuffer args;
2167  _deserStatus = _msg.deserializeTo(args);
2168  FW_ASSERT (
2169  _deserStatus == Fw::FW_SERIALIZE_OK,
2170  static_cast<FwAssertArgType>(_deserStatus)
2171  );
2172 
2173  // Reset buffer
2174  args.resetDeser();
2175 
2176  // Deserialize argument fileName
2177  Fw::CmdStringArg fileName;
2178  _deserStatus = args.deserializeTo(fileName);
2179  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2181  this->cmdResponse_out(
2182  _opCode,
2183  _cmdSeq,
2185  );
2186  }
2187  // Don't crash the task if bad arguments were passed from the ground
2188  break;
2189  }
2190 
2191  // Deserialize argument block
2192  Fw::Wait block;
2193  _deserStatus = args.deserializeTo(block);
2194  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2196  this->cmdResponse_out(
2197  _opCode,
2198  _cmdSeq,
2200  );
2201  }
2202  // Don't crash the task if bad arguments were passed from the ground
2203  break;
2204  }
2205 
2206  // Make sure there was no data left over.
2207  // That means the argument buffer size was incorrect.
2208 #if FW_CMD_CHECK_RESIDUAL
2209  if (args.getDeserializeSizeLeft() != 0) {
2211  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2212  }
2213  // Don't crash the task if bad arguments were passed from the ground
2214  break;
2215  }
2216 #endif
2217 
2218  // Call handler function
2219  this->RUN_cmdHandler(
2220  _opCode, _cmdSeq,
2221  fileName,
2222  block
2223  );
2224 
2225  break;
2226  }
2227 
2228  // Handle command RUN_ARGS
2229  case CMD_RUN_ARGS: {
2230  // Deserialize opcode
2231  FwOpcodeType _opCode = 0;
2232  _deserStatus = _msg.deserializeTo(_opCode);
2233  FW_ASSERT (
2234  _deserStatus == Fw::FW_SERIALIZE_OK,
2235  static_cast<FwAssertArgType>(_deserStatus)
2236  );
2237 
2238  // Deserialize command sequence
2239  U32 _cmdSeq = 0;
2240  _deserStatus = _msg.deserializeTo(_cmdSeq);
2241  FW_ASSERT (
2242  _deserStatus == Fw::FW_SERIALIZE_OK,
2243  static_cast<FwAssertArgType>(_deserStatus)
2244  );
2245 
2246  // Deserialize command argument buffer
2247  Fw::CmdArgBuffer args;
2248  _deserStatus = _msg.deserializeTo(args);
2249  FW_ASSERT (
2250  _deserStatus == Fw::FW_SERIALIZE_OK,
2251  static_cast<FwAssertArgType>(_deserStatus)
2252  );
2253 
2254  // Reset buffer
2255  args.resetDeser();
2256 
2257  // Deserialize argument fileName
2258  Fw::CmdStringArg fileName;
2259  _deserStatus = args.deserializeTo(fileName);
2260  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2262  this->cmdResponse_out(
2263  _opCode,
2264  _cmdSeq,
2266  );
2267  }
2268  // Don't crash the task if bad arguments were passed from the ground
2269  break;
2270  }
2271 
2272  // Deserialize argument block
2273  Fw::Wait block;
2274  _deserStatus = args.deserializeTo(block);
2275  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2277  this->cmdResponse_out(
2278  _opCode,
2279  _cmdSeq,
2281  );
2282  }
2283  // Don't crash the task if bad arguments were passed from the ground
2284  break;
2285  }
2286 
2287  // Deserialize argument buffer
2288  Svc::SeqArgs buffer;
2289  _deserStatus = args.deserializeTo(buffer);
2290  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2292  this->cmdResponse_out(
2293  _opCode,
2294  _cmdSeq,
2296  );
2297  }
2298  // Don't crash the task if bad arguments were passed from the ground
2299  break;
2300  }
2301 
2302  // Make sure there was no data left over.
2303  // That means the argument buffer size was incorrect.
2304 #if FW_CMD_CHECK_RESIDUAL
2305  if (args.getDeserializeSizeLeft() != 0) {
2307  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2308  }
2309  // Don't crash the task if bad arguments were passed from the ground
2310  break;
2311  }
2312 #endif
2313 
2314  // Call handler function
2315  this->RUN_ARGS_cmdHandler(
2316  _opCode, _cmdSeq,
2317  fileName,
2318  block,
2319  buffer
2320  );
2321 
2322  break;
2323  }
2324 
2325  // Handle command LOG_STATUS
2326  case CMD_LOG_STATUS: {
2327  // Deserialize opcode
2328  FwOpcodeType _opCode = 0;
2329  _deserStatus = _msg.deserializeTo(_opCode);
2330  FW_ASSERT (
2331  _deserStatus == Fw::FW_SERIALIZE_OK,
2332  static_cast<FwAssertArgType>(_deserStatus)
2333  );
2334 
2335  // Deserialize command sequence
2336  U32 _cmdSeq = 0;
2337  _deserStatus = _msg.deserializeTo(_cmdSeq);
2338  FW_ASSERT (
2339  _deserStatus == Fw::FW_SERIALIZE_OK,
2340  static_cast<FwAssertArgType>(_deserStatus)
2341  );
2342 
2343  // Deserialize command argument buffer
2344  Fw::CmdArgBuffer args;
2345  _deserStatus = _msg.deserializeTo(args);
2346  FW_ASSERT (
2347  _deserStatus == Fw::FW_SERIALIZE_OK,
2348  static_cast<FwAssertArgType>(_deserStatus)
2349  );
2350 
2351  // Reset buffer
2352  args.resetDeser();
2353 
2354  // Make sure there was no data left over.
2355  // That means the argument buffer size was incorrect.
2356 #if FW_CMD_CHECK_RESIDUAL
2357  if (args.getDeserializeSizeLeft() != 0) {
2359  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2360  }
2361  // Don't crash the task if bad arguments were passed from the ground
2362  break;
2363  }
2364 #endif
2365 
2366  // Call handler function
2367  this->LOG_STATUS_cmdHandler(_opCode, _cmdSeq);
2368 
2369  break;
2370  }
2371 
2372  default:
2373  return MSG_DISPATCH_ERROR;
2374  }
2375 
2376  return MSG_DISPATCH_OK;
2377  }
2378 
2379  // ----------------------------------------------------------------------
2380  // Calls for messages received on special input ports
2381  // ----------------------------------------------------------------------
2382 
2383  void SeqDispatcherComponentBase ::
2384  m_p_cmdIn_in(
2385  Fw::PassiveComponentBase* callComp,
2386  FwIndexType portNum,
2387  FwOpcodeType opCode,
2388  U32 cmdSeq,
2389  Fw::CmdArgBuffer& args
2390  )
2391  {
2392  FW_ASSERT(callComp);
2393  SeqDispatcherComponentBase* compPtr = static_cast<SeqDispatcherComponentBase*>(callComp);
2394  compPtr->cmdIn_handlerBase(
2395  portNum,
2396  opCode,
2397  cmdSeq,
2398  args
2399  );
2400  }
2401 
2402  // ----------------------------------------------------------------------
2403  // Calls for messages received on typed input ports
2404  // ----------------------------------------------------------------------
2405 
2406  void SeqDispatcherComponentBase ::
2407  m_p_seqDoneIn_in(
2408  Fw::PassiveComponentBase* callComp,
2409  FwIndexType portNum,
2410  FwOpcodeType opCode,
2411  U32 cmdSeq,
2412  const Fw::CmdResponse& response
2413  )
2414  {
2415  FW_ASSERT(callComp);
2416  SeqDispatcherComponentBase* compPtr = static_cast<SeqDispatcherComponentBase*>(callComp);
2417  compPtr->seqDoneIn_handlerBase(
2418  portNum,
2419  opCode,
2420  cmdSeq,
2421  response
2422  );
2423  }
2424 
2425  void SeqDispatcherComponentBase ::
2426  m_p_seqRunIn_in(
2427  Fw::PassiveComponentBase* callComp,
2428  FwIndexType portNum,
2429  const Fw::StringBase& filename,
2430  const Svc::SeqArgs& args
2431  )
2432  {
2433  FW_ASSERT(callComp);
2434  SeqDispatcherComponentBase* compPtr = static_cast<SeqDispatcherComponentBase*>(callComp);
2435  compPtr->seqRunIn_handlerBase(
2436  portNum,
2437  filename,
2438  args
2439  );
2440  }
2441 
2442  void SeqDispatcherComponentBase ::
2443  m_p_seqStartIn_in(
2444  Fw::PassiveComponentBase* callComp,
2445  FwIndexType portNum,
2446  const Fw::StringBase& filename,
2447  const Svc::SeqArgs& args
2448  )
2449  {
2450  FW_ASSERT(callComp);
2451  SeqDispatcherComponentBase* compPtr = static_cast<SeqDispatcherComponentBase*>(callComp);
2452  compPtr->seqStartIn_handlerBase(
2453  portNum,
2454  filename,
2455  args
2456  );
2457  }
2458 
2459 #if !FW_DIRECT_PORT_CALLS
2460 
2461  // ----------------------------------------------------------------------
2462  // Invocation functions for special output ports
2463  // ----------------------------------------------------------------------
2464 
2465  void SeqDispatcherComponentBase ::
2466  cmdRegOut_out(
2467  FwIndexType portNum,
2468  FwOpcodeType opCode
2469  ) const
2470  {
2471  FW_ASSERT(
2472  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
2473  static_cast<FwAssertArgType>(portNum)
2474  );
2475 
2476  FW_ASSERT(
2477  this->m_cmdRegOut_OutputPort[portNum].isConnected(),
2478  static_cast<FwAssertArgType>(portNum)
2479  );
2480  this->m_cmdRegOut_OutputPort[portNum].invoke(
2481  opCode
2482  );
2483  }
2484 
2485  void SeqDispatcherComponentBase ::
2486  cmdResponseOut_out(
2487  FwIndexType portNum,
2488  FwOpcodeType opCode,
2489  U32 cmdSeq,
2490  const Fw::CmdResponse& response
2491  ) const
2492  {
2493  FW_ASSERT(
2494  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
2495  static_cast<FwAssertArgType>(portNum)
2496  );
2497 
2498  FW_ASSERT(
2499  this->m_cmdResponseOut_OutputPort[portNum].isConnected(),
2500  static_cast<FwAssertArgType>(portNum)
2501  );
2502  this->m_cmdResponseOut_OutputPort[portNum].invoke(
2503  opCode,
2504  cmdSeq,
2505  response
2506  );
2507  }
2508 
2509  void SeqDispatcherComponentBase ::
2510  logOut_out(
2511  FwIndexType portNum,
2512  FwEventIdType id,
2513  Fw::Time& timeTag,
2514  const Fw::LogSeverity& severity,
2515  Fw::LogBuffer& args
2516  ) const
2517  {
2518  FW_ASSERT(
2519  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
2520  static_cast<FwAssertArgType>(portNum)
2521  );
2522 
2523  FW_ASSERT(
2524  this->m_logOut_OutputPort[portNum].isConnected(),
2525  static_cast<FwAssertArgType>(portNum)
2526  );
2527  this->m_logOut_OutputPort[portNum].invoke(
2528  id,
2529  timeTag,
2530  severity,
2531  args
2532  );
2533  }
2534 
2535 #if FW_ENABLE_TEXT_LOGGING
2536 
2537  void SeqDispatcherComponentBase ::
2538  logTextOut_out(
2539  FwIndexType portNum,
2540  FwEventIdType id,
2541  Fw::Time& timeTag,
2542  const Fw::LogSeverity& severity,
2543  Fw::TextLogString& text
2544  ) const
2545  {
2546  FW_ASSERT(
2547  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
2548  static_cast<FwAssertArgType>(portNum)
2549  );
2550 
2551  FW_ASSERT(
2552  this->m_logTextOut_OutputPort[portNum].isConnected(),
2553  static_cast<FwAssertArgType>(portNum)
2554  );
2555  this->m_logTextOut_OutputPort[portNum].invoke(
2556  id,
2557  timeTag,
2558  severity,
2559  text
2560  );
2561  }
2562 
2563 #endif
2564 
2565  void SeqDispatcherComponentBase ::
2566  timeCaller_out(
2567  FwIndexType portNum,
2568  Fw::Time& time
2569  ) const
2570  {
2571  FW_ASSERT(
2572  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
2573  static_cast<FwAssertArgType>(portNum)
2574  );
2575 
2576  FW_ASSERT(
2577  this->m_timeCaller_OutputPort[portNum].isConnected(),
2578  static_cast<FwAssertArgType>(portNum)
2579  );
2580  this->m_timeCaller_OutputPort[portNum].invoke(
2581  time
2582  );
2583  }
2584 
2585  void SeqDispatcherComponentBase ::
2586  tlmOut_out(
2587  FwIndexType portNum,
2588  FwChanIdType id,
2589  Fw::Time& timeTag,
2590  Fw::TlmBuffer& val
2591  ) const
2592  {
2593  FW_ASSERT(
2594  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
2595  static_cast<FwAssertArgType>(portNum)
2596  );
2597 
2598  FW_ASSERT(
2599  this->m_tlmOut_OutputPort[portNum].isConnected(),
2600  static_cast<FwAssertArgType>(portNum)
2601  );
2602  this->m_tlmOut_OutputPort[portNum].invoke(
2603  id,
2604  timeTag,
2605  val
2606  );
2607  }
2608 
2609 #endif
2610 
2611 }
Serialization/Deserialization operation was successful.
Fw::InputCmdResponsePort * get_seqDoneIn_InputPort(FwIndexType portNum)
virtual void seqDoneIn_preMsgHook(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)
Pre-message hook for async input port seqDoneIn.
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:157
void tlmWrite_sequencersAvailable(U32 arg, Fw::Time _tlmTime=Fw::Time()) const
virtual void LOG_STATUS_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command LOG_STATUS.
void tlmWrite_errorCount(U32 arg, Fw::Time _tlmTime=Fw::Time()) const
static constexpr FwSizeType CAPACITY
Definition: CmdPortAc.hpp:36
void invoke(const Fw::StringBase &filename, const Svc::SeqArgs &args) const
Invoke a port connection.
FwIdType FwOpcodeType
The type of a command opcode.
Operation succeeded.
Definition: Os.hpp:26
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
static constexpr FwSizeType CAPACITY
PlatformSizeType FwSizeType
Svc::InputCmdSeqInPort * get_seqRunIn_InputPort(FwIndexType 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
Wait or don&#39;t wait for something.
Definition: WaitEnumAc.hpp:17
virtual void RUN_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command RUN.
Status
status returned from the queue send function
Definition: Queue.hpp:30
bool isConnected_seqRunOut_OutputPort(FwIndexType portNum) const
static constexpr FwIndexType getNum_seqDoneIn_InputPorts()
Svc::InputCmdSeqInPort * get_seqStartIn_InputPort(FwIndexType portNum)
const char * toChar() const
Convert to a C-style char*.
Definition: String.hpp:50
void init()
Initialization function.
void init()
Initialization function.
Definition: CmdPortAc.cpp:89
bool isConnected_timeCaller_OutputPort(FwIndexType portNum) const
virtual void seqStartIn_handler(FwIndexType portNum, const Fw::StringBase &filename, const Svc::SeqArgs &args)=0
Handler for input port seqStartIn.
virtual const CHAR * toChar() const =0
Convert to a C-style char*.
const Time ZERO_TIME
Definition: Time.cpp:5
virtual void RUN_ARGS_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command RUN_ARGS.
void init()
Initialization function.
Definition: TlmPortAc.cpp:171
Enum representing a command response.
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
void regCommands()
Register commands with the Command Dispatcher.
No time base has been established (Required)
virtual void seqRunIn_preMsgHook(FwIndexType portNum, const Fw::StringBase &filename, const Svc::SeqArgs &args)
Pre-message hook for async input port seqRunIn.
void addCallPort(InputCmdRegPort *callPort)
Register an input port.
void seqDoneIn_handlerBase(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)
Handler base-class function for input port seqDoneIn.
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
void set_cmdResponseOut_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to cmdResponseOut[portNum].
Os::Queue m_queue
queue object for active component
static constexpr FwIndexType getNum_logOut_OutputPorts()
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:177
void RUN_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void init()
Object initializer.
Definition: ObjBase.cpp:24
SerializeStatus
forward declaration for string
bool isConnected_logOut_OutputPort(FwIndexType portNum) const
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: CmdPortAc.cpp:95
static constexpr FwIndexType getNum_cmdRegOut_OutputPorts()
virtual void LOG_STATUS_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
Message will block until space is available.
Definition: Queue.hpp:47
void log_WARNING_LO_UnknownSequenceFinished(U16 idx) const
Log event UnknownSequenceFinished.
virtual ~SeqDispatcherComponentBase()
Destroy SeqDispatcherComponentBase object.
FwIdType FwEventIdType
The type of an event identifier.
static constexpr FwIndexType getNum_seqRunOut_OutputPorts()
void invoke(FwOpcodeType opCode) const
Invoke a port connection.
void log_ACTIVITY_LO_LogSequencerStatus(U16 idx, Svc::SeqDispatcher_CmdSequencerState state, const Fw::StringBase &filename) const
Log event LogSequencerStatus.
Fw::InputCmdPort * get_cmdIn_InputPort(FwIndexType portNum)
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:40
void init()
Initialization function.
Definition: TimePortAc.cpp:151
Dispatches a sequence with arguments to the first available sequencer.
Less important informational events.
Os::Queue::Status createQueue(FwSizeType depth, FwSizeType msgSize)
#define FW_MIN(a, b)
MIN macro (deprecated in C++, use std::min)
Definition: BasicTypes.h:94
A less serious but recoverable event.
void set_seqRunOut_OutputPort(FwIndexType portNum, Svc::InputCmdSeqInPort *port)
Connect port to seqRunOut[portNum].
void invoke(Fw::Time &time) const
Invoke a port connection.
Definition: TimePortAc.cpp:170
Serializable::SizeType getDeserializeSizeLeft() const override
Get remaining deserialization buffer size.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
const char * toChar() const
Convert to a C-style char*.
Definition: ObjectName.hpp:50
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke a port connection.
virtual void RUN_ARGS_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdStringArg &fileName, Fw::Wait block, Svc::SeqArgs buffer)=0
FwIdType FwChanIdType
The type of a telemetry channel identifier.
FwSizeType SizeType
SeqDispatcherComponentBase(const char *compName="")
Construct SeqDispatcherComponentBase object.
virtual void RUN_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdStringArg &fileName, Fw::Wait block)=0
Status send(const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override
send a message into the queue through delegate
Definition: Queue.cpp:54
static constexpr FwIndexType getNum_cmdIn_InputPorts()
bool isConnected_cmdResponseOut_OutputPort(FwIndexType portNum) const
void init()
Initialization function.
static constexpr FwIndexType getNum_cmdResponseOut_OutputPorts()
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void resetDeser() override
Reset deserialization pointer to beginning of buffer.
void seqRunOut_out(FwIndexType portNum, const Fw::StringBase &filename, const Svc::SeqArgs &args) const
Invoke output port seqRunOut.
A string backed by an external buffer.
A serious but recoverable event.
void log_WARNING_LO_UnexpectedSequenceStarted(U16 idx, const Fw::StringBase &newSequence) const
Log event UnexpectedSequenceStarted.
void invoke(FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val) const
Invoke a port connection.
Definition: TlmPortAc.cpp:190
bool isConnected() const
Definition: PortBase.cpp:38
Enum representing event severity.
bool isConnected_tlmOut_OutputPort(FwIndexType portNum) const
virtual void seqStartIn_preMsgHook(FwIndexType portNum, const Fw::StringBase &filename, const Svc::SeqArgs &args)
Pre-message hook for async input port seqStartIn.
bool isConnected_cmdRegOut_OutputPort(FwIndexType portNum) const
#define PRI_FwIndexType
void seqStartIn_handlerBase(FwIndexType portNum, const Fw::StringBase &filename, const Svc::SeqArgs &args)
Handler base-class function for input port seqStartIn.
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
void init()
Initialization function.
Definition: LogPortAc.cpp:180
void setPortNum(FwIndexType portNum)
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:53
static constexpr FwSizeType CAPACITY
BlockingType
message type
Definition: Queue.hpp:46
void tlmWrite(FwChanIdType id, Fw::TlmBuffer &_tlmBuff, Fw::Time _tlmTime=Fw::Time()) const
Command failed to deserialize.
void log_WARNING_HI_NoAvailableSequencers() const
Log event NoAvailableSequencers.
PlatformQueuePriorityType FwQueuePriorityType
The type of queue priorities used.
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args) const
Invoke a port connection.
Definition: LogPortAc.cpp:199
void init()
Initialization function.
A message was sent requesting an exit of the loop.
void RUN_ARGS_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
PlatformIndexType FwIndexType
void seqRunIn_handlerBase(FwIndexType portNum, const Fw::StringBase &filename, const Svc::SeqArgs &args)
Handler base-class function for input port seqRunIn.
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:186
void addCallPort(InputCmdSeqInPort *callPort)
Register an input port.
static constexpr FwIndexType getNum_tlmOut_OutputPorts()
void init()
Initialization function.
virtual void seqDoneIn_handler(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)=0
Handler for input port seqDoneIn.
void LOG_STATUS_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
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:56
void log_WARNING_HI_InvalidSequencer(U16 idx) const
Log event InvalidSequencer.
void set_cmdRegOut_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to cmdRegOut[portNum].
Dispatches a sequence to the first available sequencer.
static constexpr FwIndexType getNum_seqRunIn_InputPorts()
Message will return with status when space is unavailable.
Definition: Queue.hpp:48
Implementation of malloc based allocator.
static constexpr FwIndexType getNum_timeCaller_OutputPorts()
static constexpr SizeType BUFFER_SIZE(SizeType maxLength)
Get the size of a null-terminated string buffer.
void init()
Initialization function.
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
void cmdIn_handlerBase(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Handler base-class function for input port cmdIn.
void log_WARNING_HI_ConflictingSequenceStarted(U16 idx, const Fw::StringBase &newSequence, const Fw::StringBase &sequenceInInternalState) const
Log event ConflictingSequenceStarted.
virtual void seqRunIn_handler(FwIndexType portNum, const Fw::StringBase &filename, const Svc::SeqArgs &args)=0
Handler for input port seqRunIn.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
static constexpr FwIndexType getNum_seqStartIn_InputPorts()
void tlmWrite_dispatchedCount(U32 arg, Fw::Time _tlmTime=Fw::Time()) const
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
Logs via Events the state of each connected command sequencer.
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.
message to exit active component task
SerializeStatus serializeTo(SerialBufferBase &buffer, Endianness mode=Endianness::BIG) const override
Serialize the contents of this object to a buffer.