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 
8 #include "Fw/Types/Assert.hpp"
10 #if FW_ENABLE_TEXT_LOGGING
11 #include "Fw/Types/String.hpp"
12 #endif
13 
14 namespace Svc {
15 
16  namespace {
17  enum MsgTypeEnum {
18  COMMANDDISPATCHER_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT,
19  COMPCMDSTAT_CMDRESPONSE,
20  PINGIN_PING,
21  SEQCMDBUFF_COM,
22  CMD_CMD_NO_OP,
23  CMD_CMD_NO_OP_STRING,
24  CMD_CMD_TEST_CMD_1,
25  CMD_CMD_CLEAR_TRACKING,
26  };
27 
28  // Get the max size by constructing a union of the async input, command, and
29  // internal port serialization sizes
30  union BuffUnion {
33  BYTE seqCmdBuffPortSize[Fw::InputComPort::SERIALIZED_SIZE];
35  };
36 
37  // Define a message buffer class large enough to handle all the
38  // asynchronous inputs to the component
39  class ComponentIpcSerializableBuffer :
41  {
42 
43  public:
44 
45  enum {
46  // 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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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.serialize(
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.serialize(portNum);
1067  FW_ASSERT(
1068  _status == Fw::FW_SERIALIZE_OK,
1069  static_cast<FwAssertArgType>(_status)
1070  );
1071 
1072  // Serialize argument opCode
1073  _status = msg.serialize(opCode);
1074  FW_ASSERT(
1075  _status == Fw::FW_SERIALIZE_OK,
1076  static_cast<FwAssertArgType>(_status)
1077  );
1078 
1079  // Serialize argument cmdSeq
1080  _status = msg.serialize(cmdSeq);
1081  FW_ASSERT(
1082  _status == Fw::FW_SERIALIZE_OK,
1083  static_cast<FwAssertArgType>(_status)
1084  );
1085 
1086  // Serialize argument response
1087  _status = msg.serialize(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  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.serialize(
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.serialize(portNum);
1134  FW_ASSERT(
1135  _status == Fw::FW_SERIALIZE_OK,
1136  static_cast<FwAssertArgType>(_status)
1137  );
1138 
1139  // Serialize argument key
1140  _status = msg.serialize(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  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.serialize(
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.serialize(portNum);
1189  FW_ASSERT(
1190  _status == Fw::FW_SERIALIZE_OK,
1191  static_cast<FwAssertArgType>(_status)
1192  );
1193 
1194  // Serialize argument data
1195  _status = msg.serialize(data);
1196  FW_ASSERT(
1197  _status == Fw::FW_SERIALIZE_OK,
1198  static_cast<FwAssertArgType>(_status)
1199  );
1200 
1201  // Serialize argument context
1202  _status = msg.serialize(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  portNum < this->getNum_compCmdSend_OutputPorts(),
1270  static_cast<FwAssertArgType>(portNum)
1271  );
1272  this->m_compCmdSend_OutputPort[portNum].invoke(
1273  opCode,
1274  cmdSeq,
1275  args
1276  );
1277  }
1278 
1281  FwIndexType portNum,
1282  U32 key
1283  )
1284  {
1285  FW_ASSERT(
1286  portNum < this->getNum_pingOut_OutputPorts(),
1287  static_cast<FwAssertArgType>(portNum)
1288  );
1289  this->m_pingOut_OutputPort[portNum].invoke(
1290  key
1291  );
1292  }
1293 
1296  FwIndexType portNum,
1297  FwOpcodeType opCode,
1298  U32 cmdSeq,
1299  const Fw::CmdResponse& response
1300  )
1301  {
1302  FW_ASSERT(
1303  portNum < this->getNum_seqCmdStatus_OutputPorts(),
1304  static_cast<FwAssertArgType>(portNum)
1305  );
1306  this->m_seqCmdStatus_OutputPort[portNum].invoke(
1307  opCode,
1308  cmdSeq,
1309  response
1310  );
1311  }
1312 
1313  // ----------------------------------------------------------------------
1314  // Command response
1315  // ----------------------------------------------------------------------
1316 
1319  FwOpcodeType opCode,
1320  U32 cmdSeq,
1321  Fw::CmdResponse response
1322  )
1323  {
1324  FW_ASSERT(this->m_CmdStatus_OutputPort[0].isConnected());
1325  this->m_CmdStatus_OutputPort[0].invoke(opCode, cmdSeq, response);
1326  }
1327 
1328  // ----------------------------------------------------------------------
1329  // Command handler base-class functions
1330  //
1331  // Call these functions directly to bypass the command input port
1332  // ----------------------------------------------------------------------
1333 
1336  FwOpcodeType opCode,
1337  U32 cmdSeq,
1338  Fw::CmdArgBuffer& args
1339  )
1340  {
1341  // Call pre-message hook
1342  this->CMD_NO_OP_preMsgHook(opCode,cmdSeq);
1343 
1344  // Defer deserializing arguments to the message dispatcher
1345  // to avoid deserializing and reserializing just for IPC
1346  ComponentIpcSerializableBuffer msg;
1348 
1349  // Serialize for IPC
1350  _status = msg.serialize(static_cast<FwEnumStoreType>(CMD_CMD_NO_OP));
1351  FW_ASSERT (
1352  _status == Fw::FW_SERIALIZE_OK,
1353  static_cast<FwAssertArgType>(_status)
1354  );
1355 
1356  // Fake port number to make message dequeue work
1357  FwIndexType port = 0;
1358 
1359  _status = msg.serialize(port);
1360  FW_ASSERT (
1361  _status == Fw::FW_SERIALIZE_OK,
1362  static_cast<FwAssertArgType>(_status)
1363  );
1364 
1365  _status = msg.serialize(opCode);
1366  FW_ASSERT (
1367  _status == Fw::FW_SERIALIZE_OK,
1368  static_cast<FwAssertArgType>(_status)
1369  );
1370 
1371  _status = msg.serialize(cmdSeq);
1372  FW_ASSERT (
1373  _status == Fw::FW_SERIALIZE_OK,
1374  static_cast<FwAssertArgType>(_status)
1375  );
1376 
1377  _status = msg.serialize(args);
1378  FW_ASSERT (
1379  _status == Fw::FW_SERIALIZE_OK,
1380  static_cast<FwAssertArgType>(_status)
1381  );
1382 
1383  // Send message
1385  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1386 
1387  FW_ASSERT(
1388  qStatus == Os::Queue::OP_OK,
1389  static_cast<FwAssertArgType>(qStatus)
1390  );
1391  }
1392 
1395  FwOpcodeType opCode,
1396  U32 cmdSeq,
1397  Fw::CmdArgBuffer& args
1398  )
1399  {
1400  // Call pre-message hook
1401  this->CMD_NO_OP_STRING_preMsgHook(opCode,cmdSeq);
1402 
1403  // Defer deserializing arguments to the message dispatcher
1404  // to avoid deserializing and reserializing just for IPC
1405  ComponentIpcSerializableBuffer msg;
1407 
1408  // Serialize for IPC
1409  _status = msg.serialize(static_cast<FwEnumStoreType>(CMD_CMD_NO_OP_STRING));
1410  FW_ASSERT (
1411  _status == Fw::FW_SERIALIZE_OK,
1412  static_cast<FwAssertArgType>(_status)
1413  );
1414 
1415  // Fake port number to make message dequeue work
1416  FwIndexType port = 0;
1417 
1418  _status = msg.serialize(port);
1419  FW_ASSERT (
1420  _status == Fw::FW_SERIALIZE_OK,
1421  static_cast<FwAssertArgType>(_status)
1422  );
1423 
1424  _status = msg.serialize(opCode);
1425  FW_ASSERT (
1426  _status == Fw::FW_SERIALIZE_OK,
1427  static_cast<FwAssertArgType>(_status)
1428  );
1429 
1430  _status = msg.serialize(cmdSeq);
1431  FW_ASSERT (
1432  _status == Fw::FW_SERIALIZE_OK,
1433  static_cast<FwAssertArgType>(_status)
1434  );
1435 
1436  _status = msg.serialize(args);
1437  FW_ASSERT (
1438  _status == Fw::FW_SERIALIZE_OK,
1439  static_cast<FwAssertArgType>(_status)
1440  );
1441 
1442  // Send message
1444  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1445 
1446  FW_ASSERT(
1447  qStatus == Os::Queue::OP_OK,
1448  static_cast<FwAssertArgType>(qStatus)
1449  );
1450  }
1451 
1454  FwOpcodeType opCode,
1455  U32 cmdSeq,
1456  Fw::CmdArgBuffer& args
1457  )
1458  {
1459  // Call pre-message hook
1460  this->CMD_TEST_CMD_1_preMsgHook(opCode,cmdSeq);
1461 
1462  // Defer deserializing arguments to the message dispatcher
1463  // to avoid deserializing and reserializing just for IPC
1464  ComponentIpcSerializableBuffer msg;
1466 
1467  // Serialize for IPC
1468  _status = msg.serialize(static_cast<FwEnumStoreType>(CMD_CMD_TEST_CMD_1));
1469  FW_ASSERT (
1470  _status == Fw::FW_SERIALIZE_OK,
1471  static_cast<FwAssertArgType>(_status)
1472  );
1473 
1474  // Fake port number to make message dequeue work
1475  FwIndexType port = 0;
1476 
1477  _status = msg.serialize(port);
1478  FW_ASSERT (
1479  _status == Fw::FW_SERIALIZE_OK,
1480  static_cast<FwAssertArgType>(_status)
1481  );
1482 
1483  _status = msg.serialize(opCode);
1484  FW_ASSERT (
1485  _status == Fw::FW_SERIALIZE_OK,
1486  static_cast<FwAssertArgType>(_status)
1487  );
1488 
1489  _status = msg.serialize(cmdSeq);
1490  FW_ASSERT (
1491  _status == Fw::FW_SERIALIZE_OK,
1492  static_cast<FwAssertArgType>(_status)
1493  );
1494 
1495  _status = msg.serialize(args);
1496  FW_ASSERT (
1497  _status == Fw::FW_SERIALIZE_OK,
1498  static_cast<FwAssertArgType>(_status)
1499  );
1500 
1501  // Send message
1503  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1504 
1505  FW_ASSERT(
1506  qStatus == Os::Queue::OP_OK,
1507  static_cast<FwAssertArgType>(qStatus)
1508  );
1509  }
1510 
1513  FwOpcodeType opCode,
1514  U32 cmdSeq,
1515  Fw::CmdArgBuffer& args
1516  )
1517  {
1518  // Call pre-message hook
1519  this->CMD_CLEAR_TRACKING_preMsgHook(opCode,cmdSeq);
1520 
1521  // Defer deserializing arguments to the message dispatcher
1522  // to avoid deserializing and reserializing just for IPC
1523  ComponentIpcSerializableBuffer msg;
1525 
1526  // Serialize for IPC
1527  _status = msg.serialize(static_cast<FwEnumStoreType>(CMD_CMD_CLEAR_TRACKING));
1528  FW_ASSERT (
1529  _status == Fw::FW_SERIALIZE_OK,
1530  static_cast<FwAssertArgType>(_status)
1531  );
1532 
1533  // Fake port number to make message dequeue work
1534  FwIndexType port = 0;
1535 
1536  _status = msg.serialize(port);
1537  FW_ASSERT (
1538  _status == Fw::FW_SERIALIZE_OK,
1539  static_cast<FwAssertArgType>(_status)
1540  );
1541 
1542  _status = msg.serialize(opCode);
1543  FW_ASSERT (
1544  _status == Fw::FW_SERIALIZE_OK,
1545  static_cast<FwAssertArgType>(_status)
1546  );
1547 
1548  _status = msg.serialize(cmdSeq);
1549  FW_ASSERT (
1550  _status == Fw::FW_SERIALIZE_OK,
1551  static_cast<FwAssertArgType>(_status)
1552  );
1553 
1554  _status = msg.serialize(args);
1555  FW_ASSERT (
1556  _status == Fw::FW_SERIALIZE_OK,
1557  static_cast<FwAssertArgType>(_status)
1558  );
1559 
1560  // Send message
1562  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1563 
1564  FW_ASSERT(
1565  qStatus == Os::Queue::OP_OK,
1566  static_cast<FwAssertArgType>(qStatus)
1567  );
1568  }
1569 
1570  // ----------------------------------------------------------------------
1571  // Pre-message hooks for async commands
1572  //
1573  // Each of these functions is invoked just before processing the
1574  // corresponding command. By default they do nothing. You can
1575  // override them to provide specific pre-command behavior.
1576  // ----------------------------------------------------------------------
1577 
1580  FwOpcodeType opCode,
1581  U32 cmdSeq
1582  )
1583  {
1584  // Defaults to no-op; can be overridden
1585  (void) opCode;
1586  (void) cmdSeq;
1587  }
1588 
1591  FwOpcodeType opCode,
1592  U32 cmdSeq
1593  )
1594  {
1595  // Defaults to no-op; can be overridden
1596  (void) opCode;
1597  (void) cmdSeq;
1598  }
1599 
1602  FwOpcodeType opCode,
1603  U32 cmdSeq
1604  )
1605  {
1606  // Defaults to no-op; can be overridden
1607  (void) opCode;
1608  (void) cmdSeq;
1609  }
1610 
1613  FwOpcodeType opCode,
1614  U32 cmdSeq
1615  )
1616  {
1617  // Defaults to no-op; can be overridden
1618  (void) opCode;
1619  (void) cmdSeq;
1620  }
1621 
1622  // ----------------------------------------------------------------------
1623  // Event logging functions
1624  // ----------------------------------------------------------------------
1625 
1628  U32 Opcode,
1629  I32 port,
1630  I32 slot
1631  ) const
1632  {
1633  // Get the time
1634  Fw::Time _logTime;
1635  if (this->m_Time_OutputPort[0].isConnected()) {
1636  this->m_Time_OutputPort[0].invoke(_logTime);
1637  }
1638 
1639  FwEventIdType _id = static_cast<FwEventIdType>(0);
1640 
1641  _id = this->getIdBase() + EVENTID_OPCODEREGISTERED;
1642 
1643  // Emit the event on the log port
1644  if (this->m_Log_OutputPort[0].isConnected()) {
1645  Fw::LogBuffer _logBuff;
1647 
1648 #if FW_AMPCS_COMPATIBLE
1649  // Serialize the number of arguments
1650  _status = _logBuff.serialize(static_cast<U8>(3));
1651  FW_ASSERT(
1652  _status == Fw::FW_SERIALIZE_OK,
1653  static_cast<FwAssertArgType>(_status)
1654  );
1655 #endif
1656 
1657 #if FW_AMPCS_COMPATIBLE
1658  // Serialize the argument size
1659  _status = _logBuff.serialize(
1660  static_cast<U8>(sizeof(U32))
1661  );
1662  FW_ASSERT(
1663  _status == Fw::FW_SERIALIZE_OK,
1664  static_cast<FwAssertArgType>(_status)
1665  );
1666 #endif
1667  _status = _logBuff.serialize(Opcode);
1668  FW_ASSERT(
1669  _status == Fw::FW_SERIALIZE_OK,
1670  static_cast<FwAssertArgType>(_status)
1671  );
1672 
1673 #if FW_AMPCS_COMPATIBLE
1674  // Serialize the argument size
1675  _status = _logBuff.serialize(
1676  static_cast<U8>(sizeof(I32))
1677  );
1678  FW_ASSERT(
1679  _status == Fw::FW_SERIALIZE_OK,
1680  static_cast<FwAssertArgType>(_status)
1681  );
1682 #endif
1683  _status = _logBuff.serialize(port);
1684  FW_ASSERT(
1685  _status == Fw::FW_SERIALIZE_OK,
1686  static_cast<FwAssertArgType>(_status)
1687  );
1688 
1689 #if FW_AMPCS_COMPATIBLE
1690  // Serialize the argument size
1691  _status = _logBuff.serialize(
1692  static_cast<U8>(sizeof(I32))
1693  );
1694  FW_ASSERT(
1695  _status == Fw::FW_SERIALIZE_OK,
1696  static_cast<FwAssertArgType>(_status)
1697  );
1698 #endif
1699  _status = _logBuff.serialize(slot);
1700  FW_ASSERT(
1701  _status == Fw::FW_SERIALIZE_OK,
1702  static_cast<FwAssertArgType>(_status)
1703  );
1704 
1705  this->m_Log_OutputPort[0].invoke(
1706  _id,
1707  _logTime,
1709  _logBuff
1710  );
1711  }
1712 
1713  // Emit the event on the text log port
1714 #if FW_ENABLE_TEXT_LOGGING
1715  if (this->m_LogText_OutputPort[0].isConnected()) {
1716 #if FW_OBJECT_NAMES == 1
1717  const char* _formatString =
1718  "(%s) %s: Opcode 0x%" PRIx32 " registered to port %" PRIi32 " slot %" PRIi32 "";
1719 #else
1720  const char* _formatString =
1721  "%s: Opcode 0x%" PRIx32 " registered to port %" PRIi32 " slot %" PRIi32 "";
1722 #endif
1723 
1724  Fw::TextLogString _logString;
1725  _logString.format(
1726  _formatString,
1727 #if FW_OBJECT_NAMES == 1
1728  this->m_objName.toChar(),
1729 #endif
1730  "OpCodeRegistered ",
1731  Opcode,
1732  port,
1733  slot
1734  );
1735 
1736  this->m_LogText_OutputPort[0].invoke(
1737  _id,
1738  _logTime,
1740  _logString
1741  );
1742  }
1743 #endif
1744  }
1745 
1748  U32 Opcode,
1749  I32 port
1750  ) const
1751  {
1752  // Get the time
1753  Fw::Time _logTime;
1754  if (this->m_Time_OutputPort[0].isConnected()) {
1755  this->m_Time_OutputPort[0].invoke(_logTime);
1756  }
1757 
1758  FwEventIdType _id = static_cast<FwEventIdType>(0);
1759 
1760  _id = this->getIdBase() + EVENTID_OPCODEDISPATCHED;
1761 
1762  // Emit the event on the log port
1763  if (this->m_Log_OutputPort[0].isConnected()) {
1764  Fw::LogBuffer _logBuff;
1766 
1767 #if FW_AMPCS_COMPATIBLE
1768  // Serialize the number of arguments
1769  _status = _logBuff.serialize(static_cast<U8>(2));
1770  FW_ASSERT(
1771  _status == Fw::FW_SERIALIZE_OK,
1772  static_cast<FwAssertArgType>(_status)
1773  );
1774 #endif
1775 
1776 #if FW_AMPCS_COMPATIBLE
1777  // Serialize the argument size
1778  _status = _logBuff.serialize(
1779  static_cast<U8>(sizeof(U32))
1780  );
1781  FW_ASSERT(
1782  _status == Fw::FW_SERIALIZE_OK,
1783  static_cast<FwAssertArgType>(_status)
1784  );
1785 #endif
1786  _status = _logBuff.serialize(Opcode);
1787  FW_ASSERT(
1788  _status == Fw::FW_SERIALIZE_OK,
1789  static_cast<FwAssertArgType>(_status)
1790  );
1791 
1792 #if FW_AMPCS_COMPATIBLE
1793  // Serialize the argument size
1794  _status = _logBuff.serialize(
1795  static_cast<U8>(sizeof(I32))
1796  );
1797  FW_ASSERT(
1798  _status == Fw::FW_SERIALIZE_OK,
1799  static_cast<FwAssertArgType>(_status)
1800  );
1801 #endif
1802  _status = _logBuff.serialize(port);
1803  FW_ASSERT(
1804  _status == Fw::FW_SERIALIZE_OK,
1805  static_cast<FwAssertArgType>(_status)
1806  );
1807 
1808  this->m_Log_OutputPort[0].invoke(
1809  _id,
1810  _logTime,
1812  _logBuff
1813  );
1814  }
1815 
1816  // Emit the event on the text log port
1817 #if FW_ENABLE_TEXT_LOGGING
1818  if (this->m_LogText_OutputPort[0].isConnected()) {
1819 #if FW_OBJECT_NAMES == 1
1820  const char* _formatString =
1821  "(%s) %s: Opcode 0x%" PRIx32 " dispatched to port %" PRIi32 "";
1822 #else
1823  const char* _formatString =
1824  "%s: Opcode 0x%" PRIx32 " dispatched to port %" PRIi32 "";
1825 #endif
1826 
1827  Fw::TextLogString _logString;
1828  _logString.format(
1829  _formatString,
1830 #if FW_OBJECT_NAMES == 1
1831  this->m_objName.toChar(),
1832 #endif
1833  "OpCodeDispatched ",
1834  Opcode,
1835  port
1836  );
1837 
1838  this->m_LogText_OutputPort[0].invoke(
1839  _id,
1840  _logTime,
1842  _logString
1843  );
1844  }
1845 #endif
1846  }
1847 
1850  {
1851  // Get the time
1852  Fw::Time _logTime;
1853  if (this->m_Time_OutputPort[0].isConnected()) {
1854  this->m_Time_OutputPort[0].invoke(_logTime);
1855  }
1856 
1857  FwEventIdType _id = static_cast<FwEventIdType>(0);
1858 
1859  _id = this->getIdBase() + EVENTID_OPCODECOMPLETED;
1860 
1861  // Emit the event on the log port
1862  if (this->m_Log_OutputPort[0].isConnected()) {
1863  Fw::LogBuffer _logBuff;
1865 
1866 #if FW_AMPCS_COMPATIBLE
1867  // Serialize the number of arguments
1868  _status = _logBuff.serialize(static_cast<U8>(1));
1869  FW_ASSERT(
1870  _status == Fw::FW_SERIALIZE_OK,
1871  static_cast<FwAssertArgType>(_status)
1872  );
1873 #endif
1874 
1875 #if FW_AMPCS_COMPATIBLE
1876  // Serialize the argument size
1877  _status = _logBuff.serialize(
1878  static_cast<U8>(sizeof(U32))
1879  );
1880  FW_ASSERT(
1881  _status == Fw::FW_SERIALIZE_OK,
1882  static_cast<FwAssertArgType>(_status)
1883  );
1884 #endif
1885  _status = _logBuff.serialize(Opcode);
1886  FW_ASSERT(
1887  _status == Fw::FW_SERIALIZE_OK,
1888  static_cast<FwAssertArgType>(_status)
1889  );
1890 
1891  this->m_Log_OutputPort[0].invoke(
1892  _id,
1893  _logTime,
1895  _logBuff
1896  );
1897  }
1898 
1899  // Emit the event on the text log port
1900 #if FW_ENABLE_TEXT_LOGGING
1901  if (this->m_LogText_OutputPort[0].isConnected()) {
1902 #if FW_OBJECT_NAMES == 1
1903  const char* _formatString =
1904  "(%s) %s: Opcode 0x%" PRIx32 " completed";
1905 #else
1906  const char* _formatString =
1907  "%s: Opcode 0x%" PRIx32 " completed";
1908 #endif
1909 
1910  Fw::TextLogString _logString;
1911  _logString.format(
1912  _formatString,
1913 #if FW_OBJECT_NAMES == 1
1914  this->m_objName.toChar(),
1915 #endif
1916  "OpCodeCompleted ",
1917  Opcode
1918  );
1919 
1920  this->m_LogText_OutputPort[0].invoke(
1921  _id,
1922  _logTime,
1924  _logString
1925  );
1926  }
1927 #endif
1928  }
1929 
1932  U32 Opcode,
1933  Fw::CmdResponse error
1934  ) const
1935  {
1936  // Get the time
1937  Fw::Time _logTime;
1938  if (this->m_Time_OutputPort[0].isConnected()) {
1939  this->m_Time_OutputPort[0].invoke(_logTime);
1940  }
1941 
1942  FwEventIdType _id = static_cast<FwEventIdType>(0);
1943 
1944  _id = this->getIdBase() + EVENTID_OPCODEERROR;
1945 
1946  // Emit the event on the log port
1947  if (this->m_Log_OutputPort[0].isConnected()) {
1948  Fw::LogBuffer _logBuff;
1950 
1951 #if FW_AMPCS_COMPATIBLE
1952  // Serialize the number of arguments
1953  _status = _logBuff.serialize(static_cast<U8>(2));
1954  FW_ASSERT(
1955  _status == Fw::FW_SERIALIZE_OK,
1956  static_cast<FwAssertArgType>(_status)
1957  );
1958 #endif
1959 
1960 #if FW_AMPCS_COMPATIBLE
1961  // Serialize the argument size
1962  _status = _logBuff.serialize(
1963  static_cast<U8>(sizeof(U32))
1964  );
1965  FW_ASSERT(
1966  _status == Fw::FW_SERIALIZE_OK,
1967  static_cast<FwAssertArgType>(_status)
1968  );
1969 #endif
1970  _status = _logBuff.serialize(Opcode);
1971  FW_ASSERT(
1972  _status == Fw::FW_SERIALIZE_OK,
1973  static_cast<FwAssertArgType>(_status)
1974  );
1975 
1976 #if FW_AMPCS_COMPATIBLE
1977  // Serialize the argument size
1978  _status = _logBuff.serialize(
1979  static_cast<U8>(Fw::CmdResponse::SERIALIZED_SIZE)
1980  );
1981  FW_ASSERT(
1982  _status == Fw::FW_SERIALIZE_OK,
1983  static_cast<FwAssertArgType>(_status)
1984  );
1985 #endif
1986  _status = _logBuff.serialize(error);
1987  FW_ASSERT(
1988  _status == Fw::FW_SERIALIZE_OK,
1989  static_cast<FwAssertArgType>(_status)
1990  );
1991 
1992  this->m_Log_OutputPort[0].invoke(
1993  _id,
1994  _logTime,
1996  _logBuff
1997  );
1998  }
1999 
2000  // Emit the event on the text log port
2001 #if FW_ENABLE_TEXT_LOGGING
2002  if (this->m_LogText_OutputPort[0].isConnected()) {
2003 #if FW_OBJECT_NAMES == 1
2004  const char* _formatString =
2005  "(%s) %s: Opcode 0x%" PRIx32 " completed with error %s";
2006 #else
2007  const char* _formatString =
2008  "%s: Opcode 0x%" PRIx32 " completed with error %s";
2009 #endif
2010 
2011  Fw::String errorStr;
2012  error.toString(errorStr);
2013 
2014  Fw::TextLogString _logString;
2015  _logString.format(
2016  _formatString,
2017 #if FW_OBJECT_NAMES == 1
2018  this->m_objName.toChar(),
2019 #endif
2020  "OpCodeError ",
2021  Opcode,
2022  errorStr.toChar()
2023  );
2024 
2025  this->m_LogText_OutputPort[0].invoke(
2026  _id,
2027  _logTime,
2029  _logString
2030  );
2031  }
2032 #endif
2033  }
2034 
2037  {
2038  // Get the time
2039  Fw::Time _logTime;
2040  if (this->m_Time_OutputPort[0].isConnected()) {
2041  this->m_Time_OutputPort[0].invoke(_logTime);
2042  }
2043 
2044  FwEventIdType _id = static_cast<FwEventIdType>(0);
2045 
2046  _id = this->getIdBase() + EVENTID_MALFORMEDCOMMAND;
2047 
2048  // Emit the event on the log port
2049  if (this->m_Log_OutputPort[0].isConnected()) {
2050  Fw::LogBuffer _logBuff;
2052 
2053 #if FW_AMPCS_COMPATIBLE
2054  // Serialize the number of arguments
2055  _status = _logBuff.serialize(static_cast<U8>(1));
2056  FW_ASSERT(
2057  _status == Fw::FW_SERIALIZE_OK,
2058  static_cast<FwAssertArgType>(_status)
2059  );
2060 #endif
2061 
2062 #if FW_AMPCS_COMPATIBLE
2063  // Serialize the argument size
2064  _status = _logBuff.serialize(
2065  static_cast<U8>(Fw::DeserialStatus::SERIALIZED_SIZE)
2066  );
2067  FW_ASSERT(
2068  _status == Fw::FW_SERIALIZE_OK,
2069  static_cast<FwAssertArgType>(_status)
2070  );
2071 #endif
2072  _status = _logBuff.serialize(Status);
2073  FW_ASSERT(
2074  _status == Fw::FW_SERIALIZE_OK,
2075  static_cast<FwAssertArgType>(_status)
2076  );
2077 
2078  this->m_Log_OutputPort[0].invoke(
2079  _id,
2080  _logTime,
2082  _logBuff
2083  );
2084  }
2085 
2086  // Emit the event on the text log port
2087 #if FW_ENABLE_TEXT_LOGGING
2088  if (this->m_LogText_OutputPort[0].isConnected()) {
2089 #if FW_OBJECT_NAMES == 1
2090  const char* _formatString =
2091  "(%s) %s: Received malformed command packet. Status: %s";
2092 #else
2093  const char* _formatString =
2094  "%s: Received malformed command packet. Status: %s";
2095 #endif
2096 
2097  Fw::String StatusStr;
2098  Status.toString(StatusStr);
2099 
2100  Fw::TextLogString _logString;
2101  _logString.format(
2102  _formatString,
2103 #if FW_OBJECT_NAMES == 1
2104  this->m_objName.toChar(),
2105 #endif
2106  "MalformedCommand ",
2107  StatusStr.toChar()
2108  );
2109 
2110  this->m_LogText_OutputPort[0].invoke(
2111  _id,
2112  _logTime,
2114  _logString
2115  );
2116  }
2117 #endif
2118  }
2119 
2122  {
2123  // Get the time
2124  Fw::Time _logTime;
2125  if (this->m_Time_OutputPort[0].isConnected()) {
2126  this->m_Time_OutputPort[0].invoke(_logTime);
2127  }
2128 
2129  FwEventIdType _id = static_cast<FwEventIdType>(0);
2130 
2131  _id = this->getIdBase() + EVENTID_INVALIDCOMMAND;
2132 
2133  // Emit the event on the log port
2134  if (this->m_Log_OutputPort[0].isConnected()) {
2135  Fw::LogBuffer _logBuff;
2137 
2138 #if FW_AMPCS_COMPATIBLE
2139  // Serialize the number of arguments
2140  _status = _logBuff.serialize(static_cast<U8>(1));
2141  FW_ASSERT(
2142  _status == Fw::FW_SERIALIZE_OK,
2143  static_cast<FwAssertArgType>(_status)
2144  );
2145 #endif
2146 
2147 #if FW_AMPCS_COMPATIBLE
2148  // Serialize the argument size
2149  _status = _logBuff.serialize(
2150  static_cast<U8>(sizeof(U32))
2151  );
2152  FW_ASSERT(
2153  _status == Fw::FW_SERIALIZE_OK,
2154  static_cast<FwAssertArgType>(_status)
2155  );
2156 #endif
2157  _status = _logBuff.serialize(Opcode);
2158  FW_ASSERT(
2159  _status == Fw::FW_SERIALIZE_OK,
2160  static_cast<FwAssertArgType>(_status)
2161  );
2162 
2163  this->m_Log_OutputPort[0].invoke(
2164  _id,
2165  _logTime,
2167  _logBuff
2168  );
2169  }
2170 
2171  // Emit the event on the text log port
2172 #if FW_ENABLE_TEXT_LOGGING
2173  if (this->m_LogText_OutputPort[0].isConnected()) {
2174 #if FW_OBJECT_NAMES == 1
2175  const char* _formatString =
2176  "(%s) %s: Invalid opcode 0x%" PRIx32 " received";
2177 #else
2178  const char* _formatString =
2179  "%s: Invalid opcode 0x%" PRIx32 " received";
2180 #endif
2181 
2182  Fw::TextLogString _logString;
2183  _logString.format(
2184  _formatString,
2185 #if FW_OBJECT_NAMES == 1
2186  this->m_objName.toChar(),
2187 #endif
2188  "InvalidCommand ",
2189  Opcode
2190  );
2191 
2192  this->m_LogText_OutputPort[0].invoke(
2193  _id,
2194  _logTime,
2196  _logString
2197  );
2198  }
2199 #endif
2200  }
2201 
2204  {
2205  // Get the time
2206  Fw::Time _logTime;
2207  if (this->m_Time_OutputPort[0].isConnected()) {
2208  this->m_Time_OutputPort[0].invoke(_logTime);
2209  }
2210 
2211  FwEventIdType _id = static_cast<FwEventIdType>(0);
2212 
2213  _id = this->getIdBase() + EVENTID_TOOMANYCOMMANDS;
2214 
2215  // Emit the event on the log port
2216  if (this->m_Log_OutputPort[0].isConnected()) {
2217  Fw::LogBuffer _logBuff;
2219 
2220 #if FW_AMPCS_COMPATIBLE
2221  // Serialize the number of arguments
2222  _status = _logBuff.serialize(static_cast<U8>(1));
2223  FW_ASSERT(
2224  _status == Fw::FW_SERIALIZE_OK,
2225  static_cast<FwAssertArgType>(_status)
2226  );
2227 #endif
2228 
2229 #if FW_AMPCS_COMPATIBLE
2230  // Serialize the argument size
2231  _status = _logBuff.serialize(
2232  static_cast<U8>(sizeof(U32))
2233  );
2234  FW_ASSERT(
2235  _status == Fw::FW_SERIALIZE_OK,
2236  static_cast<FwAssertArgType>(_status)
2237  );
2238 #endif
2239  _status = _logBuff.serialize(Opcode);
2240  FW_ASSERT(
2241  _status == Fw::FW_SERIALIZE_OK,
2242  static_cast<FwAssertArgType>(_status)
2243  );
2244 
2245  this->m_Log_OutputPort[0].invoke(
2246  _id,
2247  _logTime,
2249  _logBuff
2250  );
2251  }
2252 
2253  // Emit the event on the text log port
2254 #if FW_ENABLE_TEXT_LOGGING
2255  if (this->m_LogText_OutputPort[0].isConnected()) {
2256 #if FW_OBJECT_NAMES == 1
2257  const char* _formatString =
2258  "(%s) %s: Too many outstanding commands. opcode=0x%" PRIx32 "";
2259 #else
2260  const char* _formatString =
2261  "%s: Too many outstanding commands. opcode=0x%" PRIx32 "";
2262 #endif
2263 
2264  Fw::TextLogString _logString;
2265  _logString.format(
2266  _formatString,
2267 #if FW_OBJECT_NAMES == 1
2268  this->m_objName.toChar(),
2269 #endif
2270  "TooManyCommands ",
2271  Opcode
2272  );
2273 
2274  this->m_LogText_OutputPort[0].invoke(
2275  _id,
2276  _logTime,
2278  _logString
2279  );
2280  }
2281 #endif
2282  }
2283 
2286  {
2287  // Get the time
2288  Fw::Time _logTime;
2289  if (this->m_Time_OutputPort[0].isConnected()) {
2290  this->m_Time_OutputPort[0].invoke(_logTime);
2291  }
2292 
2293  FwEventIdType _id = static_cast<FwEventIdType>(0);
2294 
2295  _id = this->getIdBase() + EVENTID_NOOPRECEIVED;
2296 
2297  // Emit the event on the log port
2298  if (this->m_Log_OutputPort[0].isConnected()) {
2299  Fw::LogBuffer _logBuff;
2300 
2301 #if FW_AMPCS_COMPATIBLE
2303  // Serialize the number of arguments
2304  _status = _logBuff.serialize(static_cast<U8>(0));
2305  FW_ASSERT(
2306  _status == Fw::FW_SERIALIZE_OK,
2307  static_cast<FwAssertArgType>(_status)
2308  );
2309 #endif
2310 
2311  this->m_Log_OutputPort[0].invoke(
2312  _id,
2313  _logTime,
2315  _logBuff
2316  );
2317  }
2318 
2319  // Emit the event on the text log port
2320 #if FW_ENABLE_TEXT_LOGGING
2321  if (this->m_LogText_OutputPort[0].isConnected()) {
2322 #if FW_OBJECT_NAMES == 1
2323  const char* _formatString =
2324  "(%s) %s: Received a NO-OP command";
2325 #else
2326  const char* _formatString =
2327  "%s: Received a NO-OP command";
2328 #endif
2329 
2330  Fw::TextLogString _logString;
2331  _logString.format(
2332  _formatString,
2333 #if FW_OBJECT_NAMES == 1
2334  this->m_objName.toChar(),
2335 #endif
2336  "NoOpReceived "
2337  );
2338 
2339  this->m_LogText_OutputPort[0].invoke(
2340  _id,
2341  _logTime,
2343  _logString
2344  );
2345  }
2346 #endif
2347  }
2348 
2351  {
2352  // Get the time
2353  Fw::Time _logTime;
2354  if (this->m_Time_OutputPort[0].isConnected()) {
2355  this->m_Time_OutputPort[0].invoke(_logTime);
2356  }
2357 
2358  FwEventIdType _id = static_cast<FwEventIdType>(0);
2359 
2360  _id = this->getIdBase() + EVENTID_NOOPSTRINGRECEIVED;
2361 
2362  // Emit the event on the log port
2363  if (this->m_Log_OutputPort[0].isConnected()) {
2364  Fw::LogBuffer _logBuff;
2366 
2367 #if FW_AMPCS_COMPATIBLE
2368  // Serialize the number of arguments
2369  _status = _logBuff.serialize(static_cast<U8>(1));
2370  FW_ASSERT(
2371  _status == Fw::FW_SERIALIZE_OK,
2372  static_cast<FwAssertArgType>(_status)
2373  );
2374 #endif
2375 
2376  _status = message.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
2377  FW_ASSERT(
2378  _status == Fw::FW_SERIALIZE_OK,
2379  static_cast<FwAssertArgType>(_status)
2380  );
2381 
2382  this->m_Log_OutputPort[0].invoke(
2383  _id,
2384  _logTime,
2386  _logBuff
2387  );
2388  }
2389 
2390  // Emit the event on the text log port
2391 #if FW_ENABLE_TEXT_LOGGING
2392  if (this->m_LogText_OutputPort[0].isConnected()) {
2393 #if FW_OBJECT_NAMES == 1
2394  const char* _formatString =
2395  "(%s) %s: Received a NO-OP string=%s";
2396 #else
2397  const char* _formatString =
2398  "%s: Received a NO-OP string=%s";
2399 #endif
2400 
2401  Fw::TextLogString _logString;
2402  _logString.format(
2403  _formatString,
2404 #if FW_OBJECT_NAMES == 1
2405  this->m_objName.toChar(),
2406 #endif
2407  "NoOpStringReceived ",
2408  message.toChar()
2409  );
2410 
2411  this->m_LogText_OutputPort[0].invoke(
2412  _id,
2413  _logTime,
2415  _logString
2416  );
2417  }
2418 #endif
2419  }
2420 
2423  I32 arg1,
2424  F32 arg2,
2425  U8 arg3
2426  ) const
2427  {
2428  // Get the time
2429  Fw::Time _logTime;
2430  if (this->m_Time_OutputPort[0].isConnected()) {
2431  this->m_Time_OutputPort[0].invoke(_logTime);
2432  }
2433 
2434  FwEventIdType _id = static_cast<FwEventIdType>(0);
2435 
2436  _id = this->getIdBase() + EVENTID_TESTCMD1ARGS;
2437 
2438  // Emit the event on the log port
2439  if (this->m_Log_OutputPort[0].isConnected()) {
2440  Fw::LogBuffer _logBuff;
2442 
2443 #if FW_AMPCS_COMPATIBLE
2444  // Serialize the number of arguments
2445  _status = _logBuff.serialize(static_cast<U8>(3));
2446  FW_ASSERT(
2447  _status == Fw::FW_SERIALIZE_OK,
2448  static_cast<FwAssertArgType>(_status)
2449  );
2450 #endif
2451 
2452 #if FW_AMPCS_COMPATIBLE
2453  // Serialize the argument size
2454  _status = _logBuff.serialize(
2455  static_cast<U8>(sizeof(I32))
2456  );
2457  FW_ASSERT(
2458  _status == Fw::FW_SERIALIZE_OK,
2459  static_cast<FwAssertArgType>(_status)
2460  );
2461 #endif
2462  _status = _logBuff.serialize(arg1);
2463  FW_ASSERT(
2464  _status == Fw::FW_SERIALIZE_OK,
2465  static_cast<FwAssertArgType>(_status)
2466  );
2467 
2468 #if FW_AMPCS_COMPATIBLE
2469  // Serialize the argument size
2470  _status = _logBuff.serialize(
2471  static_cast<U8>(sizeof(F32))
2472  );
2473  FW_ASSERT(
2474  _status == Fw::FW_SERIALIZE_OK,
2475  static_cast<FwAssertArgType>(_status)
2476  );
2477 #endif
2478  _status = _logBuff.serialize(arg2);
2479  FW_ASSERT(
2480  _status == Fw::FW_SERIALIZE_OK,
2481  static_cast<FwAssertArgType>(_status)
2482  );
2483 
2484 #if FW_AMPCS_COMPATIBLE
2485  // Serialize the argument size
2486  _status = _logBuff.serialize(
2487  static_cast<U8>(sizeof(U8))
2488  );
2489  FW_ASSERT(
2490  _status == Fw::FW_SERIALIZE_OK,
2491  static_cast<FwAssertArgType>(_status)
2492  );
2493 #endif
2494  _status = _logBuff.serialize(arg3);
2495  FW_ASSERT(
2496  _status == Fw::FW_SERIALIZE_OK,
2497  static_cast<FwAssertArgType>(_status)
2498  );
2499 
2500  this->m_Log_OutputPort[0].invoke(
2501  _id,
2502  _logTime,
2504  _logBuff
2505  );
2506  }
2507 
2508  // Emit the event on the text log port
2509 #if FW_ENABLE_TEXT_LOGGING
2510  if (this->m_LogText_OutputPort[0].isConnected()) {
2511 #if FW_OBJECT_NAMES == 1
2512  const char* _formatString =
2513  "(%s) %s: TEST_CMD_1 args: I32: %" PRIi32 ", F32: %f, U8: %" PRIu8 "";
2514 #else
2515  const char* _formatString =
2516  "%s: TEST_CMD_1 args: I32: %" PRIi32 ", F32: %f, U8: %" PRIu8 "";
2517 #endif
2518 
2519  Fw::TextLogString _logString;
2520  _logString.format(
2521  _formatString,
2522 #if FW_OBJECT_NAMES == 1
2523  this->m_objName.toChar(),
2524 #endif
2525  "TestCmd1Args ",
2526  arg1,
2527  arg2,
2528  arg3
2529  );
2530 
2531  this->m_LogText_OutputPort[0].invoke(
2532  _id,
2533  _logTime,
2535  _logString
2536  );
2537  }
2538 #endif
2539  }
2540 
2543  U32 Opcode,
2544  I32 port
2545  ) const
2546  {
2547  // Get the time
2548  Fw::Time _logTime;
2549  if (this->m_Time_OutputPort[0].isConnected()) {
2550  this->m_Time_OutputPort[0].invoke(_logTime);
2551  }
2552 
2553  FwEventIdType _id = static_cast<FwEventIdType>(0);
2554 
2555  _id = this->getIdBase() + EVENTID_OPCODEREREGISTERED;
2556 
2557  // Emit the event on the log port
2558  if (this->m_Log_OutputPort[0].isConnected()) {
2559  Fw::LogBuffer _logBuff;
2561 
2562 #if FW_AMPCS_COMPATIBLE
2563  // Serialize the number of arguments
2564  _status = _logBuff.serialize(static_cast<U8>(2));
2565  FW_ASSERT(
2566  _status == Fw::FW_SERIALIZE_OK,
2567  static_cast<FwAssertArgType>(_status)
2568  );
2569 #endif
2570 
2571 #if FW_AMPCS_COMPATIBLE
2572  // Serialize the argument size
2573  _status = _logBuff.serialize(
2574  static_cast<U8>(sizeof(U32))
2575  );
2576  FW_ASSERT(
2577  _status == Fw::FW_SERIALIZE_OK,
2578  static_cast<FwAssertArgType>(_status)
2579  );
2580 #endif
2581  _status = _logBuff.serialize(Opcode);
2582  FW_ASSERT(
2583  _status == Fw::FW_SERIALIZE_OK,
2584  static_cast<FwAssertArgType>(_status)
2585  );
2586 
2587 #if FW_AMPCS_COMPATIBLE
2588  // Serialize the argument size
2589  _status = _logBuff.serialize(
2590  static_cast<U8>(sizeof(I32))
2591  );
2592  FW_ASSERT(
2593  _status == Fw::FW_SERIALIZE_OK,
2594  static_cast<FwAssertArgType>(_status)
2595  );
2596 #endif
2597  _status = _logBuff.serialize(port);
2598  FW_ASSERT(
2599  _status == Fw::FW_SERIALIZE_OK,
2600  static_cast<FwAssertArgType>(_status)
2601  );
2602 
2603  this->m_Log_OutputPort[0].invoke(
2604  _id,
2605  _logTime,
2607  _logBuff
2608  );
2609  }
2610 
2611  // Emit the event on the text log port
2612 #if FW_ENABLE_TEXT_LOGGING
2613  if (this->m_LogText_OutputPort[0].isConnected()) {
2614 #if FW_OBJECT_NAMES == 1
2615  const char* _formatString =
2616  "(%s) %s: Opcode 0x%" PRIx32 " is already registered to port %" PRIi32 "";
2617 #else
2618  const char* _formatString =
2619  "%s: Opcode 0x%" PRIx32 " is already registered to port %" PRIi32 "";
2620 #endif
2621 
2622  Fw::TextLogString _logString;
2623  _logString.format(
2624  _formatString,
2625 #if FW_OBJECT_NAMES == 1
2626  this->m_objName.toChar(),
2627 #endif
2628  "OpCodeReregistered ",
2629  Opcode,
2630  port
2631  );
2632 
2633  this->m_LogText_OutputPort[0].invoke(
2634  _id,
2635  _logTime,
2637  _logString
2638  );
2639  }
2640 #endif
2641  }
2642 
2643  // ----------------------------------------------------------------------
2644  // Telemetry write functions
2645  // ----------------------------------------------------------------------
2646 
2649  U32 arg,
2650  Fw::Time _tlmTime
2651  )
2652  {
2653  // Check to see if it is the first time
2654  if (not this->m_first_update_CommandsDispatched) {
2655  // Check to see if value has changed. If not, don't write it.
2656  if (arg == this->m_last_CommandsDispatched) {
2657  return;
2658  }
2659  else {
2660  this->m_last_CommandsDispatched = arg;
2661  }
2662  }
2663  else {
2664  this->m_first_update_CommandsDispatched = false;
2665  this->m_last_CommandsDispatched = arg;
2666  }
2667 
2668  if (this->m_Tlm_OutputPort[0].isConnected()) {
2669  if (
2670  this->m_Time_OutputPort[0].isConnected() &&
2671  (_tlmTime == Fw::ZERO_TIME)
2672  ) {
2673  this->m_Time_OutputPort[0].invoke(_tlmTime);
2674  }
2675 
2676  Fw::TlmBuffer _tlmBuff;
2677  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
2678  FW_ASSERT(
2679  _stat == Fw::FW_SERIALIZE_OK,
2680  static_cast<FwAssertArgType>(_stat)
2681  );
2682 
2683  FwChanIdType _id;
2684 
2685  _id = this->getIdBase() + CHANNELID_COMMANDSDISPATCHED;
2686 
2687  this->m_Tlm_OutputPort[0].invoke(
2688  _id,
2689  _tlmTime,
2690  _tlmBuff
2691  );
2692  }
2693  }
2694 
2697  U32 arg,
2698  Fw::Time _tlmTime
2699  )
2700  {
2701  // Check to see if it is the first time
2702  if (not this->m_first_update_CommandErrors) {
2703  // Check to see if value has changed. If not, don't write it.
2704  if (arg == this->m_last_CommandErrors) {
2705  return;
2706  }
2707  else {
2708  this->m_last_CommandErrors = arg;
2709  }
2710  }
2711  else {
2712  this->m_first_update_CommandErrors = false;
2713  this->m_last_CommandErrors = arg;
2714  }
2715 
2716  if (this->m_Tlm_OutputPort[0].isConnected()) {
2717  if (
2718  this->m_Time_OutputPort[0].isConnected() &&
2719  (_tlmTime == Fw::ZERO_TIME)
2720  ) {
2721  this->m_Time_OutputPort[0].invoke(_tlmTime);
2722  }
2723 
2724  Fw::TlmBuffer _tlmBuff;
2725  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
2726  FW_ASSERT(
2727  _stat == Fw::FW_SERIALIZE_OK,
2728  static_cast<FwAssertArgType>(_stat)
2729  );
2730 
2731  FwChanIdType _id;
2732 
2733  _id = this->getIdBase() + CHANNELID_COMMANDERRORS;
2734 
2735  this->m_Tlm_OutputPort[0].invoke(
2736  _id,
2737  _tlmTime,
2738  _tlmBuff
2739  );
2740  }
2741  }
2742 
2743  // ----------------------------------------------------------------------
2744  // Time
2745  // ----------------------------------------------------------------------
2746 
2749  {
2750  if (this->m_Time_OutputPort[0].isConnected()) {
2751  Fw::Time _time;
2752  this->m_Time_OutputPort[0].invoke(_time);
2753  return _time;
2754  }
2755  else {
2756  return Fw::Time(TB_NONE, 0, 0);
2757  }
2758  }
2759 
2760  // ----------------------------------------------------------------------
2761  // Mutex operations for guarded ports
2762  //
2763  // You can override these operations to provide more sophisticated
2764  // synchronization
2765  // ----------------------------------------------------------------------
2766 
2769  {
2770  this->m_guardedPortMutex.lock();
2771  }
2772 
2775  {
2776  this->m_guardedPortMutex.unLock();
2777  }
2778 
2779  // ----------------------------------------------------------------------
2780  // Message dispatch functions
2781  // ----------------------------------------------------------------------
2782 
2783  Fw::QueuedComponentBase::MsgDispatchStatus CommandDispatcherComponentBase ::
2784  doDispatch()
2785  {
2786  ComponentIpcSerializableBuffer msg;
2787  FwQueuePriorityType priority = 0;
2788 
2789  Os::Queue::Status msgStatus = this->m_queue.receive(
2790  msg,
2792  priority
2793  );
2794  FW_ASSERT(
2795  msgStatus == Os::Queue::OP_OK,
2796  static_cast<FwAssertArgType>(msgStatus)
2797  );
2798 
2799  // Reset to beginning of buffer
2800  msg.resetDeser();
2801 
2802  FwEnumStoreType desMsg = 0;
2803  Fw::SerializeStatus deserStatus = msg.deserialize(desMsg);
2804  FW_ASSERT(
2805  deserStatus == Fw::FW_SERIALIZE_OK,
2806  static_cast<FwAssertArgType>(deserStatus)
2807  );
2808 
2809  MsgTypeEnum msgType = static_cast<MsgTypeEnum>(desMsg);
2810 
2811  if (msgType == COMMANDDISPATCHER_COMPONENT_EXIT) {
2812  return MSG_DISPATCH_EXIT;
2813  }
2814 
2815  FwIndexType portNum = 0;
2816  deserStatus = msg.deserialize(portNum);
2817  FW_ASSERT(
2818  deserStatus == Fw::FW_SERIALIZE_OK,
2819  static_cast<FwAssertArgType>(deserStatus)
2820  );
2821 
2822  switch (msgType) {
2823  // Handle async input port compCmdStat
2824  case COMPCMDSTAT_CMDRESPONSE: {
2825  // Deserialize argument opCode
2826  FwOpcodeType opCode;
2827  deserStatus = msg.deserialize(opCode);
2828  FW_ASSERT(
2829  deserStatus == Fw::FW_SERIALIZE_OK,
2830  static_cast<FwAssertArgType>(deserStatus)
2831  );
2832 
2833  // Deserialize argument cmdSeq
2834  U32 cmdSeq;
2835  deserStatus = msg.deserialize(cmdSeq);
2836  FW_ASSERT(
2837  deserStatus == Fw::FW_SERIALIZE_OK,
2838  static_cast<FwAssertArgType>(deserStatus)
2839  );
2840 
2841  // Deserialize argument response
2842  Fw::CmdResponse response;
2843  deserStatus = msg.deserialize(response);
2844  FW_ASSERT(
2845  deserStatus == Fw::FW_SERIALIZE_OK,
2846  static_cast<FwAssertArgType>(deserStatus)
2847  );
2848  // Call handler function
2849  this->compCmdStat_handler(
2850  portNum,
2851  opCode,
2852  cmdSeq,
2853  response
2854  );
2855 
2856  break;
2857  }
2858 
2859  // Handle async input port pingIn
2860  case PINGIN_PING: {
2861  // Deserialize argument key
2862  U32 key;
2863  deserStatus = msg.deserialize(key);
2864  FW_ASSERT(
2865  deserStatus == Fw::FW_SERIALIZE_OK,
2866  static_cast<FwAssertArgType>(deserStatus)
2867  );
2868  // Call handler function
2869  this->pingIn_handler(
2870  portNum,
2871  key
2872  );
2873 
2874  break;
2875  }
2876 
2877  // Handle async input port seqCmdBuff
2878  case SEQCMDBUFF_COM: {
2879  // Deserialize argument data
2880  Fw::ComBuffer data;
2881  deserStatus = msg.deserialize(data);
2882  FW_ASSERT(
2883  deserStatus == Fw::FW_SERIALIZE_OK,
2884  static_cast<FwAssertArgType>(deserStatus)
2885  );
2886 
2887  // Deserialize argument context
2888  U32 context;
2889  deserStatus = msg.deserialize(context);
2890  FW_ASSERT(
2891  deserStatus == Fw::FW_SERIALIZE_OK,
2892  static_cast<FwAssertArgType>(deserStatus)
2893  );
2894  // Call handler function
2895  this->seqCmdBuff_handler(
2896  portNum,
2897  data,
2898  context
2899  );
2900 
2901  break;
2902  }
2903 
2904  // Handle command CMD_NO_OP
2905  case CMD_CMD_NO_OP: {
2906  // Deserialize opcode
2907  FwOpcodeType opCode = 0;
2908  deserStatus = msg.deserialize(opCode);
2909  FW_ASSERT (
2910  deserStatus == Fw::FW_SERIALIZE_OK,
2911  static_cast<FwAssertArgType>(deserStatus)
2912  );
2913 
2914  // Deserialize command sequence
2915  U32 cmdSeq = 0;
2916  deserStatus = msg.deserialize(cmdSeq);
2917  FW_ASSERT (
2918  deserStatus == Fw::FW_SERIALIZE_OK,
2919  static_cast<FwAssertArgType>(deserStatus)
2920  );
2921 
2922  // Deserialize command argument buffer
2923  Fw::CmdArgBuffer args;
2924  deserStatus = msg.deserialize(args);
2925  FW_ASSERT (
2926  deserStatus == Fw::FW_SERIALIZE_OK,
2927  static_cast<FwAssertArgType>(deserStatus)
2928  );
2929 
2930  // Reset buffer
2931  args.resetDeser();
2932 
2933  // Make sure there was no data left over.
2934  // That means the argument buffer size was incorrect.
2935 #if FW_CMD_CHECK_RESIDUAL
2936  if (args.getBuffLeft() != 0) {
2937  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
2938  this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2939  }
2940  // Don't crash the task if bad arguments were passed from the ground
2941  break;
2942  }
2943 #endif
2944 
2945  // Call handler function
2946  this->CMD_NO_OP_cmdHandler(opCode, cmdSeq);
2947 
2948  break;
2949  }
2950 
2951  // Handle command CMD_NO_OP_STRING
2952  case CMD_CMD_NO_OP_STRING: {
2953  // Deserialize opcode
2954  FwOpcodeType opCode = 0;
2955  deserStatus = msg.deserialize(opCode);
2956  FW_ASSERT (
2957  deserStatus == Fw::FW_SERIALIZE_OK,
2958  static_cast<FwAssertArgType>(deserStatus)
2959  );
2960 
2961  // Deserialize command sequence
2962  U32 cmdSeq = 0;
2963  deserStatus = msg.deserialize(cmdSeq);
2964  FW_ASSERT (
2965  deserStatus == Fw::FW_SERIALIZE_OK,
2966  static_cast<FwAssertArgType>(deserStatus)
2967  );
2968 
2969  // Deserialize command argument buffer
2970  Fw::CmdArgBuffer args;
2971  deserStatus = msg.deserialize(args);
2972  FW_ASSERT (
2973  deserStatus == Fw::FW_SERIALIZE_OK,
2974  static_cast<FwAssertArgType>(deserStatus)
2975  );
2976 
2977  // Reset buffer
2978  args.resetDeser();
2979 
2980  // Deserialize argument arg1
2981  Fw::CmdStringArg arg1;
2982  deserStatus = args.deserialize(arg1);
2983  if (deserStatus != Fw::FW_SERIALIZE_OK) {
2984  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
2985  this->cmdResponse_out(
2986  opCode,
2987  cmdSeq,
2989  );
2990  }
2991  // Don't crash the task if bad arguments were passed from the ground
2992  break;
2993  }
2994 
2995  // Make sure there was no data left over.
2996  // That means the argument buffer size was incorrect.
2997 #if FW_CMD_CHECK_RESIDUAL
2998  if (args.getBuffLeft() != 0) {
2999  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
3000  this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
3001  }
3002  // Don't crash the task if bad arguments were passed from the ground
3003  break;
3004  }
3005 #endif
3006 
3007  // Call handler function
3009  opCode, cmdSeq,
3010  arg1
3011  );
3012 
3013  break;
3014  }
3015 
3016  // Handle command CMD_TEST_CMD_1
3017  case CMD_CMD_TEST_CMD_1: {
3018  // Deserialize opcode
3019  FwOpcodeType opCode = 0;
3020  deserStatus = msg.deserialize(opCode);
3021  FW_ASSERT (
3022  deserStatus == Fw::FW_SERIALIZE_OK,
3023  static_cast<FwAssertArgType>(deserStatus)
3024  );
3025 
3026  // Deserialize command sequence
3027  U32 cmdSeq = 0;
3028  deserStatus = msg.deserialize(cmdSeq);
3029  FW_ASSERT (
3030  deserStatus == Fw::FW_SERIALIZE_OK,
3031  static_cast<FwAssertArgType>(deserStatus)
3032  );
3033 
3034  // Deserialize command argument buffer
3035  Fw::CmdArgBuffer args;
3036  deserStatus = msg.deserialize(args);
3037  FW_ASSERT (
3038  deserStatus == Fw::FW_SERIALIZE_OK,
3039  static_cast<FwAssertArgType>(deserStatus)
3040  );
3041 
3042  // Reset buffer
3043  args.resetDeser();
3044 
3045  // Deserialize argument arg1
3046  I32 arg1;
3047  deserStatus = args.deserialize(arg1);
3048  if (deserStatus != Fw::FW_SERIALIZE_OK) {
3049  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
3050  this->cmdResponse_out(
3051  opCode,
3052  cmdSeq,
3054  );
3055  }
3056  // Don't crash the task if bad arguments were passed from the ground
3057  break;
3058  }
3059 
3060  // Deserialize argument arg2
3061  F32 arg2;
3062  deserStatus = args.deserialize(arg2);
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 arg3
3076  U8 arg3;
3077  deserStatus = args.deserialize(arg3);
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  // Make sure there was no data left over.
3091  // That means the argument buffer size was incorrect.
3092 #if FW_CMD_CHECK_RESIDUAL
3093  if (args.getBuffLeft() != 0) {
3094  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
3095  this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
3096  }
3097  // Don't crash the task if bad arguments were passed from the ground
3098  break;
3099  }
3100 #endif
3101 
3102  // Call handler function
3104  opCode, cmdSeq,
3105  arg1,
3106  arg2,
3107  arg3
3108  );
3109 
3110  break;
3111  }
3112 
3113  // Handle command CMD_CLEAR_TRACKING
3114  case CMD_CMD_CLEAR_TRACKING: {
3115  // Deserialize opcode
3116  FwOpcodeType opCode = 0;
3117  deserStatus = msg.deserialize(opCode);
3118  FW_ASSERT (
3119  deserStatus == Fw::FW_SERIALIZE_OK,
3120  static_cast<FwAssertArgType>(deserStatus)
3121  );
3122 
3123  // Deserialize command sequence
3124  U32 cmdSeq = 0;
3125  deserStatus = msg.deserialize(cmdSeq);
3126  FW_ASSERT (
3127  deserStatus == Fw::FW_SERIALIZE_OK,
3128  static_cast<FwAssertArgType>(deserStatus)
3129  );
3130 
3131  // Deserialize command argument buffer
3132  Fw::CmdArgBuffer args;
3133  deserStatus = msg.deserialize(args);
3134  FW_ASSERT (
3135  deserStatus == Fw::FW_SERIALIZE_OK,
3136  static_cast<FwAssertArgType>(deserStatus)
3137  );
3138 
3139  // Reset buffer
3140  args.resetDeser();
3141 
3142  // Make sure there was no data left over.
3143  // That means the argument buffer size was incorrect.
3144 #if FW_CMD_CHECK_RESIDUAL
3145  if (args.getBuffLeft() != 0) {
3146  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
3147  this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
3148  }
3149  // Don't crash the task if bad arguments were passed from the ground
3150  break;
3151  }
3152 #endif
3153 
3154  // Call handler function
3155  this->CMD_CLEAR_TRACKING_cmdHandler(opCode, cmdSeq);
3156 
3157  break;
3158  }
3159 
3160  default:
3161  return MSG_DISPATCH_ERROR;
3162  }
3163 
3164  return MSG_DISPATCH_OK;
3165  }
3166 
3167  // ----------------------------------------------------------------------
3168  // Calls for messages received on special input ports
3169  // ----------------------------------------------------------------------
3170 
3171  void CommandDispatcherComponentBase ::
3172  m_p_CmdDisp_in(
3173  Fw::PassiveComponentBase* callComp,
3174  FwIndexType portNum,
3175  FwOpcodeType opCode,
3176  U32 cmdSeq,
3177  Fw::CmdArgBuffer& args
3178  )
3179  {
3180  FW_ASSERT(callComp);
3181  CommandDispatcherComponentBase* compPtr = static_cast<CommandDispatcherComponentBase*>(callComp);
3182 
3183  const U32 idBase = callComp->getIdBase();
3184  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
3185 
3186  // Select base class function based on opcode
3187  switch (opCode - idBase) {
3188  case OPCODE_CMD_NO_OP: {
3189  compPtr->CMD_NO_OP_cmdHandlerBase(
3190  opCode,
3191  cmdSeq,
3192  args
3193  );
3194  break;
3195  }
3196 
3197  case OPCODE_CMD_NO_OP_STRING: {
3198  compPtr->CMD_NO_OP_STRING_cmdHandlerBase(
3199  opCode,
3200  cmdSeq,
3201  args
3202  );
3203  break;
3204  }
3205 
3206  case OPCODE_CMD_TEST_CMD_1: {
3207  compPtr->CMD_TEST_CMD_1_cmdHandlerBase(
3208  opCode,
3209  cmdSeq,
3210  args
3211  );
3212  break;
3213  }
3214 
3216  compPtr->CMD_CLEAR_TRACKING_cmdHandlerBase(
3217  opCode,
3218  cmdSeq,
3219  args
3220  );
3221  break;
3222  }
3223  }
3224  }
3225 
3226  // ----------------------------------------------------------------------
3227  // Calls for messages received on typed input ports
3228  // ----------------------------------------------------------------------
3229 
3230  void CommandDispatcherComponentBase ::
3231  m_p_compCmdReg_in(
3232  Fw::PassiveComponentBase* callComp,
3233  FwIndexType portNum,
3234  FwOpcodeType opCode
3235  )
3236  {
3237  FW_ASSERT(callComp);
3238  CommandDispatcherComponentBase* compPtr = static_cast<CommandDispatcherComponentBase*>(callComp);
3239  compPtr->compCmdReg_handlerBase(
3240  portNum,
3241  opCode
3242  );
3243  }
3244 
3245  void CommandDispatcherComponentBase ::
3246  m_p_compCmdStat_in(
3247  Fw::PassiveComponentBase* callComp,
3248  FwIndexType portNum,
3249  FwOpcodeType opCode,
3250  U32 cmdSeq,
3251  const Fw::CmdResponse& response
3252  )
3253  {
3254  FW_ASSERT(callComp);
3255  CommandDispatcherComponentBase* compPtr = static_cast<CommandDispatcherComponentBase*>(callComp);
3256  compPtr->compCmdStat_handlerBase(
3257  portNum,
3258  opCode,
3259  cmdSeq,
3260  response
3261  );
3262  }
3263 
3264  void CommandDispatcherComponentBase ::
3265  m_p_pingIn_in(
3266  Fw::PassiveComponentBase* callComp,
3267  FwIndexType portNum,
3268  U32 key
3269  )
3270  {
3271  FW_ASSERT(callComp);
3272  CommandDispatcherComponentBase* compPtr = static_cast<CommandDispatcherComponentBase*>(callComp);
3273  compPtr->pingIn_handlerBase(
3274  portNum,
3275  key
3276  );
3277  }
3278 
3279  void CommandDispatcherComponentBase ::
3280  m_p_seqCmdBuff_in(
3281  Fw::PassiveComponentBase* callComp,
3282  FwIndexType portNum,
3283  Fw::ComBuffer& data,
3284  U32 context
3285  )
3286  {
3287  FW_ASSERT(callComp);
3288  CommandDispatcherComponentBase* compPtr = static_cast<CommandDispatcherComponentBase*>(callComp);
3289  compPtr->seqCmdBuff_handlerBase(
3290  portNum,
3291  data,
3292  context
3293  );
3294  }
3295 
3296 }
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].
Definition: Time.hpp:9
virtual void CMD_NO_OP_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command CMD_NO_OP.
Operation succeeded.
Definition: Os.hpp:26
void invoke(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args) const
Invoke a port interface.
Definition: CmdPortAc.cpp:163
void pingIn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port pingIn.
CommandDispatcherComponentBase(const char *compName="")
Construct CommandDispatcherComponentBase object.
void regCommands()
Register commands with the Command Dispatcher.
NATIVE_UINT_TYPE SizeType
Status
status returned from the queue send function
Definition: Queue.hpp:30
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
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:40
Fw::InputCmdPort * get_CmdDisp_InputPort(FwIndexType portNum)
PlatformSizeType FwSizeType
Definition: FpConfig.h:35
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
Exceeded the number of commands that can be simultaneously executed.
virtual void CMD_NO_OP_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
void log_ACTIVITY_HI_TestCmd1Args(I32 arg1, F32 arg2, U8 arg3) const
I32 FwEnumStoreType
Definition: FpConfig.h:64
void pingOut_out(FwIndexType portNum, U32 key)
Invoke output port pingOut.
void init()
Initialization function.
Definition: TlmPortAc.cpp:144
Enum representing a command response.
void addCallPort(InputCmdRegPort *callPort)
Register an input port.
virtual void pingIn_handler(FwIndexType portNum, U32 key)=0
Handler for input port pingIn.
PlatformIndexType FwIndexType
Definition: FpConfig.h:25
bool isConnected_CmdStatus_OutputPort(FwIndexType portNum)
void compCmdSend_out(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Invoke output port compCmdSend.
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:26
void init()
Initialization function.
Definition: ComPortAc.cpp:56
The size of the serial representations of the port arguments.
Definition: CmdPortAc.hpp:37
virtual void CMD_TEST_CMD_1_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command CMD_TEST_CMD_1.
This log event message returns the TEST_CMD_1 arguments.
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:49
Message will block until space is available.
Definition: Queue.hpp:46
The size of the serial representation.
void log_ACTIVITY_HI_NoOpStringReceived(const Fw::StringBase &message) const
void tlmWrite_CommandsDispatched(U32 arg, Fw::Time _tlmTime=Fw::Time())
The command dispatcher has successfully received a NO-OP command from GUI with a string.
void invoke(FwOpcodeType opCode) const
Invoke a port interface.
void set_CmdReg_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to CmdReg[portNum].
Serializable::SizeType getBuffLeft() const
returns how much deserialization buffer is left
void init()
Initialization function.
Definition: TimePortAc.cpp:128
void setPortNum(NATIVE_INT_TYPE portNum)
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:72
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: PingPortAc.hpp:36
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
void log_COMMAND_OpCodeDispatched(U32 Opcode, I32 port) const
U32 FwOpcodeType
Definition: FpConfig.h:91
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.
No time base has been established.
Definition: FpConfig.h:70
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
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
The command dispatcher has successfully received a NO-OP command.
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.
The size of the serial representations of the port arguments.
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:42
U32 FwEventIdType
Definition: FpConfig.h:103
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.
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:30
BlockingType
message type
Definition: Queue.hpp:45
#define PRI_PlatformIntType
void log_DIAGNOSTIC_OpCodeReregistered(U32 Opcode, I32 port) const
Command failed to deserialize.
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
PlatformQueuePriorityType FwQueuePriorityType
Definition: FpConfig.h:55
void init()
Initialization function.
message to exit active component task
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.
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
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)
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition: BasicTypes.h:70
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
message sent/received okay
Definition: Queue.hpp:31
U8 BYTE
byte type
Definition: BasicTypes.h:31
virtual void CMD_CLEAR_TRACKING_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
The size of the serial representation.
virtual SerializeStatus serialize(SerializeBufferBase &buffer) const
serialization function
Definition: StringBase.cpp:142
void log_COMMAND_OpCodeError(U32 Opcode, Fw::CmdResponse error) const
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:47
void CMD_NO_OP_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Status receive(U8 *destination, FwSizeType capacity, BlockingType blockType, FwSizeType &actualSize, FwQueuePriorityType &priority) override
receive a message from the queue through delegate
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].
bool isConnected_compCmdSend_OutputPort(FwIndexType portNum)
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:148
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_DIAGNOSTIC_OpCodeRegistered(U32 Opcode, I32 port, I32 slot) const
Log event OpCodeRegistered.
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].
#define FW_LOG_STRING_MAX_SIZE
Max size of log string parameter type.
Definition: FpConfig.h:319
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
The size of the serial representations of the port arguments.
Definition: ComPortAc.hpp:37
U32 FwChanIdType
Definition: FpConfig.h:95
Clear command tracking info to recover from components not returning status.
void CMD_TEST_CMD_1_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)