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