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  FW_ASSERT(
1187  qStatus == Os::Queue::OP_OK,
1188  static_cast<FwAssertArgType>(qStatus)
1189  );
1190  }
1191 
1194  FwIndexType portNum,
1195  U32 context
1196  )
1197  {
1198  // Make sure port number is valid
1199  FW_ASSERT(
1200  (0 <= portNum) && (portNum < this->getNum_run_InputPorts()),
1201  static_cast<FwAssertArgType>(portNum)
1202  );
1203 
1204  // Call pre-message hook
1206  portNum,
1207  context
1208  );
1209  ComponentIpcSerializableBuffer msg;
1211 
1212  // Serialize message ID
1213  _status = msg.serializeFrom(
1214  static_cast<FwEnumStoreType>(RUN_SCHED)
1215  );
1216  FW_ASSERT(
1217  _status == Fw::FW_SERIALIZE_OK,
1218  static_cast<FwAssertArgType>(_status)
1219  );
1220 
1221  // Serialize port number
1222  _status = msg.serializeFrom(portNum);
1223  FW_ASSERT(
1224  _status == Fw::FW_SERIALIZE_OK,
1225  static_cast<FwAssertArgType>(_status)
1226  );
1227 
1228  // Serialize argument context
1229  _status = msg.serializeFrom(context);
1230  FW_ASSERT(
1231  _status == Fw::FW_SERIALIZE_OK,
1232  static_cast<FwAssertArgType>(_status)
1233  );
1234 
1235  // Send message
1237  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1238 
1239  FW_ASSERT(
1240  qStatus == Os::Queue::OP_OK,
1241  static_cast<FwAssertArgType>(qStatus)
1242  );
1243  }
1244 
1247  FwIndexType portNum,
1248  Fw::ComBuffer& data,
1249  U32 context
1250  )
1251  {
1252  // Make sure port number is valid
1253  FW_ASSERT(
1254  (0 <= portNum) && (portNum < this->getNum_seqCmdBuff_InputPorts()),
1255  static_cast<FwAssertArgType>(portNum)
1256  );
1257 
1258  // Call pre-message hook
1260  portNum,
1261  data,
1262  context
1263  );
1264  ComponentIpcSerializableBuffer msg;
1266 
1267  // Serialize message ID
1268  _status = msg.serializeFrom(
1269  static_cast<FwEnumStoreType>(SEQCMDBUFF_COM)
1270  );
1271  FW_ASSERT(
1272  _status == Fw::FW_SERIALIZE_OK,
1273  static_cast<FwAssertArgType>(_status)
1274  );
1275 
1276  // Serialize port number
1277  _status = msg.serializeFrom(portNum);
1278  FW_ASSERT(
1279  _status == Fw::FW_SERIALIZE_OK,
1280  static_cast<FwAssertArgType>(_status)
1281  );
1282 
1283  // Serialize argument data
1284  _status = msg.serializeFrom(data);
1285  FW_ASSERT(
1286  _status == Fw::FW_SERIALIZE_OK,
1287  static_cast<FwAssertArgType>(_status)
1288  );
1289 
1290  // Serialize argument context
1291  _status = msg.serializeFrom(context);
1292  FW_ASSERT(
1293  _status == Fw::FW_SERIALIZE_OK,
1294  static_cast<FwAssertArgType>(_status)
1295  );
1296 
1297  // Send message
1299  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1300 
1301  if (qStatus == Os::Queue::Status::FULL) {
1302  this->seqCmdBuff_overflowHook(portNum, data, context);
1303  return;
1304  }
1305 
1306  FW_ASSERT(
1307  qStatus == Os::Queue::OP_OK,
1308  static_cast<FwAssertArgType>(qStatus)
1309  );
1310  }
1311 
1312  // ----------------------------------------------------------------------
1313  // Pre-message hooks for typed async input ports
1314  //
1315  // Each of these functions is invoked just before processing a message
1316  // on the corresponding port. By default, they do nothing. You can
1317  // override them to provide specific pre-message behavior.
1318  // ----------------------------------------------------------------------
1319 
1322  FwIndexType portNum,
1323  FwOpcodeType opCode,
1324  U32 cmdSeq,
1325  const Fw::CmdResponse& response
1326  )
1327  {
1328  // Default: no-op
1329  }
1330 
1333  FwIndexType portNum,
1334  U32 key
1335  )
1336  {
1337  // Default: no-op
1338  }
1339 
1342  FwIndexType portNum,
1343  U32 context
1344  )
1345  {
1346  // Default: no-op
1347  }
1348 
1351  FwIndexType portNum,
1352  Fw::ComBuffer& data,
1353  U32 context
1354  )
1355  {
1356  // Default: no-op
1357  }
1358 
1359 #if !FW_DIRECT_PORT_CALLS
1360 
1361  // ----------------------------------------------------------------------
1362  // Invocation functions for typed output ports
1363  // ----------------------------------------------------------------------
1364 
1367  FwIndexType portNum,
1368  FwOpcodeType opCode,
1369  U32 cmdSeq,
1370  Fw::CmdArgBuffer& args
1371  ) const
1372  {
1373  FW_ASSERT(
1374  (0 <= portNum) && (portNum < this->getNum_compCmdSend_OutputPorts()),
1375  static_cast<FwAssertArgType>(portNum)
1376  );
1377 
1378  FW_ASSERT(
1379  this->m_compCmdSend_OutputPort[portNum].isConnected(),
1380  static_cast<FwAssertArgType>(portNum)
1381  );
1382  this->m_compCmdSend_OutputPort[portNum].invoke(
1383  opCode,
1384  cmdSeq,
1385  args
1386  );
1387  }
1388 
1391  FwIndexType portNum,
1392  U32 key
1393  ) const
1394  {
1395  FW_ASSERT(
1396  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
1397  static_cast<FwAssertArgType>(portNum)
1398  );
1399 
1400  FW_ASSERT(
1401  this->m_pingOut_OutputPort[portNum].isConnected(),
1402  static_cast<FwAssertArgType>(portNum)
1403  );
1404  this->m_pingOut_OutputPort[portNum].invoke(
1405  key
1406  );
1407  }
1408 
1411  FwIndexType portNum,
1412  FwOpcodeType opCode,
1413  U32 cmdSeq,
1414  const Fw::CmdResponse& response
1415  ) const
1416  {
1417  FW_ASSERT(
1418  (0 <= portNum) && (portNum < this->getNum_seqCmdStatus_OutputPorts()),
1419  static_cast<FwAssertArgType>(portNum)
1420  );
1421 
1422  FW_ASSERT(
1423  this->m_seqCmdStatus_OutputPort[portNum].isConnected(),
1424  static_cast<FwAssertArgType>(portNum)
1425  );
1426  this->m_seqCmdStatus_OutputPort[portNum].invoke(
1427  opCode,
1428  cmdSeq,
1429  response
1430  );
1431  }
1432 
1433 #endif
1434 
1435  // ----------------------------------------------------------------------
1436  // Command response
1437  // ----------------------------------------------------------------------
1438 
1441  FwOpcodeType opCode,
1442  U32 cmdSeq,
1443  Fw::CmdResponse response
1444  )
1445  {
1447  this->CmdStatus_out(0, opCode, cmdSeq, response);
1448  }
1449 
1450  // ----------------------------------------------------------------------
1451  // Command handler base-class functions
1452  //
1453  // Call these functions directly to bypass the command input port
1454  // ----------------------------------------------------------------------
1455 
1458  FwOpcodeType opCode,
1459  U32 cmdSeq,
1460  Fw::CmdArgBuffer& args
1461  )
1462  {
1463  // Call pre-message hook
1464  this->CMD_NO_OP_preMsgHook(opCode,cmdSeq);
1465 
1466  // Defer deserializing arguments to the message dispatcher
1467  // to avoid deserializing and reserializing just for IPC
1468  ComponentIpcSerializableBuffer msg;
1470 
1471  // Serialize for IPC
1472  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_CMD_NO_OP));
1473  FW_ASSERT (
1474  _status == Fw::FW_SERIALIZE_OK,
1475  static_cast<FwAssertArgType>(_status)
1476  );
1477 
1478  // Fake port number to make message dequeue work
1479  FwIndexType port = 0;
1480 
1481  _status = msg.serializeFrom(port);
1482  FW_ASSERT (
1483  _status == Fw::FW_SERIALIZE_OK,
1484  static_cast<FwAssertArgType>(_status)
1485  );
1486 
1487  _status = msg.serializeFrom(opCode);
1488  FW_ASSERT (
1489  _status == Fw::FW_SERIALIZE_OK,
1490  static_cast<FwAssertArgType>(_status)
1491  );
1492 
1493  _status = msg.serializeFrom(cmdSeq);
1494  FW_ASSERT (
1495  _status == Fw::FW_SERIALIZE_OK,
1496  static_cast<FwAssertArgType>(_status)
1497  );
1498 
1499  _status = msg.serializeFrom(args);
1500  FW_ASSERT (
1501  _status == Fw::FW_SERIALIZE_OK,
1502  static_cast<FwAssertArgType>(_status)
1503  );
1504 
1505  // Send message
1507  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1508 
1509  FW_ASSERT(
1510  qStatus == Os::Queue::OP_OK,
1511  static_cast<FwAssertArgType>(qStatus)
1512  );
1513  }
1514 
1517  FwOpcodeType opCode,
1518  U32 cmdSeq,
1519  Fw::CmdArgBuffer& args
1520  )
1521  {
1522  // Call pre-message hook
1523  this->CMD_NO_OP_STRING_preMsgHook(opCode,cmdSeq);
1524 
1525  // Defer deserializing arguments to the message dispatcher
1526  // to avoid deserializing and reserializing just for IPC
1527  ComponentIpcSerializableBuffer msg;
1529 
1530  // Serialize for IPC
1531  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_CMD_NO_OP_STRING));
1532  FW_ASSERT (
1533  _status == Fw::FW_SERIALIZE_OK,
1534  static_cast<FwAssertArgType>(_status)
1535  );
1536 
1537  // Fake port number to make message dequeue work
1538  FwIndexType port = 0;
1539 
1540  _status = msg.serializeFrom(port);
1541  FW_ASSERT (
1542  _status == Fw::FW_SERIALIZE_OK,
1543  static_cast<FwAssertArgType>(_status)
1544  );
1545 
1546  _status = msg.serializeFrom(opCode);
1547  FW_ASSERT (
1548  _status == Fw::FW_SERIALIZE_OK,
1549  static_cast<FwAssertArgType>(_status)
1550  );
1551 
1552  _status = msg.serializeFrom(cmdSeq);
1553  FW_ASSERT (
1554  _status == Fw::FW_SERIALIZE_OK,
1555  static_cast<FwAssertArgType>(_status)
1556  );
1557 
1558  _status = msg.serializeFrom(args);
1559  FW_ASSERT (
1560  _status == Fw::FW_SERIALIZE_OK,
1561  static_cast<FwAssertArgType>(_status)
1562  );
1563 
1564  // Send message
1566  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1567 
1568  FW_ASSERT(
1569  qStatus == Os::Queue::OP_OK,
1570  static_cast<FwAssertArgType>(qStatus)
1571  );
1572  }
1573 
1576  FwOpcodeType opCode,
1577  U32 cmdSeq,
1578  Fw::CmdArgBuffer& args
1579  )
1580  {
1581  // Call pre-message hook
1582  this->CMD_TEST_CMD_1_preMsgHook(opCode,cmdSeq);
1583 
1584  // Defer deserializing arguments to the message dispatcher
1585  // to avoid deserializing and reserializing just for IPC
1586  ComponentIpcSerializableBuffer msg;
1588 
1589  // Serialize for IPC
1590  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_CMD_TEST_CMD_1));
1591  FW_ASSERT (
1592  _status == Fw::FW_SERIALIZE_OK,
1593  static_cast<FwAssertArgType>(_status)
1594  );
1595 
1596  // Fake port number to make message dequeue work
1597  FwIndexType port = 0;
1598 
1599  _status = msg.serializeFrom(port);
1600  FW_ASSERT (
1601  _status == Fw::FW_SERIALIZE_OK,
1602  static_cast<FwAssertArgType>(_status)
1603  );
1604 
1605  _status = msg.serializeFrom(opCode);
1606  FW_ASSERT (
1607  _status == Fw::FW_SERIALIZE_OK,
1608  static_cast<FwAssertArgType>(_status)
1609  );
1610 
1611  _status = msg.serializeFrom(cmdSeq);
1612  FW_ASSERT (
1613  _status == Fw::FW_SERIALIZE_OK,
1614  static_cast<FwAssertArgType>(_status)
1615  );
1616 
1617  _status = msg.serializeFrom(args);
1618  FW_ASSERT (
1619  _status == Fw::FW_SERIALIZE_OK,
1620  static_cast<FwAssertArgType>(_status)
1621  );
1622 
1623  // Send message
1625  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1626 
1627  FW_ASSERT(
1628  qStatus == Os::Queue::OP_OK,
1629  static_cast<FwAssertArgType>(qStatus)
1630  );
1631  }
1632 
1635  FwOpcodeType opCode,
1636  U32 cmdSeq,
1637  Fw::CmdArgBuffer& args
1638  )
1639  {
1640  // Call pre-message hook
1641  this->CMD_CLEAR_TRACKING_preMsgHook(opCode,cmdSeq);
1642 
1643  // Defer deserializing arguments to the message dispatcher
1644  // to avoid deserializing and reserializing just for IPC
1645  ComponentIpcSerializableBuffer msg;
1647 
1648  // Serialize for IPC
1649  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_CMD_CLEAR_TRACKING));
1650  FW_ASSERT (
1651  _status == Fw::FW_SERIALIZE_OK,
1652  static_cast<FwAssertArgType>(_status)
1653  );
1654 
1655  // Fake port number to make message dequeue work
1656  FwIndexType port = 0;
1657 
1658  _status = msg.serializeFrom(port);
1659  FW_ASSERT (
1660  _status == Fw::FW_SERIALIZE_OK,
1661  static_cast<FwAssertArgType>(_status)
1662  );
1663 
1664  _status = msg.serializeFrom(opCode);
1665  FW_ASSERT (
1666  _status == Fw::FW_SERIALIZE_OK,
1667  static_cast<FwAssertArgType>(_status)
1668  );
1669 
1670  _status = msg.serializeFrom(cmdSeq);
1671  FW_ASSERT (
1672  _status == Fw::FW_SERIALIZE_OK,
1673  static_cast<FwAssertArgType>(_status)
1674  );
1675 
1676  _status = msg.serializeFrom(args);
1677  FW_ASSERT (
1678  _status == Fw::FW_SERIALIZE_OK,
1679  static_cast<FwAssertArgType>(_status)
1680  );
1681 
1682  // Send message
1684  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1685 
1686  FW_ASSERT(
1687  qStatus == Os::Queue::OP_OK,
1688  static_cast<FwAssertArgType>(qStatus)
1689  );
1690  }
1691 
1692  // ----------------------------------------------------------------------
1693  // Pre-message hooks for async commands
1694  //
1695  // Each of these functions is invoked just before processing the
1696  // corresponding command. By default they do nothing. You can
1697  // override them to provide specific pre-command behavior.
1698  // ----------------------------------------------------------------------
1699 
1702  FwOpcodeType opCode,
1703  U32 cmdSeq
1704  )
1705  {
1706  // Defaults to no-op; can be overridden
1707  (void) opCode;
1708  (void) cmdSeq;
1709  }
1710 
1713  FwOpcodeType opCode,
1714  U32 cmdSeq
1715  )
1716  {
1717  // Defaults to no-op; can be overridden
1718  (void) opCode;
1719  (void) cmdSeq;
1720  }
1721 
1724  FwOpcodeType opCode,
1725  U32 cmdSeq
1726  )
1727  {
1728  // Defaults to no-op; can be overridden
1729  (void) opCode;
1730  (void) cmdSeq;
1731  }
1732 
1735  FwOpcodeType opCode,
1736  U32 cmdSeq
1737  )
1738  {
1739  // Defaults to no-op; can be overridden
1740  (void) opCode;
1741  (void) cmdSeq;
1742  }
1743 
1744  // ----------------------------------------------------------------------
1745  // Event logging functions
1746  // ----------------------------------------------------------------------
1747 
1750  FwOpcodeType Opcode,
1751  I32 port,
1752  I32 slot
1753  ) const
1754  {
1755  // Get the time
1756  Fw::Time _logTime;
1757  if (this->isConnected_Time_OutputPort(0)) {
1758  this->Time_out(0, _logTime);
1759  }
1760 
1761  const FwEventIdType _id = this->getIdBase() + EVENTID_OPCODEREGISTERED;
1762 
1763  // Emit the event on the log port
1764  if (this->isConnected_Log_OutputPort(0)) {
1765  Fw::LogBuffer _logBuff;
1767 
1768 #if FW_AMPCS_COMPATIBLE
1769  // Serialize the number of arguments
1770  _status = _logBuff.serializeFrom(static_cast<U8>(3));
1771  FW_ASSERT(
1772  _status == Fw::FW_SERIALIZE_OK,
1773  static_cast<FwAssertArgType>(_status)
1774  );
1775 #endif
1776 
1777 #if FW_AMPCS_COMPATIBLE
1778  // Serialize the argument size
1779  _status = _logBuff.serializeFrom(
1780  static_cast<U8>(sizeof(FwOpcodeType))
1781  );
1782  FW_ASSERT(
1783  _status == Fw::FW_SERIALIZE_OK,
1784  static_cast<FwAssertArgType>(_status)
1785  );
1786 #endif
1787  _status = _logBuff.serializeFrom(Opcode);
1788  FW_ASSERT(
1789  _status == Fw::FW_SERIALIZE_OK,
1790  static_cast<FwAssertArgType>(_status)
1791  );
1792 
1793 #if FW_AMPCS_COMPATIBLE
1794  // Serialize the argument size
1795  _status = _logBuff.serializeFrom(
1796  static_cast<U8>(sizeof(I32))
1797  );
1798  FW_ASSERT(
1799  _status == Fw::FW_SERIALIZE_OK,
1800  static_cast<FwAssertArgType>(_status)
1801  );
1802 #endif
1803  _status = _logBuff.serializeFrom(port);
1804  FW_ASSERT(
1805  _status == Fw::FW_SERIALIZE_OK,
1806  static_cast<FwAssertArgType>(_status)
1807  );
1808 
1809 #if FW_AMPCS_COMPATIBLE
1810  // Serialize the argument size
1811  _status = _logBuff.serializeFrom(
1812  static_cast<U8>(sizeof(I32))
1813  );
1814  FW_ASSERT(
1815  _status == Fw::FW_SERIALIZE_OK,
1816  static_cast<FwAssertArgType>(_status)
1817  );
1818 #endif
1819  _status = _logBuff.serializeFrom(slot);
1820  FW_ASSERT(
1821  _status == Fw::FW_SERIALIZE_OK,
1822  static_cast<FwAssertArgType>(_status)
1823  );
1824 
1825  this->Log_out(
1826  0,
1827  _id,
1828  _logTime,
1830  _logBuff
1831  );
1832  }
1833 
1834  // Emit the event on the text log port
1835 #if FW_ENABLE_TEXT_LOGGING
1836  if (this->isConnected_LogText_OutputPort(0)) {
1837 #if FW_OBJECT_NAMES == 1
1838  const char* _formatString =
1839  "(%s) %s: Opcode 0x%" PRIx32 " registered to port %" PRIi32 " slot %" PRIi32 "";
1840 #else
1841  const char* _formatString =
1842  "%s: Opcode 0x%" PRIx32 " registered to port %" PRIi32 " slot %" PRIi32 "";
1843 #endif
1844 
1845  Fw::TextLogString _logString;
1846  (void) _logString.format(
1847  _formatString,
1848 #if FW_OBJECT_NAMES == 1
1849  this->m_objName.toChar(),
1850 #endif
1851  "OpCodeRegistered ",
1852  Opcode,
1853  port,
1854  slot
1855  );
1856 
1857  this->LogText_out(
1858  0,
1859  _id,
1860  _logTime,
1862  _logString
1863  );
1864  }
1865 #endif
1866  }
1867 
1870  FwOpcodeType Opcode,
1871  I32 port
1872  ) const
1873  {
1874  // Get the time
1875  Fw::Time _logTime;
1876  if (this->isConnected_Time_OutputPort(0)) {
1877  this->Time_out(0, _logTime);
1878  }
1879 
1880  const FwEventIdType _id = this->getIdBase() + EVENTID_OPCODEDISPATCHED;
1881 
1882  // Emit the event on the log port
1883  if (this->isConnected_Log_OutputPort(0)) {
1884  Fw::LogBuffer _logBuff;
1886 
1887 #if FW_AMPCS_COMPATIBLE
1888  // Serialize the number of arguments
1889  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1890  FW_ASSERT(
1891  _status == Fw::FW_SERIALIZE_OK,
1892  static_cast<FwAssertArgType>(_status)
1893  );
1894 #endif
1895 
1896 #if FW_AMPCS_COMPATIBLE
1897  // Serialize the argument size
1898  _status = _logBuff.serializeFrom(
1899  static_cast<U8>(sizeof(FwOpcodeType))
1900  );
1901  FW_ASSERT(
1902  _status == Fw::FW_SERIALIZE_OK,
1903  static_cast<FwAssertArgType>(_status)
1904  );
1905 #endif
1906  _status = _logBuff.serializeFrom(Opcode);
1907  FW_ASSERT(
1908  _status == Fw::FW_SERIALIZE_OK,
1909  static_cast<FwAssertArgType>(_status)
1910  );
1911 
1912 #if FW_AMPCS_COMPATIBLE
1913  // Serialize the argument size
1914  _status = _logBuff.serializeFrom(
1915  static_cast<U8>(sizeof(I32))
1916  );
1917  FW_ASSERT(
1918  _status == Fw::FW_SERIALIZE_OK,
1919  static_cast<FwAssertArgType>(_status)
1920  );
1921 #endif
1922  _status = _logBuff.serializeFrom(port);
1923  FW_ASSERT(
1924  _status == Fw::FW_SERIALIZE_OK,
1925  static_cast<FwAssertArgType>(_status)
1926  );
1927 
1928  this->Log_out(
1929  0,
1930  _id,
1931  _logTime,
1933  _logBuff
1934  );
1935  }
1936 
1937  // Emit the event on the text log port
1938 #if FW_ENABLE_TEXT_LOGGING
1939  if (this->isConnected_LogText_OutputPort(0)) {
1940 #if FW_OBJECT_NAMES == 1
1941  const char* _formatString =
1942  "(%s) %s: Opcode 0x%" PRIx32 " dispatched to port %" PRIi32 "";
1943 #else
1944  const char* _formatString =
1945  "%s: Opcode 0x%" PRIx32 " dispatched to port %" PRIi32 "";
1946 #endif
1947 
1948  Fw::TextLogString _logString;
1949  (void) _logString.format(
1950  _formatString,
1951 #if FW_OBJECT_NAMES == 1
1952  this->m_objName.toChar(),
1953 #endif
1954  "OpCodeDispatched ",
1955  Opcode,
1956  port
1957  );
1958 
1959  this->LogText_out(
1960  0,
1961  _id,
1962  _logTime,
1964  _logString
1965  );
1966  }
1967 #endif
1968  }
1969 
1972  {
1973  // Get the time
1974  Fw::Time _logTime;
1975  if (this->isConnected_Time_OutputPort(0)) {
1976  this->Time_out(0, _logTime);
1977  }
1978 
1979  const FwEventIdType _id = this->getIdBase() + EVENTID_OPCODECOMPLETED;
1980 
1981  // Emit the event on the log port
1982  if (this->isConnected_Log_OutputPort(0)) {
1983  Fw::LogBuffer _logBuff;
1985 
1986 #if FW_AMPCS_COMPATIBLE
1987  // Serialize the number of arguments
1988  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1989  FW_ASSERT(
1990  _status == Fw::FW_SERIALIZE_OK,
1991  static_cast<FwAssertArgType>(_status)
1992  );
1993 #endif
1994 
1995 #if FW_AMPCS_COMPATIBLE
1996  // Serialize the argument size
1997  _status = _logBuff.serializeFrom(
1998  static_cast<U8>(sizeof(FwOpcodeType))
1999  );
2000  FW_ASSERT(
2001  _status == Fw::FW_SERIALIZE_OK,
2002  static_cast<FwAssertArgType>(_status)
2003  );
2004 #endif
2005  _status = _logBuff.serializeFrom(Opcode);
2006  FW_ASSERT(
2007  _status == Fw::FW_SERIALIZE_OK,
2008  static_cast<FwAssertArgType>(_status)
2009  );
2010 
2011  this->Log_out(
2012  0,
2013  _id,
2014  _logTime,
2016  _logBuff
2017  );
2018  }
2019 
2020  // Emit the event on the text log port
2021 #if FW_ENABLE_TEXT_LOGGING
2022  if (this->isConnected_LogText_OutputPort(0)) {
2023 #if FW_OBJECT_NAMES == 1
2024  const char* _formatString =
2025  "(%s) %s: Opcode 0x%" PRIx32 " completed";
2026 #else
2027  const char* _formatString =
2028  "%s: Opcode 0x%" PRIx32 " completed";
2029 #endif
2030 
2031  Fw::TextLogString _logString;
2032  (void) _logString.format(
2033  _formatString,
2034 #if FW_OBJECT_NAMES == 1
2035  this->m_objName.toChar(),
2036 #endif
2037  "OpCodeCompleted ",
2038  Opcode
2039  );
2040 
2041  this->LogText_out(
2042  0,
2043  _id,
2044  _logTime,
2046  _logString
2047  );
2048  }
2049 #endif
2050  }
2051 
2054  FwOpcodeType Opcode,
2055  const Fw::CmdResponse& error
2056  ) const
2057  {
2058  // Get the time
2059  Fw::Time _logTime;
2060  if (this->isConnected_Time_OutputPort(0)) {
2061  this->Time_out(0, _logTime);
2062  }
2063 
2064  const FwEventIdType _id = this->getIdBase() + EVENTID_OPCODEERROR;
2065 
2066  // Emit the event on the log port
2067  if (this->isConnected_Log_OutputPort(0)) {
2068  Fw::LogBuffer _logBuff;
2070 
2071 #if FW_AMPCS_COMPATIBLE
2072  // Serialize the number of arguments
2073  _status = _logBuff.serializeFrom(static_cast<U8>(2));
2074  FW_ASSERT(
2075  _status == Fw::FW_SERIALIZE_OK,
2076  static_cast<FwAssertArgType>(_status)
2077  );
2078 #endif
2079 
2080 #if FW_AMPCS_COMPATIBLE
2081  // Serialize the argument size
2082  _status = _logBuff.serializeFrom(
2083  static_cast<U8>(sizeof(FwOpcodeType))
2084  );
2085  FW_ASSERT(
2086  _status == Fw::FW_SERIALIZE_OK,
2087  static_cast<FwAssertArgType>(_status)
2088  );
2089 #endif
2090  _status = _logBuff.serializeFrom(Opcode);
2091  FW_ASSERT(
2092  _status == Fw::FW_SERIALIZE_OK,
2093  static_cast<FwAssertArgType>(_status)
2094  );
2095 
2096 #if FW_AMPCS_COMPATIBLE
2097  // Serialize the argument size
2098  _status = _logBuff.serializeFrom(
2099  static_cast<U8>(Fw::CmdResponse::SERIALIZED_SIZE)
2100  );
2101  FW_ASSERT(
2102  _status == Fw::FW_SERIALIZE_OK,
2103  static_cast<FwAssertArgType>(_status)
2104  );
2105 #endif
2106  _status = _logBuff.serializeFrom(error);
2107  FW_ASSERT(
2108  _status == Fw::FW_SERIALIZE_OK,
2109  static_cast<FwAssertArgType>(_status)
2110  );
2111 
2112  this->Log_out(
2113  0,
2114  _id,
2115  _logTime,
2117  _logBuff
2118  );
2119  }
2120 
2121  // Emit the event on the text log port
2122 #if FW_ENABLE_TEXT_LOGGING
2123  if (this->isConnected_LogText_OutputPort(0)) {
2124 #if FW_OBJECT_NAMES == 1
2125  const char* _formatString =
2126  "(%s) %s: Opcode 0x%" PRIx32 " completed with error %s";
2127 #else
2128  const char* _formatString =
2129  "%s: Opcode 0x%" PRIx32 " completed with error %s";
2130 #endif
2131 
2132  Fw::String errorStr;
2133  error.toString(errorStr);
2134 
2135  Fw::TextLogString _logString;
2136  (void) _logString.format(
2137  _formatString,
2138 #if FW_OBJECT_NAMES == 1
2139  this->m_objName.toChar(),
2140 #endif
2141  "OpCodeError ",
2142  Opcode,
2143  errorStr.toChar()
2144  );
2145 
2146  this->LogText_out(
2147  0,
2148  _id,
2149  _logTime,
2151  _logString
2152  );
2153  }
2154 #endif
2155  }
2156 
2159  {
2160  // Get the time
2161  Fw::Time _logTime;
2162  if (this->isConnected_Time_OutputPort(0)) {
2163  this->Time_out(0, _logTime);
2164  }
2165 
2166  const FwEventIdType _id = this->getIdBase() + EVENTID_MALFORMEDCOMMAND;
2167 
2168  // Emit the event on the log port
2169  if (this->isConnected_Log_OutputPort(0)) {
2170  Fw::LogBuffer _logBuff;
2172 
2173 #if FW_AMPCS_COMPATIBLE
2174  // Serialize the number of arguments
2175  _status = _logBuff.serializeFrom(static_cast<U8>(1));
2176  FW_ASSERT(
2177  _status == Fw::FW_SERIALIZE_OK,
2178  static_cast<FwAssertArgType>(_status)
2179  );
2180 #endif
2181 
2182 #if FW_AMPCS_COMPATIBLE
2183  // Serialize the argument size
2184  _status = _logBuff.serializeFrom(
2185  static_cast<U8>(Fw::DeserialStatus::SERIALIZED_SIZE)
2186  );
2187  FW_ASSERT(
2188  _status == Fw::FW_SERIALIZE_OK,
2189  static_cast<FwAssertArgType>(_status)
2190  );
2191 #endif
2192  _status = _logBuff.serializeFrom(Status);
2193  FW_ASSERT(
2194  _status == Fw::FW_SERIALIZE_OK,
2195  static_cast<FwAssertArgType>(_status)
2196  );
2197 
2198  this->Log_out(
2199  0,
2200  _id,
2201  _logTime,
2203  _logBuff
2204  );
2205  }
2206 
2207  // Emit the event on the text log port
2208 #if FW_ENABLE_TEXT_LOGGING
2209  if (this->isConnected_LogText_OutputPort(0)) {
2210 #if FW_OBJECT_NAMES == 1
2211  const char* _formatString =
2212  "(%s) %s: Received malformed command packet. Status: %s";
2213 #else
2214  const char* _formatString =
2215  "%s: Received malformed command packet. Status: %s";
2216 #endif
2217 
2218  Fw::String StatusStr;
2219  Status.toString(StatusStr);
2220 
2221  Fw::TextLogString _logString;
2222  (void) _logString.format(
2223  _formatString,
2224 #if FW_OBJECT_NAMES == 1
2225  this->m_objName.toChar(),
2226 #endif
2227  "MalformedCommand ",
2228  StatusStr.toChar()
2229  );
2230 
2231  this->LogText_out(
2232  0,
2233  _id,
2234  _logTime,
2236  _logString
2237  );
2238  }
2239 #endif
2240  }
2241 
2244  {
2245  // Get the time
2246  Fw::Time _logTime;
2247  if (this->isConnected_Time_OutputPort(0)) {
2248  this->Time_out(0, _logTime);
2249  }
2250 
2251  const FwEventIdType _id = this->getIdBase() + EVENTID_INVALIDCOMMAND;
2252 
2253  // Emit the event on the log port
2254  if (this->isConnected_Log_OutputPort(0)) {
2255  Fw::LogBuffer _logBuff;
2257 
2258 #if FW_AMPCS_COMPATIBLE
2259  // Serialize the number of arguments
2260  _status = _logBuff.serializeFrom(static_cast<U8>(1));
2261  FW_ASSERT(
2262  _status == Fw::FW_SERIALIZE_OK,
2263  static_cast<FwAssertArgType>(_status)
2264  );
2265 #endif
2266 
2267 #if FW_AMPCS_COMPATIBLE
2268  // Serialize the argument size
2269  _status = _logBuff.serializeFrom(
2270  static_cast<U8>(sizeof(FwOpcodeType))
2271  );
2272  FW_ASSERT(
2273  _status == Fw::FW_SERIALIZE_OK,
2274  static_cast<FwAssertArgType>(_status)
2275  );
2276 #endif
2277  _status = _logBuff.serializeFrom(Opcode);
2278  FW_ASSERT(
2279  _status == Fw::FW_SERIALIZE_OK,
2280  static_cast<FwAssertArgType>(_status)
2281  );
2282 
2283  this->Log_out(
2284  0,
2285  _id,
2286  _logTime,
2288  _logBuff
2289  );
2290  }
2291 
2292  // Emit the event on the text log port
2293 #if FW_ENABLE_TEXT_LOGGING
2294  if (this->isConnected_LogText_OutputPort(0)) {
2295 #if FW_OBJECT_NAMES == 1
2296  const char* _formatString =
2297  "(%s) %s: Invalid opcode 0x%" PRIx32 " received";
2298 #else
2299  const char* _formatString =
2300  "%s: Invalid opcode 0x%" PRIx32 " received";
2301 #endif
2302 
2303  Fw::TextLogString _logString;
2304  (void) _logString.format(
2305  _formatString,
2306 #if FW_OBJECT_NAMES == 1
2307  this->m_objName.toChar(),
2308 #endif
2309  "InvalidCommand ",
2310  Opcode
2311  );
2312 
2313  this->LogText_out(
2314  0,
2315  _id,
2316  _logTime,
2318  _logString
2319  );
2320  }
2321 #endif
2322  }
2323 
2326  {
2327  // Get the time
2328  Fw::Time _logTime;
2329  if (this->isConnected_Time_OutputPort(0)) {
2330  this->Time_out(0, _logTime);
2331  }
2332 
2333  const FwEventIdType _id = this->getIdBase() + EVENTID_TOOMANYCOMMANDS;
2334 
2335  // Emit the event on the log port
2336  if (this->isConnected_Log_OutputPort(0)) {
2337  Fw::LogBuffer _logBuff;
2339 
2340 #if FW_AMPCS_COMPATIBLE
2341  // Serialize the number of arguments
2342  _status = _logBuff.serializeFrom(static_cast<U8>(1));
2343  FW_ASSERT(
2344  _status == Fw::FW_SERIALIZE_OK,
2345  static_cast<FwAssertArgType>(_status)
2346  );
2347 #endif
2348 
2349 #if FW_AMPCS_COMPATIBLE
2350  // Serialize the argument size
2351  _status = _logBuff.serializeFrom(
2352  static_cast<U8>(sizeof(FwOpcodeType))
2353  );
2354  FW_ASSERT(
2355  _status == Fw::FW_SERIALIZE_OK,
2356  static_cast<FwAssertArgType>(_status)
2357  );
2358 #endif
2359  _status = _logBuff.serializeFrom(Opcode);
2360  FW_ASSERT(
2361  _status == Fw::FW_SERIALIZE_OK,
2362  static_cast<FwAssertArgType>(_status)
2363  );
2364 
2365  this->Log_out(
2366  0,
2367  _id,
2368  _logTime,
2370  _logBuff
2371  );
2372  }
2373 
2374  // Emit the event on the text log port
2375 #if FW_ENABLE_TEXT_LOGGING
2376  if (this->isConnected_LogText_OutputPort(0)) {
2377 #if FW_OBJECT_NAMES == 1
2378  const char* _formatString =
2379  "(%s) %s: Too many outstanding commands. opcode=0x%" PRIx32 "";
2380 #else
2381  const char* _formatString =
2382  "%s: Too many outstanding commands. opcode=0x%" PRIx32 "";
2383 #endif
2384 
2385  Fw::TextLogString _logString;
2386  (void) _logString.format(
2387  _formatString,
2388 #if FW_OBJECT_NAMES == 1
2389  this->m_objName.toChar(),
2390 #endif
2391  "TooManyCommands ",
2392  Opcode
2393  );
2394 
2395  this->LogText_out(
2396  0,
2397  _id,
2398  _logTime,
2400  _logString
2401  );
2402  }
2403 #endif
2404  }
2405 
2408  {
2409  // Get the time
2410  Fw::Time _logTime;
2411  if (this->isConnected_Time_OutputPort(0)) {
2412  this->Time_out(0, _logTime);
2413  }
2414 
2415  const FwEventIdType _id = this->getIdBase() + EVENTID_NOOPRECEIVED;
2416 
2417  // Emit the event on the log port
2418  if (this->isConnected_Log_OutputPort(0)) {
2419  Fw::LogBuffer _logBuff;
2420 
2421 #if FW_AMPCS_COMPATIBLE
2423  // Serialize the number of arguments
2424  _status = _logBuff.serializeFrom(static_cast<U8>(0));
2425  FW_ASSERT(
2426  _status == Fw::FW_SERIALIZE_OK,
2427  static_cast<FwAssertArgType>(_status)
2428  );
2429 #endif
2430 
2431  this->Log_out(
2432  0,
2433  _id,
2434  _logTime,
2436  _logBuff
2437  );
2438  }
2439 
2440  // Emit the event on the text log port
2441 #if FW_ENABLE_TEXT_LOGGING
2442  if (this->isConnected_LogText_OutputPort(0)) {
2443 #if FW_OBJECT_NAMES == 1
2444  const char* _formatString =
2445  "(%s) %s: Received a NO-OP command";
2446 #else
2447  const char* _formatString =
2448  "%s: Received a NO-OP command";
2449 #endif
2450 
2451  Fw::TextLogString _logString;
2452  (void) _logString.format(
2453  _formatString,
2454 #if FW_OBJECT_NAMES == 1
2455  this->m_objName.toChar(),
2456 #endif
2457  "NoOpReceived "
2458  );
2459 
2460  this->LogText_out(
2461  0,
2462  _id,
2463  _logTime,
2465  _logString
2466  );
2467  }
2468 #endif
2469  }
2470 
2473  {
2474  // Get the time
2475  Fw::Time _logTime;
2476  if (this->isConnected_Time_OutputPort(0)) {
2477  this->Time_out(0, _logTime);
2478  }
2479 
2480  const FwEventIdType _id = this->getIdBase() + EVENTID_NOOPSTRINGRECEIVED;
2481 
2482  // Emit the event on the log port
2483  if (this->isConnected_Log_OutputPort(0)) {
2484  Fw::LogBuffer _logBuff;
2486 
2487 #if FW_AMPCS_COMPATIBLE
2488  // Serialize the number of arguments
2489  _status = _logBuff.serializeFrom(static_cast<U8>(1));
2490  FW_ASSERT(
2491  _status == Fw::FW_SERIALIZE_OK,
2492  static_cast<FwAssertArgType>(_status)
2493  );
2494 #endif
2495 
2496  _status = message.serializeTo(
2497  _logBuff,
2498  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 40)
2499  );
2500  FW_ASSERT(
2501  _status == Fw::FW_SERIALIZE_OK,
2502  static_cast<FwAssertArgType>(_status)
2503  );
2504 
2505  this->Log_out(
2506  0,
2507  _id,
2508  _logTime,
2510  _logBuff
2511  );
2512  }
2513 
2514  // Emit the event on the text log port
2515 #if FW_ENABLE_TEXT_LOGGING
2516  if (this->isConnected_LogText_OutputPort(0)) {
2517 #if FW_OBJECT_NAMES == 1
2518  const char* _formatString =
2519  "(%s) %s: Received a NO-OP string=%s";
2520 #else
2521  const char* _formatString =
2522  "%s: Received a NO-OP string=%s";
2523 #endif
2524 
2525  Fw::TextLogString _logString;
2526  (void) _logString.format(
2527  _formatString,
2528 #if FW_OBJECT_NAMES == 1
2529  this->m_objName.toChar(),
2530 #endif
2531  "NoOpStringReceived ",
2532  message.toChar()
2533  );
2534 
2535  this->LogText_out(
2536  0,
2537  _id,
2538  _logTime,
2540  _logString
2541  );
2542  }
2543 #endif
2544  }
2545 
2548  I32 arg1,
2549  F32 arg2,
2550  U8 arg3
2551  ) const
2552  {
2553  // Get the time
2554  Fw::Time _logTime;
2555  if (this->isConnected_Time_OutputPort(0)) {
2556  this->Time_out(0, _logTime);
2557  }
2558 
2559  const FwEventIdType _id = this->getIdBase() + EVENTID_TESTCMD1ARGS;
2560 
2561  // Emit the event on the log port
2562  if (this->isConnected_Log_OutputPort(0)) {
2563  Fw::LogBuffer _logBuff;
2565 
2566 #if FW_AMPCS_COMPATIBLE
2567  // Serialize the number of arguments
2568  _status = _logBuff.serializeFrom(static_cast<U8>(3));
2569  FW_ASSERT(
2570  _status == Fw::FW_SERIALIZE_OK,
2571  static_cast<FwAssertArgType>(_status)
2572  );
2573 #endif
2574 
2575 #if FW_AMPCS_COMPATIBLE
2576  // Serialize the argument size
2577  _status = _logBuff.serializeFrom(
2578  static_cast<U8>(sizeof(I32))
2579  );
2580  FW_ASSERT(
2581  _status == Fw::FW_SERIALIZE_OK,
2582  static_cast<FwAssertArgType>(_status)
2583  );
2584 #endif
2585  _status = _logBuff.serializeFrom(arg1);
2586  FW_ASSERT(
2587  _status == Fw::FW_SERIALIZE_OK,
2588  static_cast<FwAssertArgType>(_status)
2589  );
2590 
2591 #if FW_AMPCS_COMPATIBLE
2592  // Serialize the argument size
2593  _status = _logBuff.serializeFrom(
2594  static_cast<U8>(sizeof(F32))
2595  );
2596  FW_ASSERT(
2597  _status == Fw::FW_SERIALIZE_OK,
2598  static_cast<FwAssertArgType>(_status)
2599  );
2600 #endif
2601  _status = _logBuff.serializeFrom(arg2);
2602  FW_ASSERT(
2603  _status == Fw::FW_SERIALIZE_OK,
2604  static_cast<FwAssertArgType>(_status)
2605  );
2606 
2607 #if FW_AMPCS_COMPATIBLE
2608  // Serialize the argument size
2609  _status = _logBuff.serializeFrom(
2610  static_cast<U8>(sizeof(U8))
2611  );
2612  FW_ASSERT(
2613  _status == Fw::FW_SERIALIZE_OK,
2614  static_cast<FwAssertArgType>(_status)
2615  );
2616 #endif
2617  _status = _logBuff.serializeFrom(arg3);
2618  FW_ASSERT(
2619  _status == Fw::FW_SERIALIZE_OK,
2620  static_cast<FwAssertArgType>(_status)
2621  );
2622 
2623  this->Log_out(
2624  0,
2625  _id,
2626  _logTime,
2628  _logBuff
2629  );
2630  }
2631 
2632  // Emit the event on the text log port
2633 #if FW_ENABLE_TEXT_LOGGING
2634  if (this->isConnected_LogText_OutputPort(0)) {
2635 #if FW_OBJECT_NAMES == 1
2636  const char* _formatString =
2637  "(%s) %s: TEST_CMD_1 args: I32: %" PRIi32 ", F32: %f, U8: %" PRIu8 "";
2638 #else
2639  const char* _formatString =
2640  "%s: TEST_CMD_1 args: I32: %" PRIi32 ", F32: %f, U8: %" PRIu8 "";
2641 #endif
2642 
2643  Fw::TextLogString _logString;
2644  (void) _logString.format(
2645  _formatString,
2646 #if FW_OBJECT_NAMES == 1
2647  this->m_objName.toChar(),
2648 #endif
2649  "TestCmd1Args ",
2650  arg1,
2651  static_cast<F64>(arg2),
2652  arg3
2653  );
2654 
2655  this->LogText_out(
2656  0,
2657  _id,
2658  _logTime,
2660  _logString
2661  );
2662  }
2663 #endif
2664  }
2665 
2668  FwOpcodeType Opcode,
2669  I32 port
2670  ) const
2671  {
2672  // Get the time
2673  Fw::Time _logTime;
2674  if (this->isConnected_Time_OutputPort(0)) {
2675  this->Time_out(0, _logTime);
2676  }
2677 
2678  const FwEventIdType _id = this->getIdBase() + EVENTID_OPCODEREREGISTERED;
2679 
2680  // Emit the event on the log port
2681  if (this->isConnected_Log_OutputPort(0)) {
2682  Fw::LogBuffer _logBuff;
2684 
2685 #if FW_AMPCS_COMPATIBLE
2686  // Serialize the number of arguments
2687  _status = _logBuff.serializeFrom(static_cast<U8>(2));
2688  FW_ASSERT(
2689  _status == Fw::FW_SERIALIZE_OK,
2690  static_cast<FwAssertArgType>(_status)
2691  );
2692 #endif
2693 
2694 #if FW_AMPCS_COMPATIBLE
2695  // Serialize the argument size
2696  _status = _logBuff.serializeFrom(
2697  static_cast<U8>(sizeof(FwOpcodeType))
2698  );
2699  FW_ASSERT(
2700  _status == Fw::FW_SERIALIZE_OK,
2701  static_cast<FwAssertArgType>(_status)
2702  );
2703 #endif
2704  _status = _logBuff.serializeFrom(Opcode);
2705  FW_ASSERT(
2706  _status == Fw::FW_SERIALIZE_OK,
2707  static_cast<FwAssertArgType>(_status)
2708  );
2709 
2710 #if FW_AMPCS_COMPATIBLE
2711  // Serialize the argument size
2712  _status = _logBuff.serializeFrom(
2713  static_cast<U8>(sizeof(I32))
2714  );
2715  FW_ASSERT(
2716  _status == Fw::FW_SERIALIZE_OK,
2717  static_cast<FwAssertArgType>(_status)
2718  );
2719 #endif
2720  _status = _logBuff.serializeFrom(port);
2721  FW_ASSERT(
2722  _status == Fw::FW_SERIALIZE_OK,
2723  static_cast<FwAssertArgType>(_status)
2724  );
2725 
2726  this->Log_out(
2727  0,
2728  _id,
2729  _logTime,
2731  _logBuff
2732  );
2733  }
2734 
2735  // Emit the event on the text log port
2736 #if FW_ENABLE_TEXT_LOGGING
2737  if (this->isConnected_LogText_OutputPort(0)) {
2738 #if FW_OBJECT_NAMES == 1
2739  const char* _formatString =
2740  "(%s) %s: Opcode 0x%" PRIx32 " is already registered to port %" PRIi32 "";
2741 #else
2742  const char* _formatString =
2743  "%s: Opcode 0x%" PRIx32 " is already registered to port %" PRIi32 "";
2744 #endif
2745 
2746  Fw::TextLogString _logString;
2747  (void) _logString.format(
2748  _formatString,
2749 #if FW_OBJECT_NAMES == 1
2750  this->m_objName.toChar(),
2751 #endif
2752  "OpCodeReregistered ",
2753  Opcode,
2754  port
2755  );
2756 
2757  this->LogText_out(
2758  0,
2759  _id,
2760  _logTime,
2762  _logString
2763  );
2764  }
2765 #endif
2766  }
2767 
2770  FwOpcodeType OpCode,
2771  U32 Context
2772  )
2773  {
2774  // Check throttle value
2775  if (this->m_CommandDroppedQueueOverflowThrottle >= EVENTID_COMMANDDROPPEDQUEUEOVERFLOW_THROTTLE) {
2776  return;
2777  }
2778  else {
2779  this->m_CommandDroppedQueueOverflowThrottle++;
2780  }
2781 
2782  // Get the time
2783  Fw::Time _logTime;
2784  if (this->isConnected_Time_OutputPort(0)) {
2785  this->Time_out(0, _logTime);
2786  }
2787 
2789 
2790  // Emit the event on the log port
2791  if (this->isConnected_Log_OutputPort(0)) {
2792  Fw::LogBuffer _logBuff;
2794 
2795 #if FW_AMPCS_COMPATIBLE
2796  // Serialize the number of arguments
2797  _status = _logBuff.serializeFrom(static_cast<U8>(2));
2798  FW_ASSERT(
2799  _status == Fw::FW_SERIALIZE_OK,
2800  static_cast<FwAssertArgType>(_status)
2801  );
2802 #endif
2803 
2804 #if FW_AMPCS_COMPATIBLE
2805  // Serialize the argument size
2806  _status = _logBuff.serializeFrom(
2807  static_cast<U8>(sizeof(FwOpcodeType))
2808  );
2809  FW_ASSERT(
2810  _status == Fw::FW_SERIALIZE_OK,
2811  static_cast<FwAssertArgType>(_status)
2812  );
2813 #endif
2814  _status = _logBuff.serializeFrom(OpCode);
2815  FW_ASSERT(
2816  _status == Fw::FW_SERIALIZE_OK,
2817  static_cast<FwAssertArgType>(_status)
2818  );
2819 
2820 #if FW_AMPCS_COMPATIBLE
2821  // Serialize the argument size
2822  _status = _logBuff.serializeFrom(
2823  static_cast<U8>(sizeof(U32))
2824  );
2825  FW_ASSERT(
2826  _status == Fw::FW_SERIALIZE_OK,
2827  static_cast<FwAssertArgType>(_status)
2828  );
2829 #endif
2830  _status = _logBuff.serializeFrom(Context);
2831  FW_ASSERT(
2832  _status == Fw::FW_SERIALIZE_OK,
2833  static_cast<FwAssertArgType>(_status)
2834  );
2835 
2836  this->Log_out(
2837  0,
2838  _id,
2839  _logTime,
2841  _logBuff
2842  );
2843  }
2844 
2845  // Emit the event on the text log port
2846 #if FW_ENABLE_TEXT_LOGGING
2847  if (this->isConnected_LogText_OutputPort(0)) {
2848 #if FW_OBJECT_NAMES == 1
2849  const char* _formatString =
2850  "(%s) %s: Opcode 0x%" PRIx32 " was dropped due to buffer overflow and not processed. Context %" PRIu32 "";
2851 #else
2852  const char* _formatString =
2853  "%s: Opcode 0x%" PRIx32 " was dropped due to buffer overflow and not processed. Context %" PRIu32 "";
2854 #endif
2855 
2856  Fw::TextLogString _logString;
2857  (void) _logString.format(
2858  _formatString,
2859 #if FW_OBJECT_NAMES == 1
2860  this->m_objName.toChar(),
2861 #endif
2862  "CommandDroppedQueueOverflow ",
2863  OpCode,
2864  Context
2865  );
2866 
2867  this->LogText_out(
2868  0,
2869  _id,
2870  _logTime,
2872  _logString
2873  );
2874  }
2875 #endif
2876  }
2877 
2878  // ----------------------------------------------------------------------
2879  // Event throttle reset functions
2880  // ----------------------------------------------------------------------
2881 
2884  {
2885  // Reset throttle counter
2886  this->m_CommandDroppedQueueOverflowThrottle = 0;
2887  }
2888 
2889  // ----------------------------------------------------------------------
2890  // Telemetry serialized write
2891  // ----------------------------------------------------------------------
2892 
2895  FwChanIdType id,
2896  Fw::TlmBuffer& _tlmBuff,
2897  Fw::Time _tlmTime
2898  ) const
2899  {
2900  if (this->isConnected_Tlm_OutputPort(0)) {
2901  if (
2902  this->isConnected_Time_OutputPort(0) &&
2903  (_tlmTime == Fw::ZERO_TIME)
2904  ) {
2905  this->Time_out(0, _tlmTime);
2906  }
2907 
2908  FwChanIdType _id;
2909  _id = this->getIdBase() + id;
2910 
2911  this->Tlm_out(
2912  0,
2913  _id,
2914  _tlmTime,
2915  _tlmBuff
2916  );
2917  }
2918  }
2919 
2920  // ----------------------------------------------------------------------
2921  // Telemetry write functions
2922  // ----------------------------------------------------------------------
2923 
2926  U32 arg,
2927  Fw::Time _tlmTime
2928  )
2929  {
2930  // Check to see if it is the first time
2931  if (not this->m_first_update_CommandsDispatched) {
2932  // Check to see if value has changed. If not, don't write it.
2933  if (arg == this->m_last_CommandsDispatched) {
2934  return;
2935  }
2936  else {
2937  this->m_last_CommandsDispatched = arg;
2938  }
2939  }
2940  else {
2941  this->m_first_update_CommandsDispatched = false;
2942  this->m_last_CommandsDispatched = arg;
2943  }
2944 
2945  if (this->isConnected_Tlm_OutputPort(0)) {
2946  Fw::TlmBuffer _tlmBuff;
2947  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
2948  FW_ASSERT(
2949  _stat == Fw::FW_SERIALIZE_OK,
2950  static_cast<FwAssertArgType>(_stat)
2951  );
2952 
2953  this->tlmWrite(
2955  _tlmBuff,
2956  _tlmTime
2957  );
2958  }
2959  }
2960 
2963  U32 arg,
2964  Fw::Time _tlmTime
2965  )
2966  {
2967  // Check to see if it is the first time
2968  if (not this->m_first_update_CommandErrors) {
2969  // Check to see if value has changed. If not, don't write it.
2970  if (arg == this->m_last_CommandErrors) {
2971  return;
2972  }
2973  else {
2974  this->m_last_CommandErrors = arg;
2975  }
2976  }
2977  else {
2978  this->m_first_update_CommandErrors = false;
2979  this->m_last_CommandErrors = arg;
2980  }
2981 
2982  if (this->isConnected_Tlm_OutputPort(0)) {
2983  Fw::TlmBuffer _tlmBuff;
2984  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
2985  FW_ASSERT(
2986  _stat == Fw::FW_SERIALIZE_OK,
2987  static_cast<FwAssertArgType>(_stat)
2988  );
2989 
2990  this->tlmWrite(
2992  _tlmBuff,
2993  _tlmTime
2994  );
2995  }
2996  }
2997 
3000  U32 arg,
3001  Fw::Time _tlmTime
3002  )
3003  {
3004  // Check to see if it is the first time
3005  if (not this->m_first_update_CommandsDropped) {
3006  // Check to see if value has changed. If not, don't write it.
3007  if (arg == this->m_last_CommandsDropped) {
3008  return;
3009  }
3010  else {
3011  this->m_last_CommandsDropped = arg;
3012  }
3013  }
3014  else {
3015  this->m_first_update_CommandsDropped = false;
3016  this->m_last_CommandsDropped = arg;
3017  }
3018 
3019  if (this->isConnected_Tlm_OutputPort(0)) {
3020  Fw::TlmBuffer _tlmBuff;
3021  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
3022  FW_ASSERT(
3023  _stat == Fw::FW_SERIALIZE_OK,
3024  static_cast<FwAssertArgType>(_stat)
3025  );
3026 
3027  this->tlmWrite(
3029  _tlmBuff,
3030  _tlmTime
3031  );
3032  }
3033  }
3034 
3035  // ----------------------------------------------------------------------
3036  // Time
3037  // ----------------------------------------------------------------------
3038 
3040  getTime() const
3041  {
3042  if (this->isConnected_Time_OutputPort(0)) {
3043  Fw::Time _time;
3044  this->Time_out(0, _time);
3045  return _time;
3046  }
3047  else {
3048  return Fw::Time(TimeBase::TB_NONE, 0, 0);
3049  }
3050  }
3051 
3052  // ----------------------------------------------------------------------
3053  // Mutex operations for guarded ports
3054  //
3055  // You can override these operations to provide more sophisticated
3056  // synchronization
3057  // ----------------------------------------------------------------------
3058 
3061  {
3062  this->m_guardedPortMutex.lock();
3063  }
3064 
3067  {
3068  this->m_guardedPortMutex.unLock();
3069  }
3070 
3071  // ----------------------------------------------------------------------
3072  // Message dispatch functions
3073  // ----------------------------------------------------------------------
3074 
3075  Fw::QueuedComponentBase::MsgDispatchStatus CommandDispatcherComponentBase ::
3076  doDispatch()
3077  {
3078  ComponentIpcSerializableBuffer _msg;
3079  FwQueuePriorityType _priority = 0;
3080 
3081  Os::Queue::Status _msgStatus = this->m_queue.receive(
3082  _msg,
3084  _priority
3085  );
3086  FW_ASSERT(
3087  _msgStatus == Os::Queue::OP_OK,
3088  static_cast<FwAssertArgType>(_msgStatus)
3089  );
3090 
3091  // Reset to beginning of buffer
3092  _msg.resetDeser();
3093 
3094  FwEnumStoreType _desMsg = 0;
3095  Fw::SerializeStatus _deserStatus = _msg.deserializeTo(_desMsg);
3096  FW_ASSERT(
3097  _deserStatus == Fw::FW_SERIALIZE_OK,
3098  static_cast<FwAssertArgType>(_deserStatus)
3099  );
3100 
3101  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
3102 
3103  if (_msgType == COMMANDDISPATCHER_COMPONENT_EXIT) {
3104  return MSG_DISPATCH_EXIT;
3105  }
3106 
3107  FwIndexType portNum = 0;
3108  _deserStatus = _msg.deserializeTo(portNum);
3109  FW_ASSERT(
3110  _deserStatus == Fw::FW_SERIALIZE_OK,
3111  static_cast<FwAssertArgType>(_deserStatus)
3112  );
3113 
3114  switch (_msgType) {
3115  // Handle async input port compCmdStat
3116  case COMPCMDSTAT_CMDRESPONSE: {
3117  // Deserialize argument opCode
3118  FwOpcodeType opCode;
3119  _deserStatus = _msg.deserializeTo(opCode);
3120  FW_ASSERT(
3121  _deserStatus == Fw::FW_SERIALIZE_OK,
3122  static_cast<FwAssertArgType>(_deserStatus)
3123  );
3124 
3125  // Deserialize argument cmdSeq
3126  U32 cmdSeq;
3127  _deserStatus = _msg.deserializeTo(cmdSeq);
3128  FW_ASSERT(
3129  _deserStatus == Fw::FW_SERIALIZE_OK,
3130  static_cast<FwAssertArgType>(_deserStatus)
3131  );
3132 
3133  // Deserialize argument response
3134  Fw::CmdResponse response;
3135  _deserStatus = _msg.deserializeTo(response);
3136  FW_ASSERT(
3137  _deserStatus == Fw::FW_SERIALIZE_OK,
3138  static_cast<FwAssertArgType>(_deserStatus)
3139  );
3140  // Call handler function
3141  this->compCmdStat_handler(
3142  portNum,
3143  opCode,
3144  cmdSeq,
3145  response
3146  );
3147 
3148  break;
3149  }
3150 
3151  // Handle async input port pingIn
3152  case PINGIN_PING: {
3153  // Deserialize argument key
3154  U32 key;
3155  _deserStatus = _msg.deserializeTo(key);
3156  FW_ASSERT(
3157  _deserStatus == Fw::FW_SERIALIZE_OK,
3158  static_cast<FwAssertArgType>(_deserStatus)
3159  );
3160  // Call handler function
3161  this->pingIn_handler(
3162  portNum,
3163  key
3164  );
3165 
3166  break;
3167  }
3168 
3169  // Handle async input port run
3170  case RUN_SCHED: {
3171  // Deserialize argument context
3172  U32 context;
3173  _deserStatus = _msg.deserializeTo(context);
3174  FW_ASSERT(
3175  _deserStatus == Fw::FW_SERIALIZE_OK,
3176  static_cast<FwAssertArgType>(_deserStatus)
3177  );
3178  // Call handler function
3179  this->run_handler(
3180  portNum,
3181  context
3182  );
3183 
3184  break;
3185  }
3186 
3187  // Handle async input port seqCmdBuff
3188  case SEQCMDBUFF_COM: {
3189  // Deserialize argument data
3190  Fw::ComBuffer data;
3191  _deserStatus = _msg.deserializeTo(data);
3192  FW_ASSERT(
3193  _deserStatus == Fw::FW_SERIALIZE_OK,
3194  static_cast<FwAssertArgType>(_deserStatus)
3195  );
3196 
3197  // Deserialize argument context
3198  U32 context;
3199  _deserStatus = _msg.deserializeTo(context);
3200  FW_ASSERT(
3201  _deserStatus == Fw::FW_SERIALIZE_OK,
3202  static_cast<FwAssertArgType>(_deserStatus)
3203  );
3204  // Call handler function
3205  this->seqCmdBuff_handler(
3206  portNum,
3207  data,
3208  context
3209  );
3210 
3211  break;
3212  }
3213 
3214  // Handle command CMD_NO_OP
3215  case CMD_CMD_NO_OP: {
3216  // Deserialize opcode
3217  FwOpcodeType _opCode = 0;
3218  _deserStatus = _msg.deserializeTo(_opCode);
3219  FW_ASSERT (
3220  _deserStatus == Fw::FW_SERIALIZE_OK,
3221  static_cast<FwAssertArgType>(_deserStatus)
3222  );
3223 
3224  // Deserialize command sequence
3225  U32 _cmdSeq = 0;
3226  _deserStatus = _msg.deserializeTo(_cmdSeq);
3227  FW_ASSERT (
3228  _deserStatus == Fw::FW_SERIALIZE_OK,
3229  static_cast<FwAssertArgType>(_deserStatus)
3230  );
3231 
3232  // Deserialize command argument buffer
3233  Fw::CmdArgBuffer args;
3234  _deserStatus = _msg.deserializeTo(args);
3235  FW_ASSERT (
3236  _deserStatus == Fw::FW_SERIALIZE_OK,
3237  static_cast<FwAssertArgType>(_deserStatus)
3238  );
3239 
3240  // Reset buffer
3241  args.resetDeser();
3242 
3243  // Make sure there was no data left over.
3244  // That means the argument buffer size was incorrect.
3245 #if FW_CMD_CHECK_RESIDUAL
3246  if (args.getDeserializeSizeLeft() != 0) {
3247  if (this->isConnected_CmdStatus_OutputPort(0)) {
3248  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
3249  }
3250  // Don't crash the task if bad arguments were passed from the ground
3251  break;
3252  }
3253 #endif
3254 
3255  // Call handler function
3256  this->CMD_NO_OP_cmdHandler(_opCode, _cmdSeq);
3257 
3258  break;
3259  }
3260 
3261  // Handle command CMD_NO_OP_STRING
3262  case CMD_CMD_NO_OP_STRING: {
3263  // Deserialize opcode
3264  FwOpcodeType _opCode = 0;
3265  _deserStatus = _msg.deserializeTo(_opCode);
3266  FW_ASSERT (
3267  _deserStatus == Fw::FW_SERIALIZE_OK,
3268  static_cast<FwAssertArgType>(_deserStatus)
3269  );
3270 
3271  // Deserialize command sequence
3272  U32 _cmdSeq = 0;
3273  _deserStatus = _msg.deserializeTo(_cmdSeq);
3274  FW_ASSERT (
3275  _deserStatus == Fw::FW_SERIALIZE_OK,
3276  static_cast<FwAssertArgType>(_deserStatus)
3277  );
3278 
3279  // Deserialize command argument buffer
3280  Fw::CmdArgBuffer args;
3281  _deserStatus = _msg.deserializeTo(args);
3282  FW_ASSERT (
3283  _deserStatus == Fw::FW_SERIALIZE_OK,
3284  static_cast<FwAssertArgType>(_deserStatus)
3285  );
3286 
3287  // Reset buffer
3288  args.resetDeser();
3289 
3290  // Deserialize argument arg1
3291  Fw::CmdStringArg arg1;
3292  _deserStatus = args.deserializeTo(arg1);
3293  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
3294  if (this->isConnected_CmdStatus_OutputPort(0)) {
3295  this->cmdResponse_out(
3296  _opCode,
3297  _cmdSeq,
3299  );
3300  }
3301  // Don't crash the task if bad arguments were passed from the ground
3302  break;
3303  }
3304 
3305  // Make sure there was no data left over.
3306  // That means the argument buffer size was incorrect.
3307 #if FW_CMD_CHECK_RESIDUAL
3308  if (args.getDeserializeSizeLeft() != 0) {
3309  if (this->isConnected_CmdStatus_OutputPort(0)) {
3310  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
3311  }
3312  // Don't crash the task if bad arguments were passed from the ground
3313  break;
3314  }
3315 #endif
3316 
3317  // Call handler function
3319  _opCode, _cmdSeq,
3320  arg1
3321  );
3322 
3323  break;
3324  }
3325 
3326  // Handle command CMD_TEST_CMD_1
3327  case CMD_CMD_TEST_CMD_1: {
3328  // Deserialize opcode
3329  FwOpcodeType _opCode = 0;
3330  _deserStatus = _msg.deserializeTo(_opCode);
3331  FW_ASSERT (
3332  _deserStatus == Fw::FW_SERIALIZE_OK,
3333  static_cast<FwAssertArgType>(_deserStatus)
3334  );
3335 
3336  // Deserialize command sequence
3337  U32 _cmdSeq = 0;
3338  _deserStatus = _msg.deserializeTo(_cmdSeq);
3339  FW_ASSERT (
3340  _deserStatus == Fw::FW_SERIALIZE_OK,
3341  static_cast<FwAssertArgType>(_deserStatus)
3342  );
3343 
3344  // Deserialize command argument buffer
3345  Fw::CmdArgBuffer args;
3346  _deserStatus = _msg.deserializeTo(args);
3347  FW_ASSERT (
3348  _deserStatus == Fw::FW_SERIALIZE_OK,
3349  static_cast<FwAssertArgType>(_deserStatus)
3350  );
3351 
3352  // Reset buffer
3353  args.resetDeser();
3354 
3355  // Deserialize argument arg1
3356  I32 arg1;
3357  _deserStatus = args.deserializeTo(arg1);
3358  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
3359  if (this->isConnected_CmdStatus_OutputPort(0)) {
3360  this->cmdResponse_out(
3361  _opCode,
3362  _cmdSeq,
3364  );
3365  }
3366  // Don't crash the task if bad arguments were passed from the ground
3367  break;
3368  }
3369 
3370  // Deserialize argument arg2
3371  F32 arg2;
3372  _deserStatus = args.deserializeTo(arg2);
3373  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
3374  if (this->isConnected_CmdStatus_OutputPort(0)) {
3375  this->cmdResponse_out(
3376  _opCode,
3377  _cmdSeq,
3379  );
3380  }
3381  // Don't crash the task if bad arguments were passed from the ground
3382  break;
3383  }
3384 
3385  // Deserialize argument arg3
3386  U8 arg3;
3387  _deserStatus = args.deserializeTo(arg3);
3388  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
3389  if (this->isConnected_CmdStatus_OutputPort(0)) {
3390  this->cmdResponse_out(
3391  _opCode,
3392  _cmdSeq,
3394  );
3395  }
3396  // Don't crash the task if bad arguments were passed from the ground
3397  break;
3398  }
3399 
3400  // Make sure there was no data left over.
3401  // That means the argument buffer size was incorrect.
3402 #if FW_CMD_CHECK_RESIDUAL
3403  if (args.getDeserializeSizeLeft() != 0) {
3404  if (this->isConnected_CmdStatus_OutputPort(0)) {
3405  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
3406  }
3407  // Don't crash the task if bad arguments were passed from the ground
3408  break;
3409  }
3410 #endif
3411 
3412  // Call handler function
3414  _opCode, _cmdSeq,
3415  arg1,
3416  arg2,
3417  arg3
3418  );
3419 
3420  break;
3421  }
3422 
3423  // Handle command CMD_CLEAR_TRACKING
3424  case CMD_CMD_CLEAR_TRACKING: {
3425  // Deserialize opcode
3426  FwOpcodeType _opCode = 0;
3427  _deserStatus = _msg.deserializeTo(_opCode);
3428  FW_ASSERT (
3429  _deserStatus == Fw::FW_SERIALIZE_OK,
3430  static_cast<FwAssertArgType>(_deserStatus)
3431  );
3432 
3433  // Deserialize command sequence
3434  U32 _cmdSeq = 0;
3435  _deserStatus = _msg.deserializeTo(_cmdSeq);
3436  FW_ASSERT (
3437  _deserStatus == Fw::FW_SERIALIZE_OK,
3438  static_cast<FwAssertArgType>(_deserStatus)
3439  );
3440 
3441  // Deserialize command argument buffer
3442  Fw::CmdArgBuffer args;
3443  _deserStatus = _msg.deserializeTo(args);
3444  FW_ASSERT (
3445  _deserStatus == Fw::FW_SERIALIZE_OK,
3446  static_cast<FwAssertArgType>(_deserStatus)
3447  );
3448 
3449  // Reset buffer
3450  args.resetDeser();
3451 
3452  // Make sure there was no data left over.
3453  // That means the argument buffer size was incorrect.
3454 #if FW_CMD_CHECK_RESIDUAL
3455  if (args.getDeserializeSizeLeft() != 0) {
3456  if (this->isConnected_CmdStatus_OutputPort(0)) {
3457  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
3458  }
3459  // Don't crash the task if bad arguments were passed from the ground
3460  break;
3461  }
3462 #endif
3463 
3464  // Call handler function
3465  this->CMD_CLEAR_TRACKING_cmdHandler(_opCode, _cmdSeq);
3466 
3467  break;
3468  }
3469 
3470  default:
3471  return MSG_DISPATCH_ERROR;
3472  }
3473 
3474  return MSG_DISPATCH_OK;
3475  }
3476 
3477  // ----------------------------------------------------------------------
3478  // Calls for messages received on special input ports
3479  // ----------------------------------------------------------------------
3480 
3481  void CommandDispatcherComponentBase ::
3482  m_p_CmdDisp_in(
3483  Fw::PassiveComponentBase* callComp,
3484  FwIndexType portNum,
3485  FwOpcodeType opCode,
3486  U32 cmdSeq,
3487  Fw::CmdArgBuffer& args
3488  )
3489  {
3490  FW_ASSERT(callComp != nullptr);
3491  CommandDispatcherComponentBase* compPtr = static_cast<CommandDispatcherComponentBase*>(callComp);
3492  compPtr->CmdDisp_handlerBase(
3493  portNum,
3494  opCode,
3495  cmdSeq,
3496  args
3497  );
3498  }
3499 
3500  // ----------------------------------------------------------------------
3501  // Calls for messages received on typed input ports
3502  // ----------------------------------------------------------------------
3503 
3504  void CommandDispatcherComponentBase ::
3505  m_p_compCmdReg_in(
3506  Fw::PassiveComponentBase* callComp,
3507  FwIndexType portNum,
3508  FwOpcodeType opCode
3509  )
3510  {
3511  FW_ASSERT(callComp != nullptr);
3512  CommandDispatcherComponentBase* compPtr = static_cast<CommandDispatcherComponentBase*>(callComp);
3513  compPtr->compCmdReg_handlerBase(
3514  portNum,
3515  opCode
3516  );
3517  }
3518 
3519  void CommandDispatcherComponentBase ::
3520  m_p_compCmdStat_in(
3521  Fw::PassiveComponentBase* callComp,
3522  FwIndexType portNum,
3523  FwOpcodeType opCode,
3524  U32 cmdSeq,
3525  const Fw::CmdResponse& response
3526  )
3527  {
3528  FW_ASSERT(callComp != nullptr);
3529  CommandDispatcherComponentBase* compPtr = static_cast<CommandDispatcherComponentBase*>(callComp);
3530  compPtr->compCmdStat_handlerBase(
3531  portNum,
3532  opCode,
3533  cmdSeq,
3534  response
3535  );
3536  }
3537 
3538  void CommandDispatcherComponentBase ::
3539  m_p_pingIn_in(
3540  Fw::PassiveComponentBase* callComp,
3541  FwIndexType portNum,
3542  U32 key
3543  )
3544  {
3545  FW_ASSERT(callComp != nullptr);
3546  CommandDispatcherComponentBase* compPtr = static_cast<CommandDispatcherComponentBase*>(callComp);
3547  compPtr->pingIn_handlerBase(
3548  portNum,
3549  key
3550  );
3551  }
3552 
3553  void CommandDispatcherComponentBase ::
3554  m_p_run_in(
3555  Fw::PassiveComponentBase* callComp,
3556  FwIndexType portNum,
3557  U32 context
3558  )
3559  {
3560  FW_ASSERT(callComp != nullptr);
3561  CommandDispatcherComponentBase* compPtr = static_cast<CommandDispatcherComponentBase*>(callComp);
3562  compPtr->run_handlerBase(
3563  portNum,
3564  context
3565  );
3566  }
3567 
3568  void CommandDispatcherComponentBase ::
3569  m_p_seqCmdBuff_in(
3570  Fw::PassiveComponentBase* callComp,
3571  FwIndexType portNum,
3572  Fw::ComBuffer& data,
3573  U32 context
3574  )
3575  {
3576  FW_ASSERT(callComp != nullptr);
3577  CommandDispatcherComponentBase* compPtr = static_cast<CommandDispatcherComponentBase*>(callComp);
3578  compPtr->seqCmdBuff_handlerBase(
3579  portNum,
3580  data,
3581  context
3582  );
3583  }
3584 
3585 #if !FW_DIRECT_PORT_CALLS
3586 
3587  // ----------------------------------------------------------------------
3588  // Invocation functions for special output ports
3589  // ----------------------------------------------------------------------
3590 
3591  void CommandDispatcherComponentBase ::
3592  CmdReg_out(
3593  FwIndexType portNum,
3594  FwOpcodeType opCode
3595  ) const
3596  {
3597  FW_ASSERT(
3598  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
3599  static_cast<FwAssertArgType>(portNum)
3600  );
3601 
3602  FW_ASSERT(
3603  this->m_CmdReg_OutputPort[portNum].isConnected(),
3604  static_cast<FwAssertArgType>(portNum)
3605  );
3606  this->m_CmdReg_OutputPort[portNum].invoke(
3607  opCode
3608  );
3609  }
3610 
3611  void CommandDispatcherComponentBase ::
3612  CmdStatus_out(
3613  FwIndexType portNum,
3614  FwOpcodeType opCode,
3615  U32 cmdSeq,
3616  const Fw::CmdResponse& response
3617  ) const
3618  {
3619  FW_ASSERT(
3620  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
3621  static_cast<FwAssertArgType>(portNum)
3622  );
3623 
3624  FW_ASSERT(
3625  this->m_CmdStatus_OutputPort[portNum].isConnected(),
3626  static_cast<FwAssertArgType>(portNum)
3627  );
3628  this->m_CmdStatus_OutputPort[portNum].invoke(
3629  opCode,
3630  cmdSeq,
3631  response
3632  );
3633  }
3634 
3635  void CommandDispatcherComponentBase ::
3636  Log_out(
3637  FwIndexType portNum,
3638  FwEventIdType id,
3639  Fw::Time& timeTag,
3640  const Fw::LogSeverity& severity,
3641  Fw::LogBuffer& args
3642  ) const
3643  {
3644  FW_ASSERT(
3645  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
3646  static_cast<FwAssertArgType>(portNum)
3647  );
3648 
3649  FW_ASSERT(
3650  this->m_Log_OutputPort[portNum].isConnected(),
3651  static_cast<FwAssertArgType>(portNum)
3652  );
3653  this->m_Log_OutputPort[portNum].invoke(
3654  id,
3655  timeTag,
3656  severity,
3657  args
3658  );
3659  }
3660 
3661 #if FW_ENABLE_TEXT_LOGGING
3662 
3663  void CommandDispatcherComponentBase ::
3664  LogText_out(
3665  FwIndexType portNum,
3666  FwEventIdType id,
3667  Fw::Time& timeTag,
3668  const Fw::LogSeverity& severity,
3669  Fw::TextLogString& text
3670  ) const
3671  {
3672  FW_ASSERT(
3673  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
3674  static_cast<FwAssertArgType>(portNum)
3675  );
3676 
3677  FW_ASSERT(
3678  this->m_LogText_OutputPort[portNum].isConnected(),
3679  static_cast<FwAssertArgType>(portNum)
3680  );
3681  this->m_LogText_OutputPort[portNum].invoke(
3682  id,
3683  timeTag,
3684  severity,
3685  text
3686  );
3687  }
3688 
3689 #endif
3690 
3691  void CommandDispatcherComponentBase ::
3692  Time_out(
3693  FwIndexType portNum,
3694  Fw::Time& time
3695  ) const
3696  {
3697  FW_ASSERT(
3698  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
3699  static_cast<FwAssertArgType>(portNum)
3700  );
3701 
3702  FW_ASSERT(
3703  this->m_Time_OutputPort[portNum].isConnected(),
3704  static_cast<FwAssertArgType>(portNum)
3705  );
3706  this->m_Time_OutputPort[portNum].invoke(
3707  time
3708  );
3709  }
3710 
3711  void CommandDispatcherComponentBase ::
3712  Tlm_out(
3713  FwIndexType portNum,
3714  FwChanIdType id,
3715  Fw::Time& timeTag,
3716  Fw::TlmBuffer& val
3717  ) const
3718  {
3719  FW_ASSERT(
3720  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
3721  static_cast<FwAssertArgType>(portNum)
3722  );
3723 
3724  FW_ASSERT(
3725  this->m_Tlm_OutputPort[portNum].isConnected(),
3726  static_cast<FwAssertArgType>(portNum)
3727  );
3728  this->m_Tlm_OutputPort[portNum].invoke(
3729  id,
3730  timeTag,
3731  val
3732  );
3733  }
3734 
3735 #endif
3736 
3737 }
Serialization/Deserialization operation was successful.
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:157
void set_seqCmdStatus_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to seqCmdStatus[portNum].
static constexpr FwIndexType getNum_run_InputPorts()
static constexpr FwSizeType CAPACITY
Definition: CmdPortAc.hpp:36
The command dispatcher has successfully received a NO-OP command from GUI with a string.
virtual void CMD_NO_OP_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command CMD_NO_OP.
This log event reports the Command Sequence Buffer port queue has overflowed.
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
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)
void init()
Initialization function.
Definition: SchedPortAc.cpp:73
Deserialization status.
message to exit active component task
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.
void unLock()
unlock the mutex and assert success
Definition: Mutex.cpp:41
Fw::InputCmdPort * get_CmdDisp_InputPort(FwIndexType portNum)
void invoke(U32 key) const
Invoke a port connection.
Definition: PingPortAc.cpp:170
virtual const CHAR * toChar() const =0
Convert to a C-style char*.
virtual void pingIn_preMsgHook(FwIndexType portNum, U32 key)
Pre-message hook for async input port pingIn.
virtual void compCmdStat_handler(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)=0
Handler for input port compCmdStat.
const Time ZERO_TIME
Definition: Time.cpp:5
bool isConnected_CmdReg_OutputPort(FwIndexType portNum) const
virtual void run_handler(FwIndexType portNum, U32 context)=0
Handler for input port run.
virtual void CMD_NO_OP_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
void log_ACTIVITY_HI_TestCmd1Args(I32 arg1, F32 arg2, U8 arg3) const
void compCmdSend_out(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args) const
Invoke output port compCmdSend.
The command dispatcher has successfully received a NO-OP command.
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
This log event message returns the TEST_CMD_1 arguments.
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()
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.
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
PlatformQueuePriorityType FwQueuePriorityType
The type of queue priorities used.
The size of the serial representation.
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.
The size of the serial representation.
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.
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
Exceeded the number of commands that can be simultaneously executed.
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
static constexpr FwIndexType getNum_seqCmdBuff_InputPorts()
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: PingPortAc.cpp:79
Message will return with status when space is unavailable.
Definition: Queue.hpp:48
void CMD_NO_OP_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Implementation of malloc based allocator.
static constexpr FwIndexType getNum_compCmdSend_OutputPorts()
virtual void seqCmdBuff_handler(FwIndexType portNum, Fw::ComBuffer &data, U32 context)=0
Handler for input port seqCmdBuff.
static constexpr FwIndexType getNum_compCmdStat_InputPorts()
virtual void seqCmdBuff_preMsgHook(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Pre-message hook for async input port seqCmdBuff.
void init()
Initialization function.
Fw::InputComPort * get_seqCmdBuff_InputPort(FwIndexType portNum)
void compCmdReg_handlerBase(FwIndexType portNum, FwOpcodeType opCode)
Handler base-class function for input port compCmdReg.
void set_pingOut_OutputPort(FwIndexType portNum, Svc::InputPingPort *port)
Connect port to pingOut[portNum].
static constexpr FwIndexType getNum_seqCmdStatus_OutputPorts()
void log_WARNING_HI_TooManyCommands(FwOpcodeType Opcode) const
virtual void lock()
Lock the guarded mutex.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
static constexpr FwSizeType CAPACITY
Definition: SchedPortAc.hpp:34
void log_COMMAND_OpCodeDispatched(FwOpcodeType Opcode, I32 port) const
void set_Log_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
void set_Time_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to Time[portNum].
void set_CmdStatus_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to CmdStatus[portNum].
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.
void lock()
lock the mutex and assert success
Definition: Mutex.cpp:34
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)