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