F´ Flight Software - C/C++ Documentation  devel
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 <cstdio>
8 
10 #include "Fw/Types/Assert.hpp"
11 #if FW_ENABLE_TEXT_LOGGING
12 #include "Fw/Types/String.hpp"
13 #endif
14 
15 namespace Svc {
16 
17  namespace {
18  enum MsgTypeEnum {
19  TLMPACKETIZER_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT,
20  RUN_SCHED,
21  PINGIN_PING,
22  CMD_SET_LEVEL,
23  CMD_SEND_PKT,
24  };
25 
26  // Get the max size by constructing a union of the async input, command, and
27  // internal port serialization sizes
28  union BuffUnion {
32  };
33 
34  // Define a message buffer class large enough to handle all the
35  // asynchronous inputs to the component
36  class ComponentIpcSerializableBuffer :
38  {
39 
40  public:
41 
42  enum {
43  // Max. message size = size of data + message id + port
44  SERIALIZATION_SIZE =
45  sizeof(BuffUnion) +
46  sizeof(NATIVE_INT_TYPE) +
47  sizeof(NATIVE_INT_TYPE)
48  };
49 
50  NATIVE_UINT_TYPE getBuffCapacity() const {
51  return sizeof(m_buff);
52  }
53 
54  U8* getBuffAddr() {
55  return m_buff;
56  }
57 
58  const U8* getBuffAddr() const {
59  return m_buff;
60  }
61 
62  private:
63  // Should be the max of all the input ports serialized sizes...
64  U8 m_buff[SERIALIZATION_SIZE];
65 
66  };
67  }
68 
69  // ----------------------------------------------------------------------
70  // Component initialization
71  // ----------------------------------------------------------------------
72 
74  init(
75  NATIVE_INT_TYPE queueDepth,
76  NATIVE_INT_TYPE instance
77  )
78  {
79  // Initialize base class
81 
82  // Connect input port cmdIn
83  for (
84  PlatformIntType port = 0;
85  port < static_cast<PlatformIntType>(this->getNum_cmdIn_InputPorts());
86  port++
87  ) {
88  this->m_cmdIn_InputPort[port].init();
89  this->m_cmdIn_InputPort[port].addCallComp(
90  this,
91  m_p_cmdIn_in
92  );
93  this->m_cmdIn_InputPort[port].setPortNum(port);
94 
95 #if FW_OBJECT_NAMES == 1
96  // The port name consists of this->m_objName and some extra info.
97  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
98  // However, the compiler may assume that this->m_objName fills
99  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
100  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
101  // bytes to cover the extra info.
102  char portName[2*FW_OBJ_NAME_MAX_SIZE];
103  (void) snprintf(
104  portName,
105  sizeof(portName),
106  "%s_cmdIn_InputPort[%" PRI_PlatformIntType "]",
107  this->m_objName,
108  port
109  );
110  this->m_cmdIn_InputPort[port].setObjName(portName);
111 #endif
112  }
113 
114  // Connect input port Run
115  for (
116  PlatformIntType port = 0;
117  port < static_cast<PlatformIntType>(this->getNum_Run_InputPorts());
118  port++
119  ) {
120  this->m_Run_InputPort[port].init();
121  this->m_Run_InputPort[port].addCallComp(
122  this,
123  m_p_Run_in
124  );
125  this->m_Run_InputPort[port].setPortNum(port);
126 
127 #if FW_OBJECT_NAMES == 1
128  // The port name consists of this->m_objName and some extra info.
129  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
130  // However, the compiler may assume that this->m_objName fills
131  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
132  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
133  // bytes to cover the extra info.
134  char portName[2*FW_OBJ_NAME_MAX_SIZE];
135  (void) snprintf(
136  portName,
137  sizeof(portName),
138  "%s_Run_InputPort[%" PRI_PlatformIntType "]",
139  this->m_objName,
140  port
141  );
142  this->m_Run_InputPort[port].setObjName(portName);
143 #endif
144  }
145 
146  // Connect input port TlmRecv
147  for (
148  PlatformIntType port = 0;
149  port < static_cast<PlatformIntType>(this->getNum_TlmRecv_InputPorts());
150  port++
151  ) {
152  this->m_TlmRecv_InputPort[port].init();
153  this->m_TlmRecv_InputPort[port].addCallComp(
154  this,
155  m_p_TlmRecv_in
156  );
157  this->m_TlmRecv_InputPort[port].setPortNum(port);
158 
159 #if FW_OBJECT_NAMES == 1
160  // The port name consists of this->m_objName and some extra info.
161  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
162  // However, the compiler may assume that this->m_objName fills
163  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
164  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
165  // bytes to cover the extra info.
166  char portName[2*FW_OBJ_NAME_MAX_SIZE];
167  (void) snprintf(
168  portName,
169  sizeof(portName),
170  "%s_TlmRecv_InputPort[%" PRI_PlatformIntType "]",
171  this->m_objName,
172  port
173  );
174  this->m_TlmRecv_InputPort[port].setObjName(portName);
175 #endif
176  }
177 
178  // Connect input port pingIn
179  for (
180  PlatformIntType port = 0;
181  port < static_cast<PlatformIntType>(this->getNum_pingIn_InputPorts());
182  port++
183  ) {
184  this->m_pingIn_InputPort[port].init();
185  this->m_pingIn_InputPort[port].addCallComp(
186  this,
187  m_p_pingIn_in
188  );
189  this->m_pingIn_InputPort[port].setPortNum(port);
190 
191 #if FW_OBJECT_NAMES == 1
192  // The port name consists of this->m_objName and some extra info.
193  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
194  // However, the compiler may assume that this->m_objName fills
195  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
196  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
197  // bytes to cover the extra info.
198  char portName[2*FW_OBJ_NAME_MAX_SIZE];
199  (void) snprintf(
200  portName,
201  sizeof(portName),
202  "%s_pingIn_InputPort[%" PRI_PlatformIntType "]",
203  this->m_objName,
204  port
205  );
206  this->m_pingIn_InputPort[port].setObjName(portName);
207 #endif
208  }
209 
210  // Connect output port cmdRegOut
211  for (
212  PlatformIntType port = 0;
213  port < static_cast<PlatformIntType>(this->getNum_cmdRegOut_OutputPorts());
214  port++
215  ) {
216  this->m_cmdRegOut_OutputPort[port].init();
217 
218 #if FW_OBJECT_NAMES == 1
219  // The port name consists of this->m_objName and some extra info.
220  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
221  // However, the compiler may assume that this->m_objName fills
222  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
223  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
224  // bytes to cover the extra info.
225  char portName[2*FW_OBJ_NAME_MAX_SIZE];
226  (void) snprintf(
227  portName,
228  sizeof(portName),
229  "%s_cmdRegOut_OutputPort[%" PRI_PlatformIntType "]",
230  this->m_objName,
231  port
232  );
233  this->m_cmdRegOut_OutputPort[port].setObjName(portName);
234 #endif
235  }
236 
237  // Connect output port cmdResponseOut
238  for (
239  PlatformIntType port = 0;
240  port < static_cast<PlatformIntType>(this->getNum_cmdResponseOut_OutputPorts());
241  port++
242  ) {
243  this->m_cmdResponseOut_OutputPort[port].init();
244 
245 #if FW_OBJECT_NAMES == 1
246  // The port name consists of this->m_objName and some extra info.
247  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
248  // However, the compiler may assume that this->m_objName fills
249  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
250  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
251  // bytes to cover the extra info.
252  char portName[2*FW_OBJ_NAME_MAX_SIZE];
253  (void) snprintf(
254  portName,
255  sizeof(portName),
256  "%s_cmdResponseOut_OutputPort[%" PRI_PlatformIntType "]",
257  this->m_objName,
258  port
259  );
260  this->m_cmdResponseOut_OutputPort[port].setObjName(portName);
261 #endif
262  }
263 
264  // Connect output port eventOut
265  for (
266  PlatformIntType port = 0;
267  port < static_cast<PlatformIntType>(this->getNum_eventOut_OutputPorts());
268  port++
269  ) {
270  this->m_eventOut_OutputPort[port].init();
271 
272 #if FW_OBJECT_NAMES == 1
273  // The port name consists of this->m_objName and some extra info.
274  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
275  // However, the compiler may assume that this->m_objName fills
276  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
277  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
278  // bytes to cover the extra info.
279  char portName[2*FW_OBJ_NAME_MAX_SIZE];
280  (void) snprintf(
281  portName,
282  sizeof(portName),
283  "%s_eventOut_OutputPort[%" PRI_PlatformIntType "]",
284  this->m_objName,
285  port
286  );
287  this->m_eventOut_OutputPort[port].setObjName(portName);
288 #endif
289  }
290 
291 #if FW_ENABLE_TEXT_LOGGING == 1
292  // Connect output port textEventOut
293  for (
294  PlatformIntType port = 0;
295  port < static_cast<PlatformIntType>(this->getNum_textEventOut_OutputPorts());
296  port++
297  ) {
298  this->m_textEventOut_OutputPort[port].init();
299 
300 #if FW_OBJECT_NAMES == 1
301  // The port name consists of this->m_objName and some extra info.
302  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
303  // However, the compiler may assume that this->m_objName fills
304  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
305  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
306  // bytes to cover the extra info.
307  char portName[2*FW_OBJ_NAME_MAX_SIZE];
308  (void) snprintf(
309  portName,
310  sizeof(portName),
311  "%s_textEventOut_OutputPort[%" PRI_PlatformIntType "]",
312  this->m_objName,
313  port
314  );
315  this->m_textEventOut_OutputPort[port].setObjName(portName);
316 #endif
317  }
318 #endif
319 
320  // Connect output port timeGetOut
321  for (
322  PlatformIntType port = 0;
323  port < static_cast<PlatformIntType>(this->getNum_timeGetOut_OutputPorts());
324  port++
325  ) {
326  this->m_timeGetOut_OutputPort[port].init();
327 
328 #if FW_OBJECT_NAMES == 1
329  // The port name consists of this->m_objName and some extra info.
330  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
331  // However, the compiler may assume that this->m_objName fills
332  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
333  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
334  // bytes to cover the extra info.
335  char portName[2*FW_OBJ_NAME_MAX_SIZE];
336  (void) snprintf(
337  portName,
338  sizeof(portName),
339  "%s_timeGetOut_OutputPort[%" PRI_PlatformIntType "]",
340  this->m_objName,
341  port
342  );
343  this->m_timeGetOut_OutputPort[port].setObjName(portName);
344 #endif
345  }
346 
347  // Connect output port tlmOut
348  for (
349  PlatformIntType port = 0;
350  port < static_cast<PlatformIntType>(this->getNum_tlmOut_OutputPorts());
351  port++
352  ) {
353  this->m_tlmOut_OutputPort[port].init();
354 
355 #if FW_OBJECT_NAMES == 1
356  // The port name consists of this->m_objName and some extra info.
357  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
358  // However, the compiler may assume that this->m_objName fills
359  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
360  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
361  // bytes to cover the extra info.
362  char portName[2*FW_OBJ_NAME_MAX_SIZE];
363  (void) snprintf(
364  portName,
365  sizeof(portName),
366  "%s_tlmOut_OutputPort[%" PRI_PlatformIntType "]",
367  this->m_objName,
368  port
369  );
370  this->m_tlmOut_OutputPort[port].setObjName(portName);
371 #endif
372  }
373 
374  // Connect output port PktSend
375  for (
376  PlatformIntType port = 0;
377  port < static_cast<PlatformIntType>(this->getNum_PktSend_OutputPorts());
378  port++
379  ) {
380  this->m_PktSend_OutputPort[port].init();
381 
382 #if FW_OBJECT_NAMES == 1
383  // The port name consists of this->m_objName and some extra info.
384  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
385  // However, the compiler may assume that this->m_objName fills
386  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
387  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
388  // bytes to cover the extra info.
389  char portName[2*FW_OBJ_NAME_MAX_SIZE];
390  (void) snprintf(
391  portName,
392  sizeof(portName),
393  "%s_PktSend_OutputPort[%" PRI_PlatformIntType "]",
394  this->m_objName,
395  port
396  );
397  this->m_PktSend_OutputPort[port].setObjName(portName);
398 #endif
399  }
400 
401  // Connect output port pingOut
402  for (
403  PlatformIntType port = 0;
404  port < static_cast<PlatformIntType>(this->getNum_pingOut_OutputPorts());
405  port++
406  ) {
407  this->m_pingOut_OutputPort[port].init();
408 
409 #if FW_OBJECT_NAMES == 1
410  // The port name consists of this->m_objName and some extra info.
411  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
412  // However, the compiler may assume that this->m_objName fills
413  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
414  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
415  // bytes to cover the extra info.
416  char portName[2*FW_OBJ_NAME_MAX_SIZE];
417  (void) snprintf(
418  portName,
419  sizeof(portName),
420  "%s_pingOut_OutputPort[%" PRI_PlatformIntType "]",
421  this->m_objName,
422  port
423  );
424  this->m_pingOut_OutputPort[port].setObjName(portName);
425 #endif
426  }
427 
428  Os::Queue::QueueStatus qStat = this->createQueue(
429  queueDepth,
430  ComponentIpcSerializableBuffer::SERIALIZATION_SIZE
431  );
432  FW_ASSERT(
433  Os::Queue::QUEUE_OK == qStat,
434  static_cast<FwAssertArgType>(qStat)
435  );
436  }
437 
438  // ----------------------------------------------------------------------
439  // Getters for special input ports
440  // ----------------------------------------------------------------------
441 
444  {
445  FW_ASSERT(
446  portNum < this->getNum_cmdIn_InputPorts(),
447  static_cast<FwAssertArgType>(portNum)
448  );
449 
450  return &this->m_cmdIn_InputPort[portNum];
451  }
452 
453  // ----------------------------------------------------------------------
454  // Getters for typed input ports
455  // ----------------------------------------------------------------------
456 
459  {
460  FW_ASSERT(
461  portNum < this->getNum_Run_InputPorts(),
462  static_cast<FwAssertArgType>(portNum)
463  );
464 
465  return &this->m_Run_InputPort[portNum];
466  }
467 
470  {
471  FW_ASSERT(
472  portNum < this->getNum_TlmRecv_InputPorts(),
473  static_cast<FwAssertArgType>(portNum)
474  );
475 
476  return &this->m_TlmRecv_InputPort[portNum];
477  }
478 
481  {
482  FW_ASSERT(
483  portNum < this->getNum_pingIn_InputPorts(),
484  static_cast<FwAssertArgType>(portNum)
485  );
486 
487  return &this->m_pingIn_InputPort[portNum];
488  }
489 
490  // ----------------------------------------------------------------------
491  // Connect input ports to special output ports
492  // ----------------------------------------------------------------------
493 
496  NATIVE_INT_TYPE portNum,
497  Fw::InputCmdRegPort* port
498  )
499  {
500  FW_ASSERT(
501  portNum < this->getNum_cmdRegOut_OutputPorts(),
502  static_cast<FwAssertArgType>(portNum)
503  );
504 
505  this->m_cmdRegOut_OutputPort[portNum].addCallPort(port);
506  }
507 
510  NATIVE_INT_TYPE portNum,
512  )
513  {
514  FW_ASSERT(
515  portNum < this->getNum_cmdResponseOut_OutputPorts(),
516  static_cast<FwAssertArgType>(portNum)
517  );
518 
519  this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port);
520  }
521 
524  NATIVE_INT_TYPE portNum,
525  Fw::InputLogPort* port
526  )
527  {
528  FW_ASSERT(
529  portNum < this->getNum_eventOut_OutputPorts(),
530  static_cast<FwAssertArgType>(portNum)
531  );
532 
533  this->m_eventOut_OutputPort[portNum].addCallPort(port);
534  }
535 
536 #if FW_ENABLE_TEXT_LOGGING == 1
537 
538  void TlmPacketizerComponentBase ::
539  set_textEventOut_OutputPort(
540  NATIVE_INT_TYPE portNum,
542  )
543  {
544  FW_ASSERT(
545  portNum < this->getNum_textEventOut_OutputPorts(),
546  static_cast<FwAssertArgType>(portNum)
547  );
548 
549  this->m_textEventOut_OutputPort[portNum].addCallPort(port);
550  }
551 
552 #endif
553 
556  NATIVE_INT_TYPE portNum,
557  Fw::InputTimePort* port
558  )
559  {
560  FW_ASSERT(
561  portNum < this->getNum_timeGetOut_OutputPorts(),
562  static_cast<FwAssertArgType>(portNum)
563  );
564 
565  this->m_timeGetOut_OutputPort[portNum].addCallPort(port);
566  }
567 
570  NATIVE_INT_TYPE portNum,
571  Fw::InputTlmPort* port
572  )
573  {
574  FW_ASSERT(
575  portNum < this->getNum_tlmOut_OutputPorts(),
576  static_cast<FwAssertArgType>(portNum)
577  );
578 
579  this->m_tlmOut_OutputPort[portNum].addCallPort(port);
580  }
581 
582  // ----------------------------------------------------------------------
583  // Connect typed input ports to typed output ports
584  // ----------------------------------------------------------------------
585 
588  NATIVE_INT_TYPE portNum,
589  Fw::InputComPort* port
590  )
591  {
592  FW_ASSERT(
593  portNum < this->getNum_PktSend_OutputPorts(),
594  static_cast<FwAssertArgType>(portNum)
595  );
596 
597  this->m_PktSend_OutputPort[portNum].addCallPort(port);
598  }
599 
602  NATIVE_INT_TYPE portNum,
603  Svc::InputPingPort* port
604  )
605  {
606  FW_ASSERT(
607  portNum < this->getNum_pingOut_OutputPorts(),
608  static_cast<FwAssertArgType>(portNum)
609  );
610 
611  this->m_pingOut_OutputPort[portNum].addCallPort(port);
612  }
613 
614 #if FW_PORT_SERIALIZATION
615 
616  // ----------------------------------------------------------------------
617  // Connect serial input ports to special output ports
618  // ----------------------------------------------------------------------
619 
622  NATIVE_INT_TYPE portNum,
623  Fw::InputSerializePort* port
624  )
625  {
626  FW_ASSERT(
627  portNum < this->getNum_cmdRegOut_OutputPorts(),
628  static_cast<FwAssertArgType>(portNum)
629  );
630 
631  this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port);
632  }
633 
636  NATIVE_INT_TYPE portNum,
637  Fw::InputSerializePort* port
638  )
639  {
640  FW_ASSERT(
641  portNum < this->getNum_cmdResponseOut_OutputPorts(),
642  static_cast<FwAssertArgType>(portNum)
643  );
644 
645  this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port);
646  }
647 
650  NATIVE_INT_TYPE portNum,
651  Fw::InputSerializePort* port
652  )
653  {
654  FW_ASSERT(
655  portNum < this->getNum_eventOut_OutputPorts(),
656  static_cast<FwAssertArgType>(portNum)
657  );
658 
659  this->m_eventOut_OutputPort[portNum].registerSerialPort(port);
660  }
661 
662 #if FW_ENABLE_TEXT_LOGGING == 1
663 
664  void TlmPacketizerComponentBase ::
665  set_textEventOut_OutputPort(
666  NATIVE_INT_TYPE portNum,
667  Fw::InputSerializePort* port
668  )
669  {
670  FW_ASSERT(
671  portNum < this->getNum_textEventOut_OutputPorts(),
672  static_cast<FwAssertArgType>(portNum)
673  );
674 
675  this->m_textEventOut_OutputPort[portNum].registerSerialPort(port);
676  }
677 
678 #endif
679 
682  NATIVE_INT_TYPE portNum,
683  Fw::InputSerializePort* port
684  )
685  {
686  FW_ASSERT(
687  portNum < this->getNum_timeGetOut_OutputPorts(),
688  static_cast<FwAssertArgType>(portNum)
689  );
690 
691  this->m_timeGetOut_OutputPort[portNum].registerSerialPort(port);
692  }
693 
696  NATIVE_INT_TYPE portNum,
697  Fw::InputSerializePort* port
698  )
699  {
700  FW_ASSERT(
701  portNum < this->getNum_tlmOut_OutputPorts(),
702  static_cast<FwAssertArgType>(portNum)
703  );
704 
705  this->m_tlmOut_OutputPort[portNum].registerSerialPort(port);
706  }
707 
708 #endif
709 
710 #if FW_PORT_SERIALIZATION
711 
712  // ----------------------------------------------------------------------
713  // Connect serial input ports to typed output ports
714  // ----------------------------------------------------------------------
715 
718  NATIVE_INT_TYPE portNum,
719  Fw::InputSerializePort* port
720  )
721  {
722  FW_ASSERT(
723  portNum < this->getNum_PktSend_OutputPorts(),
724  static_cast<FwAssertArgType>(portNum)
725  );
726 
727  this->m_PktSend_OutputPort[portNum].registerSerialPort(port);
728  }
729 
732  NATIVE_INT_TYPE portNum,
733  Fw::InputSerializePort* port
734  )
735  {
736  FW_ASSERT(
737  portNum < this->getNum_pingOut_OutputPorts(),
738  static_cast<FwAssertArgType>(portNum)
739  );
740 
741  this->m_pingOut_OutputPort[portNum].registerSerialPort(port);
742  }
743 
744 #endif
745 
746  // ----------------------------------------------------------------------
747  // Command registration
748  // ----------------------------------------------------------------------
749 
751  regCommands()
752  {
753  FW_ASSERT(this->m_cmdRegOut_OutputPort[0].isConnected());
754 
755  this->m_cmdRegOut_OutputPort[0].invoke(
756  this->getIdBase() + OPCODE_SET_LEVEL
757  );
758 
759  this->m_cmdRegOut_OutputPort[0].invoke(
760  this->getIdBase() + OPCODE_SEND_PKT
761  );
762  }
763 
764  // ----------------------------------------------------------------------
765  // Component construction and destruction
766  // ----------------------------------------------------------------------
767 
769  TlmPacketizerComponentBase(const char* compName) :
770  Fw::ActiveComponentBase(compName)
771  {
772 
773  }
774 
777  {
778 
779  }
780 
781  // ----------------------------------------------------------------------
782  // Getters for numbers of special input ports
783  // ----------------------------------------------------------------------
784 
787  {
788  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_cmdIn_InputPort));
789  }
790 
791  // ----------------------------------------------------------------------
792  // Getters for numbers of typed input ports
793  // ----------------------------------------------------------------------
794 
797  {
798  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_Run_InputPort));
799  }
800 
803  {
804  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_TlmRecv_InputPort));
805  }
806 
809  {
810  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_pingIn_InputPort));
811  }
812 
813  // ----------------------------------------------------------------------
814  // Getters for numbers of special output ports
815  // ----------------------------------------------------------------------
816 
819  {
820  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_cmdRegOut_OutputPort));
821  }
822 
825  {
826  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_cmdResponseOut_OutputPort));
827  }
828 
831  {
832  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_eventOut_OutputPort));
833  }
834 
835 #if FW_ENABLE_TEXT_LOGGING == 1
836 
837  NATIVE_INT_TYPE TlmPacketizerComponentBase ::
838  getNum_textEventOut_OutputPorts() const
839  {
840  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_textEventOut_OutputPort));
841  }
842 
843 #endif
844 
847  {
848  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_timeGetOut_OutputPort));
849  }
850 
853  {
854  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_tlmOut_OutputPort));
855  }
856 
857  // ----------------------------------------------------------------------
858  // Getters for numbers of typed output ports
859  // ----------------------------------------------------------------------
860 
863  {
864  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_PktSend_OutputPort));
865  }
866 
869  {
870  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_pingOut_OutputPort));
871  }
872 
873  // ----------------------------------------------------------------------
874  // Connection status queries for special output ports
875  // ----------------------------------------------------------------------
876 
879  {
880  FW_ASSERT(
881  portNum < this->getNum_cmdRegOut_OutputPorts(),
882  static_cast<FwAssertArgType>(portNum)
883  );
884 
885  return this->m_cmdRegOut_OutputPort[portNum].isConnected();
886  }
887 
890  {
891  FW_ASSERT(
892  portNum < this->getNum_cmdResponseOut_OutputPorts(),
893  static_cast<FwAssertArgType>(portNum)
894  );
895 
896  return this->m_cmdResponseOut_OutputPort[portNum].isConnected();
897  }
898 
901  {
902  FW_ASSERT(
903  portNum < this->getNum_eventOut_OutputPorts(),
904  static_cast<FwAssertArgType>(portNum)
905  );
906 
907  return this->m_eventOut_OutputPort[portNum].isConnected();
908  }
909 
910 #if FW_ENABLE_TEXT_LOGGING == 1
911 
912  bool TlmPacketizerComponentBase ::
913  isConnected_textEventOut_OutputPort(NATIVE_INT_TYPE portNum)
914  {
915  FW_ASSERT(
916  portNum < this->getNum_textEventOut_OutputPorts(),
917  static_cast<FwAssertArgType>(portNum)
918  );
919 
920  return this->m_textEventOut_OutputPort[portNum].isConnected();
921  }
922 
923 #endif
924 
927  {
928  FW_ASSERT(
929  portNum < this->getNum_timeGetOut_OutputPorts(),
930  static_cast<FwAssertArgType>(portNum)
931  );
932 
933  return this->m_timeGetOut_OutputPort[portNum].isConnected();
934  }
935 
938  {
939  FW_ASSERT(
940  portNum < this->getNum_tlmOut_OutputPorts(),
941  static_cast<FwAssertArgType>(portNum)
942  );
943 
944  return this->m_tlmOut_OutputPort[portNum].isConnected();
945  }
946 
947  // ----------------------------------------------------------------------
948  // Connection status queries for typed output ports
949  // ----------------------------------------------------------------------
950 
953  {
954  FW_ASSERT(
955  portNum < this->getNum_PktSend_OutputPorts(),
956  static_cast<FwAssertArgType>(portNum)
957  );
958 
959  return this->m_PktSend_OutputPort[portNum].isConnected();
960  }
961 
964  {
965  FW_ASSERT(
966  portNum < this->getNum_pingOut_OutputPorts(),
967  static_cast<FwAssertArgType>(portNum)
968  );
969 
970  return this->m_pingOut_OutputPort[portNum].isConnected();
971  }
972 
973  // ----------------------------------------------------------------------
974  // Port handler base-class functions for typed input ports
975  //
976  // Call these functions directly to bypass the corresponding ports
977  // ----------------------------------------------------------------------
978 
981  NATIVE_INT_TYPE portNum,
982  NATIVE_UINT_TYPE context
983  )
984  {
985  // Make sure port number is valid
986  FW_ASSERT(
987  portNum < this->getNum_Run_InputPorts(),
988  static_cast<FwAssertArgType>(portNum)
989  );
990 
991  // Call pre-message hook
993  portNum,
994  context
995  );
996  ComponentIpcSerializableBuffer msg;
998 
999  // Serialize message ID
1000  _status = msg.serialize(
1001  static_cast<NATIVE_INT_TYPE>(RUN_SCHED)
1002  );
1003  FW_ASSERT(
1004  _status == Fw::FW_SERIALIZE_OK,
1005  static_cast<FwAssertArgType>(_status)
1006  );
1007 
1008  // Serialize port number
1009  _status = msg.serialize(portNum);
1010  FW_ASSERT(
1011  _status == Fw::FW_SERIALIZE_OK,
1012  static_cast<FwAssertArgType>(_status)
1013  );
1014 
1015  // Serialize argument context
1016  _status = msg.serialize(context);
1017  FW_ASSERT(
1018  _status == Fw::FW_SERIALIZE_OK,
1019  static_cast<FwAssertArgType>(_status)
1020  );
1021 
1022  // Send message
1024  Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
1025 
1026  FW_ASSERT(
1027  qStatus == Os::Queue::QUEUE_OK,
1028  static_cast<FwAssertArgType>(qStatus)
1029  );
1030  }
1031 
1034  NATIVE_INT_TYPE portNum,
1035  FwChanIdType id,
1036  Fw::Time& timeTag,
1037  Fw::TlmBuffer& val
1038  )
1039  {
1040  // Make sure port number is valid
1041  FW_ASSERT(
1042  portNum < this->getNum_TlmRecv_InputPorts(),
1043  static_cast<FwAssertArgType>(portNum)
1044  );
1045 
1046  // Call handler function
1047  this->TlmRecv_handler(
1048  portNum,
1049  id,
1050  timeTag,
1051  val
1052  );
1053  }
1054 
1057  NATIVE_INT_TYPE portNum,
1058  U32 key
1059  )
1060  {
1061  // Make sure port number is valid
1062  FW_ASSERT(
1063  portNum < this->getNum_pingIn_InputPorts(),
1064  static_cast<FwAssertArgType>(portNum)
1065  );
1066 
1067  // Call pre-message hook
1069  portNum,
1070  key
1071  );
1072  ComponentIpcSerializableBuffer msg;
1074 
1075  // Serialize message ID
1076  _status = msg.serialize(
1077  static_cast<NATIVE_INT_TYPE>(PINGIN_PING)
1078  );
1079  FW_ASSERT(
1080  _status == Fw::FW_SERIALIZE_OK,
1081  static_cast<FwAssertArgType>(_status)
1082  );
1083 
1084  // Serialize port number
1085  _status = msg.serialize(portNum);
1086  FW_ASSERT(
1087  _status == Fw::FW_SERIALIZE_OK,
1088  static_cast<FwAssertArgType>(_status)
1089  );
1090 
1091  // Serialize argument key
1092  _status = msg.serialize(key);
1093  FW_ASSERT(
1094  _status == Fw::FW_SERIALIZE_OK,
1095  static_cast<FwAssertArgType>(_status)
1096  );
1097 
1098  // Send message
1100  Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
1101 
1102  FW_ASSERT(
1103  qStatus == Os::Queue::QUEUE_OK,
1104  static_cast<FwAssertArgType>(qStatus)
1105  );
1106  }
1107 
1108  // ----------------------------------------------------------------------
1109  // Pre-message hooks for typed async input ports
1110  //
1111  // Each of these functions is invoked just before processing a message
1112  // on the corresponding port. By default, they do nothing. You can
1113  // override them to provide specific pre-message behavior.
1114  // ----------------------------------------------------------------------
1115 
1118  NATIVE_INT_TYPE portNum,
1119  NATIVE_UINT_TYPE context
1120  )
1121  {
1122  // Default: no-op
1123  }
1124 
1127  NATIVE_INT_TYPE portNum,
1128  U32 key
1129  )
1130  {
1131  // Default: no-op
1132  }
1133 
1134  // ----------------------------------------------------------------------
1135  // Invocation functions for typed output ports
1136  // ----------------------------------------------------------------------
1137 
1139  PktSend_out(
1140  NATIVE_INT_TYPE portNum,
1141  Fw::ComBuffer& data,
1142  U32 context
1143  )
1144  {
1145  FW_ASSERT(
1146  portNum < this->getNum_PktSend_OutputPorts(),
1147  static_cast<FwAssertArgType>(portNum)
1148  );
1149  this->m_PktSend_OutputPort[portNum].invoke(
1150  data,
1151  context
1152  );
1153  }
1154 
1156  pingOut_out(
1157  NATIVE_INT_TYPE portNum,
1158  U32 key
1159  )
1160  {
1161  FW_ASSERT(
1162  portNum < this->getNum_pingOut_OutputPorts(),
1163  static_cast<FwAssertArgType>(portNum)
1164  );
1165  this->m_pingOut_OutputPort[portNum].invoke(
1166  key
1167  );
1168  }
1169 
1170  // ----------------------------------------------------------------------
1171  // Command response
1172  // ----------------------------------------------------------------------
1173 
1176  FwOpcodeType opCode,
1177  U32 cmdSeq,
1178  Fw::CmdResponse response
1179  )
1180  {
1181  FW_ASSERT(this->m_cmdResponseOut_OutputPort[0].isConnected());
1182  this->m_cmdResponseOut_OutputPort[0].invoke(opCode, cmdSeq, response);
1183  }
1184 
1185  // ----------------------------------------------------------------------
1186  // Command handler base-class functions
1187  //
1188  // Call these functions directly to bypass the command input port
1189  // ----------------------------------------------------------------------
1190 
1193  FwOpcodeType opCode,
1194  U32 cmdSeq,
1195  Fw::CmdArgBuffer& args
1196  )
1197  {
1198  // Call pre-message hook
1199  this->SET_LEVEL_preMsgHook(opCode,cmdSeq);
1200 
1201  // Defer deserializing arguments to the message dispatcher
1202  // to avoid deserializing and reserializing just for IPC
1203  ComponentIpcSerializableBuffer msg;
1205 
1206  // Serialize for IPC
1207  _status = msg.serialize(static_cast<NATIVE_INT_TYPE>(CMD_SET_LEVEL));
1208  FW_ASSERT (
1209  _status == Fw::FW_SERIALIZE_OK,
1210  static_cast<FwAssertArgType>(_status)
1211  );
1212 
1213  // Fake port number to make message dequeue work
1214  NATIVE_INT_TYPE port = 0;
1215 
1216  _status = msg.serialize(port);
1217  FW_ASSERT (
1218  _status == Fw::FW_SERIALIZE_OK,
1219  static_cast<FwAssertArgType>(_status)
1220  );
1221 
1222  _status = msg.serialize(opCode);
1223  FW_ASSERT (
1224  _status == Fw::FW_SERIALIZE_OK,
1225  static_cast<FwAssertArgType>(_status)
1226  );
1227 
1228  _status = msg.serialize(cmdSeq);
1229  FW_ASSERT (
1230  _status == Fw::FW_SERIALIZE_OK,
1231  static_cast<FwAssertArgType>(_status)
1232  );
1233 
1234  _status = msg.serialize(args);
1235  FW_ASSERT (
1236  _status == Fw::FW_SERIALIZE_OK,
1237  static_cast<FwAssertArgType>(_status)
1238  );
1239 
1240  // Send message
1242  Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
1243 
1244  FW_ASSERT(
1245  qStatus == Os::Queue::QUEUE_OK,
1246  static_cast<FwAssertArgType>(qStatus)
1247  );
1248  }
1249 
1252  FwOpcodeType opCode,
1253  U32 cmdSeq,
1254  Fw::CmdArgBuffer& args
1255  )
1256  {
1257  // Call pre-message hook
1258  this->SEND_PKT_preMsgHook(opCode,cmdSeq);
1259 
1260  // Defer deserializing arguments to the message dispatcher
1261  // to avoid deserializing and reserializing just for IPC
1262  ComponentIpcSerializableBuffer msg;
1264 
1265  // Serialize for IPC
1266  _status = msg.serialize(static_cast<NATIVE_INT_TYPE>(CMD_SEND_PKT));
1267  FW_ASSERT (
1268  _status == Fw::FW_SERIALIZE_OK,
1269  static_cast<FwAssertArgType>(_status)
1270  );
1271 
1272  // Fake port number to make message dequeue work
1273  NATIVE_INT_TYPE port = 0;
1274 
1275  _status = msg.serialize(port);
1276  FW_ASSERT (
1277  _status == Fw::FW_SERIALIZE_OK,
1278  static_cast<FwAssertArgType>(_status)
1279  );
1280 
1281  _status = msg.serialize(opCode);
1282  FW_ASSERT (
1283  _status == Fw::FW_SERIALIZE_OK,
1284  static_cast<FwAssertArgType>(_status)
1285  );
1286 
1287  _status = msg.serialize(cmdSeq);
1288  FW_ASSERT (
1289  _status == Fw::FW_SERIALIZE_OK,
1290  static_cast<FwAssertArgType>(_status)
1291  );
1292 
1293  _status = msg.serialize(args);
1294  FW_ASSERT (
1295  _status == Fw::FW_SERIALIZE_OK,
1296  static_cast<FwAssertArgType>(_status)
1297  );
1298 
1299  // Send message
1301  Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
1302 
1303  FW_ASSERT(
1304  qStatus == Os::Queue::QUEUE_OK,
1305  static_cast<FwAssertArgType>(qStatus)
1306  );
1307  }
1308 
1309  // ----------------------------------------------------------------------
1310  // Pre-message hooks for async commands
1311  //
1312  // Each of these functions is invoked just before processing the
1313  // corresponding command. By default they do nothing. You can
1314  // override them to provide specific pre-command behavior.
1315  // ----------------------------------------------------------------------
1316 
1319  FwOpcodeType opCode,
1320  U32 cmdSeq
1321  )
1322  {
1323  // Defaults to no-op; can be overridden
1324  (void) opCode;
1325  (void) cmdSeq;
1326  }
1327 
1330  FwOpcodeType opCode,
1331  U32 cmdSeq
1332  )
1333  {
1334  // Defaults to no-op; can be overridden
1335  (void) opCode;
1336  (void) cmdSeq;
1337  }
1338 
1339  // ----------------------------------------------------------------------
1340  // Event logging functions
1341  // ----------------------------------------------------------------------
1342 
1344  log_WARNING_LO_NoChan(U32 Id)
1345  {
1346  // Get the time
1347  Fw::Time _logTime;
1348  if (this->m_timeGetOut_OutputPort[0].isConnected()) {
1349  this->m_timeGetOut_OutputPort[0].invoke(_logTime);
1350  }
1351 
1352  FwEventIdType _id = static_cast<FwEventIdType>(0);
1353 
1354  _id = this->getIdBase() + EVENTID_NOCHAN;
1355 
1356  // Emit the event on the log port
1357  if (this->m_eventOut_OutputPort[0].isConnected()) {
1358  Fw::LogBuffer _logBuff;
1360 
1361 #if FW_AMPCS_COMPATIBLE
1362  // Serialize the number of arguments
1363  _status = _logBuff.serialize(static_cast<U8>(1));
1364  FW_ASSERT(
1365  _status == Fw::FW_SERIALIZE_OK,
1366  static_cast<FwAssertArgType>(_status)
1367  );
1368 #endif
1369 
1370 #if FW_AMPCS_COMPATIBLE
1371  // Serialize the argument size
1372  _status = _logBuff.serialize(
1373  static_cast<U8>(sizeof(U32))
1374  );
1375  FW_ASSERT(
1376  _status == Fw::FW_SERIALIZE_OK,
1377  static_cast<FwAssertArgType>(_status)
1378  );
1379 #endif
1380  _status = _logBuff.serialize(Id);
1381  FW_ASSERT(
1382  _status == Fw::FW_SERIALIZE_OK,
1383  static_cast<FwAssertArgType>(_status)
1384  );
1385 
1386  this->m_eventOut_OutputPort[0].invoke(
1387  _id,
1388  _logTime,
1390  _logBuff
1391  );
1392  }
1393 
1394  // Emit the event on the text log port
1395 #if FW_ENABLE_TEXT_LOGGING
1396  if (this->m_textEventOut_OutputPort[0].isConnected()) {
1397 #if FW_OBJECT_NAMES == 1
1398  const char* _formatString =
1399  "(%s) %s: Telemetry ID 0x%" PRIx32 " not packetized";
1400 #else
1401  const char* _formatString =
1402  "%s: Telemetry ID 0x%" PRIx32 " not packetized";
1403 #endif
1404 
1405  char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
1406 
1407  (void) snprintf(
1408  _textBuffer,
1410  _formatString,
1411 #if FW_OBJECT_NAMES == 1
1412  this->m_objName,
1413 #endif
1414  "NoChan ",
1415  Id
1416  );
1417 
1418  // Null terminate
1419  _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
1420  Fw::TextLogString _logString = _textBuffer;
1421  this->m_textEventOut_OutputPort[0].invoke(
1422  _id,
1423  _logTime,
1425  _logString
1426  );
1427  }
1428 #endif
1429  }
1430 
1433  {
1434  // Get the time
1435  Fw::Time _logTime;
1436  if (this->m_timeGetOut_OutputPort[0].isConnected()) {
1437  this->m_timeGetOut_OutputPort[0].invoke(_logTime);
1438  }
1439 
1440  FwEventIdType _id = static_cast<FwEventIdType>(0);
1441 
1442  _id = this->getIdBase() + EVENTID_LEVELSET;
1443 
1444  // Emit the event on the log port
1445  if (this->m_eventOut_OutputPort[0].isConnected()) {
1446  Fw::LogBuffer _logBuff;
1448 
1449 #if FW_AMPCS_COMPATIBLE
1450  // Serialize the number of arguments
1451  _status = _logBuff.serialize(static_cast<U8>(1));
1452  FW_ASSERT(
1453  _status == Fw::FW_SERIALIZE_OK,
1454  static_cast<FwAssertArgType>(_status)
1455  );
1456 #endif
1457 
1458 #if FW_AMPCS_COMPATIBLE
1459  // Serialize the argument size
1460  _status = _logBuff.serialize(
1461  static_cast<U8>(sizeof(U32))
1462  );
1463  FW_ASSERT(
1464  _status == Fw::FW_SERIALIZE_OK,
1465  static_cast<FwAssertArgType>(_status)
1466  );
1467 #endif
1468  _status = _logBuff.serialize(id);
1469  FW_ASSERT(
1470  _status == Fw::FW_SERIALIZE_OK,
1471  static_cast<FwAssertArgType>(_status)
1472  );
1473 
1474  this->m_eventOut_OutputPort[0].invoke(
1475  _id,
1476  _logTime,
1478  _logBuff
1479  );
1480  }
1481 
1482  // Emit the event on the text log port
1483 #if FW_ENABLE_TEXT_LOGGING
1484  if (this->m_textEventOut_OutputPort[0].isConnected()) {
1485 #if FW_OBJECT_NAMES == 1
1486  const char* _formatString =
1487  "(%s) %s: Telemetry send level to %" PRIu32 "";
1488 #else
1489  const char* _formatString =
1490  "%s: Telemetry send level to %" PRIu32 "";
1491 #endif
1492 
1493  char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
1494 
1495  (void) snprintf(
1496  _textBuffer,
1498  _formatString,
1499 #if FW_OBJECT_NAMES == 1
1500  this->m_objName,
1501 #endif
1502  "LevelSet ",
1503  id
1504  );
1505 
1506  // Null terminate
1507  _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
1508  Fw::TextLogString _logString = _textBuffer;
1509  this->m_textEventOut_OutputPort[0].invoke(
1510  _id,
1511  _logTime,
1513  _logString
1514  );
1515  }
1516 #endif
1517  }
1518 
1521  U32 level,
1522  U32 max
1523  )
1524  {
1525  // Get the time
1526  Fw::Time _logTime;
1527  if (this->m_timeGetOut_OutputPort[0].isConnected()) {
1528  this->m_timeGetOut_OutputPort[0].invoke(_logTime);
1529  }
1530 
1531  FwEventIdType _id = static_cast<FwEventIdType>(0);
1532 
1533  _id = this->getIdBase() + EVENTID_MAXLEVELEXCEED;
1534 
1535  // Emit the event on the log port
1536  if (this->m_eventOut_OutputPort[0].isConnected()) {
1537  Fw::LogBuffer _logBuff;
1539 
1540 #if FW_AMPCS_COMPATIBLE
1541  // Serialize the number of arguments
1542  _status = _logBuff.serialize(static_cast<U8>(2));
1543  FW_ASSERT(
1544  _status == Fw::FW_SERIALIZE_OK,
1545  static_cast<FwAssertArgType>(_status)
1546  );
1547 #endif
1548 
1549 #if FW_AMPCS_COMPATIBLE
1550  // Serialize the argument size
1551  _status = _logBuff.serialize(
1552  static_cast<U8>(sizeof(U32))
1553  );
1554  FW_ASSERT(
1555  _status == Fw::FW_SERIALIZE_OK,
1556  static_cast<FwAssertArgType>(_status)
1557  );
1558 #endif
1559  _status = _logBuff.serialize(level);
1560  FW_ASSERT(
1561  _status == Fw::FW_SERIALIZE_OK,
1562  static_cast<FwAssertArgType>(_status)
1563  );
1564 
1565 #if FW_AMPCS_COMPATIBLE
1566  // Serialize the argument size
1567  _status = _logBuff.serialize(
1568  static_cast<U8>(sizeof(U32))
1569  );
1570  FW_ASSERT(
1571  _status == Fw::FW_SERIALIZE_OK,
1572  static_cast<FwAssertArgType>(_status)
1573  );
1574 #endif
1575  _status = _logBuff.serialize(max);
1576  FW_ASSERT(
1577  _status == Fw::FW_SERIALIZE_OK,
1578  static_cast<FwAssertArgType>(_status)
1579  );
1580 
1581  this->m_eventOut_OutputPort[0].invoke(
1582  _id,
1583  _logTime,
1585  _logBuff
1586  );
1587  }
1588 
1589  // Emit the event on the text log port
1590 #if FW_ENABLE_TEXT_LOGGING
1591  if (this->m_textEventOut_OutputPort[0].isConnected()) {
1592 #if FW_OBJECT_NAMES == 1
1593  const char* _formatString =
1594  "(%s) %s: Requested send level %" PRIu32 " higher than max packet level of %" PRIu32 "";
1595 #else
1596  const char* _formatString =
1597  "%s: Requested send level %" PRIu32 " higher than max packet level of %" PRIu32 "";
1598 #endif
1599 
1600  char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
1601 
1602  (void) snprintf(
1603  _textBuffer,
1605  _formatString,
1606 #if FW_OBJECT_NAMES == 1
1607  this->m_objName,
1608 #endif
1609  "MaxLevelExceed ",
1610  level,
1611  max
1612  );
1613 
1614  // Null terminate
1615  _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
1616  Fw::TextLogString _logString = _textBuffer;
1617  this->m_textEventOut_OutputPort[0].invoke(
1618  _id,
1619  _logTime,
1621  _logString
1622  );
1623  }
1624 #endif
1625  }
1626 
1629  {
1630  // Get the time
1631  Fw::Time _logTime;
1632  if (this->m_timeGetOut_OutputPort[0].isConnected()) {
1633  this->m_timeGetOut_OutputPort[0].invoke(_logTime);
1634  }
1635 
1636  FwEventIdType _id = static_cast<FwEventIdType>(0);
1637 
1638  _id = this->getIdBase() + EVENTID_PACKETSENT;
1639 
1640  // Emit the event on the log port
1641  if (this->m_eventOut_OutputPort[0].isConnected()) {
1642  Fw::LogBuffer _logBuff;
1644 
1645 #if FW_AMPCS_COMPATIBLE
1646  // Serialize the number of arguments
1647  _status = _logBuff.serialize(static_cast<U8>(1));
1648  FW_ASSERT(
1649  _status == Fw::FW_SERIALIZE_OK,
1650  static_cast<FwAssertArgType>(_status)
1651  );
1652 #endif
1653 
1654 #if FW_AMPCS_COMPATIBLE
1655  // Serialize the argument size
1656  _status = _logBuff.serialize(
1657  static_cast<U8>(sizeof(U32))
1658  );
1659  FW_ASSERT(
1660  _status == Fw::FW_SERIALIZE_OK,
1661  static_cast<FwAssertArgType>(_status)
1662  );
1663 #endif
1664  _status = _logBuff.serialize(id);
1665  FW_ASSERT(
1666  _status == Fw::FW_SERIALIZE_OK,
1667  static_cast<FwAssertArgType>(_status)
1668  );
1669 
1670  this->m_eventOut_OutputPort[0].invoke(
1671  _id,
1672  _logTime,
1674  _logBuff
1675  );
1676  }
1677 
1678  // Emit the event on the text log port
1679 #if FW_ENABLE_TEXT_LOGGING
1680  if (this->m_textEventOut_OutputPort[0].isConnected()) {
1681 #if FW_OBJECT_NAMES == 1
1682  const char* _formatString =
1683  "(%s) %s: Sent packet ID %" PRIu32 "";
1684 #else
1685  const char* _formatString =
1686  "%s: Sent packet ID %" PRIu32 "";
1687 #endif
1688 
1689  char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
1690 
1691  (void) snprintf(
1692  _textBuffer,
1694  _formatString,
1695 #if FW_OBJECT_NAMES == 1
1696  this->m_objName,
1697 #endif
1698  "PacketSent ",
1699  id
1700  );
1701 
1702  // Null terminate
1703  _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
1704  Fw::TextLogString _logString = _textBuffer;
1705  this->m_textEventOut_OutputPort[0].invoke(
1706  _id,
1707  _logTime,
1709  _logString
1710  );
1711  }
1712 #endif
1713  }
1714 
1717  {
1718  // Get the time
1719  Fw::Time _logTime;
1720  if (this->m_timeGetOut_OutputPort[0].isConnected()) {
1721  this->m_timeGetOut_OutputPort[0].invoke(_logTime);
1722  }
1723 
1724  FwEventIdType _id = static_cast<FwEventIdType>(0);
1725 
1726  _id = this->getIdBase() + EVENTID_PACKETNOTFOUND;
1727 
1728  // Emit the event on the log port
1729  if (this->m_eventOut_OutputPort[0].isConnected()) {
1730  Fw::LogBuffer _logBuff;
1732 
1733 #if FW_AMPCS_COMPATIBLE
1734  // Serialize the number of arguments
1735  _status = _logBuff.serialize(static_cast<U8>(1));
1736  FW_ASSERT(
1737  _status == Fw::FW_SERIALIZE_OK,
1738  static_cast<FwAssertArgType>(_status)
1739  );
1740 #endif
1741 
1742 #if FW_AMPCS_COMPATIBLE
1743  // Serialize the argument size
1744  _status = _logBuff.serialize(
1745  static_cast<U8>(sizeof(U32))
1746  );
1747  FW_ASSERT(
1748  _status == Fw::FW_SERIALIZE_OK,
1749  static_cast<FwAssertArgType>(_status)
1750  );
1751 #endif
1752  _status = _logBuff.serialize(id);
1753  FW_ASSERT(
1754  _status == Fw::FW_SERIALIZE_OK,
1755  static_cast<FwAssertArgType>(_status)
1756  );
1757 
1758  this->m_eventOut_OutputPort[0].invoke(
1759  _id,
1760  _logTime,
1762  _logBuff
1763  );
1764  }
1765 
1766  // Emit the event on the text log port
1767 #if FW_ENABLE_TEXT_LOGGING
1768  if (this->m_textEventOut_OutputPort[0].isConnected()) {
1769 #if FW_OBJECT_NAMES == 1
1770  const char* _formatString =
1771  "(%s) %s: Could not find packet ID %" PRIu32 "";
1772 #else
1773  const char* _formatString =
1774  "%s: Could not find packet ID %" PRIu32 "";
1775 #endif
1776 
1777  char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
1778 
1779  (void) snprintf(
1780  _textBuffer,
1782  _formatString,
1783 #if FW_OBJECT_NAMES == 1
1784  this->m_objName,
1785 #endif
1786  "PacketNotFound ",
1787  id
1788  );
1789 
1790  // Null terminate
1791  _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
1792  Fw::TextLogString _logString = _textBuffer;
1793  this->m_textEventOut_OutputPort[0].invoke(
1794  _id,
1795  _logTime,
1797  _logString
1798  );
1799  }
1800 #endif
1801  }
1802 
1803  // ----------------------------------------------------------------------
1804  // Telemetry write functions
1805  // ----------------------------------------------------------------------
1806 
1809  U32 arg,
1810  Fw::Time _tlmTime
1811  )
1812  {
1813  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1814  if (
1815  this->m_timeGetOut_OutputPort[0].isConnected() &&
1816  (_tlmTime == Fw::ZERO_TIME)
1817  ) {
1818  this->m_timeGetOut_OutputPort[0].invoke(_tlmTime);
1819  }
1820 
1821  Fw::TlmBuffer _tlmBuff;
1822  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1823  FW_ASSERT(
1824  _stat == Fw::FW_SERIALIZE_OK,
1825  static_cast<FwAssertArgType>(_stat)
1826  );
1827 
1828  FwChanIdType _id;
1829 
1830  _id = this->getIdBase() + CHANNELID_SENDLEVEL;
1831 
1832  this->m_tlmOut_OutputPort[0].invoke(
1833  _id,
1834  _tlmTime,
1835  _tlmBuff
1836  );
1837  }
1838  }
1839 
1840  // ----------------------------------------------------------------------
1841  // Time
1842  // ----------------------------------------------------------------------
1843 
1845  getTime()
1846  {
1847  if (this->m_timeGetOut_OutputPort[0].isConnected()) {
1848  Fw::Time _time;
1849  this->m_timeGetOut_OutputPort[0].invoke(_time);
1850  return _time;
1851  }
1852  else {
1853  return Fw::Time(TB_NONE, 0, 0);
1854  }
1855  }
1856 
1857  // ----------------------------------------------------------------------
1858  // Message dispatch functions
1859  // ----------------------------------------------------------------------
1860 
1861  Fw::QueuedComponentBase::MsgDispatchStatus TlmPacketizerComponentBase ::
1862  doDispatch()
1863  {
1864  ComponentIpcSerializableBuffer msg;
1865  NATIVE_INT_TYPE priority = 0;
1866 
1867  Os::Queue::QueueStatus msgStatus = this->m_queue.receive(
1868  msg,
1869  priority,
1871  );
1872  FW_ASSERT(
1873  msgStatus == Os::Queue::QUEUE_OK,
1874  static_cast<FwAssertArgType>(msgStatus)
1875  );
1876 
1877  // Reset to beginning of buffer
1878  msg.resetDeser();
1879 
1880  NATIVE_INT_TYPE desMsg = 0;
1881  Fw::SerializeStatus deserStatus = msg.deserialize(desMsg);
1882  FW_ASSERT(
1883  deserStatus == Fw::FW_SERIALIZE_OK,
1884  static_cast<FwAssertArgType>(deserStatus)
1885  );
1886 
1887  MsgTypeEnum msgType = static_cast<MsgTypeEnum>(desMsg);
1888 
1889  if (msgType == TLMPACKETIZER_COMPONENT_EXIT) {
1890  return MSG_DISPATCH_EXIT;
1891  }
1892 
1893  NATIVE_INT_TYPE portNum = 0;
1894  deserStatus = msg.deserialize(portNum);
1895  FW_ASSERT(
1896  deserStatus == Fw::FW_SERIALIZE_OK,
1897  static_cast<FwAssertArgType>(deserStatus)
1898  );
1899 
1900  switch (msgType) {
1901  // Handle async input port Run
1902  case RUN_SCHED: {
1903  // Deserialize argument context
1904  NATIVE_UINT_TYPE context;
1905  deserStatus = msg.deserialize(context);
1906  FW_ASSERT(
1907  deserStatus == Fw::FW_SERIALIZE_OK,
1908  static_cast<FwAssertArgType>(deserStatus)
1909  );
1910  // Call handler function
1911  this->Run_handler(
1912  portNum,
1913  context
1914  );
1915 
1916  break;
1917  }
1918 
1919  // Handle async input port pingIn
1920  case PINGIN_PING: {
1921  // Deserialize argument key
1922  U32 key;
1923  deserStatus = msg.deserialize(key);
1924  FW_ASSERT(
1925  deserStatus == Fw::FW_SERIALIZE_OK,
1926  static_cast<FwAssertArgType>(deserStatus)
1927  );
1928  // Call handler function
1929  this->pingIn_handler(
1930  portNum,
1931  key
1932  );
1933 
1934  break;
1935  }
1936 
1937  // Handle command SET_LEVEL
1938  case CMD_SET_LEVEL: {
1939  // Deserialize opcode
1940  FwOpcodeType opCode = 0;
1941  deserStatus = msg.deserialize(opCode);
1942  FW_ASSERT (
1943  deserStatus == Fw::FW_SERIALIZE_OK,
1944  static_cast<FwAssertArgType>(deserStatus)
1945  );
1946 
1947  // Deserialize command sequence
1948  U32 cmdSeq = 0;
1949  deserStatus = msg.deserialize(cmdSeq);
1950  FW_ASSERT (
1951  deserStatus == Fw::FW_SERIALIZE_OK,
1952  static_cast<FwAssertArgType>(deserStatus)
1953  );
1954 
1955  // Deserialize command argument buffer
1956  Fw::CmdArgBuffer args;
1957  deserStatus = msg.deserialize(args);
1958  FW_ASSERT (
1959  deserStatus == Fw::FW_SERIALIZE_OK,
1960  static_cast<FwAssertArgType>(deserStatus)
1961  );
1962 
1963  // Reset buffer
1964  args.resetDeser();
1965 
1966  // Deserialize argument level
1967  U32 level;
1968  deserStatus = args.deserialize(level);
1969  if (deserStatus != Fw::FW_SERIALIZE_OK) {
1970  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
1971  this->cmdResponse_out(
1972  opCode,
1973  cmdSeq,
1975  );
1976  }
1977  // Don't crash the task if bad arguments were passed from the ground
1978  break;
1979  }
1980 
1981  // Make sure there was no data left over.
1982  // That means the argument buffer size was incorrect.
1983 #if FW_CMD_CHECK_RESIDUAL
1984  if (args.getBuffLeft() != 0) {
1985  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
1986  this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
1987  }
1988  // Don't crash the task if bad arguments were passed from the ground
1989  break;
1990  }
1991 #endif
1992 
1993  // Call handler function
1994  this->SET_LEVEL_cmdHandler(
1995  opCode, cmdSeq,
1996  level
1997  );
1998 
1999  break;
2000  }
2001 
2002  // Handle command SEND_PKT
2003  case CMD_SEND_PKT: {
2004  // Deserialize opcode
2005  FwOpcodeType opCode = 0;
2006  deserStatus = msg.deserialize(opCode);
2007  FW_ASSERT (
2008  deserStatus == Fw::FW_SERIALIZE_OK,
2009  static_cast<FwAssertArgType>(deserStatus)
2010  );
2011 
2012  // Deserialize command sequence
2013  U32 cmdSeq = 0;
2014  deserStatus = msg.deserialize(cmdSeq);
2015  FW_ASSERT (
2016  deserStatus == Fw::FW_SERIALIZE_OK,
2017  static_cast<FwAssertArgType>(deserStatus)
2018  );
2019 
2020  // Deserialize command argument buffer
2021  Fw::CmdArgBuffer args;
2022  deserStatus = msg.deserialize(args);
2023  FW_ASSERT (
2024  deserStatus == Fw::FW_SERIALIZE_OK,
2025  static_cast<FwAssertArgType>(deserStatus)
2026  );
2027 
2028  // Reset buffer
2029  args.resetDeser();
2030 
2031  // Deserialize argument id
2032  U32 id;
2033  deserStatus = args.deserialize(id);
2034  if (deserStatus != Fw::FW_SERIALIZE_OK) {
2035  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
2036  this->cmdResponse_out(
2037  opCode,
2038  cmdSeq,
2040  );
2041  }
2042  // Don't crash the task if bad arguments were passed from the ground
2043  break;
2044  }
2045 
2046  // Make sure there was no data left over.
2047  // That means the argument buffer size was incorrect.
2048 #if FW_CMD_CHECK_RESIDUAL
2049  if (args.getBuffLeft() != 0) {
2050  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
2051  this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2052  }
2053  // Don't crash the task if bad arguments were passed from the ground
2054  break;
2055  }
2056 #endif
2057 
2058  // Call handler function
2059  this->SEND_PKT_cmdHandler(
2060  opCode, cmdSeq,
2061  id
2062  );
2063 
2064  break;
2065  }
2066 
2067  default:
2068  return MSG_DISPATCH_ERROR;
2069  }
2070 
2071  return MSG_DISPATCH_OK;
2072  }
2073 
2074  // ----------------------------------------------------------------------
2075  // Calls for messages received on special input ports
2076  // ----------------------------------------------------------------------
2077 
2078  void TlmPacketizerComponentBase ::
2079  m_p_cmdIn_in(
2080  Fw::PassiveComponentBase* callComp,
2081  NATIVE_INT_TYPE portNum,
2082  FwOpcodeType opCode,
2083  U32 cmdSeq,
2084  Fw::CmdArgBuffer& args
2085  )
2086  {
2087  FW_ASSERT(callComp);
2088  TlmPacketizerComponentBase* compPtr = static_cast<TlmPacketizerComponentBase*>(callComp);
2089 
2090  const U32 idBase = callComp->getIdBase();
2091  FW_ASSERT(opCode >= idBase, opCode, idBase);
2092 
2093  // Select base class function based on opcode
2094  switch (opCode - idBase) {
2095  case OPCODE_SET_LEVEL: {
2096  compPtr->SET_LEVEL_cmdHandlerBase(
2097  opCode,
2098  cmdSeq,
2099  args
2100  );
2101  break;
2102  }
2103 
2104  case OPCODE_SEND_PKT: {
2105  compPtr->SEND_PKT_cmdHandlerBase(
2106  opCode,
2107  cmdSeq,
2108  args
2109  );
2110  break;
2111  }
2112  }
2113  }
2114 
2115  // ----------------------------------------------------------------------
2116  // Calls for messages received on typed input ports
2117  // ----------------------------------------------------------------------
2118 
2119  void TlmPacketizerComponentBase ::
2120  m_p_Run_in(
2121  Fw::PassiveComponentBase* callComp,
2122  NATIVE_INT_TYPE portNum,
2123  NATIVE_UINT_TYPE context
2124  )
2125  {
2126  FW_ASSERT(callComp);
2127  TlmPacketizerComponentBase* compPtr = static_cast<TlmPacketizerComponentBase*>(callComp);
2128  compPtr->Run_handlerBase(
2129  portNum,
2130  context
2131  );
2132  }
2133 
2134  void TlmPacketizerComponentBase ::
2135  m_p_TlmRecv_in(
2136  Fw::PassiveComponentBase* callComp,
2137  NATIVE_INT_TYPE portNum,
2138  FwChanIdType id,
2139  Fw::Time& timeTag,
2140  Fw::TlmBuffer& val
2141  )
2142  {
2143  FW_ASSERT(callComp);
2144  TlmPacketizerComponentBase* compPtr = static_cast<TlmPacketizerComponentBase*>(callComp);
2145  compPtr->TlmRecv_handlerBase(
2146  portNum,
2147  id,
2148  timeTag,
2149  val
2150  );
2151  }
2152 
2153  void TlmPacketizerComponentBase ::
2154  m_p_pingIn_in(
2155  Fw::PassiveComponentBase* callComp,
2156  NATIVE_INT_TYPE portNum,
2157  U32 key
2158  )
2159  {
2160  FW_ASSERT(callComp);
2161  TlmPacketizerComponentBase* compPtr = static_cast<TlmPacketizerComponentBase*>(callComp);
2162  compPtr->pingIn_handlerBase(
2163  portNum,
2164  key
2165  );
2166  }
2167 
2168 }
#define FW_ASSERT(...)
Definition: Assert.hpp:14
PlatformIntType NATIVE_INT_TYPE
Definition: BasicTypes.h:51
U8 BYTE
byte type
Definition: BasicTypes.h:27
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:26
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition: BasicTypes.h:66
PlatformUIntType NATIVE_UINT_TYPE
Definition: BasicTypes.h:52
int PlatformIntType
DefaultTypes.hpp provides fallback defaults for the platform types.
#define PRI_PlatformIntType
@ TB_NONE
No time base has been established.
Definition: FpConfig.h:39
PlatformAssertArgType FwAssertArgType
Definition: FpConfig.h:21
U32 FwChanIdType
Definition: FpConfig.h:59
U32 FwEventIdType
Definition: FpConfig.h:62
U32 FwOpcodeType
Definition: FpConfig.h:56
#define FW_LOG_TEXT_BUFFER_SIZE
Max size of string for text log message.
Definition: FpConfig.h:299
#define FW_OBJ_NAME_MAX_SIZE
Size of object name (if object names enabled). AC Limits to 80, truncation occurs above 80.
Definition: FpConfig.h:184
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects)
Definition: FpConfig.h:88
@ ACTIVE_COMPONENT_EXIT
message to exit active component task
Enum representing a command response.
@ FORMAT_ERROR
Command failed to deserialize.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: CmdPortAc.cpp:62
void init()
Initialization function.
Definition: CmdPortAc.cpp:56
@ SERIALIZED_SIZE
The size of the serial representations of the port arguments.
Definition: CmdPortAc.hpp:37
void setPortNum(NATIVE_INT_TYPE portNum)
void init()
Initialization function.
Definition: TlmPortAc.cpp:56
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: TlmPortAc.cpp:62
@ ACTIVITY_HI
Important informational events.
@ WARNING_LO
A less serious but recoverable event.
@ ACTIVITY_LO
Less important informational events.
void init()
Object initializer.
Definition: ObjBase.cpp:27
void addCallPort(InputCmdRegPort *callPort)
Register an input port.
void invoke(FwOpcodeType opCode)
Invoke a port interface.
void init()
Initialization function.
void init()
Initialization function.
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)
Invoke a port interface.
void addCallPort(InputComPort *callPort)
Register an input port.
Definition: ComPortAc.cpp:143
void init()
Initialization function.
Definition: ComPortAc.cpp:137
void invoke(Fw::ComBuffer &data, U32 context)
Invoke a port interface.
Definition: ComPortAc.cpp:156
void init()
Initialization function.
Definition: LogPortAc.cpp:151
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args)
Invoke a port interface.
Definition: LogPortAc.cpp:170
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:157
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:134
void invoke(Fw::Time &time)
Invoke a port interface.
Definition: TimePortAc.cpp:147
void init()
Initialization function.
Definition: TimePortAc.cpp:128
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:150
void init()
Initialization function.
Definition: TlmPortAc.cpp:144
void invoke(FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)
Invoke a port interface.
Definition: TlmPortAc.cpp:163
bool isConnected()
Definition: PortBase.cpp:41
Os::Queue::QueueStatus createQueue(NATIVE_INT_TYPE depth, NATIVE_INT_TYPE msgSize)
Os::Queue m_queue
queue object for active component
@ MSG_DISPATCH_OK
Dispatch was normal.
@ MSG_DISPATCH_EXIT
A message was sent requesting an exit of the loop.
@ MSG_DISPATCH_ERROR
Errors dispatching messages.
NATIVE_UINT_TYPE getBuffLeft() const
returns how much deserialization buffer is left
void resetDeser()
reset deserialization to beginning
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
Definition: Time.hpp:9
QueueStatus
Definition: Queue.hpp:27
@ QUEUE_OK
message sent/received okay
Definition: Queue.hpp:28
QueueStatus send(const Fw::SerializeBufferBase &buffer, NATIVE_INT_TYPE priority, QueueBlocking block)
send a message
Definition: QueueCommon.cpp:13
QueueStatus receive(Fw::SerializeBufferBase &buffer, NATIVE_INT_TYPE &priority, QueueBlocking block)
receive a message
Definition: QueueCommon.cpp:22
QueueBlocking
Definition: Queue.hpp:40
@ QUEUE_BLOCKING
Queue receive blocks until a message arrives.
Definition: Queue.hpp:41
@ QUEUE_NONBLOCKING
Queue receive always returns even if there is no message.
Definition: Queue.hpp:42
@ SERIALIZED_SIZE
The size of the serial representations of the port arguments.
Definition: PingPortAc.hpp:36
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: PingPortAc.cpp:62
void init()
Initialization function.
Definition: PingPortAc.cpp:56
@ SERIALIZED_SIZE
The size of the serial representations of the port arguments.
Definition: SchedPortAc.hpp:36
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: SchedPortAc.cpp:62
void init()
Initialization function.
Definition: SchedPortAc.cpp:56
void invoke(U32 key)
Invoke a port interface.
Definition: PingPortAc.cpp:147
void init()
Initialization function.
Definition: PingPortAc.cpp:128
void addCallPort(InputPingPort *callPort)
Register an input port.
Definition: PingPortAc.cpp:134
virtual void pingIn_preMsgHook(NATIVE_INT_TYPE portNum, U32 key)
Pre-message hook for async input port pingIn.
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
@ CHANNELID_SENDLEVEL
Channel ID for SendLevel.
virtual void TlmRecv_handler(NATIVE_INT_TYPE portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)=0
Handler for input port TlmRecv.
void set_eventOut_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputLogPort *port)
Connect port to eventOut[portNum].
void pingOut_out(NATIVE_INT_TYPE portNum, U32 key)
Invoke output port pingOut.
void pingIn_handlerBase(NATIVE_INT_TYPE portNum, U32 key)
Handler base-class function for input port pingIn.
NATIVE_INT_TYPE getNum_tlmOut_OutputPorts() const
Fw::InputTlmPort * get_TlmRecv_InputPort(NATIVE_INT_TYPE portNum)
void set_timeGetOut_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputTimePort *port)
Connect port to timeGetOut[portNum].
void regCommands()
Register commands with the Command Dispatcher.
NATIVE_INT_TYPE getNum_cmdIn_InputPorts() const
void set_PktSend_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputComPort *port)
Connect port to PktSend[portNum].
NATIVE_INT_TYPE getNum_eventOut_OutputPorts() const
virtual void SET_LEVEL_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command SET_LEVEL.
@ EVENTID_NOCHAN
Telemetry channel is not part of a telemetry packet.
@ EVENTID_LEVELSET
Telemetry send level set.
@ EVENTID_PACKETNOTFOUND
Couldn't find the packet to send.
@ EVENTID_MAXLEVELEXCEED
Telemetry send level set.
NATIVE_INT_TYPE getNum_cmdRegOut_OutputPorts() const
void set_cmdRegOut_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputCmdRegPort *port)
Connect port to cmdRegOut[portNum].
void set_tlmOut_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
Svc::InputSchedPort * get_Run_InputPort(NATIVE_INT_TYPE portNum)
void set_pingOut_OutputPort(NATIVE_INT_TYPE portNum, Svc::InputPingPort *port)
Connect port to pingOut[portNum].
NATIVE_INT_TYPE getNum_timeGetOut_OutputPorts() const
NATIVE_INT_TYPE getNum_pingOut_OutputPorts() const
void tlmWrite_SendLevel(U32 arg, Fw::Time _tlmTime=Fw::Time())
void PktSend_out(NATIVE_INT_TYPE portNum, Fw::ComBuffer &data, U32 context)
Invoke output port PktSend.
virtual void Run_handler(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context)=0
Handler for input port Run.
bool isConnected_cmdRegOut_OutputPort(NATIVE_INT_TYPE portNum)
virtual void pingIn_handler(NATIVE_INT_TYPE portNum, U32 key)=0
Handler for input port pingIn.
virtual void SEND_PKT_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, U32 id)=0
Svc::InputPingPort * get_pingIn_InputPort(NATIVE_INT_TYPE portNum)
bool isConnected_tlmOut_OutputPort(NATIVE_INT_TYPE portNum)
void SET_LEVEL_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
virtual ~TlmPacketizerComponentBase()
Destroy TlmPacketizerComponentBase object.
NATIVE_INT_TYPE getNum_PktSend_OutputPorts() const
bool isConnected_pingOut_OutputPort(NATIVE_INT_TYPE portNum)
bool isConnected_timeGetOut_OutputPort(NATIVE_INT_TYPE portNum)
@ OPCODE_SEND_PKT
Force a packet to be sent.
@ OPCODE_SET_LEVEL
Set telemetry send level.
bool isConnected_PktSend_OutputPort(NATIVE_INT_TYPE portNum)
bool isConnected_cmdResponseOut_OutputPort(NATIVE_INT_TYPE portNum)
void log_WARNING_LO_MaxLevelExceed(U32 level, U32 max)
NATIVE_INT_TYPE getNum_pingIn_InputPorts() const
TlmPacketizerComponentBase(const char *compName="")
Construct TlmPacketizerComponentBase object.
NATIVE_INT_TYPE getNum_cmdResponseOut_OutputPorts() const
virtual void SEND_PKT_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command SEND_PKT.
void Run_handlerBase(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context)
Handler base-class function for input port Run.
void set_cmdResponseOut_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputCmdResponsePort *port)
Connect port to cmdResponseOut[portNum].
bool isConnected_eventOut_OutputPort(NATIVE_INT_TYPE portNum)
void TlmRecv_handlerBase(NATIVE_INT_TYPE portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)
Handler base-class function for input port TlmRecv.
void SEND_PKT_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Fw::InputCmdPort * get_cmdIn_InputPort(NATIVE_INT_TYPE portNum)
virtual void Run_preMsgHook(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context)
Pre-message hook for async input port Run.
virtual void SET_LEVEL_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, U32 level)=0
NATIVE_INT_TYPE getNum_TlmRecv_InputPorts() const
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.
const Time ZERO_TIME
Definition: Time.cpp:5