F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
CommandDispatcherComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title CommandDispatcherComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for CommandDispatcher component base class
5 // ======================================================================
6 
7 #include "Fw/Types/Assert.hpp"
9 #if FW_ENABLE_TEXT_LOGGING
10 #include "Fw/Types/String.hpp"
11 #endif
13 
14 namespace Svc {
15 
16  namespace {
17  enum MsgTypeEnum {
18  COMMANDDISPATCHER_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT,
19  COMPCMDSTAT_CMDRESPONSE,
20  PINGIN_PING,
21  RUN_SCHED,
22  SEQCMDBUFF_COM,
23  CMD_CMD_NO_OP,
24  CMD_CMD_NO_OP_STRING,
25  CMD_CMD_TEST_CMD_1,
26  CMD_CMD_CLEAR_TRACKING,
27  };
28 
29  // Get the max size by constructing a union of the async input, command, and
30  // internal port serialization sizes
31  union BuffUnion {
32  BYTE compCmdStatPortSize[Fw::CmdResponsePortBuffer::CAPACITY];
33  BYTE pingInPortSize[Svc::PingPortBuffer::CAPACITY];
35  BYTE seqCmdBuffPortSize[Fw::ComPortBuffer::CAPACITY];
36  BYTE cmdPortSize[Fw::CmdPortBuffer::CAPACITY];
37  };
38 
39  // Define a message buffer class large enough to handle all the
40  // asynchronous inputs to the component
41  class ComponentIpcSerializableBuffer :
43  {
44 
45  public:
46 
47  enum {
48  // Offset into data in buffer: Size of message ID and port number
49  DATA_OFFSET = sizeof(FwEnumStoreType) + sizeof(FwIndexType),
50  // Max data size
51  MAX_DATA_SIZE = sizeof(BuffUnion),
52  // Max message size: Size of message id + size of port + max data size
53  SERIALIZATION_SIZE = DATA_OFFSET + MAX_DATA_SIZE
54  };
55 
56  Fw::Serializable::SizeType getCapacity() const {
57  return sizeof(m_buff);
58  }
59 
60  U8* getBuffAddr() {
61  return m_buff;
62  }
63 
64  const U8* getBuffAddr() const {
65  return m_buff;
66  }
67 
68  private:
69  // Should be the max of all the input ports serialized sizes...
70  U8 m_buff[SERIALIZATION_SIZE];
71 
72  };
73  }
74 
75  // ----------------------------------------------------------------------
76  // Component initialization
77  // ----------------------------------------------------------------------
78 
81  FwSizeType queueDepth,
82  FwEnumStoreType instance
83  )
84  {
85  // Initialize base class
87 
88 #if !FW_DIRECT_PORT_CALLS
89  // Connect input port CmdDisp
90  for (
91  FwIndexType port = 0;
92  port < static_cast<FwIndexType>(this->getNum_CmdDisp_InputPorts());
93  port++
94  ) {
95  this->m_CmdDisp_InputPort[port].init();
96  this->m_CmdDisp_InputPort[port].addCallComp(
97  this,
98  m_p_CmdDisp_in
99  );
100  this->m_CmdDisp_InputPort[port].setPortNum(port);
101 
102 #if FW_OBJECT_NAMES == 1
103  Fw::ObjectName portName;
104  portName.format(
105  "%s_CmdDisp_InputPort[%" PRI_FwIndexType "]",
106  this->m_objName.toChar(),
107  port
108  );
109  this->m_CmdDisp_InputPort[port].setObjName(portName.toChar());
110 #endif
111  }
112 #endif
113 
114 #if !FW_DIRECT_PORT_CALLS
115  // Connect input port compCmdReg
116  for (
117  FwIndexType port = 0;
118  port < static_cast<FwIndexType>(this->getNum_compCmdReg_InputPorts());
119  port++
120  ) {
121  this->m_compCmdReg_InputPort[port].init();
122  this->m_compCmdReg_InputPort[port].addCallComp(
123  this,
124  m_p_compCmdReg_in
125  );
126  this->m_compCmdReg_InputPort[port].setPortNum(port);
127 
128 #if FW_OBJECT_NAMES == 1
129  Fw::ObjectName portName;
130  portName.format(
131  "%s_compCmdReg_InputPort[%" PRI_FwIndexType "]",
132  this->m_objName.toChar(),
133  port
134  );
135  this->m_compCmdReg_InputPort[port].setObjName(portName.toChar());
136 #endif
137  }
138 #endif
139 
140 #if !FW_DIRECT_PORT_CALLS
141  // Connect input port compCmdStat
142  for (
143  FwIndexType port = 0;
144  port < static_cast<FwIndexType>(this->getNum_compCmdStat_InputPorts());
145  port++
146  ) {
147  this->m_compCmdStat_InputPort[port].init();
148  this->m_compCmdStat_InputPort[port].addCallComp(
149  this,
150  m_p_compCmdStat_in
151  );
152  this->m_compCmdStat_InputPort[port].setPortNum(port);
153 
154 #if FW_OBJECT_NAMES == 1
155  Fw::ObjectName portName;
156  portName.format(
157  "%s_compCmdStat_InputPort[%" PRI_FwIndexType "]",
158  this->m_objName.toChar(),
159  port
160  );
161  this->m_compCmdStat_InputPort[port].setObjName(portName.toChar());
162 #endif
163  }
164 #endif
165 
166 #if !FW_DIRECT_PORT_CALLS
167  // Connect input port pingIn
168  for (
169  FwIndexType port = 0;
170  port < static_cast<FwIndexType>(this->getNum_pingIn_InputPorts());
171  port++
172  ) {
173  this->m_pingIn_InputPort[port].init();
174  this->m_pingIn_InputPort[port].addCallComp(
175  this,
176  m_p_pingIn_in
177  );
178  this->m_pingIn_InputPort[port].setPortNum(port);
179 
180 #if FW_OBJECT_NAMES == 1
181  Fw::ObjectName portName;
182  portName.format(
183  "%s_pingIn_InputPort[%" PRI_FwIndexType "]",
184  this->m_objName.toChar(),
185  port
186  );
187  this->m_pingIn_InputPort[port].setObjName(portName.toChar());
188 #endif
189  }
190 #endif
191 
192 #if !FW_DIRECT_PORT_CALLS
193  // Connect input port run
194  for (
195  FwIndexType port = 0;
196  port < static_cast<FwIndexType>(this->getNum_run_InputPorts());
197  port++
198  ) {
199  this->m_run_InputPort[port].init();
200  this->m_run_InputPort[port].addCallComp(
201  this,
202  m_p_run_in
203  );
204  this->m_run_InputPort[port].setPortNum(port);
205 
206 #if FW_OBJECT_NAMES == 1
207  Fw::ObjectName portName;
208  portName.format(
209  "%s_run_InputPort[%" PRI_FwIndexType "]",
210  this->m_objName.toChar(),
211  port
212  );
213  this->m_run_InputPort[port].setObjName(portName.toChar());
214 #endif
215  }
216 #endif
217 
218 #if !FW_DIRECT_PORT_CALLS
219  // Connect input port seqCmdBuff
220  for (
221  FwIndexType port = 0;
222  port < static_cast<FwIndexType>(this->getNum_seqCmdBuff_InputPorts());
223  port++
224  ) {
225  this->m_seqCmdBuff_InputPort[port].init();
226  this->m_seqCmdBuff_InputPort[port].addCallComp(
227  this,
228  m_p_seqCmdBuff_in
229  );
230  this->m_seqCmdBuff_InputPort[port].setPortNum(port);
231 
232 #if FW_OBJECT_NAMES == 1
233  Fw::ObjectName portName;
234  portName.format(
235  "%s_seqCmdBuff_InputPort[%" PRI_FwIndexType "]",
236  this->m_objName.toChar(),
237  port
238  );
239  this->m_seqCmdBuff_InputPort[port].setObjName(portName.toChar());
240 #endif
241  }
242 #endif
243 
244 #if !FW_DIRECT_PORT_CALLS
245  // Connect output port CmdReg
246  for (
247  FwIndexType port = 0;
248  port < static_cast<FwIndexType>(this->getNum_CmdReg_OutputPorts());
249  port++
250  ) {
251  this->m_CmdReg_OutputPort[port].init();
252 
253 #if FW_OBJECT_NAMES == 1
254  Fw::ObjectName portName;
255  portName.format(
256  "%s_CmdReg_OutputPort[%" PRI_FwIndexType "]",
257  this->m_objName.toChar(),
258  port
259  );
260  this->m_CmdReg_OutputPort[port].setObjName(portName.toChar());
261 #endif
262  }
263 #endif
264 
265 #if !FW_DIRECT_PORT_CALLS
266  // Connect output port CmdStatus
267  for (
268  FwIndexType port = 0;
269  port < static_cast<FwIndexType>(this->getNum_CmdStatus_OutputPorts());
270  port++
271  ) {
272  this->m_CmdStatus_OutputPort[port].init();
273 
274 #if FW_OBJECT_NAMES == 1
275  Fw::ObjectName portName;
276  portName.format(
277  "%s_CmdStatus_OutputPort[%" PRI_FwIndexType "]",
278  this->m_objName.toChar(),
279  port
280  );
281  this->m_CmdStatus_OutputPort[port].setObjName(portName.toChar());
282 #endif
283  }
284 #endif
285 
286 #if !FW_DIRECT_PORT_CALLS
287  // Connect output port Log
288  for (
289  FwIndexType port = 0;
290  port < static_cast<FwIndexType>(this->getNum_Log_OutputPorts());
291  port++
292  ) {
293  this->m_Log_OutputPort[port].init();
294 
295 #if FW_OBJECT_NAMES == 1
296  Fw::ObjectName portName;
297  portName.format(
298  "%s_Log_OutputPort[%" PRI_FwIndexType "]",
299  this->m_objName.toChar(),
300  port
301  );
302  this->m_Log_OutputPort[port].setObjName(portName.toChar());
303 #endif
304  }
305 #endif
306 
307 #if !FW_DIRECT_PORT_CALLS && FW_ENABLE_TEXT_LOGGING
308  // Connect output port LogText
309  for (
310  FwIndexType port = 0;
311  port < static_cast<FwIndexType>(this->getNum_LogText_OutputPorts());
312  port++
313  ) {
314  this->m_LogText_OutputPort[port].init();
315 
316 #if FW_OBJECT_NAMES == 1
317  Fw::ObjectName portName;
318  portName.format(
319  "%s_LogText_OutputPort[%" PRI_FwIndexType "]",
320  this->m_objName.toChar(),
321  port
322  );
323  this->m_LogText_OutputPort[port].setObjName(portName.toChar());
324 #endif
325  }
326 #endif
327 
328 #if !FW_DIRECT_PORT_CALLS
329  // Connect output port Time
330  for (
331  FwIndexType port = 0;
332  port < static_cast<FwIndexType>(this->getNum_Time_OutputPorts());
333  port++
334  ) {
335  this->m_Time_OutputPort[port].init();
336 
337 #if FW_OBJECT_NAMES == 1
338  Fw::ObjectName portName;
339  portName.format(
340  "%s_Time_OutputPort[%" PRI_FwIndexType "]",
341  this->m_objName.toChar(),
342  port
343  );
344  this->m_Time_OutputPort[port].setObjName(portName.toChar());
345 #endif
346  }
347 #endif
348 
349 #if !FW_DIRECT_PORT_CALLS
350  // Connect output port Tlm
351  for (
352  FwIndexType port = 0;
353  port < static_cast<FwIndexType>(this->getNum_Tlm_OutputPorts());
354  port++
355  ) {
356  this->m_Tlm_OutputPort[port].init();
357 
358 #if FW_OBJECT_NAMES == 1
359  Fw::ObjectName portName;
360  portName.format(
361  "%s_Tlm_OutputPort[%" PRI_FwIndexType "]",
362  this->m_objName.toChar(),
363  port
364  );
365  this->m_Tlm_OutputPort[port].setObjName(portName.toChar());
366 #endif
367  }
368 #endif
369 
370 #if !FW_DIRECT_PORT_CALLS
371  // Connect output port compCmdSend
372  for (
373  FwIndexType port = 0;
374  port < static_cast<FwIndexType>(this->getNum_compCmdSend_OutputPorts());
375  port++
376  ) {
377  this->m_compCmdSend_OutputPort[port].init();
378 
379 #if FW_OBJECT_NAMES == 1
380  Fw::ObjectName portName;
381  portName.format(
382  "%s_compCmdSend_OutputPort[%" PRI_FwIndexType "]",
383  this->m_objName.toChar(),
384  port
385  );
386  this->m_compCmdSend_OutputPort[port].setObjName(portName.toChar());
387 #endif
388  }
389 #endif
390 
391 #if !FW_DIRECT_PORT_CALLS
392  // Connect output port pingOut
393  for (
394  FwIndexType port = 0;
395  port < static_cast<FwIndexType>(this->getNum_pingOut_OutputPorts());
396  port++
397  ) {
398  this->m_pingOut_OutputPort[port].init();
399 
400 #if FW_OBJECT_NAMES == 1
401  Fw::ObjectName portName;
402  portName.format(
403  "%s_pingOut_OutputPort[%" PRI_FwIndexType "]",
404  this->m_objName.toChar(),
405  port
406  );
407  this->m_pingOut_OutputPort[port].setObjName(portName.toChar());
408 #endif
409  }
410 #endif
411 
412 #if !FW_DIRECT_PORT_CALLS
413  // Connect output port seqCmdStatus
414  for (
415  FwIndexType port = 0;
416  port < static_cast<FwIndexType>(this->getNum_seqCmdStatus_OutputPorts());
417  port++
418  ) {
419  this->m_seqCmdStatus_OutputPort[port].init();
420 
421 #if FW_OBJECT_NAMES == 1
422  Fw::ObjectName portName;
423  portName.format(
424  "%s_seqCmdStatus_OutputPort[%" PRI_FwIndexType "]",
425  this->m_objName.toChar(),
426  port
427  );
428  this->m_seqCmdStatus_OutputPort[port].setObjName(portName.toChar());
429 #endif
430  }
431 #endif
432 
433  // Create the queue
434  Os::Queue::Status qStat = this->createQueue(
435  queueDepth,
436  static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
437  );
438  FW_ASSERT(
439  Os::Queue::Status::OP_OK == qStat,
440  static_cast<FwAssertArgType>(qStat)
441  );
442  }
443 
444 #if !FW_DIRECT_PORT_CALLS
445 
446  // ----------------------------------------------------------------------
447  // Getters for special input ports
448  // ----------------------------------------------------------------------
449 
452  {
453  FW_ASSERT(
454  (0 <= portNum) && (portNum < this->getNum_CmdDisp_InputPorts()),
455  static_cast<FwAssertArgType>(portNum)
456  );
457 
458  return &this->m_CmdDisp_InputPort[portNum];
459  }
460 
461 #endif
462 
463 #if !FW_DIRECT_PORT_CALLS
464 
465  // ----------------------------------------------------------------------
466  // Getters for typed input ports
467  // ----------------------------------------------------------------------
468 
471  {
472  FW_ASSERT(
473  (0 <= portNum) && (portNum < this->getNum_compCmdReg_InputPorts()),
474  static_cast<FwAssertArgType>(portNum)
475  );
476 
477  return &this->m_compCmdReg_InputPort[portNum];
478  }
479 
482  {
483  FW_ASSERT(
484  (0 <= portNum) && (portNum < this->getNum_compCmdStat_InputPorts()),
485  static_cast<FwAssertArgType>(portNum)
486  );
487 
488  return &this->m_compCmdStat_InputPort[portNum];
489  }
490 
493  {
494  FW_ASSERT(
495  (0 <= portNum) && (portNum < this->getNum_pingIn_InputPorts()),
496  static_cast<FwAssertArgType>(portNum)
497  );
498 
499  return &this->m_pingIn_InputPort[portNum];
500  }
501 
504  {
505  FW_ASSERT(
506  (0 <= portNum) && (portNum < this->getNum_run_InputPorts()),
507  static_cast<FwAssertArgType>(portNum)
508  );
509 
510  return &this->m_run_InputPort[portNum];
511  }
512 
515  {
516  FW_ASSERT(
517  (0 <= portNum) && (portNum < this->getNum_seqCmdBuff_InputPorts()),
518  static_cast<FwAssertArgType>(portNum)
519  );
520 
521  return &this->m_seqCmdBuff_InputPort[portNum];
522  }
523 
524 #endif
525 
526 #if !FW_DIRECT_PORT_CALLS
527 
528  // ----------------------------------------------------------------------
529  // Connect input ports to special output ports
530  // ----------------------------------------------------------------------
531 
534  FwIndexType portNum,
535  Fw::InputCmdRegPort* port
536  )
537  {
538  FW_ASSERT(
539  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
540  static_cast<FwAssertArgType>(portNum)
541  );
542 
543  this->m_CmdReg_OutputPort[portNum].addCallPort(port);
544  }
545 
548  FwIndexType portNum,
550  )
551  {
552  FW_ASSERT(
553  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
554  static_cast<FwAssertArgType>(portNum)
555  );
556 
557  this->m_CmdStatus_OutputPort[portNum].addCallPort(port);
558  }
559 
562  FwIndexType portNum,
563  Fw::InputLogPort* port
564  )
565  {
566  FW_ASSERT(
567  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
568  static_cast<FwAssertArgType>(portNum)
569  );
570 
571  this->m_Log_OutputPort[portNum].addCallPort(port);
572  }
573 
574 #if FW_ENABLE_TEXT_LOGGING == 1
575 
576  void CommandDispatcherComponentBase ::
577  set_LogText_OutputPort(
578  FwIndexType portNum,
580  )
581  {
582  FW_ASSERT(
583  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
584  static_cast<FwAssertArgType>(portNum)
585  );
586 
587  this->m_LogText_OutputPort[portNum].addCallPort(port);
588  }
589 
590 #endif
591 
594  FwIndexType portNum,
595  Fw::InputTimePort* port
596  )
597  {
598  FW_ASSERT(
599  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
600  static_cast<FwAssertArgType>(portNum)
601  );
602 
603  this->m_Time_OutputPort[portNum].addCallPort(port);
604  }
605 
608  FwIndexType portNum,
609  Fw::InputTlmPort* port
610  )
611  {
612  FW_ASSERT(
613  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
614  static_cast<FwAssertArgType>(portNum)
615  );
616 
617  this->m_Tlm_OutputPort[portNum].addCallPort(port);
618  }
619 
620 #endif
621 
622 #if !FW_DIRECT_PORT_CALLS
623 
624  // ----------------------------------------------------------------------
625  // Connect typed input ports to typed output ports
626  // ----------------------------------------------------------------------
627 
630  FwIndexType portNum,
631  Fw::InputCmdPort* port
632  )
633  {
634  FW_ASSERT(
635  (0 <= portNum) && (portNum < this->getNum_compCmdSend_OutputPorts()),
636  static_cast<FwAssertArgType>(portNum)
637  );
638 
639  this->m_compCmdSend_OutputPort[portNum].addCallPort(port);
640  }
641 
644  FwIndexType portNum,
645  Svc::InputPingPort* port
646  )
647  {
648  FW_ASSERT(
649  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
650  static_cast<FwAssertArgType>(portNum)
651  );
652 
653  this->m_pingOut_OutputPort[portNum].addCallPort(port);
654  }
655 
658  FwIndexType portNum,
660  )
661  {
662  FW_ASSERT(
663  (0 <= portNum) && (portNum < this->getNum_seqCmdStatus_OutputPorts()),
664  static_cast<FwAssertArgType>(portNum)
665  );
666 
667  this->m_seqCmdStatus_OutputPort[portNum].addCallPort(port);
668  }
669 
670 #endif
671 
672 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
673 
674  // ----------------------------------------------------------------------
675  // Connect serial input ports to special output ports
676  // ----------------------------------------------------------------------
677 
680  FwIndexType portNum,
681  Fw::InputSerializePort* port
682  )
683  {
684  FW_ASSERT(
685  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
686  static_cast<FwAssertArgType>(portNum)
687  );
688 
689  this->m_CmdReg_OutputPort[portNum].registerSerialPort(port);
690  }
691 
694  FwIndexType portNum,
695  Fw::InputSerializePort* port
696  )
697  {
698  FW_ASSERT(
699  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
700  static_cast<FwAssertArgType>(portNum)
701  );
702 
703  this->m_CmdStatus_OutputPort[portNum].registerSerialPort(port);
704  }
705 
708  FwIndexType portNum,
709  Fw::InputSerializePort* port
710  )
711  {
712  FW_ASSERT(
713  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
714  static_cast<FwAssertArgType>(portNum)
715  );
716 
717  this->m_Log_OutputPort[portNum].registerSerialPort(port);
718  }
719 
720 #if FW_ENABLE_TEXT_LOGGING == 1
721 
722  void CommandDispatcherComponentBase ::
723  set_LogText_OutputPort(
724  FwIndexType portNum,
725  Fw::InputSerializePort* port
726  )
727  {
728  FW_ASSERT(
729  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
730  static_cast<FwAssertArgType>(portNum)
731  );
732 
733  this->m_LogText_OutputPort[portNum].registerSerialPort(port);
734  }
735 
736 #endif
737 
740  FwIndexType portNum,
741  Fw::InputSerializePort* port
742  )
743  {
744  FW_ASSERT(
745  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
746  static_cast<FwAssertArgType>(portNum)
747  );
748 
749  this->m_Time_OutputPort[portNum].registerSerialPort(port);
750  }
751 
754  FwIndexType portNum,
755  Fw::InputSerializePort* port
756  )
757  {
758  FW_ASSERT(
759  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
760  static_cast<FwAssertArgType>(portNum)
761  );
762 
763  this->m_Tlm_OutputPort[portNum].registerSerialPort(port);
764  }
765 
766 #endif
767 
768 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
769 
770  // ----------------------------------------------------------------------
771  // Connect serial input ports to typed output ports
772  // ----------------------------------------------------------------------
773 
776  FwIndexType portNum,
777  Fw::InputSerializePort* port
778  )
779  {
780  FW_ASSERT(
781  (0 <= portNum) && (portNum < this->getNum_compCmdSend_OutputPorts()),
782  static_cast<FwAssertArgType>(portNum)
783  );
784 
785  this->m_compCmdSend_OutputPort[portNum].registerSerialPort(port);
786  }
787 
790  FwIndexType portNum,
791  Fw::InputSerializePort* port
792  )
793  {
794  FW_ASSERT(
795  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
796  static_cast<FwAssertArgType>(portNum)
797  );
798 
799  this->m_pingOut_OutputPort[portNum].registerSerialPort(port);
800  }
801 
804  FwIndexType portNum,
805  Fw::InputSerializePort* port
806  )
807  {
808  FW_ASSERT(
809  (0 <= portNum) && (portNum < this->getNum_seqCmdStatus_OutputPorts()),
810  static_cast<FwAssertArgType>(portNum)
811  );
812 
813  this->m_seqCmdStatus_OutputPort[portNum].registerSerialPort(port);
814  }
815 
816 #endif
817 
818  // ----------------------------------------------------------------------
819  // Command registration
820  // ----------------------------------------------------------------------
821 
824  {
826 
827  this->CmdReg_out(
828  0,
829  this->getIdBase() + OPCODE_CMD_NO_OP
830  );
831 
832  this->CmdReg_out(
833  0,
835  );
836 
837  this->CmdReg_out(
838  0,
840  );
841 
842  this->CmdReg_out(
843  0,
845  );
846  }
847 
848  // ----------------------------------------------------------------------
849  // Component construction and destruction
850  // ----------------------------------------------------------------------
851 
853  CommandDispatcherComponentBase(const char* compName) :
854  Fw::ActiveComponentBase(compName)
855  {
856  this->m_CommandDroppedQueueOverflowThrottle = 0;
857  }
858 
861  {
862 
863  }
864 
865 #if !FW_DIRECT_PORT_CALLS
866 
867  // ----------------------------------------------------------------------
868  // Connection status queries for special output ports
869  // ----------------------------------------------------------------------
870 
873  {
874  FW_ASSERT(
875  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
876  static_cast<FwAssertArgType>(portNum)
877  );
878 
879  return this->m_CmdReg_OutputPort[portNum].isConnected();
880  }
881 
884  {
885  FW_ASSERT(
886  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
887  static_cast<FwAssertArgType>(portNum)
888  );
889 
890  return this->m_CmdStatus_OutputPort[portNum].isConnected();
891  }
892 
895  {
896  FW_ASSERT(
897  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
898  static_cast<FwAssertArgType>(portNum)
899  );
900 
901  return this->m_Log_OutputPort[portNum].isConnected();
902  }
903 
904 #if FW_ENABLE_TEXT_LOGGING == 1
905 
906  bool CommandDispatcherComponentBase ::
907  isConnected_LogText_OutputPort(FwIndexType portNum) const
908  {
909  FW_ASSERT(
910  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
911  static_cast<FwAssertArgType>(portNum)
912  );
913 
914  return this->m_LogText_OutputPort[portNum].isConnected();
915  }
916 
917 #endif
918 
921  {
922  FW_ASSERT(
923  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
924  static_cast<FwAssertArgType>(portNum)
925  );
926 
927  return this->m_Time_OutputPort[portNum].isConnected();
928  }
929 
932  {
933  FW_ASSERT(
934  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
935  static_cast<FwAssertArgType>(portNum)
936  );
937 
938  return this->m_Tlm_OutputPort[portNum].isConnected();
939  }
940 
941 #endif
942 
943 #if !FW_DIRECT_PORT_CALLS
944 
945  // ----------------------------------------------------------------------
946  // Connection status queries for typed output ports
947  // ----------------------------------------------------------------------
948 
951  {
952  FW_ASSERT(
953  (0 <= portNum) && (portNum < this->getNum_compCmdSend_OutputPorts()),
954  static_cast<FwAssertArgType>(portNum)
955  );
956 
957  return this->m_compCmdSend_OutputPort[portNum].isConnected();
958  }
959 
962  {
963  FW_ASSERT(
964  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
965  static_cast<FwAssertArgType>(portNum)
966  );
967 
968  return this->m_pingOut_OutputPort[portNum].isConnected();
969  }
970 
973  {
974  FW_ASSERT(
975  (0 <= portNum) && (portNum < this->getNum_seqCmdStatus_OutputPorts()),
976  static_cast<FwAssertArgType>(portNum)
977  );
978 
979  return this->m_seqCmdStatus_OutputPort[portNum].isConnected();
980  }
981 
982 #endif
983 
984  // ----------------------------------------------------------------------
985  // Port handler base-class functions for special input ports
986  //
987  // Call these functions directly to bypass the corresponding ports
988  // ----------------------------------------------------------------------
989 
992  FwIndexType portNum,
993  FwOpcodeType opCode,
994  U32 cmdSeq,
995  Fw::CmdArgBuffer& args
996  )
997  {
998 
999  const U32 idBase = this->getIdBase();
1000  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
1001 
1002  // Select base class function based on opcode
1003  switch (opCode - idBase) {
1004  case OPCODE_CMD_NO_OP: {
1006  opCode,
1007  cmdSeq,
1008  args
1009  );
1010  break;
1011  }
1012 
1013  case OPCODE_CMD_NO_OP_STRING: {
1015  opCode,
1016  cmdSeq,
1017  args
1018  );
1019  break;
1020  }
1021 
1022  case OPCODE_CMD_TEST_CMD_1: {
1024  opCode,
1025  cmdSeq,
1026  args
1027  );
1028  break;
1029  }
1030 
1033  opCode,
1034  cmdSeq,
1035  args
1036  );
1037  break;
1038  }
1039  default:
1040  // Unknown opcode: ignore it
1041  break;
1042  }
1043  }
1044 
1045  // ----------------------------------------------------------------------
1046  // Port handler base-class functions for typed input ports
1047  //
1048  // Call these functions directly to bypass the corresponding ports
1049  // ----------------------------------------------------------------------
1050 
1053  FwIndexType portNum,
1054  FwOpcodeType opCode
1055  )
1056  {
1057  // Make sure port number is valid
1058  FW_ASSERT(
1059  (0 <= portNum) && (portNum < this->getNum_compCmdReg_InputPorts()),
1060  static_cast<FwAssertArgType>(portNum)
1061  );
1062 
1063  // Lock guard mutex before calling
1064  this->lock();
1065 
1066  // Call handler function
1067  this->compCmdReg_handler(
1068  portNum,
1069  opCode
1070  );
1071 
1072  // Unlock guard mutex
1073  this->unLock();
1074  }
1075 
1078  FwIndexType portNum,
1079  FwOpcodeType opCode,
1080  U32 cmdSeq,
1081  const Fw::CmdResponse& response
1082  )
1083  {
1084  // Make sure port number is valid
1085  FW_ASSERT(
1086  (0 <= portNum) && (portNum < this->getNum_compCmdStat_InputPorts()),
1087  static_cast<FwAssertArgType>(portNum)
1088  );
1089 
1090  // Call pre-message hook
1092  portNum,
1093  opCode,
1094  cmdSeq,
1095  response
1096  );
1097  ComponentIpcSerializableBuffer msg;
1099 
1100  // Serialize message ID
1101  _status = msg.serializeFrom(
1102  static_cast<FwEnumStoreType>(COMPCMDSTAT_CMDRESPONSE)
1103  );
1104  FW_ASSERT(
1105  _status == Fw::FW_SERIALIZE_OK,
1106  static_cast<FwAssertArgType>(_status)
1107  );
1108 
1109  // Serialize port number
1110  _status = msg.serializeFrom(portNum);
1111  FW_ASSERT(
1112  _status == Fw::FW_SERIALIZE_OK,
1113  static_cast<FwAssertArgType>(_status)
1114  );
1115 
1116  // Serialize argument opCode
1117  _status = msg.serializeFrom(opCode);
1118  FW_ASSERT(
1119  _status == Fw::FW_SERIALIZE_OK,
1120  static_cast<FwAssertArgType>(_status)
1121  );
1122 
1123  // Serialize argument cmdSeq
1124  _status = msg.serializeFrom(cmdSeq);
1125  FW_ASSERT(
1126  _status == Fw::FW_SERIALIZE_OK,
1127  static_cast<FwAssertArgType>(_status)
1128  );
1129 
1130  // Serialize argument response
1131  _status = msg.serializeFrom(response);
1132  FW_ASSERT(
1133  _status == Fw::FW_SERIALIZE_OK,
1134  static_cast<FwAssertArgType>(_status)
1135  );
1136 
1137  // Send message
1139  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1140 
1141  FW_ASSERT(
1142  qStatus == Os::Queue::OP_OK,
1143  static_cast<FwAssertArgType>(qStatus)
1144  );
1145  }
1146 
1149  FwIndexType portNum,
1150  U32 key
1151  )
1152  {
1153  // Make sure port number is valid
1154  FW_ASSERT(
1155  (0 <= portNum) && (portNum < this->getNum_pingIn_InputPorts()),
1156  static_cast<FwAssertArgType>(portNum)
1157  );
1158 
1159  // Call pre-message hook
1161  portNum,
1162  key
1163  );
1164  ComponentIpcSerializableBuffer msg;
1166 
1167  // Serialize message ID
1168  _status = msg.serializeFrom(
1169  static_cast<FwEnumStoreType>(PINGIN_PING)
1170  );
1171  FW_ASSERT(
1172  _status == Fw::FW_SERIALIZE_OK,
1173  static_cast<FwAssertArgType>(_status)
1174  );
1175 
1176  // Serialize port number
1177  _status = msg.serializeFrom(portNum);
1178  FW_ASSERT(
1179  _status == Fw::FW_SERIALIZE_OK,
1180  static_cast<FwAssertArgType>(_status)
1181  );
1182 
1183  // Serialize argument key
1184  _status = msg.serializeFrom(key);
1185  FW_ASSERT(
1186  _status == Fw::FW_SERIALIZE_OK,
1187  static_cast<FwAssertArgType>(_status)
1188  );
1189 
1190  // Send message
1192  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1193 
1194  FW_ASSERT(
1195  qStatus == Os::Queue::OP_OK,
1196  static_cast<FwAssertArgType>(qStatus)
1197  );
1198  }
1199 
1202  FwIndexType portNum,
1203  U32 context
1204  )
1205  {
1206  // Make sure port number is valid
1207  FW_ASSERT(
1208  (0 <= portNum) && (portNum < this->getNum_run_InputPorts()),
1209  static_cast<FwAssertArgType>(portNum)
1210  );
1211 
1212  // Call pre-message hook
1214  portNum,
1215  context
1216  );
1217  ComponentIpcSerializableBuffer msg;
1219 
1220  // Serialize message ID
1221  _status = msg.serializeFrom(
1222  static_cast<FwEnumStoreType>(RUN_SCHED)
1223  );
1224  FW_ASSERT(
1225  _status == Fw::FW_SERIALIZE_OK,
1226  static_cast<FwAssertArgType>(_status)
1227  );
1228 
1229  // Serialize port number
1230  _status = msg.serializeFrom(portNum);
1231  FW_ASSERT(
1232  _status == Fw::FW_SERIALIZE_OK,
1233  static_cast<FwAssertArgType>(_status)
1234  );
1235 
1236  // Serialize argument context
1237  _status = msg.serializeFrom(context);
1238  FW_ASSERT(
1239  _status == Fw::FW_SERIALIZE_OK,
1240  static_cast<FwAssertArgType>(_status)
1241  );
1242 
1243  // Send message
1245  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1246 
1247  FW_ASSERT(
1248  qStatus == Os::Queue::OP_OK,
1249  static_cast<FwAssertArgType>(qStatus)
1250  );
1251  }
1252 
1255  FwIndexType portNum,
1256  Fw::ComBuffer& data,
1257  U32 context
1258  )
1259  {
1260  // Make sure port number is valid
1261  FW_ASSERT(
1262  (0 <= portNum) && (portNum < this->getNum_seqCmdBuff_InputPorts()),
1263  static_cast<FwAssertArgType>(portNum)
1264  );
1265 
1266  // Call pre-message hook
1268  portNum,
1269  data,
1270  context
1271  );
1272  ComponentIpcSerializableBuffer msg;
1274 
1275  // Serialize message ID
1276  _status = msg.serializeFrom(
1277  static_cast<FwEnumStoreType>(SEQCMDBUFF_COM)
1278  );
1279  FW_ASSERT(
1280  _status == Fw::FW_SERIALIZE_OK,
1281  static_cast<FwAssertArgType>(_status)
1282  );
1283 
1284  // Serialize port number
1285  _status = msg.serializeFrom(portNum);
1286  FW_ASSERT(
1287  _status == Fw::FW_SERIALIZE_OK,
1288  static_cast<FwAssertArgType>(_status)
1289  );
1290 
1291  // Serialize argument data
1292  _status = msg.serializeFrom(data);
1293  FW_ASSERT(
1294  _status == Fw::FW_SERIALIZE_OK,
1295  static_cast<FwAssertArgType>(_status)
1296  );
1297 
1298  // Serialize argument context
1299  _status = msg.serializeFrom(context);
1300  FW_ASSERT(
1301  _status == Fw::FW_SERIALIZE_OK,
1302  static_cast<FwAssertArgType>(_status)
1303  );
1304 
1305  // Send message
1307  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1308 
1309  if (qStatus == Os::Queue::Status::FULL) {
1310  this->seqCmdBuff_overflowHook(portNum, data, context);
1311  return;
1312  }
1313 
1314  FW_ASSERT(
1315  qStatus == Os::Queue::OP_OK,
1316  static_cast<FwAssertArgType>(qStatus)
1317  );
1318  }
1319 
1320  // ----------------------------------------------------------------------
1321  // Pre-message hooks for typed async input ports
1322  //
1323  // Each of these functions is invoked just before processing a message
1324  // on the corresponding port. By default, they do nothing. You can
1325  // override them to provide specific pre-message behavior.
1326  // ----------------------------------------------------------------------
1327 
1330  FwIndexType portNum,
1331  FwOpcodeType opCode,
1332  U32 cmdSeq,
1333  const Fw::CmdResponse& response
1334  )
1335  {
1336  // Default: no-op
1337  }
1338 
1341  FwIndexType portNum,
1342  U32 key
1343  )
1344  {
1345  // Default: no-op
1346  }
1347 
1350  FwIndexType portNum,
1351  U32 context
1352  )
1353  {
1354  // Default: no-op
1355  }
1356 
1359  FwIndexType portNum,
1360  Fw::ComBuffer& data,
1361  U32 context
1362  )
1363  {
1364  // Default: no-op
1365  }
1366 
1367 #if !FW_DIRECT_PORT_CALLS
1368 
1369  // ----------------------------------------------------------------------
1370  // Invocation functions for typed output ports
1371  // ----------------------------------------------------------------------
1372 
1375  FwIndexType portNum,
1376  FwOpcodeType opCode,
1377  U32 cmdSeq,
1378  Fw::CmdArgBuffer& args
1379  ) const
1380  {
1381  FW_ASSERT(
1382  (0 <= portNum) && (portNum < this->getNum_compCmdSend_OutputPorts()),
1383  static_cast<FwAssertArgType>(portNum)
1384  );
1385 
1386  FW_ASSERT(
1387  this->m_compCmdSend_OutputPort[portNum].isConnected(),
1388  static_cast<FwAssertArgType>(portNum)
1389  );
1390  this->m_compCmdSend_OutputPort[portNum].invoke(
1391  opCode,
1392  cmdSeq,
1393  args
1394  );
1395  }
1396 
1399  FwIndexType portNum,
1400  U32 key
1401  ) const
1402  {
1403  FW_ASSERT(
1404  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
1405  static_cast<FwAssertArgType>(portNum)
1406  );
1407 
1408  FW_ASSERT(
1409  this->m_pingOut_OutputPort[portNum].isConnected(),
1410  static_cast<FwAssertArgType>(portNum)
1411  );
1412  this->m_pingOut_OutputPort[portNum].invoke(
1413  key
1414  );
1415  }
1416 
1419  FwIndexType portNum,
1420  FwOpcodeType opCode,
1421  U32 cmdSeq,
1422  const Fw::CmdResponse& response
1423  ) const
1424  {
1425  FW_ASSERT(
1426  (0 <= portNum) && (portNum < this->getNum_seqCmdStatus_OutputPorts()),
1427  static_cast<FwAssertArgType>(portNum)
1428  );
1429 
1430  FW_ASSERT(
1431  this->m_seqCmdStatus_OutputPort[portNum].isConnected(),
1432  static_cast<FwAssertArgType>(portNum)
1433  );
1434  this->m_seqCmdStatus_OutputPort[portNum].invoke(
1435  opCode,
1436  cmdSeq,
1437  response
1438  );
1439  }
1440 
1441 #endif
1442 
1443  // ----------------------------------------------------------------------
1444  // Command response
1445  // ----------------------------------------------------------------------
1446 
1449  FwOpcodeType opCode,
1450  U32 cmdSeq,
1451  Fw::CmdResponse response
1452  )
1453  {
1455  this->CmdStatus_out(0, opCode, cmdSeq, response);
1456  }
1457 
1458  // ----------------------------------------------------------------------
1459  // Command handler base-class functions
1460  //
1461  // Call these functions directly to bypass the command input port
1462  // ----------------------------------------------------------------------
1463 
1466  FwOpcodeType opCode,
1467  U32 cmdSeq,
1468  Fw::CmdArgBuffer& args
1469  )
1470  {
1471  // Call pre-message hook
1472  this->CMD_NO_OP_preMsgHook(opCode,cmdSeq);
1473 
1474  // Defer deserializing arguments to the message dispatcher
1475  // to avoid deserializing and reserializing just for IPC
1476  ComponentIpcSerializableBuffer msg;
1478 
1479  // Serialize for IPC
1480  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_CMD_NO_OP));
1481  FW_ASSERT (
1482  _status == Fw::FW_SERIALIZE_OK,
1483  static_cast<FwAssertArgType>(_status)
1484  );
1485 
1486  // Fake port number to make message dequeue work
1487  FwIndexType port = 0;
1488 
1489  _status = msg.serializeFrom(port);
1490  FW_ASSERT (
1491  _status == Fw::FW_SERIALIZE_OK,
1492  static_cast<FwAssertArgType>(_status)
1493  );
1494 
1495  _status = msg.serializeFrom(opCode);
1496  FW_ASSERT (
1497  _status == Fw::FW_SERIALIZE_OK,
1498  static_cast<FwAssertArgType>(_status)
1499  );
1500 
1501  _status = msg.serializeFrom(cmdSeq);
1502  FW_ASSERT (
1503  _status == Fw::FW_SERIALIZE_OK,
1504  static_cast<FwAssertArgType>(_status)
1505  );
1506 
1507  _status = msg.serializeFrom(args);
1508  FW_ASSERT (
1509  _status == Fw::FW_SERIALIZE_OK,
1510  static_cast<FwAssertArgType>(_status)
1511  );
1512 
1513  // Send message
1515  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1516 
1517  FW_ASSERT(
1518  qStatus == Os::Queue::OP_OK,
1519  static_cast<FwAssertArgType>(qStatus)
1520  );
1521  }
1522 
1525  FwOpcodeType opCode,
1526  U32 cmdSeq,
1527  Fw::CmdArgBuffer& args
1528  )
1529  {
1530  // Call pre-message hook
1531  this->CMD_NO_OP_STRING_preMsgHook(opCode,cmdSeq);
1532 
1533  // Defer deserializing arguments to the message dispatcher
1534  // to avoid deserializing and reserializing just for IPC
1535  ComponentIpcSerializableBuffer msg;
1537 
1538  // Serialize for IPC
1539  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_CMD_NO_OP_STRING));
1540  FW_ASSERT (
1541  _status == Fw::FW_SERIALIZE_OK,
1542  static_cast<FwAssertArgType>(_status)
1543  );
1544 
1545  // Fake port number to make message dequeue work
1546  FwIndexType port = 0;
1547 
1548  _status = msg.serializeFrom(port);
1549  FW_ASSERT (
1550  _status == Fw::FW_SERIALIZE_OK,
1551  static_cast<FwAssertArgType>(_status)
1552  );
1553 
1554  _status = msg.serializeFrom(opCode);
1555  FW_ASSERT (
1556  _status == Fw::FW_SERIALIZE_OK,
1557  static_cast<FwAssertArgType>(_status)
1558  );
1559 
1560  _status = msg.serializeFrom(cmdSeq);
1561  FW_ASSERT (
1562  _status == Fw::FW_SERIALIZE_OK,
1563  static_cast<FwAssertArgType>(_status)
1564  );
1565 
1566  _status = msg.serializeFrom(args);
1567  FW_ASSERT (
1568  _status == Fw::FW_SERIALIZE_OK,
1569  static_cast<FwAssertArgType>(_status)
1570  );
1571 
1572  // Send message
1574  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1575 
1576  FW_ASSERT(
1577  qStatus == Os::Queue::OP_OK,
1578  static_cast<FwAssertArgType>(qStatus)
1579  );
1580  }
1581 
1584  FwOpcodeType opCode,
1585  U32 cmdSeq,
1586  Fw::CmdArgBuffer& args
1587  )
1588  {
1589  // Call pre-message hook
1590  this->CMD_TEST_CMD_1_preMsgHook(opCode,cmdSeq);
1591 
1592  // Defer deserializing arguments to the message dispatcher
1593  // to avoid deserializing and reserializing just for IPC
1594  ComponentIpcSerializableBuffer msg;
1596 
1597  // Serialize for IPC
1598  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_CMD_TEST_CMD_1));
1599  FW_ASSERT (
1600  _status == Fw::FW_SERIALIZE_OK,
1601  static_cast<FwAssertArgType>(_status)
1602  );
1603 
1604  // Fake port number to make message dequeue work
1605  FwIndexType port = 0;
1606 
1607  _status = msg.serializeFrom(port);
1608  FW_ASSERT (
1609  _status == Fw::FW_SERIALIZE_OK,
1610  static_cast<FwAssertArgType>(_status)
1611  );
1612 
1613  _status = msg.serializeFrom(opCode);
1614  FW_ASSERT (
1615  _status == Fw::FW_SERIALIZE_OK,
1616  static_cast<FwAssertArgType>(_status)
1617  );
1618 
1619  _status = msg.serializeFrom(cmdSeq);
1620  FW_ASSERT (
1621  _status == Fw::FW_SERIALIZE_OK,
1622  static_cast<FwAssertArgType>(_status)
1623  );
1624 
1625  _status = msg.serializeFrom(args);
1626  FW_ASSERT (
1627  _status == Fw::FW_SERIALIZE_OK,
1628  static_cast<FwAssertArgType>(_status)
1629  );
1630 
1631  // Send message
1633  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1634 
1635  FW_ASSERT(
1636  qStatus == Os::Queue::OP_OK,
1637  static_cast<FwAssertArgType>(qStatus)
1638  );
1639  }
1640 
1643  FwOpcodeType opCode,
1644  U32 cmdSeq,
1645  Fw::CmdArgBuffer& args
1646  )
1647  {
1648  // Call pre-message hook
1649  this->CMD_CLEAR_TRACKING_preMsgHook(opCode,cmdSeq);
1650 
1651  // Defer deserializing arguments to the message dispatcher
1652  // to avoid deserializing and reserializing just for IPC
1653  ComponentIpcSerializableBuffer msg;
1655 
1656  // Serialize for IPC
1657  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_CMD_CLEAR_TRACKING));
1658  FW_ASSERT (
1659  _status == Fw::FW_SERIALIZE_OK,
1660  static_cast<FwAssertArgType>(_status)
1661  );
1662 
1663  // Fake port number to make message dequeue work
1664  FwIndexType port = 0;
1665 
1666  _status = msg.serializeFrom(port);
1667  FW_ASSERT (
1668  _status == Fw::FW_SERIALIZE_OK,
1669  static_cast<FwAssertArgType>(_status)
1670  );
1671 
1672  _status = msg.serializeFrom(opCode);
1673  FW_ASSERT (
1674  _status == Fw::FW_SERIALIZE_OK,
1675  static_cast<FwAssertArgType>(_status)
1676  );
1677 
1678  _status = msg.serializeFrom(cmdSeq);
1679  FW_ASSERT (
1680  _status == Fw::FW_SERIALIZE_OK,
1681  static_cast<FwAssertArgType>(_status)
1682  );
1683 
1684  _status = msg.serializeFrom(args);
1685  FW_ASSERT (
1686  _status == Fw::FW_SERIALIZE_OK,
1687  static_cast<FwAssertArgType>(_status)
1688  );
1689 
1690  // Send message
1692  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1693 
1694  FW_ASSERT(
1695  qStatus == Os::Queue::OP_OK,
1696  static_cast<FwAssertArgType>(qStatus)
1697  );
1698  }
1699 
1700  // ----------------------------------------------------------------------
1701  // Pre-message hooks for async commands
1702  //
1703  // Each of these functions is invoked just before processing the
1704  // corresponding command. By default they do nothing. You can
1705  // override them to provide specific pre-command behavior.
1706  // ----------------------------------------------------------------------
1707 
1710  FwOpcodeType opCode,
1711  U32 cmdSeq
1712  )
1713  {
1714  // Defaults to no-op; can be overridden
1715  (void) opCode;
1716  (void) cmdSeq;
1717  }
1718 
1721  FwOpcodeType opCode,
1722  U32 cmdSeq
1723  )
1724  {
1725  // Defaults to no-op; can be overridden
1726  (void) opCode;
1727  (void) cmdSeq;
1728  }
1729 
1732  FwOpcodeType opCode,
1733  U32 cmdSeq
1734  )
1735  {
1736  // Defaults to no-op; can be overridden
1737  (void) opCode;
1738  (void) cmdSeq;
1739  }
1740 
1743  FwOpcodeType opCode,
1744  U32 cmdSeq
1745  )
1746  {
1747  // Defaults to no-op; can be overridden
1748  (void) opCode;
1749  (void) cmdSeq;
1750  }
1751 
1752  // ----------------------------------------------------------------------
1753  // Event logging functions
1754  // ----------------------------------------------------------------------
1755 
1758  FwOpcodeType Opcode,
1759  I32 port,
1760  I32 slot
1761  ) const
1762  {
1763  // Get the time
1764  Fw::Time _logTime;
1765  if (this->isConnected_Time_OutputPort(0)) {
1766  this->Time_out(0, _logTime);
1767  }
1768 
1769  const FwEventIdType _id = this->getIdBase() + EVENTID_OPCODEREGISTERED;
1770 
1771  // Emit the event on the log port
1772  if (this->isConnected_Log_OutputPort(0)) {
1773  Fw::LogBuffer _logBuff;
1775 
1776 #if FW_AMPCS_COMPATIBLE
1777  // Serialize the number of arguments
1778  _status = _logBuff.serializeFrom(static_cast<U8>(3));
1779  FW_ASSERT(
1780  _status == Fw::FW_SERIALIZE_OK,
1781  static_cast<FwAssertArgType>(_status)
1782  );
1783 #endif
1784 
1785 #if FW_AMPCS_COMPATIBLE
1786  // Serialize the argument size
1787  _status = _logBuff.serializeFrom(
1788  static_cast<U8>(sizeof(FwOpcodeType))
1789  );
1790  FW_ASSERT(
1791  _status == Fw::FW_SERIALIZE_OK,
1792  static_cast<FwAssertArgType>(_status)
1793  );
1794 #endif
1795  _status = _logBuff.serializeFrom(Opcode);
1796  FW_ASSERT(
1797  _status == Fw::FW_SERIALIZE_OK,
1798  static_cast<FwAssertArgType>(_status)
1799  );
1800 
1801 #if FW_AMPCS_COMPATIBLE
1802  // Serialize the argument size
1803  _status = _logBuff.serializeFrom(
1804  static_cast<U8>(sizeof(I32))
1805  );
1806  FW_ASSERT(
1807  _status == Fw::FW_SERIALIZE_OK,
1808  static_cast<FwAssertArgType>(_status)
1809  );
1810 #endif
1811  _status = _logBuff.serializeFrom(port);
1812  FW_ASSERT(
1813  _status == Fw::FW_SERIALIZE_OK,
1814  static_cast<FwAssertArgType>(_status)
1815  );
1816 
1817 #if FW_AMPCS_COMPATIBLE
1818  // Serialize the argument size
1819  _status = _logBuff.serializeFrom(
1820  static_cast<U8>(sizeof(I32))
1821  );
1822  FW_ASSERT(
1823  _status == Fw::FW_SERIALIZE_OK,
1824  static_cast<FwAssertArgType>(_status)
1825  );
1826 #endif
1827  _status = _logBuff.serializeFrom(slot);
1828  FW_ASSERT(
1829  _status == Fw::FW_SERIALIZE_OK,
1830  static_cast<FwAssertArgType>(_status)
1831  );
1832 
1833  this->Log_out(
1834  0,
1835  _id,
1836  _logTime,
1838  _logBuff
1839  );
1840  }
1841 
1842  // Emit the event on the text log port
1843 #if FW_ENABLE_TEXT_LOGGING
1844  if (this->isConnected_LogText_OutputPort(0)) {
1845 #if FW_OBJECT_NAMES == 1
1846  const char* _formatString =
1847  "(%s) %s: Opcode 0x%" PRIx32 " registered to port %" PRIi32 " slot %" PRIi32 "";
1848 #else
1849  const char* _formatString =
1850  "%s: Opcode 0x%" PRIx32 " registered to port %" PRIi32 " slot %" PRIi32 "";
1851 #endif
1852 
1853  Fw::TextLogString _logString;
1854  _logString.format(
1855  _formatString,
1856 #if FW_OBJECT_NAMES == 1
1857  this->m_objName.toChar(),
1858 #endif
1859  "OpCodeRegistered ",
1860  Opcode,
1861  port,
1862  slot
1863  );
1864 
1865  this->LogText_out(
1866  0,
1867  _id,
1868  _logTime,
1870  _logString
1871  );
1872  }
1873 #endif
1874  }
1875 
1878  FwOpcodeType Opcode,
1879  I32 port
1880  ) const
1881  {
1882  // Get the time
1883  Fw::Time _logTime;
1884  if (this->isConnected_Time_OutputPort(0)) {
1885  this->Time_out(0, _logTime);
1886  }
1887 
1888  const FwEventIdType _id = this->getIdBase() + EVENTID_OPCODEDISPATCHED;
1889 
1890  // Emit the event on the log port
1891  if (this->isConnected_Log_OutputPort(0)) {
1892  Fw::LogBuffer _logBuff;
1894 
1895 #if FW_AMPCS_COMPATIBLE
1896  // Serialize the number of arguments
1897  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1898  FW_ASSERT(
1899  _status == Fw::FW_SERIALIZE_OK,
1900  static_cast<FwAssertArgType>(_status)
1901  );
1902 #endif
1903 
1904 #if FW_AMPCS_COMPATIBLE
1905  // Serialize the argument size
1906  _status = _logBuff.serializeFrom(
1907  static_cast<U8>(sizeof(FwOpcodeType))
1908  );
1909  FW_ASSERT(
1910  _status == Fw::FW_SERIALIZE_OK,
1911  static_cast<FwAssertArgType>(_status)
1912  );
1913 #endif
1914  _status = _logBuff.serializeFrom(Opcode);
1915  FW_ASSERT(
1916  _status == Fw::FW_SERIALIZE_OK,
1917  static_cast<FwAssertArgType>(_status)
1918  );
1919 
1920 #if FW_AMPCS_COMPATIBLE
1921  // Serialize the argument size
1922  _status = _logBuff.serializeFrom(
1923  static_cast<U8>(sizeof(I32))
1924  );
1925  FW_ASSERT(
1926  _status == Fw::FW_SERIALIZE_OK,
1927  static_cast<FwAssertArgType>(_status)
1928  );
1929 #endif
1930  _status = _logBuff.serializeFrom(port);
1931  FW_ASSERT(
1932  _status == Fw::FW_SERIALIZE_OK,
1933  static_cast<FwAssertArgType>(_status)
1934  );
1935 
1936  this->Log_out(
1937  0,
1938  _id,
1939  _logTime,
1941  _logBuff
1942  );
1943  }
1944 
1945  // Emit the event on the text log port
1946 #if FW_ENABLE_TEXT_LOGGING
1947  if (this->isConnected_LogText_OutputPort(0)) {
1948 #if FW_OBJECT_NAMES == 1
1949  const char* _formatString =
1950  "(%s) %s: Opcode 0x%" PRIx32 " dispatched to port %" PRIi32 "";
1951 #else
1952  const char* _formatString =
1953  "%s: Opcode 0x%" PRIx32 " dispatched to port %" PRIi32 "";
1954 #endif
1955 
1956  Fw::TextLogString _logString;
1957  _logString.format(
1958  _formatString,
1959 #if FW_OBJECT_NAMES == 1
1960  this->m_objName.toChar(),
1961 #endif
1962  "OpCodeDispatched ",
1963  Opcode,
1964  port
1965  );
1966 
1967  this->LogText_out(
1968  0,
1969  _id,
1970  _logTime,
1972  _logString
1973  );
1974  }
1975 #endif
1976  }
1977 
1980  {
1981  // Get the time
1982  Fw::Time _logTime;
1983  if (this->isConnected_Time_OutputPort(0)) {
1984  this->Time_out(0, _logTime);
1985  }
1986 
1987  const FwEventIdType _id = this->getIdBase() + EVENTID_OPCODECOMPLETED;
1988 
1989  // Emit the event on the log port
1990  if (this->isConnected_Log_OutputPort(0)) {
1991  Fw::LogBuffer _logBuff;
1993 
1994 #if FW_AMPCS_COMPATIBLE
1995  // Serialize the number of arguments
1996  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1997  FW_ASSERT(
1998  _status == Fw::FW_SERIALIZE_OK,
1999  static_cast<FwAssertArgType>(_status)
2000  );
2001 #endif
2002 
2003 #if FW_AMPCS_COMPATIBLE
2004  // Serialize the argument size
2005  _status = _logBuff.serializeFrom(
2006  static_cast<U8>(sizeof(FwOpcodeType))
2007  );
2008  FW_ASSERT(
2009  _status == Fw::FW_SERIALIZE_OK,
2010  static_cast<FwAssertArgType>(_status)
2011  );
2012 #endif
2013  _status = _logBuff.serializeFrom(Opcode);
2014  FW_ASSERT(
2015  _status == Fw::FW_SERIALIZE_OK,
2016  static_cast<FwAssertArgType>(_status)
2017  );
2018 
2019  this->Log_out(
2020  0,
2021  _id,
2022  _logTime,
2024  _logBuff
2025  );
2026  }
2027 
2028  // Emit the event on the text log port
2029 #if FW_ENABLE_TEXT_LOGGING
2030  if (this->isConnected_LogText_OutputPort(0)) {
2031 #if FW_OBJECT_NAMES == 1
2032  const char* _formatString =
2033  "(%s) %s: Opcode 0x%" PRIx32 " completed";
2034 #else
2035  const char* _formatString =
2036  "%s: Opcode 0x%" PRIx32 " completed";
2037 #endif
2038 
2039  Fw::TextLogString _logString;
2040  _logString.format(
2041  _formatString,
2042 #if FW_OBJECT_NAMES == 1
2043  this->m_objName.toChar(),
2044 #endif
2045  "OpCodeCompleted ",
2046  Opcode
2047  );
2048 
2049  this->LogText_out(
2050  0,
2051  _id,
2052  _logTime,
2054  _logString
2055  );
2056  }
2057 #endif
2058  }
2059 
2062  FwOpcodeType Opcode,
2063  Fw::CmdResponse error
2064  ) const
2065  {
2066  // Get the time
2067  Fw::Time _logTime;
2068  if (this->isConnected_Time_OutputPort(0)) {
2069  this->Time_out(0, _logTime);
2070  }
2071 
2072  const FwEventIdType _id = this->getIdBase() + EVENTID_OPCODEERROR;
2073 
2074  // Emit the event on the log port
2075  if (this->isConnected_Log_OutputPort(0)) {
2076  Fw::LogBuffer _logBuff;
2078 
2079 #if FW_AMPCS_COMPATIBLE
2080  // Serialize the number of arguments
2081  _status = _logBuff.serializeFrom(static_cast<U8>(2));
2082  FW_ASSERT(
2083  _status == Fw::FW_SERIALIZE_OK,
2084  static_cast<FwAssertArgType>(_status)
2085  );
2086 #endif
2087 
2088 #if FW_AMPCS_COMPATIBLE
2089  // Serialize the argument size
2090  _status = _logBuff.serializeFrom(
2091  static_cast<U8>(sizeof(FwOpcodeType))
2092  );
2093  FW_ASSERT(
2094  _status == Fw::FW_SERIALIZE_OK,
2095  static_cast<FwAssertArgType>(_status)
2096  );
2097 #endif
2098  _status = _logBuff.serializeFrom(Opcode);
2099  FW_ASSERT(
2100  _status == Fw::FW_SERIALIZE_OK,
2101  static_cast<FwAssertArgType>(_status)
2102  );
2103 
2104 #if FW_AMPCS_COMPATIBLE
2105  // Serialize the argument size
2106  _status = _logBuff.serializeFrom(
2107  static_cast<U8>(Fw::CmdResponse::SERIALIZED_SIZE)
2108  );
2109  FW_ASSERT(
2110  _status == Fw::FW_SERIALIZE_OK,
2111  static_cast<FwAssertArgType>(_status)
2112  );
2113 #endif
2114  _status = _logBuff.serializeFrom(error);
2115  FW_ASSERT(
2116  _status == Fw::FW_SERIALIZE_OK,
2117  static_cast<FwAssertArgType>(_status)
2118  );
2119 
2120  this->Log_out(
2121  0,
2122  _id,
2123  _logTime,
2125  _logBuff
2126  );
2127  }
2128 
2129  // Emit the event on the text log port
2130 #if FW_ENABLE_TEXT_LOGGING
2131  if (this->isConnected_LogText_OutputPort(0)) {
2132 #if FW_OBJECT_NAMES == 1
2133  const char* _formatString =
2134  "(%s) %s: Opcode 0x%" PRIx32 " completed with error %s";
2135 #else
2136  const char* _formatString =
2137  "%s: Opcode 0x%" PRIx32 " completed with error %s";
2138 #endif
2139 
2140  Fw::String errorStr;
2141  error.toString(errorStr);
2142 
2143  Fw::TextLogString _logString;
2144  _logString.format(
2145  _formatString,
2146 #if FW_OBJECT_NAMES == 1
2147  this->m_objName.toChar(),
2148 #endif
2149  "OpCodeError ",
2150  Opcode,
2151  errorStr.toChar()
2152  );
2153 
2154  this->LogText_out(
2155  0,
2156  _id,
2157  _logTime,
2159  _logString
2160  );
2161  }
2162 #endif
2163  }
2164 
2167  {
2168  // Get the time
2169  Fw::Time _logTime;
2170  if (this->isConnected_Time_OutputPort(0)) {
2171  this->Time_out(0, _logTime);
2172  }
2173 
2174  const FwEventIdType _id = this->getIdBase() + EVENTID_MALFORMEDCOMMAND;
2175 
2176  // Emit the event on the log port
2177  if (this->isConnected_Log_OutputPort(0)) {
2178  Fw::LogBuffer _logBuff;
2180 
2181 #if FW_AMPCS_COMPATIBLE
2182  // Serialize the number of arguments
2183  _status = _logBuff.serializeFrom(static_cast<U8>(1));
2184  FW_ASSERT(
2185  _status == Fw::FW_SERIALIZE_OK,
2186  static_cast<FwAssertArgType>(_status)
2187  );
2188 #endif
2189 
2190 #if FW_AMPCS_COMPATIBLE
2191  // Serialize the argument size
2192  _status = _logBuff.serializeFrom(
2193  static_cast<U8>(Fw::DeserialStatus::SERIALIZED_SIZE)
2194  );
2195  FW_ASSERT(
2196  _status == Fw::FW_SERIALIZE_OK,
2197  static_cast<FwAssertArgType>(_status)
2198  );
2199 #endif
2200  _status = _logBuff.serializeFrom(Status);
2201  FW_ASSERT(
2202  _status == Fw::FW_SERIALIZE_OK,
2203  static_cast<FwAssertArgType>(_status)
2204  );
2205 
2206  this->Log_out(
2207  0,
2208  _id,
2209  _logTime,
2211  _logBuff
2212  );
2213  }
2214 
2215  // Emit the event on the text log port
2216 #if FW_ENABLE_TEXT_LOGGING
2217  if (this->isConnected_LogText_OutputPort(0)) {
2218 #if FW_OBJECT_NAMES == 1
2219  const char* _formatString =
2220  "(%s) %s: Received malformed command packet. Status: %s";
2221 #else
2222  const char* _formatString =
2223  "%s: Received malformed command packet. Status: %s";
2224 #endif
2225 
2226  Fw::String StatusStr;
2227  Status.toString(StatusStr);
2228 
2229  Fw::TextLogString _logString;
2230  _logString.format(
2231  _formatString,
2232 #if FW_OBJECT_NAMES == 1
2233  this->m_objName.toChar(),
2234 #endif
2235  "MalformedCommand ",
2236  StatusStr.toChar()
2237  );
2238 
2239  this->LogText_out(
2240  0,
2241  _id,
2242  _logTime,
2244  _logString
2245  );
2246  }
2247 #endif
2248  }
2249 
2252  {
2253  // Get the time
2254  Fw::Time _logTime;
2255  if (this->isConnected_Time_OutputPort(0)) {
2256  this->Time_out(0, _logTime);
2257  }
2258 
2259  const FwEventIdType _id = this->getIdBase() + EVENTID_INVALIDCOMMAND;
2260 
2261  // Emit the event on the log port
2262  if (this->isConnected_Log_OutputPort(0)) {
2263  Fw::LogBuffer _logBuff;
2265 
2266 #if FW_AMPCS_COMPATIBLE
2267  // Serialize the number of arguments
2268  _status = _logBuff.serializeFrom(static_cast<U8>(1));
2269  FW_ASSERT(
2270  _status == Fw::FW_SERIALIZE_OK,
2271  static_cast<FwAssertArgType>(_status)
2272  );
2273 #endif
2274 
2275 #if FW_AMPCS_COMPATIBLE
2276  // Serialize the argument size
2277  _status = _logBuff.serializeFrom(
2278  static_cast<U8>(sizeof(FwOpcodeType))
2279  );
2280  FW_ASSERT(
2281  _status == Fw::FW_SERIALIZE_OK,
2282  static_cast<FwAssertArgType>(_status)
2283  );
2284 #endif
2285  _status = _logBuff.serializeFrom(Opcode);
2286  FW_ASSERT(
2287  _status == Fw::FW_SERIALIZE_OK,
2288  static_cast<FwAssertArgType>(_status)
2289  );
2290 
2291  this->Log_out(
2292  0,
2293  _id,
2294  _logTime,
2296  _logBuff
2297  );
2298  }
2299 
2300  // Emit the event on the text log port
2301 #if FW_ENABLE_TEXT_LOGGING
2302  if (this->isConnected_LogText_OutputPort(0)) {
2303 #if FW_OBJECT_NAMES == 1
2304  const char* _formatString =
2305  "(%s) %s: Invalid opcode 0x%" PRIx32 " received";
2306 #else
2307  const char* _formatString =
2308  "%s: Invalid opcode 0x%" PRIx32 " received";
2309 #endif
2310 
2311  Fw::TextLogString _logString;
2312  _logString.format(
2313  _formatString,
2314 #if FW_OBJECT_NAMES == 1
2315  this->m_objName.toChar(),
2316 #endif
2317  "InvalidCommand ",
2318  Opcode
2319  );
2320 
2321  this->LogText_out(
2322  0,
2323  _id,
2324  _logTime,
2326  _logString
2327  );
2328  }
2329 #endif
2330  }
2331 
2334  {
2335  // Get the time
2336  Fw::Time _logTime;
2337  if (this->isConnected_Time_OutputPort(0)) {
2338  this->Time_out(0, _logTime);
2339  }
2340 
2341  const FwEventIdType _id = this->getIdBase() + EVENTID_TOOMANYCOMMANDS;
2342 
2343  // Emit the event on the log port
2344  if (this->isConnected_Log_OutputPort(0)) {
2345  Fw::LogBuffer _logBuff;
2347 
2348 #if FW_AMPCS_COMPATIBLE
2349  // Serialize the number of arguments
2350  _status = _logBuff.serializeFrom(static_cast<U8>(1));
2351  FW_ASSERT(
2352  _status == Fw::FW_SERIALIZE_OK,
2353  static_cast<FwAssertArgType>(_status)
2354  );
2355 #endif
2356 
2357 #if FW_AMPCS_COMPATIBLE
2358  // Serialize the argument size
2359  _status = _logBuff.serializeFrom(
2360  static_cast<U8>(sizeof(FwOpcodeType))
2361  );
2362  FW_ASSERT(
2363  _status == Fw::FW_SERIALIZE_OK,
2364  static_cast<FwAssertArgType>(_status)
2365  );
2366 #endif
2367  _status = _logBuff.serializeFrom(Opcode);
2368  FW_ASSERT(
2369  _status == Fw::FW_SERIALIZE_OK,
2370  static_cast<FwAssertArgType>(_status)
2371  );
2372 
2373  this->Log_out(
2374  0,
2375  _id,
2376  _logTime,
2378  _logBuff
2379  );
2380  }
2381 
2382  // Emit the event on the text log port
2383 #if FW_ENABLE_TEXT_LOGGING
2384  if (this->isConnected_LogText_OutputPort(0)) {
2385 #if FW_OBJECT_NAMES == 1
2386  const char* _formatString =
2387  "(%s) %s: Too many outstanding commands. opcode=0x%" PRIx32 "";
2388 #else
2389  const char* _formatString =
2390  "%s: Too many outstanding commands. opcode=0x%" PRIx32 "";
2391 #endif
2392 
2393  Fw::TextLogString _logString;
2394  _logString.format(
2395  _formatString,
2396 #if FW_OBJECT_NAMES == 1
2397  this->m_objName.toChar(),
2398 #endif
2399  "TooManyCommands ",
2400  Opcode
2401  );
2402 
2403  this->LogText_out(
2404  0,
2405  _id,
2406  _logTime,
2408  _logString
2409  );
2410  }
2411 #endif
2412  }
2413 
2416  {
2417  // Get the time
2418  Fw::Time _logTime;
2419  if (this->isConnected_Time_OutputPort(0)) {
2420  this->Time_out(0, _logTime);
2421  }
2422 
2423  const FwEventIdType _id = this->getIdBase() + EVENTID_NOOPRECEIVED;
2424 
2425  // Emit the event on the log port
2426  if (this->isConnected_Log_OutputPort(0)) {
2427  Fw::LogBuffer _logBuff;
2428 
2429 #if FW_AMPCS_COMPATIBLE
2431  // Serialize the number of arguments
2432  _status = _logBuff.serializeFrom(static_cast<U8>(0));
2433  FW_ASSERT(
2434  _status == Fw::FW_SERIALIZE_OK,
2435  static_cast<FwAssertArgType>(_status)
2436  );
2437 #endif
2438 
2439  this->Log_out(
2440  0,
2441  _id,
2442  _logTime,
2444  _logBuff
2445  );
2446  }
2447 
2448  // Emit the event on the text log port
2449 #if FW_ENABLE_TEXT_LOGGING
2450  if (this->isConnected_LogText_OutputPort(0)) {
2451 #if FW_OBJECT_NAMES == 1
2452  const char* _formatString =
2453  "(%s) %s: Received a NO-OP command";
2454 #else
2455  const char* _formatString =
2456  "%s: Received a NO-OP command";
2457 #endif
2458 
2459  Fw::TextLogString _logString;
2460  _logString.format(
2461  _formatString,
2462 #if FW_OBJECT_NAMES == 1
2463  this->m_objName.toChar(),
2464 #endif
2465  "NoOpReceived "
2466  );
2467 
2468  this->LogText_out(
2469  0,
2470  _id,
2471  _logTime,
2473  _logString
2474  );
2475  }
2476 #endif
2477  }
2478 
2481  {
2482  // Get the time
2483  Fw::Time _logTime;
2484  if (this->isConnected_Time_OutputPort(0)) {
2485  this->Time_out(0, _logTime);
2486  }
2487 
2488  const FwEventIdType _id = this->getIdBase() + EVENTID_NOOPSTRINGRECEIVED;
2489 
2490  // Emit the event on the log port
2491  if (this->isConnected_Log_OutputPort(0)) {
2492  Fw::LogBuffer _logBuff;
2494 
2495 #if FW_AMPCS_COMPATIBLE
2496  // Serialize the number of arguments
2497  _status = _logBuff.serializeFrom(static_cast<U8>(1));
2498  FW_ASSERT(
2499  _status == Fw::FW_SERIALIZE_OK,
2500  static_cast<FwAssertArgType>(_status)
2501  );
2502 #endif
2503 
2504  _status = message.serializeTo(
2505  _logBuff,
2506  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 40)
2507  );
2508  FW_ASSERT(
2509  _status == Fw::FW_SERIALIZE_OK,
2510  static_cast<FwAssertArgType>(_status)
2511  );
2512 
2513  this->Log_out(
2514  0,
2515  _id,
2516  _logTime,
2518  _logBuff
2519  );
2520  }
2521 
2522  // Emit the event on the text log port
2523 #if FW_ENABLE_TEXT_LOGGING
2524  if (this->isConnected_LogText_OutputPort(0)) {
2525 #if FW_OBJECT_NAMES == 1
2526  const char* _formatString =
2527  "(%s) %s: Received a NO-OP string=%s";
2528 #else
2529  const char* _formatString =
2530  "%s: Received a NO-OP string=%s";
2531 #endif
2532 
2533  Fw::TextLogString _logString;
2534  _logString.format(
2535  _formatString,
2536 #if FW_OBJECT_NAMES == 1
2537  this->m_objName.toChar(),
2538 #endif
2539  "NoOpStringReceived ",
2540  message.toChar()
2541  );
2542 
2543  this->LogText_out(
2544  0,
2545  _id,
2546  _logTime,
2548  _logString
2549  );
2550  }
2551 #endif
2552  }
2553 
2556  I32 arg1,
2557  F32 arg2,
2558  U8 arg3
2559  ) const
2560  {
2561  // Get the time
2562  Fw::Time _logTime;
2563  if (this->isConnected_Time_OutputPort(0)) {
2564  this->Time_out(0, _logTime);
2565  }
2566 
2567  const FwEventIdType _id = this->getIdBase() + EVENTID_TESTCMD1ARGS;
2568 
2569  // Emit the event on the log port
2570  if (this->isConnected_Log_OutputPort(0)) {
2571  Fw::LogBuffer _logBuff;
2573 
2574 #if FW_AMPCS_COMPATIBLE
2575  // Serialize the number of arguments
2576  _status = _logBuff.serializeFrom(static_cast<U8>(3));
2577  FW_ASSERT(
2578  _status == Fw::FW_SERIALIZE_OK,
2579  static_cast<FwAssertArgType>(_status)
2580  );
2581 #endif
2582 
2583 #if FW_AMPCS_COMPATIBLE
2584  // Serialize the argument size
2585  _status = _logBuff.serializeFrom(
2586  static_cast<U8>(sizeof(I32))
2587  );
2588  FW_ASSERT(
2589  _status == Fw::FW_SERIALIZE_OK,
2590  static_cast<FwAssertArgType>(_status)
2591  );
2592 #endif
2593  _status = _logBuff.serializeFrom(arg1);
2594  FW_ASSERT(
2595  _status == Fw::FW_SERIALIZE_OK,
2596  static_cast<FwAssertArgType>(_status)
2597  );
2598 
2599 #if FW_AMPCS_COMPATIBLE
2600  // Serialize the argument size
2601  _status = _logBuff.serializeFrom(
2602  static_cast<U8>(sizeof(F32))
2603  );
2604  FW_ASSERT(
2605  _status == Fw::FW_SERIALIZE_OK,
2606  static_cast<FwAssertArgType>(_status)
2607  );
2608 #endif
2609  _status = _logBuff.serializeFrom(arg2);
2610  FW_ASSERT(
2611  _status == Fw::FW_SERIALIZE_OK,
2612  static_cast<FwAssertArgType>(_status)
2613  );
2614 
2615 #if FW_AMPCS_COMPATIBLE
2616  // Serialize the argument size
2617  _status = _logBuff.serializeFrom(
2618  static_cast<U8>(sizeof(U8))
2619  );
2620  FW_ASSERT(
2621  _status == Fw::FW_SERIALIZE_OK,
2622  static_cast<FwAssertArgType>(_status)
2623  );
2624 #endif
2625  _status = _logBuff.serializeFrom(arg3);
2626  FW_ASSERT(
2627  _status == Fw::FW_SERIALIZE_OK,
2628  static_cast<FwAssertArgType>(_status)
2629  );
2630 
2631  this->Log_out(
2632  0,
2633  _id,
2634  _logTime,
2636  _logBuff
2637  );
2638  }
2639 
2640  // Emit the event on the text log port
2641 #if FW_ENABLE_TEXT_LOGGING
2642  if (this->isConnected_LogText_OutputPort(0)) {
2643 #if FW_OBJECT_NAMES == 1
2644  const char* _formatString =
2645  "(%s) %s: TEST_CMD_1 args: I32: %" PRIi32 ", F32: %f, U8: %" PRIu8 "";
2646 #else
2647  const char* _formatString =
2648  "%s: TEST_CMD_1 args: I32: %" PRIi32 ", F32: %f, U8: %" PRIu8 "";
2649 #endif
2650 
2651  Fw::TextLogString _logString;
2652  _logString.format(
2653  _formatString,
2654 #if FW_OBJECT_NAMES == 1
2655  this->m_objName.toChar(),
2656 #endif
2657  "TestCmd1Args ",
2658  arg1,
2659  static_cast<F64>(arg2),
2660  arg3
2661  );
2662 
2663  this->LogText_out(
2664  0,
2665  _id,
2666  _logTime,
2668  _logString
2669  );
2670  }
2671 #endif
2672  }
2673 
2676  FwOpcodeType Opcode,
2677  I32 port
2678  ) const
2679  {
2680  // Get the time
2681  Fw::Time _logTime;
2682  if (this->isConnected_Time_OutputPort(0)) {
2683  this->Time_out(0, _logTime);
2684  }
2685 
2686  const FwEventIdType _id = this->getIdBase() + EVENTID_OPCODEREREGISTERED;
2687 
2688  // Emit the event on the log port
2689  if (this->isConnected_Log_OutputPort(0)) {
2690  Fw::LogBuffer _logBuff;
2692 
2693 #if FW_AMPCS_COMPATIBLE
2694  // Serialize the number of arguments
2695  _status = _logBuff.serializeFrom(static_cast<U8>(2));
2696  FW_ASSERT(
2697  _status == Fw::FW_SERIALIZE_OK,
2698  static_cast<FwAssertArgType>(_status)
2699  );
2700 #endif
2701 
2702 #if FW_AMPCS_COMPATIBLE
2703  // Serialize the argument size
2704  _status = _logBuff.serializeFrom(
2705  static_cast<U8>(sizeof(FwOpcodeType))
2706  );
2707  FW_ASSERT(
2708  _status == Fw::FW_SERIALIZE_OK,
2709  static_cast<FwAssertArgType>(_status)
2710  );
2711 #endif
2712  _status = _logBuff.serializeFrom(Opcode);
2713  FW_ASSERT(
2714  _status == Fw::FW_SERIALIZE_OK,
2715  static_cast<FwAssertArgType>(_status)
2716  );
2717 
2718 #if FW_AMPCS_COMPATIBLE
2719  // Serialize the argument size
2720  _status = _logBuff.serializeFrom(
2721  static_cast<U8>(sizeof(I32))
2722  );
2723  FW_ASSERT(
2724  _status == Fw::FW_SERIALIZE_OK,
2725  static_cast<FwAssertArgType>(_status)
2726  );
2727 #endif
2728  _status = _logBuff.serializeFrom(port);
2729  FW_ASSERT(
2730  _status == Fw::FW_SERIALIZE_OK,
2731  static_cast<FwAssertArgType>(_status)
2732  );
2733 
2734  this->Log_out(
2735  0,
2736  _id,
2737  _logTime,
2739  _logBuff
2740  );
2741  }
2742 
2743  // Emit the event on the text log port
2744 #if FW_ENABLE_TEXT_LOGGING
2745  if (this->isConnected_LogText_OutputPort(0)) {
2746 #if FW_OBJECT_NAMES == 1
2747  const char* _formatString =
2748  "(%s) %s: Opcode 0x%" PRIx32 " is already registered to port %" PRIi32 "";
2749 #else
2750  const char* _formatString =
2751  "%s: Opcode 0x%" PRIx32 " is already registered to port %" PRIi32 "";
2752 #endif
2753 
2754  Fw::TextLogString _logString;
2755  _logString.format(
2756  _formatString,
2757 #if FW_OBJECT_NAMES == 1
2758  this->m_objName.toChar(),
2759 #endif
2760  "OpCodeReregistered ",
2761  Opcode,
2762  port
2763  );
2764 
2765  this->LogText_out(
2766  0,
2767  _id,
2768  _logTime,
2770  _logString
2771  );
2772  }
2773 #endif
2774  }
2775 
2778  FwOpcodeType OpCode,
2779  U32 Context
2780  )
2781  {
2782  // Check throttle value
2783  if (this->m_CommandDroppedQueueOverflowThrottle >= EVENTID_COMMANDDROPPEDQUEUEOVERFLOW_THROTTLE) {
2784  return;
2785  }
2786  else {
2787  this->m_CommandDroppedQueueOverflowThrottle++;
2788  }
2789 
2790  // Get the time
2791  Fw::Time _logTime;
2792  if (this->isConnected_Time_OutputPort(0)) {
2793  this->Time_out(0, _logTime);
2794  }
2795 
2797 
2798  // Emit the event on the log port
2799  if (this->isConnected_Log_OutputPort(0)) {
2800  Fw::LogBuffer _logBuff;
2802 
2803 #if FW_AMPCS_COMPATIBLE
2804  // Serialize the number of arguments
2805  _status = _logBuff.serializeFrom(static_cast<U8>(2));
2806  FW_ASSERT(
2807  _status == Fw::FW_SERIALIZE_OK,
2808  static_cast<FwAssertArgType>(_status)
2809  );
2810 #endif
2811 
2812 #if FW_AMPCS_COMPATIBLE
2813  // Serialize the argument size
2814  _status = _logBuff.serializeFrom(
2815  static_cast<U8>(sizeof(FwOpcodeType))
2816  );
2817  FW_ASSERT(
2818  _status == Fw::FW_SERIALIZE_OK,
2819  static_cast<FwAssertArgType>(_status)
2820  );
2821 #endif
2822  _status = _logBuff.serializeFrom(OpCode);
2823  FW_ASSERT(
2824  _status == Fw::FW_SERIALIZE_OK,
2825  static_cast<FwAssertArgType>(_status)
2826  );
2827 
2828 #if FW_AMPCS_COMPATIBLE
2829  // Serialize the argument size
2830  _status = _logBuff.serializeFrom(
2831  static_cast<U8>(sizeof(U32))
2832  );
2833  FW_ASSERT(
2834  _status == Fw::FW_SERIALIZE_OK,
2835  static_cast<FwAssertArgType>(_status)
2836  );
2837 #endif
2838  _status = _logBuff.serializeFrom(Context);
2839  FW_ASSERT(
2840  _status == Fw::FW_SERIALIZE_OK,
2841  static_cast<FwAssertArgType>(_status)
2842  );
2843 
2844  this->Log_out(
2845  0,
2846  _id,
2847  _logTime,
2849  _logBuff
2850  );
2851  }
2852 
2853  // Emit the event on the text log port
2854 #if FW_ENABLE_TEXT_LOGGING
2855  if (this->isConnected_LogText_OutputPort(0)) {
2856 #if FW_OBJECT_NAMES == 1
2857  const char* _formatString =
2858  "(%s) %s: Opcode 0x%" PRIx32 " was dropped due to buffer overflow and not processed. Context %" PRIu32 "";
2859 #else
2860  const char* _formatString =
2861  "%s: Opcode 0x%" PRIx32 " was dropped due to buffer overflow and not processed. Context %" PRIu32 "";
2862 #endif
2863 
2864  Fw::TextLogString _logString;
2865  _logString.format(
2866  _formatString,
2867 #if FW_OBJECT_NAMES == 1
2868  this->m_objName.toChar(),
2869 #endif
2870  "CommandDroppedQueueOverflow ",
2871  OpCode,
2872  Context
2873  );
2874 
2875  this->LogText_out(
2876  0,
2877  _id,
2878  _logTime,
2880  _logString
2881  );
2882  }
2883 #endif
2884  }
2885 
2886  // ----------------------------------------------------------------------
2887  // Event throttle reset functions
2888  // ----------------------------------------------------------------------
2889 
2892  {
2893  // Reset throttle counter
2894  this->m_CommandDroppedQueueOverflowThrottle = 0;
2895  }
2896 
2897  // ----------------------------------------------------------------------
2898  // Telemetry serialized write
2899  // ----------------------------------------------------------------------
2900 
2903  FwChanIdType id,
2904  Fw::TlmBuffer& _tlmBuff,
2905  Fw::Time _tlmTime
2906  ) const
2907  {
2908  if (this->isConnected_Tlm_OutputPort(0)) {
2909  if (
2910  this->isConnected_Time_OutputPort(0) &&
2911  (_tlmTime == Fw::ZERO_TIME)
2912  ) {
2913  this->Time_out(0, _tlmTime);
2914  }
2915 
2916  FwChanIdType _id;
2917  _id = this->getIdBase() + id;
2918 
2919  this->Tlm_out(
2920  0,
2921  _id,
2922  _tlmTime,
2923  _tlmBuff
2924  );
2925  }
2926  }
2927 
2928  // ----------------------------------------------------------------------
2929  // Telemetry write functions
2930  // ----------------------------------------------------------------------
2931 
2934  U32 arg,
2935  Fw::Time _tlmTime
2936  )
2937  {
2938  // Check to see if it is the first time
2939  if (not this->m_first_update_CommandsDispatched) {
2940  // Check to see if value has changed. If not, don't write it.
2941  if (arg == this->m_last_CommandsDispatched) {
2942  return;
2943  }
2944  else {
2945  this->m_last_CommandsDispatched = arg;
2946  }
2947  }
2948  else {
2949  this->m_first_update_CommandsDispatched = false;
2950  this->m_last_CommandsDispatched = arg;
2951  }
2952 
2953  if (this->isConnected_Tlm_OutputPort(0)) {
2954  Fw::TlmBuffer _tlmBuff;
2955  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
2956  FW_ASSERT(
2957  _stat == Fw::FW_SERIALIZE_OK,
2958  static_cast<FwAssertArgType>(_stat)
2959  );
2960 
2961  this->tlmWrite(
2963  _tlmBuff,
2964  _tlmTime
2965  );
2966  }
2967  }
2968 
2971  U32 arg,
2972  Fw::Time _tlmTime
2973  )
2974  {
2975  // Check to see if it is the first time
2976  if (not this->m_first_update_CommandErrors) {
2977  // Check to see if value has changed. If not, don't write it.
2978  if (arg == this->m_last_CommandErrors) {
2979  return;
2980  }
2981  else {
2982  this->m_last_CommandErrors = arg;
2983  }
2984  }
2985  else {
2986  this->m_first_update_CommandErrors = false;
2987  this->m_last_CommandErrors = arg;
2988  }
2989 
2990  if (this->isConnected_Tlm_OutputPort(0)) {
2991  Fw::TlmBuffer _tlmBuff;
2992  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
2993  FW_ASSERT(
2994  _stat == Fw::FW_SERIALIZE_OK,
2995  static_cast<FwAssertArgType>(_stat)
2996  );
2997 
2998  this->tlmWrite(
3000  _tlmBuff,
3001  _tlmTime
3002  );
3003  }
3004  }
3005 
3008  U32 arg,
3009  Fw::Time _tlmTime
3010  )
3011  {
3012  // Check to see if it is the first time
3013  if (not this->m_first_update_CommandsDropped) {
3014  // Check to see if value has changed. If not, don't write it.
3015  if (arg == this->m_last_CommandsDropped) {
3016  return;
3017  }
3018  else {
3019  this->m_last_CommandsDropped = arg;
3020  }
3021  }
3022  else {
3023  this->m_first_update_CommandsDropped = false;
3024  this->m_last_CommandsDropped = arg;
3025  }
3026 
3027  if (this->isConnected_Tlm_OutputPort(0)) {
3028  Fw::TlmBuffer _tlmBuff;
3029  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
3030  FW_ASSERT(
3031  _stat == Fw::FW_SERIALIZE_OK,
3032  static_cast<FwAssertArgType>(_stat)
3033  );
3034 
3035  this->tlmWrite(
3037  _tlmBuff,
3038  _tlmTime
3039  );
3040  }
3041  }
3042 
3043  // ----------------------------------------------------------------------
3044  // Time
3045  // ----------------------------------------------------------------------
3046 
3048  getTime() const
3049  {
3050  if (this->isConnected_Time_OutputPort(0)) {
3051  Fw::Time _time;
3052  this->Time_out(0, _time);
3053  return _time;
3054  }
3055  else {
3056  return Fw::Time(TimeBase::TB_NONE, 0, 0);
3057  }
3058  }
3059 
3060  // ----------------------------------------------------------------------
3061  // Mutex operations for guarded ports
3062  //
3063  // You can override these operations to provide more sophisticated
3064  // synchronization
3065  // ----------------------------------------------------------------------
3066 
3069  {
3070  this->m_guardedPortMutex.lock();
3071  }
3072 
3075  {
3076  this->m_guardedPortMutex.unLock();
3077  }
3078 
3079  // ----------------------------------------------------------------------
3080  // Message dispatch functions
3081  // ----------------------------------------------------------------------
3082 
3083  Fw::QueuedComponentBase::MsgDispatchStatus CommandDispatcherComponentBase ::
3084  doDispatch()
3085  {
3086  ComponentIpcSerializableBuffer _msg;
3087  FwQueuePriorityType _priority = 0;
3088 
3089  Os::Queue::Status _msgStatus = this->m_queue.receive(
3090  _msg,
3092  _priority
3093  );
3094  FW_ASSERT(
3095  _msgStatus == Os::Queue::OP_OK,
3096  static_cast<FwAssertArgType>(_msgStatus)
3097  );
3098 
3099  // Reset to beginning of buffer
3100  _msg.resetDeser();
3101 
3102  FwEnumStoreType _desMsg = 0;
3103  Fw::SerializeStatus _deserStatus = _msg.deserializeTo(_desMsg);
3104  FW_ASSERT(
3105  _deserStatus == Fw::FW_SERIALIZE_OK,
3106  static_cast<FwAssertArgType>(_deserStatus)
3107  );
3108 
3109  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
3110 
3111  if (_msgType == COMMANDDISPATCHER_COMPONENT_EXIT) {
3112  return MSG_DISPATCH_EXIT;
3113  }
3114 
3115  FwIndexType portNum = 0;
3116  _deserStatus = _msg.deserializeTo(portNum);
3117  FW_ASSERT(
3118  _deserStatus == Fw::FW_SERIALIZE_OK,
3119  static_cast<FwAssertArgType>(_deserStatus)
3120  );
3121 
3122  switch (_msgType) {
3123  // Handle async input port compCmdStat
3124  case COMPCMDSTAT_CMDRESPONSE: {
3125  // Deserialize argument opCode
3126  FwOpcodeType opCode;
3127  _deserStatus = _msg.deserializeTo(opCode);
3128  FW_ASSERT(
3129  _deserStatus == Fw::FW_SERIALIZE_OK,
3130  static_cast<FwAssertArgType>(_deserStatus)
3131  );
3132 
3133  // Deserialize argument cmdSeq
3134  U32 cmdSeq;
3135  _deserStatus = _msg.deserializeTo(cmdSeq);
3136  FW_ASSERT(
3137  _deserStatus == Fw::FW_SERIALIZE_OK,
3138  static_cast<FwAssertArgType>(_deserStatus)
3139  );
3140 
3141  // Deserialize argument response
3142  Fw::CmdResponse response;
3143  _deserStatus = _msg.deserializeTo(response);
3144  FW_ASSERT(
3145  _deserStatus == Fw::FW_SERIALIZE_OK,
3146  static_cast<FwAssertArgType>(_deserStatus)
3147  );
3148  // Call handler function
3149  this->compCmdStat_handler(
3150  portNum,
3151  opCode,
3152  cmdSeq,
3153  response
3154  );
3155 
3156  break;
3157  }
3158 
3159  // Handle async input port pingIn
3160  case PINGIN_PING: {
3161  // Deserialize argument key
3162  U32 key;
3163  _deserStatus = _msg.deserializeTo(key);
3164  FW_ASSERT(
3165  _deserStatus == Fw::FW_SERIALIZE_OK,
3166  static_cast<FwAssertArgType>(_deserStatus)
3167  );
3168  // Call handler function
3169  this->pingIn_handler(
3170  portNum,
3171  key
3172  );
3173 
3174  break;
3175  }
3176 
3177  // Handle async input port run
3178  case RUN_SCHED: {
3179  // Deserialize argument context
3180  U32 context;
3181  _deserStatus = _msg.deserializeTo(context);
3182  FW_ASSERT(
3183  _deserStatus == Fw::FW_SERIALIZE_OK,
3184  static_cast<FwAssertArgType>(_deserStatus)
3185  );
3186  // Call handler function
3187  this->run_handler(
3188  portNum,
3189  context
3190  );
3191 
3192  break;
3193  }
3194 
3195  // Handle async input port seqCmdBuff
3196  case SEQCMDBUFF_COM: {
3197  // Deserialize argument data
3198  Fw::ComBuffer data;
3199  _deserStatus = _msg.deserializeTo(data);
3200  FW_ASSERT(
3201  _deserStatus == Fw::FW_SERIALIZE_OK,
3202  static_cast<FwAssertArgType>(_deserStatus)
3203  );
3204 
3205  // Deserialize argument context
3206  U32 context;
3207  _deserStatus = _msg.deserializeTo(context);
3208  FW_ASSERT(
3209  _deserStatus == Fw::FW_SERIALIZE_OK,
3210  static_cast<FwAssertArgType>(_deserStatus)
3211  );
3212  // Call handler function
3213  this->seqCmdBuff_handler(
3214  portNum,
3215  data,
3216  context
3217  );
3218 
3219  break;
3220  }
3221 
3222  // Handle command CMD_NO_OP
3223  case CMD_CMD_NO_OP: {
3224  // Deserialize opcode
3225  FwOpcodeType _opCode = 0;
3226  _deserStatus = _msg.deserializeTo(_opCode);
3227  FW_ASSERT (
3228  _deserStatus == Fw::FW_SERIALIZE_OK,
3229  static_cast<FwAssertArgType>(_deserStatus)
3230  );
3231 
3232  // Deserialize command sequence
3233  U32 _cmdSeq = 0;
3234  _deserStatus = _msg.deserializeTo(_cmdSeq);
3235  FW_ASSERT (
3236  _deserStatus == Fw::FW_SERIALIZE_OK,
3237  static_cast<FwAssertArgType>(_deserStatus)
3238  );
3239 
3240  // Deserialize command argument buffer
3241  Fw::CmdArgBuffer args;
3242  _deserStatus = _msg.deserializeTo(args);
3243  FW_ASSERT (
3244  _deserStatus == Fw::FW_SERIALIZE_OK,
3245  static_cast<FwAssertArgType>(_deserStatus)
3246  );
3247 
3248  // Reset buffer
3249  args.resetDeser();
3250 
3251  // Make sure there was no data left over.
3252  // That means the argument buffer size was incorrect.
3253 #if FW_CMD_CHECK_RESIDUAL
3254  if (args.getDeserializeSizeLeft() != 0) {
3255  if (this->isConnected_CmdStatus_OutputPort(0)) {
3256  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
3257  }
3258  // Don't crash the task if bad arguments were passed from the ground
3259  break;
3260  }
3261 #endif
3262 
3263  // Call handler function
3264  this->CMD_NO_OP_cmdHandler(_opCode, _cmdSeq);
3265 
3266  break;
3267  }
3268 
3269  // Handle command CMD_NO_OP_STRING
3270  case CMD_CMD_NO_OP_STRING: {
3271  // Deserialize opcode
3272  FwOpcodeType _opCode = 0;
3273  _deserStatus = _msg.deserializeTo(_opCode);
3274  FW_ASSERT (
3275  _deserStatus == Fw::FW_SERIALIZE_OK,
3276  static_cast<FwAssertArgType>(_deserStatus)
3277  );
3278 
3279  // Deserialize command sequence
3280  U32 _cmdSeq = 0;
3281  _deserStatus = _msg.deserializeTo(_cmdSeq);
3282  FW_ASSERT (
3283  _deserStatus == Fw::FW_SERIALIZE_OK,
3284  static_cast<FwAssertArgType>(_deserStatus)
3285  );
3286 
3287  // Deserialize command argument buffer
3288  Fw::CmdArgBuffer args;
3289  _deserStatus = _msg.deserializeTo(args);
3290  FW_ASSERT (
3291  _deserStatus == Fw::FW_SERIALIZE_OK,
3292  static_cast<FwAssertArgType>(_deserStatus)
3293  );
3294 
3295  // Reset buffer
3296  args.resetDeser();
3297 
3298  // Deserialize argument arg1
3299  Fw::CmdStringArg arg1;
3300  _deserStatus = args.deserializeTo(arg1);
3301  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
3302  if (this->isConnected_CmdStatus_OutputPort(0)) {
3303  this->cmdResponse_out(
3304  _opCode,
3305  _cmdSeq,
3307  );
3308  }
3309  // Don't crash the task if bad arguments were passed from the ground
3310  break;
3311  }
3312 
3313  // Make sure there was no data left over.
3314  // That means the argument buffer size was incorrect.
3315 #if FW_CMD_CHECK_RESIDUAL
3316  if (args.getDeserializeSizeLeft() != 0) {
3317  if (this->isConnected_CmdStatus_OutputPort(0)) {
3318  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
3319  }
3320  // Don't crash the task if bad arguments were passed from the ground
3321  break;
3322  }
3323 #endif
3324 
3325  // Call handler function
3327  _opCode, _cmdSeq,
3328  arg1
3329  );
3330 
3331  break;
3332  }
3333 
3334  // Handle command CMD_TEST_CMD_1
3335  case CMD_CMD_TEST_CMD_1: {
3336  // Deserialize opcode
3337  FwOpcodeType _opCode = 0;
3338  _deserStatus = _msg.deserializeTo(_opCode);
3339  FW_ASSERT (
3340  _deserStatus == Fw::FW_SERIALIZE_OK,
3341  static_cast<FwAssertArgType>(_deserStatus)
3342  );
3343 
3344  // Deserialize command sequence
3345  U32 _cmdSeq = 0;
3346  _deserStatus = _msg.deserializeTo(_cmdSeq);
3347  FW_ASSERT (
3348  _deserStatus == Fw::FW_SERIALIZE_OK,
3349  static_cast<FwAssertArgType>(_deserStatus)
3350  );
3351 
3352  // Deserialize command argument buffer
3353  Fw::CmdArgBuffer args;
3354  _deserStatus = _msg.deserializeTo(args);
3355  FW_ASSERT (
3356  _deserStatus == Fw::FW_SERIALIZE_OK,
3357  static_cast<FwAssertArgType>(_deserStatus)
3358  );
3359 
3360  // Reset buffer
3361  args.resetDeser();
3362 
3363  // Deserialize argument arg1
3364  I32 arg1;
3365  _deserStatus = args.deserializeTo(arg1);
3366  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
3367  if (this->isConnected_CmdStatus_OutputPort(0)) {
3368  this->cmdResponse_out(
3369  _opCode,
3370  _cmdSeq,
3372  );
3373  }
3374  // Don't crash the task if bad arguments were passed from the ground
3375  break;
3376  }
3377 
3378  // Deserialize argument arg2
3379  F32 arg2;
3380  _deserStatus = args.deserializeTo(arg2);
3381  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
3382  if (this->isConnected_CmdStatus_OutputPort(0)) {
3383  this->cmdResponse_out(
3384  _opCode,
3385  _cmdSeq,
3387  );
3388  }
3389  // Don't crash the task if bad arguments were passed from the ground
3390  break;
3391  }
3392 
3393  // Deserialize argument arg3
3394  U8 arg3;
3395  _deserStatus = args.deserializeTo(arg3);
3396  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
3397  if (this->isConnected_CmdStatus_OutputPort(0)) {
3398  this->cmdResponse_out(
3399  _opCode,
3400  _cmdSeq,
3402  );
3403  }
3404  // Don't crash the task if bad arguments were passed from the ground
3405  break;
3406  }
3407 
3408  // Make sure there was no data left over.
3409  // That means the argument buffer size was incorrect.
3410 #if FW_CMD_CHECK_RESIDUAL
3411  if (args.getDeserializeSizeLeft() != 0) {
3412  if (this->isConnected_CmdStatus_OutputPort(0)) {
3413  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
3414  }
3415  // Don't crash the task if bad arguments were passed from the ground
3416  break;
3417  }
3418 #endif
3419 
3420  // Call handler function
3422  _opCode, _cmdSeq,
3423  arg1,
3424  arg2,
3425  arg3
3426  );
3427 
3428  break;
3429  }
3430 
3431  // Handle command CMD_CLEAR_TRACKING
3432  case CMD_CMD_CLEAR_TRACKING: {
3433  // Deserialize opcode
3434  FwOpcodeType _opCode = 0;
3435  _deserStatus = _msg.deserializeTo(_opCode);
3436  FW_ASSERT (
3437  _deserStatus == Fw::FW_SERIALIZE_OK,
3438  static_cast<FwAssertArgType>(_deserStatus)
3439  );
3440 
3441  // Deserialize command sequence
3442  U32 _cmdSeq = 0;
3443  _deserStatus = _msg.deserializeTo(_cmdSeq);
3444  FW_ASSERT (
3445  _deserStatus == Fw::FW_SERIALIZE_OK,
3446  static_cast<FwAssertArgType>(_deserStatus)
3447  );
3448 
3449  // Deserialize command argument buffer
3450  Fw::CmdArgBuffer args;
3451  _deserStatus = _msg.deserializeTo(args);
3452  FW_ASSERT (
3453  _deserStatus == Fw::FW_SERIALIZE_OK,
3454  static_cast<FwAssertArgType>(_deserStatus)
3455  );
3456 
3457  // Reset buffer
3458  args.resetDeser();
3459 
3460  // Make sure there was no data left over.
3461  // That means the argument buffer size was incorrect.
3462 #if FW_CMD_CHECK_RESIDUAL
3463  if (args.getDeserializeSizeLeft() != 0) {
3464  if (this->isConnected_CmdStatus_OutputPort(0)) {
3465  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
3466  }
3467  // Don't crash the task if bad arguments were passed from the ground
3468  break;
3469  }
3470 #endif
3471 
3472  // Call handler function
3473  this->CMD_CLEAR_TRACKING_cmdHandler(_opCode, _cmdSeq);
3474 
3475  break;
3476  }
3477 
3478  default:
3479  return MSG_DISPATCH_ERROR;
3480  }
3481 
3482  return MSG_DISPATCH_OK;
3483  }
3484 
3485  // ----------------------------------------------------------------------
3486  // Calls for messages received on special input ports
3487  // ----------------------------------------------------------------------
3488 
3489  void CommandDispatcherComponentBase ::
3490  m_p_CmdDisp_in(
3491  Fw::PassiveComponentBase* callComp,
3492  FwIndexType portNum,
3493  FwOpcodeType opCode,
3494  U32 cmdSeq,
3495  Fw::CmdArgBuffer& args
3496  )
3497  {
3498  FW_ASSERT(callComp);
3499  CommandDispatcherComponentBase* compPtr = static_cast<CommandDispatcherComponentBase*>(callComp);
3500  compPtr->CmdDisp_handlerBase(
3501  portNum,
3502  opCode,
3503  cmdSeq,
3504  args
3505  );
3506  }
3507 
3508  // ----------------------------------------------------------------------
3509  // Calls for messages received on typed input ports
3510  // ----------------------------------------------------------------------
3511 
3512  void CommandDispatcherComponentBase ::
3513  m_p_compCmdReg_in(
3514  Fw::PassiveComponentBase* callComp,
3515  FwIndexType portNum,
3516  FwOpcodeType opCode
3517  )
3518  {
3519  FW_ASSERT(callComp);
3520  CommandDispatcherComponentBase* compPtr = static_cast<CommandDispatcherComponentBase*>(callComp);
3521  compPtr->compCmdReg_handlerBase(
3522  portNum,
3523  opCode
3524  );
3525  }
3526 
3527  void CommandDispatcherComponentBase ::
3528  m_p_compCmdStat_in(
3529  Fw::PassiveComponentBase* callComp,
3530  FwIndexType portNum,
3531  FwOpcodeType opCode,
3532  U32 cmdSeq,
3533  const Fw::CmdResponse& response
3534  )
3535  {
3536  FW_ASSERT(callComp);
3537  CommandDispatcherComponentBase* compPtr = static_cast<CommandDispatcherComponentBase*>(callComp);
3538  compPtr->compCmdStat_handlerBase(
3539  portNum,
3540  opCode,
3541  cmdSeq,
3542  response
3543  );
3544  }
3545 
3546  void CommandDispatcherComponentBase ::
3547  m_p_pingIn_in(
3548  Fw::PassiveComponentBase* callComp,
3549  FwIndexType portNum,
3550  U32 key
3551  )
3552  {
3553  FW_ASSERT(callComp);
3554  CommandDispatcherComponentBase* compPtr = static_cast<CommandDispatcherComponentBase*>(callComp);
3555  compPtr->pingIn_handlerBase(
3556  portNum,
3557  key
3558  );
3559  }
3560 
3561  void CommandDispatcherComponentBase ::
3562  m_p_run_in(
3563  Fw::PassiveComponentBase* callComp,
3564  FwIndexType portNum,
3565  U32 context
3566  )
3567  {
3568  FW_ASSERT(callComp);
3569  CommandDispatcherComponentBase* compPtr = static_cast<CommandDispatcherComponentBase*>(callComp);
3570  compPtr->run_handlerBase(
3571  portNum,
3572  context
3573  );
3574  }
3575 
3576  void CommandDispatcherComponentBase ::
3577  m_p_seqCmdBuff_in(
3578  Fw::PassiveComponentBase* callComp,
3579  FwIndexType portNum,
3580  Fw::ComBuffer& data,
3581  U32 context
3582  )
3583  {
3584  FW_ASSERT(callComp);
3585  CommandDispatcherComponentBase* compPtr = static_cast<CommandDispatcherComponentBase*>(callComp);
3586  compPtr->seqCmdBuff_handlerBase(
3587  portNum,
3588  data,
3589  context
3590  );
3591  }
3592 
3593 #if !FW_DIRECT_PORT_CALLS
3594 
3595  // ----------------------------------------------------------------------
3596  // Invocation functions for special output ports
3597  // ----------------------------------------------------------------------
3598 
3599  void CommandDispatcherComponentBase ::
3600  CmdReg_out(
3601  FwIndexType portNum,
3602  FwOpcodeType opCode
3603  ) const
3604  {
3605  FW_ASSERT(
3606  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
3607  static_cast<FwAssertArgType>(portNum)
3608  );
3609 
3610  FW_ASSERT(
3611  this->m_CmdReg_OutputPort[portNum].isConnected(),
3612  static_cast<FwAssertArgType>(portNum)
3613  );
3614  this->m_CmdReg_OutputPort[portNum].invoke(
3615  opCode
3616  );
3617  }
3618 
3619  void CommandDispatcherComponentBase ::
3620  CmdStatus_out(
3621  FwIndexType portNum,
3622  FwOpcodeType opCode,
3623  U32 cmdSeq,
3624  const Fw::CmdResponse& response
3625  ) const
3626  {
3627  FW_ASSERT(
3628  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
3629  static_cast<FwAssertArgType>(portNum)
3630  );
3631 
3632  FW_ASSERT(
3633  this->m_CmdStatus_OutputPort[portNum].isConnected(),
3634  static_cast<FwAssertArgType>(portNum)
3635  );
3636  this->m_CmdStatus_OutputPort[portNum].invoke(
3637  opCode,
3638  cmdSeq,
3639  response
3640  );
3641  }
3642 
3643  void CommandDispatcherComponentBase ::
3644  Log_out(
3645  FwIndexType portNum,
3646  FwEventIdType id,
3647  Fw::Time& timeTag,
3648  const Fw::LogSeverity& severity,
3649  Fw::LogBuffer& args
3650  ) const
3651  {
3652  FW_ASSERT(
3653  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
3654  static_cast<FwAssertArgType>(portNum)
3655  );
3656 
3657  FW_ASSERT(
3658  this->m_Log_OutputPort[portNum].isConnected(),
3659  static_cast<FwAssertArgType>(portNum)
3660  );
3661  this->m_Log_OutputPort[portNum].invoke(
3662  id,
3663  timeTag,
3664  severity,
3665  args
3666  );
3667  }
3668 
3669 #if FW_ENABLE_TEXT_LOGGING
3670 
3671  void CommandDispatcherComponentBase ::
3672  LogText_out(
3673  FwIndexType portNum,
3674  FwEventIdType id,
3675  Fw::Time& timeTag,
3676  const Fw::LogSeverity& severity,
3677  Fw::TextLogString& text
3678  ) const
3679  {
3680  FW_ASSERT(
3681  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
3682  static_cast<FwAssertArgType>(portNum)
3683  );
3684 
3685  FW_ASSERT(
3686  this->m_LogText_OutputPort[portNum].isConnected(),
3687  static_cast<FwAssertArgType>(portNum)
3688  );
3689  this->m_LogText_OutputPort[portNum].invoke(
3690  id,
3691  timeTag,
3692  severity,
3693  text
3694  );
3695  }
3696 
3697 #endif
3698 
3699  void CommandDispatcherComponentBase ::
3700  Time_out(
3701  FwIndexType portNum,
3702  Fw::Time& time
3703  ) const
3704  {
3705  FW_ASSERT(
3706  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
3707  static_cast<FwAssertArgType>(portNum)
3708  );
3709 
3710  FW_ASSERT(
3711  this->m_Time_OutputPort[portNum].isConnected(),
3712  static_cast<FwAssertArgType>(portNum)
3713  );
3714  this->m_Time_OutputPort[portNum].invoke(
3715  time
3716  );
3717  }
3718 
3719  void CommandDispatcherComponentBase ::
3720  Tlm_out(
3721  FwIndexType portNum,
3722  FwChanIdType id,
3723  Fw::Time& timeTag,
3724  Fw::TlmBuffer& val
3725  ) const
3726  {
3727  FW_ASSERT(
3728  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
3729  static_cast<FwAssertArgType>(portNum)
3730  );
3731 
3732  FW_ASSERT(
3733  this->m_Tlm_OutputPort[portNum].isConnected(),
3734  static_cast<FwAssertArgType>(portNum)
3735  );
3736  this->m_Tlm_OutputPort[portNum].invoke(
3737  id,
3738  timeTag,
3739  val
3740  );
3741  }
3742 
3743 #endif
3744 
3745 }
Serialization/Deserialization operation was successful.
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:157
void set_seqCmdStatus_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to seqCmdStatus[portNum].
static constexpr FwIndexType getNum_run_InputPorts()
static constexpr FwSizeType CAPACITY
Definition: CmdPortAc.hpp:36
virtual void CMD_NO_OP_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command CMD_NO_OP.
Exceeded the number of commands that can be simultaneously executed.
void seqCmdStatus_out(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke output port seqCmdStatus.
FwIdType FwOpcodeType
The type of a command opcode.
Operation succeeded.
Definition: Os.hpp:26
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
static constexpr FwIndexType getNum_Log_OutputPorts()
This log event reports the Command Sequence Buffer port queue has overflowed.
void invoke(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args) const
Invoke a port connection.
Definition: CmdPortAc.cpp:190
PlatformSizeType FwSizeType
Svc::InputSchedPort * get_run_InputPort(FwIndexType portNum)
void pingIn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port pingIn.
Status receive(U8 *destination, FwSizeType capacity, BlockingType blockType, FwSizeType &actualSize, FwQueuePriorityType &priority) override
receive a message from the queue through delegate
Definition: Queue.cpp:71
CommandDispatcherComponentBase(const char *compName="")
Construct CommandDispatcherComponentBase object.
I32 FwEnumStoreType
void regCommands()
Register commands with the Command Dispatcher.
void log_WARNING_HI_CommandDroppedQueueOverflow(FwOpcodeType OpCode, U32 Context)
Status
status returned from the queue send function
Definition: Queue.hpp:30
Fw::InputCmdRegPort * get_compCmdReg_InputPort(FwIndexType portNum)
void CMD_NO_OP_STRING_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void init()
Initialization function.
Definition: SchedPortAc.cpp:73
Deserialization status.
const char * toChar() const
Convert to a C-style char*.
Definition: String.hpp:50
virtual void run_preMsgHook(FwIndexType portNum, U32 context)
Pre-message hook for async input port run.
virtual void unLock()
Unlock the guarded mutex.
void init()
Initialization function.
Definition: CmdPortAc.cpp:89
void unLock()
unlock the mutex and assert success
Definition: Mutex.cpp:41
Fw::InputCmdPort * get_CmdDisp_InputPort(FwIndexType portNum)
void invoke(U32 key) const
Invoke a port connection.
Definition: PingPortAc.cpp:170
virtual const CHAR * toChar() const =0
Convert to a C-style char*.
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
bool isConnected_CmdReg_OutputPort(FwIndexType portNum) const
virtual void run_handler(FwIndexType portNum, U32 context)=0
Handler for input port run.
virtual void CMD_NO_OP_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
void log_ACTIVITY_HI_TestCmd1Args(I32 arg1, F32 arg2, U8 arg3) const
void compCmdSend_out(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args) const
Invoke output port compCmdSend.
void init()
Initialization function.
Definition: TlmPortAc.cpp:171
Enum representing a command response.
static constexpr FwIndexType getNum_CmdDisp_InputPorts()
No time base has been established (Required)
void addCallPort(InputCmdRegPort *callPort)
Register an input port.
virtual void pingIn_handler(FwIndexType portNum, U32 key)=0
Handler for input port pingIn.
static constexpr FwIndexType getNum_pingIn_InputPorts()
bool isConnected_Time_OutputPort(FwIndexType portNum) const
The command dispatcher has successfully received a NO-OP command from GUI with a string.
static constexpr FwIndexType getNum_pingOut_OutputPorts()
void log_DIAGNOSTIC_OpCodeReregistered(FwOpcodeType Opcode, I32 port) const
Os::Queue m_queue
queue object for active component
static constexpr FwIndexType getNum_CmdStatus_OutputPorts()
The command dispatcher has successfully received a NO-OP command.
This log event message returns the TEST_CMD_1 arguments.
Software diagnostic events.
Svc::InputPingPort * get_pingIn_InputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_Tlm_OutputPorts()
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:177
void init()
Object initializer.
Definition: ObjBase.cpp:24
void init()
Initialization function.
Definition: ComPortAc.cpp:81
virtual void CMD_TEST_CMD_1_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command CMD_TEST_CMD_1.
SerializeStatus
forward declaration for string
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: CmdPortAc.cpp:95
float F32
32-bit floating point
Definition: BasicTypes.h:83
Message will block until space is available.
Definition: Queue.hpp:47
void log_COMMAND_OpCodeCompleted(FwOpcodeType Opcode) const
FwIdType FwEventIdType
The type of an event identifier.
void log_ACTIVITY_HI_NoOpStringReceived(const Fw::StringBase &message) const
void tlmWrite_CommandsDispatched(U32 arg, Fw::Time _tlmTime=Fw::Time())
static constexpr FwIndexType getNum_CmdReg_OutputPorts()
void invoke(FwOpcodeType opCode) const
Invoke a port connection.
static constexpr FwSizeType CAPACITY
Definition: PingPortAc.hpp:34
void set_CmdReg_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to CmdReg[portNum].
The size of the serial representation.
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:40
void init()
Initialization function.
Definition: TimePortAc.cpp:151
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: ComPortAc.cpp:87
Os::Queue::Status createQueue(FwSizeType depth, FwSizeType msgSize)
static constexpr FwSizeType CAPACITY
Definition: ComPortAc.hpp:35
#define FW_MIN(a, b)
MIN macro (deprecated in C++, use std::min)
Definition: BasicTypes.h:94
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:151
void addCallPort(InputCmdPort *callPort)
Register an input port.
Definition: CmdPortAc.cpp:177
void tlmWrite_CommandsDropped(U32 arg, Fw::Time _tlmTime=Fw::Time())
void invoke(Fw::Time &time) const
Invoke a port connection.
Definition: TimePortAc.cpp:170
virtual ~CommandDispatcherComponentBase()
Destroy CommandDispatcherComponentBase object.
Status
Generic OK/ERROR status.
Definition: Os.hpp:25
Fw::InputCmdResponsePort * get_compCmdStat_InputPort(FwIndexType portNum)
Serializable::SizeType getDeserializeSizeLeft() const override
Get remaining deserialization buffer size.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
const char * toChar() const
Convert to a C-style char*.
Definition: ObjectName.hpp:50
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke a port connection.
static constexpr FwIndexType getNum_Time_OutputPorts()
FwIdType FwChanIdType
The type of a telemetry channel identifier.
FwSizeType SizeType
void addCallPort(InputPingPort *callPort)
Register an input port.
Definition: PingPortAc.cpp:157
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
bool isConnected_compCmdSend_OutputPort(FwIndexType portNum) const
Status send(const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override
send a message into the queue through delegate
Definition: Queue.cpp:54
virtual void CMD_TEST_CMD_1_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, I32 arg1, F32 arg2, U8 arg3)=0
void log_WARNING_HI_CommandDroppedQueueOverflow_ThrottleClear()
Reset throttle value for CommandDroppedQueueOverflow.
void init()
Initialization function.
Definition: CmdPortAc.cpp:171
virtual void compCmdReg_handler(FwIndexType portNum, FwOpcodeType opCode)=0
Handler for input port compCmdReg.
void resetDeser() override
Reset deserialization pointer to beginning of buffer.
void tlmWrite_CommandErrors(U32 arg, Fw::Time _tlmTime=Fw::Time())
void pingOut_out(FwIndexType portNum, U32 key) const
Invoke output port pingOut.
virtual void compCmdStat_preMsgHook(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)
Pre-message hook for async input port compCmdStat.
A serious but recoverable event.
void invoke(FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val) const
Invoke a port connection.
Definition: TlmPortAc.cpp:190
static constexpr FwIndexType getNum_compCmdReg_InputPorts()
bool isConnected() const
Definition: PortBase.cpp:38
Enum representing event severity.
void log_WARNING_HI_InvalidCommand(FwOpcodeType Opcode) const
#define PRI_FwIndexType
void tlmWrite(FwChanIdType id, Fw::TlmBuffer &_tlmBuff, Fw::Time _tlmTime=Fw::Time()) const
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
void init()
Initialization function.
Definition: LogPortAc.cpp:180
void compCmdStat_handlerBase(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)
Handler base-class function for input port compCmdStat.
bool isConnected_pingOut_OutputPort(FwIndexType portNum) const
void setPortNum(FwIndexType portNum)
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:53
static constexpr FwSizeType CAPACITY
void CmdDisp_handlerBase(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Handler base-class function for input port CmdDisp.
BlockingType
message type
Definition: Queue.hpp:46
void log_COMMAND_OpCodeError(FwOpcodeType Opcode, Fw::CmdResponse error) const
Command failed to deserialize.
bool isConnected_Tlm_OutputPort(FwIndexType portNum) const
PlatformQueuePriorityType FwQueuePriorityType
The type of queue priorities used.
Important informational events.
bool isConnected_Log_OutputPort(FwIndexType portNum) const
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: SchedPortAc.cpp:79
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args) const
Invoke a port connection.
Definition: LogPortAc.cpp:199
void init()
Initialization function.
bool isConnected_CmdStatus_OutputPort(FwIndexType portNum) const
The size of the serial representation.
A message was sent requesting an exit of the loop.
PlatformIndexType FwIndexType
void run_handlerBase(FwIndexType portNum, U32 context)
Handler base-class function for input port run.
void log_DIAGNOSTIC_OpCodeRegistered(FwOpcodeType Opcode, I32 port, I32 slot) const
Log event OpCodeRegistered.
virtual void CMD_CLEAR_TRACKING_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command CMD_CLEAR_TRACKING.
void set_Tlm_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to Tlm[portNum].
void CMD_CLEAR_TRACKING_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
double F64
64-bit floating point (double). Required for compiler-supplied double promotion.
Definition: BasicTypes.h:85
bool isConnected_seqCmdStatus_OutputPort(FwIndexType portNum) const
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:186
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
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:73
RateGroupDivider component implementation.
message sent/received okay
Definition: Queue.hpp:31
SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG) override
Deserialize an 8-bit unsigned integer value.
virtual void seqCmdBuff_overflowHook(FwIndexType portNum, Fw::ComBuffer &data, U32 context)=0
Overflow hook for async input port seqCmdBuff.
U8 BYTE
byte type
Definition: BasicTypes.h:56
virtual void CMD_CLEAR_TRACKING_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
static constexpr FwIndexType getNum_seqCmdBuff_InputPorts()
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: PingPortAc.cpp:79
Message will return with status when space is unavailable.
Definition: Queue.hpp:48
void CMD_NO_OP_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Implementation of malloc based allocator.
static constexpr FwIndexType getNum_compCmdSend_OutputPorts()
virtual void seqCmdBuff_handler(FwIndexType portNum, Fw::ComBuffer &data, U32 context)=0
Handler for input port seqCmdBuff.
static constexpr FwIndexType getNum_compCmdStat_InputPorts()
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].
static constexpr FwIndexType getNum_seqCmdStatus_OutputPorts()
void log_WARNING_HI_TooManyCommands(FwOpcodeType Opcode) const
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.
static constexpr FwSizeType CAPACITY
Definition: SchedPortAc.hpp:34
void log_COMMAND_OpCodeDispatched(FwOpcodeType Opcode, I32 port) const
void set_Log_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
void set_Time_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to Time[portNum].
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
message to exit active component task
SerializeStatus serializeTo(SerialBufferBase &buffer, Endianness mode=Endianness::BIG) const override
Serialize the contents of this object to a buffer.
Clear command tracking info to recover from components not returning status.
void CMD_TEST_CMD_1_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)