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  CMD_CANCEL_NAME,
26  CMD_CANCEL_ALL,
27  };
28 
29  // Get the max size by constructing a union of the async input, command, and
30  // internal port serialization sizes
31  union BuffUnion {
32  BYTE seqDoneInPortSize[Fw::CmdResponsePortBuffer::CAPACITY];
33  BYTE seqRunInPortSize[Svc::CmdSeqInPortBuffer::CAPACITY];
34  BYTE seqStartInPortSize[Svc::CmdSeqInPortBuffer::CAPACITY];
36  };
37 
38  // Define a message buffer class large enough to handle all the
39  // asynchronous inputs to the component
40  class ComponentIpcSerializableBuffer :
42  {
43 
44  public:
45 
46  enum {
47  // Offset into data in buffer: Size of message ID and port number
48  DATA_OFFSET = sizeof(FwEnumStoreType) + sizeof(FwIndexType),
49  // Max data size
50  MAX_DATA_SIZE = sizeof(BuffUnion),
51  // Max message size: Size of message id + size of port + max data size
52  SERIALIZATION_SIZE = DATA_OFFSET + MAX_DATA_SIZE
53  };
54 
55  ComponentIpcSerializableBuffer() : Fw::LinearBufferBase(m_buff, sizeof(m_buff)) {
56 
57  }
58 
59  private:
60  // Should be the max of all the input ports serialized sizes...
61  U8 m_buff[SERIALIZATION_SIZE];
62 
63  };
64  }
65 
66  // ----------------------------------------------------------------------
67  // Component initialization
68  // ----------------------------------------------------------------------
69 
72  FwSizeType queueDepth,
73  FwEnumStoreType instance
74  )
75  {
76  // Initialize base class
78 
79 #if !FW_DIRECT_PORT_CALLS
80  // Connect input port cmdIn
81  for (
82  FwIndexType port = 0;
83  port < static_cast<FwIndexType>(this->getNum_cmdIn_InputPorts());
84  port++
85  ) {
86  this->m_cmdIn_InputPort[port].init();
87  this->m_cmdIn_InputPort[port].addCallComp(
88  this,
89  m_p_cmdIn_in
90  );
91  this->m_cmdIn_InputPort[port].setPortNum(port);
92 
93 #if FW_OBJECT_NAMES == 1
94  Fw::ObjectName portName;
95  portName.format(
96  "%s_cmdIn_InputPort[%" PRI_FwIndexType "]",
97  this->m_objName.toChar(),
98  port
99  );
100  this->m_cmdIn_InputPort[port].setObjName(portName.toChar());
101 #endif
102  }
103 #endif
104 
105 #if !FW_DIRECT_PORT_CALLS
106  // Connect input port seqDoneIn
107  for (
108  FwIndexType port = 0;
109  port < static_cast<FwIndexType>(this->getNum_seqDoneIn_InputPorts());
110  port++
111  ) {
112  this->m_seqDoneIn_InputPort[port].init();
113  this->m_seqDoneIn_InputPort[port].addCallComp(
114  this,
115  m_p_seqDoneIn_in
116  );
117  this->m_seqDoneIn_InputPort[port].setPortNum(port);
118 
119 #if FW_OBJECT_NAMES == 1
120  Fw::ObjectName portName;
121  portName.format(
122  "%s_seqDoneIn_InputPort[%" PRI_FwIndexType "]",
123  this->m_objName.toChar(),
124  port
125  );
126  this->m_seqDoneIn_InputPort[port].setObjName(portName.toChar());
127 #endif
128  }
129 #endif
130 
131 #if !FW_DIRECT_PORT_CALLS
132  // Connect input port seqRunIn
133  for (
134  FwIndexType port = 0;
135  port < static_cast<FwIndexType>(this->getNum_seqRunIn_InputPorts());
136  port++
137  ) {
138  this->m_seqRunIn_InputPort[port].init();
139  this->m_seqRunIn_InputPort[port].addCallComp(
140  this,
141  m_p_seqRunIn_in
142  );
143  this->m_seqRunIn_InputPort[port].setPortNum(port);
144 
145 #if FW_OBJECT_NAMES == 1
146  Fw::ObjectName portName;
147  portName.format(
148  "%s_seqRunIn_InputPort[%" PRI_FwIndexType "]",
149  this->m_objName.toChar(),
150  port
151  );
152  this->m_seqRunIn_InputPort[port].setObjName(portName.toChar());
153 #endif
154  }
155 #endif
156 
157 #if !FW_DIRECT_PORT_CALLS
158  // Connect input port seqStartIn
159  for (
160  FwIndexType port = 0;
161  port < static_cast<FwIndexType>(this->getNum_seqStartIn_InputPorts());
162  port++
163  ) {
164  this->m_seqStartIn_InputPort[port].init();
165  this->m_seqStartIn_InputPort[port].addCallComp(
166  this,
167  m_p_seqStartIn_in
168  );
169  this->m_seqStartIn_InputPort[port].setPortNum(port);
170 
171 #if FW_OBJECT_NAMES == 1
172  Fw::ObjectName portName;
173  portName.format(
174  "%s_seqStartIn_InputPort[%" PRI_FwIndexType "]",
175  this->m_objName.toChar(),
176  port
177  );
178  this->m_seqStartIn_InputPort[port].setObjName(portName.toChar());
179 #endif
180  }
181 #endif
182 
183 #if !FW_DIRECT_PORT_CALLS
184  // Connect output port cmdRegOut
185  for (
186  FwIndexType port = 0;
187  port < static_cast<FwIndexType>(this->getNum_cmdRegOut_OutputPorts());
188  port++
189  ) {
190  this->m_cmdRegOut_OutputPort[port].init();
191 
192 #if FW_OBJECT_NAMES == 1
193  Fw::ObjectName portName;
194  portName.format(
195  "%s_cmdRegOut_OutputPort[%" PRI_FwIndexType "]",
196  this->m_objName.toChar(),
197  port
198  );
199  this->m_cmdRegOut_OutputPort[port].setObjName(portName.toChar());
200 #endif
201  }
202 #endif
203 
204 #if !FW_DIRECT_PORT_CALLS
205  // Connect output port cmdResponseOut
206  for (
207  FwIndexType port = 0;
208  port < static_cast<FwIndexType>(this->getNum_cmdResponseOut_OutputPorts());
209  port++
210  ) {
211  this->m_cmdResponseOut_OutputPort[port].init();
212 
213 #if FW_OBJECT_NAMES == 1
214  Fw::ObjectName portName;
215  portName.format(
216  "%s_cmdResponseOut_OutputPort[%" PRI_FwIndexType "]",
217  this->m_objName.toChar(),
218  port
219  );
220  this->m_cmdResponseOut_OutputPort[port].setObjName(portName.toChar());
221 #endif
222  }
223 #endif
224 
225 #if !FW_DIRECT_PORT_CALLS
226  // Connect output port logOut
227  for (
228  FwIndexType port = 0;
229  port < static_cast<FwIndexType>(this->getNum_logOut_OutputPorts());
230  port++
231  ) {
232  this->m_logOut_OutputPort[port].init();
233 
234 #if FW_OBJECT_NAMES == 1
235  Fw::ObjectName portName;
236  portName.format(
237  "%s_logOut_OutputPort[%" PRI_FwIndexType "]",
238  this->m_objName.toChar(),
239  port
240  );
241  this->m_logOut_OutputPort[port].setObjName(portName.toChar());
242 #endif
243  }
244 #endif
245 
246 #if !FW_DIRECT_PORT_CALLS && FW_ENABLE_TEXT_LOGGING
247  // Connect output port logTextOut
248  for (
249  FwIndexType port = 0;
250  port < static_cast<FwIndexType>(this->getNum_logTextOut_OutputPorts());
251  port++
252  ) {
253  this->m_logTextOut_OutputPort[port].init();
254 
255 #if FW_OBJECT_NAMES == 1
256  Fw::ObjectName portName;
257  portName.format(
258  "%s_logTextOut_OutputPort[%" PRI_FwIndexType "]",
259  this->m_objName.toChar(),
260  port
261  );
262  this->m_logTextOut_OutputPort[port].setObjName(portName.toChar());
263 #endif
264  }
265 #endif
266 
267 #if !FW_DIRECT_PORT_CALLS
268  // Connect output port timeCaller
269  for (
270  FwIndexType port = 0;
271  port < static_cast<FwIndexType>(this->getNum_timeCaller_OutputPorts());
272  port++
273  ) {
274  this->m_timeCaller_OutputPort[port].init();
275 
276 #if FW_OBJECT_NAMES == 1
277  Fw::ObjectName portName;
278  portName.format(
279  "%s_timeCaller_OutputPort[%" PRI_FwIndexType "]",
280  this->m_objName.toChar(),
281  port
282  );
283  this->m_timeCaller_OutputPort[port].setObjName(portName.toChar());
284 #endif
285  }
286 #endif
287 
288 #if !FW_DIRECT_PORT_CALLS
289  // Connect output port tlmOut
290  for (
291  FwIndexType port = 0;
292  port < static_cast<FwIndexType>(this->getNum_tlmOut_OutputPorts());
293  port++
294  ) {
295  this->m_tlmOut_OutputPort[port].init();
296 
297 #if FW_OBJECT_NAMES == 1
298  Fw::ObjectName portName;
299  portName.format(
300  "%s_tlmOut_OutputPort[%" PRI_FwIndexType "]",
301  this->m_objName.toChar(),
302  port
303  );
304  this->m_tlmOut_OutputPort[port].setObjName(portName.toChar());
305 #endif
306  }
307 #endif
308 
309 #if !FW_DIRECT_PORT_CALLS
310  // Connect output port seqCancelOut
311  for (
312  FwIndexType port = 0;
313  port < static_cast<FwIndexType>(this->getNum_seqCancelOut_OutputPorts());
314  port++
315  ) {
316  this->m_seqCancelOut_OutputPort[port].init();
317 
318 #if FW_OBJECT_NAMES == 1
319  Fw::ObjectName portName;
320  portName.format(
321  "%s_seqCancelOut_OutputPort[%" PRI_FwIndexType "]",
322  this->m_objName.toChar(),
323  port
324  );
325  this->m_seqCancelOut_OutputPort[port].setObjName(portName.toChar());
326 #endif
327  }
328 #endif
329 
330 #if !FW_DIRECT_PORT_CALLS
331  // Connect output port seqRunOut
332  for (
333  FwIndexType port = 0;
334  port < static_cast<FwIndexType>(this->getNum_seqRunOut_OutputPorts());
335  port++
336  ) {
337  this->m_seqRunOut_OutputPort[port].init();
338 
339 #if FW_OBJECT_NAMES == 1
340  Fw::ObjectName portName;
341  portName.format(
342  "%s_seqRunOut_OutputPort[%" PRI_FwIndexType "]",
343  this->m_objName.toChar(),
344  port
345  );
346  this->m_seqRunOut_OutputPort[port].setObjName(portName.toChar());
347 #endif
348  }
349 #endif
350 
351  // Create the queue
352  Os::Queue::Status qStat = this->createQueue(
353  queueDepth,
354  static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
355  );
356  FW_ASSERT(
357  Os::Queue::Status::OP_OK == qStat,
358  static_cast<FwAssertArgType>(qStat)
359  );
360  }
361 
362 #if !FW_DIRECT_PORT_CALLS
363 
364  // ----------------------------------------------------------------------
365  // Getters for special input ports
366  // ----------------------------------------------------------------------
367 
370  {
371  FW_ASSERT(
372  (0 <= portNum) && (portNum < this->getNum_cmdIn_InputPorts()),
373  static_cast<FwAssertArgType>(portNum)
374  );
375 
376  return &this->m_cmdIn_InputPort[portNum];
377  }
378 
379 #endif
380 
381 #if !FW_DIRECT_PORT_CALLS
382 
383  // ----------------------------------------------------------------------
384  // Getters for typed input ports
385  // ----------------------------------------------------------------------
386 
389  {
390  FW_ASSERT(
391  (0 <= portNum) && (portNum < this->getNum_seqDoneIn_InputPorts()),
392  static_cast<FwAssertArgType>(portNum)
393  );
394 
395  return &this->m_seqDoneIn_InputPort[portNum];
396  }
397 
400  {
401  FW_ASSERT(
402  (0 <= portNum) && (portNum < this->getNum_seqRunIn_InputPorts()),
403  static_cast<FwAssertArgType>(portNum)
404  );
405 
406  return &this->m_seqRunIn_InputPort[portNum];
407  }
408 
411  {
412  FW_ASSERT(
413  (0 <= portNum) && (portNum < this->getNum_seqStartIn_InputPorts()),
414  static_cast<FwAssertArgType>(portNum)
415  );
416 
417  return &this->m_seqStartIn_InputPort[portNum];
418  }
419 
420 #endif
421 
422 #if !FW_DIRECT_PORT_CALLS
423 
424  // ----------------------------------------------------------------------
425  // Connect input ports to special output ports
426  // ----------------------------------------------------------------------
427 
430  FwIndexType portNum,
431  Fw::InputCmdRegPort* port
432  )
433  {
434  FW_ASSERT(
435  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
436  static_cast<FwAssertArgType>(portNum)
437  );
438 
439  this->m_cmdRegOut_OutputPort[portNum].addCallPort(port);
440  }
441 
444  FwIndexType portNum,
446  )
447  {
448  FW_ASSERT(
449  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
450  static_cast<FwAssertArgType>(portNum)
451  );
452 
453  this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port);
454  }
455 
458  FwIndexType portNum,
459  Fw::InputLogPort* port
460  )
461  {
462  FW_ASSERT(
463  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
464  static_cast<FwAssertArgType>(portNum)
465  );
466 
467  this->m_logOut_OutputPort[portNum].addCallPort(port);
468  }
469 
470 #if FW_ENABLE_TEXT_LOGGING == 1
471 
472  void SeqDispatcherComponentBase ::
473  set_logTextOut_OutputPort(
474  FwIndexType portNum,
476  )
477  {
478  FW_ASSERT(
479  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
480  static_cast<FwAssertArgType>(portNum)
481  );
482 
483  this->m_logTextOut_OutputPort[portNum].addCallPort(port);
484  }
485 
486 #endif
487 
490  FwIndexType portNum,
491  Fw::InputTimePort* port
492  )
493  {
494  FW_ASSERT(
495  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
496  static_cast<FwAssertArgType>(portNum)
497  );
498 
499  this->m_timeCaller_OutputPort[portNum].addCallPort(port);
500  }
501 
504  FwIndexType portNum,
505  Fw::InputTlmPort* port
506  )
507  {
508  FW_ASSERT(
509  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
510  static_cast<FwAssertArgType>(portNum)
511  );
512 
513  this->m_tlmOut_OutputPort[portNum].addCallPort(port);
514  }
515 
516 #endif
517 
518 #if !FW_DIRECT_PORT_CALLS
519 
520  // ----------------------------------------------------------------------
521  // Connect typed input ports to typed output ports
522  // ----------------------------------------------------------------------
523 
526  FwIndexType portNum,
528  )
529  {
530  FW_ASSERT(
531  (0 <= portNum) && (portNum < this->getNum_seqCancelOut_OutputPorts()),
532  static_cast<FwAssertArgType>(portNum)
533  );
534 
535  this->m_seqCancelOut_OutputPort[portNum].addCallPort(port);
536  }
537 
540  FwIndexType portNum,
542  )
543  {
544  FW_ASSERT(
545  (0 <= portNum) && (portNum < this->getNum_seqRunOut_OutputPorts()),
546  static_cast<FwAssertArgType>(portNum)
547  );
548 
549  this->m_seqRunOut_OutputPort[portNum].addCallPort(port);
550  }
551 
552 #endif
553 
554 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
555 
556  // ----------------------------------------------------------------------
557  // Connect serial input ports to special output ports
558  // ----------------------------------------------------------------------
559 
562  FwIndexType portNum,
563  Fw::InputSerializePort* port
564  )
565  {
566  FW_ASSERT(
567  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
568  static_cast<FwAssertArgType>(portNum)
569  );
570 
571  this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port);
572  }
573 
576  FwIndexType portNum,
577  Fw::InputSerializePort* port
578  )
579  {
580  FW_ASSERT(
581  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
582  static_cast<FwAssertArgType>(portNum)
583  );
584 
585  this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port);
586  }
587 
590  FwIndexType portNum,
591  Fw::InputSerializePort* port
592  )
593  {
594  FW_ASSERT(
595  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
596  static_cast<FwAssertArgType>(portNum)
597  );
598 
599  this->m_logOut_OutputPort[portNum].registerSerialPort(port);
600  }
601 
602 #if FW_ENABLE_TEXT_LOGGING == 1
603 
604  void SeqDispatcherComponentBase ::
605  set_logTextOut_OutputPort(
606  FwIndexType portNum,
607  Fw::InputSerializePort* port
608  )
609  {
610  FW_ASSERT(
611  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
612  static_cast<FwAssertArgType>(portNum)
613  );
614 
615  this->m_logTextOut_OutputPort[portNum].registerSerialPort(port);
616  }
617 
618 #endif
619 
622  FwIndexType portNum,
623  Fw::InputSerializePort* port
624  )
625  {
626  FW_ASSERT(
627  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
628  static_cast<FwAssertArgType>(portNum)
629  );
630 
631  this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
632  }
633 
636  FwIndexType portNum,
637  Fw::InputSerializePort* port
638  )
639  {
640  FW_ASSERT(
641  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
642  static_cast<FwAssertArgType>(portNum)
643  );
644 
645  this->m_tlmOut_OutputPort[portNum].registerSerialPort(port);
646  }
647 
648 #endif
649 
650 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
651 
652  // ----------------------------------------------------------------------
653  // Connect serial input ports to typed output ports
654  // ----------------------------------------------------------------------
655 
658  FwIndexType portNum,
659  Fw::InputSerializePort* port
660  )
661  {
662  FW_ASSERT(
663  (0 <= portNum) && (portNum < this->getNum_seqCancelOut_OutputPorts()),
664  static_cast<FwAssertArgType>(portNum)
665  );
666 
667  this->m_seqCancelOut_OutputPort[portNum].registerSerialPort(port);
668  }
669 
672  FwIndexType portNum,
673  Fw::InputSerializePort* port
674  )
675  {
676  FW_ASSERT(
677  (0 <= portNum) && (portNum < this->getNum_seqRunOut_OutputPorts()),
678  static_cast<FwAssertArgType>(portNum)
679  );
680 
681  this->m_seqRunOut_OutputPort[portNum].registerSerialPort(port);
682  }
683 
684 #endif
685 
686  // ----------------------------------------------------------------------
687  // Command registration
688  // ----------------------------------------------------------------------
689 
692  {
694 
695  this->cmdRegOut_out(
696  0,
697  this->getIdBase() + OPCODE_RUN
698  );
699 
700  this->cmdRegOut_out(
701  0,
702  this->getIdBase() + OPCODE_RUN_ARGS
703  );
704 
705  this->cmdRegOut_out(
706  0,
707  this->getIdBase() + OPCODE_LOG_STATUS
708  );
709 
710  this->cmdRegOut_out(
711  0,
712  this->getIdBase() + OPCODE_CANCEL_NAME
713  );
714 
715  this->cmdRegOut_out(
716  0,
717  this->getIdBase() + OPCODE_CANCEL_ALL
718  );
719  }
720 
721  // ----------------------------------------------------------------------
722  // Component construction and destruction
723  // ----------------------------------------------------------------------
724 
726  SeqDispatcherComponentBase(const char* compName) :
727  Fw::ActiveComponentBase(compName)
728  {
729 
730  }
731 
734  {
735 
736  }
737 
738 #if !FW_DIRECT_PORT_CALLS
739 
740  // ----------------------------------------------------------------------
741  // Connection status queries for special output ports
742  // ----------------------------------------------------------------------
743 
746  {
747  FW_ASSERT(
748  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
749  static_cast<FwAssertArgType>(portNum)
750  );
751 
752  return this->m_cmdRegOut_OutputPort[portNum].isConnected();
753  }
754 
757  {
758  FW_ASSERT(
759  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
760  static_cast<FwAssertArgType>(portNum)
761  );
762 
763  return this->m_cmdResponseOut_OutputPort[portNum].isConnected();
764  }
765 
768  {
769  FW_ASSERT(
770  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
771  static_cast<FwAssertArgType>(portNum)
772  );
773 
774  return this->m_logOut_OutputPort[portNum].isConnected();
775  }
776 
777 #if FW_ENABLE_TEXT_LOGGING == 1
778 
779  bool SeqDispatcherComponentBase ::
780  isConnected_logTextOut_OutputPort(FwIndexType portNum) const
781  {
782  FW_ASSERT(
783  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
784  static_cast<FwAssertArgType>(portNum)
785  );
786 
787  return this->m_logTextOut_OutputPort[portNum].isConnected();
788  }
789 
790 #endif
791 
794  {
795  FW_ASSERT(
796  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
797  static_cast<FwAssertArgType>(portNum)
798  );
799 
800  return this->m_timeCaller_OutputPort[portNum].isConnected();
801  }
802 
805  {
806  FW_ASSERT(
807  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
808  static_cast<FwAssertArgType>(portNum)
809  );
810 
811  return this->m_tlmOut_OutputPort[portNum].isConnected();
812  }
813 
814 #endif
815 
816 #if !FW_DIRECT_PORT_CALLS
817 
818  // ----------------------------------------------------------------------
819  // Connection status queries for typed output ports
820  // ----------------------------------------------------------------------
821 
824  {
825  FW_ASSERT(
826  (0 <= portNum) && (portNum < this->getNum_seqCancelOut_OutputPorts()),
827  static_cast<FwAssertArgType>(portNum)
828  );
829 
830  return this->m_seqCancelOut_OutputPort[portNum].isConnected();
831  }
832 
835  {
836  FW_ASSERT(
837  (0 <= portNum) && (portNum < this->getNum_seqRunOut_OutputPorts()),
838  static_cast<FwAssertArgType>(portNum)
839  );
840 
841  return this->m_seqRunOut_OutputPort[portNum].isConnected();
842  }
843 
844 #endif
845 
846  // ----------------------------------------------------------------------
847  // Port handler base-class functions for special input ports
848  //
849  // Call these functions directly to bypass the corresponding ports
850  // ----------------------------------------------------------------------
851 
854  FwIndexType portNum,
855  FwOpcodeType opCode,
856  U32 cmdSeq,
857  Fw::CmdArgBuffer& args
858  )
859  {
860 
861  const U32 idBase = this->getIdBase();
862  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
863 
864  // Select base class function based on opcode
865  switch (opCode - idBase) {
866  case OPCODE_RUN: {
867  this->RUN_cmdHandlerBase(
868  opCode,
869  cmdSeq,
870  args
871  );
872  break;
873  }
874 
875  case OPCODE_RUN_ARGS: {
877  opCode,
878  cmdSeq,
879  args
880  );
881  break;
882  }
883 
884  case OPCODE_LOG_STATUS: {
886  opCode,
887  cmdSeq,
888  args
889  );
890  break;
891  }
892 
893  case OPCODE_CANCEL_NAME: {
895  opCode,
896  cmdSeq,
897  args
898  );
899  break;
900  }
901 
902  case OPCODE_CANCEL_ALL: {
904  opCode,
905  cmdSeq,
906  args
907  );
908  break;
909  }
910  default:
911  // Unknown opcode: ignore it
912  break;
913  }
914  }
915 
916  // ----------------------------------------------------------------------
917  // Port handler base-class functions for typed input ports
918  //
919  // Call these functions directly to bypass the corresponding ports
920  // ----------------------------------------------------------------------
921 
924  FwIndexType portNum,
925  FwOpcodeType opCode,
926  U32 cmdSeq,
927  const Fw::CmdResponse& response
928  )
929  {
930  // Make sure port number is valid
931  FW_ASSERT(
932  (0 <= portNum) && (portNum < this->getNum_seqDoneIn_InputPorts()),
933  static_cast<FwAssertArgType>(portNum)
934  );
935 
936  // Call pre-message hook
938  portNum,
939  opCode,
940  cmdSeq,
941  response
942  );
943  ComponentIpcSerializableBuffer msg;
945 
946  // Serialize message ID
947  _status = msg.serializeFrom(
948  static_cast<FwEnumStoreType>(SEQDONEIN_CMDRESPONSE)
949  );
950  FW_ASSERT(
951  _status == Fw::FW_SERIALIZE_OK,
952  static_cast<FwAssertArgType>(_status)
953  );
954 
955  // Serialize port number
956  _status = msg.serializeFrom(portNum);
957  FW_ASSERT(
958  _status == Fw::FW_SERIALIZE_OK,
959  static_cast<FwAssertArgType>(_status)
960  );
961 
962  // Serialize argument opCode
963  _status = msg.serializeFrom(opCode);
964  FW_ASSERT(
965  _status == Fw::FW_SERIALIZE_OK,
966  static_cast<FwAssertArgType>(_status)
967  );
968 
969  // Serialize argument cmdSeq
970  _status = msg.serializeFrom(cmdSeq);
971  FW_ASSERT(
972  _status == Fw::FW_SERIALIZE_OK,
973  static_cast<FwAssertArgType>(_status)
974  );
975 
976  // Serialize argument response
977  _status = msg.serializeFrom(response);
978  FW_ASSERT(
979  _status == Fw::FW_SERIALIZE_OK,
980  static_cast<FwAssertArgType>(_status)
981  );
982 
983  // Send message
985  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
986 
987  FW_ASSERT(
988  qStatus == Os::Queue::OP_OK,
989  static_cast<FwAssertArgType>(qStatus)
990  );
991  }
992 
995  FwIndexType portNum,
996  const Fw::StringBase& filename,
997  const Svc::SeqArgs& args
998  )
999  {
1000  // Make sure port number is valid
1001  FW_ASSERT(
1002  (0 <= portNum) && (portNum < this->getNum_seqRunIn_InputPorts()),
1003  static_cast<FwAssertArgType>(portNum)
1004  );
1005 
1006  // Call pre-message hook
1008  portNum,
1009  filename,
1010  args
1011  );
1012  ComponentIpcSerializableBuffer msg;
1014 
1015  // Serialize message ID
1016  _status = msg.serializeFrom(
1017  static_cast<FwEnumStoreType>(SEQRUNIN_CMDSEQIN)
1018  );
1019  FW_ASSERT(
1020  _status == Fw::FW_SERIALIZE_OK,
1021  static_cast<FwAssertArgType>(_status)
1022  );
1023 
1024  // Serialize port number
1025  _status = msg.serializeFrom(portNum);
1026  FW_ASSERT(
1027  _status == Fw::FW_SERIALIZE_OK,
1028  static_cast<FwAssertArgType>(_status)
1029  );
1030 
1031  // Serialize argument filename
1032  _status = filename.serializeTo(msg, 240);
1033  FW_ASSERT(
1034  _status == Fw::FW_SERIALIZE_OK,
1035  static_cast<FwAssertArgType>(_status)
1036  );
1037 
1038  // Serialize argument args
1039  _status = msg.serializeFrom(args);
1040  FW_ASSERT(
1041  _status == Fw::FW_SERIALIZE_OK,
1042  static_cast<FwAssertArgType>(_status)
1043  );
1044 
1045  // Send message
1047  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1048 
1049  FW_ASSERT(
1050  qStatus == Os::Queue::OP_OK,
1051  static_cast<FwAssertArgType>(qStatus)
1052  );
1053  }
1054 
1057  FwIndexType portNum,
1058  const Fw::StringBase& filename,
1059  const Svc::SeqArgs& args
1060  )
1061  {
1062  // Make sure port number is valid
1063  FW_ASSERT(
1064  (0 <= portNum) && (portNum < this->getNum_seqStartIn_InputPorts()),
1065  static_cast<FwAssertArgType>(portNum)
1066  );
1067 
1068  // Call pre-message hook
1070  portNum,
1071  filename,
1072  args
1073  );
1074  ComponentIpcSerializableBuffer msg;
1076 
1077  // Serialize message ID
1078  _status = msg.serializeFrom(
1079  static_cast<FwEnumStoreType>(SEQSTARTIN_CMDSEQIN)
1080  );
1081  FW_ASSERT(
1082  _status == Fw::FW_SERIALIZE_OK,
1083  static_cast<FwAssertArgType>(_status)
1084  );
1085 
1086  // Serialize port number
1087  _status = msg.serializeFrom(portNum);
1088  FW_ASSERT(
1089  _status == Fw::FW_SERIALIZE_OK,
1090  static_cast<FwAssertArgType>(_status)
1091  );
1092 
1093  // Serialize argument filename
1094  _status = filename.serializeTo(msg, 240);
1095  FW_ASSERT(
1096  _status == Fw::FW_SERIALIZE_OK,
1097  static_cast<FwAssertArgType>(_status)
1098  );
1099 
1100  // Serialize argument args
1101  _status = msg.serializeFrom(args);
1102  FW_ASSERT(
1103  _status == Fw::FW_SERIALIZE_OK,
1104  static_cast<FwAssertArgType>(_status)
1105  );
1106 
1107  // Send message
1109  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1110 
1111  FW_ASSERT(
1112  qStatus == Os::Queue::OP_OK,
1113  static_cast<FwAssertArgType>(qStatus)
1114  );
1115  }
1116 
1117  // ----------------------------------------------------------------------
1118  // Pre-message hooks for typed async input ports
1119  //
1120  // Each of these functions is invoked just before processing a message
1121  // on the corresponding port. By default, they do nothing. You can
1122  // override them to provide specific pre-message behavior.
1123  // ----------------------------------------------------------------------
1124 
1127  FwIndexType portNum,
1128  FwOpcodeType opCode,
1129  U32 cmdSeq,
1130  const Fw::CmdResponse& response
1131  )
1132  {
1133  // Default: no-op
1134  }
1135 
1138  FwIndexType portNum,
1139  const Fw::StringBase& filename,
1140  const Svc::SeqArgs& args
1141  )
1142  {
1143  // Default: no-op
1144  }
1145 
1148  FwIndexType portNum,
1149  const Fw::StringBase& filename,
1150  const Svc::SeqArgs& args
1151  )
1152  {
1153  // Default: no-op
1154  }
1155 
1156 #if !FW_DIRECT_PORT_CALLS
1157 
1158  // ----------------------------------------------------------------------
1159  // Invocation functions for typed output ports
1160  // ----------------------------------------------------------------------
1161 
1164  {
1165  FW_ASSERT(
1166  (0 <= portNum) && (portNum < this->getNum_seqCancelOut_OutputPorts()),
1167  static_cast<FwAssertArgType>(portNum)
1168  );
1169 
1170  FW_ASSERT(
1171  this->m_seqCancelOut_OutputPort[portNum].isConnected(),
1172  static_cast<FwAssertArgType>(portNum)
1173  );
1174  this->m_seqCancelOut_OutputPort[portNum].invoke();
1175  }
1176 
1179  FwIndexType portNum,
1180  const Fw::StringBase& filename,
1181  const Svc::SeqArgs& args
1182  ) const
1183  {
1184  FW_ASSERT(
1185  (0 <= portNum) && (portNum < this->getNum_seqRunOut_OutputPorts()),
1186  static_cast<FwAssertArgType>(portNum)
1187  );
1188 
1189  FW_ASSERT(
1190  this->m_seqRunOut_OutputPort[portNum].isConnected(),
1191  static_cast<FwAssertArgType>(portNum)
1192  );
1193  this->m_seqRunOut_OutputPort[portNum].invoke(
1194  filename,
1195  args
1196  );
1197  }
1198 
1199 #endif
1200 
1201  // ----------------------------------------------------------------------
1202  // Command response
1203  // ----------------------------------------------------------------------
1204 
1207  FwOpcodeType opCode,
1208  U32 cmdSeq,
1209  Fw::CmdResponse response
1210  )
1211  {
1213  this->cmdResponseOut_out(0, opCode, cmdSeq, response);
1214  }
1215 
1216  // ----------------------------------------------------------------------
1217  // Command handler base-class functions
1218  //
1219  // Call these functions directly to bypass the command input port
1220  // ----------------------------------------------------------------------
1221 
1224  FwOpcodeType opCode,
1225  U32 cmdSeq,
1226  Fw::CmdArgBuffer& args
1227  )
1228  {
1229  // Call pre-message hook
1230  this->RUN_preMsgHook(opCode,cmdSeq);
1231 
1232  // Defer deserializing arguments to the message dispatcher
1233  // to avoid deserializing and reserializing just for IPC
1234  ComponentIpcSerializableBuffer msg;
1236 
1237  // Serialize for IPC
1238  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_RUN));
1239  FW_ASSERT (
1240  _status == Fw::FW_SERIALIZE_OK,
1241  static_cast<FwAssertArgType>(_status)
1242  );
1243 
1244  // Fake port number to make message dequeue work
1245  FwIndexType port = 0;
1246 
1247  _status = msg.serializeFrom(port);
1248  FW_ASSERT (
1249  _status == Fw::FW_SERIALIZE_OK,
1250  static_cast<FwAssertArgType>(_status)
1251  );
1252 
1253  _status = msg.serializeFrom(opCode);
1254  FW_ASSERT (
1255  _status == Fw::FW_SERIALIZE_OK,
1256  static_cast<FwAssertArgType>(_status)
1257  );
1258 
1259  _status = msg.serializeFrom(cmdSeq);
1260  FW_ASSERT (
1261  _status == Fw::FW_SERIALIZE_OK,
1262  static_cast<FwAssertArgType>(_status)
1263  );
1264 
1265  _status = msg.serializeFrom(args);
1266  FW_ASSERT (
1267  _status == Fw::FW_SERIALIZE_OK,
1268  static_cast<FwAssertArgType>(_status)
1269  );
1270 
1271  // Send message
1273  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1274 
1275  FW_ASSERT(
1276  qStatus == Os::Queue::OP_OK,
1277  static_cast<FwAssertArgType>(qStatus)
1278  );
1279  }
1280 
1283  FwOpcodeType opCode,
1284  U32 cmdSeq,
1285  Fw::CmdArgBuffer& args
1286  )
1287  {
1288  // Call pre-message hook
1289  this->RUN_ARGS_preMsgHook(opCode,cmdSeq);
1290 
1291  // Defer deserializing arguments to the message dispatcher
1292  // to avoid deserializing and reserializing just for IPC
1293  ComponentIpcSerializableBuffer msg;
1295 
1296  // Serialize for IPC
1297  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_RUN_ARGS));
1298  FW_ASSERT (
1299  _status == Fw::FW_SERIALIZE_OK,
1300  static_cast<FwAssertArgType>(_status)
1301  );
1302 
1303  // Fake port number to make message dequeue work
1304  FwIndexType port = 0;
1305 
1306  _status = msg.serializeFrom(port);
1307  FW_ASSERT (
1308  _status == Fw::FW_SERIALIZE_OK,
1309  static_cast<FwAssertArgType>(_status)
1310  );
1311 
1312  _status = msg.serializeFrom(opCode);
1313  FW_ASSERT (
1314  _status == Fw::FW_SERIALIZE_OK,
1315  static_cast<FwAssertArgType>(_status)
1316  );
1317 
1318  _status = msg.serializeFrom(cmdSeq);
1319  FW_ASSERT (
1320  _status == Fw::FW_SERIALIZE_OK,
1321  static_cast<FwAssertArgType>(_status)
1322  );
1323 
1324  _status = msg.serializeFrom(args);
1325  FW_ASSERT (
1326  _status == Fw::FW_SERIALIZE_OK,
1327  static_cast<FwAssertArgType>(_status)
1328  );
1329 
1330  // Send message
1332  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1333 
1334  FW_ASSERT(
1335  qStatus == Os::Queue::OP_OK,
1336  static_cast<FwAssertArgType>(qStatus)
1337  );
1338  }
1339 
1342  FwOpcodeType opCode,
1343  U32 cmdSeq,
1344  Fw::CmdArgBuffer& args
1345  )
1346  {
1347  // Call pre-message hook
1348  this->LOG_STATUS_preMsgHook(opCode,cmdSeq);
1349 
1350  // Defer deserializing arguments to the message dispatcher
1351  // to avoid deserializing and reserializing just for IPC
1352  ComponentIpcSerializableBuffer msg;
1354 
1355  // Serialize for IPC
1356  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_LOG_STATUS));
1357  FW_ASSERT (
1358  _status == Fw::FW_SERIALIZE_OK,
1359  static_cast<FwAssertArgType>(_status)
1360  );
1361 
1362  // Fake port number to make message dequeue work
1363  FwIndexType port = 0;
1364 
1365  _status = msg.serializeFrom(port);
1366  FW_ASSERT (
1367  _status == Fw::FW_SERIALIZE_OK,
1368  static_cast<FwAssertArgType>(_status)
1369  );
1370 
1371  _status = msg.serializeFrom(opCode);
1372  FW_ASSERT (
1373  _status == Fw::FW_SERIALIZE_OK,
1374  static_cast<FwAssertArgType>(_status)
1375  );
1376 
1377  _status = msg.serializeFrom(cmdSeq);
1378  FW_ASSERT (
1379  _status == Fw::FW_SERIALIZE_OK,
1380  static_cast<FwAssertArgType>(_status)
1381  );
1382 
1383  _status = msg.serializeFrom(args);
1384  FW_ASSERT (
1385  _status == Fw::FW_SERIALIZE_OK,
1386  static_cast<FwAssertArgType>(_status)
1387  );
1388 
1389  // Send message
1391  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1392 
1393  FW_ASSERT(
1394  qStatus == Os::Queue::OP_OK,
1395  static_cast<FwAssertArgType>(qStatus)
1396  );
1397  }
1398 
1401  FwOpcodeType opCode,
1402  U32 cmdSeq,
1403  Fw::CmdArgBuffer& args
1404  )
1405  {
1406  // Call pre-message hook
1407  this->CANCEL_NAME_preMsgHook(opCode,cmdSeq);
1408 
1409  // Defer deserializing arguments to the message dispatcher
1410  // to avoid deserializing and reserializing just for IPC
1411  ComponentIpcSerializableBuffer msg;
1413 
1414  // Serialize for IPC
1415  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_CANCEL_NAME));
1416  FW_ASSERT (
1417  _status == Fw::FW_SERIALIZE_OK,
1418  static_cast<FwAssertArgType>(_status)
1419  );
1420 
1421  // Fake port number to make message dequeue work
1422  FwIndexType port = 0;
1423 
1424  _status = msg.serializeFrom(port);
1425  FW_ASSERT (
1426  _status == Fw::FW_SERIALIZE_OK,
1427  static_cast<FwAssertArgType>(_status)
1428  );
1429 
1430  _status = msg.serializeFrom(opCode);
1431  FW_ASSERT (
1432  _status == Fw::FW_SERIALIZE_OK,
1433  static_cast<FwAssertArgType>(_status)
1434  );
1435 
1436  _status = msg.serializeFrom(cmdSeq);
1437  FW_ASSERT (
1438  _status == Fw::FW_SERIALIZE_OK,
1439  static_cast<FwAssertArgType>(_status)
1440  );
1441 
1442  _status = msg.serializeFrom(args);
1443  FW_ASSERT (
1444  _status == Fw::FW_SERIALIZE_OK,
1445  static_cast<FwAssertArgType>(_status)
1446  );
1447 
1448  // Send message
1450  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1451 
1452  FW_ASSERT(
1453  qStatus == Os::Queue::OP_OK,
1454  static_cast<FwAssertArgType>(qStatus)
1455  );
1456  }
1457 
1460  FwOpcodeType opCode,
1461  U32 cmdSeq,
1462  Fw::CmdArgBuffer& args
1463  )
1464  {
1465  // Call pre-message hook
1466  this->CANCEL_ALL_preMsgHook(opCode,cmdSeq);
1467 
1468  // Defer deserializing arguments to the message dispatcher
1469  // to avoid deserializing and reserializing just for IPC
1470  ComponentIpcSerializableBuffer msg;
1472 
1473  // Serialize for IPC
1474  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_CANCEL_ALL));
1475  FW_ASSERT (
1476  _status == Fw::FW_SERIALIZE_OK,
1477  static_cast<FwAssertArgType>(_status)
1478  );
1479 
1480  // Fake port number to make message dequeue work
1481  FwIndexType port = 0;
1482 
1483  _status = msg.serializeFrom(port);
1484  FW_ASSERT (
1485  _status == Fw::FW_SERIALIZE_OK,
1486  static_cast<FwAssertArgType>(_status)
1487  );
1488 
1489  _status = msg.serializeFrom(opCode);
1490  FW_ASSERT (
1491  _status == Fw::FW_SERIALIZE_OK,
1492  static_cast<FwAssertArgType>(_status)
1493  );
1494 
1495  _status = msg.serializeFrom(cmdSeq);
1496  FW_ASSERT (
1497  _status == Fw::FW_SERIALIZE_OK,
1498  static_cast<FwAssertArgType>(_status)
1499  );
1500 
1501  _status = msg.serializeFrom(args);
1502  FW_ASSERT (
1503  _status == Fw::FW_SERIALIZE_OK,
1504  static_cast<FwAssertArgType>(_status)
1505  );
1506 
1507  // Send message
1509  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1510 
1511  FW_ASSERT(
1512  qStatus == Os::Queue::OP_OK,
1513  static_cast<FwAssertArgType>(qStatus)
1514  );
1515  }
1516 
1517  // ----------------------------------------------------------------------
1518  // Pre-message hooks for async commands
1519  //
1520  // Each of these functions is invoked just before processing the
1521  // corresponding command. By default they do nothing. You can
1522  // override them to provide specific pre-command behavior.
1523  // ----------------------------------------------------------------------
1524 
1527  FwOpcodeType opCode,
1528  U32 cmdSeq
1529  )
1530  {
1531  // Defaults to no-op; can be overridden
1532  (void) opCode;
1533  (void) cmdSeq;
1534  }
1535 
1538  FwOpcodeType opCode,
1539  U32 cmdSeq
1540  )
1541  {
1542  // Defaults to no-op; can be overridden
1543  (void) opCode;
1544  (void) cmdSeq;
1545  }
1546 
1549  FwOpcodeType opCode,
1550  U32 cmdSeq
1551  )
1552  {
1553  // Defaults to no-op; can be overridden
1554  (void) opCode;
1555  (void) cmdSeq;
1556  }
1557 
1560  FwOpcodeType opCode,
1561  U32 cmdSeq
1562  )
1563  {
1564  // Defaults to no-op; can be overridden
1565  (void) opCode;
1566  (void) cmdSeq;
1567  }
1568 
1571  FwOpcodeType opCode,
1572  U32 cmdSeq
1573  )
1574  {
1575  // Defaults to no-op; can be overridden
1576  (void) opCode;
1577  (void) cmdSeq;
1578  }
1579 
1580  // ----------------------------------------------------------------------
1581  // Event logging functions
1582  // ----------------------------------------------------------------------
1583 
1586  {
1587  // Get the time
1588  Fw::Time _logTime;
1589  if (this->isConnected_timeCaller_OutputPort(0)) {
1590  this->timeCaller_out(0, _logTime);
1591  }
1592 
1593  const FwEventIdType _id = this->getIdBase() + EVENTID_INVALIDSEQUENCER;
1594 
1595  // Emit the event on the log port
1596  if (this->isConnected_logOut_OutputPort(0)) {
1597  Fw::LogBuffer _logBuff;
1599 
1600 #if FW_AMPCS_COMPATIBLE
1601  // Serialize the number of arguments
1602  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1603  FW_ASSERT(
1604  _status == Fw::FW_SERIALIZE_OK,
1605  static_cast<FwAssertArgType>(_status)
1606  );
1607 #endif
1608 
1609 #if FW_AMPCS_COMPATIBLE
1610  // Serialize the argument size
1611  _status = _logBuff.serializeFrom(
1612  static_cast<U8>(sizeof(U16))
1613  );
1614  FW_ASSERT(
1615  _status == Fw::FW_SERIALIZE_OK,
1616  static_cast<FwAssertArgType>(_status)
1617  );
1618 #endif
1619  _status = _logBuff.serializeFrom(idx);
1620  FW_ASSERT(
1621  _status == Fw::FW_SERIALIZE_OK,
1622  static_cast<FwAssertArgType>(_status)
1623  );
1624 
1625  this->logOut_out(
1626  0,
1627  _id,
1628  _logTime,
1630  _logBuff
1631  );
1632  }
1633 
1634  // Emit the event on the text log port
1635 #if FW_ENABLE_TEXT_LOGGING
1636  if (this->isConnected_logTextOut_OutputPort(0)) {
1637 #if FW_OBJECT_NAMES == 1
1638  const char* _formatString =
1639  "(%s) %s: Invalid sequence index %" PRIu16 "";
1640 #else
1641  const char* _formatString =
1642  "%s: Invalid sequence index %" PRIu16 "";
1643 #endif
1644 
1645  Fw::TextLogString _logString;
1646  (void) _logString.format(
1647  _formatString,
1648 #if FW_OBJECT_NAMES == 1
1649  this->m_objName.toChar(),
1650 #endif
1651  "InvalidSequencer ",
1652  idx
1653  );
1654 
1655  this->logTextOut_out(
1656  0,
1657  _id,
1658  _logTime,
1660  _logString
1661  );
1662  }
1663 #endif
1664  }
1665 
1668  {
1669  // Get the time
1670  Fw::Time _logTime;
1671  if (this->isConnected_timeCaller_OutputPort(0)) {
1672  this->timeCaller_out(0, _logTime);
1673  }
1674 
1676 
1677  // Emit the event on the log port
1678  if (this->isConnected_logOut_OutputPort(0)) {
1679  Fw::LogBuffer _logBuff;
1680 
1681 #if FW_AMPCS_COMPATIBLE
1683  // Serialize the number of arguments
1684  _status = _logBuff.serializeFrom(static_cast<U8>(0));
1685  FW_ASSERT(
1686  _status == Fw::FW_SERIALIZE_OK,
1687  static_cast<FwAssertArgType>(_status)
1688  );
1689 #endif
1690 
1691  this->logOut_out(
1692  0,
1693  _id,
1694  _logTime,
1696  _logBuff
1697  );
1698  }
1699 
1700  // Emit the event on the text log port
1701 #if FW_ENABLE_TEXT_LOGGING
1702  if (this->isConnected_logTextOut_OutputPort(0)) {
1703 #if FW_OBJECT_NAMES == 1
1704  const char* _formatString =
1705  "(%s) %s: No available cmd sequencers to dispatch a sequence to";
1706 #else
1707  const char* _formatString =
1708  "%s: No available cmd sequencers to dispatch a sequence to";
1709 #endif
1710 
1711  Fw::TextLogString _logString;
1712  (void) _logString.format(
1713  _formatString,
1714 #if FW_OBJECT_NAMES == 1
1715  this->m_objName.toChar(),
1716 #endif
1717  "NoAvailableSequencers "
1718  );
1719 
1720  this->logTextOut_out(
1721  0,
1722  _id,
1723  _logTime,
1725  _logString
1726  );
1727  }
1728 #endif
1729  }
1730 
1733  {
1734  // Get the time
1735  Fw::Time _logTime;
1736  if (this->isConnected_timeCaller_OutputPort(0)) {
1737  this->timeCaller_out(0, _logTime);
1738  }
1739 
1741 
1742  // Emit the event on the log port
1743  if (this->isConnected_logOut_OutputPort(0)) {
1744  Fw::LogBuffer _logBuff;
1746 
1747 #if FW_AMPCS_COMPATIBLE
1748  // Serialize the number of arguments
1749  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1750  FW_ASSERT(
1751  _status == Fw::FW_SERIALIZE_OK,
1752  static_cast<FwAssertArgType>(_status)
1753  );
1754 #endif
1755 
1756 #if FW_AMPCS_COMPATIBLE
1757  // Serialize the argument size
1758  _status = _logBuff.serializeFrom(
1759  static_cast<U8>(sizeof(U16))
1760  );
1761  FW_ASSERT(
1762  _status == Fw::FW_SERIALIZE_OK,
1763  static_cast<FwAssertArgType>(_status)
1764  );
1765 #endif
1766  _status = _logBuff.serializeFrom(idx);
1767  FW_ASSERT(
1768  _status == Fw::FW_SERIALIZE_OK,
1769  static_cast<FwAssertArgType>(_status)
1770  );
1771 
1772  this->logOut_out(
1773  0,
1774  _id,
1775  _logTime,
1777  _logBuff
1778  );
1779  }
1780 
1781  // Emit the event on the text log port
1782 #if FW_ENABLE_TEXT_LOGGING
1783  if (this->isConnected_logTextOut_OutputPort(0)) {
1784 #if FW_OBJECT_NAMES == 1
1785  const char* _formatString =
1786  "(%s) %s: Sequencer %" PRIu16 " completed a sequence with no matching start notification";
1787 #else
1788  const char* _formatString =
1789  "%s: Sequencer %" PRIu16 " completed a sequence with no matching start notification";
1790 #endif
1791 
1792  Fw::TextLogString _logString;
1793  (void) _logString.format(
1794  _formatString,
1795 #if FW_OBJECT_NAMES == 1
1796  this->m_objName.toChar(),
1797 #endif
1798  "UnknownSequenceFinished ",
1799  idx
1800  );
1801 
1802  this->logTextOut_out(
1803  0,
1804  _id,
1805  _logTime,
1807  _logString
1808  );
1809  }
1810 #endif
1811  }
1812 
1815  U16 idx,
1816  const Fw::StringBase& newSequence,
1817  const Fw::StringBase& sequenceInInternalState
1818  ) const
1819  {
1820  // Get the time
1821  Fw::Time _logTime;
1822  if (this->isConnected_timeCaller_OutputPort(0)) {
1823  this->timeCaller_out(0, _logTime);
1824  }
1825 
1827 
1828  // Emit the event on the log port
1829  if (this->isConnected_logOut_OutputPort(0)) {
1830  Fw::LogBuffer _logBuff;
1832 
1833 #if FW_AMPCS_COMPATIBLE
1834  // Serialize the number of arguments
1835  _status = _logBuff.serializeFrom(static_cast<U8>(3));
1836  FW_ASSERT(
1837  _status == Fw::FW_SERIALIZE_OK,
1838  static_cast<FwAssertArgType>(_status)
1839  );
1840 #endif
1841 
1842 #if FW_AMPCS_COMPATIBLE
1843  // Serialize the argument size
1844  _status = _logBuff.serializeFrom(
1845  static_cast<U8>(sizeof(U16))
1846  );
1847  FW_ASSERT(
1848  _status == Fw::FW_SERIALIZE_OK,
1849  static_cast<FwAssertArgType>(_status)
1850  );
1851 #endif
1852  _status = _logBuff.serializeFrom(idx);
1853  FW_ASSERT(
1854  _status == Fw::FW_SERIALIZE_OK,
1855  static_cast<FwAssertArgType>(_status)
1856  );
1857 
1858  _status = newSequence.serializeTo(
1859  _logBuff,
1860  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 240)
1861  );
1862  FW_ASSERT(
1863  _status == Fw::FW_SERIALIZE_OK,
1864  static_cast<FwAssertArgType>(_status)
1865  );
1866 
1867  _status = sequenceInInternalState.serializeTo(
1868  _logBuff,
1869  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 240)
1870  );
1871  FW_ASSERT(
1872  _status == Fw::FW_SERIALIZE_OK,
1873  static_cast<FwAssertArgType>(_status)
1874  );
1875 
1876  this->logOut_out(
1877  0,
1878  _id,
1879  _logTime,
1881  _logBuff
1882  );
1883  }
1884 
1885  // Emit the event on the text log port
1886 #if FW_ENABLE_TEXT_LOGGING
1887  if (this->isConnected_logTextOut_OutputPort(0)) {
1888 #if FW_OBJECT_NAMES == 1
1889  const char* _formatString =
1890  "(%s) %s: Sequencer %" PRIu16 " started a sequence %s while still running %s";
1891 #else
1892  const char* _formatString =
1893  "%s: Sequencer %" PRIu16 " started a sequence %s while still running %s";
1894 #endif
1895 
1896  Fw::TextLogString _logString;
1897  (void) _logString.format(
1898  _formatString,
1899 #if FW_OBJECT_NAMES == 1
1900  this->m_objName.toChar(),
1901 #endif
1902  "ConflictingSequenceStarted ",
1903  idx,
1904  newSequence.toChar(),
1905  sequenceInInternalState.toChar()
1906  );
1907 
1908  this->logTextOut_out(
1909  0,
1910  _id,
1911  _logTime,
1913  _logString
1914  );
1915  }
1916 #endif
1917  }
1918 
1921  U16 idx,
1922  const Fw::StringBase& newSequence
1923  ) const
1924  {
1925  // Get the time
1926  Fw::Time _logTime;
1927  if (this->isConnected_timeCaller_OutputPort(0)) {
1928  this->timeCaller_out(0, _logTime);
1929  }
1930 
1932 
1933  // Emit the event on the log port
1934  if (this->isConnected_logOut_OutputPort(0)) {
1935  Fw::LogBuffer _logBuff;
1937 
1938 #if FW_AMPCS_COMPATIBLE
1939  // Serialize the number of arguments
1940  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1941  FW_ASSERT(
1942  _status == Fw::FW_SERIALIZE_OK,
1943  static_cast<FwAssertArgType>(_status)
1944  );
1945 #endif
1946 
1947 #if FW_AMPCS_COMPATIBLE
1948  // Serialize the argument size
1949  _status = _logBuff.serializeFrom(
1950  static_cast<U8>(sizeof(U16))
1951  );
1952  FW_ASSERT(
1953  _status == Fw::FW_SERIALIZE_OK,
1954  static_cast<FwAssertArgType>(_status)
1955  );
1956 #endif
1957  _status = _logBuff.serializeFrom(idx);
1958  FW_ASSERT(
1959  _status == Fw::FW_SERIALIZE_OK,
1960  static_cast<FwAssertArgType>(_status)
1961  );
1962 
1963  _status = newSequence.serializeTo(
1964  _logBuff,
1965  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 240)
1966  );
1967  FW_ASSERT(
1968  _status == Fw::FW_SERIALIZE_OK,
1969  static_cast<FwAssertArgType>(_status)
1970  );
1971 
1972  this->logOut_out(
1973  0,
1974  _id,
1975  _logTime,
1977  _logBuff
1978  );
1979  }
1980 
1981  // Emit the event on the text log port
1982 #if FW_ENABLE_TEXT_LOGGING
1983  if (this->isConnected_logTextOut_OutputPort(0)) {
1984 #if FW_OBJECT_NAMES == 1
1985  const char* _formatString =
1986  "(%s) %s: Sequencer %" PRIu16 " was externally commanded to start a sequence %s";
1987 #else
1988  const char* _formatString =
1989  "%s: Sequencer %" PRIu16 " was externally commanded to start a sequence %s";
1990 #endif
1991 
1992  Fw::TextLogString _logString;
1993  (void) _logString.format(
1994  _formatString,
1995 #if FW_OBJECT_NAMES == 1
1996  this->m_objName.toChar(),
1997 #endif
1998  "UnexpectedSequenceStarted ",
1999  idx,
2000  newSequence.toChar()
2001  );
2002 
2003  this->logTextOut_out(
2004  0,
2005  _id,
2006  _logTime,
2008  _logString
2009  );
2010  }
2011 #endif
2012  }
2013 
2016  U16 idx,
2018  const Fw::StringBase& filename
2019  ) const
2020  {
2021  // Get the time
2022  Fw::Time _logTime;
2023  if (this->isConnected_timeCaller_OutputPort(0)) {
2024  this->timeCaller_out(0, _logTime);
2025  }
2026 
2027  const FwEventIdType _id = this->getIdBase() + EVENTID_LOGSEQUENCERSTATUS;
2028 
2029  // Emit the event on the log port
2030  if (this->isConnected_logOut_OutputPort(0)) {
2031  Fw::LogBuffer _logBuff;
2033 
2034 #if FW_AMPCS_COMPATIBLE
2035  // Serialize the number of arguments
2036  _status = _logBuff.serializeFrom(static_cast<U8>(3));
2037  FW_ASSERT(
2038  _status == Fw::FW_SERIALIZE_OK,
2039  static_cast<FwAssertArgType>(_status)
2040  );
2041 #endif
2042 
2043 #if FW_AMPCS_COMPATIBLE
2044  // Serialize the argument size
2045  _status = _logBuff.serializeFrom(
2046  static_cast<U8>(sizeof(U16))
2047  );
2048  FW_ASSERT(
2049  _status == Fw::FW_SERIALIZE_OK,
2050  static_cast<FwAssertArgType>(_status)
2051  );
2052 #endif
2053  _status = _logBuff.serializeFrom(idx);
2054  FW_ASSERT(
2055  _status == Fw::FW_SERIALIZE_OK,
2056  static_cast<FwAssertArgType>(_status)
2057  );
2058 
2059 #if FW_AMPCS_COMPATIBLE
2060  // Serialize the argument size
2061  _status = _logBuff.serializeFrom(
2063  );
2064  FW_ASSERT(
2065  _status == Fw::FW_SERIALIZE_OK,
2066  static_cast<FwAssertArgType>(_status)
2067  );
2068 #endif
2069  _status = _logBuff.serializeFrom(state);
2070  FW_ASSERT(
2071  _status == Fw::FW_SERIALIZE_OK,
2072  static_cast<FwAssertArgType>(_status)
2073  );
2074 
2075  _status = filename.serializeTo(
2076  _logBuff,
2077  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 240)
2078  );
2079  FW_ASSERT(
2080  _status == Fw::FW_SERIALIZE_OK,
2081  static_cast<FwAssertArgType>(_status)
2082  );
2083 
2084  this->logOut_out(
2085  0,
2086  _id,
2087  _logTime,
2089  _logBuff
2090  );
2091  }
2092 
2093  // Emit the event on the text log port
2094 #if FW_ENABLE_TEXT_LOGGING
2095  if (this->isConnected_logTextOut_OutputPort(0)) {
2096 #if FW_OBJECT_NAMES == 1
2097  const char* _formatString =
2098  "(%s) %s: Sequencer %" PRIu16 " with state %s is running file %s";
2099 #else
2100  const char* _formatString =
2101  "%s: Sequencer %" PRIu16 " with state %s is running file %s";
2102 #endif
2103 
2104  Fw::String stateStr;
2105  state.toString(stateStr);
2106 
2107  Fw::TextLogString _logString;
2108  (void) _logString.format(
2109  _formatString,
2110 #if FW_OBJECT_NAMES == 1
2111  this->m_objName.toChar(),
2112 #endif
2113  "LogSequencerStatus ",
2114  idx,
2115  stateStr.toChar(),
2116  filename.toChar()
2117  );
2118 
2119  this->logTextOut_out(
2120  0,
2121  _id,
2122  _logTime,
2124  _logString
2125  );
2126  }
2127 #endif
2128  }
2129 
2132  U16 idx,
2133  const Fw::StringBase& filename
2134  ) const
2135  {
2136  // Get the time
2137  Fw::Time _logTime;
2138  if (this->isConnected_timeCaller_OutputPort(0)) {
2139  this->timeCaller_out(0, _logTime);
2140  }
2141 
2142  const FwEventIdType _id = this->getIdBase() + EVENTID_SEQUENCECANCELED;
2143 
2144  // Emit the event on the log port
2145  if (this->isConnected_logOut_OutputPort(0)) {
2146  Fw::LogBuffer _logBuff;
2148 
2149 #if FW_AMPCS_COMPATIBLE
2150  // Serialize the number of arguments
2151  _status = _logBuff.serializeFrom(static_cast<U8>(2));
2152  FW_ASSERT(
2153  _status == Fw::FW_SERIALIZE_OK,
2154  static_cast<FwAssertArgType>(_status)
2155  );
2156 #endif
2157 
2158 #if FW_AMPCS_COMPATIBLE
2159  // Serialize the argument size
2160  _status = _logBuff.serializeFrom(
2161  static_cast<U8>(sizeof(U16))
2162  );
2163  FW_ASSERT(
2164  _status == Fw::FW_SERIALIZE_OK,
2165  static_cast<FwAssertArgType>(_status)
2166  );
2167 #endif
2168  _status = _logBuff.serializeFrom(idx);
2169  FW_ASSERT(
2170  _status == Fw::FW_SERIALIZE_OK,
2171  static_cast<FwAssertArgType>(_status)
2172  );
2173 
2174  _status = filename.serializeTo(
2175  _logBuff,
2176  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 240)
2177  );
2178  FW_ASSERT(
2179  _status == Fw::FW_SERIALIZE_OK,
2180  static_cast<FwAssertArgType>(_status)
2181  );
2182 
2183  this->logOut_out(
2184  0,
2185  _id,
2186  _logTime,
2188  _logBuff
2189  );
2190  }
2191 
2192  // Emit the event on the text log port
2193 #if FW_ENABLE_TEXT_LOGGING
2194  if (this->isConnected_logTextOut_OutputPort(0)) {
2195 #if FW_OBJECT_NAMES == 1
2196  const char* _formatString =
2197  "(%s) %s: Sequencer %" PRIu16 " canceled running sequence %s";
2198 #else
2199  const char* _formatString =
2200  "%s: Sequencer %" PRIu16 " canceled running sequence %s";
2201 #endif
2202 
2203  Fw::TextLogString _logString;
2204  (void) _logString.format(
2205  _formatString,
2206 #if FW_OBJECT_NAMES == 1
2207  this->m_objName.toChar(),
2208 #endif
2209  "SequenceCanceled ",
2210  idx,
2211  filename.toChar()
2212  );
2213 
2214  this->logTextOut_out(
2215  0,
2216  _id,
2217  _logTime,
2219  _logString
2220  );
2221  }
2222 #endif
2223  }
2224 
2227  {
2228  // Get the time
2229  Fw::Time _logTime;
2230  if (this->isConnected_timeCaller_OutputPort(0)) {
2231  this->timeCaller_out(0, _logTime);
2232  }
2233 
2235 
2236  // Emit the event on the log port
2237  if (this->isConnected_logOut_OutputPort(0)) {
2238  Fw::LogBuffer _logBuff;
2240 
2241 #if FW_AMPCS_COMPATIBLE
2242  // Serialize the number of arguments
2243  _status = _logBuff.serializeFrom(static_cast<U8>(1));
2244  FW_ASSERT(
2245  _status == Fw::FW_SERIALIZE_OK,
2246  static_cast<FwAssertArgType>(_status)
2247  );
2248 #endif
2249 
2250  _status = filename.serializeTo(
2251  _logBuff,
2252  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 240)
2253  );
2254  FW_ASSERT(
2255  _status == Fw::FW_SERIALIZE_OK,
2256  static_cast<FwAssertArgType>(_status)
2257  );
2258 
2259  this->logOut_out(
2260  0,
2261  _id,
2262  _logTime,
2264  _logBuff
2265  );
2266  }
2267 
2268  // Emit the event on the text log port
2269 #if FW_ENABLE_TEXT_LOGGING
2270  if (this->isConnected_logTextOut_OutputPort(0)) {
2271 #if FW_OBJECT_NAMES == 1
2272  const char* _formatString =
2273  "(%s) %s: No running sequence matched file %s to cancel";
2274 #else
2275  const char* _formatString =
2276  "%s: No running sequence matched file %s to cancel";
2277 #endif
2278 
2279  Fw::TextLogString _logString;
2280  (void) _logString.format(
2281  _formatString,
2282 #if FW_OBJECT_NAMES == 1
2283  this->m_objName.toChar(),
2284 #endif
2285  "CancelSequenceNotFound ",
2286  filename.toChar()
2287  );
2288 
2289  this->logTextOut_out(
2290  0,
2291  _id,
2292  _logTime,
2294  _logString
2295  );
2296  }
2297 #endif
2298  }
2299 
2300  // ----------------------------------------------------------------------
2301  // Telemetry serialized write
2302  // ----------------------------------------------------------------------
2303 
2306  FwChanIdType id,
2307  Fw::TlmBuffer& _tlmBuff,
2308  Fw::Time _tlmTime
2309  ) const
2310  {
2311  if (this->isConnected_tlmOut_OutputPort(0)) {
2312  if (
2314  (_tlmTime == Fw::ZERO_TIME)
2315  ) {
2316  this->timeCaller_out(0, _tlmTime);
2317  }
2318 
2319  FwChanIdType _id;
2320  _id = this->getIdBase() + id;
2321 
2322  this->tlmOut_out(
2323  0,
2324  _id,
2325  _tlmTime,
2326  _tlmBuff
2327  );
2328  }
2329  }
2330 
2331  // ----------------------------------------------------------------------
2332  // Telemetry write functions
2333  // ----------------------------------------------------------------------
2334 
2337  U32 arg,
2338  Fw::Time _tlmTime
2339  ) const
2340  {
2341  if (this->isConnected_tlmOut_OutputPort(0)) {
2342  Fw::TlmBuffer _tlmBuff;
2343  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
2344  FW_ASSERT(
2345  _stat == Fw::FW_SERIALIZE_OK,
2346  static_cast<FwAssertArgType>(_stat)
2347  );
2348 
2349  this->tlmWrite(
2351  _tlmBuff,
2352  _tlmTime
2353  );
2354  }
2355  }
2356 
2359  U32 arg,
2360  Fw::Time _tlmTime
2361  ) const
2362  {
2363  if (this->isConnected_tlmOut_OutputPort(0)) {
2364  Fw::TlmBuffer _tlmBuff;
2365  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
2366  FW_ASSERT(
2367  _stat == Fw::FW_SERIALIZE_OK,
2368  static_cast<FwAssertArgType>(_stat)
2369  );
2370 
2371  this->tlmWrite(
2373  _tlmBuff,
2374  _tlmTime
2375  );
2376  }
2377  }
2378 
2381  U32 arg,
2382  Fw::Time _tlmTime
2383  ) const
2384  {
2385  if (this->isConnected_tlmOut_OutputPort(0)) {
2386  Fw::TlmBuffer _tlmBuff;
2387  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
2388  FW_ASSERT(
2389  _stat == Fw::FW_SERIALIZE_OK,
2390  static_cast<FwAssertArgType>(_stat)
2391  );
2392 
2393  this->tlmWrite(
2395  _tlmBuff,
2396  _tlmTime
2397  );
2398  }
2399  }
2400 
2403  U32 arg,
2404  Fw::Time _tlmTime
2405  ) const
2406  {
2407  if (this->isConnected_tlmOut_OutputPort(0)) {
2408  Fw::TlmBuffer _tlmBuff;
2409  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
2410  FW_ASSERT(
2411  _stat == Fw::FW_SERIALIZE_OK,
2412  static_cast<FwAssertArgType>(_stat)
2413  );
2414 
2415  this->tlmWrite(
2417  _tlmBuff,
2418  _tlmTime
2419  );
2420  }
2421  }
2422 
2423  // ----------------------------------------------------------------------
2424  // Time
2425  // ----------------------------------------------------------------------
2426 
2428  getTime() const
2429  {
2430  if (this->isConnected_timeCaller_OutputPort(0)) {
2431  Fw::Time _time;
2432  this->timeCaller_out(0, _time);
2433  return _time;
2434  }
2435  else {
2436  return Fw::Time(TimeBase::TB_NONE, 0, 0);
2437  }
2438  }
2439 
2440  // ----------------------------------------------------------------------
2441  // Message dispatch functions
2442  // ----------------------------------------------------------------------
2443 
2444  Fw::QueuedComponentBase::MsgDispatchStatus SeqDispatcherComponentBase ::
2445  doDispatch()
2446  {
2447  ComponentIpcSerializableBuffer _msg;
2448  FwQueuePriorityType _priority = 0;
2449 
2450  Os::Queue::Status _msgStatus = this->m_queue.receive(
2451  _msg,
2453  _priority
2454  );
2455  FW_ASSERT(
2456  _msgStatus == Os::Queue::OP_OK,
2457  static_cast<FwAssertArgType>(_msgStatus)
2458  );
2459 
2460  // Reset to beginning of buffer
2461  _msg.resetDeser();
2462 
2463  FwEnumStoreType _desMsg = 0;
2464  Fw::SerializeStatus _deserStatus = _msg.deserializeTo(_desMsg);
2465  FW_ASSERT(
2466  _deserStatus == Fw::FW_SERIALIZE_OK,
2467  static_cast<FwAssertArgType>(_deserStatus)
2468  );
2469 
2470  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
2471 
2472  if (_msgType == SEQDISPATCHER_COMPONENT_EXIT) {
2473  return MSG_DISPATCH_EXIT;
2474  }
2475 
2476  FwIndexType portNum = 0;
2477  _deserStatus = _msg.deserializeTo(portNum);
2478  FW_ASSERT(
2479  _deserStatus == Fw::FW_SERIALIZE_OK,
2480  static_cast<FwAssertArgType>(_deserStatus)
2481  );
2482 
2483  switch (_msgType) {
2484  // Handle async input port seqDoneIn
2485  case SEQDONEIN_CMDRESPONSE: {
2486  // Deserialize argument opCode
2487  FwOpcodeType opCode;
2488  _deserStatus = _msg.deserializeTo(opCode);
2489  FW_ASSERT(
2490  _deserStatus == Fw::FW_SERIALIZE_OK,
2491  static_cast<FwAssertArgType>(_deserStatus)
2492  );
2493 
2494  // Deserialize argument cmdSeq
2495  U32 cmdSeq;
2496  _deserStatus = _msg.deserializeTo(cmdSeq);
2497  FW_ASSERT(
2498  _deserStatus == Fw::FW_SERIALIZE_OK,
2499  static_cast<FwAssertArgType>(_deserStatus)
2500  );
2501 
2502  // Deserialize argument response
2503  Fw::CmdResponse response;
2504  _deserStatus = _msg.deserializeTo(response);
2505  FW_ASSERT(
2506  _deserStatus == Fw::FW_SERIALIZE_OK,
2507  static_cast<FwAssertArgType>(_deserStatus)
2508  );
2509  // Call handler function
2510  this->seqDoneIn_handler(
2511  portNum,
2512  opCode,
2513  cmdSeq,
2514  response
2515  );
2516 
2517  break;
2518  }
2519 
2520  // Handle async input port seqRunIn
2521  case SEQRUNIN_CMDSEQIN: {
2522  // Deserialize argument filename
2523  char __fprime_ac_filename_buffer[Fw::StringBase::BUFFER_SIZE(240)];
2524  Fw::ExternalString filename(__fprime_ac_filename_buffer, sizeof __fprime_ac_filename_buffer);
2525  _deserStatus = _msg.deserializeTo(filename);
2526  FW_ASSERT(
2527  _deserStatus == Fw::FW_SERIALIZE_OK,
2528  static_cast<FwAssertArgType>(_deserStatus)
2529  );
2530 
2531  // Deserialize argument args
2532  Svc::SeqArgs args;
2533  _deserStatus = _msg.deserializeTo(args);
2534  FW_ASSERT(
2535  _deserStatus == Fw::FW_SERIALIZE_OK,
2536  static_cast<FwAssertArgType>(_deserStatus)
2537  );
2538  // Call handler function
2539  this->seqRunIn_handler(
2540  portNum,
2541  filename,
2542  args
2543  );
2544 
2545  break;
2546  }
2547 
2548  // Handle async input port seqStartIn
2549  case SEQSTARTIN_CMDSEQIN: {
2550  // Deserialize argument filename
2551  char __fprime_ac_filename_buffer[Fw::StringBase::BUFFER_SIZE(240)];
2552  Fw::ExternalString filename(__fprime_ac_filename_buffer, sizeof __fprime_ac_filename_buffer);
2553  _deserStatus = _msg.deserializeTo(filename);
2554  FW_ASSERT(
2555  _deserStatus == Fw::FW_SERIALIZE_OK,
2556  static_cast<FwAssertArgType>(_deserStatus)
2557  );
2558 
2559  // Deserialize argument args
2560  Svc::SeqArgs args;
2561  _deserStatus = _msg.deserializeTo(args);
2562  FW_ASSERT(
2563  _deserStatus == Fw::FW_SERIALIZE_OK,
2564  static_cast<FwAssertArgType>(_deserStatus)
2565  );
2566  // Call handler function
2567  this->seqStartIn_handler(
2568  portNum,
2569  filename,
2570  args
2571  );
2572 
2573  break;
2574  }
2575 
2576  // Handle command RUN
2577  case CMD_RUN: {
2578  // Deserialize opcode
2579  FwOpcodeType _opCode = 0;
2580  _deserStatus = _msg.deserializeTo(_opCode);
2581  FW_ASSERT (
2582  _deserStatus == Fw::FW_SERIALIZE_OK,
2583  static_cast<FwAssertArgType>(_deserStatus)
2584  );
2585 
2586  // Deserialize command sequence
2587  U32 _cmdSeq = 0;
2588  _deserStatus = _msg.deserializeTo(_cmdSeq);
2589  FW_ASSERT (
2590  _deserStatus == Fw::FW_SERIALIZE_OK,
2591  static_cast<FwAssertArgType>(_deserStatus)
2592  );
2593 
2594  // Deserialize command argument buffer
2595  Fw::CmdArgBuffer args;
2596  _deserStatus = _msg.deserializeTo(args);
2597  FW_ASSERT (
2598  _deserStatus == Fw::FW_SERIALIZE_OK,
2599  static_cast<FwAssertArgType>(_deserStatus)
2600  );
2601 
2602  // Reset buffer
2603  args.resetDeser();
2604 
2605  // Deserialize argument fileName
2606  Fw::CmdStringArg fileName;
2607  _deserStatus = args.deserializeTo(fileName);
2608  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2610  this->cmdResponse_out(
2611  _opCode,
2612  _cmdSeq,
2614  );
2615  }
2616  // Don't crash the task if bad arguments were passed from the ground
2617  break;
2618  }
2619 
2620  // Deserialize argument block
2621  Svc::BlockState block;
2622  _deserStatus = args.deserializeTo(block);
2623  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2625  this->cmdResponse_out(
2626  _opCode,
2627  _cmdSeq,
2629  );
2630  }
2631  // Don't crash the task if bad arguments were passed from the ground
2632  break;
2633  }
2634 
2635  // Make sure there was no data left over.
2636  // That means the argument buffer size was incorrect.
2637 #if FW_CMD_CHECK_RESIDUAL
2638  if (args.getDeserializeSizeLeft() != 0) {
2640  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2641  }
2642  // Don't crash the task if bad arguments were passed from the ground
2643  break;
2644  }
2645 #endif
2646 
2647  // Call handler function
2648  this->RUN_cmdHandler(
2649  _opCode, _cmdSeq,
2650  fileName,
2651  block
2652  );
2653 
2654  break;
2655  }
2656 
2657  // Handle command RUN_ARGS
2658  case CMD_RUN_ARGS: {
2659  // Deserialize opcode
2660  FwOpcodeType _opCode = 0;
2661  _deserStatus = _msg.deserializeTo(_opCode);
2662  FW_ASSERT (
2663  _deserStatus == Fw::FW_SERIALIZE_OK,
2664  static_cast<FwAssertArgType>(_deserStatus)
2665  );
2666 
2667  // Deserialize command sequence
2668  U32 _cmdSeq = 0;
2669  _deserStatus = _msg.deserializeTo(_cmdSeq);
2670  FW_ASSERT (
2671  _deserStatus == Fw::FW_SERIALIZE_OK,
2672  static_cast<FwAssertArgType>(_deserStatus)
2673  );
2674 
2675  // Deserialize command argument buffer
2676  Fw::CmdArgBuffer args;
2677  _deserStatus = _msg.deserializeTo(args);
2678  FW_ASSERT (
2679  _deserStatus == Fw::FW_SERIALIZE_OK,
2680  static_cast<FwAssertArgType>(_deserStatus)
2681  );
2682 
2683  // Reset buffer
2684  args.resetDeser();
2685 
2686  // Deserialize argument fileName
2687  Fw::CmdStringArg fileName;
2688  _deserStatus = args.deserializeTo(fileName);
2689  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2691  this->cmdResponse_out(
2692  _opCode,
2693  _cmdSeq,
2695  );
2696  }
2697  // Don't crash the task if bad arguments were passed from the ground
2698  break;
2699  }
2700 
2701  // Deserialize argument block
2702  Svc::BlockState block;
2703  _deserStatus = args.deserializeTo(block);
2704  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2706  this->cmdResponse_out(
2707  _opCode,
2708  _cmdSeq,
2710  );
2711  }
2712  // Don't crash the task if bad arguments were passed from the ground
2713  break;
2714  }
2715 
2716  // Deserialize argument buffer
2717  Svc::SeqArgs buffer;
2718  _deserStatus = args.deserializeTo(buffer);
2719  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2721  this->cmdResponse_out(
2722  _opCode,
2723  _cmdSeq,
2725  );
2726  }
2727  // Don't crash the task if bad arguments were passed from the ground
2728  break;
2729  }
2730 
2731  // Make sure there was no data left over.
2732  // That means the argument buffer size was incorrect.
2733 #if FW_CMD_CHECK_RESIDUAL
2734  if (args.getDeserializeSizeLeft() != 0) {
2736  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2737  }
2738  // Don't crash the task if bad arguments were passed from the ground
2739  break;
2740  }
2741 #endif
2742 
2743  // Call handler function
2744  this->RUN_ARGS_cmdHandler(
2745  _opCode, _cmdSeq,
2746  fileName,
2747  block,
2748  buffer
2749  );
2750 
2751  break;
2752  }
2753 
2754  // Handle command LOG_STATUS
2755  case CMD_LOG_STATUS: {
2756  // Deserialize opcode
2757  FwOpcodeType _opCode = 0;
2758  _deserStatus = _msg.deserializeTo(_opCode);
2759  FW_ASSERT (
2760  _deserStatus == Fw::FW_SERIALIZE_OK,
2761  static_cast<FwAssertArgType>(_deserStatus)
2762  );
2763 
2764  // Deserialize command sequence
2765  U32 _cmdSeq = 0;
2766  _deserStatus = _msg.deserializeTo(_cmdSeq);
2767  FW_ASSERT (
2768  _deserStatus == Fw::FW_SERIALIZE_OK,
2769  static_cast<FwAssertArgType>(_deserStatus)
2770  );
2771 
2772  // Deserialize command argument buffer
2773  Fw::CmdArgBuffer args;
2774  _deserStatus = _msg.deserializeTo(args);
2775  FW_ASSERT (
2776  _deserStatus == Fw::FW_SERIALIZE_OK,
2777  static_cast<FwAssertArgType>(_deserStatus)
2778  );
2779 
2780  // Reset buffer
2781  args.resetDeser();
2782 
2783  // Make sure there was no data left over.
2784  // That means the argument buffer size was incorrect.
2785 #if FW_CMD_CHECK_RESIDUAL
2786  if (args.getDeserializeSizeLeft() != 0) {
2788  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2789  }
2790  // Don't crash the task if bad arguments were passed from the ground
2791  break;
2792  }
2793 #endif
2794 
2795  // Call handler function
2796  this->LOG_STATUS_cmdHandler(_opCode, _cmdSeq);
2797 
2798  break;
2799  }
2800 
2801  // Handle command CANCEL_NAME
2802  case CMD_CANCEL_NAME: {
2803  // Deserialize opcode
2804  FwOpcodeType _opCode = 0;
2805  _deserStatus = _msg.deserializeTo(_opCode);
2806  FW_ASSERT (
2807  _deserStatus == Fw::FW_SERIALIZE_OK,
2808  static_cast<FwAssertArgType>(_deserStatus)
2809  );
2810 
2811  // Deserialize command sequence
2812  U32 _cmdSeq = 0;
2813  _deserStatus = _msg.deserializeTo(_cmdSeq);
2814  FW_ASSERT (
2815  _deserStatus == Fw::FW_SERIALIZE_OK,
2816  static_cast<FwAssertArgType>(_deserStatus)
2817  );
2818 
2819  // Deserialize command argument buffer
2820  Fw::CmdArgBuffer args;
2821  _deserStatus = _msg.deserializeTo(args);
2822  FW_ASSERT (
2823  _deserStatus == Fw::FW_SERIALIZE_OK,
2824  static_cast<FwAssertArgType>(_deserStatus)
2825  );
2826 
2827  // Reset buffer
2828  args.resetDeser();
2829 
2830  // Deserialize argument fileName
2831  Fw::CmdStringArg fileName;
2832  _deserStatus = args.deserializeTo(fileName);
2833  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2835  this->cmdResponse_out(
2836  _opCode,
2837  _cmdSeq,
2839  );
2840  }
2841  // Don't crash the task if bad arguments were passed from the ground
2842  break;
2843  }
2844 
2845  // Make sure there was no data left over.
2846  // That means the argument buffer size was incorrect.
2847 #if FW_CMD_CHECK_RESIDUAL
2848  if (args.getDeserializeSizeLeft() != 0) {
2850  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2851  }
2852  // Don't crash the task if bad arguments were passed from the ground
2853  break;
2854  }
2855 #endif
2856 
2857  // Call handler function
2858  this->CANCEL_NAME_cmdHandler(
2859  _opCode, _cmdSeq,
2860  fileName
2861  );
2862 
2863  break;
2864  }
2865 
2866  // Handle command CANCEL_ALL
2867  case CMD_CANCEL_ALL: {
2868  // Deserialize opcode
2869  FwOpcodeType _opCode = 0;
2870  _deserStatus = _msg.deserializeTo(_opCode);
2871  FW_ASSERT (
2872  _deserStatus == Fw::FW_SERIALIZE_OK,
2873  static_cast<FwAssertArgType>(_deserStatus)
2874  );
2875 
2876  // Deserialize command sequence
2877  U32 _cmdSeq = 0;
2878  _deserStatus = _msg.deserializeTo(_cmdSeq);
2879  FW_ASSERT (
2880  _deserStatus == Fw::FW_SERIALIZE_OK,
2881  static_cast<FwAssertArgType>(_deserStatus)
2882  );
2883 
2884  // Deserialize command argument buffer
2885  Fw::CmdArgBuffer args;
2886  _deserStatus = _msg.deserializeTo(args);
2887  FW_ASSERT (
2888  _deserStatus == Fw::FW_SERIALIZE_OK,
2889  static_cast<FwAssertArgType>(_deserStatus)
2890  );
2891 
2892  // Reset buffer
2893  args.resetDeser();
2894 
2895  // Make sure there was no data left over.
2896  // That means the argument buffer size was incorrect.
2897 #if FW_CMD_CHECK_RESIDUAL
2898  if (args.getDeserializeSizeLeft() != 0) {
2900  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2901  }
2902  // Don't crash the task if bad arguments were passed from the ground
2903  break;
2904  }
2905 #endif
2906 
2907  // Call handler function
2908  this->CANCEL_ALL_cmdHandler(_opCode, _cmdSeq);
2909 
2910  break;
2911  }
2912 
2913  default:
2914  return MSG_DISPATCH_ERROR;
2915  }
2916 
2917  return MSG_DISPATCH_OK;
2918  }
2919 
2920  // ----------------------------------------------------------------------
2921  // Calls for messages received on special input ports
2922  // ----------------------------------------------------------------------
2923 
2924  void SeqDispatcherComponentBase ::
2925  m_p_cmdIn_in(
2926  Fw::PassiveComponentBase* callComp,
2927  FwIndexType portNum,
2928  FwOpcodeType opCode,
2929  U32 cmdSeq,
2930  Fw::CmdArgBuffer& args
2931  )
2932  {
2933  FW_ASSERT(callComp != nullptr);
2934  SeqDispatcherComponentBase* compPtr = static_cast<SeqDispatcherComponentBase*>(callComp);
2935  compPtr->cmdIn_handlerBase(
2936  portNum,
2937  opCode,
2938  cmdSeq,
2939  args
2940  );
2941  }
2942 
2943  // ----------------------------------------------------------------------
2944  // Calls for messages received on typed input ports
2945  // ----------------------------------------------------------------------
2946 
2947  void SeqDispatcherComponentBase ::
2948  m_p_seqDoneIn_in(
2949  Fw::PassiveComponentBase* callComp,
2950  FwIndexType portNum,
2951  FwOpcodeType opCode,
2952  U32 cmdSeq,
2953  const Fw::CmdResponse& response
2954  )
2955  {
2956  FW_ASSERT(callComp != nullptr);
2957  SeqDispatcherComponentBase* compPtr = static_cast<SeqDispatcherComponentBase*>(callComp);
2958  compPtr->seqDoneIn_handlerBase(
2959  portNum,
2960  opCode,
2961  cmdSeq,
2962  response
2963  );
2964  }
2965 
2966  void SeqDispatcherComponentBase ::
2967  m_p_seqRunIn_in(
2968  Fw::PassiveComponentBase* callComp,
2969  FwIndexType portNum,
2970  const Fw::StringBase& filename,
2971  const Svc::SeqArgs& args
2972  )
2973  {
2974  FW_ASSERT(callComp != nullptr);
2975  SeqDispatcherComponentBase* compPtr = static_cast<SeqDispatcherComponentBase*>(callComp);
2976  compPtr->seqRunIn_handlerBase(
2977  portNum,
2978  filename,
2979  args
2980  );
2981  }
2982 
2983  void SeqDispatcherComponentBase ::
2984  m_p_seqStartIn_in(
2985  Fw::PassiveComponentBase* callComp,
2986  FwIndexType portNum,
2987  const Fw::StringBase& filename,
2988  const Svc::SeqArgs& args
2989  )
2990  {
2991  FW_ASSERT(callComp != nullptr);
2992  SeqDispatcherComponentBase* compPtr = static_cast<SeqDispatcherComponentBase*>(callComp);
2993  compPtr->seqStartIn_handlerBase(
2994  portNum,
2995  filename,
2996  args
2997  );
2998  }
2999 
3000 #if !FW_DIRECT_PORT_CALLS
3001 
3002  // ----------------------------------------------------------------------
3003  // Invocation functions for special output ports
3004  // ----------------------------------------------------------------------
3005 
3006  void SeqDispatcherComponentBase ::
3007  cmdRegOut_out(
3008  FwIndexType portNum,
3009  FwOpcodeType opCode
3010  ) const
3011  {
3012  FW_ASSERT(
3013  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
3014  static_cast<FwAssertArgType>(portNum)
3015  );
3016 
3017  FW_ASSERT(
3018  this->m_cmdRegOut_OutputPort[portNum].isConnected(),
3019  static_cast<FwAssertArgType>(portNum)
3020  );
3021  this->m_cmdRegOut_OutputPort[portNum].invoke(
3022  opCode
3023  );
3024  }
3025 
3026  void SeqDispatcherComponentBase ::
3027  cmdResponseOut_out(
3028  FwIndexType portNum,
3029  FwOpcodeType opCode,
3030  U32 cmdSeq,
3031  const Fw::CmdResponse& response
3032  ) const
3033  {
3034  FW_ASSERT(
3035  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
3036  static_cast<FwAssertArgType>(portNum)
3037  );
3038 
3039  FW_ASSERT(
3040  this->m_cmdResponseOut_OutputPort[portNum].isConnected(),
3041  static_cast<FwAssertArgType>(portNum)
3042  );
3043  this->m_cmdResponseOut_OutputPort[portNum].invoke(
3044  opCode,
3045  cmdSeq,
3046  response
3047  );
3048  }
3049 
3050  void SeqDispatcherComponentBase ::
3051  logOut_out(
3052  FwIndexType portNum,
3053  FwEventIdType id,
3054  Fw::Time& timeTag,
3055  const Fw::LogSeverity& severity,
3056  Fw::LogBuffer& args
3057  ) const
3058  {
3059  FW_ASSERT(
3060  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
3061  static_cast<FwAssertArgType>(portNum)
3062  );
3063 
3064  FW_ASSERT(
3065  this->m_logOut_OutputPort[portNum].isConnected(),
3066  static_cast<FwAssertArgType>(portNum)
3067  );
3068  this->m_logOut_OutputPort[portNum].invoke(
3069  id,
3070  timeTag,
3071  severity,
3072  args
3073  );
3074  }
3075 
3076 #if FW_ENABLE_TEXT_LOGGING
3077 
3078  void SeqDispatcherComponentBase ::
3079  logTextOut_out(
3080  FwIndexType portNum,
3081  FwEventIdType id,
3082  Fw::Time& timeTag,
3083  const Fw::LogSeverity& severity,
3084  Fw::TextLogString& text
3085  ) const
3086  {
3087  FW_ASSERT(
3088  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
3089  static_cast<FwAssertArgType>(portNum)
3090  );
3091 
3092  FW_ASSERT(
3093  this->m_logTextOut_OutputPort[portNum].isConnected(),
3094  static_cast<FwAssertArgType>(portNum)
3095  );
3096  this->m_logTextOut_OutputPort[portNum].invoke(
3097  id,
3098  timeTag,
3099  severity,
3100  text
3101  );
3102  }
3103 
3104 #endif
3105 
3106  void SeqDispatcherComponentBase ::
3107  timeCaller_out(
3108  FwIndexType portNum,
3109  Fw::Time& time
3110  ) const
3111  {
3112  FW_ASSERT(
3113  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
3114  static_cast<FwAssertArgType>(portNum)
3115  );
3116 
3117  FW_ASSERT(
3118  this->m_timeCaller_OutputPort[portNum].isConnected(),
3119  static_cast<FwAssertArgType>(portNum)
3120  );
3121  this->m_timeCaller_OutputPort[portNum].invoke(
3122  time
3123  );
3124  }
3125 
3126  void SeqDispatcherComponentBase ::
3127  tlmOut_out(
3128  FwIndexType portNum,
3129  FwChanIdType id,
3130  Fw::Time& timeTag,
3131  Fw::TlmBuffer& val
3132  ) const
3133  {
3134  FW_ASSERT(
3135  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
3136  static_cast<FwAssertArgType>(portNum)
3137  );
3138 
3139  FW_ASSERT(
3140  this->m_tlmOut_OutputPort[portNum].isConnected(),
3141  static_cast<FwAssertArgType>(portNum)
3142  );
3143  this->m_tlmOut_OutputPort[portNum].invoke(
3144  id,
3145  timeTag,
3146  val
3147  );
3148  }
3149 
3150 #endif
3151 
3152 }
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:27
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
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)
message to exit active component task
void addCallPort(InputCmdSeqCancelPort *callPort)
Register an input port.
void init()
Initialization function.
void init()
Initialization function.
Definition: CmdPortAc.cpp:89
SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG) override
Deserialize an 8-bit unsigned integer value.
bool isConnected_timeCaller_OutputPort(FwIndexType portNum) const
virtual void RUN_ARGS_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdStringArg &fileName, const Svc::BlockState &block, const Svc::SeqArgs &buffer)=0
Dispatches a sequence to the first available sequencer.
Cancels any running sequence matching the given file name.
Logs via Events the state of each connected command sequencer.
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 CANCEL_NAME_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdStringArg &fileName)=0
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)
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
virtual void seqRunIn_preMsgHook(FwIndexType portNum, const Fw::StringBase &filename, const Svc::SeqArgs &args)
Pre-message hook for async input port seqRunIn.
void tlmWrite_canceledCount(U32 arg, Fw::Time _tlmTime=Fw::Time()) const
void addCallPort(InputCmdRegPort *callPort)
Register an input port.
void CANCEL_ALL_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
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()
virtual void CANCEL_ALL_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command CANCEL_ALL.
Dispatches a sequence with arguments to the first available sequencer.
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
bool isConnected_seqCancelOut_OutputPort(FwIndexType portNum) const
void log_WARNING_LO_CancelSequenceNotFound(const Fw::StringBase &filename) const
Log event CancelSequenceNotFound.
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 init()
Initialization function.
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
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:99
A less serious but recoverable event.
void set_seqRunOut_OutputPort(FwIndexType portNum, Svc::InputCmdSeqInPort *port)
Connect port to seqRunOut[portNum].
virtual void CANCEL_ALL_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
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 set_seqCancelOut_OutputPort(FwIndexType portNum, Svc::InputCmdSeqCancelPort *port)
Connect port to seqCancelOut[portNum].
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke a port connection.
FwIdType FwChanIdType
The type of a telemetry channel identifier.
SeqDispatcherComponentBase(const char *compName="")
Construct SeqDispatcherComponentBase object.
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()
Sequencer blocking state.
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
const char * toChar() const
Convert to a C-style char*.
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:58
void init()
Initialization function.
Definition: LogPortAc.cpp:180
void setPortNum(FwIndexType portNum)
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:54
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.
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 log_ACTIVITY_LO_LogSequencerStatus(U16 idx, const Svc::SeqDispatcher_CmdSequencerState &state, const Fw::StringBase &filename) const
Log event LogSequencerStatus.
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 invoke() const
Invoke a port connection.
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
U8 BYTE
byte type
Definition: BasicTypes.h:57
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].
static constexpr FwIndexType getNum_seqCancelOut_OutputPorts()
static constexpr FwIndexType getNum_seqRunIn_InputPorts()
void CANCEL_NAME_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Message will return with status when space is unavailable.
Definition: Queue.hpp:48
virtual void RUN_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdStringArg &fileName, const Svc::BlockState &block)=0
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 seqCancelOut_out(FwIndexType portNum) const
Invoke output port seqCancelOut.
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_ACTIVITY_HI_SequenceCanceled(U16 idx, const Fw::StringBase &filename) const
Log event SequenceCanceled.
void log_WARNING_HI_ConflictingSequenceStarted(U16 idx, const Fw::StringBase &newSequence, const Fw::StringBase &sequenceInInternalState) const
Log event ConflictingSequenceStarted.
virtual void CANCEL_NAME_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command CANCEL_NAME.
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].
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.
SerializeStatus serializeTo(SerialBufferBase &buffer, Endianness mode=Endianness::BIG) const override
Serialize the contents of this object to a buffer.
BYTE cmdPortSize[Fw::CmdPortBuffer::CAPACITY]