F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
TlmChanComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title TlmChanComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for TlmChan 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  TLMCHAN_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT,
20  RUN_SCHED,
21  PINGIN_PING,
22  };
23 
24  // Get the max size by constructing a union of the async input, command, and
25  // internal port serialization sizes
26  union BuffUnion {
29  };
30 
31  // Define a message buffer class large enough to handle all the
32  // asynchronous inputs to the component
33  class ComponentIpcSerializableBuffer :
35  {
36 
37  public:
38 
39  enum {
40  // Max. message size = size of data + message id + port
41  SERIALIZATION_SIZE =
42  sizeof(BuffUnion) +
43  sizeof(NATIVE_INT_TYPE) +
44  sizeof(NATIVE_INT_TYPE)
45  };
46 
47  NATIVE_UINT_TYPE getBuffCapacity() const {
48  return sizeof(m_buff);
49  }
50 
51  U8* getBuffAddr() {
52  return m_buff;
53  }
54 
55  const U8* getBuffAddr() const {
56  return m_buff;
57  }
58 
59  private:
60  // Should be the max of all the input ports serialized sizes...
61  U8 m_buff[SERIALIZATION_SIZE];
62 
63  };
64  }
65 
66  // ----------------------------------------------------------------------
67  // Component initialization
68  // ----------------------------------------------------------------------
69 
71  init(
72  NATIVE_INT_TYPE queueDepth,
73  NATIVE_INT_TYPE instance
74  )
75  {
76  // Initialize base class
78 
79  // Connect input port Run
80  for (
81  PlatformIntType port = 0;
82  port < static_cast<PlatformIntType>(this->getNum_Run_InputPorts());
83  port++
84  ) {
85  this->m_Run_InputPort[port].init();
86  this->m_Run_InputPort[port].addCallComp(
87  this,
88  m_p_Run_in
89  );
90  this->m_Run_InputPort[port].setPortNum(port);
91 
92 #if FW_OBJECT_NAMES == 1
93  // The port name consists of this->m_objName and some extra info.
94  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
95  // However, the compiler may assume that this->m_objName fills
96  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
97  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
98  // bytes to cover the extra info.
99  char portName[2*FW_OBJ_NAME_MAX_SIZE];
100  (void) snprintf(
101  portName,
102  sizeof(portName),
103  "%s_Run_InputPort[%" PRI_PlatformIntType "]",
104  this->m_objName,
105  port
106  );
107  this->m_Run_InputPort[port].setObjName(portName);
108 #endif
109  }
110 
111  // Connect input port TlmGet
112  for (
113  PlatformIntType port = 0;
114  port < static_cast<PlatformIntType>(this->getNum_TlmGet_InputPorts());
115  port++
116  ) {
117  this->m_TlmGet_InputPort[port].init();
118  this->m_TlmGet_InputPort[port].addCallComp(
119  this,
120  m_p_TlmGet_in
121  );
122  this->m_TlmGet_InputPort[port].setPortNum(port);
123 
124 #if FW_OBJECT_NAMES == 1
125  // The port name consists of this->m_objName and some extra info.
126  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
127  // However, the compiler may assume that this->m_objName fills
128  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
129  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
130  // bytes to cover the extra info.
131  char portName[2*FW_OBJ_NAME_MAX_SIZE];
132  (void) snprintf(
133  portName,
134  sizeof(portName),
135  "%s_TlmGet_InputPort[%" PRI_PlatformIntType "]",
136  this->m_objName,
137  port
138  );
139  this->m_TlmGet_InputPort[port].setObjName(portName);
140 #endif
141  }
142 
143  // Connect input port TlmRecv
144  for (
145  PlatformIntType port = 0;
146  port < static_cast<PlatformIntType>(this->getNum_TlmRecv_InputPorts());
147  port++
148  ) {
149  this->m_TlmRecv_InputPort[port].init();
150  this->m_TlmRecv_InputPort[port].addCallComp(
151  this,
152  m_p_TlmRecv_in
153  );
154  this->m_TlmRecv_InputPort[port].setPortNum(port);
155 
156 #if FW_OBJECT_NAMES == 1
157  // The port name consists of this->m_objName and some extra info.
158  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
159  // However, the compiler may assume that this->m_objName fills
160  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
161  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
162  // bytes to cover the extra info.
163  char portName[2*FW_OBJ_NAME_MAX_SIZE];
164  (void) snprintf(
165  portName,
166  sizeof(portName),
167  "%s_TlmRecv_InputPort[%" PRI_PlatformIntType "]",
168  this->m_objName,
169  port
170  );
171  this->m_TlmRecv_InputPort[port].setObjName(portName);
172 #endif
173  }
174 
175  // Connect input port pingIn
176  for (
177  PlatformIntType port = 0;
178  port < static_cast<PlatformIntType>(this->getNum_pingIn_InputPorts());
179  port++
180  ) {
181  this->m_pingIn_InputPort[port].init();
182  this->m_pingIn_InputPort[port].addCallComp(
183  this,
184  m_p_pingIn_in
185  );
186  this->m_pingIn_InputPort[port].setPortNum(port);
187 
188 #if FW_OBJECT_NAMES == 1
189  // The port name consists of this->m_objName and some extra info.
190  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
191  // However, the compiler may assume that this->m_objName fills
192  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
193  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
194  // bytes to cover the extra info.
195  char portName[2*FW_OBJ_NAME_MAX_SIZE];
196  (void) snprintf(
197  portName,
198  sizeof(portName),
199  "%s_pingIn_InputPort[%" PRI_PlatformIntType "]",
200  this->m_objName,
201  port
202  );
203  this->m_pingIn_InputPort[port].setObjName(portName);
204 #endif
205  }
206 
207  // Connect output port PktSend
208  for (
209  PlatformIntType port = 0;
210  port < static_cast<PlatformIntType>(this->getNum_PktSend_OutputPorts());
211  port++
212  ) {
213  this->m_PktSend_OutputPort[port].init();
214 
215 #if FW_OBJECT_NAMES == 1
216  // The port name consists of this->m_objName and some extra info.
217  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
218  // However, the compiler may assume that this->m_objName fills
219  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
220  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
221  // bytes to cover the extra info.
222  char portName[2*FW_OBJ_NAME_MAX_SIZE];
223  (void) snprintf(
224  portName,
225  sizeof(portName),
226  "%s_PktSend_OutputPort[%" PRI_PlatformIntType "]",
227  this->m_objName,
228  port
229  );
230  this->m_PktSend_OutputPort[port].setObjName(portName);
231 #endif
232  }
233 
234  // Connect output port pingOut
235  for (
236  PlatformIntType port = 0;
237  port < static_cast<PlatformIntType>(this->getNum_pingOut_OutputPorts());
238  port++
239  ) {
240  this->m_pingOut_OutputPort[port].init();
241 
242 #if FW_OBJECT_NAMES == 1
243  // The port name consists of this->m_objName and some extra info.
244  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
245  // However, the compiler may assume that this->m_objName fills
246  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
247  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
248  // bytes to cover the extra info.
249  char portName[2*FW_OBJ_NAME_MAX_SIZE];
250  (void) snprintf(
251  portName,
252  sizeof(portName),
253  "%s_pingOut_OutputPort[%" PRI_PlatformIntType "]",
254  this->m_objName,
255  port
256  );
257  this->m_pingOut_OutputPort[port].setObjName(portName);
258 #endif
259  }
260 
261  Os::Queue::QueueStatus qStat = this->createQueue(
262  queueDepth,
263  ComponentIpcSerializableBuffer::SERIALIZATION_SIZE
264  );
265  FW_ASSERT(
266  Os::Queue::QUEUE_OK == qStat,
267  static_cast<FwAssertArgType>(qStat)
268  );
269  }
270 
271  // ----------------------------------------------------------------------
272  // Getters for typed input ports
273  // ----------------------------------------------------------------------
274 
277  {
278  FW_ASSERT(
279  portNum < this->getNum_Run_InputPorts(),
280  static_cast<FwAssertArgType>(portNum)
281  );
282 
283  return &this->m_Run_InputPort[portNum];
284  }
285 
288  {
289  FW_ASSERT(
290  portNum < this->getNum_TlmGet_InputPorts(),
291  static_cast<FwAssertArgType>(portNum)
292  );
293 
294  return &this->m_TlmGet_InputPort[portNum];
295  }
296 
299  {
300  FW_ASSERT(
301  portNum < this->getNum_TlmRecv_InputPorts(),
302  static_cast<FwAssertArgType>(portNum)
303  );
304 
305  return &this->m_TlmRecv_InputPort[portNum];
306  }
307 
310  {
311  FW_ASSERT(
312  portNum < this->getNum_pingIn_InputPorts(),
313  static_cast<FwAssertArgType>(portNum)
314  );
315 
316  return &this->m_pingIn_InputPort[portNum];
317  }
318 
319  // ----------------------------------------------------------------------
320  // Connect typed input ports to typed output ports
321  // ----------------------------------------------------------------------
322 
325  NATIVE_INT_TYPE portNum,
326  Fw::InputComPort* port
327  )
328  {
329  FW_ASSERT(
330  portNum < this->getNum_PktSend_OutputPorts(),
331  static_cast<FwAssertArgType>(portNum)
332  );
333 
334  this->m_PktSend_OutputPort[portNum].addCallPort(port);
335  }
336 
339  NATIVE_INT_TYPE portNum,
340  Svc::InputPingPort* port
341  )
342  {
343  FW_ASSERT(
344  portNum < this->getNum_pingOut_OutputPorts(),
345  static_cast<FwAssertArgType>(portNum)
346  );
347 
348  this->m_pingOut_OutputPort[portNum].addCallPort(port);
349  }
350 
351 #if FW_PORT_SERIALIZATION
352 
353  // ----------------------------------------------------------------------
354  // Connect serial input ports to typed output ports
355  // ----------------------------------------------------------------------
356 
359  NATIVE_INT_TYPE portNum,
360  Fw::InputSerializePort* port
361  )
362  {
363  FW_ASSERT(
364  portNum < this->getNum_PktSend_OutputPorts(),
365  static_cast<FwAssertArgType>(portNum)
366  );
367 
368  this->m_PktSend_OutputPort[portNum].registerSerialPort(port);
369  }
370 
373  NATIVE_INT_TYPE portNum,
374  Fw::InputSerializePort* port
375  )
376  {
377  FW_ASSERT(
378  portNum < this->getNum_pingOut_OutputPorts(),
379  static_cast<FwAssertArgType>(portNum)
380  );
381 
382  this->m_pingOut_OutputPort[portNum].registerSerialPort(port);
383  }
384 
385 #endif
386 
387  // ----------------------------------------------------------------------
388  // Component construction and destruction
389  // ----------------------------------------------------------------------
390 
392  TlmChanComponentBase(const char* compName) :
393  Fw::ActiveComponentBase(compName)
394  {
395 
396  }
397 
400  {
401 
402  }
403 
404  // ----------------------------------------------------------------------
405  // Getters for numbers of typed input ports
406  // ----------------------------------------------------------------------
407 
410  {
411  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_Run_InputPort));
412  }
413 
416  {
417  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_TlmGet_InputPort));
418  }
419 
422  {
423  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_TlmRecv_InputPort));
424  }
425 
428  {
429  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_pingIn_InputPort));
430  }
431 
432  // ----------------------------------------------------------------------
433  // Getters for numbers of typed output ports
434  // ----------------------------------------------------------------------
435 
438  {
439  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_PktSend_OutputPort));
440  }
441 
444  {
445  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_pingOut_OutputPort));
446  }
447 
448  // ----------------------------------------------------------------------
449  // Connection status queries for typed output ports
450  // ----------------------------------------------------------------------
451 
454  {
455  FW_ASSERT(
456  portNum < this->getNum_PktSend_OutputPorts(),
457  static_cast<FwAssertArgType>(portNum)
458  );
459 
460  return this->m_PktSend_OutputPort[portNum].isConnected();
461  }
462 
465  {
466  FW_ASSERT(
467  portNum < this->getNum_pingOut_OutputPorts(),
468  static_cast<FwAssertArgType>(portNum)
469  );
470 
471  return this->m_pingOut_OutputPort[portNum].isConnected();
472  }
473 
474  // ----------------------------------------------------------------------
475  // Port handler base-class functions for typed input ports
476  //
477  // Call these functions directly to bypass the corresponding ports
478  // ----------------------------------------------------------------------
479 
482  NATIVE_INT_TYPE portNum,
483  NATIVE_UINT_TYPE context
484  )
485  {
486  // Make sure port number is valid
487  FW_ASSERT(
488  portNum < this->getNum_Run_InputPorts(),
489  static_cast<FwAssertArgType>(portNum)
490  );
491 
492  // Call pre-message hook
494  portNum,
495  context
496  );
497  ComponentIpcSerializableBuffer msg;
499 
500  // Serialize message ID
501  _status = msg.serialize(
502  static_cast<NATIVE_INT_TYPE>(RUN_SCHED)
503  );
504  FW_ASSERT(
505  _status == Fw::FW_SERIALIZE_OK,
506  static_cast<FwAssertArgType>(_status)
507  );
508 
509  // Serialize port number
510  _status = msg.serialize(portNum);
511  FW_ASSERT(
512  _status == Fw::FW_SERIALIZE_OK,
513  static_cast<FwAssertArgType>(_status)
514  );
515 
516  // Serialize argument context
517  _status = msg.serialize(context);
518  FW_ASSERT(
519  _status == Fw::FW_SERIALIZE_OK,
520  static_cast<FwAssertArgType>(_status)
521  );
522 
523  // Send message
525  Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
526 
527  FW_ASSERT(
528  qStatus == Os::Queue::QUEUE_OK,
529  static_cast<FwAssertArgType>(qStatus)
530  );
531  }
532 
535  NATIVE_INT_TYPE portNum,
536  FwChanIdType id,
537  Fw::Time& timeTag,
538  Fw::TlmBuffer& val
539  )
540  {
541  // Make sure port number is valid
542  FW_ASSERT(
543  portNum < this->getNum_TlmGet_InputPorts(),
544  static_cast<FwAssertArgType>(portNum)
545  );
546 
547  // Lock guard mutex before calling
548  this->lock();
549 
550  // Call handler function
551  this->TlmGet_handler(
552  portNum,
553  id,
554  timeTag,
555  val
556  );
557 
558  // Unlock guard mutex
559  this->unLock();
560  }
561 
564  NATIVE_INT_TYPE portNum,
565  FwChanIdType id,
566  Fw::Time& timeTag,
567  Fw::TlmBuffer& val
568  )
569  {
570  // Make sure port number is valid
571  FW_ASSERT(
572  portNum < this->getNum_TlmRecv_InputPorts(),
573  static_cast<FwAssertArgType>(portNum)
574  );
575 
576  // Lock guard mutex before calling
577  this->lock();
578 
579  // Call handler function
580  this->TlmRecv_handler(
581  portNum,
582  id,
583  timeTag,
584  val
585  );
586 
587  // Unlock guard mutex
588  this->unLock();
589  }
590 
593  NATIVE_INT_TYPE portNum,
594  U32 key
595  )
596  {
597  // Make sure port number is valid
598  FW_ASSERT(
599  portNum < this->getNum_pingIn_InputPorts(),
600  static_cast<FwAssertArgType>(portNum)
601  );
602 
603  // Call pre-message hook
605  portNum,
606  key
607  );
608  ComponentIpcSerializableBuffer msg;
610 
611  // Serialize message ID
612  _status = msg.serialize(
613  static_cast<NATIVE_INT_TYPE>(PINGIN_PING)
614  );
615  FW_ASSERT(
616  _status == Fw::FW_SERIALIZE_OK,
617  static_cast<FwAssertArgType>(_status)
618  );
619 
620  // Serialize port number
621  _status = msg.serialize(portNum);
622  FW_ASSERT(
623  _status == Fw::FW_SERIALIZE_OK,
624  static_cast<FwAssertArgType>(_status)
625  );
626 
627  // Serialize argument key
628  _status = msg.serialize(key);
629  FW_ASSERT(
630  _status == Fw::FW_SERIALIZE_OK,
631  static_cast<FwAssertArgType>(_status)
632  );
633 
634  // Send message
636  Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
637 
638  FW_ASSERT(
639  qStatus == Os::Queue::QUEUE_OK,
640  static_cast<FwAssertArgType>(qStatus)
641  );
642  }
643 
644  // ----------------------------------------------------------------------
645  // Pre-message hooks for typed async input ports
646  //
647  // Each of these functions is invoked just before processing a message
648  // on the corresponding port. By default, they do nothing. You can
649  // override them to provide specific pre-message behavior.
650  // ----------------------------------------------------------------------
651 
654  NATIVE_INT_TYPE portNum,
655  NATIVE_UINT_TYPE context
656  )
657  {
658  // Default: no-op
659  }
660 
663  NATIVE_INT_TYPE portNum,
664  U32 key
665  )
666  {
667  // Default: no-op
668  }
669 
670  // ----------------------------------------------------------------------
671  // Invocation functions for typed output ports
672  // ----------------------------------------------------------------------
673 
676  NATIVE_INT_TYPE portNum,
677  Fw::ComBuffer& data,
678  U32 context
679  )
680  {
681  FW_ASSERT(
682  portNum < this->getNum_PktSend_OutputPorts(),
683  static_cast<FwAssertArgType>(portNum)
684  );
685  this->m_PktSend_OutputPort[portNum].invoke(
686  data,
687  context
688  );
689  }
690 
693  NATIVE_INT_TYPE portNum,
694  U32 key
695  )
696  {
697  FW_ASSERT(
698  portNum < this->getNum_pingOut_OutputPorts(),
699  static_cast<FwAssertArgType>(portNum)
700  );
701  this->m_pingOut_OutputPort[portNum].invoke(
702  key
703  );
704  }
705 
706  // ----------------------------------------------------------------------
707  // Mutex operations for guarded ports
708  //
709  // You can override these operations to provide more sophisticated
710  // synchronization
711  // ----------------------------------------------------------------------
712 
714  lock()
715  {
716  this->m_guardedPortMutex.lock();
717  }
718 
720  unLock()
721  {
722  this->m_guardedPortMutex.unLock();
723  }
724 
725  // ----------------------------------------------------------------------
726  // Message dispatch functions
727  // ----------------------------------------------------------------------
728 
729  Fw::QueuedComponentBase::MsgDispatchStatus TlmChanComponentBase ::
730  doDispatch()
731  {
732  ComponentIpcSerializableBuffer msg;
733  NATIVE_INT_TYPE priority = 0;
734 
735  Os::Queue::QueueStatus msgStatus = this->m_queue.receive(
736  msg,
737  priority,
739  );
740  FW_ASSERT(
741  msgStatus == Os::Queue::QUEUE_OK,
742  static_cast<FwAssertArgType>(msgStatus)
743  );
744 
745  // Reset to beginning of buffer
746  msg.resetDeser();
747 
748  NATIVE_INT_TYPE desMsg = 0;
749  Fw::SerializeStatus deserStatus = msg.deserialize(desMsg);
750  FW_ASSERT(
751  deserStatus == Fw::FW_SERIALIZE_OK,
752  static_cast<FwAssertArgType>(deserStatus)
753  );
754 
755  MsgTypeEnum msgType = static_cast<MsgTypeEnum>(desMsg);
756 
757  if (msgType == TLMCHAN_COMPONENT_EXIT) {
758  return MSG_DISPATCH_EXIT;
759  }
760 
761  NATIVE_INT_TYPE portNum = 0;
762  deserStatus = msg.deserialize(portNum);
763  FW_ASSERT(
764  deserStatus == Fw::FW_SERIALIZE_OK,
765  static_cast<FwAssertArgType>(deserStatus)
766  );
767 
768  switch (msgType) {
769  // Handle async input port Run
770  case RUN_SCHED: {
771  // Deserialize argument context
772  NATIVE_UINT_TYPE context;
773  deserStatus = msg.deserialize(context);
774  FW_ASSERT(
775  deserStatus == Fw::FW_SERIALIZE_OK,
776  static_cast<FwAssertArgType>(deserStatus)
777  );
778  // Call handler function
779  this->Run_handler(
780  portNum,
781  context
782  );
783 
784  break;
785  }
786 
787  // Handle async input port pingIn
788  case PINGIN_PING: {
789  // Deserialize argument key
790  U32 key;
791  deserStatus = msg.deserialize(key);
792  FW_ASSERT(
793  deserStatus == Fw::FW_SERIALIZE_OK,
794  static_cast<FwAssertArgType>(deserStatus)
795  );
796  // Call handler function
797  this->pingIn_handler(
798  portNum,
799  key
800  );
801 
802  break;
803  }
804 
805  default:
806  return MSG_DISPATCH_ERROR;
807  }
808 
809  return MSG_DISPATCH_OK;
810  }
811 
812  // ----------------------------------------------------------------------
813  // Calls for messages received on typed input ports
814  // ----------------------------------------------------------------------
815 
816  void TlmChanComponentBase ::
817  m_p_Run_in(
818  Fw::PassiveComponentBase* callComp,
819  NATIVE_INT_TYPE portNum,
820  NATIVE_UINT_TYPE context
821  )
822  {
823  FW_ASSERT(callComp);
824  TlmChanComponentBase* compPtr = static_cast<TlmChanComponentBase*>(callComp);
825  compPtr->Run_handlerBase(
826  portNum,
827  context
828  );
829  }
830 
831  void TlmChanComponentBase ::
832  m_p_TlmGet_in(
833  Fw::PassiveComponentBase* callComp,
834  NATIVE_INT_TYPE portNum,
835  FwChanIdType id,
836  Fw::Time& timeTag,
837  Fw::TlmBuffer& val
838  )
839  {
840  FW_ASSERT(callComp);
841  TlmChanComponentBase* compPtr = static_cast<TlmChanComponentBase*>(callComp);
842  compPtr->TlmGet_handlerBase(
843  portNum,
844  id,
845  timeTag,
846  val
847  );
848  }
849 
850  void TlmChanComponentBase ::
851  m_p_TlmRecv_in(
852  Fw::PassiveComponentBase* callComp,
853  NATIVE_INT_TYPE portNum,
854  FwChanIdType id,
855  Fw::Time& timeTag,
856  Fw::TlmBuffer& val
857  )
858  {
859  FW_ASSERT(callComp);
860  TlmChanComponentBase* compPtr = static_cast<TlmChanComponentBase*>(callComp);
861  compPtr->TlmRecv_handlerBase(
862  portNum,
863  id,
864  timeTag,
865  val
866  );
867  }
868 
869  void TlmChanComponentBase ::
870  m_p_pingIn_in(
871  Fw::PassiveComponentBase* callComp,
872  NATIVE_INT_TYPE portNum,
873  U32 key
874  )
875  {
876  FW_ASSERT(callComp);
877  TlmChanComponentBase* compPtr = static_cast<TlmChanComponentBase*>(callComp);
878  compPtr->pingIn_handlerBase(
879  portNum,
880  key
881  );
882  }
883 
884 }
#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
PlatformAssertArgType FwAssertArgType
Definition: FpConfig.h:21
U32 FwChanIdType
Definition: FpConfig.h:59
#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
@ ACTIVE_COMPONENT_EXIT
message to exit active component task
void setPortNum(NATIVE_INT_TYPE portNum)
void init()
Initialization function.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void init()
Initialization function.
Definition: TlmPortAc.cpp:56
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: TlmPortAc.cpp:62
void init()
Object initializer.
Definition: ObjBase.cpp:27
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
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.
Definition: Time.hpp:9
void unLock()
unlock the mutex
Definition: Mutex.cpp:13
void lock()
lock the mutex
Definition: Mutex.cpp:12
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_handler(NATIVE_INT_TYPE portNum, U32 key)=0
Handler for input port pingIn.
void set_pingOut_OutputPort(NATIVE_INT_TYPE portNum, Svc::InputPingPort *port)
Connect port to pingOut[portNum].
bool isConnected_PktSend_OutputPort(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 unLock()
Unlock the guarded mutex.
virtual ~TlmChanComponentBase()
Destroy TlmChanComponentBase object.
Fw::InputTlmPort * get_TlmRecv_InputPort(NATIVE_INT_TYPE portNum)
void pingOut_out(NATIVE_INT_TYPE portNum, U32 key)
Invoke output port pingOut.
bool isConnected_pingOut_OutputPort(NATIVE_INT_TYPE portNum)
Fw::InputTlmGetPort * get_TlmGet_InputPort(NATIVE_INT_TYPE portNum)
virtual void Run_handler(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context)=0
Handler for input port Run.
Svc::InputPingPort * get_pingIn_InputPort(NATIVE_INT_TYPE portNum)
virtual void TlmRecv_handler(NATIVE_INT_TYPE portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)=0
Handler for input port TlmRecv.
NATIVE_INT_TYPE getNum_TlmGet_InputPorts() const
NATIVE_INT_TYPE getNum_pingOut_OutputPorts() const
void TlmRecv_handlerBase(NATIVE_INT_TYPE portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)
Handler base-class function for input port TlmRecv.
void TlmGet_handlerBase(NATIVE_INT_TYPE portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)
Handler base-class function for input port TlmGet.
NATIVE_INT_TYPE getNum_Run_InputPorts() const
void Run_handlerBase(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context)
Handler base-class function for input port Run.
TlmChanComponentBase(const char *compName="")
Construct TlmChanComponentBase object.
Svc::InputSchedPort * get_Run_InputPort(NATIVE_INT_TYPE portNum)
void PktSend_out(NATIVE_INT_TYPE portNum, Fw::ComBuffer &data, U32 context)
Invoke output port PktSend.
void pingIn_handlerBase(NATIVE_INT_TYPE portNum, U32 key)
Handler base-class function for input port pingIn.
NATIVE_INT_TYPE getNum_PktSend_OutputPorts() const
virtual void pingIn_preMsgHook(NATIVE_INT_TYPE portNum, U32 key)
Pre-message hook for async input port pingIn.
NATIVE_INT_TYPE getNum_pingIn_InputPorts() const
void set_PktSend_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputComPort *port)
Connect port to PktSend[portNum].
NATIVE_INT_TYPE getNum_TlmRecv_InputPorts() const
virtual void lock()
Lock the guarded mutex.
virtual void TlmGet_handler(NATIVE_INT_TYPE portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)=0
Handler for input port TlmGet.
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.