F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CommandDispatcherComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title CommandDispatcherComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for CommandDispatcher component base class
5 // ======================================================================
6 
8 #include "Fw/Types/Assert.hpp"
10 #if FW_ENABLE_TEXT_LOGGING
11 #include "Fw/Types/String.hpp"
12 #endif
13 
14 namespace Svc {
15 
16  namespace {
17  enum MsgTypeEnum {
18  COMMANDDISPATCHER_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT,
19  COMPCMDSTAT_CMDRESPONSE,
20  PINGIN_PING,
21  SEQCMDBUFF_COM,
22  CMD_CMD_NO_OP,
23  CMD_CMD_NO_OP_STRING,
24  CMD_CMD_TEST_CMD_1,
25  CMD_CMD_CLEAR_TRACKING,
26  };
27 
28  // Get the max size by constructing a union of the async input, command, and
29  // internal port serialization sizes
30  union BuffUnion {
33  BYTE seqCmdBuffPortSize[Fw::InputComPort::SERIALIZED_SIZE];
35  };
36 
37  // Define a message buffer class large enough to handle all the
38  // asynchronous inputs to the component
39  class ComponentIpcSerializableBuffer :
41  {
42 
43  public:
44 
45  enum {
46  // Max. message size = size of data + message id + port
47  SERIALIZATION_SIZE =
48  sizeof(BuffUnion) +
49  sizeof(FwEnumStoreType) +
50  sizeof(FwIndexType)
51  };
52 
53  Fw::Serializable::SizeType getBuffCapacity() 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 
77  init(
78  FwSizeType queueDepth,
79  FwEnumStoreType instance
80  )
81  {
82  // Initialize base class
84 
85  // Connect input port CmdDisp
86  for (
87  FwIndexType port = 0;
88  port < static_cast<FwIndexType>(this->getNum_CmdDisp_InputPorts());
89  port++
90  ) {
91  this->m_CmdDisp_InputPort[port].init();
92  this->m_CmdDisp_InputPort[port].addCallComp(
93  this,
94  m_p_CmdDisp_in
95  );
96  this->m_CmdDisp_InputPort[port].setPortNum(port);
97 
98 #if FW_OBJECT_NAMES == 1
99  Fw::ObjectName portName;
100  portName.format(
101  "%s_CmdDisp_InputPort[%" PRI_PlatformIntType "]",
102  this->m_objName.toChar(),
103  port
104  );
105  this->m_CmdDisp_InputPort[port].setObjName(portName.toChar());
106 #endif
107  }
108 
109  // Connect input port compCmdReg
110  for (
111  FwIndexType port = 0;
112  port < static_cast<FwIndexType>(this->getNum_compCmdReg_InputPorts());
113  port++
114  ) {
115  this->m_compCmdReg_InputPort[port].init();
116  this->m_compCmdReg_InputPort[port].addCallComp(
117  this,
118  m_p_compCmdReg_in
119  );
120  this->m_compCmdReg_InputPort[port].setPortNum(port);
121 
122 #if FW_OBJECT_NAMES == 1
123  Fw::ObjectName portName;
124  portName.format(
125  "%s_compCmdReg_InputPort[%" PRI_PlatformIntType "]",
126  this->m_objName.toChar(),
127  port
128  );
129  this->m_compCmdReg_InputPort[port].setObjName(portName.toChar());
130 #endif
131  }
132 
133  // Connect input port compCmdStat
134  for (
135  FwIndexType port = 0;
136  port < static_cast<FwIndexType>(this->getNum_compCmdStat_InputPorts());
137  port++
138  ) {
139  this->m_compCmdStat_InputPort[port].init();
140  this->m_compCmdStat_InputPort[port].addCallComp(
141  this,
142  m_p_compCmdStat_in
143  );
144  this->m_compCmdStat_InputPort[port].setPortNum(port);
145 
146 #if FW_OBJECT_NAMES == 1
147  Fw::ObjectName portName;
148  portName.format(
149  "%s_compCmdStat_InputPort[%" PRI_PlatformIntType "]",
150  this->m_objName.toChar(),
151  port
152  );
153  this->m_compCmdStat_InputPort[port].setObjName(portName.toChar());
154 #endif
155  }
156 
157  // Connect input port pingIn
158  for (
159  FwIndexType port = 0;
160  port < static_cast<FwIndexType>(this->getNum_pingIn_InputPorts());
161  port++
162  ) {
163  this->m_pingIn_InputPort[port].init();
164  this->m_pingIn_InputPort[port].addCallComp(
165  this,
166  m_p_pingIn_in
167  );
168  this->m_pingIn_InputPort[port].setPortNum(port);
169 
170 #if FW_OBJECT_NAMES == 1
171  Fw::ObjectName portName;
172  portName.format(
173  "%s_pingIn_InputPort[%" PRI_PlatformIntType "]",
174  this->m_objName.toChar(),
175  port
176  );
177  this->m_pingIn_InputPort[port].setObjName(portName.toChar());
178 #endif
179  }
180 
181  // Connect input port seqCmdBuff
182  for (
183  FwIndexType port = 0;
184  port < static_cast<FwIndexType>(this->getNum_seqCmdBuff_InputPorts());
185  port++
186  ) {
187  this->m_seqCmdBuff_InputPort[port].init();
188  this->m_seqCmdBuff_InputPort[port].addCallComp(
189  this,
190  m_p_seqCmdBuff_in
191  );
192  this->m_seqCmdBuff_InputPort[port].setPortNum(port);
193 
194 #if FW_OBJECT_NAMES == 1
195  Fw::ObjectName portName;
196  portName.format(
197  "%s_seqCmdBuff_InputPort[%" PRI_PlatformIntType "]",
198  this->m_objName.toChar(),
199  port
200  );
201  this->m_seqCmdBuff_InputPort[port].setObjName(portName.toChar());
202 #endif
203  }
204 
205  // Connect output port CmdReg
206  for (
207  FwIndexType port = 0;
208  port < static_cast<FwIndexType>(this->getNum_CmdReg_OutputPorts());
209  port++
210  ) {
211  this->m_CmdReg_OutputPort[port].init();
212 
213 #if FW_OBJECT_NAMES == 1
214  Fw::ObjectName portName;
215  portName.format(
216  "%s_CmdReg_OutputPort[%" PRI_PlatformIntType "]",
217  this->m_objName.toChar(),
218  port
219  );
220  this->m_CmdReg_OutputPort[port].setObjName(portName.toChar());
221 #endif
222  }
223 
224  // Connect output port CmdStatus
225  for (
226  FwIndexType port = 0;
227  port < static_cast<FwIndexType>(this->getNum_CmdStatus_OutputPorts());
228  port++
229  ) {
230  this->m_CmdStatus_OutputPort[port].init();
231 
232 #if FW_OBJECT_NAMES == 1
233  Fw::ObjectName portName;
234  portName.format(
235  "%s_CmdStatus_OutputPort[%" PRI_PlatformIntType "]",
236  this->m_objName.toChar(),
237  port
238  );
239  this->m_CmdStatus_OutputPort[port].setObjName(portName.toChar());
240 #endif
241  }
242 
243  // Connect output port Log
244  for (
245  FwIndexType port = 0;
246  port < static_cast<FwIndexType>(this->getNum_Log_OutputPorts());
247  port++
248  ) {
249  this->m_Log_OutputPort[port].init();
250 
251 #if FW_OBJECT_NAMES == 1
252  Fw::ObjectName portName;
253  portName.format(
254  "%s_Log_OutputPort[%" PRI_PlatformIntType "]",
255  this->m_objName.toChar(),
256  port
257  );
258  this->m_Log_OutputPort[port].setObjName(portName.toChar());
259 #endif
260  }
261 
262 #if FW_ENABLE_TEXT_LOGGING == 1
263  // Connect output port LogText
264  for (
265  FwIndexType port = 0;
266  port < static_cast<FwIndexType>(this->getNum_LogText_OutputPorts());
267  port++
268  ) {
269  this->m_LogText_OutputPort[port].init();
270 
271 #if FW_OBJECT_NAMES == 1
272  Fw::ObjectName portName;
273  portName.format(
274  "%s_LogText_OutputPort[%" PRI_PlatformIntType "]",
275  this->m_objName.toChar(),
276  port
277  );
278  this->m_LogText_OutputPort[port].setObjName(portName.toChar());
279 #endif
280  }
281 #endif
282 
283  // Connect output port Time
284  for (
285  FwIndexType port = 0;
286  port < static_cast<FwIndexType>(this->getNum_Time_OutputPorts());
287  port++
288  ) {
289  this->m_Time_OutputPort[port].init();
290 
291 #if FW_OBJECT_NAMES == 1
292  Fw::ObjectName portName;
293  portName.format(
294  "%s_Time_OutputPort[%" PRI_PlatformIntType "]",
295  this->m_objName.toChar(),
296  port
297  );
298  this->m_Time_OutputPort[port].setObjName(portName.toChar());
299 #endif
300  }
301 
302  // Connect output port Tlm
303  for (
304  FwIndexType port = 0;
305  port < static_cast<FwIndexType>(this->getNum_Tlm_OutputPorts());
306  port++
307  ) {
308  this->m_Tlm_OutputPort[port].init();
309 
310 #if FW_OBJECT_NAMES == 1
311  Fw::ObjectName portName;
312  portName.format(
313  "%s_Tlm_OutputPort[%" PRI_PlatformIntType "]",
314  this->m_objName.toChar(),
315  port
316  );
317  this->m_Tlm_OutputPort[port].setObjName(portName.toChar());
318 #endif
319  }
320 
321  // Connect output port compCmdSend
322  for (
323  FwIndexType port = 0;
324  port < static_cast<FwIndexType>(this->getNum_compCmdSend_OutputPorts());
325  port++
326  ) {
327  this->m_compCmdSend_OutputPort[port].init();
328 
329 #if FW_OBJECT_NAMES == 1
330  Fw::ObjectName portName;
331  portName.format(
332  "%s_compCmdSend_OutputPort[%" PRI_PlatformIntType "]",
333  this->m_objName.toChar(),
334  port
335  );
336  this->m_compCmdSend_OutputPort[port].setObjName(portName.toChar());
337 #endif
338  }
339 
340  // Connect output port pingOut
341  for (
342  FwIndexType port = 0;
343  port < static_cast<FwIndexType>(this->getNum_pingOut_OutputPorts());
344  port++
345  ) {
346  this->m_pingOut_OutputPort[port].init();
347 
348 #if FW_OBJECT_NAMES == 1
349  Fw::ObjectName portName;
350  portName.format(
351  "%s_pingOut_OutputPort[%" PRI_PlatformIntType "]",
352  this->m_objName.toChar(),
353  port
354  );
355  this->m_pingOut_OutputPort[port].setObjName(portName.toChar());
356 #endif
357  }
358 
359  // Connect output port seqCmdStatus
360  for (
361  FwIndexType port = 0;
362  port < static_cast<FwIndexType>(this->getNum_seqCmdStatus_OutputPorts());
363  port++
364  ) {
365  this->m_seqCmdStatus_OutputPort[port].init();
366 
367 #if FW_OBJECT_NAMES == 1
368  Fw::ObjectName portName;
369  portName.format(
370  "%s_seqCmdStatus_OutputPort[%" PRI_PlatformIntType "]",
371  this->m_objName.toChar(),
372  port
373  );
374  this->m_seqCmdStatus_OutputPort[port].setObjName(portName.toChar());
375 #endif
376  }
377 
378  Os::Queue::Status qStat = this->createQueue(
379  queueDepth,
380  static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
381  );
382  FW_ASSERT(
383  Os::Queue::Status::OP_OK == qStat,
384  static_cast<FwAssertArgType>(qStat)
385  );
386  }
387 
388  // ----------------------------------------------------------------------
389  // Getters for special input ports
390  // ----------------------------------------------------------------------
391 
394  {
395  FW_ASSERT(
396  portNum < this->getNum_CmdDisp_InputPorts(),
397  static_cast<FwAssertArgType>(portNum)
398  );
399 
400  return &this->m_CmdDisp_InputPort[portNum];
401  }
402 
403  // ----------------------------------------------------------------------
404  // Getters for typed input ports
405  // ----------------------------------------------------------------------
406 
409  {
410  FW_ASSERT(
411  portNum < this->getNum_compCmdReg_InputPorts(),
412  static_cast<FwAssertArgType>(portNum)
413  );
414 
415  return &this->m_compCmdReg_InputPort[portNum];
416  }
417 
420  {
421  FW_ASSERT(
422  portNum < this->getNum_compCmdStat_InputPorts(),
423  static_cast<FwAssertArgType>(portNum)
424  );
425 
426  return &this->m_compCmdStat_InputPort[portNum];
427  }
428 
431  {
432  FW_ASSERT(
433  portNum < this->getNum_pingIn_InputPorts(),
434  static_cast<FwAssertArgType>(portNum)
435  );
436 
437  return &this->m_pingIn_InputPort[portNum];
438  }
439 
442  {
443  FW_ASSERT(
444  portNum < this->getNum_seqCmdBuff_InputPorts(),
445  static_cast<FwAssertArgType>(portNum)
446  );
447 
448  return &this->m_seqCmdBuff_InputPort[portNum];
449  }
450 
451  // ----------------------------------------------------------------------
452  // Connect input ports to special output ports
453  // ----------------------------------------------------------------------
454 
457  FwIndexType portNum,
458  Fw::InputCmdRegPort* port
459  )
460  {
461  FW_ASSERT(
462  portNum < this->getNum_CmdReg_OutputPorts(),
463  static_cast<FwAssertArgType>(portNum)
464  );
465 
466  this->m_CmdReg_OutputPort[portNum].addCallPort(port);
467  }
468 
471  FwIndexType portNum,
473  )
474  {
475  FW_ASSERT(
476  portNum < this->getNum_CmdStatus_OutputPorts(),
477  static_cast<FwAssertArgType>(portNum)
478  );
479 
480  this->m_CmdStatus_OutputPort[portNum].addCallPort(port);
481  }
482 
485  FwIndexType portNum,
486  Fw::InputLogPort* port
487  )
488  {
489  FW_ASSERT(
490  portNum < this->getNum_Log_OutputPorts(),
491  static_cast<FwAssertArgType>(portNum)
492  );
493 
494  this->m_Log_OutputPort[portNum].addCallPort(port);
495  }
496 
497 #if FW_ENABLE_TEXT_LOGGING == 1
498 
499  void CommandDispatcherComponentBase ::
500  set_LogText_OutputPort(
501  FwIndexType portNum,
503  )
504  {
505  FW_ASSERT(
506  portNum < this->getNum_LogText_OutputPorts(),
507  static_cast<FwAssertArgType>(portNum)
508  );
509 
510  this->m_LogText_OutputPort[portNum].addCallPort(port);
511  }
512 
513 #endif
514 
517  FwIndexType portNum,
518  Fw::InputTimePort* port
519  )
520  {
521  FW_ASSERT(
522  portNum < this->getNum_Time_OutputPorts(),
523  static_cast<FwAssertArgType>(portNum)
524  );
525 
526  this->m_Time_OutputPort[portNum].addCallPort(port);
527  }
528 
531  FwIndexType portNum,
532  Fw::InputTlmPort* port
533  )
534  {
535  FW_ASSERT(
536  portNum < this->getNum_Tlm_OutputPorts(),
537  static_cast<FwAssertArgType>(portNum)
538  );
539 
540  this->m_Tlm_OutputPort[portNum].addCallPort(port);
541  }
542 
543  // ----------------------------------------------------------------------
544  // Connect typed input ports to typed output ports
545  // ----------------------------------------------------------------------
546 
549  FwIndexType portNum,
550  Fw::InputCmdPort* port
551  )
552  {
553  FW_ASSERT(
554  portNum < this->getNum_compCmdSend_OutputPorts(),
555  static_cast<FwAssertArgType>(portNum)
556  );
557 
558  this->m_compCmdSend_OutputPort[portNum].addCallPort(port);
559  }
560 
563  FwIndexType portNum,
564  Svc::InputPingPort* port
565  )
566  {
567  FW_ASSERT(
568  portNum < this->getNum_pingOut_OutputPorts(),
569  static_cast<FwAssertArgType>(portNum)
570  );
571 
572  this->m_pingOut_OutputPort[portNum].addCallPort(port);
573  }
574 
577  FwIndexType portNum,
579  )
580  {
581  FW_ASSERT(
582  portNum < this->getNum_seqCmdStatus_OutputPorts(),
583  static_cast<FwAssertArgType>(portNum)
584  );
585 
586  this->m_seqCmdStatus_OutputPort[portNum].addCallPort(port);
587  }
588 
589 #if FW_PORT_SERIALIZATION
590 
591  // ----------------------------------------------------------------------
592  // Connect serial input ports to special output ports
593  // ----------------------------------------------------------------------
594 
597  FwIndexType portNum,
598  Fw::InputSerializePort* port
599  )
600  {
601  FW_ASSERT(
602  portNum < this->getNum_CmdReg_OutputPorts(),
603  static_cast<FwAssertArgType>(portNum)
604  );
605 
606  this->m_CmdReg_OutputPort[portNum].registerSerialPort(port);
607  }
608 
611  FwIndexType portNum,
612  Fw::InputSerializePort* port
613  )
614  {
615  FW_ASSERT(
616  portNum < this->getNum_CmdStatus_OutputPorts(),
617  static_cast<FwAssertArgType>(portNum)
618  );
619 
620  this->m_CmdStatus_OutputPort[portNum].registerSerialPort(port);
621  }
622 
625  FwIndexType portNum,
626  Fw::InputSerializePort* port
627  )
628  {
629  FW_ASSERT(
630  portNum < this->getNum_Log_OutputPorts(),
631  static_cast<FwAssertArgType>(portNum)
632  );
633 
634  this->m_Log_OutputPort[portNum].registerSerialPort(port);
635  }
636 
637 #if FW_ENABLE_TEXT_LOGGING == 1
638 
639  void CommandDispatcherComponentBase ::
640  set_LogText_OutputPort(
641  FwIndexType portNum,
642  Fw::InputSerializePort* port
643  )
644  {
645  FW_ASSERT(
646  portNum < this->getNum_LogText_OutputPorts(),
647  static_cast<FwAssertArgType>(portNum)
648  );
649 
650  this->m_LogText_OutputPort[portNum].registerSerialPort(port);
651  }
652 
653 #endif
654 
657  FwIndexType portNum,
658  Fw::InputSerializePort* port
659  )
660  {
661  FW_ASSERT(
662  portNum < this->getNum_Time_OutputPorts(),
663  static_cast<FwAssertArgType>(portNum)
664  );
665 
666  this->m_Time_OutputPort[portNum].registerSerialPort(port);
667  }
668 
671  FwIndexType portNum,
672  Fw::InputSerializePort* port
673  )
674  {
675  FW_ASSERT(
676  portNum < this->getNum_Tlm_OutputPorts(),
677  static_cast<FwAssertArgType>(portNum)
678  );
679 
680  this->m_Tlm_OutputPort[portNum].registerSerialPort(port);
681  }
682 
683 #endif
684 
685 #if FW_PORT_SERIALIZATION
686 
687  // ----------------------------------------------------------------------
688  // Connect serial input ports to typed output ports
689  // ----------------------------------------------------------------------
690 
693  FwIndexType portNum,
694  Fw::InputSerializePort* port
695  )
696  {
697  FW_ASSERT(
698  portNum < this->getNum_compCmdSend_OutputPorts(),
699  static_cast<FwAssertArgType>(portNum)
700  );
701 
702  this->m_compCmdSend_OutputPort[portNum].registerSerialPort(port);
703  }
704 
707  FwIndexType portNum,
708  Fw::InputSerializePort* port
709  )
710  {
711  FW_ASSERT(
712  portNum < this->getNum_pingOut_OutputPorts(),
713  static_cast<FwAssertArgType>(portNum)
714  );
715 
716  this->m_pingOut_OutputPort[portNum].registerSerialPort(port);
717  }
718 
721  FwIndexType portNum,
722  Fw::InputSerializePort* port
723  )
724  {
725  FW_ASSERT(
726  portNum < this->getNum_seqCmdStatus_OutputPorts(),
727  static_cast<FwAssertArgType>(portNum)
728  );
729 
730  this->m_seqCmdStatus_OutputPort[portNum].registerSerialPort(port);
731  }
732 
733 #endif
734 
735  // ----------------------------------------------------------------------
736  // Command registration
737  // ----------------------------------------------------------------------
738 
740  regCommands()
741  {
742  FW_ASSERT(this->m_CmdReg_OutputPort[0].isConnected());
743 
744  this->m_CmdReg_OutputPort[0].invoke(
745  this->getIdBase() + OPCODE_CMD_NO_OP
746  );
747 
748  this->m_CmdReg_OutputPort[0].invoke(
750  );
751 
752  this->m_CmdReg_OutputPort[0].invoke(
754  );
755 
756  this->m_CmdReg_OutputPort[0].invoke(
758  );
759  }
760 
761  // ----------------------------------------------------------------------
762  // Component construction and destruction
763  // ----------------------------------------------------------------------
764 
766  CommandDispatcherComponentBase(const char* compName) :
767  Fw::ActiveComponentBase(compName)
768  {
769  // Write telemetry channel CommandsDispatched
770  this->m_first_update_CommandsDispatched = true;
771  this->m_last_CommandsDispatched = 0;
772 
773  // Write telemetry channel CommandErrors
774  this->m_first_update_CommandErrors = true;
775  this->m_last_CommandErrors = 0;
776  }
777 
780  {
781 
782  }
783 
784  // ----------------------------------------------------------------------
785  // Getters for numbers of special input ports
786  // ----------------------------------------------------------------------
787 
790  {
791  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_CmdDisp_InputPort));
792  }
793 
794  // ----------------------------------------------------------------------
795  // Getters for numbers of typed input ports
796  // ----------------------------------------------------------------------
797 
800  {
801  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_compCmdReg_InputPort));
802  }
803 
806  {
807  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_compCmdStat_InputPort));
808  }
809 
812  {
813  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_pingIn_InputPort));
814  }
815 
818  {
819  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_seqCmdBuff_InputPort));
820  }
821 
822  // ----------------------------------------------------------------------
823  // Getters for numbers of special output ports
824  // ----------------------------------------------------------------------
825 
828  {
829  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_CmdReg_OutputPort));
830  }
831 
834  {
835  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_CmdStatus_OutputPort));
836  }
837 
840  {
841  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_Log_OutputPort));
842  }
843 
844 #if FW_ENABLE_TEXT_LOGGING == 1
845 
846  FwIndexType CommandDispatcherComponentBase ::
847  getNum_LogText_OutputPorts() const
848  {
849  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_LogText_OutputPort));
850  }
851 
852 #endif
853 
856  {
857  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_Time_OutputPort));
858  }
859 
862  {
863  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_Tlm_OutputPort));
864  }
865 
866  // ----------------------------------------------------------------------
867  // Getters for numbers of typed output ports
868  // ----------------------------------------------------------------------
869 
872  {
873  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_compCmdSend_OutputPort));
874  }
875 
878  {
879  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_pingOut_OutputPort));
880  }
881 
884  {
885  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_seqCmdStatus_OutputPort));
886  }
887 
888  // ----------------------------------------------------------------------
889  // Connection status queries for special output ports
890  // ----------------------------------------------------------------------
891 
894  {
895  FW_ASSERT(
896  portNum < this->getNum_CmdReg_OutputPorts(),
897  static_cast<FwAssertArgType>(portNum)
898  );
899 
900  return this->m_CmdReg_OutputPort[portNum].isConnected();
901  }
902 
905  {
906  FW_ASSERT(
907  portNum < this->getNum_CmdStatus_OutputPorts(),
908  static_cast<FwAssertArgType>(portNum)
909  );
910 
911  return this->m_CmdStatus_OutputPort[portNum].isConnected();
912  }
913 
916  {
917  FW_ASSERT(
918  portNum < this->getNum_Log_OutputPorts(),
919  static_cast<FwAssertArgType>(portNum)
920  );
921 
922  return this->m_Log_OutputPort[portNum].isConnected();
923  }
924 
925 #if FW_ENABLE_TEXT_LOGGING == 1
926 
927  bool CommandDispatcherComponentBase ::
928  isConnected_LogText_OutputPort(FwIndexType portNum)
929  {
930  FW_ASSERT(
931  portNum < this->getNum_LogText_OutputPorts(),
932  static_cast<FwAssertArgType>(portNum)
933  );
934 
935  return this->m_LogText_OutputPort[portNum].isConnected();
936  }
937 
938 #endif
939 
942  {
943  FW_ASSERT(
944  portNum < this->getNum_Time_OutputPorts(),
945  static_cast<FwAssertArgType>(portNum)
946  );
947 
948  return this->m_Time_OutputPort[portNum].isConnected();
949  }
950 
953  {
954  FW_ASSERT(
955  portNum < this->getNum_Tlm_OutputPorts(),
956  static_cast<FwAssertArgType>(portNum)
957  );
958 
959  return this->m_Tlm_OutputPort[portNum].isConnected();
960  }
961 
962  // ----------------------------------------------------------------------
963  // Connection status queries for typed output ports
964  // ----------------------------------------------------------------------
965 
968  {
969  FW_ASSERT(
970  portNum < this->getNum_compCmdSend_OutputPorts(),
971  static_cast<FwAssertArgType>(portNum)
972  );
973 
974  return this->m_compCmdSend_OutputPort[portNum].isConnected();
975  }
976 
979  {
980  FW_ASSERT(
981  portNum < this->getNum_pingOut_OutputPorts(),
982  static_cast<FwAssertArgType>(portNum)
983  );
984 
985  return this->m_pingOut_OutputPort[portNum].isConnected();
986  }
987 
990  {
991  FW_ASSERT(
992  portNum < this->getNum_seqCmdStatus_OutputPorts(),
993  static_cast<FwAssertArgType>(portNum)
994  );
995 
996  return this->m_seqCmdStatus_OutputPort[portNum].isConnected();
997  }
998 
999  // ----------------------------------------------------------------------
1000  // Port handler base-class functions for typed input ports
1001  //
1002  // Call these functions directly to bypass the corresponding ports
1003  // ----------------------------------------------------------------------
1004 
1007  FwIndexType portNum,
1008  FwOpcodeType opCode
1009  )
1010  {
1011  // Make sure port number is valid
1012  FW_ASSERT(
1013  portNum < this->getNum_compCmdReg_InputPorts(),
1014  static_cast<FwAssertArgType>(portNum)
1015  );
1016 
1017  // Lock guard mutex before calling
1018  this->lock();
1019 
1020  // Call handler function
1021  this->compCmdReg_handler(
1022  portNum,
1023  opCode
1024  );
1025 
1026  // Unlock guard mutex
1027  this->unLock();
1028  }
1029 
1032  FwIndexType portNum,
1033  FwOpcodeType opCode,
1034  U32 cmdSeq,
1035  const Fw::CmdResponse& response
1036  )
1037  {
1038  // Make sure port number is valid
1039  FW_ASSERT(
1040  portNum < this->getNum_compCmdStat_InputPorts(),
1041  static_cast<FwAssertArgType>(portNum)
1042  );
1043 
1044  // Call pre-message hook
1046  portNum,
1047  opCode,
1048  cmdSeq,
1049  response
1050  );
1051  ComponentIpcSerializableBuffer msg;
1053 
1054  // Serialize message ID
1055  _status = msg.serialize(
1056  static_cast<FwEnumStoreType>(COMPCMDSTAT_CMDRESPONSE)
1057  );
1058  FW_ASSERT(
1059  _status == Fw::FW_SERIALIZE_OK,
1060  static_cast<FwAssertArgType>(_status)
1061  );
1062 
1063  // Serialize port number
1064  _status = msg.serialize(portNum);
1065  FW_ASSERT(
1066  _status == Fw::FW_SERIALIZE_OK,
1067  static_cast<FwAssertArgType>(_status)
1068  );
1069 
1070  // Serialize argument opCode
1071  _status = msg.serialize(opCode);
1072  FW_ASSERT(
1073  _status == Fw::FW_SERIALIZE_OK,
1074  static_cast<FwAssertArgType>(_status)
1075  );
1076 
1077  // Serialize argument cmdSeq
1078  _status = msg.serialize(cmdSeq);
1079  FW_ASSERT(
1080  _status == Fw::FW_SERIALIZE_OK,
1081  static_cast<FwAssertArgType>(_status)
1082  );
1083 
1084  // Serialize argument response
1085  _status = msg.serialize(response);
1086  FW_ASSERT(
1087  _status == Fw::FW_SERIALIZE_OK,
1088  static_cast<FwAssertArgType>(_status)
1089  );
1090 
1091  // Send message
1093  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1094 
1095  FW_ASSERT(
1096  qStatus == Os::Queue::OP_OK,
1097  static_cast<FwAssertArgType>(qStatus)
1098  );
1099  }
1100 
1103  FwIndexType portNum,
1104  U32 key
1105  )
1106  {
1107  // Make sure port number is valid
1108  FW_ASSERT(
1109  portNum < this->getNum_pingIn_InputPorts(),
1110  static_cast<FwAssertArgType>(portNum)
1111  );
1112 
1113  // Call pre-message hook
1115  portNum,
1116  key
1117  );
1118  ComponentIpcSerializableBuffer msg;
1120 
1121  // Serialize message ID
1122  _status = msg.serialize(
1123  static_cast<FwEnumStoreType>(PINGIN_PING)
1124  );
1125  FW_ASSERT(
1126  _status == Fw::FW_SERIALIZE_OK,
1127  static_cast<FwAssertArgType>(_status)
1128  );
1129 
1130  // Serialize port number
1131  _status = msg.serialize(portNum);
1132  FW_ASSERT(
1133  _status == Fw::FW_SERIALIZE_OK,
1134  static_cast<FwAssertArgType>(_status)
1135  );
1136 
1137  // Serialize argument key
1138  _status = msg.serialize(key);
1139  FW_ASSERT(
1140  _status == Fw::FW_SERIALIZE_OK,
1141  static_cast<FwAssertArgType>(_status)
1142  );
1143 
1144  // Send message
1146  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1147 
1148  FW_ASSERT(
1149  qStatus == Os::Queue::OP_OK,
1150  static_cast<FwAssertArgType>(qStatus)
1151  );
1152  }
1153 
1156  FwIndexType portNum,
1157  Fw::ComBuffer& data,
1158  U32 context
1159  )
1160  {
1161  // Make sure port number is valid
1162  FW_ASSERT(
1163  portNum < this->getNum_seqCmdBuff_InputPorts(),
1164  static_cast<FwAssertArgType>(portNum)
1165  );
1166 
1167  // Call pre-message hook
1169  portNum,
1170  data,
1171  context
1172  );
1173  ComponentIpcSerializableBuffer msg;
1175 
1176  // Serialize message ID
1177  _status = msg.serialize(
1178  static_cast<FwEnumStoreType>(SEQCMDBUFF_COM)
1179  );
1180  FW_ASSERT(
1181  _status == Fw::FW_SERIALIZE_OK,
1182  static_cast<FwAssertArgType>(_status)
1183  );
1184 
1185  // Serialize port number
1186  _status = msg.serialize(portNum);
1187  FW_ASSERT(
1188  _status == Fw::FW_SERIALIZE_OK,
1189  static_cast<FwAssertArgType>(_status)
1190  );
1191 
1192  // Serialize argument data
1193  _status = msg.serialize(data);
1194  FW_ASSERT(
1195  _status == Fw::FW_SERIALIZE_OK,
1196  static_cast<FwAssertArgType>(_status)
1197  );
1198 
1199  // Serialize argument context
1200  _status = msg.serialize(context);
1201  FW_ASSERT(
1202  _status == Fw::FW_SERIALIZE_OK,
1203  static_cast<FwAssertArgType>(_status)
1204  );
1205 
1206  // Send message
1208  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1209 
1210  FW_ASSERT(
1211  qStatus == Os::Queue::OP_OK,
1212  static_cast<FwAssertArgType>(qStatus)
1213  );
1214  }
1215 
1216  // ----------------------------------------------------------------------
1217  // Pre-message hooks for typed async input ports
1218  //
1219  // Each of these functions is invoked just before processing a message
1220  // on the corresponding port. By default, they do nothing. You can
1221  // override them to provide specific pre-message behavior.
1222  // ----------------------------------------------------------------------
1223 
1226  FwIndexType portNum,
1227  FwOpcodeType opCode,
1228  U32 cmdSeq,
1229  const Fw::CmdResponse& response
1230  )
1231  {
1232  // Default: no-op
1233  }
1234 
1237  FwIndexType portNum,
1238  U32 key
1239  )
1240  {
1241  // Default: no-op
1242  }
1243 
1246  FwIndexType portNum,
1247  Fw::ComBuffer& data,
1248  U32 context
1249  )
1250  {
1251  // Default: no-op
1252  }
1253 
1254  // ----------------------------------------------------------------------
1255  // Invocation functions for typed output ports
1256  // ----------------------------------------------------------------------
1257 
1260  FwIndexType portNum,
1261  FwOpcodeType opCode,
1262  U32 cmdSeq,
1263  Fw::CmdArgBuffer& args
1264  )
1265  {
1266  FW_ASSERT(
1267  portNum < this->getNum_compCmdSend_OutputPorts(),
1268  static_cast<FwAssertArgType>(portNum)
1269  );
1270  this->m_compCmdSend_OutputPort[portNum].invoke(
1271  opCode,
1272  cmdSeq,
1273  args
1274  );
1275  }
1276 
1278  pingOut_out(
1279  FwIndexType portNum,
1280  U32 key
1281  )
1282  {
1283  FW_ASSERT(
1284  portNum < this->getNum_pingOut_OutputPorts(),
1285  static_cast<FwAssertArgType>(portNum)
1286  );
1287  this->m_pingOut_OutputPort[portNum].invoke(
1288  key
1289  );
1290  }
1291 
1294  FwIndexType portNum,
1295  FwOpcodeType opCode,
1296  U32 cmdSeq,
1297  const Fw::CmdResponse& response
1298  )
1299  {
1300  FW_ASSERT(
1301  portNum < this->getNum_seqCmdStatus_OutputPorts(),
1302  static_cast<FwAssertArgType>(portNum)
1303  );
1304  this->m_seqCmdStatus_OutputPort[portNum].invoke(
1305  opCode,
1306  cmdSeq,
1307  response
1308  );
1309  }
1310 
1311  // ----------------------------------------------------------------------
1312  // Command response
1313  // ----------------------------------------------------------------------
1314 
1317  FwOpcodeType opCode,
1318  U32 cmdSeq,
1319  Fw::CmdResponse response
1320  )
1321  {
1322  FW_ASSERT(this->m_CmdStatus_OutputPort[0].isConnected());
1323  this->m_CmdStatus_OutputPort[0].invoke(opCode, cmdSeq, response);
1324  }
1325 
1326  // ----------------------------------------------------------------------
1327  // Command handler base-class functions
1328  //
1329  // Call these functions directly to bypass the command input port
1330  // ----------------------------------------------------------------------
1331 
1334  FwOpcodeType opCode,
1335  U32 cmdSeq,
1336  Fw::CmdArgBuffer& args
1337  )
1338  {
1339  // Call pre-message hook
1340  this->CMD_NO_OP_preMsgHook(opCode,cmdSeq);
1341 
1342  // Defer deserializing arguments to the message dispatcher
1343  // to avoid deserializing and reserializing just for IPC
1344  ComponentIpcSerializableBuffer msg;
1346 
1347  // Serialize for IPC
1348  _status = msg.serialize(static_cast<FwEnumStoreType>(CMD_CMD_NO_OP));
1349  FW_ASSERT (
1350  _status == Fw::FW_SERIALIZE_OK,
1351  static_cast<FwAssertArgType>(_status)
1352  );
1353 
1354  // Fake port number to make message dequeue work
1355  FwIndexType port = 0;
1356 
1357  _status = msg.serialize(port);
1358  FW_ASSERT (
1359  _status == Fw::FW_SERIALIZE_OK,
1360  static_cast<FwAssertArgType>(_status)
1361  );
1362 
1363  _status = msg.serialize(opCode);
1364  FW_ASSERT (
1365  _status == Fw::FW_SERIALIZE_OK,
1366  static_cast<FwAssertArgType>(_status)
1367  );
1368 
1369  _status = msg.serialize(cmdSeq);
1370  FW_ASSERT (
1371  _status == Fw::FW_SERIALIZE_OK,
1372  static_cast<FwAssertArgType>(_status)
1373  );
1374 
1375  _status = msg.serialize(args);
1376  FW_ASSERT (
1377  _status == Fw::FW_SERIALIZE_OK,
1378  static_cast<FwAssertArgType>(_status)
1379  );
1380 
1381  // Send message
1383  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1384 
1385  FW_ASSERT(
1386  qStatus == Os::Queue::OP_OK,
1387  static_cast<FwAssertArgType>(qStatus)
1388  );
1389  }
1390 
1393  FwOpcodeType opCode,
1394  U32 cmdSeq,
1395  Fw::CmdArgBuffer& args
1396  )
1397  {
1398  // Call pre-message hook
1399  this->CMD_NO_OP_STRING_preMsgHook(opCode,cmdSeq);
1400 
1401  // Defer deserializing arguments to the message dispatcher
1402  // to avoid deserializing and reserializing just for IPC
1403  ComponentIpcSerializableBuffer msg;
1405 
1406  // Serialize for IPC
1407  _status = msg.serialize(static_cast<FwEnumStoreType>(CMD_CMD_NO_OP_STRING));
1408  FW_ASSERT (
1409  _status == Fw::FW_SERIALIZE_OK,
1410  static_cast<FwAssertArgType>(_status)
1411  );
1412 
1413  // Fake port number to make message dequeue work
1414  FwIndexType port = 0;
1415 
1416  _status = msg.serialize(port);
1417  FW_ASSERT (
1418  _status == Fw::FW_SERIALIZE_OK,
1419  static_cast<FwAssertArgType>(_status)
1420  );
1421 
1422  _status = msg.serialize(opCode);
1423  FW_ASSERT (
1424  _status == Fw::FW_SERIALIZE_OK,
1425  static_cast<FwAssertArgType>(_status)
1426  );
1427 
1428  _status = msg.serialize(cmdSeq);
1429  FW_ASSERT (
1430  _status == Fw::FW_SERIALIZE_OK,
1431  static_cast<FwAssertArgType>(_status)
1432  );
1433 
1434  _status = msg.serialize(args);
1435  FW_ASSERT (
1436  _status == Fw::FW_SERIALIZE_OK,
1437  static_cast<FwAssertArgType>(_status)
1438  );
1439 
1440  // Send message
1442  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1443 
1444  FW_ASSERT(
1445  qStatus == Os::Queue::OP_OK,
1446  static_cast<FwAssertArgType>(qStatus)
1447  );
1448  }
1449 
1452  FwOpcodeType opCode,
1453  U32 cmdSeq,
1454  Fw::CmdArgBuffer& args
1455  )
1456  {
1457  // Call pre-message hook
1458  this->CMD_TEST_CMD_1_preMsgHook(opCode,cmdSeq);
1459 
1460  // Defer deserializing arguments to the message dispatcher
1461  // to avoid deserializing and reserializing just for IPC
1462  ComponentIpcSerializableBuffer msg;
1464 
1465  // Serialize for IPC
1466  _status = msg.serialize(static_cast<FwEnumStoreType>(CMD_CMD_TEST_CMD_1));
1467  FW_ASSERT (
1468  _status == Fw::FW_SERIALIZE_OK,
1469  static_cast<FwAssertArgType>(_status)
1470  );
1471 
1472  // Fake port number to make message dequeue work
1473  FwIndexType port = 0;
1474 
1475  _status = msg.serialize(port);
1476  FW_ASSERT (
1477  _status == Fw::FW_SERIALIZE_OK,
1478  static_cast<FwAssertArgType>(_status)
1479  );
1480 
1481  _status = msg.serialize(opCode);
1482  FW_ASSERT (
1483  _status == Fw::FW_SERIALIZE_OK,
1484  static_cast<FwAssertArgType>(_status)
1485  );
1486 
1487  _status = msg.serialize(cmdSeq);
1488  FW_ASSERT (
1489  _status == Fw::FW_SERIALIZE_OK,
1490  static_cast<FwAssertArgType>(_status)
1491  );
1492 
1493  _status = msg.serialize(args);
1494  FW_ASSERT (
1495  _status == Fw::FW_SERIALIZE_OK,
1496  static_cast<FwAssertArgType>(_status)
1497  );
1498 
1499  // Send message
1501  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1502 
1503  FW_ASSERT(
1504  qStatus == Os::Queue::OP_OK,
1505  static_cast<FwAssertArgType>(qStatus)
1506  );
1507  }
1508 
1511  FwOpcodeType opCode,
1512  U32 cmdSeq,
1513  Fw::CmdArgBuffer& args
1514  )
1515  {
1516  // Call pre-message hook
1517  this->CMD_CLEAR_TRACKING_preMsgHook(opCode,cmdSeq);
1518 
1519  // Defer deserializing arguments to the message dispatcher
1520  // to avoid deserializing and reserializing just for IPC
1521  ComponentIpcSerializableBuffer msg;
1523 
1524  // Serialize for IPC
1525  _status = msg.serialize(static_cast<FwEnumStoreType>(CMD_CMD_CLEAR_TRACKING));
1526  FW_ASSERT (
1527  _status == Fw::FW_SERIALIZE_OK,
1528  static_cast<FwAssertArgType>(_status)
1529  );
1530 
1531  // Fake port number to make message dequeue work
1532  FwIndexType port = 0;
1533 
1534  _status = msg.serialize(port);
1535  FW_ASSERT (
1536  _status == Fw::FW_SERIALIZE_OK,
1537  static_cast<FwAssertArgType>(_status)
1538  );
1539 
1540  _status = msg.serialize(opCode);
1541  FW_ASSERT (
1542  _status == Fw::FW_SERIALIZE_OK,
1543  static_cast<FwAssertArgType>(_status)
1544  );
1545 
1546  _status = msg.serialize(cmdSeq);
1547  FW_ASSERT (
1548  _status == Fw::FW_SERIALIZE_OK,
1549  static_cast<FwAssertArgType>(_status)
1550  );
1551 
1552  _status = msg.serialize(args);
1553  FW_ASSERT (
1554  _status == Fw::FW_SERIALIZE_OK,
1555  static_cast<FwAssertArgType>(_status)
1556  );
1557 
1558  // Send message
1560  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1561 
1562  FW_ASSERT(
1563  qStatus == Os::Queue::OP_OK,
1564  static_cast<FwAssertArgType>(qStatus)
1565  );
1566  }
1567 
1568  // ----------------------------------------------------------------------
1569  // Pre-message hooks for async commands
1570  //
1571  // Each of these functions is invoked just before processing the
1572  // corresponding command. By default they do nothing. You can
1573  // override them to provide specific pre-command behavior.
1574  // ----------------------------------------------------------------------
1575 
1578  FwOpcodeType opCode,
1579  U32 cmdSeq
1580  )
1581  {
1582  // Defaults to no-op; can be overridden
1583  (void) opCode;
1584  (void) cmdSeq;
1585  }
1586 
1589  FwOpcodeType opCode,
1590  U32 cmdSeq
1591  )
1592  {
1593  // Defaults to no-op; can be overridden
1594  (void) opCode;
1595  (void) cmdSeq;
1596  }
1597 
1600  FwOpcodeType opCode,
1601  U32 cmdSeq
1602  )
1603  {
1604  // Defaults to no-op; can be overridden
1605  (void) opCode;
1606  (void) cmdSeq;
1607  }
1608 
1611  FwOpcodeType opCode,
1612  U32 cmdSeq
1613  )
1614  {
1615  // Defaults to no-op; can be overridden
1616  (void) opCode;
1617  (void) cmdSeq;
1618  }
1619 
1620  // ----------------------------------------------------------------------
1621  // Event logging functions
1622  // ----------------------------------------------------------------------
1623 
1626  U32 Opcode,
1627  I32 port,
1628  I32 slot
1629  )
1630  {
1631  // Get the time
1632  Fw::Time _logTime;
1633  if (this->m_Time_OutputPort[0].isConnected()) {
1634  this->m_Time_OutputPort[0].invoke(_logTime);
1635  }
1636 
1637  FwEventIdType _id = static_cast<FwEventIdType>(0);
1638 
1639  _id = this->getIdBase() + EVENTID_OPCODEREGISTERED;
1640 
1641  // Emit the event on the log port
1642  if (this->m_Log_OutputPort[0].isConnected()) {
1643  Fw::LogBuffer _logBuff;
1645 
1646 #if FW_AMPCS_COMPATIBLE
1647  // Serialize the number of arguments
1648  _status = _logBuff.serialize(static_cast<U8>(3));
1649  FW_ASSERT(
1650  _status == Fw::FW_SERIALIZE_OK,
1651  static_cast<FwAssertArgType>(_status)
1652  );
1653 #endif
1654 
1655 #if FW_AMPCS_COMPATIBLE
1656  // Serialize the argument size
1657  _status = _logBuff.serialize(
1658  static_cast<U8>(sizeof(U32))
1659  );
1660  FW_ASSERT(
1661  _status == Fw::FW_SERIALIZE_OK,
1662  static_cast<FwAssertArgType>(_status)
1663  );
1664 #endif
1665  _status = _logBuff.serialize(Opcode);
1666  FW_ASSERT(
1667  _status == Fw::FW_SERIALIZE_OK,
1668  static_cast<FwAssertArgType>(_status)
1669  );
1670 
1671 #if FW_AMPCS_COMPATIBLE
1672  // Serialize the argument size
1673  _status = _logBuff.serialize(
1674  static_cast<U8>(sizeof(I32))
1675  );
1676  FW_ASSERT(
1677  _status == Fw::FW_SERIALIZE_OK,
1678  static_cast<FwAssertArgType>(_status)
1679  );
1680 #endif
1681  _status = _logBuff.serialize(port);
1682  FW_ASSERT(
1683  _status == Fw::FW_SERIALIZE_OK,
1684  static_cast<FwAssertArgType>(_status)
1685  );
1686 
1687 #if FW_AMPCS_COMPATIBLE
1688  // Serialize the argument size
1689  _status = _logBuff.serialize(
1690  static_cast<U8>(sizeof(I32))
1691  );
1692  FW_ASSERT(
1693  _status == Fw::FW_SERIALIZE_OK,
1694  static_cast<FwAssertArgType>(_status)
1695  );
1696 #endif
1697  _status = _logBuff.serialize(slot);
1698  FW_ASSERT(
1699  _status == Fw::FW_SERIALIZE_OK,
1700  static_cast<FwAssertArgType>(_status)
1701  );
1702 
1703  this->m_Log_OutputPort[0].invoke(
1704  _id,
1705  _logTime,
1707  _logBuff
1708  );
1709  }
1710 
1711  // Emit the event on the text log port
1712 #if FW_ENABLE_TEXT_LOGGING
1713  if (this->m_LogText_OutputPort[0].isConnected()) {
1714 #if FW_OBJECT_NAMES == 1
1715  const char* _formatString =
1716  "(%s) %s: Opcode 0x%" PRIx32 " registered to port %" PRIi32 " slot %" PRIi32 "";
1717 #else
1718  const char* _formatString =
1719  "%s: Opcode 0x%" PRIx32 " registered to port %" PRIi32 " slot %" PRIi32 "";
1720 #endif
1721 
1722  Fw::TextLogString _logString;
1723  _logString.format(
1724  _formatString,
1725 #if FW_OBJECT_NAMES == 1
1726  this->m_objName.toChar(),
1727 #endif
1728  "OpCodeRegistered ",
1729  Opcode,
1730  port,
1731  slot
1732  );
1733 
1734  this->m_LogText_OutputPort[0].invoke(
1735  _id,
1736  _logTime,
1738  _logString
1739  );
1740  }
1741 #endif
1742  }
1743 
1746  U32 Opcode,
1747  I32 port
1748  )
1749  {
1750  // Get the time
1751  Fw::Time _logTime;
1752  if (this->m_Time_OutputPort[0].isConnected()) {
1753  this->m_Time_OutputPort[0].invoke(_logTime);
1754  }
1755 
1756  FwEventIdType _id = static_cast<FwEventIdType>(0);
1757 
1758  _id = this->getIdBase() + EVENTID_OPCODEDISPATCHED;
1759 
1760  // Emit the event on the log port
1761  if (this->m_Log_OutputPort[0].isConnected()) {
1762  Fw::LogBuffer _logBuff;
1764 
1765 #if FW_AMPCS_COMPATIBLE
1766  // Serialize the number of arguments
1767  _status = _logBuff.serialize(static_cast<U8>(2));
1768  FW_ASSERT(
1769  _status == Fw::FW_SERIALIZE_OK,
1770  static_cast<FwAssertArgType>(_status)
1771  );
1772 #endif
1773 
1774 #if FW_AMPCS_COMPATIBLE
1775  // Serialize the argument size
1776  _status = _logBuff.serialize(
1777  static_cast<U8>(sizeof(U32))
1778  );
1779  FW_ASSERT(
1780  _status == Fw::FW_SERIALIZE_OK,
1781  static_cast<FwAssertArgType>(_status)
1782  );
1783 #endif
1784  _status = _logBuff.serialize(Opcode);
1785  FW_ASSERT(
1786  _status == Fw::FW_SERIALIZE_OK,
1787  static_cast<FwAssertArgType>(_status)
1788  );
1789 
1790 #if FW_AMPCS_COMPATIBLE
1791  // Serialize the argument size
1792  _status = _logBuff.serialize(
1793  static_cast<U8>(sizeof(I32))
1794  );
1795  FW_ASSERT(
1796  _status == Fw::FW_SERIALIZE_OK,
1797  static_cast<FwAssertArgType>(_status)
1798  );
1799 #endif
1800  _status = _logBuff.serialize(port);
1801  FW_ASSERT(
1802  _status == Fw::FW_SERIALIZE_OK,
1803  static_cast<FwAssertArgType>(_status)
1804  );
1805 
1806  this->m_Log_OutputPort[0].invoke(
1807  _id,
1808  _logTime,
1810  _logBuff
1811  );
1812  }
1813 
1814  // Emit the event on the text log port
1815 #if FW_ENABLE_TEXT_LOGGING
1816  if (this->m_LogText_OutputPort[0].isConnected()) {
1817 #if FW_OBJECT_NAMES == 1
1818  const char* _formatString =
1819  "(%s) %s: Opcode 0x%" PRIx32 " dispatched to port %" PRIi32 "";
1820 #else
1821  const char* _formatString =
1822  "%s: Opcode 0x%" PRIx32 " dispatched to port %" PRIi32 "";
1823 #endif
1824 
1825  Fw::TextLogString _logString;
1826  _logString.format(
1827  _formatString,
1828 #if FW_OBJECT_NAMES == 1
1829  this->m_objName.toChar(),
1830 #endif
1831  "OpCodeDispatched ",
1832  Opcode,
1833  port
1834  );
1835 
1836  this->m_LogText_OutputPort[0].invoke(
1837  _id,
1838  _logTime,
1840  _logString
1841  );
1842  }
1843 #endif
1844  }
1845 
1847  log_COMMAND_OpCodeCompleted(U32 Opcode)
1848  {
1849  // Get the time
1850  Fw::Time _logTime;
1851  if (this->m_Time_OutputPort[0].isConnected()) {
1852  this->m_Time_OutputPort[0].invoke(_logTime);
1853  }
1854 
1855  FwEventIdType _id = static_cast<FwEventIdType>(0);
1856 
1857  _id = this->getIdBase() + EVENTID_OPCODECOMPLETED;
1858 
1859  // Emit the event on the log port
1860  if (this->m_Log_OutputPort[0].isConnected()) {
1861  Fw::LogBuffer _logBuff;
1863 
1864 #if FW_AMPCS_COMPATIBLE
1865  // Serialize the number of arguments
1866  _status = _logBuff.serialize(static_cast<U8>(1));
1867  FW_ASSERT(
1868  _status == Fw::FW_SERIALIZE_OK,
1869  static_cast<FwAssertArgType>(_status)
1870  );
1871 #endif
1872 
1873 #if FW_AMPCS_COMPATIBLE
1874  // Serialize the argument size
1875  _status = _logBuff.serialize(
1876  static_cast<U8>(sizeof(U32))
1877  );
1878  FW_ASSERT(
1879  _status == Fw::FW_SERIALIZE_OK,
1880  static_cast<FwAssertArgType>(_status)
1881  );
1882 #endif
1883  _status = _logBuff.serialize(Opcode);
1884  FW_ASSERT(
1885  _status == Fw::FW_SERIALIZE_OK,
1886  static_cast<FwAssertArgType>(_status)
1887  );
1888 
1889  this->m_Log_OutputPort[0].invoke(
1890  _id,
1891  _logTime,
1893  _logBuff
1894  );
1895  }
1896 
1897  // Emit the event on the text log port
1898 #if FW_ENABLE_TEXT_LOGGING
1899  if (this->m_LogText_OutputPort[0].isConnected()) {
1900 #if FW_OBJECT_NAMES == 1
1901  const char* _formatString =
1902  "(%s) %s: Opcode 0x%" PRIx32 " completed";
1903 #else
1904  const char* _formatString =
1905  "%s: Opcode 0x%" PRIx32 " completed";
1906 #endif
1907 
1908  Fw::TextLogString _logString;
1909  _logString.format(
1910  _formatString,
1911 #if FW_OBJECT_NAMES == 1
1912  this->m_objName.toChar(),
1913 #endif
1914  "OpCodeCompleted ",
1915  Opcode
1916  );
1917 
1918  this->m_LogText_OutputPort[0].invoke(
1919  _id,
1920  _logTime,
1922  _logString
1923  );
1924  }
1925 #endif
1926  }
1927 
1930  U32 Opcode,
1931  Fw::CmdResponse error
1932  )
1933  {
1934  // Get the time
1935  Fw::Time _logTime;
1936  if (this->m_Time_OutputPort[0].isConnected()) {
1937  this->m_Time_OutputPort[0].invoke(_logTime);
1938  }
1939 
1940  FwEventIdType _id = static_cast<FwEventIdType>(0);
1941 
1942  _id = this->getIdBase() + EVENTID_OPCODEERROR;
1943 
1944  // Emit the event on the log port
1945  if (this->m_Log_OutputPort[0].isConnected()) {
1946  Fw::LogBuffer _logBuff;
1948 
1949 #if FW_AMPCS_COMPATIBLE
1950  // Serialize the number of arguments
1951  _status = _logBuff.serialize(static_cast<U8>(2));
1952  FW_ASSERT(
1953  _status == Fw::FW_SERIALIZE_OK,
1954  static_cast<FwAssertArgType>(_status)
1955  );
1956 #endif
1957 
1958 #if FW_AMPCS_COMPATIBLE
1959  // Serialize the argument size
1960  _status = _logBuff.serialize(
1961  static_cast<U8>(sizeof(U32))
1962  );
1963  FW_ASSERT(
1964  _status == Fw::FW_SERIALIZE_OK,
1965  static_cast<FwAssertArgType>(_status)
1966  );
1967 #endif
1968  _status = _logBuff.serialize(Opcode);
1969  FW_ASSERT(
1970  _status == Fw::FW_SERIALIZE_OK,
1971  static_cast<FwAssertArgType>(_status)
1972  );
1973 
1974 #if FW_AMPCS_COMPATIBLE
1975  // Serialize the argument size
1976  _status = _logBuff.serialize(
1977  static_cast<U8>(Fw::CmdResponse::SERIALIZED_SIZE)
1978  );
1979  FW_ASSERT(
1980  _status == Fw::FW_SERIALIZE_OK,
1981  static_cast<FwAssertArgType>(_status)
1982  );
1983 #endif
1984  _status = _logBuff.serialize(error);
1985  FW_ASSERT(
1986  _status == Fw::FW_SERIALIZE_OK,
1987  static_cast<FwAssertArgType>(_status)
1988  );
1989 
1990  this->m_Log_OutputPort[0].invoke(
1991  _id,
1992  _logTime,
1994  _logBuff
1995  );
1996  }
1997 
1998  // Emit the event on the text log port
1999 #if FW_ENABLE_TEXT_LOGGING
2000  if (this->m_LogText_OutputPort[0].isConnected()) {
2001 #if FW_OBJECT_NAMES == 1
2002  const char* _formatString =
2003  "(%s) %s: Opcode 0x%" PRIx32 " completed with error %s";
2004 #else
2005  const char* _formatString =
2006  "%s: Opcode 0x%" PRIx32 " completed with error %s";
2007 #endif
2008 
2009  Fw::String errorStr;
2010  error.toString(errorStr);
2011 
2012  Fw::TextLogString _logString;
2013  _logString.format(
2014  _formatString,
2015 #if FW_OBJECT_NAMES == 1
2016  this->m_objName.toChar(),
2017 #endif
2018  "OpCodeError ",
2019  Opcode,
2020  errorStr.toChar()
2021  );
2022 
2023  this->m_LogText_OutputPort[0].invoke(
2024  _id,
2025  _logTime,
2027  _logString
2028  );
2029  }
2030 #endif
2031  }
2032 
2035  {
2036  // Get the time
2037  Fw::Time _logTime;
2038  if (this->m_Time_OutputPort[0].isConnected()) {
2039  this->m_Time_OutputPort[0].invoke(_logTime);
2040  }
2041 
2042  FwEventIdType _id = static_cast<FwEventIdType>(0);
2043 
2044  _id = this->getIdBase() + EVENTID_MALFORMEDCOMMAND;
2045 
2046  // Emit the event on the log port
2047  if (this->m_Log_OutputPort[0].isConnected()) {
2048  Fw::LogBuffer _logBuff;
2050 
2051 #if FW_AMPCS_COMPATIBLE
2052  // Serialize the number of arguments
2053  _status = _logBuff.serialize(static_cast<U8>(1));
2054  FW_ASSERT(
2055  _status == Fw::FW_SERIALIZE_OK,
2056  static_cast<FwAssertArgType>(_status)
2057  );
2058 #endif
2059 
2060 #if FW_AMPCS_COMPATIBLE
2061  // Serialize the argument size
2062  _status = _logBuff.serialize(
2064  );
2065  FW_ASSERT(
2066  _status == Fw::FW_SERIALIZE_OK,
2067  static_cast<FwAssertArgType>(_status)
2068  );
2069 #endif
2070  _status = _logBuff.serialize(Status);
2071  FW_ASSERT(
2072  _status == Fw::FW_SERIALIZE_OK,
2073  static_cast<FwAssertArgType>(_status)
2074  );
2075 
2076  this->m_Log_OutputPort[0].invoke(
2077  _id,
2078  _logTime,
2080  _logBuff
2081  );
2082  }
2083 
2084  // Emit the event on the text log port
2085 #if FW_ENABLE_TEXT_LOGGING
2086  if (this->m_LogText_OutputPort[0].isConnected()) {
2087 #if FW_OBJECT_NAMES == 1
2088  const char* _formatString =
2089  "(%s) %s: Received malformed command packet. Status: %s";
2090 #else
2091  const char* _formatString =
2092  "%s: Received malformed command packet. Status: %s";
2093 #endif
2094 
2095  Fw::String StatusStr;
2096  Status.toString(StatusStr);
2097 
2098  Fw::TextLogString _logString;
2099  _logString.format(
2100  _formatString,
2101 #if FW_OBJECT_NAMES == 1
2102  this->m_objName.toChar(),
2103 #endif
2104  "MalformedCommand ",
2105  StatusStr.toChar()
2106  );
2107 
2108  this->m_LogText_OutputPort[0].invoke(
2109  _id,
2110  _logTime,
2112  _logString
2113  );
2114  }
2115 #endif
2116  }
2117 
2120  {
2121  // Get the time
2122  Fw::Time _logTime;
2123  if (this->m_Time_OutputPort[0].isConnected()) {
2124  this->m_Time_OutputPort[0].invoke(_logTime);
2125  }
2126 
2127  FwEventIdType _id = static_cast<FwEventIdType>(0);
2128 
2129  _id = this->getIdBase() + EVENTID_INVALIDCOMMAND;
2130 
2131  // Emit the event on the log port
2132  if (this->m_Log_OutputPort[0].isConnected()) {
2133  Fw::LogBuffer _logBuff;
2135 
2136 #if FW_AMPCS_COMPATIBLE
2137  // Serialize the number of arguments
2138  _status = _logBuff.serialize(static_cast<U8>(1));
2139  FW_ASSERT(
2140  _status == Fw::FW_SERIALIZE_OK,
2141  static_cast<FwAssertArgType>(_status)
2142  );
2143 #endif
2144 
2145 #if FW_AMPCS_COMPATIBLE
2146  // Serialize the argument size
2147  _status = _logBuff.serialize(
2148  static_cast<U8>(sizeof(U32))
2149  );
2150  FW_ASSERT(
2151  _status == Fw::FW_SERIALIZE_OK,
2152  static_cast<FwAssertArgType>(_status)
2153  );
2154 #endif
2155  _status = _logBuff.serialize(Opcode);
2156  FW_ASSERT(
2157  _status == Fw::FW_SERIALIZE_OK,
2158  static_cast<FwAssertArgType>(_status)
2159  );
2160 
2161  this->m_Log_OutputPort[0].invoke(
2162  _id,
2163  _logTime,
2165  _logBuff
2166  );
2167  }
2168 
2169  // Emit the event on the text log port
2170 #if FW_ENABLE_TEXT_LOGGING
2171  if (this->m_LogText_OutputPort[0].isConnected()) {
2172 #if FW_OBJECT_NAMES == 1
2173  const char* _formatString =
2174  "(%s) %s: Invalid opcode 0x%" PRIx32 " received";
2175 #else
2176  const char* _formatString =
2177  "%s: Invalid opcode 0x%" PRIx32 " received";
2178 #endif
2179 
2180  Fw::TextLogString _logString;
2181  _logString.format(
2182  _formatString,
2183 #if FW_OBJECT_NAMES == 1
2184  this->m_objName.toChar(),
2185 #endif
2186  "InvalidCommand ",
2187  Opcode
2188  );
2189 
2190  this->m_LogText_OutputPort[0].invoke(
2191  _id,
2192  _logTime,
2194  _logString
2195  );
2196  }
2197 #endif
2198  }
2199 
2202  {
2203  // Get the time
2204  Fw::Time _logTime;
2205  if (this->m_Time_OutputPort[0].isConnected()) {
2206  this->m_Time_OutputPort[0].invoke(_logTime);
2207  }
2208 
2209  FwEventIdType _id = static_cast<FwEventIdType>(0);
2210 
2211  _id = this->getIdBase() + EVENTID_TOOMANYCOMMANDS;
2212 
2213  // Emit the event on the log port
2214  if (this->m_Log_OutputPort[0].isConnected()) {
2215  Fw::LogBuffer _logBuff;
2217 
2218 #if FW_AMPCS_COMPATIBLE
2219  // Serialize the number of arguments
2220  _status = _logBuff.serialize(static_cast<U8>(1));
2221  FW_ASSERT(
2222  _status == Fw::FW_SERIALIZE_OK,
2223  static_cast<FwAssertArgType>(_status)
2224  );
2225 #endif
2226 
2227 #if FW_AMPCS_COMPATIBLE
2228  // Serialize the argument size
2229  _status = _logBuff.serialize(
2230  static_cast<U8>(sizeof(U32))
2231  );
2232  FW_ASSERT(
2233  _status == Fw::FW_SERIALIZE_OK,
2234  static_cast<FwAssertArgType>(_status)
2235  );
2236 #endif
2237  _status = _logBuff.serialize(Opcode);
2238  FW_ASSERT(
2239  _status == Fw::FW_SERIALIZE_OK,
2240  static_cast<FwAssertArgType>(_status)
2241  );
2242 
2243  this->m_Log_OutputPort[0].invoke(
2244  _id,
2245  _logTime,
2247  _logBuff
2248  );
2249  }
2250 
2251  // Emit the event on the text log port
2252 #if FW_ENABLE_TEXT_LOGGING
2253  if (this->m_LogText_OutputPort[0].isConnected()) {
2254 #if FW_OBJECT_NAMES == 1
2255  const char* _formatString =
2256  "(%s) %s: Too many outstanding commands. opcode=0x%" PRIx32 "";
2257 #else
2258  const char* _formatString =
2259  "%s: Too many outstanding commands. opcode=0x%" PRIx32 "";
2260 #endif
2261 
2262  Fw::TextLogString _logString;
2263  _logString.format(
2264  _formatString,
2265 #if FW_OBJECT_NAMES == 1
2266  this->m_objName.toChar(),
2267 #endif
2268  "TooManyCommands ",
2269  Opcode
2270  );
2271 
2272  this->m_LogText_OutputPort[0].invoke(
2273  _id,
2274  _logTime,
2276  _logString
2277  );
2278  }
2279 #endif
2280  }
2281 
2284  {
2285  // Get the time
2286  Fw::Time _logTime;
2287  if (this->m_Time_OutputPort[0].isConnected()) {
2288  this->m_Time_OutputPort[0].invoke(_logTime);
2289  }
2290 
2291  FwEventIdType _id = static_cast<FwEventIdType>(0);
2292 
2293  _id = this->getIdBase() + EVENTID_NOOPRECEIVED;
2294 
2295  // Emit the event on the log port
2296  if (this->m_Log_OutputPort[0].isConnected()) {
2297  Fw::LogBuffer _logBuff;
2298 
2299 #if FW_AMPCS_COMPATIBLE
2301  // Serialize the number of arguments
2302  _status = _logBuff.serialize(static_cast<U8>(0));
2303  FW_ASSERT(
2304  _status == Fw::FW_SERIALIZE_OK,
2305  static_cast<FwAssertArgType>(_status)
2306  );
2307 #endif
2308 
2309  this->m_Log_OutputPort[0].invoke(
2310  _id,
2311  _logTime,
2313  _logBuff
2314  );
2315  }
2316 
2317  // Emit the event on the text log port
2318 #if FW_ENABLE_TEXT_LOGGING
2319  if (this->m_LogText_OutputPort[0].isConnected()) {
2320 #if FW_OBJECT_NAMES == 1
2321  const char* _formatString =
2322  "(%s) %s: Received a NO-OP command";
2323 #else
2324  const char* _formatString =
2325  "%s: Received a NO-OP command";
2326 #endif
2327 
2328  Fw::TextLogString _logString;
2329  _logString.format(
2330  _formatString,
2331 #if FW_OBJECT_NAMES == 1
2332  this->m_objName.toChar(),
2333 #endif
2334  "NoOpReceived "
2335  );
2336 
2337  this->m_LogText_OutputPort[0].invoke(
2338  _id,
2339  _logTime,
2341  _logString
2342  );
2343  }
2344 #endif
2345  }
2346 
2349  {
2350  // Get the time
2351  Fw::Time _logTime;
2352  if (this->m_Time_OutputPort[0].isConnected()) {
2353  this->m_Time_OutputPort[0].invoke(_logTime);
2354  }
2355 
2356  FwEventIdType _id = static_cast<FwEventIdType>(0);
2357 
2358  _id = this->getIdBase() + EVENTID_NOOPSTRINGRECEIVED;
2359 
2360  // Emit the event on the log port
2361  if (this->m_Log_OutputPort[0].isConnected()) {
2362  Fw::LogBuffer _logBuff;
2364 
2365 #if FW_AMPCS_COMPATIBLE
2366  // Serialize the number of arguments
2367  _status = _logBuff.serialize(static_cast<U8>(1));
2368  FW_ASSERT(
2369  _status == Fw::FW_SERIALIZE_OK,
2370  static_cast<FwAssertArgType>(_status)
2371  );
2372 #endif
2373 
2374  _status = message.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
2375  FW_ASSERT(
2376  _status == Fw::FW_SERIALIZE_OK,
2377  static_cast<FwAssertArgType>(_status)
2378  );
2379 
2380  this->m_Log_OutputPort[0].invoke(
2381  _id,
2382  _logTime,
2384  _logBuff
2385  );
2386  }
2387 
2388  // Emit the event on the text log port
2389 #if FW_ENABLE_TEXT_LOGGING
2390  if (this->m_LogText_OutputPort[0].isConnected()) {
2391 #if FW_OBJECT_NAMES == 1
2392  const char* _formatString =
2393  "(%s) %s: Received a NO-OP string=%s";
2394 #else
2395  const char* _formatString =
2396  "%s: Received a NO-OP string=%s";
2397 #endif
2398 
2399  Fw::TextLogString _logString;
2400  _logString.format(
2401  _formatString,
2402 #if FW_OBJECT_NAMES == 1
2403  this->m_objName.toChar(),
2404 #endif
2405  "NoOpStringReceived ",
2406  message.toChar()
2407  );
2408 
2409  this->m_LogText_OutputPort[0].invoke(
2410  _id,
2411  _logTime,
2413  _logString
2414  );
2415  }
2416 #endif
2417  }
2418 
2421  I32 arg1,
2422  F32 arg2,
2423  U8 arg3
2424  )
2425  {
2426  // Get the time
2427  Fw::Time _logTime;
2428  if (this->m_Time_OutputPort[0].isConnected()) {
2429  this->m_Time_OutputPort[0].invoke(_logTime);
2430  }
2431 
2432  FwEventIdType _id = static_cast<FwEventIdType>(0);
2433 
2434  _id = this->getIdBase() + EVENTID_TESTCMD1ARGS;
2435 
2436  // Emit the event on the log port
2437  if (this->m_Log_OutputPort[0].isConnected()) {
2438  Fw::LogBuffer _logBuff;
2440 
2441 #if FW_AMPCS_COMPATIBLE
2442  // Serialize the number of arguments
2443  _status = _logBuff.serialize(static_cast<U8>(3));
2444  FW_ASSERT(
2445  _status == Fw::FW_SERIALIZE_OK,
2446  static_cast<FwAssertArgType>(_status)
2447  );
2448 #endif
2449 
2450 #if FW_AMPCS_COMPATIBLE
2451  // Serialize the argument size
2452  _status = _logBuff.serialize(
2453  static_cast<U8>(sizeof(I32))
2454  );
2455  FW_ASSERT(
2456  _status == Fw::FW_SERIALIZE_OK,
2457  static_cast<FwAssertArgType>(_status)
2458  );
2459 #endif
2460  _status = _logBuff.serialize(arg1);
2461  FW_ASSERT(
2462  _status == Fw::FW_SERIALIZE_OK,
2463  static_cast<FwAssertArgType>(_status)
2464  );
2465 
2466 #if FW_AMPCS_COMPATIBLE
2467  // Serialize the argument size
2468  _status = _logBuff.serialize(
2469  static_cast<U8>(sizeof(F32))
2470  );
2471  FW_ASSERT(
2472  _status == Fw::FW_SERIALIZE_OK,
2473  static_cast<FwAssertArgType>(_status)
2474  );
2475 #endif
2476  _status = _logBuff.serialize(arg2);
2477  FW_ASSERT(
2478  _status == Fw::FW_SERIALIZE_OK,
2479  static_cast<FwAssertArgType>(_status)
2480  );
2481 
2482 #if FW_AMPCS_COMPATIBLE
2483  // Serialize the argument size
2484  _status = _logBuff.serialize(
2485  static_cast<U8>(sizeof(U8))
2486  );
2487  FW_ASSERT(
2488  _status == Fw::FW_SERIALIZE_OK,
2489  static_cast<FwAssertArgType>(_status)
2490  );
2491 #endif
2492  _status = _logBuff.serialize(arg3);
2493  FW_ASSERT(
2494  _status == Fw::FW_SERIALIZE_OK,
2495  static_cast<FwAssertArgType>(_status)
2496  );
2497 
2498  this->m_Log_OutputPort[0].invoke(
2499  _id,
2500  _logTime,
2502  _logBuff
2503  );
2504  }
2505 
2506  // Emit the event on the text log port
2507 #if FW_ENABLE_TEXT_LOGGING
2508  if (this->m_LogText_OutputPort[0].isConnected()) {
2509 #if FW_OBJECT_NAMES == 1
2510  const char* _formatString =
2511  "(%s) %s: TEST_CMD_1 args: I32: %" PRIi32 ", F32: %f, U8: %" PRIu8 "";
2512 #else
2513  const char* _formatString =
2514  "%s: TEST_CMD_1 args: I32: %" PRIi32 ", F32: %f, U8: %" PRIu8 "";
2515 #endif
2516 
2517  Fw::TextLogString _logString;
2518  _logString.format(
2519  _formatString,
2520 #if FW_OBJECT_NAMES == 1
2521  this->m_objName.toChar(),
2522 #endif
2523  "TestCmd1Args ",
2524  arg1,
2525  arg2,
2526  arg3
2527  );
2528 
2529  this->m_LogText_OutputPort[0].invoke(
2530  _id,
2531  _logTime,
2533  _logString
2534  );
2535  }
2536 #endif
2537  }
2538 
2541  U32 Opcode,
2542  I32 port
2543  )
2544  {
2545  // Get the time
2546  Fw::Time _logTime;
2547  if (this->m_Time_OutputPort[0].isConnected()) {
2548  this->m_Time_OutputPort[0].invoke(_logTime);
2549  }
2550 
2551  FwEventIdType _id = static_cast<FwEventIdType>(0);
2552 
2553  _id = this->getIdBase() + EVENTID_OPCODEREREGISTERED;
2554 
2555  // Emit the event on the log port
2556  if (this->m_Log_OutputPort[0].isConnected()) {
2557  Fw::LogBuffer _logBuff;
2559 
2560 #if FW_AMPCS_COMPATIBLE
2561  // Serialize the number of arguments
2562  _status = _logBuff.serialize(static_cast<U8>(2));
2563  FW_ASSERT(
2564  _status == Fw::FW_SERIALIZE_OK,
2565  static_cast<FwAssertArgType>(_status)
2566  );
2567 #endif
2568 
2569 #if FW_AMPCS_COMPATIBLE
2570  // Serialize the argument size
2571  _status = _logBuff.serialize(
2572  static_cast<U8>(sizeof(U32))
2573  );
2574  FW_ASSERT(
2575  _status == Fw::FW_SERIALIZE_OK,
2576  static_cast<FwAssertArgType>(_status)
2577  );
2578 #endif
2579  _status = _logBuff.serialize(Opcode);
2580  FW_ASSERT(
2581  _status == Fw::FW_SERIALIZE_OK,
2582  static_cast<FwAssertArgType>(_status)
2583  );
2584 
2585 #if FW_AMPCS_COMPATIBLE
2586  // Serialize the argument size
2587  _status = _logBuff.serialize(
2588  static_cast<U8>(sizeof(I32))
2589  );
2590  FW_ASSERT(
2591  _status == Fw::FW_SERIALIZE_OK,
2592  static_cast<FwAssertArgType>(_status)
2593  );
2594 #endif
2595  _status = _logBuff.serialize(port);
2596  FW_ASSERT(
2597  _status == Fw::FW_SERIALIZE_OK,
2598  static_cast<FwAssertArgType>(_status)
2599  );
2600 
2601  this->m_Log_OutputPort[0].invoke(
2602  _id,
2603  _logTime,
2605  _logBuff
2606  );
2607  }
2608 
2609  // Emit the event on the text log port
2610 #if FW_ENABLE_TEXT_LOGGING
2611  if (this->m_LogText_OutputPort[0].isConnected()) {
2612 #if FW_OBJECT_NAMES == 1
2613  const char* _formatString =
2614  "(%s) %s: Opcode 0x%" PRIx32 " is already registered to port %" PRIi32 "";
2615 #else
2616  const char* _formatString =
2617  "%s: Opcode 0x%" PRIx32 " is already registered to port %" PRIi32 "";
2618 #endif
2619 
2620  Fw::TextLogString _logString;
2621  _logString.format(
2622  _formatString,
2623 #if FW_OBJECT_NAMES == 1
2624  this->m_objName.toChar(),
2625 #endif
2626  "OpCodeReregistered ",
2627  Opcode,
2628  port
2629  );
2630 
2631  this->m_LogText_OutputPort[0].invoke(
2632  _id,
2633  _logTime,
2635  _logString
2636  );
2637  }
2638 #endif
2639  }
2640 
2641  // ----------------------------------------------------------------------
2642  // Telemetry write functions
2643  // ----------------------------------------------------------------------
2644 
2647  U32 arg,
2648  Fw::Time _tlmTime
2649  )
2650  {
2651  // Check to see if it is the first time
2652  if (not this->m_first_update_CommandsDispatched) {
2653  // Check to see if value has changed. If not, don't write it.
2654  if (arg == this->m_last_CommandsDispatched) {
2655  return;
2656  }
2657  else {
2658  this->m_last_CommandsDispatched = arg;
2659  }
2660  }
2661  else {
2662  this->m_first_update_CommandsDispatched = false;
2663  this->m_last_CommandsDispatched = arg;
2664  }
2665 
2666  if (this->m_Tlm_OutputPort[0].isConnected()) {
2667  if (
2668  this->m_Time_OutputPort[0].isConnected() &&
2669  (_tlmTime == Fw::ZERO_TIME)
2670  ) {
2671  this->m_Time_OutputPort[0].invoke(_tlmTime);
2672  }
2673 
2674  Fw::TlmBuffer _tlmBuff;
2675  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
2676  FW_ASSERT(
2677  _stat == Fw::FW_SERIALIZE_OK,
2678  static_cast<FwAssertArgType>(_stat)
2679  );
2680 
2681  FwChanIdType _id;
2682 
2683  _id = this->getIdBase() + CHANNELID_COMMANDSDISPATCHED;
2684 
2685  this->m_Tlm_OutputPort[0].invoke(
2686  _id,
2687  _tlmTime,
2688  _tlmBuff
2689  );
2690  }
2691  }
2692 
2695  U32 arg,
2696  Fw::Time _tlmTime
2697  )
2698  {
2699  // Check to see if it is the first time
2700  if (not this->m_first_update_CommandErrors) {
2701  // Check to see if value has changed. If not, don't write it.
2702  if (arg == this->m_last_CommandErrors) {
2703  return;
2704  }
2705  else {
2706  this->m_last_CommandErrors = arg;
2707  }
2708  }
2709  else {
2710  this->m_first_update_CommandErrors = false;
2711  this->m_last_CommandErrors = arg;
2712  }
2713 
2714  if (this->m_Tlm_OutputPort[0].isConnected()) {
2715  if (
2716  this->m_Time_OutputPort[0].isConnected() &&
2717  (_tlmTime == Fw::ZERO_TIME)
2718  ) {
2719  this->m_Time_OutputPort[0].invoke(_tlmTime);
2720  }
2721 
2722  Fw::TlmBuffer _tlmBuff;
2723  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
2724  FW_ASSERT(
2725  _stat == Fw::FW_SERIALIZE_OK,
2726  static_cast<FwAssertArgType>(_stat)
2727  );
2728 
2729  FwChanIdType _id;
2730 
2731  _id = this->getIdBase() + CHANNELID_COMMANDERRORS;
2732 
2733  this->m_Tlm_OutputPort[0].invoke(
2734  _id,
2735  _tlmTime,
2736  _tlmBuff
2737  );
2738  }
2739  }
2740 
2741  // ----------------------------------------------------------------------
2742  // Time
2743  // ----------------------------------------------------------------------
2744 
2746  getTime()
2747  {
2748  if (this->m_Time_OutputPort[0].isConnected()) {
2749  Fw::Time _time;
2750  this->m_Time_OutputPort[0].invoke(_time);
2751  return _time;
2752  }
2753  else {
2754  return Fw::Time(TB_NONE, 0, 0);
2755  }
2756  }
2757 
2758  // ----------------------------------------------------------------------
2759  // Mutex operations for guarded ports
2760  //
2761  // You can override these operations to provide more sophisticated
2762  // synchronization
2763  // ----------------------------------------------------------------------
2764 
2766  lock()
2767  {
2768  this->m_guardedPortMutex.lock();
2769  }
2770 
2772  unLock()
2773  {
2774  this->m_guardedPortMutex.unLock();
2775  }
2776 
2777  // ----------------------------------------------------------------------
2778  // Message dispatch functions
2779  // ----------------------------------------------------------------------
2780 
2781  Fw::QueuedComponentBase::MsgDispatchStatus CommandDispatcherComponentBase ::
2782  doDispatch()
2783  {
2784  ComponentIpcSerializableBuffer msg;
2785  FwQueuePriorityType priority = 0;
2786 
2787  Os::Queue::Status msgStatus = this->m_queue.receive(
2788  msg,
2790  priority
2791  );
2792  FW_ASSERT(
2793  msgStatus == Os::Queue::OP_OK,
2794  static_cast<FwAssertArgType>(msgStatus)
2795  );
2796 
2797  // Reset to beginning of buffer
2798  msg.resetDeser();
2799 
2800  FwEnumStoreType desMsg = 0;
2801  Fw::SerializeStatus deserStatus = msg.deserialize(desMsg);
2802  FW_ASSERT(
2803  deserStatus == Fw::FW_SERIALIZE_OK,
2804  static_cast<FwAssertArgType>(deserStatus)
2805  );
2806 
2807  MsgTypeEnum msgType = static_cast<MsgTypeEnum>(desMsg);
2808 
2809  if (msgType == COMMANDDISPATCHER_COMPONENT_EXIT) {
2810  return MSG_DISPATCH_EXIT;
2811  }
2812 
2813  FwIndexType portNum = 0;
2814  deserStatus = msg.deserialize(portNum);
2815  FW_ASSERT(
2816  deserStatus == Fw::FW_SERIALIZE_OK,
2817  static_cast<FwAssertArgType>(deserStatus)
2818  );
2819 
2820  switch (msgType) {
2821  // Handle async input port compCmdStat
2822  case COMPCMDSTAT_CMDRESPONSE: {
2823  // Deserialize argument opCode
2824  FwOpcodeType opCode;
2825  deserStatus = msg.deserialize(opCode);
2826  FW_ASSERT(
2827  deserStatus == Fw::FW_SERIALIZE_OK,
2828  static_cast<FwAssertArgType>(deserStatus)
2829  );
2830 
2831  // Deserialize argument cmdSeq
2832  U32 cmdSeq;
2833  deserStatus = msg.deserialize(cmdSeq);
2834  FW_ASSERT(
2835  deserStatus == Fw::FW_SERIALIZE_OK,
2836  static_cast<FwAssertArgType>(deserStatus)
2837  );
2838 
2839  // Deserialize argument response
2840  Fw::CmdResponse response;
2841  deserStatus = msg.deserialize(response);
2842  FW_ASSERT(
2843  deserStatus == Fw::FW_SERIALIZE_OK,
2844  static_cast<FwAssertArgType>(deserStatus)
2845  );
2846  // Call handler function
2847  this->compCmdStat_handler(
2848  portNum,
2849  opCode,
2850  cmdSeq,
2851  response
2852  );
2853 
2854  break;
2855  }
2856 
2857  // Handle async input port pingIn
2858  case PINGIN_PING: {
2859  // Deserialize argument key
2860  U32 key;
2861  deserStatus = msg.deserialize(key);
2862  FW_ASSERT(
2863  deserStatus == Fw::FW_SERIALIZE_OK,
2864  static_cast<FwAssertArgType>(deserStatus)
2865  );
2866  // Call handler function
2867  this->pingIn_handler(
2868  portNum,
2869  key
2870  );
2871 
2872  break;
2873  }
2874 
2875  // Handle async input port seqCmdBuff
2876  case SEQCMDBUFF_COM: {
2877  // Deserialize argument data
2878  Fw::ComBuffer data;
2879  deserStatus = msg.deserialize(data);
2880  FW_ASSERT(
2881  deserStatus == Fw::FW_SERIALIZE_OK,
2882  static_cast<FwAssertArgType>(deserStatus)
2883  );
2884 
2885  // Deserialize argument context
2886  U32 context;
2887  deserStatus = msg.deserialize(context);
2888  FW_ASSERT(
2889  deserStatus == Fw::FW_SERIALIZE_OK,
2890  static_cast<FwAssertArgType>(deserStatus)
2891  );
2892  // Call handler function
2893  this->seqCmdBuff_handler(
2894  portNum,
2895  data,
2896  context
2897  );
2898 
2899  break;
2900  }
2901 
2902  // Handle command CMD_NO_OP
2903  case CMD_CMD_NO_OP: {
2904  // Deserialize opcode
2905  FwOpcodeType opCode = 0;
2906  deserStatus = msg.deserialize(opCode);
2907  FW_ASSERT (
2908  deserStatus == Fw::FW_SERIALIZE_OK,
2909  static_cast<FwAssertArgType>(deserStatus)
2910  );
2911 
2912  // Deserialize command sequence
2913  U32 cmdSeq = 0;
2914  deserStatus = msg.deserialize(cmdSeq);
2915  FW_ASSERT (
2916  deserStatus == Fw::FW_SERIALIZE_OK,
2917  static_cast<FwAssertArgType>(deserStatus)
2918  );
2919 
2920  // Deserialize command argument buffer
2921  Fw::CmdArgBuffer args;
2922  deserStatus = msg.deserialize(args);
2923  FW_ASSERT (
2924  deserStatus == Fw::FW_SERIALIZE_OK,
2925  static_cast<FwAssertArgType>(deserStatus)
2926  );
2927 
2928  // Reset buffer
2929  args.resetDeser();
2930 
2931  // Make sure there was no data left over.
2932  // That means the argument buffer size was incorrect.
2933 #if FW_CMD_CHECK_RESIDUAL
2934  if (args.getBuffLeft() != 0) {
2935  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
2936  this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2937  }
2938  // Don't crash the task if bad arguments were passed from the ground
2939  break;
2940  }
2941 #endif
2942 
2943  // Call handler function
2944  this->CMD_NO_OP_cmdHandler(opCode, cmdSeq);
2945 
2946  break;
2947  }
2948 
2949  // Handle command CMD_NO_OP_STRING
2950  case CMD_CMD_NO_OP_STRING: {
2951  // Deserialize opcode
2952  FwOpcodeType opCode = 0;
2953  deserStatus = msg.deserialize(opCode);
2954  FW_ASSERT (
2955  deserStatus == Fw::FW_SERIALIZE_OK,
2956  static_cast<FwAssertArgType>(deserStatus)
2957  );
2958 
2959  // Deserialize command sequence
2960  U32 cmdSeq = 0;
2961  deserStatus = msg.deserialize(cmdSeq);
2962  FW_ASSERT (
2963  deserStatus == Fw::FW_SERIALIZE_OK,
2964  static_cast<FwAssertArgType>(deserStatus)
2965  );
2966 
2967  // Deserialize command argument buffer
2968  Fw::CmdArgBuffer args;
2969  deserStatus = msg.deserialize(args);
2970  FW_ASSERT (
2971  deserStatus == Fw::FW_SERIALIZE_OK,
2972  static_cast<FwAssertArgType>(deserStatus)
2973  );
2974 
2975  // Reset buffer
2976  args.resetDeser();
2977 
2978  // Deserialize argument arg1
2979  Fw::CmdStringArg arg1;
2980  deserStatus = args.deserialize(arg1);
2981  if (deserStatus != Fw::FW_SERIALIZE_OK) {
2982  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
2983  this->cmdResponse_out(
2984  opCode,
2985  cmdSeq,
2987  );
2988  }
2989  // Don't crash the task if bad arguments were passed from the ground
2990  break;
2991  }
2992 
2993  // Make sure there was no data left over.
2994  // That means the argument buffer size was incorrect.
2995 #if FW_CMD_CHECK_RESIDUAL
2996  if (args.getBuffLeft() != 0) {
2997  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
2998  this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2999  }
3000  // Don't crash the task if bad arguments were passed from the ground
3001  break;
3002  }
3003 #endif
3004 
3005  // Call handler function
3007  opCode, cmdSeq,
3008  arg1
3009  );
3010 
3011  break;
3012  }
3013 
3014  // Handle command CMD_TEST_CMD_1
3015  case CMD_CMD_TEST_CMD_1: {
3016  // Deserialize opcode
3017  FwOpcodeType opCode = 0;
3018  deserStatus = msg.deserialize(opCode);
3019  FW_ASSERT (
3020  deserStatus == Fw::FW_SERIALIZE_OK,
3021  static_cast<FwAssertArgType>(deserStatus)
3022  );
3023 
3024  // Deserialize command sequence
3025  U32 cmdSeq = 0;
3026  deserStatus = msg.deserialize(cmdSeq);
3027  FW_ASSERT (
3028  deserStatus == Fw::FW_SERIALIZE_OK,
3029  static_cast<FwAssertArgType>(deserStatus)
3030  );
3031 
3032  // Deserialize command argument buffer
3033  Fw::CmdArgBuffer args;
3034  deserStatus = msg.deserialize(args);
3035  FW_ASSERT (
3036  deserStatus == Fw::FW_SERIALIZE_OK,
3037  static_cast<FwAssertArgType>(deserStatus)
3038  );
3039 
3040  // Reset buffer
3041  args.resetDeser();
3042 
3043  // Deserialize argument arg1
3044  I32 arg1;
3045  deserStatus = args.deserialize(arg1);
3046  if (deserStatus != Fw::FW_SERIALIZE_OK) {
3047  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
3048  this->cmdResponse_out(
3049  opCode,
3050  cmdSeq,
3052  );
3053  }
3054  // Don't crash the task if bad arguments were passed from the ground
3055  break;
3056  }
3057 
3058  // Deserialize argument arg2
3059  F32 arg2;
3060  deserStatus = args.deserialize(arg2);
3061  if (deserStatus != Fw::FW_SERIALIZE_OK) {
3062  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
3063  this->cmdResponse_out(
3064  opCode,
3065  cmdSeq,
3067  );
3068  }
3069  // Don't crash the task if bad arguments were passed from the ground
3070  break;
3071  }
3072 
3073  // Deserialize argument arg3
3074  U8 arg3;
3075  deserStatus = args.deserialize(arg3);
3076  if (deserStatus != Fw::FW_SERIALIZE_OK) {
3077  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
3078  this->cmdResponse_out(
3079  opCode,
3080  cmdSeq,
3082  );
3083  }
3084  // Don't crash the task if bad arguments were passed from the ground
3085  break;
3086  }
3087 
3088  // Make sure there was no data left over.
3089  // That means the argument buffer size was incorrect.
3090 #if FW_CMD_CHECK_RESIDUAL
3091  if (args.getBuffLeft() != 0) {
3092  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
3093  this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
3094  }
3095  // Don't crash the task if bad arguments were passed from the ground
3096  break;
3097  }
3098 #endif
3099 
3100  // Call handler function
3102  opCode, cmdSeq,
3103  arg1,
3104  arg2,
3105  arg3
3106  );
3107 
3108  break;
3109  }
3110 
3111  // Handle command CMD_CLEAR_TRACKING
3112  case CMD_CMD_CLEAR_TRACKING: {
3113  // Deserialize opcode
3114  FwOpcodeType opCode = 0;
3115  deserStatus = msg.deserialize(opCode);
3116  FW_ASSERT (
3117  deserStatus == Fw::FW_SERIALIZE_OK,
3118  static_cast<FwAssertArgType>(deserStatus)
3119  );
3120 
3121  // Deserialize command sequence
3122  U32 cmdSeq = 0;
3123  deserStatus = msg.deserialize(cmdSeq);
3124  FW_ASSERT (
3125  deserStatus == Fw::FW_SERIALIZE_OK,
3126  static_cast<FwAssertArgType>(deserStatus)
3127  );
3128 
3129  // Deserialize command argument buffer
3130  Fw::CmdArgBuffer args;
3131  deserStatus = msg.deserialize(args);
3132  FW_ASSERT (
3133  deserStatus == Fw::FW_SERIALIZE_OK,
3134  static_cast<FwAssertArgType>(deserStatus)
3135  );
3136 
3137  // Reset buffer
3138  args.resetDeser();
3139 
3140  // Make sure there was no data left over.
3141  // That means the argument buffer size was incorrect.
3142 #if FW_CMD_CHECK_RESIDUAL
3143  if (args.getBuffLeft() != 0) {
3144  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
3145  this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
3146  }
3147  // Don't crash the task if bad arguments were passed from the ground
3148  break;
3149  }
3150 #endif
3151 
3152  // Call handler function
3153  this->CMD_CLEAR_TRACKING_cmdHandler(opCode, cmdSeq);
3154 
3155  break;
3156  }
3157 
3158  default:
3159  return MSG_DISPATCH_ERROR;
3160  }
3161 
3162  return MSG_DISPATCH_OK;
3163  }
3164 
3165  // ----------------------------------------------------------------------
3166  // Calls for messages received on special input ports
3167  // ----------------------------------------------------------------------
3168 
3169  void CommandDispatcherComponentBase ::
3170  m_p_CmdDisp_in(
3171  Fw::PassiveComponentBase* callComp,
3172  FwIndexType portNum,
3173  FwOpcodeType opCode,
3174  U32 cmdSeq,
3175  Fw::CmdArgBuffer& args
3176  )
3177  {
3178  FW_ASSERT(callComp);
3179  CommandDispatcherComponentBase* compPtr = static_cast<CommandDispatcherComponentBase*>(callComp);
3180 
3181  const U32 idBase = callComp->getIdBase();
3182  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
3183 
3184  // Select base class function based on opcode
3185  switch (opCode - idBase) {
3186  case OPCODE_CMD_NO_OP: {
3187  compPtr->CMD_NO_OP_cmdHandlerBase(
3188  opCode,
3189  cmdSeq,
3190  args
3191  );
3192  break;
3193  }
3194 
3195  case OPCODE_CMD_NO_OP_STRING: {
3196  compPtr->CMD_NO_OP_STRING_cmdHandlerBase(
3197  opCode,
3198  cmdSeq,
3199  args
3200  );
3201  break;
3202  }
3203 
3204  case OPCODE_CMD_TEST_CMD_1: {
3205  compPtr->CMD_TEST_CMD_1_cmdHandlerBase(
3206  opCode,
3207  cmdSeq,
3208  args
3209  );
3210  break;
3211  }
3212 
3214  compPtr->CMD_CLEAR_TRACKING_cmdHandlerBase(
3215  opCode,
3216  cmdSeq,
3217  args
3218  );
3219  break;
3220  }
3221  }
3222  }
3223 
3224  // ----------------------------------------------------------------------
3225  // Calls for messages received on typed input ports
3226  // ----------------------------------------------------------------------
3227 
3228  void CommandDispatcherComponentBase ::
3229  m_p_compCmdReg_in(
3230  Fw::PassiveComponentBase* callComp,
3231  FwIndexType portNum,
3232  FwOpcodeType opCode
3233  )
3234  {
3235  FW_ASSERT(callComp);
3236  CommandDispatcherComponentBase* compPtr = static_cast<CommandDispatcherComponentBase*>(callComp);
3237  compPtr->compCmdReg_handlerBase(
3238  portNum,
3239  opCode
3240  );
3241  }
3242 
3243  void CommandDispatcherComponentBase ::
3244  m_p_compCmdStat_in(
3245  Fw::PassiveComponentBase* callComp,
3246  FwIndexType portNum,
3247  FwOpcodeType opCode,
3248  U32 cmdSeq,
3249  const Fw::CmdResponse& response
3250  )
3251  {
3252  FW_ASSERT(callComp);
3253  CommandDispatcherComponentBase* compPtr = static_cast<CommandDispatcherComponentBase*>(callComp);
3254  compPtr->compCmdStat_handlerBase(
3255  portNum,
3256  opCode,
3257  cmdSeq,
3258  response
3259  );
3260  }
3261 
3262  void CommandDispatcherComponentBase ::
3263  m_p_pingIn_in(
3264  Fw::PassiveComponentBase* callComp,
3265  FwIndexType portNum,
3266  U32 key
3267  )
3268  {
3269  FW_ASSERT(callComp);
3270  CommandDispatcherComponentBase* compPtr = static_cast<CommandDispatcherComponentBase*>(callComp);
3271  compPtr->pingIn_handlerBase(
3272  portNum,
3273  key
3274  );
3275  }
3276 
3277  void CommandDispatcherComponentBase ::
3278  m_p_seqCmdBuff_in(
3279  Fw::PassiveComponentBase* callComp,
3280  FwIndexType portNum,
3281  Fw::ComBuffer& data,
3282  U32 context
3283  )
3284  {
3285  FW_ASSERT(callComp);
3286  CommandDispatcherComponentBase* compPtr = static_cast<CommandDispatcherComponentBase*>(callComp);
3287  compPtr->seqCmdBuff_handlerBase(
3288  portNum,
3289  data,
3290  context
3291  );
3292  }
3293 
3294 }
#define FW_ASSERT(...)
Definition: Assert.hpp:14
U8 BYTE
byte type
Definition: BasicTypes.h:31
float F32
32-bit floating point
Definition: BasicTypes.h:49
#define FW_MIN(a, b)
MIN macro.
Definition: BasicTypes.h:72
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:30
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition: BasicTypes.h:70
#define PRI_PlatformIntType
@ TB_NONE
No time base has been established.
Definition: FpConfig.h:70
I32 FwEnumStoreType
Definition: FpConfig.h:64
PlatformAssertArgType FwAssertArgType
Definition: FpConfig.h:39
U32 FwChanIdType
Definition: FpConfig.h:95
U32 FwEventIdType
Definition: FpConfig.h:103
U32 FwOpcodeType
Definition: FpConfig.h:91
PlatformSizeType FwSizeType
Definition: FpConfig.h:35
#define FW_LOG_STRING_MAX_SIZE
Max size of log string parameter type.
Definition: FpConfig.h:319
PlatformQueuePriorityType FwQueuePriorityType
Definition: FpConfig.h:55
PlatformIndexType FwIndexType
Definition: FpConfig.h:25
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects)
Definition: FpConfig.h:148
@ ACTIVE_COMPONENT_EXIT
message to exit active component task
Enum representing a command response.
@ FORMAT_ERROR
Command failed to deserialize.
@ SERIALIZED_SIZE
The size of the serial representation.
Fw::SerializeStatus deserialize(Fw::SerializeBufferBase &buffer)
Deserialize raw enum value from SerialType.
Deserialization status.
@ SERIALIZED_SIZE
The size of the serial representation.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: CmdPortAc.cpp:62
@ SERIALIZED_SIZE
The size of the serial representations of the port arguments.
Definition: CmdPortAc.hpp:37
void init()
Initialization function.
Definition: CmdPortAc.cpp:56
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void init()
Initialization function.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void init()
Initialization function.
@ SERIALIZED_SIZE
The size of the serial representations of the port arguments.
@ SERIALIZED_SIZE
The size of the serial representations of the port arguments.
Definition: ComPortAc.hpp:37
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: ComPortAc.cpp:62
void init()
Initialization function.
Definition: ComPortAc.cpp:56
void setPortNum(NATIVE_INT_TYPE portNum)
@ WARNING_HI
A serious but recoverable event.
@ ACTIVITY_HI
Important informational events.
@ DIAGNOSTIC
Software diagnostic events.
@ COMMAND
An activity related to commanding.
void init()
Object initializer.
Definition: ObjBase.cpp:27
const char * toChar() const
Definition: ObjectName.hpp:50
void addCallPort(InputCmdPort *callPort)
Register an input port.
Definition: CmdPortAc.cpp:150
void invoke(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Invoke a port interface.
Definition: CmdPortAc.cpp:163
void init()
Initialization function.
Definition: CmdPortAc.cpp:144
void addCallPort(InputCmdRegPort *callPort)
Register an input port.
void invoke(FwOpcodeType opCode)
Invoke a port interface.
void init()
Initialization function.
void init()
Initialization function.
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)
Invoke a port interface.
void init()
Initialization function.
Definition: LogPortAc.cpp:151
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args)
Invoke a port interface.
Definition: LogPortAc.cpp:170
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:157
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:134
void invoke(Fw::Time &time)
Invoke a port interface.
Definition: TimePortAc.cpp:147
void init()
Initialization function.
Definition: TimePortAc.cpp:128
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:150
void init()
Initialization function.
Definition: TlmPortAc.cpp:144
void invoke(FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)
Invoke a port interface.
Definition: TlmPortAc.cpp:163
bool isConnected()
Definition: PortBase.cpp:41
Os::Queue::Status createQueue(FwSizeType depth, FwSizeType msgSize)
Os::Queue m_queue
queue object for active component
@ MSG_DISPATCH_OK
Dispatch was normal.
@ MSG_DISPATCH_EXIT
A message was sent requesting an exit of the loop.
@ MSG_DISPATCH_ERROR
Errors dispatching messages.
NATIVE_UINT_TYPE SizeType
void resetDeser()
reset deserialization to beginning
Serializable::SizeType getBuffLeft() const
returns how much deserialization buffer is left
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
virtual const CHAR * toChar() const =0
void format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:56
virtual SerializeStatus serialize(SerializeBufferBase &buffer) const
serialization function
Definition: StringBase.cpp:146
const char * toChar() const
Definition: String.hpp:50
Definition: Time.hpp:9
void unLock()
unlock the mutex and assert success
Definition: Mutex.cpp:40
void lock()
lock the mutex and assert success
Definition: Mutex.cpp:34
Status send(const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override
send a message into the queue through delegate
Status receive(U8 *destination, FwSizeType capacity, BlockingType blockType, FwSizeType &actualSize, FwQueuePriorityType &priority) override
receive a message from the queue through delegate
BlockingType
message type
Definition: Queue.hpp:44
@ BLOCKING
Message will block until space is available.
Definition: Queue.hpp:45
@ NONBLOCKING
Message will return with status when space is unavailable.
Definition: Queue.hpp:46
Status
status returned from the queue send function
Definition: Queue.hpp:30
@ OP_OK
message sent/received okay
Definition: Queue.hpp:31
void set_CmdStatus_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to CmdStatus[portNum].
virtual void pingIn_preMsgHook(FwIndexType portNum, U32 key)
Pre-message hook for async input port pingIn.
void log_DIAGNOSTIC_OpCodeReregistered(U32 Opcode, I32 port)
bool isConnected_seqCmdStatus_OutputPort(FwIndexType portNum)
virtual void CMD_TEST_CMD_1_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command CMD_TEST_CMD_1.
void log_ACTIVITY_HI_TestCmd1Args(I32 arg1, F32 arg2, U8 arg3)
virtual void compCmdStat_handler(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)=0
Handler for input port compCmdStat.
virtual void CMD_NO_OP_STRING_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command CMD_NO_OP_STRING.
void regCommands()
Register commands with the Command Dispatcher.
void CMD_NO_OP_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void log_DIAGNOSTIC_OpCodeRegistered(U32 Opcode, I32 port, I32 slot)
Log event OpCodeRegistered.
CommandDispatcherComponentBase(const char *compName="")
Construct CommandDispatcherComponentBase object.
virtual void CMD_NO_OP_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command CMD_NO_OP.
virtual void compCmdReg_handler(FwIndexType portNum, FwOpcodeType opCode)=0
Handler for input port compCmdReg.
@ OPCODE_CMD_CLEAR_TRACKING
Clear command tracking info to recover from components not returning status.
void seqCmdBuff_handlerBase(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Handler base-class function for input port seqCmdBuff.
void set_Log_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
virtual void unLock()
Unlock the guarded mutex.
Fw::InputCmdResponsePort * get_compCmdStat_InputPort(FwIndexType portNum)
virtual void seqCmdBuff_preMsgHook(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Pre-message hook for async input port seqCmdBuff.
void tlmWrite_CommandErrors(U32 arg, Fw::Time _tlmTime=Fw::Time())
void set_Tlm_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to Tlm[portNum].
virtual void pingIn_handler(FwIndexType portNum, U32 key)=0
Handler for input port pingIn.
void compCmdReg_handlerBase(FwIndexType portNum, FwOpcodeType opCode)
Handler base-class function for input port compCmdReg.
void set_Time_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to Time[portNum].
bool isConnected_compCmdSend_OutputPort(FwIndexType portNum)
@ CHANNELID_COMMANDSDISPATCHED
Channel ID for CommandsDispatched.
@ CHANNELID_COMMANDERRORS
Channel ID for CommandErrors.
void log_WARNING_HI_MalformedCommand(Fw::DeserialStatus Status)
void log_ACTIVITY_HI_NoOpStringReceived(const Fw::StringBase &message)
void set_seqCmdStatus_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to seqCmdStatus[portNum].
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
Svc::InputPingPort * get_pingIn_InputPort(FwIndexType portNum)
Fw::InputCmdRegPort * get_compCmdReg_InputPort(FwIndexType portNum)
Fw::InputCmdPort * get_CmdDisp_InputPort(FwIndexType portNum)
virtual void CMD_CLEAR_TRACKING_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
void compCmdStat_handlerBase(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)
Handler base-class function for input port compCmdStat.
virtual void compCmdStat_preMsgHook(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)
Pre-message hook for async input port compCmdStat.
virtual void CMD_NO_OP_STRING_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdStringArg &arg1)=0
void set_CmdReg_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to CmdReg[portNum].
void pingOut_out(FwIndexType portNum, U32 key)
Invoke output port pingOut.
virtual void CMD_CLEAR_TRACKING_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command CMD_CLEAR_TRACKING.
virtual ~CommandDispatcherComponentBase()
Destroy CommandDispatcherComponentBase object.
virtual void CMD_NO_OP_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
void seqCmdStatus_out(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)
Invoke output port seqCmdStatus.
void set_compCmdSend_OutputPort(FwIndexType portNum, Fw::InputCmdPort *port)
Connect port to compCmdSend[portNum].
bool isConnected_CmdStatus_OutputPort(FwIndexType portNum)
@ EVENTID_MALFORMEDCOMMAND
Received a malformed command packet.
@ EVENTID_NOOPRECEIVED
The command dispatcher has successfully received a NO-OP command.
@ EVENTID_TOOMANYCOMMANDS
Exceeded the number of commands that can be simultaneously executed.
@ EVENTID_NOOPSTRINGRECEIVED
The command dispatcher has successfully received a NO-OP command from GUI with a string.
@ EVENTID_TESTCMD1ARGS
This log event message returns the TEST_CMD_1 arguments.
@ EVENTID_OPCODEREREGISTERED
Op code reregistered event.
@ EVENTID_OPCODEERROR
Op code completed with error event.
void compCmdSend_out(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Invoke output port compCmdSend.
virtual void seqCmdBuff_handler(FwIndexType portNum, Fw::ComBuffer &data, U32 context)=0
Handler for input port seqCmdBuff.
void CMD_TEST_CMD_1_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void tlmWrite_CommandsDispatched(U32 arg, Fw::Time _tlmTime=Fw::Time())
void set_pingOut_OutputPort(FwIndexType portNum, Svc::InputPingPort *port)
Connect port to pingOut[portNum].
void CMD_NO_OP_STRING_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
virtual void lock()
Lock the guarded mutex.
void CMD_CLEAR_TRACKING_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
virtual void CMD_TEST_CMD_1_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, I32 arg1, F32 arg2, U8 arg3)=0
Fw::InputComPort * get_seqCmdBuff_InputPort(FwIndexType portNum)
void log_COMMAND_OpCodeError(U32 Opcode, Fw::CmdResponse error)
void pingIn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port pingIn.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: PingPortAc.cpp:62
void init()
Initialization function.
Definition: PingPortAc.cpp:56
@ SERIALIZED_SIZE
The size of the serial representations of the port arguments.
Definition: PingPortAc.hpp:36
void invoke(U32 key)
Invoke a port interface.
Definition: PingPortAc.cpp:147
void init()
Initialization function.
Definition: PingPortAc.cpp:128
void addCallPort(InputPingPort *callPort)
Register an input port.
Definition: PingPortAc.cpp:134
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.
const Time ZERO_TIME
Definition: Time.cpp:5
Status
Generic OK/ERROR status.
Definition: Os.hpp:25
@ OP_OK
Operation succeeded.
Definition: Os.hpp:26