F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
TlmPacketizerComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title TlmPacketizerComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for TlmPacketizer 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  TLMPACKETIZER_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT,
19  RUN_SCHED,
20  CONFIGURESECTIONGROUPRATE_CONFIGUREGROUPRATE,
21  CONTROLIN_ENABLESECTION,
22  PINGIN_PING,
23  CMD_SET_LEVEL,
24  CMD_SEND_PKT,
25  CMD_ENABLE_SECTION,
26  CMD_ENABLE_GROUP,
27  CMD_FORCE_GROUP,
28  CMD_CONFIGURE_GROUP_RATES,
29  };
30 
31  // Get the max size by constructing a union of the async input, command, and
32  // internal port serialization sizes
33  union BuffUnion {
35  BYTE configureSectionGroupRatePortSize[Svc::ConfigureGroupRatePortBuffer::CAPACITY];
37  BYTE pingInPortSize[Svc::PingPortBuffer::CAPACITY];
38  BYTE cmdPortSize[Fw::CmdPortBuffer::CAPACITY];
39  };
40 
41  // Define a message buffer class large enough to handle all the
42  // asynchronous inputs to the component
43  class ComponentIpcSerializableBuffer :
45  {
46 
47  public:
48 
49  enum {
50  // Offset into data in buffer: Size of message ID and port number
51  DATA_OFFSET = sizeof(FwEnumStoreType) + sizeof(FwIndexType),
52  // Max data size
53  MAX_DATA_SIZE = sizeof(BuffUnion),
54  // Max message size: Size of message id + size of port + max data size
55  SERIALIZATION_SIZE = DATA_OFFSET + MAX_DATA_SIZE
56  };
57 
58  Fw::Serializable::SizeType getCapacity() const {
59  return sizeof(m_buff);
60  }
61 
62  U8* getBuffAddr() {
63  return m_buff;
64  }
65 
66  const U8* getBuffAddr() const {
67  return m_buff;
68  }
69 
70  private:
71  // Should be the max of all the input ports serialized sizes...
72  U8 m_buff[SERIALIZATION_SIZE];
73 
74  };
75  }
76 
77  // ----------------------------------------------------------------------
78  // Component initialization
79  // ----------------------------------------------------------------------
80 
83  FwSizeType queueDepth,
84  FwEnumStoreType instance
85  )
86  {
87  // Initialize base class
89 
90 #if !FW_DIRECT_PORT_CALLS
91  // Connect input port cmdIn
92  for (
93  FwIndexType port = 0;
94  port < static_cast<FwIndexType>(this->getNum_cmdIn_InputPorts());
95  port++
96  ) {
97  this->m_cmdIn_InputPort[port].init();
98  this->m_cmdIn_InputPort[port].addCallComp(
99  this,
100  m_p_cmdIn_in
101  );
102  this->m_cmdIn_InputPort[port].setPortNum(port);
103 
104 #if FW_OBJECT_NAMES == 1
105  Fw::ObjectName portName;
106  portName.format(
107  "%s_cmdIn_InputPort[%" PRI_FwIndexType "]",
108  this->m_objName.toChar(),
109  port
110  );
111  this->m_cmdIn_InputPort[port].setObjName(portName.toChar());
112 #endif
113  }
114 #endif
115 
116 #if !FW_DIRECT_PORT_CALLS
117  // Connect input port Run
118  for (
119  FwIndexType port = 0;
120  port < static_cast<FwIndexType>(this->getNum_Run_InputPorts());
121  port++
122  ) {
123  this->m_Run_InputPort[port].init();
124  this->m_Run_InputPort[port].addCallComp(
125  this,
126  m_p_Run_in
127  );
128  this->m_Run_InputPort[port].setPortNum(port);
129 
130 #if FW_OBJECT_NAMES == 1
131  Fw::ObjectName portName;
132  portName.format(
133  "%s_Run_InputPort[%" PRI_FwIndexType "]",
134  this->m_objName.toChar(),
135  port
136  );
137  this->m_Run_InputPort[port].setObjName(portName.toChar());
138 #endif
139  }
140 #endif
141 
142 #if !FW_DIRECT_PORT_CALLS
143  // Connect input port TlmGet
144  for (
145  FwIndexType port = 0;
146  port < static_cast<FwIndexType>(this->getNum_TlmGet_InputPorts());
147  port++
148  ) {
149  this->m_TlmGet_InputPort[port].init();
150  this->m_TlmGet_InputPort[port].addCallComp(
151  this,
152  m_p_TlmGet_in
153  );
154  this->m_TlmGet_InputPort[port].setPortNum(port);
155 
156 #if FW_OBJECT_NAMES == 1
157  Fw::ObjectName portName;
158  portName.format(
159  "%s_TlmGet_InputPort[%" PRI_FwIndexType "]",
160  this->m_objName.toChar(),
161  port
162  );
163  this->m_TlmGet_InputPort[port].setObjName(portName.toChar());
164 #endif
165  }
166 #endif
167 
168 #if !FW_DIRECT_PORT_CALLS
169  // Connect input port TlmRecv
170  for (
171  FwIndexType port = 0;
172  port < static_cast<FwIndexType>(this->getNum_TlmRecv_InputPorts());
173  port++
174  ) {
175  this->m_TlmRecv_InputPort[port].init();
176  this->m_TlmRecv_InputPort[port].addCallComp(
177  this,
178  m_p_TlmRecv_in
179  );
180  this->m_TlmRecv_InputPort[port].setPortNum(port);
181 
182 #if FW_OBJECT_NAMES == 1
183  Fw::ObjectName portName;
184  portName.format(
185  "%s_TlmRecv_InputPort[%" PRI_FwIndexType "]",
186  this->m_objName.toChar(),
187  port
188  );
189  this->m_TlmRecv_InputPort[port].setObjName(portName.toChar());
190 #endif
191  }
192 #endif
193 
194 #if !FW_DIRECT_PORT_CALLS
195  // Connect input port configureSectionGroupRate
196  for (
197  FwIndexType port = 0;
198  port < static_cast<FwIndexType>(this->getNum_configureSectionGroupRate_InputPorts());
199  port++
200  ) {
201  this->m_configureSectionGroupRate_InputPort[port].init();
202  this->m_configureSectionGroupRate_InputPort[port].addCallComp(
203  this,
204  m_p_configureSectionGroupRate_in
205  );
206  this->m_configureSectionGroupRate_InputPort[port].setPortNum(port);
207 
208 #if FW_OBJECT_NAMES == 1
209  Fw::ObjectName portName;
210  portName.format(
211  "%s_configureSectionGroupRate_InputPort[%" PRI_FwIndexType "]",
212  this->m_objName.toChar(),
213  port
214  );
215  this->m_configureSectionGroupRate_InputPort[port].setObjName(portName.toChar());
216 #endif
217  }
218 #endif
219 
220 #if !FW_DIRECT_PORT_CALLS
221  // Connect input port controlIn
222  for (
223  FwIndexType port = 0;
224  port < static_cast<FwIndexType>(this->getNum_controlIn_InputPorts());
225  port++
226  ) {
227  this->m_controlIn_InputPort[port].init();
228  this->m_controlIn_InputPort[port].addCallComp(
229  this,
230  m_p_controlIn_in
231  );
232  this->m_controlIn_InputPort[port].setPortNum(port);
233 
234 #if FW_OBJECT_NAMES == 1
235  Fw::ObjectName portName;
236  portName.format(
237  "%s_controlIn_InputPort[%" PRI_FwIndexType "]",
238  this->m_objName.toChar(),
239  port
240  );
241  this->m_controlIn_InputPort[port].setObjName(portName.toChar());
242 #endif
243  }
244 #endif
245 
246 #if !FW_DIRECT_PORT_CALLS
247  // Connect input port pingIn
248  for (
249  FwIndexType port = 0;
250  port < static_cast<FwIndexType>(this->getNum_pingIn_InputPorts());
251  port++
252  ) {
253  this->m_pingIn_InputPort[port].init();
254  this->m_pingIn_InputPort[port].addCallComp(
255  this,
256  m_p_pingIn_in
257  );
258  this->m_pingIn_InputPort[port].setPortNum(port);
259 
260 #if FW_OBJECT_NAMES == 1
261  Fw::ObjectName portName;
262  portName.format(
263  "%s_pingIn_InputPort[%" PRI_FwIndexType "]",
264  this->m_objName.toChar(),
265  port
266  );
267  this->m_pingIn_InputPort[port].setObjName(portName.toChar());
268 #endif
269  }
270 #endif
271 
272 #if !FW_DIRECT_PORT_CALLS
273  // Connect output port cmdRegOut
274  for (
275  FwIndexType port = 0;
276  port < static_cast<FwIndexType>(this->getNum_cmdRegOut_OutputPorts());
277  port++
278  ) {
279  this->m_cmdRegOut_OutputPort[port].init();
280 
281 #if FW_OBJECT_NAMES == 1
282  Fw::ObjectName portName;
283  portName.format(
284  "%s_cmdRegOut_OutputPort[%" PRI_FwIndexType "]",
285  this->m_objName.toChar(),
286  port
287  );
288  this->m_cmdRegOut_OutputPort[port].setObjName(portName.toChar());
289 #endif
290  }
291 #endif
292 
293 #if !FW_DIRECT_PORT_CALLS
294  // Connect output port cmdResponseOut
295  for (
296  FwIndexType port = 0;
297  port < static_cast<FwIndexType>(this->getNum_cmdResponseOut_OutputPorts());
298  port++
299  ) {
300  this->m_cmdResponseOut_OutputPort[port].init();
301 
302 #if FW_OBJECT_NAMES == 1
303  Fw::ObjectName portName;
304  portName.format(
305  "%s_cmdResponseOut_OutputPort[%" PRI_FwIndexType "]",
306  this->m_objName.toChar(),
307  port
308  );
309  this->m_cmdResponseOut_OutputPort[port].setObjName(portName.toChar());
310 #endif
311  }
312 #endif
313 
314 #if !FW_DIRECT_PORT_CALLS
315  // Connect output port eventOut
316  for (
317  FwIndexType port = 0;
318  port < static_cast<FwIndexType>(this->getNum_eventOut_OutputPorts());
319  port++
320  ) {
321  this->m_eventOut_OutputPort[port].init();
322 
323 #if FW_OBJECT_NAMES == 1
324  Fw::ObjectName portName;
325  portName.format(
326  "%s_eventOut_OutputPort[%" PRI_FwIndexType "]",
327  this->m_objName.toChar(),
328  port
329  );
330  this->m_eventOut_OutputPort[port].setObjName(portName.toChar());
331 #endif
332  }
333 #endif
334 
335 #if !FW_DIRECT_PORT_CALLS
336  // Connect output port paramGetOut
337  for (
338  FwIndexType port = 0;
339  port < static_cast<FwIndexType>(this->getNum_paramGetOut_OutputPorts());
340  port++
341  ) {
342  this->m_paramGetOut_OutputPort[port].init();
343 
344 #if FW_OBJECT_NAMES == 1
345  Fw::ObjectName portName;
346  portName.format(
347  "%s_paramGetOut_OutputPort[%" PRI_FwIndexType "]",
348  this->m_objName.toChar(),
349  port
350  );
351  this->m_paramGetOut_OutputPort[port].setObjName(portName.toChar());
352 #endif
353  }
354 #endif
355 
356 #if !FW_DIRECT_PORT_CALLS
357  // Connect output port paramSetOut
358  for (
359  FwIndexType port = 0;
360  port < static_cast<FwIndexType>(this->getNum_paramSetOut_OutputPorts());
361  port++
362  ) {
363  this->m_paramSetOut_OutputPort[port].init();
364 
365 #if FW_OBJECT_NAMES == 1
366  Fw::ObjectName portName;
367  portName.format(
368  "%s_paramSetOut_OutputPort[%" PRI_FwIndexType "]",
369  this->m_objName.toChar(),
370  port
371  );
372  this->m_paramSetOut_OutputPort[port].setObjName(portName.toChar());
373 #endif
374  }
375 #endif
376 
377 #if !FW_DIRECT_PORT_CALLS && FW_ENABLE_TEXT_LOGGING
378  // Connect output port textEventOut
379  for (
380  FwIndexType port = 0;
381  port < static_cast<FwIndexType>(this->getNum_textEventOut_OutputPorts());
382  port++
383  ) {
384  this->m_textEventOut_OutputPort[port].init();
385 
386 #if FW_OBJECT_NAMES == 1
387  Fw::ObjectName portName;
388  portName.format(
389  "%s_textEventOut_OutputPort[%" PRI_FwIndexType "]",
390  this->m_objName.toChar(),
391  port
392  );
393  this->m_textEventOut_OutputPort[port].setObjName(portName.toChar());
394 #endif
395  }
396 #endif
397 
398 #if !FW_DIRECT_PORT_CALLS
399  // Connect output port timeGetOut
400  for (
401  FwIndexType port = 0;
402  port < static_cast<FwIndexType>(this->getNum_timeGetOut_OutputPorts());
403  port++
404  ) {
405  this->m_timeGetOut_OutputPort[port].init();
406 
407 #if FW_OBJECT_NAMES == 1
408  Fw::ObjectName portName;
409  portName.format(
410  "%s_timeGetOut_OutputPort[%" PRI_FwIndexType "]",
411  this->m_objName.toChar(),
412  port
413  );
414  this->m_timeGetOut_OutputPort[port].setObjName(portName.toChar());
415 #endif
416  }
417 #endif
418 
419 #if !FW_DIRECT_PORT_CALLS
420  // Connect output port tlmOut
421  for (
422  FwIndexType port = 0;
423  port < static_cast<FwIndexType>(this->getNum_tlmOut_OutputPorts());
424  port++
425  ) {
426  this->m_tlmOut_OutputPort[port].init();
427 
428 #if FW_OBJECT_NAMES == 1
429  Fw::ObjectName portName;
430  portName.format(
431  "%s_tlmOut_OutputPort[%" PRI_FwIndexType "]",
432  this->m_objName.toChar(),
433  port
434  );
435  this->m_tlmOut_OutputPort[port].setObjName(portName.toChar());
436 #endif
437  }
438 #endif
439 
440 #if !FW_DIRECT_PORT_CALLS
441  // Connect output port PktSend
442  for (
443  FwIndexType port = 0;
444  port < static_cast<FwIndexType>(this->getNum_PktSend_OutputPorts());
445  port++
446  ) {
447  this->m_PktSend_OutputPort[port].init();
448 
449 #if FW_OBJECT_NAMES == 1
450  Fw::ObjectName portName;
451  portName.format(
452  "%s_PktSend_OutputPort[%" PRI_FwIndexType "]",
453  this->m_objName.toChar(),
454  port
455  );
456  this->m_PktSend_OutputPort[port].setObjName(portName.toChar());
457 #endif
458  }
459 #endif
460 
461 #if !FW_DIRECT_PORT_CALLS
462  // Connect output port pingOut
463  for (
464  FwIndexType port = 0;
465  port < static_cast<FwIndexType>(this->getNum_pingOut_OutputPorts());
466  port++
467  ) {
468  this->m_pingOut_OutputPort[port].init();
469 
470 #if FW_OBJECT_NAMES == 1
471  Fw::ObjectName portName;
472  portName.format(
473  "%s_pingOut_OutputPort[%" PRI_FwIndexType "]",
474  this->m_objName.toChar(),
475  port
476  );
477  this->m_pingOut_OutputPort[port].setObjName(portName.toChar());
478 #endif
479  }
480 #endif
481 
482  // Create the queue
483  Os::Queue::Status qStat = this->createQueue(
484  queueDepth,
485  static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
486  );
487  FW_ASSERT(
488  Os::Queue::Status::OP_OK == qStat,
489  static_cast<FwAssertArgType>(qStat)
490  );
491  }
492 
493 #if !FW_DIRECT_PORT_CALLS
494 
495  // ----------------------------------------------------------------------
496  // Getters for special input ports
497  // ----------------------------------------------------------------------
498 
501  {
502  FW_ASSERT(
503  (0 <= portNum) && (portNum < this->getNum_cmdIn_InputPorts()),
504  static_cast<FwAssertArgType>(portNum)
505  );
506 
507  return &this->m_cmdIn_InputPort[portNum];
508  }
509 
510 #endif
511 
512 #if !FW_DIRECT_PORT_CALLS
513 
514  // ----------------------------------------------------------------------
515  // Getters for typed input ports
516  // ----------------------------------------------------------------------
517 
520  {
521  FW_ASSERT(
522  (0 <= portNum) && (portNum < this->getNum_Run_InputPorts()),
523  static_cast<FwAssertArgType>(portNum)
524  );
525 
526  return &this->m_Run_InputPort[portNum];
527  }
528 
531  {
532  FW_ASSERT(
533  (0 <= portNum) && (portNum < this->getNum_TlmGet_InputPorts()),
534  static_cast<FwAssertArgType>(portNum)
535  );
536 
537  return &this->m_TlmGet_InputPort[portNum];
538  }
539 
542  {
543  FW_ASSERT(
544  (0 <= portNum) && (portNum < this->getNum_TlmRecv_InputPorts()),
545  static_cast<FwAssertArgType>(portNum)
546  );
547 
548  return &this->m_TlmRecv_InputPort[portNum];
549  }
550 
553  {
554  FW_ASSERT(
555  (0 <= portNum) && (portNum < this->getNum_configureSectionGroupRate_InputPorts()),
556  static_cast<FwAssertArgType>(portNum)
557  );
558 
559  return &this->m_configureSectionGroupRate_InputPort[portNum];
560  }
561 
564  {
565  FW_ASSERT(
566  (0 <= portNum) && (portNum < this->getNum_controlIn_InputPorts()),
567  static_cast<FwAssertArgType>(portNum)
568  );
569 
570  return &this->m_controlIn_InputPort[portNum];
571  }
572 
575  {
576  FW_ASSERT(
577  (0 <= portNum) && (portNum < this->getNum_pingIn_InputPorts()),
578  static_cast<FwAssertArgType>(portNum)
579  );
580 
581  return &this->m_pingIn_InputPort[portNum];
582  }
583 
584 #endif
585 
586 #if !FW_DIRECT_PORT_CALLS
587 
588  // ----------------------------------------------------------------------
589  // Connect input ports to special output ports
590  // ----------------------------------------------------------------------
591 
594  FwIndexType portNum,
595  Fw::InputCmdRegPort* port
596  )
597  {
598  FW_ASSERT(
599  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
600  static_cast<FwAssertArgType>(portNum)
601  );
602 
603  this->m_cmdRegOut_OutputPort[portNum].addCallPort(port);
604  }
605 
608  FwIndexType portNum,
610  )
611  {
612  FW_ASSERT(
613  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
614  static_cast<FwAssertArgType>(portNum)
615  );
616 
617  this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port);
618  }
619 
622  FwIndexType portNum,
623  Fw::InputLogPort* port
624  )
625  {
626  FW_ASSERT(
627  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
628  static_cast<FwAssertArgType>(portNum)
629  );
630 
631  this->m_eventOut_OutputPort[portNum].addCallPort(port);
632  }
633 
636  FwIndexType portNum,
637  Fw::InputPrmGetPort* port
638  )
639  {
640  FW_ASSERT(
641  (0 <= portNum) && (portNum < this->getNum_paramGetOut_OutputPorts()),
642  static_cast<FwAssertArgType>(portNum)
643  );
644 
645  this->m_paramGetOut_OutputPort[portNum].addCallPort(port);
646  }
647 
650  FwIndexType portNum,
651  Fw::InputPrmSetPort* port
652  )
653  {
654  FW_ASSERT(
655  (0 <= portNum) && (portNum < this->getNum_paramSetOut_OutputPorts()),
656  static_cast<FwAssertArgType>(portNum)
657  );
658 
659  this->m_paramSetOut_OutputPort[portNum].addCallPort(port);
660  }
661 
662 #if FW_ENABLE_TEXT_LOGGING == 1
663 
664  void TlmPacketizerComponentBase ::
665  set_textEventOut_OutputPort(
666  FwIndexType portNum,
668  )
669  {
670  FW_ASSERT(
671  (0 <= portNum) && (portNum < this->getNum_textEventOut_OutputPorts()),
672  static_cast<FwAssertArgType>(portNum)
673  );
674 
675  this->m_textEventOut_OutputPort[portNum].addCallPort(port);
676  }
677 
678 #endif
679 
682  FwIndexType portNum,
683  Fw::InputTimePort* port
684  )
685  {
686  FW_ASSERT(
687  (0 <= portNum) && (portNum < this->getNum_timeGetOut_OutputPorts()),
688  static_cast<FwAssertArgType>(portNum)
689  );
690 
691  this->m_timeGetOut_OutputPort[portNum].addCallPort(port);
692  }
693 
696  FwIndexType portNum,
697  Fw::InputTlmPort* port
698  )
699  {
700  FW_ASSERT(
701  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
702  static_cast<FwAssertArgType>(portNum)
703  );
704 
705  this->m_tlmOut_OutputPort[portNum].addCallPort(port);
706  }
707 
708 #endif
709 
710 #if !FW_DIRECT_PORT_CALLS
711 
712  // ----------------------------------------------------------------------
713  // Connect typed input ports to typed output ports
714  // ----------------------------------------------------------------------
715 
718  FwIndexType portNum,
719  Fw::InputComPort* port
720  )
721  {
722  FW_ASSERT(
723  (0 <= portNum) && (portNum < this->getNum_PktSend_OutputPorts()),
724  static_cast<FwAssertArgType>(portNum)
725  );
726 
727  this->m_PktSend_OutputPort[portNum].addCallPort(port);
728  }
729 
732  FwIndexType portNum,
733  Svc::InputPingPort* port
734  )
735  {
736  FW_ASSERT(
737  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
738  static_cast<FwAssertArgType>(portNum)
739  );
740 
741  this->m_pingOut_OutputPort[portNum].addCallPort(port);
742  }
743 
744 #endif
745 
746 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
747 
748  // ----------------------------------------------------------------------
749  // Connect serial input ports to special output ports
750  // ----------------------------------------------------------------------
751 
754  FwIndexType portNum,
755  Fw::InputSerializePort* port
756  )
757  {
758  FW_ASSERT(
759  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
760  static_cast<FwAssertArgType>(portNum)
761  );
762 
763  this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port);
764  }
765 
768  FwIndexType portNum,
769  Fw::InputSerializePort* port
770  )
771  {
772  FW_ASSERT(
773  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
774  static_cast<FwAssertArgType>(portNum)
775  );
776 
777  this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port);
778  }
779 
782  FwIndexType portNum,
783  Fw::InputSerializePort* port
784  )
785  {
786  FW_ASSERT(
787  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
788  static_cast<FwAssertArgType>(portNum)
789  );
790 
791  this->m_eventOut_OutputPort[portNum].registerSerialPort(port);
792  }
793 
796  FwIndexType portNum,
797  Fw::InputSerializePort* port
798  )
799  {
800  FW_ASSERT(
801  (0 <= portNum) && (portNum < this->getNum_paramSetOut_OutputPorts()),
802  static_cast<FwAssertArgType>(portNum)
803  );
804 
805  this->m_paramSetOut_OutputPort[portNum].registerSerialPort(port);
806  }
807 
808 #if FW_ENABLE_TEXT_LOGGING == 1
809 
810  void TlmPacketizerComponentBase ::
811  set_textEventOut_OutputPort(
812  FwIndexType portNum,
813  Fw::InputSerializePort* port
814  )
815  {
816  FW_ASSERT(
817  (0 <= portNum) && (portNum < this->getNum_textEventOut_OutputPorts()),
818  static_cast<FwAssertArgType>(portNum)
819  );
820 
821  this->m_textEventOut_OutputPort[portNum].registerSerialPort(port);
822  }
823 
824 #endif
825 
828  FwIndexType portNum,
829  Fw::InputSerializePort* port
830  )
831  {
832  FW_ASSERT(
833  (0 <= portNum) && (portNum < this->getNum_timeGetOut_OutputPorts()),
834  static_cast<FwAssertArgType>(portNum)
835  );
836 
837  this->m_timeGetOut_OutputPort[portNum].registerSerialPort(port);
838  }
839 
842  FwIndexType portNum,
843  Fw::InputSerializePort* port
844  )
845  {
846  FW_ASSERT(
847  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
848  static_cast<FwAssertArgType>(portNum)
849  );
850 
851  this->m_tlmOut_OutputPort[portNum].registerSerialPort(port);
852  }
853 
854 #endif
855 
856 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
857 
858  // ----------------------------------------------------------------------
859  // Connect serial input ports to typed output ports
860  // ----------------------------------------------------------------------
861 
864  FwIndexType portNum,
865  Fw::InputSerializePort* port
866  )
867  {
868  FW_ASSERT(
869  (0 <= portNum) && (portNum < this->getNum_PktSend_OutputPorts()),
870  static_cast<FwAssertArgType>(portNum)
871  );
872 
873  this->m_PktSend_OutputPort[portNum].registerSerialPort(port);
874  }
875 
878  FwIndexType portNum,
879  Fw::InputSerializePort* port
880  )
881  {
882  FW_ASSERT(
883  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
884  static_cast<FwAssertArgType>(portNum)
885  );
886 
887  this->m_pingOut_OutputPort[portNum].registerSerialPort(port);
888  }
889 
890 #endif
891 
892  // ----------------------------------------------------------------------
893  // Command registration
894  // ----------------------------------------------------------------------
895 
898  {
900 
901  this->cmdRegOut_out(
902  0,
903  this->getIdBase() + OPCODE_SET_LEVEL
904  );
905 
906  this->cmdRegOut_out(
907  0,
908  this->getIdBase() + OPCODE_SEND_PKT
909  );
910 
911  this->cmdRegOut_out(
912  0,
914  );
915 
916  this->cmdRegOut_out(
917  0,
919  );
920 
921  this->cmdRegOut_out(
922  0,
923  this->getIdBase() + OPCODE_FORCE_GROUP
924  );
925 
926  this->cmdRegOut_out(
927  0,
929  );
930 
931  this->cmdRegOut_out(
932  0,
934  );
935 
936  this->cmdRegOut_out(
937  0,
939  );
940 
941  this->cmdRegOut_out(
942  0,
944  );
945 
946  this->cmdRegOut_out(
947  0,
949  );
950  }
951 
952  // ----------------------------------------------------------------------
953  // Parameter loading
954  // ----------------------------------------------------------------------
955 
958  {
960  const FwPrmIdType _baseId = static_cast<FwPrmIdType>(this->getIdBase());
962 
963  FwPrmIdType _id{};
964  Fw::ParamBuffer _paramBuffer;
965 
966  _id = _baseId + PARAMID_SECTION_ENABLED;
967 
968  // Get serialized parameter SECTION_ENABLED
969  this->m_param_SECTION_ENABLED_valid = this->paramGetOut_out(
970  0,
971  _id,
972  _paramBuffer
973  );
974 
975  this->m_paramLock.lock();
976 
977  // Deserialize parameter or use default value
978  if (this->m_param_SECTION_ENABLED_valid == Fw::ParamValid::VALID) {
979  FW_ASSERT(this->paramDelegatePtr != nullptr);
980  _stat = this->paramDelegatePtr->deserializeParam(
981  _baseId,
983  this->m_param_SECTION_ENABLED_valid,
984  _paramBuffer
985  );
986  if (_stat != Fw::FW_SERIALIZE_OK) {
987  this->m_param_SECTION_ENABLED_valid = Fw::ParamValid::DEFAULT;
988  }
989  }
990  else {
991  this->m_param_SECTION_ENABLED_valid = Fw::ParamValid::DEFAULT;
992  }
993  if (this->m_param_SECTION_ENABLED_valid == Fw::ParamValid::DEFAULT) {
995  _paramBuffer.resetSer();
996  _stat = _paramBuffer.serializeFrom(_val);
997  FW_ASSERT(_stat == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(_stat));
998  FW_ASSERT(this->paramDelegatePtr != nullptr);
999  _stat = this->paramDelegatePtr->deserializeParam(
1000  _baseId,
1002  this->m_param_SECTION_ENABLED_valid,
1003  _paramBuffer
1004  );
1005  if (_stat != Fw::FW_SERIALIZE_OK) {
1006  this->m_param_SECTION_ENABLED_valid = Fw::ParamValid::INVALID;
1007  }
1008  }
1009 
1010  this->m_paramLock.unlock();
1011 
1012  _id = _baseId + PARAMID_SECTION_CONFIGS;
1013 
1014  // Get serialized parameter SECTION_CONFIGS
1015  this->m_param_SECTION_CONFIGS_valid = this->paramGetOut_out(
1016  0,
1017  _id,
1018  _paramBuffer
1019  );
1020 
1021  this->m_paramLock.lock();
1022 
1023  // Deserialize parameter or use default value
1024  if (this->m_param_SECTION_CONFIGS_valid == Fw::ParamValid::VALID) {
1025  FW_ASSERT(this->paramDelegatePtr != nullptr);
1026  _stat = this->paramDelegatePtr->deserializeParam(
1027  _baseId,
1029  this->m_param_SECTION_CONFIGS_valid,
1030  _paramBuffer
1031  );
1032  if (_stat != Fw::FW_SERIALIZE_OK) {
1033  this->m_param_SECTION_CONFIGS_valid = Fw::ParamValid::DEFAULT;
1034  }
1035  }
1036  else {
1037  this->m_param_SECTION_CONFIGS_valid = Fw::ParamValid::DEFAULT;
1038  }
1039  if (this->m_param_SECTION_CONFIGS_valid == Fw::ParamValid::DEFAULT) {
1041  _paramBuffer.resetSer();
1042  _stat = _paramBuffer.serializeFrom(_val);
1043  FW_ASSERT(_stat == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(_stat));
1044  FW_ASSERT(this->paramDelegatePtr != nullptr);
1045  _stat = this->paramDelegatePtr->deserializeParam(
1046  _baseId,
1048  this->m_param_SECTION_CONFIGS_valid,
1049  _paramBuffer
1050  );
1051  if (_stat != Fw::FW_SERIALIZE_OK) {
1052  this->m_param_SECTION_CONFIGS_valid = Fw::ParamValid::INVALID;
1053  }
1054  }
1055 
1056  this->m_paramLock.unlock();
1057 
1058  // Call notifier
1059  this->parametersLoaded();
1060  }
1061 
1062  // ----------------------------------------------------------------------
1063  // Component construction and destruction
1064  // ----------------------------------------------------------------------
1065 
1067  TlmPacketizerComponentBase(const char* compName) :
1068  Fw::ActiveComponentBase(compName)
1069  {
1070 
1071  }
1072 
1075  {
1076 
1077  }
1078 
1079 #if !FW_DIRECT_PORT_CALLS
1080 
1081  // ----------------------------------------------------------------------
1082  // Connection status queries for special output ports
1083  // ----------------------------------------------------------------------
1084 
1087  {
1088  FW_ASSERT(
1089  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
1090  static_cast<FwAssertArgType>(portNum)
1091  );
1092 
1093  return this->m_cmdRegOut_OutputPort[portNum].isConnected();
1094  }
1095 
1098  {
1099  FW_ASSERT(
1100  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
1101  static_cast<FwAssertArgType>(portNum)
1102  );
1103 
1104  return this->m_cmdResponseOut_OutputPort[portNum].isConnected();
1105  }
1106 
1109  {
1110  FW_ASSERT(
1111  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
1112  static_cast<FwAssertArgType>(portNum)
1113  );
1114 
1115  return this->m_eventOut_OutputPort[portNum].isConnected();
1116  }
1117 
1120  {
1121  FW_ASSERT(
1122  (0 <= portNum) && (portNum < this->getNum_paramGetOut_OutputPorts()),
1123  static_cast<FwAssertArgType>(portNum)
1124  );
1125 
1126  return this->m_paramGetOut_OutputPort[portNum].isConnected();
1127  }
1128 
1131  {
1132  FW_ASSERT(
1133  (0 <= portNum) && (portNum < this->getNum_paramSetOut_OutputPorts()),
1134  static_cast<FwAssertArgType>(portNum)
1135  );
1136 
1137  return this->m_paramSetOut_OutputPort[portNum].isConnected();
1138  }
1139 
1140 #if FW_ENABLE_TEXT_LOGGING == 1
1141 
1142  bool TlmPacketizerComponentBase ::
1143  isConnected_textEventOut_OutputPort(FwIndexType portNum) const
1144  {
1145  FW_ASSERT(
1146  (0 <= portNum) && (portNum < this->getNum_textEventOut_OutputPorts()),
1147  static_cast<FwAssertArgType>(portNum)
1148  );
1149 
1150  return this->m_textEventOut_OutputPort[portNum].isConnected();
1151  }
1152 
1153 #endif
1154 
1157  {
1158  FW_ASSERT(
1159  (0 <= portNum) && (portNum < this->getNum_timeGetOut_OutputPorts()),
1160  static_cast<FwAssertArgType>(portNum)
1161  );
1162 
1163  return this->m_timeGetOut_OutputPort[portNum].isConnected();
1164  }
1165 
1168  {
1169  FW_ASSERT(
1170  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
1171  static_cast<FwAssertArgType>(portNum)
1172  );
1173 
1174  return this->m_tlmOut_OutputPort[portNum].isConnected();
1175  }
1176 
1177 #endif
1178 
1179 #if !FW_DIRECT_PORT_CALLS
1180 
1181  // ----------------------------------------------------------------------
1182  // Connection status queries for typed output ports
1183  // ----------------------------------------------------------------------
1184 
1187  {
1188  FW_ASSERT(
1189  (0 <= portNum) && (portNum < this->getNum_PktSend_OutputPorts()),
1190  static_cast<FwAssertArgType>(portNum)
1191  );
1192 
1193  return this->m_PktSend_OutputPort[portNum].isConnected();
1194  }
1195 
1198  {
1199  FW_ASSERT(
1200  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
1201  static_cast<FwAssertArgType>(portNum)
1202  );
1203 
1204  return this->m_pingOut_OutputPort[portNum].isConnected();
1205  }
1206 
1207 #endif
1208 
1209  // ----------------------------------------------------------------------
1210  // Port handler base-class functions for special input ports
1211  //
1212  // Call these functions directly to bypass the corresponding ports
1213  // ----------------------------------------------------------------------
1214 
1217  FwIndexType portNum,
1218  FwOpcodeType opCode,
1219  U32 cmdSeq,
1220  Fw::CmdArgBuffer& args
1221  )
1222  {
1223 
1224  const U32 idBase = this->getIdBase();
1225  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
1226 
1227  // Select base class function based on opcode
1228  switch (opCode - idBase) {
1229  case OPCODE_SET_LEVEL: {
1231  opCode,
1232  cmdSeq,
1233  args
1234  );
1235  break;
1236  }
1237 
1238  case OPCODE_SEND_PKT: {
1240  opCode,
1241  cmdSeq,
1242  args
1243  );
1244  break;
1245  }
1246 
1247  case OPCODE_ENABLE_SECTION: {
1249  opCode,
1250  cmdSeq,
1251  args
1252  );
1253  break;
1254  }
1255 
1256  case OPCODE_ENABLE_GROUP: {
1258  opCode,
1259  cmdSeq,
1260  args
1261  );
1262  break;
1263  }
1264 
1265  case OPCODE_FORCE_GROUP: {
1267  opCode,
1268  cmdSeq,
1269  args
1270  );
1271  break;
1272  }
1273 
1276  opCode,
1277  cmdSeq,
1278  args
1279  );
1280  break;
1281  }
1282 
1284  Fw::CmdResponse _cstat = this->paramSet_SECTION_ENABLED(args);
1285  this->cmdResponse_out(
1286  opCode,
1287  cmdSeq,
1288  _cstat
1289  );
1290  break;
1291  }
1292 
1294  Fw::CmdResponse _cstat = this->paramSave_SECTION_ENABLED();
1295  this->cmdResponse_out(
1296  opCode,
1297  cmdSeq,
1298  _cstat
1299  );
1300  break;
1301  }
1302 
1304  Fw::CmdResponse _cstat = this->paramSet_SECTION_CONFIGS(args);
1305  this->cmdResponse_out(
1306  opCode,
1307  cmdSeq,
1308  _cstat
1309  );
1310  break;
1311  }
1312 
1314  Fw::CmdResponse _cstat = this->paramSave_SECTION_CONFIGS();
1315  this->cmdResponse_out(
1316  opCode,
1317  cmdSeq,
1318  _cstat
1319  );
1320  break;
1321  }
1322  default:
1323  // Unknown opcode: ignore it
1324  break;
1325  }
1326  }
1327 
1328  // ----------------------------------------------------------------------
1329  // Port handler base-class functions for typed input ports
1330  //
1331  // Call these functions directly to bypass the corresponding ports
1332  // ----------------------------------------------------------------------
1333 
1336  FwIndexType portNum,
1337  U32 context
1338  )
1339  {
1340  // Make sure port number is valid
1341  FW_ASSERT(
1342  (0 <= portNum) && (portNum < this->getNum_Run_InputPorts()),
1343  static_cast<FwAssertArgType>(portNum)
1344  );
1345 
1346  // Call pre-message hook
1348  portNum,
1349  context
1350  );
1351  ComponentIpcSerializableBuffer msg;
1353 
1354  // Serialize message ID
1355  _status = msg.serializeFrom(
1356  static_cast<FwEnumStoreType>(RUN_SCHED)
1357  );
1358  FW_ASSERT(
1359  _status == Fw::FW_SERIALIZE_OK,
1360  static_cast<FwAssertArgType>(_status)
1361  );
1362 
1363  // Serialize port number
1364  _status = msg.serializeFrom(portNum);
1365  FW_ASSERT(
1366  _status == Fw::FW_SERIALIZE_OK,
1367  static_cast<FwAssertArgType>(_status)
1368  );
1369 
1370  // Serialize argument context
1371  _status = msg.serializeFrom(context);
1372  FW_ASSERT(
1373  _status == Fw::FW_SERIALIZE_OK,
1374  static_cast<FwAssertArgType>(_status)
1375  );
1376 
1377  // Send message
1379  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1380 
1381  FW_ASSERT(
1382  qStatus == Os::Queue::OP_OK,
1383  static_cast<FwAssertArgType>(qStatus)
1384  );
1385  }
1386 
1389  FwIndexType portNum,
1390  FwChanIdType id,
1391  Fw::Time& timeTag,
1392  Fw::TlmBuffer& val
1393  )
1394  {
1395  // Make sure port number is valid
1396  FW_ASSERT(
1397  (0 <= portNum) && (portNum < this->getNum_TlmGet_InputPorts()),
1398  static_cast<FwAssertArgType>(portNum)
1399  );
1400 
1401  Fw::TlmValid retVal;
1402 
1403  // Call handler function
1404  retVal = this->TlmGet_handler(
1405  portNum,
1406  id,
1407  timeTag,
1408  val
1409  );
1410 
1411  return retVal;
1412  }
1413 
1416  FwIndexType portNum,
1417  FwChanIdType id,
1418  Fw::Time& timeTag,
1419  Fw::TlmBuffer& val
1420  )
1421  {
1422  // Make sure port number is valid
1423  FW_ASSERT(
1424  (0 <= portNum) && (portNum < this->getNum_TlmRecv_InputPorts()),
1425  static_cast<FwAssertArgType>(portNum)
1426  );
1427 
1428  // Call handler function
1429  this->TlmRecv_handler(
1430  portNum,
1431  id,
1432  timeTag,
1433  val
1434  );
1435  }
1436 
1439  FwIndexType portNum,
1440  const Svc::TelemetrySection& section,
1441  FwChanIdType tlmGroup,
1442  const Svc::RateLogic& rateLogic,
1443  U32 minDelta,
1444  U32 maxDelta
1445  )
1446  {
1447  // Make sure port number is valid
1448  FW_ASSERT(
1449  (0 <= portNum) && (portNum < this->getNum_configureSectionGroupRate_InputPorts()),
1450  static_cast<FwAssertArgType>(portNum)
1451  );
1452 
1453  // Call pre-message hook
1455  portNum,
1456  section,
1457  tlmGroup,
1458  rateLogic,
1459  minDelta,
1460  maxDelta
1461  );
1462  ComponentIpcSerializableBuffer msg;
1464 
1465  // Serialize message ID
1466  _status = msg.serializeFrom(
1467  static_cast<FwEnumStoreType>(CONFIGURESECTIONGROUPRATE_CONFIGUREGROUPRATE)
1468  );
1469  FW_ASSERT(
1470  _status == Fw::FW_SERIALIZE_OK,
1471  static_cast<FwAssertArgType>(_status)
1472  );
1473 
1474  // Serialize port number
1475  _status = msg.serializeFrom(portNum);
1476  FW_ASSERT(
1477  _status == Fw::FW_SERIALIZE_OK,
1478  static_cast<FwAssertArgType>(_status)
1479  );
1480 
1481  // Serialize argument section
1482  _status = msg.serializeFrom(section);
1483  FW_ASSERT(
1484  _status == Fw::FW_SERIALIZE_OK,
1485  static_cast<FwAssertArgType>(_status)
1486  );
1487 
1488  // Serialize argument tlmGroup
1489  _status = msg.serializeFrom(tlmGroup);
1490  FW_ASSERT(
1491  _status == Fw::FW_SERIALIZE_OK,
1492  static_cast<FwAssertArgType>(_status)
1493  );
1494 
1495  // Serialize argument rateLogic
1496  _status = msg.serializeFrom(rateLogic);
1497  FW_ASSERT(
1498  _status == Fw::FW_SERIALIZE_OK,
1499  static_cast<FwAssertArgType>(_status)
1500  );
1501 
1502  // Serialize argument minDelta
1503  _status = msg.serializeFrom(minDelta);
1504  FW_ASSERT(
1505  _status == Fw::FW_SERIALIZE_OK,
1506  static_cast<FwAssertArgType>(_status)
1507  );
1508 
1509  // Serialize argument maxDelta
1510  _status = msg.serializeFrom(maxDelta);
1511  FW_ASSERT(
1512  _status == Fw::FW_SERIALIZE_OK,
1513  static_cast<FwAssertArgType>(_status)
1514  );
1515 
1516  // Send message
1518  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1519 
1520  FW_ASSERT(
1521  qStatus == Os::Queue::OP_OK,
1522  static_cast<FwAssertArgType>(qStatus)
1523  );
1524  }
1525 
1528  FwIndexType portNum,
1529  const Svc::TelemetrySection& section,
1530  const Fw::Enabled& enabled
1531  )
1532  {
1533  // Make sure port number is valid
1534  FW_ASSERT(
1535  (0 <= portNum) && (portNum < this->getNum_controlIn_InputPorts()),
1536  static_cast<FwAssertArgType>(portNum)
1537  );
1538 
1539  // Call pre-message hook
1541  portNum,
1542  section,
1543  enabled
1544  );
1545  ComponentIpcSerializableBuffer msg;
1547 
1548  // Serialize message ID
1549  _status = msg.serializeFrom(
1550  static_cast<FwEnumStoreType>(CONTROLIN_ENABLESECTION)
1551  );
1552  FW_ASSERT(
1553  _status == Fw::FW_SERIALIZE_OK,
1554  static_cast<FwAssertArgType>(_status)
1555  );
1556 
1557  // Serialize port number
1558  _status = msg.serializeFrom(portNum);
1559  FW_ASSERT(
1560  _status == Fw::FW_SERIALIZE_OK,
1561  static_cast<FwAssertArgType>(_status)
1562  );
1563 
1564  // Serialize argument section
1565  _status = msg.serializeFrom(section);
1566  FW_ASSERT(
1567  _status == Fw::FW_SERIALIZE_OK,
1568  static_cast<FwAssertArgType>(_status)
1569  );
1570 
1571  // Serialize argument enabled
1572  _status = msg.serializeFrom(enabled);
1573  FW_ASSERT(
1574  _status == Fw::FW_SERIALIZE_OK,
1575  static_cast<FwAssertArgType>(_status)
1576  );
1577 
1578  // Send message
1580  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1581 
1582  FW_ASSERT(
1583  qStatus == Os::Queue::OP_OK,
1584  static_cast<FwAssertArgType>(qStatus)
1585  );
1586  }
1587 
1590  FwIndexType portNum,
1591  U32 key
1592  )
1593  {
1594  // Make sure port number is valid
1595  FW_ASSERT(
1596  (0 <= portNum) && (portNum < this->getNum_pingIn_InputPorts()),
1597  static_cast<FwAssertArgType>(portNum)
1598  );
1599 
1600  // Call pre-message hook
1602  portNum,
1603  key
1604  );
1605  ComponentIpcSerializableBuffer msg;
1607 
1608  // Serialize message ID
1609  _status = msg.serializeFrom(
1610  static_cast<FwEnumStoreType>(PINGIN_PING)
1611  );
1612  FW_ASSERT(
1613  _status == Fw::FW_SERIALIZE_OK,
1614  static_cast<FwAssertArgType>(_status)
1615  );
1616 
1617  // Serialize port number
1618  _status = msg.serializeFrom(portNum);
1619  FW_ASSERT(
1620  _status == Fw::FW_SERIALIZE_OK,
1621  static_cast<FwAssertArgType>(_status)
1622  );
1623 
1624  // Serialize argument key
1625  _status = msg.serializeFrom(key);
1626  FW_ASSERT(
1627  _status == Fw::FW_SERIALIZE_OK,
1628  static_cast<FwAssertArgType>(_status)
1629  );
1630 
1631  // Send message
1633  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1634 
1635  FW_ASSERT(
1636  qStatus == Os::Queue::OP_OK,
1637  static_cast<FwAssertArgType>(qStatus)
1638  );
1639  }
1640 
1641  // ----------------------------------------------------------------------
1642  // Pre-message hooks for typed async input ports
1643  //
1644  // Each of these functions is invoked just before processing a message
1645  // on the corresponding port. By default, they do nothing. You can
1646  // override them to provide specific pre-message behavior.
1647  // ----------------------------------------------------------------------
1648 
1651  FwIndexType portNum,
1652  U32 context
1653  )
1654  {
1655  // Default: no-op
1656  }
1657 
1660  FwIndexType portNum,
1661  const Svc::TelemetrySection& section,
1662  FwChanIdType tlmGroup,
1663  const Svc::RateLogic& rateLogic,
1664  U32 minDelta,
1665  U32 maxDelta
1666  )
1667  {
1668  // Default: no-op
1669  }
1670 
1673  FwIndexType portNum,
1674  const Svc::TelemetrySection& section,
1675  const Fw::Enabled& enabled
1676  )
1677  {
1678  // Default: no-op
1679  }
1680 
1683  FwIndexType portNum,
1684  U32 key
1685  )
1686  {
1687  // Default: no-op
1688  }
1689 
1690 #if !FW_DIRECT_PORT_CALLS
1691 
1692  // ----------------------------------------------------------------------
1693  // Invocation functions for typed output ports
1694  // ----------------------------------------------------------------------
1695 
1698  FwIndexType portNum,
1699  Fw::ComBuffer& data,
1700  U32 context
1701  ) const
1702  {
1703  FW_ASSERT(
1704  (0 <= portNum) && (portNum < this->getNum_PktSend_OutputPorts()),
1705  static_cast<FwAssertArgType>(portNum)
1706  );
1707 
1708  FW_ASSERT(
1709  this->m_PktSend_OutputPort[portNum].isConnected(),
1710  static_cast<FwAssertArgType>(portNum)
1711  );
1712  this->m_PktSend_OutputPort[portNum].invoke(
1713  data,
1714  context
1715  );
1716  }
1717 
1720  FwIndexType portNum,
1721  U32 key
1722  ) const
1723  {
1724  FW_ASSERT(
1725  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
1726  static_cast<FwAssertArgType>(portNum)
1727  );
1728 
1729  FW_ASSERT(
1730  this->m_pingOut_OutputPort[portNum].isConnected(),
1731  static_cast<FwAssertArgType>(portNum)
1732  );
1733  this->m_pingOut_OutputPort[portNum].invoke(
1734  key
1735  );
1736  }
1737 
1738 #endif
1739 
1740  // ----------------------------------------------------------------------
1741  // Command response
1742  // ----------------------------------------------------------------------
1743 
1746  FwOpcodeType opCode,
1747  U32 cmdSeq,
1748  Fw::CmdResponse response
1749  )
1750  {
1752  this->cmdResponseOut_out(0, opCode, cmdSeq, response);
1753  }
1754 
1755  // ----------------------------------------------------------------------
1756  // Command handler base-class functions
1757  //
1758  // Call these functions directly to bypass the command input port
1759  // ----------------------------------------------------------------------
1760 
1763  FwOpcodeType opCode,
1764  U32 cmdSeq,
1765  Fw::CmdArgBuffer& args
1766  )
1767  {
1768  // Call pre-message hook
1769  this->SET_LEVEL_preMsgHook(opCode,cmdSeq);
1770 
1771  // Defer deserializing arguments to the message dispatcher
1772  // to avoid deserializing and reserializing just for IPC
1773  ComponentIpcSerializableBuffer msg;
1775 
1776  // Serialize for IPC
1777  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_SET_LEVEL));
1778  FW_ASSERT (
1779  _status == Fw::FW_SERIALIZE_OK,
1780  static_cast<FwAssertArgType>(_status)
1781  );
1782 
1783  // Fake port number to make message dequeue work
1784  FwIndexType port = 0;
1785 
1786  _status = msg.serializeFrom(port);
1787  FW_ASSERT (
1788  _status == Fw::FW_SERIALIZE_OK,
1789  static_cast<FwAssertArgType>(_status)
1790  );
1791 
1792  _status = msg.serializeFrom(opCode);
1793  FW_ASSERT (
1794  _status == Fw::FW_SERIALIZE_OK,
1795  static_cast<FwAssertArgType>(_status)
1796  );
1797 
1798  _status = msg.serializeFrom(cmdSeq);
1799  FW_ASSERT (
1800  _status == Fw::FW_SERIALIZE_OK,
1801  static_cast<FwAssertArgType>(_status)
1802  );
1803 
1804  _status = msg.serializeFrom(args);
1805  FW_ASSERT (
1806  _status == Fw::FW_SERIALIZE_OK,
1807  static_cast<FwAssertArgType>(_status)
1808  );
1809 
1810  // Send message
1812  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1813 
1814  FW_ASSERT(
1815  qStatus == Os::Queue::OP_OK,
1816  static_cast<FwAssertArgType>(qStatus)
1817  );
1818  }
1819 
1822  FwOpcodeType opCode,
1823  U32 cmdSeq,
1824  Fw::CmdArgBuffer& args
1825  )
1826  {
1827  // Call pre-message hook
1828  this->SEND_PKT_preMsgHook(opCode,cmdSeq);
1829 
1830  // Defer deserializing arguments to the message dispatcher
1831  // to avoid deserializing and reserializing just for IPC
1832  ComponentIpcSerializableBuffer msg;
1834 
1835  // Serialize for IPC
1836  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_SEND_PKT));
1837  FW_ASSERT (
1838  _status == Fw::FW_SERIALIZE_OK,
1839  static_cast<FwAssertArgType>(_status)
1840  );
1841 
1842  // Fake port number to make message dequeue work
1843  FwIndexType port = 0;
1844 
1845  _status = msg.serializeFrom(port);
1846  FW_ASSERT (
1847  _status == Fw::FW_SERIALIZE_OK,
1848  static_cast<FwAssertArgType>(_status)
1849  );
1850 
1851  _status = msg.serializeFrom(opCode);
1852  FW_ASSERT (
1853  _status == Fw::FW_SERIALIZE_OK,
1854  static_cast<FwAssertArgType>(_status)
1855  );
1856 
1857  _status = msg.serializeFrom(cmdSeq);
1858  FW_ASSERT (
1859  _status == Fw::FW_SERIALIZE_OK,
1860  static_cast<FwAssertArgType>(_status)
1861  );
1862 
1863  _status = msg.serializeFrom(args);
1864  FW_ASSERT (
1865  _status == Fw::FW_SERIALIZE_OK,
1866  static_cast<FwAssertArgType>(_status)
1867  );
1868 
1869  // Send message
1871  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1872 
1873  FW_ASSERT(
1874  qStatus == Os::Queue::OP_OK,
1875  static_cast<FwAssertArgType>(qStatus)
1876  );
1877  }
1878 
1881  FwOpcodeType opCode,
1882  U32 cmdSeq,
1883  Fw::CmdArgBuffer& args
1884  )
1885  {
1886  // Call pre-message hook
1887  this->ENABLE_SECTION_preMsgHook(opCode,cmdSeq);
1888 
1889  // Defer deserializing arguments to the message dispatcher
1890  // to avoid deserializing and reserializing just for IPC
1891  ComponentIpcSerializableBuffer msg;
1893 
1894  // Serialize for IPC
1895  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_ENABLE_SECTION));
1896  FW_ASSERT (
1897  _status == Fw::FW_SERIALIZE_OK,
1898  static_cast<FwAssertArgType>(_status)
1899  );
1900 
1901  // Fake port number to make message dequeue work
1902  FwIndexType port = 0;
1903 
1904  _status = msg.serializeFrom(port);
1905  FW_ASSERT (
1906  _status == Fw::FW_SERIALIZE_OK,
1907  static_cast<FwAssertArgType>(_status)
1908  );
1909 
1910  _status = msg.serializeFrom(opCode);
1911  FW_ASSERT (
1912  _status == Fw::FW_SERIALIZE_OK,
1913  static_cast<FwAssertArgType>(_status)
1914  );
1915 
1916  _status = msg.serializeFrom(cmdSeq);
1917  FW_ASSERT (
1918  _status == Fw::FW_SERIALIZE_OK,
1919  static_cast<FwAssertArgType>(_status)
1920  );
1921 
1922  _status = msg.serializeFrom(args);
1923  FW_ASSERT (
1924  _status == Fw::FW_SERIALIZE_OK,
1925  static_cast<FwAssertArgType>(_status)
1926  );
1927 
1928  // Send message
1930  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1931 
1932  FW_ASSERT(
1933  qStatus == Os::Queue::OP_OK,
1934  static_cast<FwAssertArgType>(qStatus)
1935  );
1936  }
1937 
1940  FwOpcodeType opCode,
1941  U32 cmdSeq,
1942  Fw::CmdArgBuffer& args
1943  )
1944  {
1945  // Call pre-message hook
1946  this->ENABLE_GROUP_preMsgHook(opCode,cmdSeq);
1947 
1948  // Defer deserializing arguments to the message dispatcher
1949  // to avoid deserializing and reserializing just for IPC
1950  ComponentIpcSerializableBuffer msg;
1952 
1953  // Serialize for IPC
1954  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_ENABLE_GROUP));
1955  FW_ASSERT (
1956  _status == Fw::FW_SERIALIZE_OK,
1957  static_cast<FwAssertArgType>(_status)
1958  );
1959 
1960  // Fake port number to make message dequeue work
1961  FwIndexType port = 0;
1962 
1963  _status = msg.serializeFrom(port);
1964  FW_ASSERT (
1965  _status == Fw::FW_SERIALIZE_OK,
1966  static_cast<FwAssertArgType>(_status)
1967  );
1968 
1969  _status = msg.serializeFrom(opCode);
1970  FW_ASSERT (
1971  _status == Fw::FW_SERIALIZE_OK,
1972  static_cast<FwAssertArgType>(_status)
1973  );
1974 
1975  _status = msg.serializeFrom(cmdSeq);
1976  FW_ASSERT (
1977  _status == Fw::FW_SERIALIZE_OK,
1978  static_cast<FwAssertArgType>(_status)
1979  );
1980 
1981  _status = msg.serializeFrom(args);
1982  FW_ASSERT (
1983  _status == Fw::FW_SERIALIZE_OK,
1984  static_cast<FwAssertArgType>(_status)
1985  );
1986 
1987  // Send message
1989  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1990 
1991  FW_ASSERT(
1992  qStatus == Os::Queue::OP_OK,
1993  static_cast<FwAssertArgType>(qStatus)
1994  );
1995  }
1996 
1999  FwOpcodeType opCode,
2000  U32 cmdSeq,
2001  Fw::CmdArgBuffer& args
2002  )
2003  {
2004  // Call pre-message hook
2005  this->FORCE_GROUP_preMsgHook(opCode,cmdSeq);
2006 
2007  // Defer deserializing arguments to the message dispatcher
2008  // to avoid deserializing and reserializing just for IPC
2009  ComponentIpcSerializableBuffer msg;
2011 
2012  // Serialize for IPC
2013  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_FORCE_GROUP));
2014  FW_ASSERT (
2015  _status == Fw::FW_SERIALIZE_OK,
2016  static_cast<FwAssertArgType>(_status)
2017  );
2018 
2019  // Fake port number to make message dequeue work
2020  FwIndexType port = 0;
2021 
2022  _status = msg.serializeFrom(port);
2023  FW_ASSERT (
2024  _status == Fw::FW_SERIALIZE_OK,
2025  static_cast<FwAssertArgType>(_status)
2026  );
2027 
2028  _status = msg.serializeFrom(opCode);
2029  FW_ASSERT (
2030  _status == Fw::FW_SERIALIZE_OK,
2031  static_cast<FwAssertArgType>(_status)
2032  );
2033 
2034  _status = msg.serializeFrom(cmdSeq);
2035  FW_ASSERT (
2036  _status == Fw::FW_SERIALIZE_OK,
2037  static_cast<FwAssertArgType>(_status)
2038  );
2039 
2040  _status = msg.serializeFrom(args);
2041  FW_ASSERT (
2042  _status == Fw::FW_SERIALIZE_OK,
2043  static_cast<FwAssertArgType>(_status)
2044  );
2045 
2046  // Send message
2048  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
2049 
2050  FW_ASSERT(
2051  qStatus == Os::Queue::OP_OK,
2052  static_cast<FwAssertArgType>(qStatus)
2053  );
2054  }
2055 
2058  FwOpcodeType opCode,
2059  U32 cmdSeq,
2060  Fw::CmdArgBuffer& args
2061  )
2062  {
2063  // Call pre-message hook
2064  this->CONFIGURE_GROUP_RATES_preMsgHook(opCode,cmdSeq);
2065 
2066  // Defer deserializing arguments to the message dispatcher
2067  // to avoid deserializing and reserializing just for IPC
2068  ComponentIpcSerializableBuffer msg;
2070 
2071  // Serialize for IPC
2072  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_CONFIGURE_GROUP_RATES));
2073  FW_ASSERT (
2074  _status == Fw::FW_SERIALIZE_OK,
2075  static_cast<FwAssertArgType>(_status)
2076  );
2077 
2078  // Fake port number to make message dequeue work
2079  FwIndexType port = 0;
2080 
2081  _status = msg.serializeFrom(port);
2082  FW_ASSERT (
2083  _status == Fw::FW_SERIALIZE_OK,
2084  static_cast<FwAssertArgType>(_status)
2085  );
2086 
2087  _status = msg.serializeFrom(opCode);
2088  FW_ASSERT (
2089  _status == Fw::FW_SERIALIZE_OK,
2090  static_cast<FwAssertArgType>(_status)
2091  );
2092 
2093  _status = msg.serializeFrom(cmdSeq);
2094  FW_ASSERT (
2095  _status == Fw::FW_SERIALIZE_OK,
2096  static_cast<FwAssertArgType>(_status)
2097  );
2098 
2099  _status = msg.serializeFrom(args);
2100  FW_ASSERT (
2101  _status == Fw::FW_SERIALIZE_OK,
2102  static_cast<FwAssertArgType>(_status)
2103  );
2104 
2105  // Send message
2107  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
2108 
2109  FW_ASSERT(
2110  qStatus == Os::Queue::OP_OK,
2111  static_cast<FwAssertArgType>(qStatus)
2112  );
2113  }
2114 
2115  // ----------------------------------------------------------------------
2116  // Pre-message hooks for async commands
2117  //
2118  // Each of these functions is invoked just before processing the
2119  // corresponding command. By default they do nothing. You can
2120  // override them to provide specific pre-command behavior.
2121  // ----------------------------------------------------------------------
2122 
2125  FwOpcodeType opCode,
2126  U32 cmdSeq
2127  )
2128  {
2129  // Defaults to no-op; can be overridden
2130  (void) opCode;
2131  (void) cmdSeq;
2132  }
2133 
2136  FwOpcodeType opCode,
2137  U32 cmdSeq
2138  )
2139  {
2140  // Defaults to no-op; can be overridden
2141  (void) opCode;
2142  (void) cmdSeq;
2143  }
2144 
2147  FwOpcodeType opCode,
2148  U32 cmdSeq
2149  )
2150  {
2151  // Defaults to no-op; can be overridden
2152  (void) opCode;
2153  (void) cmdSeq;
2154  }
2155 
2158  FwOpcodeType opCode,
2159  U32 cmdSeq
2160  )
2161  {
2162  // Defaults to no-op; can be overridden
2163  (void) opCode;
2164  (void) cmdSeq;
2165  }
2166 
2169  FwOpcodeType opCode,
2170  U32 cmdSeq
2171  )
2172  {
2173  // Defaults to no-op; can be overridden
2174  (void) opCode;
2175  (void) cmdSeq;
2176  }
2177 
2180  FwOpcodeType opCode,
2181  U32 cmdSeq
2182  )
2183  {
2184  // Defaults to no-op; can be overridden
2185  (void) opCode;
2186  (void) cmdSeq;
2187  }
2188 
2189  // ----------------------------------------------------------------------
2190  // Event logging functions
2191  // ----------------------------------------------------------------------
2192 
2195  {
2196  // Get the time
2197  Fw::Time _logTime;
2198  if (this->isConnected_timeGetOut_OutputPort(0)) {
2199  this->timeGetOut_out(0, _logTime);
2200  }
2201 
2202  const FwEventIdType _id = this->getIdBase() + EVENTID_NOCHAN;
2203 
2204  // Emit the event on the log port
2205  if (this->isConnected_eventOut_OutputPort(0)) {
2206  Fw::LogBuffer _logBuff;
2208 
2209 #if FW_AMPCS_COMPATIBLE
2210  // Serialize the number of arguments
2211  _status = _logBuff.serializeFrom(static_cast<U8>(1));
2212  FW_ASSERT(
2213  _status == Fw::FW_SERIALIZE_OK,
2214  static_cast<FwAssertArgType>(_status)
2215  );
2216 #endif
2217 
2218 #if FW_AMPCS_COMPATIBLE
2219  // Serialize the argument size
2220  _status = _logBuff.serializeFrom(
2221  static_cast<U8>(sizeof(FwChanIdType))
2222  );
2223  FW_ASSERT(
2224  _status == Fw::FW_SERIALIZE_OK,
2225  static_cast<FwAssertArgType>(_status)
2226  );
2227 #endif
2228  _status = _logBuff.serializeFrom(Id);
2229  FW_ASSERT(
2230  _status == Fw::FW_SERIALIZE_OK,
2231  static_cast<FwAssertArgType>(_status)
2232  );
2233 
2234  this->eventOut_out(
2235  0,
2236  _id,
2237  _logTime,
2239  _logBuff
2240  );
2241  }
2242 
2243  // Emit the event on the text log port
2244 #if FW_ENABLE_TEXT_LOGGING
2245  if (this->isConnected_textEventOut_OutputPort(0)) {
2246 #if FW_OBJECT_NAMES == 1
2247  const char* _formatString =
2248  "(%s) %s: Telemetry ID 0x%" PRIx32 " not packetized";
2249 #else
2250  const char* _formatString =
2251  "%s: Telemetry ID 0x%" PRIx32 " not packetized";
2252 #endif
2253 
2254  Fw::TextLogString _logString;
2255  _logString.format(
2256  _formatString,
2257 #if FW_OBJECT_NAMES == 1
2258  this->m_objName.toChar(),
2259 #endif
2260  "NoChan ",
2261  Id
2262  );
2263 
2264  this->textEventOut_out(
2265  0,
2266  _id,
2267  _logTime,
2269  _logString
2270  );
2271  }
2272 #endif
2273  }
2274 
2277  {
2278  // Get the time
2279  Fw::Time _logTime;
2280  if (this->isConnected_timeGetOut_OutputPort(0)) {
2281  this->timeGetOut_out(0, _logTime);
2282  }
2283 
2284  const FwEventIdType _id = this->getIdBase() + EVENTID_LEVELSET;
2285 
2286  // Emit the event on the log port
2287  if (this->isConnected_eventOut_OutputPort(0)) {
2288  Fw::LogBuffer _logBuff;
2290 
2291 #if FW_AMPCS_COMPATIBLE
2292  // Serialize the number of arguments
2293  _status = _logBuff.serializeFrom(static_cast<U8>(1));
2294  FW_ASSERT(
2295  _status == Fw::FW_SERIALIZE_OK,
2296  static_cast<FwAssertArgType>(_status)
2297  );
2298 #endif
2299 
2300 #if FW_AMPCS_COMPATIBLE
2301  // Serialize the argument size
2302  _status = _logBuff.serializeFrom(
2303  static_cast<U8>(sizeof(FwChanIdType))
2304  );
2305  FW_ASSERT(
2306  _status == Fw::FW_SERIALIZE_OK,
2307  static_cast<FwAssertArgType>(_status)
2308  );
2309 #endif
2310  _status = _logBuff.serializeFrom(level);
2311  FW_ASSERT(
2312  _status == Fw::FW_SERIALIZE_OK,
2313  static_cast<FwAssertArgType>(_status)
2314  );
2315 
2316  this->eventOut_out(
2317  0,
2318  _id,
2319  _logTime,
2321  _logBuff
2322  );
2323  }
2324 
2325  // Emit the event on the text log port
2326 #if FW_ENABLE_TEXT_LOGGING
2327  if (this->isConnected_textEventOut_OutputPort(0)) {
2328 #if FW_OBJECT_NAMES == 1
2329  const char* _formatString =
2330  "(%s) %s: Telemetry send level to %" PRIu32 "";
2331 #else
2332  const char* _formatString =
2333  "%s: Telemetry send level to %" PRIu32 "";
2334 #endif
2335 
2336  Fw::TextLogString _logString;
2337  _logString.format(
2338  _formatString,
2339 #if FW_OBJECT_NAMES == 1
2340  this->m_objName.toChar(),
2341 #endif
2342  "LevelSet ",
2343  level
2344  );
2345 
2346  this->textEventOut_out(
2347  0,
2348  _id,
2349  _logTime,
2351  _logString
2352  );
2353  }
2354 #endif
2355  }
2356 
2359  FwChanIdType level,
2360  FwChanIdType max
2361  ) const
2362  {
2363  // Get the time
2364  Fw::Time _logTime;
2365  if (this->isConnected_timeGetOut_OutputPort(0)) {
2366  this->timeGetOut_out(0, _logTime);
2367  }
2368 
2369  const FwEventIdType _id = this->getIdBase() + EVENTID_MAXLEVELEXCEED;
2370 
2371  // Emit the event on the log port
2372  if (this->isConnected_eventOut_OutputPort(0)) {
2373  Fw::LogBuffer _logBuff;
2375 
2376 #if FW_AMPCS_COMPATIBLE
2377  // Serialize the number of arguments
2378  _status = _logBuff.serializeFrom(static_cast<U8>(2));
2379  FW_ASSERT(
2380  _status == Fw::FW_SERIALIZE_OK,
2381  static_cast<FwAssertArgType>(_status)
2382  );
2383 #endif
2384 
2385 #if FW_AMPCS_COMPATIBLE
2386  // Serialize the argument size
2387  _status = _logBuff.serializeFrom(
2388  static_cast<U8>(sizeof(FwChanIdType))
2389  );
2390  FW_ASSERT(
2391  _status == Fw::FW_SERIALIZE_OK,
2392  static_cast<FwAssertArgType>(_status)
2393  );
2394 #endif
2395  _status = _logBuff.serializeFrom(level);
2396  FW_ASSERT(
2397  _status == Fw::FW_SERIALIZE_OK,
2398  static_cast<FwAssertArgType>(_status)
2399  );
2400 
2401 #if FW_AMPCS_COMPATIBLE
2402  // Serialize the argument size
2403  _status = _logBuff.serializeFrom(
2404  static_cast<U8>(sizeof(FwChanIdType))
2405  );
2406  FW_ASSERT(
2407  _status == Fw::FW_SERIALIZE_OK,
2408  static_cast<FwAssertArgType>(_status)
2409  );
2410 #endif
2411  _status = _logBuff.serializeFrom(max);
2412  FW_ASSERT(
2413  _status == Fw::FW_SERIALIZE_OK,
2414  static_cast<FwAssertArgType>(_status)
2415  );
2416 
2417  this->eventOut_out(
2418  0,
2419  _id,
2420  _logTime,
2422  _logBuff
2423  );
2424  }
2425 
2426  // Emit the event on the text log port
2427 #if FW_ENABLE_TEXT_LOGGING
2428  if (this->isConnected_textEventOut_OutputPort(0)) {
2429 #if FW_OBJECT_NAMES == 1
2430  const char* _formatString =
2431  "(%s) %s: Requested send level %" PRIu32 " higher than max packet level of %" PRIu32 "";
2432 #else
2433  const char* _formatString =
2434  "%s: Requested send level %" PRIu32 " higher than max packet level of %" PRIu32 "";
2435 #endif
2436 
2437  Fw::TextLogString _logString;
2438  _logString.format(
2439  _formatString,
2440 #if FW_OBJECT_NAMES == 1
2441  this->m_objName.toChar(),
2442 #endif
2443  "MaxLevelExceed ",
2444  level,
2445  max
2446  );
2447 
2448  this->textEventOut_out(
2449  0,
2450  _id,
2451  _logTime,
2453  _logString
2454  );
2455  }
2456 #endif
2457  }
2458 
2460  log_ACTIVITY_LO_PacketSent(U32 packetId) const
2461  {
2462  // Get the time
2463  Fw::Time _logTime;
2464  if (this->isConnected_timeGetOut_OutputPort(0)) {
2465  this->timeGetOut_out(0, _logTime);
2466  }
2467 
2468  const FwEventIdType _id = this->getIdBase() + EVENTID_PACKETSENT;
2469 
2470  // Emit the event on the log port
2471  if (this->isConnected_eventOut_OutputPort(0)) {
2472  Fw::LogBuffer _logBuff;
2474 
2475 #if FW_AMPCS_COMPATIBLE
2476  // Serialize the number of arguments
2477  _status = _logBuff.serializeFrom(static_cast<U8>(1));
2478  FW_ASSERT(
2479  _status == Fw::FW_SERIALIZE_OK,
2480  static_cast<FwAssertArgType>(_status)
2481  );
2482 #endif
2483 
2484 #if FW_AMPCS_COMPATIBLE
2485  // Serialize the argument size
2486  _status = _logBuff.serializeFrom(
2487  static_cast<U8>(sizeof(U32))
2488  );
2489  FW_ASSERT(
2490  _status == Fw::FW_SERIALIZE_OK,
2491  static_cast<FwAssertArgType>(_status)
2492  );
2493 #endif
2494  _status = _logBuff.serializeFrom(packetId);
2495  FW_ASSERT(
2496  _status == Fw::FW_SERIALIZE_OK,
2497  static_cast<FwAssertArgType>(_status)
2498  );
2499 
2500  this->eventOut_out(
2501  0,
2502  _id,
2503  _logTime,
2505  _logBuff
2506  );
2507  }
2508 
2509  // Emit the event on the text log port
2510 #if FW_ENABLE_TEXT_LOGGING
2511  if (this->isConnected_textEventOut_OutputPort(0)) {
2512 #if FW_OBJECT_NAMES == 1
2513  const char* _formatString =
2514  "(%s) %s: Sent packet ID %" PRIu32 "";
2515 #else
2516  const char* _formatString =
2517  "%s: Sent packet ID %" PRIu32 "";
2518 #endif
2519 
2520  Fw::TextLogString _logString;
2521  _logString.format(
2522  _formatString,
2523 #if FW_OBJECT_NAMES == 1
2524  this->m_objName.toChar(),
2525 #endif
2526  "PacketSent ",
2527  packetId
2528  );
2529 
2530  this->textEventOut_out(
2531  0,
2532  _id,
2533  _logTime,
2535  _logString
2536  );
2537  }
2538 #endif
2539  }
2540 
2543  {
2544  // Get the time
2545  Fw::Time _logTime;
2546  if (this->isConnected_timeGetOut_OutputPort(0)) {
2547  this->timeGetOut_out(0, _logTime);
2548  }
2549 
2550  const FwEventIdType _id = this->getIdBase() + EVENTID_PACKETNOTFOUND;
2551 
2552  // Emit the event on the log port
2553  if (this->isConnected_eventOut_OutputPort(0)) {
2554  Fw::LogBuffer _logBuff;
2556 
2557 #if FW_AMPCS_COMPATIBLE
2558  // Serialize the number of arguments
2559  _status = _logBuff.serializeFrom(static_cast<U8>(1));
2560  FW_ASSERT(
2561  _status == Fw::FW_SERIALIZE_OK,
2562  static_cast<FwAssertArgType>(_status)
2563  );
2564 #endif
2565 
2566 #if FW_AMPCS_COMPATIBLE
2567  // Serialize the argument size
2568  _status = _logBuff.serializeFrom(
2569  static_cast<U8>(sizeof(U32))
2570  );
2571  FW_ASSERT(
2572  _status == Fw::FW_SERIALIZE_OK,
2573  static_cast<FwAssertArgType>(_status)
2574  );
2575 #endif
2576  _status = _logBuff.serializeFrom(packetId);
2577  FW_ASSERT(
2578  _status == Fw::FW_SERIALIZE_OK,
2579  static_cast<FwAssertArgType>(_status)
2580  );
2581 
2582  this->eventOut_out(
2583  0,
2584  _id,
2585  _logTime,
2587  _logBuff
2588  );
2589  }
2590 
2591  // Emit the event on the text log port
2592 #if FW_ENABLE_TEXT_LOGGING
2593  if (this->isConnected_textEventOut_OutputPort(0)) {
2594 #if FW_OBJECT_NAMES == 1
2595  const char* _formatString =
2596  "(%s) %s: Could not find packet ID %" PRIu32 "";
2597 #else
2598  const char* _formatString =
2599  "%s: Could not find packet ID %" PRIu32 "";
2600 #endif
2601 
2602  Fw::TextLogString _logString;
2603  _logString.format(
2604  _formatString,
2605 #if FW_OBJECT_NAMES == 1
2606  this->m_objName.toChar(),
2607 #endif
2608  "PacketNotFound ",
2609  packetId
2610  );
2611 
2612  this->textEventOut_out(
2613  0,
2614  _id,
2615  _logTime,
2617  _logString
2618  );
2619  }
2620 #endif
2621  }
2622 
2625  Svc::TelemetrySection section,
2626  Fw::Enabled enable
2627  ) const
2628  {
2629  // Get the time
2630  Fw::Time _logTime;
2631  if (this->isConnected_timeGetOut_OutputPort(0)) {
2632  this->timeGetOut_out(0, _logTime);
2633  }
2634 
2636 
2637  // Emit the event on the log port
2638  if (this->isConnected_eventOut_OutputPort(0)) {
2639  Fw::LogBuffer _logBuff;
2641 
2642 #if FW_AMPCS_COMPATIBLE
2643  // Serialize the number of arguments
2644  _status = _logBuff.serializeFrom(static_cast<U8>(2));
2645  FW_ASSERT(
2646  _status == Fw::FW_SERIALIZE_OK,
2647  static_cast<FwAssertArgType>(_status)
2648  );
2649 #endif
2650 
2651 #if FW_AMPCS_COMPATIBLE
2652  // Serialize the argument size
2653  _status = _logBuff.serializeFrom(
2655  );
2656  FW_ASSERT(
2657  _status == Fw::FW_SERIALIZE_OK,
2658  static_cast<FwAssertArgType>(_status)
2659  );
2660 #endif
2661  _status = _logBuff.serializeFrom(section);
2662  FW_ASSERT(
2663  _status == Fw::FW_SERIALIZE_OK,
2664  static_cast<FwAssertArgType>(_status)
2665  );
2666 
2667 #if FW_AMPCS_COMPATIBLE
2668  // Serialize the argument size
2669  _status = _logBuff.serializeFrom(
2670  static_cast<U8>(Fw::Enabled::SERIALIZED_SIZE)
2671  );
2672  FW_ASSERT(
2673  _status == Fw::FW_SERIALIZE_OK,
2674  static_cast<FwAssertArgType>(_status)
2675  );
2676 #endif
2677  _status = _logBuff.serializeFrom(enable);
2678  FW_ASSERT(
2679  _status == Fw::FW_SERIALIZE_OK,
2680  static_cast<FwAssertArgType>(_status)
2681  );
2682 
2683  this->eventOut_out(
2684  0,
2685  _id,
2686  _logTime,
2688  _logBuff
2689  );
2690  }
2691 
2692  // Emit the event on the text log port
2693 #if FW_ENABLE_TEXT_LOGGING
2694  if (this->isConnected_textEventOut_OutputPort(0)) {
2695 #if FW_OBJECT_NAMES == 1
2696  const char* _formatString =
2697  "(%s) %s: Section %s is unconfigurable and cannot be set to %s";
2698 #else
2699  const char* _formatString =
2700  "%s: Section %s is unconfigurable and cannot be set to %s";
2701 #endif
2702 
2703  Fw::String sectionStr;
2704  section.toString(sectionStr);
2705  Fw::String enableStr;
2706  enable.toString(enableStr);
2707 
2708  Fw::TextLogString _logString;
2709  _logString.format(
2710  _formatString,
2711 #if FW_OBJECT_NAMES == 1
2712  this->m_objName.toChar(),
2713 #endif
2714  "SectionUnconfigurable ",
2715  sectionStr.toChar(),
2716  enableStr.toChar()
2717  );
2718 
2719  this->textEventOut_out(
2720  0,
2721  _id,
2722  _logTime,
2724  _logString
2725  );
2726  }
2727 #endif
2728  }
2729 
2730  // ----------------------------------------------------------------------
2731  // Telemetry serialized write
2732  // ----------------------------------------------------------------------
2733 
2736  FwChanIdType id,
2737  Fw::TlmBuffer& _tlmBuff,
2738  Fw::Time _tlmTime
2739  ) const
2740  {
2741  if (this->isConnected_tlmOut_OutputPort(0)) {
2742  if (
2744  (_tlmTime == Fw::ZERO_TIME)
2745  ) {
2746  this->timeGetOut_out(0, _tlmTime);
2747  }
2748 
2749  FwChanIdType _id;
2750  _id = this->getIdBase() + id;
2751 
2752  this->tlmOut_out(
2753  0,
2754  _id,
2755  _tlmTime,
2756  _tlmBuff
2757  );
2758  }
2759  }
2760 
2761  // ----------------------------------------------------------------------
2762  // Telemetry write functions
2763  // ----------------------------------------------------------------------
2764 
2768  Fw::Time _tlmTime
2769  ) const
2770  {
2771  if (this->isConnected_tlmOut_OutputPort(0)) {
2772  Fw::TlmBuffer _tlmBuff;
2773  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
2774  FW_ASSERT(
2775  _stat == Fw::FW_SERIALIZE_OK,
2776  static_cast<FwAssertArgType>(_stat)
2777  );
2778 
2779  this->tlmWrite(
2781  _tlmBuff,
2782  _tlmTime
2783  );
2784  }
2785  }
2786 
2790  Fw::Time _tlmTime
2791  ) const
2792  {
2793  if (this->isConnected_tlmOut_OutputPort(0)) {
2794  Fw::TlmBuffer _tlmBuff;
2795  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
2796  FW_ASSERT(
2797  _stat == Fw::FW_SERIALIZE_OK,
2798  static_cast<FwAssertArgType>(_stat)
2799  );
2800 
2801  this->tlmWrite(
2803  _tlmBuff,
2804  _tlmTime
2805  );
2806  }
2807  }
2808 
2809  // ----------------------------------------------------------------------
2810  // Parameter hook functions
2811  // ----------------------------------------------------------------------
2812 
2815  {
2816  // Do nothing by default
2817  }
2818 
2821  {
2822  // Do nothing by default
2823  }
2824 
2825  // ----------------------------------------------------------------------
2826  // Parameter get functions
2827  // ----------------------------------------------------------------------
2828 
2831  {
2833  this->m_paramLock.lock();
2834  valid = this->m_param_SECTION_ENABLED_valid;
2835  if ((valid == Fw::ParamValid::VALID) || (valid == Fw::ParamValid::DEFAULT)) {
2836  Fw::ParamBuffer _paramBuffer;
2837  FW_ASSERT(this->paramDelegatePtr != nullptr);
2838  Fw::SerializeStatus _stat = this->paramDelegatePtr->serializeParam(
2839  static_cast<FwPrmIdType>(this->getIdBase()),
2841  _paramBuffer
2842  );
2843  if(_stat == Fw::FW_SERIALIZE_OK) {
2844  _stat = _paramBuffer.deserializeTo(_local);
2845  FW_ASSERT(_stat == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(_stat));
2846  } else {
2847  valid = Fw::ParamValid::INVALID;
2848  }
2849  }
2850  this->m_paramLock.unlock();
2851  return _local;
2852  }
2853 
2856  {
2858  this->m_paramLock.lock();
2859  valid = this->m_param_SECTION_CONFIGS_valid;
2860  if ((valid == Fw::ParamValid::VALID) || (valid == Fw::ParamValid::DEFAULT)) {
2861  Fw::ParamBuffer _paramBuffer;
2862  FW_ASSERT(this->paramDelegatePtr != nullptr);
2863  Fw::SerializeStatus _stat = this->paramDelegatePtr->serializeParam(
2864  static_cast<FwPrmIdType>(this->getIdBase()),
2866  _paramBuffer
2867  );
2868  if(_stat == Fw::FW_SERIALIZE_OK) {
2869  _stat = _paramBuffer.deserializeTo(_local);
2870  FW_ASSERT(_stat == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(_stat));
2871  } else {
2872  valid = Fw::ParamValid::INVALID;
2873  }
2874  }
2875  this->m_paramLock.unlock();
2876  return _local;
2877  }
2878 
2879  // ----------------------------------------------------------------------
2880  // External parameter delegate initialization
2881  // ----------------------------------------------------------------------
2882 
2885  {
2886  FW_ASSERT(paramExternalDelegatePtr != nullptr);
2887  this->paramDelegatePtr = paramExternalDelegatePtr;
2888  }
2889 
2890  // ----------------------------------------------------------------------
2891  // Time
2892  // ----------------------------------------------------------------------
2893 
2895  getTime() const
2896  {
2897  if (this->isConnected_timeGetOut_OutputPort(0)) {
2898  Fw::Time _time;
2899  this->timeGetOut_out(0, _time);
2900  return _time;
2901  }
2902  else {
2903  return Fw::Time(TimeBase::TB_NONE, 0, 0);
2904  }
2905  }
2906 
2907  // ----------------------------------------------------------------------
2908  // Message dispatch functions
2909  // ----------------------------------------------------------------------
2910 
2911  Fw::QueuedComponentBase::MsgDispatchStatus TlmPacketizerComponentBase ::
2912  doDispatch()
2913  {
2914  ComponentIpcSerializableBuffer _msg;
2915  FwQueuePriorityType _priority = 0;
2916 
2917  Os::Queue::Status _msgStatus = this->m_queue.receive(
2918  _msg,
2920  _priority
2921  );
2922  FW_ASSERT(
2923  _msgStatus == Os::Queue::OP_OK,
2924  static_cast<FwAssertArgType>(_msgStatus)
2925  );
2926 
2927  // Reset to beginning of buffer
2928  _msg.resetDeser();
2929 
2930  FwEnumStoreType _desMsg = 0;
2931  Fw::SerializeStatus _deserStatus = _msg.deserializeTo(_desMsg);
2932  FW_ASSERT(
2933  _deserStatus == Fw::FW_SERIALIZE_OK,
2934  static_cast<FwAssertArgType>(_deserStatus)
2935  );
2936 
2937  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
2938 
2939  if (_msgType == TLMPACKETIZER_COMPONENT_EXIT) {
2940  return MSG_DISPATCH_EXIT;
2941  }
2942 
2943  FwIndexType portNum = 0;
2944  _deserStatus = _msg.deserializeTo(portNum);
2945  FW_ASSERT(
2946  _deserStatus == Fw::FW_SERIALIZE_OK,
2947  static_cast<FwAssertArgType>(_deserStatus)
2948  );
2949 
2950  switch (_msgType) {
2951  // Handle async input port Run
2952  case RUN_SCHED: {
2953  // Deserialize argument context
2954  U32 context;
2955  _deserStatus = _msg.deserializeTo(context);
2956  FW_ASSERT(
2957  _deserStatus == Fw::FW_SERIALIZE_OK,
2958  static_cast<FwAssertArgType>(_deserStatus)
2959  );
2960  // Call handler function
2961  this->Run_handler(
2962  portNum,
2963  context
2964  );
2965 
2966  break;
2967  }
2968 
2969  // Handle async input port configureSectionGroupRate
2970  case CONFIGURESECTIONGROUPRATE_CONFIGUREGROUPRATE: {
2971  // Deserialize argument section
2972  Svc::TelemetrySection section;
2973  _deserStatus = _msg.deserializeTo(section);
2974  FW_ASSERT(
2975  _deserStatus == Fw::FW_SERIALIZE_OK,
2976  static_cast<FwAssertArgType>(_deserStatus)
2977  );
2978 
2979  // Deserialize argument tlmGroup
2980  FwChanIdType tlmGroup;
2981  _deserStatus = _msg.deserializeTo(tlmGroup);
2982  FW_ASSERT(
2983  _deserStatus == Fw::FW_SERIALIZE_OK,
2984  static_cast<FwAssertArgType>(_deserStatus)
2985  );
2986 
2987  // Deserialize argument rateLogic
2988  Svc::RateLogic rateLogic;
2989  _deserStatus = _msg.deserializeTo(rateLogic);
2990  FW_ASSERT(
2991  _deserStatus == Fw::FW_SERIALIZE_OK,
2992  static_cast<FwAssertArgType>(_deserStatus)
2993  );
2994 
2995  // Deserialize argument minDelta
2996  U32 minDelta;
2997  _deserStatus = _msg.deserializeTo(minDelta);
2998  FW_ASSERT(
2999  _deserStatus == Fw::FW_SERIALIZE_OK,
3000  static_cast<FwAssertArgType>(_deserStatus)
3001  );
3002 
3003  // Deserialize argument maxDelta
3004  U32 maxDelta;
3005  _deserStatus = _msg.deserializeTo(maxDelta);
3006  FW_ASSERT(
3007  _deserStatus == Fw::FW_SERIALIZE_OK,
3008  static_cast<FwAssertArgType>(_deserStatus)
3009  );
3010  // Call handler function
3012  portNum,
3013  section,
3014  tlmGroup,
3015  rateLogic,
3016  minDelta,
3017  maxDelta
3018  );
3019 
3020  break;
3021  }
3022 
3023  // Handle async input port controlIn
3024  case CONTROLIN_ENABLESECTION: {
3025  // Deserialize argument section
3026  Svc::TelemetrySection section;
3027  _deserStatus = _msg.deserializeTo(section);
3028  FW_ASSERT(
3029  _deserStatus == Fw::FW_SERIALIZE_OK,
3030  static_cast<FwAssertArgType>(_deserStatus)
3031  );
3032 
3033  // Deserialize argument enabled
3034  Fw::Enabled enabled;
3035  _deserStatus = _msg.deserializeTo(enabled);
3036  FW_ASSERT(
3037  _deserStatus == Fw::FW_SERIALIZE_OK,
3038  static_cast<FwAssertArgType>(_deserStatus)
3039  );
3040  // Call handler function
3041  this->controlIn_handler(
3042  portNum,
3043  section,
3044  enabled
3045  );
3046 
3047  break;
3048  }
3049 
3050  // Handle async input port pingIn
3051  case PINGIN_PING: {
3052  // Deserialize argument key
3053  U32 key;
3054  _deserStatus = _msg.deserializeTo(key);
3055  FW_ASSERT(
3056  _deserStatus == Fw::FW_SERIALIZE_OK,
3057  static_cast<FwAssertArgType>(_deserStatus)
3058  );
3059  // Call handler function
3060  this->pingIn_handler(
3061  portNum,
3062  key
3063  );
3064 
3065  break;
3066  }
3067 
3068  // Handle command SET_LEVEL
3069  case CMD_SET_LEVEL: {
3070  // Deserialize opcode
3071  FwOpcodeType _opCode = 0;
3072  _deserStatus = _msg.deserializeTo(_opCode);
3073  FW_ASSERT (
3074  _deserStatus == Fw::FW_SERIALIZE_OK,
3075  static_cast<FwAssertArgType>(_deserStatus)
3076  );
3077 
3078  // Deserialize command sequence
3079  U32 _cmdSeq = 0;
3080  _deserStatus = _msg.deserializeTo(_cmdSeq);
3081  FW_ASSERT (
3082  _deserStatus == Fw::FW_SERIALIZE_OK,
3083  static_cast<FwAssertArgType>(_deserStatus)
3084  );
3085 
3086  // Deserialize command argument buffer
3087  Fw::CmdArgBuffer args;
3088  _deserStatus = _msg.deserializeTo(args);
3089  FW_ASSERT (
3090  _deserStatus == Fw::FW_SERIALIZE_OK,
3091  static_cast<FwAssertArgType>(_deserStatus)
3092  );
3093 
3094  // Reset buffer
3095  args.resetDeser();
3096 
3097  // Deserialize argument level
3098  FwChanIdType level;
3099  _deserStatus = args.deserializeTo(level);
3100  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
3102  this->cmdResponse_out(
3103  _opCode,
3104  _cmdSeq,
3106  );
3107  }
3108  // Don't crash the task if bad arguments were passed from the ground
3109  break;
3110  }
3111 
3112  // Make sure there was no data left over.
3113  // That means the argument buffer size was incorrect.
3114 #if FW_CMD_CHECK_RESIDUAL
3115  if (args.getDeserializeSizeLeft() != 0) {
3117  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
3118  }
3119  // Don't crash the task if bad arguments were passed from the ground
3120  break;
3121  }
3122 #endif
3123 
3124  // Call handler function
3125  this->SET_LEVEL_cmdHandler(
3126  _opCode, _cmdSeq,
3127  level
3128  );
3129 
3130  break;
3131  }
3132 
3133  // Handle command SEND_PKT
3134  case CMD_SEND_PKT: {
3135  // Deserialize opcode
3136  FwOpcodeType _opCode = 0;
3137  _deserStatus = _msg.deserializeTo(_opCode);
3138  FW_ASSERT (
3139  _deserStatus == Fw::FW_SERIALIZE_OK,
3140  static_cast<FwAssertArgType>(_deserStatus)
3141  );
3142 
3143  // Deserialize command sequence
3144  U32 _cmdSeq = 0;
3145  _deserStatus = _msg.deserializeTo(_cmdSeq);
3146  FW_ASSERT (
3147  _deserStatus == Fw::FW_SERIALIZE_OK,
3148  static_cast<FwAssertArgType>(_deserStatus)
3149  );
3150 
3151  // Deserialize command argument buffer
3152  Fw::CmdArgBuffer args;
3153  _deserStatus = _msg.deserializeTo(args);
3154  FW_ASSERT (
3155  _deserStatus == Fw::FW_SERIALIZE_OK,
3156  static_cast<FwAssertArgType>(_deserStatus)
3157  );
3158 
3159  // Reset buffer
3160  args.resetDeser();
3161 
3162  // Deserialize argument id
3163  U32 id;
3164  _deserStatus = args.deserializeTo(id);
3165  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
3167  this->cmdResponse_out(
3168  _opCode,
3169  _cmdSeq,
3171  );
3172  }
3173  // Don't crash the task if bad arguments were passed from the ground
3174  break;
3175  }
3176 
3177  // Deserialize argument section
3178  Svc::TelemetrySection section;
3179  _deserStatus = args.deserializeTo(section);
3180  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
3182  this->cmdResponse_out(
3183  _opCode,
3184  _cmdSeq,
3186  );
3187  }
3188  // Don't crash the task if bad arguments were passed from the ground
3189  break;
3190  }
3191 
3192  // Make sure there was no data left over.
3193  // That means the argument buffer size was incorrect.
3194 #if FW_CMD_CHECK_RESIDUAL
3195  if (args.getDeserializeSizeLeft() != 0) {
3197  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
3198  }
3199  // Don't crash the task if bad arguments were passed from the ground
3200  break;
3201  }
3202 #endif
3203 
3204  // Call handler function
3205  this->SEND_PKT_cmdHandler(
3206  _opCode, _cmdSeq,
3207  id,
3208  section
3209  );
3210 
3211  break;
3212  }
3213 
3214  // Handle command ENABLE_SECTION
3215  case CMD_ENABLE_SECTION: {
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  // Deserialize argument section
3244  Svc::TelemetrySection section;
3245  _deserStatus = args.deserializeTo(section);
3246  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
3248  this->cmdResponse_out(
3249  _opCode,
3250  _cmdSeq,
3252  );
3253  }
3254  // Don't crash the task if bad arguments were passed from the ground
3255  break;
3256  }
3257 
3258  // Deserialize argument enable
3259  Fw::Enabled enable;
3260  _deserStatus = args.deserializeTo(enable);
3261  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
3263  this->cmdResponse_out(
3264  _opCode,
3265  _cmdSeq,
3267  );
3268  }
3269  // Don't crash the task if bad arguments were passed from the ground
3270  break;
3271  }
3272 
3273  // Make sure there was no data left over.
3274  // That means the argument buffer size was incorrect.
3275 #if FW_CMD_CHECK_RESIDUAL
3276  if (args.getDeserializeSizeLeft() != 0) {
3278  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
3279  }
3280  // Don't crash the task if bad arguments were passed from the ground
3281  break;
3282  }
3283 #endif
3284 
3285  // Call handler function
3287  _opCode, _cmdSeq,
3288  section,
3289  enable
3290  );
3291 
3292  break;
3293  }
3294 
3295  // Handle command ENABLE_GROUP
3296  case CMD_ENABLE_GROUP: {
3297  // Deserialize opcode
3298  FwOpcodeType _opCode = 0;
3299  _deserStatus = _msg.deserializeTo(_opCode);
3300  FW_ASSERT (
3301  _deserStatus == Fw::FW_SERIALIZE_OK,
3302  static_cast<FwAssertArgType>(_deserStatus)
3303  );
3304 
3305  // Deserialize command sequence
3306  U32 _cmdSeq = 0;
3307  _deserStatus = _msg.deserializeTo(_cmdSeq);
3308  FW_ASSERT (
3309  _deserStatus == Fw::FW_SERIALIZE_OK,
3310  static_cast<FwAssertArgType>(_deserStatus)
3311  );
3312 
3313  // Deserialize command argument buffer
3314  Fw::CmdArgBuffer args;
3315  _deserStatus = _msg.deserializeTo(args);
3316  FW_ASSERT (
3317  _deserStatus == Fw::FW_SERIALIZE_OK,
3318  static_cast<FwAssertArgType>(_deserStatus)
3319  );
3320 
3321  // Reset buffer
3322  args.resetDeser();
3323 
3324  // Deserialize argument section
3325  Svc::TelemetrySection section;
3326  _deserStatus = args.deserializeTo(section);
3327  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
3329  this->cmdResponse_out(
3330  _opCode,
3331  _cmdSeq,
3333  );
3334  }
3335  // Don't crash the task if bad arguments were passed from the ground
3336  break;
3337  }
3338 
3339  // Deserialize argument tlmGroup
3340  FwChanIdType tlmGroup;
3341  _deserStatus = args.deserializeTo(tlmGroup);
3342  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
3344  this->cmdResponse_out(
3345  _opCode,
3346  _cmdSeq,
3348  );
3349  }
3350  // Don't crash the task if bad arguments were passed from the ground
3351  break;
3352  }
3353 
3354  // Deserialize argument enable
3355  Fw::Enabled enable;
3356  _deserStatus = args.deserializeTo(enable);
3357  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
3359  this->cmdResponse_out(
3360  _opCode,
3361  _cmdSeq,
3363  );
3364  }
3365  // Don't crash the task if bad arguments were passed from the ground
3366  break;
3367  }
3368 
3369  // Make sure there was no data left over.
3370  // That means the argument buffer size was incorrect.
3371 #if FW_CMD_CHECK_RESIDUAL
3372  if (args.getDeserializeSizeLeft() != 0) {
3374  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
3375  }
3376  // Don't crash the task if bad arguments were passed from the ground
3377  break;
3378  }
3379 #endif
3380 
3381  // Call handler function
3383  _opCode, _cmdSeq,
3384  section,
3385  tlmGroup,
3386  enable
3387  );
3388 
3389  break;
3390  }
3391 
3392  // Handle command FORCE_GROUP
3393  case CMD_FORCE_GROUP: {
3394  // Deserialize opcode
3395  FwOpcodeType _opCode = 0;
3396  _deserStatus = _msg.deserializeTo(_opCode);
3397  FW_ASSERT (
3398  _deserStatus == Fw::FW_SERIALIZE_OK,
3399  static_cast<FwAssertArgType>(_deserStatus)
3400  );
3401 
3402  // Deserialize command sequence
3403  U32 _cmdSeq = 0;
3404  _deserStatus = _msg.deserializeTo(_cmdSeq);
3405  FW_ASSERT (
3406  _deserStatus == Fw::FW_SERIALIZE_OK,
3407  static_cast<FwAssertArgType>(_deserStatus)
3408  );
3409 
3410  // Deserialize command argument buffer
3411  Fw::CmdArgBuffer args;
3412  _deserStatus = _msg.deserializeTo(args);
3413  FW_ASSERT (
3414  _deserStatus == Fw::FW_SERIALIZE_OK,
3415  static_cast<FwAssertArgType>(_deserStatus)
3416  );
3417 
3418  // Reset buffer
3419  args.resetDeser();
3420 
3421  // Deserialize argument section
3422  Svc::TelemetrySection section;
3423  _deserStatus = args.deserializeTo(section);
3424  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
3426  this->cmdResponse_out(
3427  _opCode,
3428  _cmdSeq,
3430  );
3431  }
3432  // Don't crash the task if bad arguments were passed from the ground
3433  break;
3434  }
3435 
3436  // Deserialize argument tlmGroup
3437  FwChanIdType tlmGroup;
3438  _deserStatus = args.deserializeTo(tlmGroup);
3439  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
3441  this->cmdResponse_out(
3442  _opCode,
3443  _cmdSeq,
3445  );
3446  }
3447  // Don't crash the task if bad arguments were passed from the ground
3448  break;
3449  }
3450 
3451  // Deserialize argument enable
3452  Fw::Enabled enable;
3453  _deserStatus = args.deserializeTo(enable);
3454  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
3456  this->cmdResponse_out(
3457  _opCode,
3458  _cmdSeq,
3460  );
3461  }
3462  // Don't crash the task if bad arguments were passed from the ground
3463  break;
3464  }
3465 
3466  // Make sure there was no data left over.
3467  // That means the argument buffer size was incorrect.
3468 #if FW_CMD_CHECK_RESIDUAL
3469  if (args.getDeserializeSizeLeft() != 0) {
3471  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
3472  }
3473  // Don't crash the task if bad arguments were passed from the ground
3474  break;
3475  }
3476 #endif
3477 
3478  // Call handler function
3479  this->FORCE_GROUP_cmdHandler(
3480  _opCode, _cmdSeq,
3481  section,
3482  tlmGroup,
3483  enable
3484  );
3485 
3486  break;
3487  }
3488 
3489  // Handle command CONFIGURE_GROUP_RATES
3490  case CMD_CONFIGURE_GROUP_RATES: {
3491  // Deserialize opcode
3492  FwOpcodeType _opCode = 0;
3493  _deserStatus = _msg.deserializeTo(_opCode);
3494  FW_ASSERT (
3495  _deserStatus == Fw::FW_SERIALIZE_OK,
3496  static_cast<FwAssertArgType>(_deserStatus)
3497  );
3498 
3499  // Deserialize command sequence
3500  U32 _cmdSeq = 0;
3501  _deserStatus = _msg.deserializeTo(_cmdSeq);
3502  FW_ASSERT (
3503  _deserStatus == Fw::FW_SERIALIZE_OK,
3504  static_cast<FwAssertArgType>(_deserStatus)
3505  );
3506 
3507  // Deserialize command argument buffer
3508  Fw::CmdArgBuffer args;
3509  _deserStatus = _msg.deserializeTo(args);
3510  FW_ASSERT (
3511  _deserStatus == Fw::FW_SERIALIZE_OK,
3512  static_cast<FwAssertArgType>(_deserStatus)
3513  );
3514 
3515  // Reset buffer
3516  args.resetDeser();
3517 
3518  // Deserialize argument section
3519  Svc::TelemetrySection section;
3520  _deserStatus = args.deserializeTo(section);
3521  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
3523  this->cmdResponse_out(
3524  _opCode,
3525  _cmdSeq,
3527  );
3528  }
3529  // Don't crash the task if bad arguments were passed from the ground
3530  break;
3531  }
3532 
3533  // Deserialize argument tlmGroup
3534  FwChanIdType tlmGroup;
3535  _deserStatus = args.deserializeTo(tlmGroup);
3536  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
3538  this->cmdResponse_out(
3539  _opCode,
3540  _cmdSeq,
3542  );
3543  }
3544  // Don't crash the task if bad arguments were passed from the ground
3545  break;
3546  }
3547 
3548  // Deserialize argument rateLogic
3549  Svc::RateLogic rateLogic;
3550  _deserStatus = args.deserializeTo(rateLogic);
3551  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
3553  this->cmdResponse_out(
3554  _opCode,
3555  _cmdSeq,
3557  );
3558  }
3559  // Don't crash the task if bad arguments were passed from the ground
3560  break;
3561  }
3562 
3563  // Deserialize argument minDelta
3564  U32 minDelta;
3565  _deserStatus = args.deserializeTo(minDelta);
3566  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
3568  this->cmdResponse_out(
3569  _opCode,
3570  _cmdSeq,
3572  );
3573  }
3574  // Don't crash the task if bad arguments were passed from the ground
3575  break;
3576  }
3577 
3578  // Deserialize argument maxDelta
3579  U32 maxDelta;
3580  _deserStatus = args.deserializeTo(maxDelta);
3581  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
3583  this->cmdResponse_out(
3584  _opCode,
3585  _cmdSeq,
3587  );
3588  }
3589  // Don't crash the task if bad arguments were passed from the ground
3590  break;
3591  }
3592 
3593  // Make sure there was no data left over.
3594  // That means the argument buffer size was incorrect.
3595 #if FW_CMD_CHECK_RESIDUAL
3596  if (args.getDeserializeSizeLeft() != 0) {
3598  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
3599  }
3600  // Don't crash the task if bad arguments were passed from the ground
3601  break;
3602  }
3603 #endif
3604 
3605  // Call handler function
3607  _opCode, _cmdSeq,
3608  section,
3609  tlmGroup,
3610  rateLogic,
3611  minDelta,
3612  maxDelta
3613  );
3614 
3615  break;
3616  }
3617 
3618  default:
3619  return MSG_DISPATCH_ERROR;
3620  }
3621 
3622  return MSG_DISPATCH_OK;
3623  }
3624 
3625  // ----------------------------------------------------------------------
3626  // Calls for messages received on special input ports
3627  // ----------------------------------------------------------------------
3628 
3629  void TlmPacketizerComponentBase ::
3630  m_p_cmdIn_in(
3631  Fw::PassiveComponentBase* callComp,
3632  FwIndexType portNum,
3633  FwOpcodeType opCode,
3634  U32 cmdSeq,
3635  Fw::CmdArgBuffer& args
3636  )
3637  {
3638  FW_ASSERT(callComp);
3639  TlmPacketizerComponentBase* compPtr = static_cast<TlmPacketizerComponentBase*>(callComp);
3640  compPtr->cmdIn_handlerBase(
3641  portNum,
3642  opCode,
3643  cmdSeq,
3644  args
3645  );
3646  }
3647 
3648  // ----------------------------------------------------------------------
3649  // Calls for messages received on typed input ports
3650  // ----------------------------------------------------------------------
3651 
3652  void TlmPacketizerComponentBase ::
3653  m_p_Run_in(
3654  Fw::PassiveComponentBase* callComp,
3655  FwIndexType portNum,
3656  U32 context
3657  )
3658  {
3659  FW_ASSERT(callComp);
3660  TlmPacketizerComponentBase* compPtr = static_cast<TlmPacketizerComponentBase*>(callComp);
3661  compPtr->Run_handlerBase(
3662  portNum,
3663  context
3664  );
3665  }
3666 
3667  Fw::TlmValid TlmPacketizerComponentBase ::
3668  m_p_TlmGet_in(
3669  Fw::PassiveComponentBase* callComp,
3670  FwIndexType portNum,
3671  FwChanIdType id,
3672  Fw::Time& timeTag,
3673  Fw::TlmBuffer& val
3674  )
3675  {
3676  FW_ASSERT(callComp);
3677  TlmPacketizerComponentBase* compPtr = static_cast<TlmPacketizerComponentBase*>(callComp);
3678  return compPtr->TlmGet_handlerBase(
3679  portNum,
3680  id,
3681  timeTag,
3682  val
3683  );
3684  }
3685 
3686  void TlmPacketizerComponentBase ::
3687  m_p_TlmRecv_in(
3688  Fw::PassiveComponentBase* callComp,
3689  FwIndexType portNum,
3690  FwChanIdType id,
3691  Fw::Time& timeTag,
3692  Fw::TlmBuffer& val
3693  )
3694  {
3695  FW_ASSERT(callComp);
3696  TlmPacketizerComponentBase* compPtr = static_cast<TlmPacketizerComponentBase*>(callComp);
3697  compPtr->TlmRecv_handlerBase(
3698  portNum,
3699  id,
3700  timeTag,
3701  val
3702  );
3703  }
3704 
3705  void TlmPacketizerComponentBase ::
3706  m_p_configureSectionGroupRate_in(
3707  Fw::PassiveComponentBase* callComp,
3708  FwIndexType portNum,
3709  const Svc::TelemetrySection& section,
3710  FwChanIdType tlmGroup,
3711  const Svc::RateLogic& rateLogic,
3712  U32 minDelta,
3713  U32 maxDelta
3714  )
3715  {
3716  FW_ASSERT(callComp);
3717  TlmPacketizerComponentBase* compPtr = static_cast<TlmPacketizerComponentBase*>(callComp);
3718  compPtr->configureSectionGroupRate_handlerBase(
3719  portNum,
3720  section,
3721  tlmGroup,
3722  rateLogic,
3723  minDelta,
3724  maxDelta
3725  );
3726  }
3727 
3728  void TlmPacketizerComponentBase ::
3729  m_p_controlIn_in(
3730  Fw::PassiveComponentBase* callComp,
3731  FwIndexType portNum,
3732  const Svc::TelemetrySection& section,
3733  const Fw::Enabled& enabled
3734  )
3735  {
3736  FW_ASSERT(callComp);
3737  TlmPacketizerComponentBase* compPtr = static_cast<TlmPacketizerComponentBase*>(callComp);
3738  compPtr->controlIn_handlerBase(
3739  portNum,
3740  section,
3741  enabled
3742  );
3743  }
3744 
3745  void TlmPacketizerComponentBase ::
3746  m_p_pingIn_in(
3747  Fw::PassiveComponentBase* callComp,
3748  FwIndexType portNum,
3749  U32 key
3750  )
3751  {
3752  FW_ASSERT(callComp);
3753  TlmPacketizerComponentBase* compPtr = static_cast<TlmPacketizerComponentBase*>(callComp);
3754  compPtr->pingIn_handlerBase(
3755  portNum,
3756  key
3757  );
3758  }
3759 
3760 #if !FW_DIRECT_PORT_CALLS
3761 
3762  // ----------------------------------------------------------------------
3763  // Invocation functions for special output ports
3764  // ----------------------------------------------------------------------
3765 
3766  void TlmPacketizerComponentBase ::
3767  cmdRegOut_out(
3768  FwIndexType portNum,
3769  FwOpcodeType opCode
3770  ) const
3771  {
3772  FW_ASSERT(
3773  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
3774  static_cast<FwAssertArgType>(portNum)
3775  );
3776 
3777  FW_ASSERT(
3778  this->m_cmdRegOut_OutputPort[portNum].isConnected(),
3779  static_cast<FwAssertArgType>(portNum)
3780  );
3781  this->m_cmdRegOut_OutputPort[portNum].invoke(
3782  opCode
3783  );
3784  }
3785 
3786  void TlmPacketizerComponentBase ::
3787  cmdResponseOut_out(
3788  FwIndexType portNum,
3789  FwOpcodeType opCode,
3790  U32 cmdSeq,
3791  const Fw::CmdResponse& response
3792  ) const
3793  {
3794  FW_ASSERT(
3795  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
3796  static_cast<FwAssertArgType>(portNum)
3797  );
3798 
3799  FW_ASSERT(
3800  this->m_cmdResponseOut_OutputPort[portNum].isConnected(),
3801  static_cast<FwAssertArgType>(portNum)
3802  );
3803  this->m_cmdResponseOut_OutputPort[portNum].invoke(
3804  opCode,
3805  cmdSeq,
3806  response
3807  );
3808  }
3809 
3810  void TlmPacketizerComponentBase ::
3811  eventOut_out(
3812  FwIndexType portNum,
3813  FwEventIdType id,
3814  Fw::Time& timeTag,
3815  const Fw::LogSeverity& severity,
3816  Fw::LogBuffer& args
3817  ) const
3818  {
3819  FW_ASSERT(
3820  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
3821  static_cast<FwAssertArgType>(portNum)
3822  );
3823 
3824  FW_ASSERT(
3825  this->m_eventOut_OutputPort[portNum].isConnected(),
3826  static_cast<FwAssertArgType>(portNum)
3827  );
3828  this->m_eventOut_OutputPort[portNum].invoke(
3829  id,
3830  timeTag,
3831  severity,
3832  args
3833  );
3834  }
3835 
3836  Fw::ParamValid TlmPacketizerComponentBase ::
3837  paramGetOut_out(
3838  FwIndexType portNum,
3839  FwPrmIdType id,
3840  Fw::ParamBuffer& val
3841  ) const
3842  {
3843  FW_ASSERT(
3844  (0 <= portNum) && (portNum < this->getNum_paramGetOut_OutputPorts()),
3845  static_cast<FwAssertArgType>(portNum)
3846  );
3847 
3848  FW_ASSERT(
3849  this->m_paramGetOut_OutputPort[portNum].isConnected(),
3850  static_cast<FwAssertArgType>(portNum)
3851  );
3852  return this->m_paramGetOut_OutputPort[portNum].invoke(
3853  id,
3854  val
3855  );
3856  }
3857 
3858  void TlmPacketizerComponentBase ::
3859  paramSetOut_out(
3860  FwIndexType portNum,
3861  FwPrmIdType id,
3862  Fw::ParamBuffer& val
3863  ) const
3864  {
3865  FW_ASSERT(
3866  (0 <= portNum) && (portNum < this->getNum_paramSetOut_OutputPorts()),
3867  static_cast<FwAssertArgType>(portNum)
3868  );
3869 
3870  FW_ASSERT(
3871  this->m_paramSetOut_OutputPort[portNum].isConnected(),
3872  static_cast<FwAssertArgType>(portNum)
3873  );
3874  this->m_paramSetOut_OutputPort[portNum].invoke(
3875  id,
3876  val
3877  );
3878  }
3879 
3880 #if FW_ENABLE_TEXT_LOGGING
3881 
3882  void TlmPacketizerComponentBase ::
3883  textEventOut_out(
3884  FwIndexType portNum,
3885  FwEventIdType id,
3886  Fw::Time& timeTag,
3887  const Fw::LogSeverity& severity,
3888  Fw::TextLogString& text
3889  ) const
3890  {
3891  FW_ASSERT(
3892  (0 <= portNum) && (portNum < this->getNum_textEventOut_OutputPorts()),
3893  static_cast<FwAssertArgType>(portNum)
3894  );
3895 
3896  FW_ASSERT(
3897  this->m_textEventOut_OutputPort[portNum].isConnected(),
3898  static_cast<FwAssertArgType>(portNum)
3899  );
3900  this->m_textEventOut_OutputPort[portNum].invoke(
3901  id,
3902  timeTag,
3903  severity,
3904  text
3905  );
3906  }
3907 
3908 #endif
3909 
3910  void TlmPacketizerComponentBase ::
3911  timeGetOut_out(
3912  FwIndexType portNum,
3913  Fw::Time& time
3914  ) const
3915  {
3916  FW_ASSERT(
3917  (0 <= portNum) && (portNum < this->getNum_timeGetOut_OutputPorts()),
3918  static_cast<FwAssertArgType>(portNum)
3919  );
3920 
3921  FW_ASSERT(
3922  this->m_timeGetOut_OutputPort[portNum].isConnected(),
3923  static_cast<FwAssertArgType>(portNum)
3924  );
3925  this->m_timeGetOut_OutputPort[portNum].invoke(
3926  time
3927  );
3928  }
3929 
3930  void TlmPacketizerComponentBase ::
3931  tlmOut_out(
3932  FwIndexType portNum,
3933  FwChanIdType id,
3934  Fw::Time& timeTag,
3935  Fw::TlmBuffer& val
3936  ) const
3937  {
3938  FW_ASSERT(
3939  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
3940  static_cast<FwAssertArgType>(portNum)
3941  );
3942 
3943  FW_ASSERT(
3944  this->m_tlmOut_OutputPort[portNum].isConnected(),
3945  static_cast<FwAssertArgType>(portNum)
3946  );
3947  this->m_tlmOut_OutputPort[portNum].invoke(
3948  id,
3949  timeTag,
3950  val
3951  );
3952  }
3953 
3954 #endif
3955 
3956  // ----------------------------------------------------------------------
3957  // Parameter set functions
3958  // ----------------------------------------------------------------------
3959 
3960  Fw::CmdResponse TlmPacketizerComponentBase ::
3961  paramSet_SECTION_ENABLED(Fw::SerialBufferBase& val)
3962  {
3963  Fw::CmdResponse _response{};
3964 
3965  this->m_paramLock.lock();
3966  // Update the external parameter
3967  FW_ASSERT(this->paramDelegatePtr != nullptr);
3968  const Fw::SerializeStatus _stat = this->paramDelegatePtr->deserializeParam(
3969  static_cast<FwPrmIdType>(this->getIdBase()),
3972  val
3973  );
3974  // Set response and update component state
3975  if (_stat == Fw::FW_SERIALIZE_OK) {
3976  this->m_param_SECTION_ENABLED_valid = Fw::ParamValid::VALID;
3977  _response = Fw::CmdResponse::OK;
3978  }
3979  else {
3980  this->m_param_SECTION_ENABLED_valid = Fw::ParamValid::INVALID;
3982  }
3983  this->m_paramLock.unlock();
3984 
3985  // Call notifier
3986  if (_response == Fw::CmdResponse::OK) {
3988  }
3989  return _response;
3990  }
3991 
3992  Fw::CmdResponse TlmPacketizerComponentBase ::
3993  paramSet_SECTION_CONFIGS(Fw::SerialBufferBase& val)
3994  {
3995  Fw::CmdResponse _response{};
3996 
3997  this->m_paramLock.lock();
3998  // Update the external parameter
3999  FW_ASSERT(this->paramDelegatePtr != nullptr);
4000  const Fw::SerializeStatus _stat = this->paramDelegatePtr->deserializeParam(
4001  static_cast<FwPrmIdType>(this->getIdBase()),
4004  val
4005  );
4006  // Set response and update component state
4007  if (_stat == Fw::FW_SERIALIZE_OK) {
4008  this->m_param_SECTION_CONFIGS_valid = Fw::ParamValid::VALID;
4009  _response = Fw::CmdResponse::OK;
4010  }
4011  else {
4012  this->m_param_SECTION_CONFIGS_valid = Fw::ParamValid::INVALID;
4014  }
4015  this->m_paramLock.unlock();
4016 
4017  // Call notifier
4018  if (_response == Fw::CmdResponse::OK) {
4020  }
4021  return _response;
4022  }
4023 
4024  // ----------------------------------------------------------------------
4025  // Parameter save functions
4026  // ----------------------------------------------------------------------
4027 
4028  Fw::CmdResponse TlmPacketizerComponentBase ::
4029  paramSave_SECTION_ENABLED()
4030  {
4031  if (!this->isConnected_paramSetOut_OutputPort(0)) {
4033  }
4034  Fw::ParamBuffer _paramBuffer;
4035  const FwIdType idBase = this->getIdBase();
4037  // Serialize the parameter
4038  this->m_paramLock.lock();
4039  if ((this->m_param_SECTION_ENABLED_valid == Fw::ParamValid::VALID) || (this->m_param_SECTION_ENABLED_valid == Fw::ParamValid::DEFAULT)) {
4040  FW_ASSERT(this->paramDelegatePtr != nullptr);
4041  _stat = this->paramDelegatePtr->serializeParam(
4042  static_cast<FwPrmIdType>(idBase),
4044  _paramBuffer
4045  );
4046  }
4047  this->m_paramLock.unlock();
4048  if (_stat != Fw::FW_SERIALIZE_OK) {
4050  }
4051  // Save the parameter
4052  this->paramSetOut_out(
4053  0,
4054  static_cast<FwPrmIdType>(idBase + PARAMID_SECTION_ENABLED),
4055  _paramBuffer
4056  );
4057  // Return the command response
4058  return Fw::CmdResponse::OK;
4059  }
4060 
4061  Fw::CmdResponse TlmPacketizerComponentBase ::
4062  paramSave_SECTION_CONFIGS()
4063  {
4064  if (!this->isConnected_paramSetOut_OutputPort(0)) {
4066  }
4067  Fw::ParamBuffer _paramBuffer;
4068  const FwIdType idBase = this->getIdBase();
4070  // Serialize the parameter
4071  this->m_paramLock.lock();
4072  if ((this->m_param_SECTION_CONFIGS_valid == Fw::ParamValid::VALID) || (this->m_param_SECTION_CONFIGS_valid == Fw::ParamValid::DEFAULT)) {
4073  FW_ASSERT(this->paramDelegatePtr != nullptr);
4074  _stat = this->paramDelegatePtr->serializeParam(
4075  static_cast<FwPrmIdType>(idBase),
4077  _paramBuffer
4078  );
4079  }
4080  this->m_paramLock.unlock();
4081  if (_stat != Fw::FW_SERIALIZE_OK) {
4083  }
4084  // Save the parameter
4085  this->paramSetOut_out(
4086  0,
4087  static_cast<FwPrmIdType>(idBase + PARAMID_SECTION_CONFIGS),
4088  _paramBuffer
4089  );
4090  // Return the command response
4091  return Fw::CmdResponse::OK;
4092  }
4093 
4094 }
bool isConnected_PktSend_OutputPort(FwIndexType portNum) const
static constexpr FwSizeType CAPACITY
Serialization/Deserialization operation was successful.
void SEND_PKT_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:157
Svc::InputEnableSectionPort * get_controlIn_InputPort(FwIndexType portNum)
message to exit active component task
void invoke(Fw::ComBuffer &data, U32 context) const
Invoke a port connection.
Definition: ComPortAc.cpp:181
Telemetry channel is not part of a telemetry packet.
void init()
Initialization function.
Definition: ComPortAc.cpp:162
static constexpr FwSizeType CAPACITY
Definition: CmdPortAc.hpp:36
void set_PktSend_OutputPort(FwIndexType portNum, Fw::InputComPort *port)
Connect port to PktSend[portNum].
FwIdType FwOpcodeType
The type of a command opcode.
bool isConnected_eventOut_OutputPort(FwIndexType portNum) const
Operation succeeded.
Definition: Os.hpp:27
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
void pingIn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port pingIn.
PlatformSizeType FwSizeType
void tlmWrite_GroupConfigs(const Svc::TlmPacketizer_SectionConfigs &arg, Fw::Time _tlmTime=Fw::Time()) const
bool isConnected_tlmOut_OutputPort(FwIndexType portNum) const
void FORCE_GROUP_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Status receive(U8 *destination, FwSizeType capacity, BlockingType blockType, FwSizeType &actualSize, FwQueuePriorityType &priority) override
receive a message from the queue through delegate
Definition: Queue.cpp:71
Fw::InputCmdPort * get_cmdIn_InputPort(FwIndexType portNum)
I32 FwEnumStoreType
static constexpr FwIndexType getNum_cmdResponseOut_OutputPorts()
bool isConnected_paramGetOut_OutputPort(FwIndexType portNum) const
Enabled state.
void log_ACTIVITY_HI_LevelSet(FwChanIdType level) const
void init()
Initialization function.
Svc::InputConfigureGroupRatePort * get_configureSectionGroupRate_InputPort(FwIndexType portNum)
virtual void TlmRecv_handler(FwIndexType portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)=0
Handler for input port TlmRecv.
void Run_handlerBase(FwIndexType portNum, U32 context)
Handler base-class function for input port Run.
void log_ACTIVITY_LO_PacketSent(U32 packetId) const
Status
status returned from the queue send function
Definition: Queue.hpp:30
void init()
Initialization function.
Definition: SchedPortAc.cpp:73
static constexpr FwIndexType getNum_PktSend_OutputPorts()
void init()
Initialization function.
Definition: CmdPortAc.cpp:89
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: TlmPortAc.cpp:95
virtual SerializeStatus deserializeParam(const FwPrmIdType base_id, const FwPrmIdType local_id, const ParamValid prmStat, SerialBufferBase &buff)=0
FwIdType FwPrmIdType
The type of a parameter identifier.
void log_WARNING_LO_NoChan(FwChanIdType Id) const
static constexpr FwIndexType getNum_pingIn_InputPorts()
void addCallPort(InputPrmSetPort *callPort)
Register an input port.
virtual void configureSectionGroupRate_handler(FwIndexType portNum, const Svc::TelemetrySection &section, FwChanIdType tlmGroup, const Svc::RateLogic &rateLogic, U32 minDelta, U32 maxDelta)=0
Handler for input port configureSectionGroupRate.
virtual void FORCE_GROUP_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Svc::TelemetrySection section, FwChanIdType tlmGroup, Fw::Enabled enable)=0
virtual SerializeStatus serializeParam(const FwPrmIdType base_id, const FwPrmIdType local_id, SerialBufferBase &buff) const =0
void invoke(U32 key) const
Invoke a port connection.
Definition: PingPortAc.cpp:170
void TlmRecv_handlerBase(FwIndexType portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)
Handler base-class function for input port TlmRecv.
void controlIn_handlerBase(FwIndexType portNum, const Svc::TelemetrySection &section, const Fw::Enabled &enabled)
Handler base-class function for input port controlIn.
const Time ZERO_TIME
Definition: Time.cpp:5
bool isConnected_pingOut_OutputPort(FwIndexType portNum) const
virtual void controlIn_handler(FwIndexType portNum, const Svc::TelemetrySection &section, const Fw::Enabled &enabled)=0
Handler for input port controlIn.
virtual void SEND_PKT_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, U32 id, Svc::TelemetrySection section)=0
void init()
Initialization function.
Definition: TlmPortAc.cpp:171
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
Enum representing a command response.
void init()
Initialization function.
Definition: TlmPortAc.cpp:89
No time base has been established (Required)
bool isConnected_paramSetOut_OutputPort(FwIndexType portNum) const
void addCallPort(InputCmdRegPort *callPort)
Register an input port.
Send on updates after MIN ticks since last send.
Enable / disable telemetry of a group on a section.
void cmdIn_handlerBase(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Handler base-class function for input port cmdIn.
virtual void pingIn_preMsgHook(FwIndexType portNum, U32 key)
Pre-message hook for async input port pingIn.
virtual void SET_LEVEL_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, FwChanIdType level)=0
void log_WARNING_LO_PacketNotFound(U32 packetId) const
void init()
Initialization function.
Os::Queue m_queue
queue object for active component
void loadParameters()
Load the parameters from a parameter source.
void set_paramSetOut_OutputPort(FwIndexType portNum, Fw::InputPrmSetPort *port)
Connect port to paramSetOut[portNum].
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:177
virtual ~TlmPacketizerComponentBase()
Destroy TlmPacketizerComponentBase object.
void addCallPort(InputPrmGetPort *callPort)
Register an input port.
void tlmWrite_SectionEnabled(const Svc::TlmPacketizer_SectionEnabled &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel SectionEnabled.
void set_pingOut_OutputPort(FwIndexType portNum, Svc::InputPingPort *port)
Connect port to pingOut[portNum].
void init()
Object initializer.
Definition: ObjBase.cpp:24
virtual void CONFIGURE_GROUP_RATES_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Svc::TelemetrySection section, FwChanIdType tlmGroup, Svc::RateLogic rateLogic, U32 minDelta, U32 maxDelta)=0
SerializeStatus
forward declaration for string
void registerExternalParameters(Fw::ParamExternalDelegate *paramExternalDelegatePtr)
Initialize the external parameter delegate.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: CmdPortAc.cpp:95
Message will block until space is available.
Definition: Queue.hpp:47
Set Min and Max Deltas between successive packets.
virtual void configureSectionGroupRate_preMsgHook(FwIndexType portNum, const Svc::TelemetrySection &section, FwChanIdType tlmGroup, const Svc::RateLogic &rateLogic, U32 minDelta, U32 maxDelta)
Pre-message hook for async input port configureSectionGroupRate.
void unlock()
alias for unLock to meet BasicLockable requirements
Definition: Mutex.hpp:64
FwIdType FwEventIdType
The type of an event identifier.
virtual void FORCE_GROUP_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command FORCE_GROUP.
void invoke(FwOpcodeType opCode) const
Invoke a port connection.
static constexpr FwSizeType CAPACITY
Definition: PingPortAc.hpp:34
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:40
Svc::InputPingPort * get_pingIn_InputPort(FwIndexType portNum)
void init()
Initialization function.
Definition: TimePortAc.cpp:151
static constexpr FwIndexType getNum_cmdRegOut_OutputPorts()
Data was the wrong format (e.g. wrong packet type)
Fw::InputTlmGetPort * get_TlmGet_InputPort(FwIndexType portNum)
bool isConnected_timeGetOut_OutputPort(FwIndexType portNum) const
virtual void CONFIGURE_GROUP_RATES_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command CONFIGURE_GROUP_RATES.
Less important informational events.
Os::Queue::Status createQueue(FwSizeType depth, FwSizeType msgSize)
virtual void Run_preMsgHook(FwIndexType portNum, U32 context)
Pre-message hook for async input port Run.
Enumeration for rate logic types for telemetry groups.
A less serious but recoverable event.
Fw::ParamValid invoke(FwPrmIdType id, Fw::ParamBuffer &val) const
void tlmWrite(FwChanIdType id, Fw::TlmBuffer &_tlmBuff, Fw::Time _tlmTime=Fw::Time()) const
void init()
Initialization function.
Definition: PingPortAc.cpp:151
bool isConnected_cmdResponseOut_OutputPort(FwIndexType portNum) const
static constexpr FwIndexType getNum_timeGetOut_OutputPorts()
void invoke(Fw::Time &time) const
Invoke a port connection.
Definition: TimePortAc.cpp:170
static constexpr FwIndexType getNum_paramGetOut_OutputPorts()
Serializable::SizeType getDeserializeSizeLeft() const override
Get remaining deserialization buffer size.
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke a port connection.
virtual void ENABLE_GROUP_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Svc::TelemetrySection section, FwChanIdType tlmGroup, Fw::Enabled enable)=0
FwIdType FwChanIdType
The type of a telemetry channel identifier.
FwSizeType SizeType
void addCallPort(InputPingPort *callPort)
Register an input port.
Definition: PingPortAc.cpp:157
Status send(const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override
send a message into the queue through delegate
Definition: Queue.cpp:54
The size of the serial representation.
void resetDeser() override
Reset deserialization pointer to beginning of buffer.
void resetSer() override
Reset serialization pointer to beginning of buffer.
virtual void pingIn_handler(FwIndexType portNum, U32 key)=0
Handler for input port pingIn.
virtual void ENABLE_GROUP_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command ENABLE_GROUP.
void invoke(FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val) const
Invoke a port connection.
Definition: TlmPortAc.cpp:190
const char * toChar() const
Convert to a C-style char*.
void set_eventOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to eventOut[portNum].
bool isConnected() const
Definition: PortBase.cpp:38
Enum representing event severity.
static constexpr FwIndexType getNum_tlmOut_OutputPorts()
virtual void ENABLE_SECTION_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Svc::TelemetrySection section, Fw::Enabled enable)=0
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
#define PRI_FwIndexType
Enabled and disabled states.
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
Fw::TlmValid TlmGet_handlerBase(FwIndexType portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)
Handler base-class function for input port TlmGet.
void init()
Initialization function.
Definition: LogPortAc.cpp:180
Command successfully executed.
virtual void Run_handler(FwIndexType portNum, U32 context)=0
Handler for input port Run.
void setPortNum(FwIndexType portNum)
void init()
Initialization function.
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:53
BlockingType
message type
Definition: Queue.hpp:46
static constexpr FwIndexType getNum_eventOut_OutputPorts()
The size of the serial representation.
void ENABLE_GROUP_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Command failed to deserialize.
PlatformQueuePriorityType FwQueuePriorityType
The type of queue priorities used.
Command had execution error.
Important informational events.
Svc::TlmPacketizer_SectionEnabled paramGet_SECTION_ENABLED(Fw::ParamValid &valid)
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 PktSend_out(FwIndexType portNum, Fw::ComBuffer &data, U32 context) const
Invoke output port PktSend.
void log_WARNING_LO_SectionUnconfigurable(Svc::TelemetrySection section, Fw::Enabled enable) const
Log event SectionUnconfigurable.
static constexpr FwIndexType getNum_paramSetOut_OutputPorts()
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void log_WARNING_LO_MaxLevelExceed(FwChanIdType level, FwChanIdType max) const
virtual void controlIn_preMsgHook(FwIndexType portNum, const Svc::TelemetrySection &section, const Fw::Enabled &enabled)
Pre-message hook for async input port controlIn.
A message was sent requesting an exit of the loop.
PlatformIndexType FwIndexType
TlmPacketizerComponentBase(const char *compName="")
Construct TlmPacketizerComponentBase object.
static constexpr FwIndexType getNum_configureSectionGroupRate_InputPorts()
virtual void parametersLoaded()
Called whenever parameters are loaded.
void set_timeGetOut_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeGetOut[portNum].
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:186
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void ENABLE_SECTION_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void init()
Initialization function.
virtual void SEND_PKT_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command SEND_PKT.
void init()
Initialization function.
Definition: PingPortAc.cpp:73
void init()
Initialization function.
Command failed validation.
void configureSectionGroupRate_handlerBase(FwIndexType portNum, const Svc::TelemetrySection &section, FwChanIdType tlmGroup, const Svc::RateLogic &rateLogic, U32 minDelta, U32 maxDelta)
Handler base-class function for input port configureSectionGroupRate.
RateGroupDivider component implementation.
virtual void parameterUpdated(FwPrmIdType id)
Called whenever a parameter is updated.
message sent/received okay
Definition: Queue.hpp:31
SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG) override
Deserialize an 8-bit unsigned integer value.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Enum representing parameter validity.
bool isConnected_cmdRegOut_OutputPort(FwIndexType portNum) const
U8 BYTE
byte type
Definition: BasicTypes.h:56
Svc::InputSchedPort * get_Run_InputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_TlmGet_InputPorts()
void invoke(FwPrmIdType id, Fw::ParamBuffer &val) const
Invoke a port connection.
void addCallPort(InputComPort *callPort)
Register an input port.
Definition: ComPortAc.cpp:168
Fw::InputTlmPort * get_TlmRecv_InputPort(FwIndexType portNum)
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: PingPortAc.cpp:79
Svc::TlmPacketizer_SectionConfigs paramGet_SECTION_CONFIGS(Fw::ParamValid &valid)
static constexpr FwIndexType getNum_controlIn_InputPorts()
virtual void ENABLE_SECTION_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command ENABLE_SECTION.
Force telemetering a group on a section, even if disabled.
void regCommands()
Register commands with the Command Dispatcher.
Message will return with status when space is unavailable.
Definition: Queue.hpp:48
Implementation of malloc based allocator.
void init()
Initialization function.
void init()
Initialization function.
void pingOut_out(FwIndexType portNum, U32 key) const
Invoke output port pingOut.
void CONFIGURE_GROUP_RATES_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void SET_LEVEL_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
virtual void SET_LEVEL_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command SET_LEVEL.
static constexpr FwIndexType getNum_pingOut_OutputPorts()
#define FW_ASSERT(...)
Definition: Assert.hpp:14
Disabled state.
static constexpr FwSizeType CAPACITY
Definition: SchedPortAc.hpp:34
void set_paramGetOut_OutputPort(FwIndexType portNum, Fw::InputPrmGetPort *port)
Connect port to paramGetOut[portNum].
static constexpr FwIndexType getNum_Run_InputPorts()
void set_cmdResponseOut_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to cmdResponseOut[portNum].
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.
void lock()
lock the mutex and assert success
Definition: Mutex.cpp:34
virtual Fw::TlmValid TlmGet_handler(FwIndexType portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)=0
Handler for input port TlmGet.
static constexpr FwIndexType getNum_TlmRecv_InputPorts()
U32 FwIdType
The id type.
void set_cmdRegOut_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to cmdRegOut[portNum].
static constexpr FwIndexType getNum_cmdIn_InputPorts()