F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
ComLoggerDpComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title ComLoggerDpComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for ComLoggerDp component base class
5 // ======================================================================
6 
7 #include "Fw/Types/Assert.hpp"
9 #if FW_ENABLE_TEXT_LOGGING
10 #include "Fw/Types/String.hpp"
11 #endif
13 
14 namespace Svc {
15 
16  namespace {
17  enum MsgTypeEnum {
18  COMLOGGERDP_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT,
19  COMIN_COM,
20  PINGIN_PING,
21  SCHEDIN_SCHED,
22  STARTRECORDINGIN_COMLOGGERSTART,
23  STOPRECORDINGIN_COMLOGGERSTOP,
24  CMD_STARTCOMDP,
25  CMD_UPDATEPRIORITY,
26  CMD_STOPCOMDP,
27  CMD_CLEAR_COUNTERS,
28  };
29 
30  // Get the max size by constructing a union of the async input, command, and
31  // internal port serialization sizes
32  union BuffUnion {
33  BYTE comInPortSize[Fw::ComPortBuffer::CAPACITY];
35  BYTE schedInPortSize[Svc::SchedPortBuffer::CAPACITY];
36  BYTE startRecordingInPortSize[Svc::ComLoggerStartPortBuffer::CAPACITY];
38  };
39 
40  // Define a message buffer class large enough to handle all the
41  // asynchronous inputs to the component
42  class ComponentIpcSerializableBuffer :
44  {
45 
46  public:
47 
48  enum {
49  // Offset into data in buffer: Size of message ID and port number
50  DATA_OFFSET = sizeof(FwEnumStoreType) + sizeof(FwIndexType),
51  // Max data size
52  MAX_DATA_SIZE = sizeof(BuffUnion),
53  // Max message size: Size of message id + size of port + max data size
54  SERIALIZATION_SIZE = DATA_OFFSET + MAX_DATA_SIZE
55  };
56 
57  ComponentIpcSerializableBuffer() : Fw::LinearBufferBase(m_buff, sizeof(m_buff)) {
58 
59  }
60 
61  private:
62  // Should be the max of all the input ports serialized sizes...
63  U8 m_buff[SERIALIZATION_SIZE];
64 
65  };
66  }
67 
68  // ----------------------------------------------------------------------
69  // Types for data products
70  // ----------------------------------------------------------------------
71 
74  FwDpIdType id,
75  const Fw::Buffer& buffer,
76  FwDpIdType baseId
77  ) :
78  Fw::DpContainer(id, buffer),
79  m_baseId(baseId)
80  {
81 
82  }
83 
86  Fw::DpContainer(),
87  m_baseId(0)
88  {
89 
90  }
91 
94  const U8* array,
95  FwSizeType size
96  )
97  {
98  FW_ASSERT(array != nullptr);
99  // Compute the size delta
100  const FwSizeType sizeDelta =
101  sizeof(FwDpIdType) +
102  sizeof(FwSizeStoreType) +
103  size * sizeof(U8);
104  // Serialize the elements if they will fit
106  if ((this->m_dataBuffer.getSize() + sizeDelta) <= this->m_dataBuffer.getCapacity()) {
107  const FwDpIdType id = this->m_baseId + RecordId::ComBufferRecord;
108  status = this->m_dataBuffer.serializeFrom(id);
109  FW_ASSERT(status == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(status));
110  status = this->m_dataBuffer.serializeSize(size);
111  FW_ASSERT(status == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(status));
112  status = this->m_dataBuffer.serializeFrom(array, size, Fw::Serialization::OMIT_LENGTH);
113  FW_ASSERT(status == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(status));
114  this->m_dataSize += sizeDelta;
115  }
116  else {
118  }
119  return status;
120  }
121 
122  // ----------------------------------------------------------------------
123  // Component initialization
124  // ----------------------------------------------------------------------
125 
128  FwSizeType queueDepth,
129  FwEnumStoreType instance
130  )
131  {
132  // Initialize base class
134 
135 #if !FW_DIRECT_PORT_CALLS
136  // Connect input port cmdIn
137  for (
138  FwIndexType port = 0;
139  port < static_cast<FwIndexType>(this->getNum_cmdIn_InputPorts());
140  port++
141  ) {
142  this->m_cmdIn_InputPort[port].init();
143  this->m_cmdIn_InputPort[port].addCallComp(
144  this,
145  m_p_cmdIn_in
146  );
147  this->m_cmdIn_InputPort[port].setPortNum(port);
148 
149 #if FW_OBJECT_NAMES == 1
150  Fw::ObjectName portName;
151  portName.format(
152  "%s_cmdIn_InputPort[%" PRI_FwIndexType "]",
153  this->m_objName.toChar(),
154  port
155  );
156  this->m_cmdIn_InputPort[port].setObjName(portName.toChar());
157 #endif
158  }
159 #endif
160 
161 #if !FW_DIRECT_PORT_CALLS
162  // Connect input port comIn
163  for (
164  FwIndexType port = 0;
165  port < static_cast<FwIndexType>(this->getNum_comIn_InputPorts());
166  port++
167  ) {
168  this->m_comIn_InputPort[port].init();
169  this->m_comIn_InputPort[port].addCallComp(
170  this,
171  m_p_comIn_in
172  );
173  this->m_comIn_InputPort[port].setPortNum(port);
174 
175 #if FW_OBJECT_NAMES == 1
176  Fw::ObjectName portName;
177  portName.format(
178  "%s_comIn_InputPort[%" PRI_FwIndexType "]",
179  this->m_objName.toChar(),
180  port
181  );
182  this->m_comIn_InputPort[port].setObjName(portName.toChar());
183 #endif
184  }
185 #endif
186 
187 #if !FW_DIRECT_PORT_CALLS
188  // Connect input port pingIn
189  for (
190  FwIndexType port = 0;
191  port < static_cast<FwIndexType>(this->getNum_pingIn_InputPorts());
192  port++
193  ) {
194  this->m_pingIn_InputPort[port].init();
195  this->m_pingIn_InputPort[port].addCallComp(
196  this,
197  m_p_pingIn_in
198  );
199  this->m_pingIn_InputPort[port].setPortNum(port);
200 
201 #if FW_OBJECT_NAMES == 1
202  Fw::ObjectName portName;
203  portName.format(
204  "%s_pingIn_InputPort[%" PRI_FwIndexType "]",
205  this->m_objName.toChar(),
206  port
207  );
208  this->m_pingIn_InputPort[port].setObjName(portName.toChar());
209 #endif
210  }
211 #endif
212 
213 #if !FW_DIRECT_PORT_CALLS
214  // Connect input port schedIn
215  for (
216  FwIndexType port = 0;
217  port < static_cast<FwIndexType>(this->getNum_schedIn_InputPorts());
218  port++
219  ) {
220  this->m_schedIn_InputPort[port].init();
221  this->m_schedIn_InputPort[port].addCallComp(
222  this,
223  m_p_schedIn_in
224  );
225  this->m_schedIn_InputPort[port].setPortNum(port);
226 
227 #if FW_OBJECT_NAMES == 1
228  Fw::ObjectName portName;
229  portName.format(
230  "%s_schedIn_InputPort[%" PRI_FwIndexType "]",
231  this->m_objName.toChar(),
232  port
233  );
234  this->m_schedIn_InputPort[port].setObjName(portName.toChar());
235 #endif
236  }
237 #endif
238 
239 #if !FW_DIRECT_PORT_CALLS
240  // Connect input port startRecordingIn
241  for (
242  FwIndexType port = 0;
243  port < static_cast<FwIndexType>(this->getNum_startRecordingIn_InputPorts());
244  port++
245  ) {
246  this->m_startRecordingIn_InputPort[port].init();
247  this->m_startRecordingIn_InputPort[port].addCallComp(
248  this,
249  m_p_startRecordingIn_in
250  );
251  this->m_startRecordingIn_InputPort[port].setPortNum(port);
252 
253 #if FW_OBJECT_NAMES == 1
254  Fw::ObjectName portName;
255  portName.format(
256  "%s_startRecordingIn_InputPort[%" PRI_FwIndexType "]",
257  this->m_objName.toChar(),
258  port
259  );
260  this->m_startRecordingIn_InputPort[port].setObjName(portName.toChar());
261 #endif
262  }
263 #endif
264 
265 #if !FW_DIRECT_PORT_CALLS
266  // Connect input port stopRecordingIn
267  for (
268  FwIndexType port = 0;
269  port < static_cast<FwIndexType>(this->getNum_stopRecordingIn_InputPorts());
270  port++
271  ) {
272  this->m_stopRecordingIn_InputPort[port].init();
273  this->m_stopRecordingIn_InputPort[port].addCallComp(
274  this,
275  m_p_stopRecordingIn_in
276  );
277  this->m_stopRecordingIn_InputPort[port].setPortNum(port);
278 
279 #if FW_OBJECT_NAMES == 1
280  Fw::ObjectName portName;
281  portName.format(
282  "%s_stopRecordingIn_InputPort[%" PRI_FwIndexType "]",
283  this->m_objName.toChar(),
284  port
285  );
286  this->m_stopRecordingIn_InputPort[port].setObjName(portName.toChar());
287 #endif
288  }
289 #endif
290 
291 #if !FW_DIRECT_PORT_CALLS && FW_ENABLE_TEXT_LOGGING
292  // Connect output port LogText
293  for (
294  FwIndexType port = 0;
295  port < static_cast<FwIndexType>(this->getNum_LogText_OutputPorts());
296  port++
297  ) {
298  this->m_LogText_OutputPort[port].init();
299 
300 #if FW_OBJECT_NAMES == 1
301  Fw::ObjectName portName;
302  portName.format(
303  "%s_LogText_OutputPort[%" PRI_FwIndexType "]",
304  this->m_objName.toChar(),
305  port
306  );
307  this->m_LogText_OutputPort[port].setObjName(portName.toChar());
308 #endif
309  }
310 #endif
311 
312 #if !FW_DIRECT_PORT_CALLS
313  // Connect output port cmdRegOut
314  for (
315  FwIndexType port = 0;
316  port < static_cast<FwIndexType>(this->getNum_cmdRegOut_OutputPorts());
317  port++
318  ) {
319  this->m_cmdRegOut_OutputPort[port].init();
320 
321 #if FW_OBJECT_NAMES == 1
322  Fw::ObjectName portName;
323  portName.format(
324  "%s_cmdRegOut_OutputPort[%" PRI_FwIndexType "]",
325  this->m_objName.toChar(),
326  port
327  );
328  this->m_cmdRegOut_OutputPort[port].setObjName(portName.toChar());
329 #endif
330  }
331 #endif
332 
333 #if !FW_DIRECT_PORT_CALLS
334  // Connect output port cmdResponseOut
335  for (
336  FwIndexType port = 0;
337  port < static_cast<FwIndexType>(this->getNum_cmdResponseOut_OutputPorts());
338  port++
339  ) {
340  this->m_cmdResponseOut_OutputPort[port].init();
341 
342 #if FW_OBJECT_NAMES == 1
343  Fw::ObjectName portName;
344  portName.format(
345  "%s_cmdResponseOut_OutputPort[%" PRI_FwIndexType "]",
346  this->m_objName.toChar(),
347  port
348  );
349  this->m_cmdResponseOut_OutputPort[port].setObjName(portName.toChar());
350 #endif
351  }
352 #endif
353 
354 #if !FW_DIRECT_PORT_CALLS
355  // Connect output port logOut
356  for (
357  FwIndexType port = 0;
358  port < static_cast<FwIndexType>(this->getNum_logOut_OutputPorts());
359  port++
360  ) {
361  this->m_logOut_OutputPort[port].init();
362 
363 #if FW_OBJECT_NAMES == 1
364  Fw::ObjectName portName;
365  portName.format(
366  "%s_logOut_OutputPort[%" PRI_FwIndexType "]",
367  this->m_objName.toChar(),
368  port
369  );
370  this->m_logOut_OutputPort[port].setObjName(portName.toChar());
371 #endif
372  }
373 #endif
374 
375 #if !FW_DIRECT_PORT_CALLS
376  // Connect output port productGetOut
377  for (
378  FwIndexType port = 0;
379  port < static_cast<FwIndexType>(this->getNum_productGetOut_OutputPorts());
380  port++
381  ) {
382  this->m_productGetOut_OutputPort[port].init();
383 
384 #if FW_OBJECT_NAMES == 1
385  Fw::ObjectName portName;
386  portName.format(
387  "%s_productGetOut_OutputPort[%" PRI_FwIndexType "]",
388  this->m_objName.toChar(),
389  port
390  );
391  this->m_productGetOut_OutputPort[port].setObjName(portName.toChar());
392 #endif
393  }
394 #endif
395 
396 #if !FW_DIRECT_PORT_CALLS
397  // Connect output port productSendOut
398  for (
399  FwIndexType port = 0;
400  port < static_cast<FwIndexType>(this->getNum_productSendOut_OutputPorts());
401  port++
402  ) {
403  this->m_productSendOut_OutputPort[port].init();
404 
405 #if FW_OBJECT_NAMES == 1
406  Fw::ObjectName portName;
407  portName.format(
408  "%s_productSendOut_OutputPort[%" PRI_FwIndexType "]",
409  this->m_objName.toChar(),
410  port
411  );
412  this->m_productSendOut_OutputPort[port].setObjName(portName.toChar());
413 #endif
414  }
415 #endif
416 
417 #if !FW_DIRECT_PORT_CALLS
418  // Connect output port timeCaller
419  for (
420  FwIndexType port = 0;
421  port < static_cast<FwIndexType>(this->getNum_timeCaller_OutputPorts());
422  port++
423  ) {
424  this->m_timeCaller_OutputPort[port].init();
425 
426 #if FW_OBJECT_NAMES == 1
427  Fw::ObjectName portName;
428  portName.format(
429  "%s_timeCaller_OutputPort[%" PRI_FwIndexType "]",
430  this->m_objName.toChar(),
431  port
432  );
433  this->m_timeCaller_OutputPort[port].setObjName(portName.toChar());
434 #endif
435  }
436 #endif
437 
438 #if !FW_DIRECT_PORT_CALLS
439  // Connect output port tlmOut
440  for (
441  FwIndexType port = 0;
442  port < static_cast<FwIndexType>(this->getNum_tlmOut_OutputPorts());
443  port++
444  ) {
445  this->m_tlmOut_OutputPort[port].init();
446 
447 #if FW_OBJECT_NAMES == 1
448  Fw::ObjectName portName;
449  portName.format(
450  "%s_tlmOut_OutputPort[%" PRI_FwIndexType "]",
451  this->m_objName.toChar(),
452  port
453  );
454  this->m_tlmOut_OutputPort[port].setObjName(portName.toChar());
455 #endif
456  }
457 #endif
458 
459 #if !FW_DIRECT_PORT_CALLS
460  // Connect output port pingOut
461  for (
462  FwIndexType port = 0;
463  port < static_cast<FwIndexType>(this->getNum_pingOut_OutputPorts());
464  port++
465  ) {
466  this->m_pingOut_OutputPort[port].init();
467 
468 #if FW_OBJECT_NAMES == 1
469  Fw::ObjectName portName;
470  portName.format(
471  "%s_pingOut_OutputPort[%" PRI_FwIndexType "]",
472  this->m_objName.toChar(),
473  port
474  );
475  this->m_pingOut_OutputPort[port].setObjName(portName.toChar());
476 #endif
477  }
478 #endif
479 
480  // Create the queue
481  Os::Queue::Status qStat = this->createQueue(
482  queueDepth,
483  static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
484  );
485  FW_ASSERT(
486  Os::Queue::Status::OP_OK == qStat,
487  static_cast<FwAssertArgType>(qStat)
488  );
489  }
490 
491 #if !FW_DIRECT_PORT_CALLS
492 
493  // ----------------------------------------------------------------------
494  // Getters for special input ports
495  // ----------------------------------------------------------------------
496 
499  {
500  FW_ASSERT(
501  (0 <= portNum) && (portNum < this->getNum_cmdIn_InputPorts()),
502  static_cast<FwAssertArgType>(portNum)
503  );
504 
505  return &this->m_cmdIn_InputPort[portNum];
506  }
507 
508 #endif
509 
510 #if !FW_DIRECT_PORT_CALLS
511 
512  // ----------------------------------------------------------------------
513  // Getters for typed input ports
514  // ----------------------------------------------------------------------
515 
518  {
519  FW_ASSERT(
520  (0 <= portNum) && (portNum < this->getNum_comIn_InputPorts()),
521  static_cast<FwAssertArgType>(portNum)
522  );
523 
524  return &this->m_comIn_InputPort[portNum];
525  }
526 
529  {
530  FW_ASSERT(
531  (0 <= portNum) && (portNum < this->getNum_pingIn_InputPorts()),
532  static_cast<FwAssertArgType>(portNum)
533  );
534 
535  return &this->m_pingIn_InputPort[portNum];
536  }
537 
540  {
541  FW_ASSERT(
542  (0 <= portNum) && (portNum < this->getNum_schedIn_InputPorts()),
543  static_cast<FwAssertArgType>(portNum)
544  );
545 
546  return &this->m_schedIn_InputPort[portNum];
547  }
548 
551  {
552  FW_ASSERT(
553  (0 <= portNum) && (portNum < this->getNum_startRecordingIn_InputPorts()),
554  static_cast<FwAssertArgType>(portNum)
555  );
556 
557  return &this->m_startRecordingIn_InputPort[portNum];
558  }
559 
562  {
563  FW_ASSERT(
564  (0 <= portNum) && (portNum < this->getNum_stopRecordingIn_InputPorts()),
565  static_cast<FwAssertArgType>(portNum)
566  );
567 
568  return &this->m_stopRecordingIn_InputPort[portNum];
569  }
570 
571 #endif
572 
573 #if !FW_DIRECT_PORT_CALLS
574 
575  // ----------------------------------------------------------------------
576  // Connect input ports to special output ports
577  // ----------------------------------------------------------------------
578 
579 #if FW_ENABLE_TEXT_LOGGING == 1
580 
581  void ComLoggerDpComponentBase ::
582  set_LogText_OutputPort(
583  FwIndexType portNum,
585  )
586  {
587  FW_ASSERT(
588  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
589  static_cast<FwAssertArgType>(portNum)
590  );
591 
592  this->m_LogText_OutputPort[portNum].addCallPort(port);
593  }
594 
595 #endif
596 
599  FwIndexType portNum,
600  Fw::InputCmdRegPort* port
601  )
602  {
603  FW_ASSERT(
604  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
605  static_cast<FwAssertArgType>(portNum)
606  );
607 
608  this->m_cmdRegOut_OutputPort[portNum].addCallPort(port);
609  }
610 
613  FwIndexType portNum,
615  )
616  {
617  FW_ASSERT(
618  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
619  static_cast<FwAssertArgType>(portNum)
620  );
621 
622  this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port);
623  }
624 
627  FwIndexType portNum,
628  Fw::InputLogPort* port
629  )
630  {
631  FW_ASSERT(
632  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
633  static_cast<FwAssertArgType>(portNum)
634  );
635 
636  this->m_logOut_OutputPort[portNum].addCallPort(port);
637  }
638 
641  FwIndexType portNum,
642  Fw::InputDpGetPort* port
643  )
644  {
645  FW_ASSERT(
646  (0 <= portNum) && (portNum < this->getNum_productGetOut_OutputPorts()),
647  static_cast<FwAssertArgType>(portNum)
648  );
649 
650  this->m_productGetOut_OutputPort[portNum].addCallPort(port);
651  }
652 
655  FwIndexType portNum,
656  Fw::InputDpSendPort* port
657  )
658  {
659  FW_ASSERT(
660  (0 <= portNum) && (portNum < this->getNum_productSendOut_OutputPorts()),
661  static_cast<FwAssertArgType>(portNum)
662  );
663 
664  this->m_productSendOut_OutputPort[portNum].addCallPort(port);
665  }
666 
669  FwIndexType portNum,
670  Fw::InputTimePort* port
671  )
672  {
673  FW_ASSERT(
674  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
675  static_cast<FwAssertArgType>(portNum)
676  );
677 
678  this->m_timeCaller_OutputPort[portNum].addCallPort(port);
679  }
680 
683  FwIndexType portNum,
684  Fw::InputTlmPort* port
685  )
686  {
687  FW_ASSERT(
688  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
689  static_cast<FwAssertArgType>(portNum)
690  );
691 
692  this->m_tlmOut_OutputPort[portNum].addCallPort(port);
693  }
694 
695 #endif
696 
697 #if !FW_DIRECT_PORT_CALLS
698 
699  // ----------------------------------------------------------------------
700  // Connect typed input ports to typed output ports
701  // ----------------------------------------------------------------------
702 
705  FwIndexType portNum,
706  Svc::InputPingPort* port
707  )
708  {
709  FW_ASSERT(
710  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
711  static_cast<FwAssertArgType>(portNum)
712  );
713 
714  this->m_pingOut_OutputPort[portNum].addCallPort(port);
715  }
716 
717 #endif
718 
719 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
720 
721  // ----------------------------------------------------------------------
722  // Connect serial input ports to special output ports
723  // ----------------------------------------------------------------------
724 
725 #if FW_ENABLE_TEXT_LOGGING == 1
726 
727  void ComLoggerDpComponentBase ::
728  set_LogText_OutputPort(
729  FwIndexType portNum,
730  Fw::InputSerializePort* port
731  )
732  {
733  FW_ASSERT(
734  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
735  static_cast<FwAssertArgType>(portNum)
736  );
737 
738  this->m_LogText_OutputPort[portNum].registerSerialPort(port);
739  }
740 
741 #endif
742 
745  FwIndexType portNum,
746  Fw::InputSerializePort* port
747  )
748  {
749  FW_ASSERT(
750  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
751  static_cast<FwAssertArgType>(portNum)
752  );
753 
754  this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port);
755  }
756 
759  FwIndexType portNum,
760  Fw::InputSerializePort* port
761  )
762  {
763  FW_ASSERT(
764  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
765  static_cast<FwAssertArgType>(portNum)
766  );
767 
768  this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port);
769  }
770 
773  FwIndexType portNum,
774  Fw::InputSerializePort* port
775  )
776  {
777  FW_ASSERT(
778  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
779  static_cast<FwAssertArgType>(portNum)
780  );
781 
782  this->m_logOut_OutputPort[portNum].registerSerialPort(port);
783  }
784 
787  FwIndexType portNum,
788  Fw::InputSerializePort* port
789  )
790  {
791  FW_ASSERT(
792  (0 <= portNum) && (portNum < this->getNum_productSendOut_OutputPorts()),
793  static_cast<FwAssertArgType>(portNum)
794  );
795 
796  this->m_productSendOut_OutputPort[portNum].registerSerialPort(port);
797  }
798 
801  FwIndexType portNum,
802  Fw::InputSerializePort* port
803  )
804  {
805  FW_ASSERT(
806  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
807  static_cast<FwAssertArgType>(portNum)
808  );
809 
810  this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
811  }
812 
815  FwIndexType portNum,
816  Fw::InputSerializePort* port
817  )
818  {
819  FW_ASSERT(
820  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
821  static_cast<FwAssertArgType>(portNum)
822  );
823 
824  this->m_tlmOut_OutputPort[portNum].registerSerialPort(port);
825  }
826 
827 #endif
828 
829 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
830 
831  // ----------------------------------------------------------------------
832  // Connect serial input ports to typed output ports
833  // ----------------------------------------------------------------------
834 
837  FwIndexType portNum,
838  Fw::InputSerializePort* port
839  )
840  {
841  FW_ASSERT(
842  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
843  static_cast<FwAssertArgType>(portNum)
844  );
845 
846  this->m_pingOut_OutputPort[portNum].registerSerialPort(port);
847  }
848 
849 #endif
850 
851  // ----------------------------------------------------------------------
852  // Command registration
853  // ----------------------------------------------------------------------
854 
857  {
859 
860  this->cmdRegOut_out(
861  0,
862  this->getIdBase() + OPCODE_STARTCOMDP
863  );
864 
865  this->cmdRegOut_out(
866  0,
868  );
869 
870  this->cmdRegOut_out(
871  0,
872  this->getIdBase() + OPCODE_STOPCOMDP
873  );
874 
875  this->cmdRegOut_out(
876  0,
878  );
879  }
880 
881  // ----------------------------------------------------------------------
882  // Component construction and destruction
883  // ----------------------------------------------------------------------
884 
886  ComLoggerDpComponentBase(const char* compName) :
887  Fw::ActiveComponentBase(compName)
888  {
889  this->m_DpBufferErrorThrottle = 0;
890  }
891 
894  {
895 
896  }
897 
898 #if !FW_DIRECT_PORT_CALLS
899 
900  // ----------------------------------------------------------------------
901  // Connection status queries for special output ports
902  // ----------------------------------------------------------------------
903 
904 #if FW_ENABLE_TEXT_LOGGING == 1
905 
906  bool ComLoggerDpComponentBase ::
907  isConnected_LogText_OutputPort(FwIndexType portNum) const
908  {
909  FW_ASSERT(
910  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
911  static_cast<FwAssertArgType>(portNum)
912  );
913 
914  return this->m_LogText_OutputPort[portNum].isConnected();
915  }
916 
917 #endif
918 
921  {
922  FW_ASSERT(
923  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
924  static_cast<FwAssertArgType>(portNum)
925  );
926 
927  return this->m_cmdRegOut_OutputPort[portNum].isConnected();
928  }
929 
932  {
933  FW_ASSERT(
934  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
935  static_cast<FwAssertArgType>(portNum)
936  );
937 
938  return this->m_cmdResponseOut_OutputPort[portNum].isConnected();
939  }
940 
943  {
944  FW_ASSERT(
945  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
946  static_cast<FwAssertArgType>(portNum)
947  );
948 
949  return this->m_logOut_OutputPort[portNum].isConnected();
950  }
951 
954  {
955  FW_ASSERT(
956  (0 <= portNum) && (portNum < this->getNum_productGetOut_OutputPorts()),
957  static_cast<FwAssertArgType>(portNum)
958  );
959 
960  return this->m_productGetOut_OutputPort[portNum].isConnected();
961  }
962 
965  {
966  FW_ASSERT(
967  (0 <= portNum) && (portNum < this->getNum_productSendOut_OutputPorts()),
968  static_cast<FwAssertArgType>(portNum)
969  );
970 
971  return this->m_productSendOut_OutputPort[portNum].isConnected();
972  }
973 
976  {
977  FW_ASSERT(
978  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
979  static_cast<FwAssertArgType>(portNum)
980  );
981 
982  return this->m_timeCaller_OutputPort[portNum].isConnected();
983  }
984 
987  {
988  FW_ASSERT(
989  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
990  static_cast<FwAssertArgType>(portNum)
991  );
992 
993  return this->m_tlmOut_OutputPort[portNum].isConnected();
994  }
995 
996 #endif
997 
998 #if !FW_DIRECT_PORT_CALLS
999 
1000  // ----------------------------------------------------------------------
1001  // Connection status queries for typed output ports
1002  // ----------------------------------------------------------------------
1003 
1006  {
1007  FW_ASSERT(
1008  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
1009  static_cast<FwAssertArgType>(portNum)
1010  );
1011 
1012  return this->m_pingOut_OutputPort[portNum].isConnected();
1013  }
1014 
1015 #endif
1016 
1017  // ----------------------------------------------------------------------
1018  // Port handler base-class functions for special input ports
1019  //
1020  // Call these functions directly to bypass the corresponding ports
1021  // ----------------------------------------------------------------------
1022 
1025  FwIndexType portNum,
1026  FwOpcodeType opCode,
1027  U32 cmdSeq,
1028  Fw::CmdArgBuffer& args
1029  )
1030  {
1031 
1032  const U32 idBase = this->getIdBase();
1033  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
1034 
1035  // Select base class function based on opcode
1036  switch (opCode - idBase) {
1037  case OPCODE_STARTCOMDP: {
1039  opCode,
1040  cmdSeq,
1041  args
1042  );
1043  break;
1044  }
1045 
1046  case OPCODE_UPDATEPRIORITY: {
1048  opCode,
1049  cmdSeq,
1050  args
1051  );
1052  break;
1053  }
1054 
1055  case OPCODE_STOPCOMDP: {
1057  opCode,
1058  cmdSeq,
1059  args
1060  );
1061  break;
1062  }
1063 
1064  case OPCODE_CLEAR_COUNTERS: {
1066  opCode,
1067  cmdSeq,
1068  args
1069  );
1070  break;
1071  }
1072  default:
1073  // Unknown opcode: ignore it
1074  break;
1075  }
1076  }
1077 
1078  // ----------------------------------------------------------------------
1079  // Port handler base-class functions for typed input ports
1080  //
1081  // Call these functions directly to bypass the corresponding ports
1082  // ----------------------------------------------------------------------
1083 
1086  FwIndexType portNum,
1087  Fw::ComBuffer& data,
1088  U32 context
1089  )
1090  {
1091  // Make sure port number is valid
1092  FW_ASSERT(
1093  (0 <= portNum) && (portNum < this->getNum_comIn_InputPorts()),
1094  static_cast<FwAssertArgType>(portNum)
1095  );
1096 
1097  // Call pre-message hook
1099  portNum,
1100  data,
1101  context
1102  );
1103  ComponentIpcSerializableBuffer msg;
1105 
1106  // Serialize message ID
1107  _status = msg.serializeFrom(
1108  static_cast<FwEnumStoreType>(COMIN_COM)
1109  );
1110  FW_ASSERT(
1111  _status == Fw::FW_SERIALIZE_OK,
1112  static_cast<FwAssertArgType>(_status)
1113  );
1114 
1115  // Serialize port number
1116  _status = msg.serializeFrom(portNum);
1117  FW_ASSERT(
1118  _status == Fw::FW_SERIALIZE_OK,
1119  static_cast<FwAssertArgType>(_status)
1120  );
1121 
1122  // Serialize argument data
1123  _status = msg.serializeFrom(data);
1124  FW_ASSERT(
1125  _status == Fw::FW_SERIALIZE_OK,
1126  static_cast<FwAssertArgType>(_status)
1127  );
1128 
1129  // Serialize argument context
1130  _status = msg.serializeFrom(context);
1131  FW_ASSERT(
1132  _status == Fw::FW_SERIALIZE_OK,
1133  static_cast<FwAssertArgType>(_status)
1134  );
1135 
1136  // Send message
1138  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1139 
1140  if (qStatus == Os::Queue::Status::FULL) {
1141  this->incNumMsgDropped();
1142  return;
1143  }
1144 
1145  FW_ASSERT(
1146  qStatus == Os::Queue::OP_OK,
1147  static_cast<FwAssertArgType>(qStatus)
1148  );
1149  }
1150 
1153  FwIndexType portNum,
1154  U32 key
1155  )
1156  {
1157  // Make sure port number is valid
1158  FW_ASSERT(
1159  (0 <= portNum) && (portNum < this->getNum_pingIn_InputPorts()),
1160  static_cast<FwAssertArgType>(portNum)
1161  );
1162 
1163  // Call pre-message hook
1165  portNum,
1166  key
1167  );
1168  ComponentIpcSerializableBuffer msg;
1170 
1171  // Serialize message ID
1172  _status = msg.serializeFrom(
1173  static_cast<FwEnumStoreType>(PINGIN_PING)
1174  );
1175  FW_ASSERT(
1176  _status == Fw::FW_SERIALIZE_OK,
1177  static_cast<FwAssertArgType>(_status)
1178  );
1179 
1180  // Serialize port number
1181  _status = msg.serializeFrom(portNum);
1182  FW_ASSERT(
1183  _status == Fw::FW_SERIALIZE_OK,
1184  static_cast<FwAssertArgType>(_status)
1185  );
1186 
1187  // Serialize argument key
1188  _status = msg.serializeFrom(key);
1189  FW_ASSERT(
1190  _status == Fw::FW_SERIALIZE_OK,
1191  static_cast<FwAssertArgType>(_status)
1192  );
1193 
1194  // Send message
1196  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1197 
1198  FW_ASSERT(
1199  qStatus == Os::Queue::OP_OK,
1200  static_cast<FwAssertArgType>(qStatus)
1201  );
1202  }
1203 
1206  FwIndexType portNum,
1207  U32 context
1208  )
1209  {
1210  // Make sure port number is valid
1211  FW_ASSERT(
1212  (0 <= portNum) && (portNum < this->getNum_schedIn_InputPorts()),
1213  static_cast<FwAssertArgType>(portNum)
1214  );
1215 
1216  // Call pre-message hook
1218  portNum,
1219  context
1220  );
1221  ComponentIpcSerializableBuffer msg;
1223 
1224  // Serialize message ID
1225  _status = msg.serializeFrom(
1226  static_cast<FwEnumStoreType>(SCHEDIN_SCHED)
1227  );
1228  FW_ASSERT(
1229  _status == Fw::FW_SERIALIZE_OK,
1230  static_cast<FwAssertArgType>(_status)
1231  );
1232 
1233  // Serialize port number
1234  _status = msg.serializeFrom(portNum);
1235  FW_ASSERT(
1236  _status == Fw::FW_SERIALIZE_OK,
1237  static_cast<FwAssertArgType>(_status)
1238  );
1239 
1240  // Serialize argument context
1241  _status = msg.serializeFrom(context);
1242  FW_ASSERT(
1243  _status == Fw::FW_SERIALIZE_OK,
1244  static_cast<FwAssertArgType>(_status)
1245  );
1246 
1247  // Send message
1249  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1250 
1251  FW_ASSERT(
1252  qStatus == Os::Queue::OP_OK,
1253  static_cast<FwAssertArgType>(qStatus)
1254  );
1255  }
1256 
1259  FwIndexType portNum,
1260  FwSizeType packetsPerContainer,
1261  FwDpPriorityType priority
1262  )
1263  {
1264  // Make sure port number is valid
1265  FW_ASSERT(
1266  (0 <= portNum) && (portNum < this->getNum_startRecordingIn_InputPorts()),
1267  static_cast<FwAssertArgType>(portNum)
1268  );
1269 
1270  // Call pre-message hook
1272  portNum,
1273  packetsPerContainer,
1274  priority
1275  );
1276  ComponentIpcSerializableBuffer msg;
1278 
1279  // Serialize message ID
1280  _status = msg.serializeFrom(
1281  static_cast<FwEnumStoreType>(STARTRECORDINGIN_COMLOGGERSTART)
1282  );
1283  FW_ASSERT(
1284  _status == Fw::FW_SERIALIZE_OK,
1285  static_cast<FwAssertArgType>(_status)
1286  );
1287 
1288  // Serialize port number
1289  _status = msg.serializeFrom(portNum);
1290  FW_ASSERT(
1291  _status == Fw::FW_SERIALIZE_OK,
1292  static_cast<FwAssertArgType>(_status)
1293  );
1294 
1295  // Serialize argument packetsPerContainer
1296  _status = msg.serializeFrom(packetsPerContainer);
1297  FW_ASSERT(
1298  _status == Fw::FW_SERIALIZE_OK,
1299  static_cast<FwAssertArgType>(_status)
1300  );
1301 
1302  // Serialize argument priority
1303  _status = msg.serializeFrom(priority);
1304  FW_ASSERT(
1305  _status == Fw::FW_SERIALIZE_OK,
1306  static_cast<FwAssertArgType>(_status)
1307  );
1308 
1309  // Send message
1311  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1312 
1313  FW_ASSERT(
1314  qStatus == Os::Queue::OP_OK,
1315  static_cast<FwAssertArgType>(qStatus)
1316  );
1317  }
1318 
1321  {
1322  // Make sure port number is valid
1323  FW_ASSERT(
1324  (0 <= portNum) && (portNum < this->getNum_stopRecordingIn_InputPorts()),
1325  static_cast<FwAssertArgType>(portNum)
1326  );
1327 
1328  // Call pre-message hook
1329  stopRecordingIn_preMsgHook(portNum);
1330  ComponentIpcSerializableBuffer msg;
1332 
1333  // Serialize message ID
1334  _status = msg.serializeFrom(
1335  static_cast<FwEnumStoreType>(STOPRECORDINGIN_COMLOGGERSTOP)
1336  );
1337  FW_ASSERT(
1338  _status == Fw::FW_SERIALIZE_OK,
1339  static_cast<FwAssertArgType>(_status)
1340  );
1341 
1342  // Serialize port number
1343  _status = msg.serializeFrom(portNum);
1344  FW_ASSERT(
1345  _status == Fw::FW_SERIALIZE_OK,
1346  static_cast<FwAssertArgType>(_status)
1347  );
1348 
1349  // Send message
1351  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1352 
1353  FW_ASSERT(
1354  qStatus == Os::Queue::OP_OK,
1355  static_cast<FwAssertArgType>(qStatus)
1356  );
1357  }
1358 
1359  // ----------------------------------------------------------------------
1360  // Pre-message hooks for typed async input ports
1361  //
1362  // Each of these functions is invoked just before processing a message
1363  // on the corresponding port. By default, they do nothing. You can
1364  // override them to provide specific pre-message behavior.
1365  // ----------------------------------------------------------------------
1366 
1369  FwIndexType portNum,
1370  Fw::ComBuffer& data,
1371  U32 context
1372  )
1373  {
1374  // Default: no-op
1375  }
1376 
1379  FwIndexType portNum,
1380  U32 key
1381  )
1382  {
1383  // Default: no-op
1384  }
1385 
1388  FwIndexType portNum,
1389  U32 context
1390  )
1391  {
1392  // Default: no-op
1393  }
1394 
1397  FwIndexType portNum,
1398  FwSizeType packetsPerContainer,
1399  FwDpPriorityType priority
1400  )
1401  {
1402  // Default: no-op
1403  }
1404 
1407  {
1408  // Default: no-op
1409  }
1410 
1411 #if !FW_DIRECT_PORT_CALLS
1412 
1413  // ----------------------------------------------------------------------
1414  // Invocation functions for typed output ports
1415  // ----------------------------------------------------------------------
1416 
1419  FwIndexType portNum,
1420  U32 key
1421  ) const
1422  {
1423  FW_ASSERT(
1424  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
1425  static_cast<FwAssertArgType>(portNum)
1426  );
1427 
1428  FW_ASSERT(
1429  this->m_pingOut_OutputPort[portNum].isConnected(),
1430  static_cast<FwAssertArgType>(portNum)
1431  );
1432  this->m_pingOut_OutputPort[portNum].invoke(
1433  key
1434  );
1435  }
1436 
1437 #endif
1438 
1439  // ----------------------------------------------------------------------
1440  // Command response
1441  // ----------------------------------------------------------------------
1442 
1445  FwOpcodeType opCode,
1446  U32 cmdSeq,
1447  Fw::CmdResponse response
1448  )
1449  {
1451  this->cmdResponseOut_out(0, opCode, cmdSeq, response);
1452  }
1453 
1454  // ----------------------------------------------------------------------
1455  // Command handler base-class functions
1456  //
1457  // Call these functions directly to bypass the command input port
1458  // ----------------------------------------------------------------------
1459 
1462  FwOpcodeType opCode,
1463  U32 cmdSeq,
1464  Fw::CmdArgBuffer& args
1465  )
1466  {
1467  // Call pre-message hook
1468  this->StartComDp_preMsgHook(opCode,cmdSeq);
1469 
1470  // Defer deserializing arguments to the message dispatcher
1471  // to avoid deserializing and reserializing just for IPC
1472  ComponentIpcSerializableBuffer msg;
1474 
1475  // Serialize for IPC
1476  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_STARTCOMDP));
1477  FW_ASSERT (
1478  _status == Fw::FW_SERIALIZE_OK,
1479  static_cast<FwAssertArgType>(_status)
1480  );
1481 
1482  // Fake port number to make message dequeue work
1483  FwIndexType port = 0;
1484 
1485  _status = msg.serializeFrom(port);
1486  FW_ASSERT (
1487  _status == Fw::FW_SERIALIZE_OK,
1488  static_cast<FwAssertArgType>(_status)
1489  );
1490 
1491  _status = msg.serializeFrom(opCode);
1492  FW_ASSERT (
1493  _status == Fw::FW_SERIALIZE_OK,
1494  static_cast<FwAssertArgType>(_status)
1495  );
1496 
1497  _status = msg.serializeFrom(cmdSeq);
1498  FW_ASSERT (
1499  _status == Fw::FW_SERIALIZE_OK,
1500  static_cast<FwAssertArgType>(_status)
1501  );
1502 
1503  _status = msg.serializeFrom(args);
1504  FW_ASSERT (
1505  _status == Fw::FW_SERIALIZE_OK,
1506  static_cast<FwAssertArgType>(_status)
1507  );
1508 
1509  // Send message
1511  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1512 
1513  FW_ASSERT(
1514  qStatus == Os::Queue::OP_OK,
1515  static_cast<FwAssertArgType>(qStatus)
1516  );
1517  }
1518 
1521  FwOpcodeType opCode,
1522  U32 cmdSeq,
1523  Fw::CmdArgBuffer& args
1524  )
1525  {
1526  // Call pre-message hook
1527  this->UpdatePriority_preMsgHook(opCode,cmdSeq);
1528 
1529  // Defer deserializing arguments to the message dispatcher
1530  // to avoid deserializing and reserializing just for IPC
1531  ComponentIpcSerializableBuffer msg;
1533 
1534  // Serialize for IPC
1535  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_UPDATEPRIORITY));
1536  FW_ASSERT (
1537  _status == Fw::FW_SERIALIZE_OK,
1538  static_cast<FwAssertArgType>(_status)
1539  );
1540 
1541  // Fake port number to make message dequeue work
1542  FwIndexType port = 0;
1543 
1544  _status = msg.serializeFrom(port);
1545  FW_ASSERT (
1546  _status == Fw::FW_SERIALIZE_OK,
1547  static_cast<FwAssertArgType>(_status)
1548  );
1549 
1550  _status = msg.serializeFrom(opCode);
1551  FW_ASSERT (
1552  _status == Fw::FW_SERIALIZE_OK,
1553  static_cast<FwAssertArgType>(_status)
1554  );
1555 
1556  _status = msg.serializeFrom(cmdSeq);
1557  FW_ASSERT (
1558  _status == Fw::FW_SERIALIZE_OK,
1559  static_cast<FwAssertArgType>(_status)
1560  );
1561 
1562  _status = msg.serializeFrom(args);
1563  FW_ASSERT (
1564  _status == Fw::FW_SERIALIZE_OK,
1565  static_cast<FwAssertArgType>(_status)
1566  );
1567 
1568  // Send message
1570  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1571 
1572  FW_ASSERT(
1573  qStatus == Os::Queue::OP_OK,
1574  static_cast<FwAssertArgType>(qStatus)
1575  );
1576  }
1577 
1580  FwOpcodeType opCode,
1581  U32 cmdSeq,
1582  Fw::CmdArgBuffer& args
1583  )
1584  {
1585  // Call pre-message hook
1586  this->StopComDp_preMsgHook(opCode,cmdSeq);
1587 
1588  // Defer deserializing arguments to the message dispatcher
1589  // to avoid deserializing and reserializing just for IPC
1590  ComponentIpcSerializableBuffer msg;
1592 
1593  // Serialize for IPC
1594  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_STOPCOMDP));
1595  FW_ASSERT (
1596  _status == Fw::FW_SERIALIZE_OK,
1597  static_cast<FwAssertArgType>(_status)
1598  );
1599 
1600  // Fake port number to make message dequeue work
1601  FwIndexType port = 0;
1602 
1603  _status = msg.serializeFrom(port);
1604  FW_ASSERT (
1605  _status == Fw::FW_SERIALIZE_OK,
1606  static_cast<FwAssertArgType>(_status)
1607  );
1608 
1609  _status = msg.serializeFrom(opCode);
1610  FW_ASSERT (
1611  _status == Fw::FW_SERIALIZE_OK,
1612  static_cast<FwAssertArgType>(_status)
1613  );
1614 
1615  _status = msg.serializeFrom(cmdSeq);
1616  FW_ASSERT (
1617  _status == Fw::FW_SERIALIZE_OK,
1618  static_cast<FwAssertArgType>(_status)
1619  );
1620 
1621  _status = msg.serializeFrom(args);
1622  FW_ASSERT (
1623  _status == Fw::FW_SERIALIZE_OK,
1624  static_cast<FwAssertArgType>(_status)
1625  );
1626 
1627  // Send message
1629  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1630 
1631  FW_ASSERT(
1632  qStatus == Os::Queue::OP_OK,
1633  static_cast<FwAssertArgType>(qStatus)
1634  );
1635  }
1636 
1639  FwOpcodeType opCode,
1640  U32 cmdSeq,
1641  Fw::CmdArgBuffer& args
1642  )
1643  {
1644  // Call pre-message hook
1645  this->CLEAR_COUNTERS_preMsgHook(opCode,cmdSeq);
1646 
1647  // Defer deserializing arguments to the message dispatcher
1648  // to avoid deserializing and reserializing just for IPC
1649  ComponentIpcSerializableBuffer msg;
1651 
1652  // Serialize for IPC
1653  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_CLEAR_COUNTERS));
1654  FW_ASSERT (
1655  _status == Fw::FW_SERIALIZE_OK,
1656  static_cast<FwAssertArgType>(_status)
1657  );
1658 
1659  // Fake port number to make message dequeue work
1660  FwIndexType port = 0;
1661 
1662  _status = msg.serializeFrom(port);
1663  FW_ASSERT (
1664  _status == Fw::FW_SERIALIZE_OK,
1665  static_cast<FwAssertArgType>(_status)
1666  );
1667 
1668  _status = msg.serializeFrom(opCode);
1669  FW_ASSERT (
1670  _status == Fw::FW_SERIALIZE_OK,
1671  static_cast<FwAssertArgType>(_status)
1672  );
1673 
1674  _status = msg.serializeFrom(cmdSeq);
1675  FW_ASSERT (
1676  _status == Fw::FW_SERIALIZE_OK,
1677  static_cast<FwAssertArgType>(_status)
1678  );
1679 
1680  _status = msg.serializeFrom(args);
1681  FW_ASSERT (
1682  _status == Fw::FW_SERIALIZE_OK,
1683  static_cast<FwAssertArgType>(_status)
1684  );
1685 
1686  // Send message
1688  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1689 
1690  FW_ASSERT(
1691  qStatus == Os::Queue::OP_OK,
1692  static_cast<FwAssertArgType>(qStatus)
1693  );
1694  }
1695 
1696  // ----------------------------------------------------------------------
1697  // Pre-message hooks for async commands
1698  //
1699  // Each of these functions is invoked just before processing the
1700  // corresponding command. By default they do nothing. You can
1701  // override them to provide specific pre-command behavior.
1702  // ----------------------------------------------------------------------
1703 
1706  FwOpcodeType opCode,
1707  U32 cmdSeq
1708  )
1709  {
1710  // Defaults to no-op; can be overridden
1711  (void) opCode;
1712  (void) cmdSeq;
1713  }
1714 
1717  FwOpcodeType opCode,
1718  U32 cmdSeq
1719  )
1720  {
1721  // Defaults to no-op; can be overridden
1722  (void) opCode;
1723  (void) cmdSeq;
1724  }
1725 
1728  FwOpcodeType opCode,
1729  U32 cmdSeq
1730  )
1731  {
1732  // Defaults to no-op; can be overridden
1733  (void) opCode;
1734  (void) cmdSeq;
1735  }
1736 
1739  FwOpcodeType opCode,
1740  U32 cmdSeq
1741  )
1742  {
1743  // Defaults to no-op; can be overridden
1744  (void) opCode;
1745  (void) cmdSeq;
1746  }
1747 
1748  // ----------------------------------------------------------------------
1749  // Event logging functions
1750  // ----------------------------------------------------------------------
1751 
1754  {
1755  // Check throttle value
1756  if (this->m_DpBufferErrorThrottle >= EVENTID_DPBUFFERERROR_THROTTLE) {
1757  return;
1758  }
1759  else {
1760  this->m_DpBufferErrorThrottle++;
1761  }
1762 
1763  // Get the time
1764  Fw::Time _logTime;
1765  if (this->isConnected_timeCaller_OutputPort(0)) {
1766  this->timeCaller_out(0, _logTime);
1767  }
1768 
1769  const FwEventIdType _id = this->getIdBase() + EVENTID_DPBUFFERERROR;
1770 
1771  // Emit the event on the log port
1772  if (this->isConnected_logOut_OutputPort(0)) {
1773  Fw::LogBuffer _logBuff;
1775 
1776 #if FW_AMPCS_COMPATIBLE
1777  // Serialize the number of arguments
1778  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1779  FW_ASSERT(
1780  _status == Fw::FW_SERIALIZE_OK,
1781  static_cast<FwAssertArgType>(_status)
1782  );
1783 #endif
1784 
1785 #if FW_AMPCS_COMPATIBLE
1786  // Serialize the argument size
1787  _status = _logBuff.serializeFrom(
1788  static_cast<U8>(sizeof(U32))
1789  );
1790  FW_ASSERT(
1791  _status == Fw::FW_SERIALIZE_OK,
1792  static_cast<FwAssertArgType>(_status)
1793  );
1794 #endif
1795  _status = _logBuff.serializeFrom(size);
1796  FW_ASSERT(
1797  _status == Fw::FW_SERIALIZE_OK,
1798  static_cast<FwAssertArgType>(_status)
1799  );
1800 
1801  this->logOut_out(
1802  0,
1803  _id,
1804  _logTime,
1806  _logBuff
1807  );
1808  }
1809 
1810  // Emit the event on the text log port
1811 #if FW_ENABLE_TEXT_LOGGING
1812  if (this->isConnected_LogText_OutputPort(0)) {
1813 #if FW_OBJECT_NAMES == 1
1814  const char* _formatString =
1815  "(%s) %s: Error getting ComDp buffer of size %" PRIu32 "";
1816 #else
1817  const char* _formatString =
1818  "%s: Error getting ComDp buffer of size %" PRIu32 "";
1819 #endif
1820 
1821  Fw::TextLogString _logString;
1822  (void) _logString.format(
1823  _formatString,
1824 #if FW_OBJECT_NAMES == 1
1825  this->m_objName.toChar(),
1826 #endif
1827  "DpBufferError ",
1828  size
1829  );
1830 
1831  this->LogText_out(
1832  0,
1833  _id,
1834  _logTime,
1836  _logString
1837  );
1838  }
1839 #endif
1840  }
1841 
1843  log_ACTIVITY_HI_ComDpStarted(FwSizeType packetsPerContainer) const
1844  {
1845  // Get the time
1846  Fw::Time _logTime;
1847  if (this->isConnected_timeCaller_OutputPort(0)) {
1848  this->timeCaller_out(0, _logTime);
1849  }
1850 
1851  const FwEventIdType _id = this->getIdBase() + EVENTID_COMDPSTARTED;
1852 
1853  // Emit the event on the log port
1854  if (this->isConnected_logOut_OutputPort(0)) {
1855  Fw::LogBuffer _logBuff;
1857 
1858 #if FW_AMPCS_COMPATIBLE
1859  // Serialize the number of arguments
1860  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1861  FW_ASSERT(
1862  _status == Fw::FW_SERIALIZE_OK,
1863  static_cast<FwAssertArgType>(_status)
1864  );
1865 #endif
1866 
1867 #if FW_AMPCS_COMPATIBLE
1868  // Serialize the argument size
1869  _status = _logBuff.serializeFrom(
1870  static_cast<U8>(sizeof(FwSizeType))
1871  );
1872  FW_ASSERT(
1873  _status == Fw::FW_SERIALIZE_OK,
1874  static_cast<FwAssertArgType>(_status)
1875  );
1876 #endif
1877  _status = _logBuff.serializeFrom(packetsPerContainer);
1878  FW_ASSERT(
1879  _status == Fw::FW_SERIALIZE_OK,
1880  static_cast<FwAssertArgType>(_status)
1881  );
1882 
1883  this->logOut_out(
1884  0,
1885  _id,
1886  _logTime,
1888  _logBuff
1889  );
1890  }
1891 
1892  // Emit the event on the text log port
1893 #if FW_ENABLE_TEXT_LOGGING
1894  if (this->isConnected_LogText_OutputPort(0)) {
1895 #if FW_OBJECT_NAMES == 1
1896  const char* _formatString =
1897  "(%s) %s: Started Com DP logging: %" PRIu64 " packets per container";
1898 #else
1899  const char* _formatString =
1900  "%s: Started Com DP logging: %" PRIu64 " packets per container";
1901 #endif
1902 
1903  Fw::TextLogString _logString;
1904  (void) _logString.format(
1905  _formatString,
1906 #if FW_OBJECT_NAMES == 1
1907  this->m_objName.toChar(),
1908 #endif
1909  "ComDpStarted ",
1910  packetsPerContainer
1911  );
1912 
1913  this->LogText_out(
1914  0,
1915  _id,
1916  _logTime,
1918  _logString
1919  );
1920  }
1921 #endif
1922  }
1923 
1926  {
1927  // Get the time
1928  Fw::Time _logTime;
1929  if (this->isConnected_timeCaller_OutputPort(0)) {
1930  this->timeCaller_out(0, _logTime);
1931  }
1932 
1933  const FwEventIdType _id = this->getIdBase() + EVENTID_COMDPSTOPPED;
1934 
1935  // Emit the event on the log port
1936  if (this->isConnected_logOut_OutputPort(0)) {
1937  Fw::LogBuffer _logBuff;
1939 
1940 #if FW_AMPCS_COMPATIBLE
1941  // Serialize the number of arguments
1942  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1943  FW_ASSERT(
1944  _status == Fw::FW_SERIALIZE_OK,
1945  static_cast<FwAssertArgType>(_status)
1946  );
1947 #endif
1948 
1949 #if FW_AMPCS_COMPATIBLE
1950  // Serialize the argument size
1951  _status = _logBuff.serializeFrom(
1953  );
1954  FW_ASSERT(
1955  _status == Fw::FW_SERIALIZE_OK,
1956  static_cast<FwAssertArgType>(_status)
1957  );
1958 #endif
1959  _status = _logBuff.serializeFrom(partialContainer);
1960  FW_ASSERT(
1961  _status == Fw::FW_SERIALIZE_OK,
1962  static_cast<FwAssertArgType>(_status)
1963  );
1964 
1965  this->logOut_out(
1966  0,
1967  _id,
1968  _logTime,
1970  _logBuff
1971  );
1972  }
1973 
1974  // Emit the event on the text log port
1975 #if FW_ENABLE_TEXT_LOGGING
1976  if (this->isConnected_LogText_OutputPort(0)) {
1977 #if FW_OBJECT_NAMES == 1
1978  const char* _formatString =
1979  "(%s) %s: Stopped Com DP logging: partial container %s";
1980 #else
1981  const char* _formatString =
1982  "%s: Stopped Com DP logging: partial container %s";
1983 #endif
1984 
1985  Fw::String partialContainerStr;
1986  partialContainer.toString(partialContainerStr);
1987 
1988  Fw::TextLogString _logString;
1989  (void) _logString.format(
1990  _formatString,
1991 #if FW_OBJECT_NAMES == 1
1992  this->m_objName.toChar(),
1993 #endif
1994  "ComDpStopped ",
1995  partialContainerStr.toChar()
1996  );
1997 
1998  this->LogText_out(
1999  0,
2000  _id,
2001  _logTime,
2003  _logString
2004  );
2005  }
2006 #endif
2007  }
2008 
2011  {
2012  // Get the time
2013  Fw::Time _logTime;
2014  if (this->isConnected_timeCaller_OutputPort(0)) {
2015  this->timeCaller_out(0, _logTime);
2016  }
2017 
2018  const FwEventIdType _id = this->getIdBase() + EVENTID_PRIORITYUPDATED;
2019 
2020  // Emit the event on the log port
2021  if (this->isConnected_logOut_OutputPort(0)) {
2022  Fw::LogBuffer _logBuff;
2024 
2025 #if FW_AMPCS_COMPATIBLE
2026  // Serialize the number of arguments
2027  _status = _logBuff.serializeFrom(static_cast<U8>(1));
2028  FW_ASSERT(
2029  _status == Fw::FW_SERIALIZE_OK,
2030  static_cast<FwAssertArgType>(_status)
2031  );
2032 #endif
2033 
2034 #if FW_AMPCS_COMPATIBLE
2035  // Serialize the argument size
2036  _status = _logBuff.serializeFrom(
2037  static_cast<U8>(sizeof(FwDpPriorityType))
2038  );
2039  FW_ASSERT(
2040  _status == Fw::FW_SERIALIZE_OK,
2041  static_cast<FwAssertArgType>(_status)
2042  );
2043 #endif
2044  _status = _logBuff.serializeFrom(priority);
2045  FW_ASSERT(
2046  _status == Fw::FW_SERIALIZE_OK,
2047  static_cast<FwAssertArgType>(_status)
2048  );
2049 
2050  this->logOut_out(
2051  0,
2052  _id,
2053  _logTime,
2055  _logBuff
2056  );
2057  }
2058 
2059  // Emit the event on the text log port
2060 #if FW_ENABLE_TEXT_LOGGING
2061  if (this->isConnected_LogText_OutputPort(0)) {
2062 #if FW_OBJECT_NAMES == 1
2063  const char* _formatString =
2064  "(%s) %s: Updated Com DP priority to %" PRIu32 "";
2065 #else
2066  const char* _formatString =
2067  "%s: Updated Com DP priority to %" PRIu32 "";
2068 #endif
2069 
2070  Fw::TextLogString _logString;
2071  (void) _logString.format(
2072  _formatString,
2073 #if FW_OBJECT_NAMES == 1
2074  this->m_objName.toChar(),
2075 #endif
2076  "PriorityUpdated ",
2077  priority
2078  );
2079 
2080  this->LogText_out(
2081  0,
2082  _id,
2083  _logTime,
2085  _logString
2086  );
2087  }
2088 #endif
2089  }
2090 
2093  {
2094  // Get the time
2095  Fw::Time _logTime;
2096  if (this->isConnected_timeCaller_OutputPort(0)) {
2097  this->timeCaller_out(0, _logTime);
2098  }
2099 
2100  const FwEventIdType _id = this->getIdBase() + EVENTID_COUNTERSCLEARED;
2101 
2102  // Emit the event on the log port
2103  if (this->isConnected_logOut_OutputPort(0)) {
2104  Fw::LogBuffer _logBuff;
2105 
2106 #if FW_AMPCS_COMPATIBLE
2108  // Serialize the number of arguments
2109  _status = _logBuff.serializeFrom(static_cast<U8>(0));
2110  FW_ASSERT(
2111  _status == Fw::FW_SERIALIZE_OK,
2112  static_cast<FwAssertArgType>(_status)
2113  );
2114 #endif
2115 
2116  this->logOut_out(
2117  0,
2118  _id,
2119  _logTime,
2121  _logBuff
2122  );
2123  }
2124 
2125  // Emit the event on the text log port
2126 #if FW_ENABLE_TEXT_LOGGING
2127  if (this->isConnected_LogText_OutputPort(0)) {
2128 #if FW_OBJECT_NAMES == 1
2129  const char* _formatString =
2130  "(%s) %s: Cleared NumBuffersLogged counter and DpBufferError throttle";
2131 #else
2132  const char* _formatString =
2133  "%s: Cleared NumBuffersLogged counter and DpBufferError throttle";
2134 #endif
2135 
2136  Fw::TextLogString _logString;
2137  (void) _logString.format(
2138  _formatString,
2139 #if FW_OBJECT_NAMES == 1
2140  this->m_objName.toChar(),
2141 #endif
2142  "CountersCleared "
2143  );
2144 
2145  this->LogText_out(
2146  0,
2147  _id,
2148  _logTime,
2150  _logString
2151  );
2152  }
2153 #endif
2154  }
2155 
2158  {
2159  // Get the time
2160  Fw::Time _logTime;
2161  if (this->isConnected_timeCaller_OutputPort(0)) {
2162  this->timeCaller_out(0, _logTime);
2163  }
2164 
2166 
2167  // Emit the event on the log port
2168  if (this->isConnected_logOut_OutputPort(0)) {
2169  Fw::LogBuffer _logBuff;
2171 
2172 #if FW_AMPCS_COMPATIBLE
2173  // Serialize the number of arguments
2174  _status = _logBuff.serializeFrom(static_cast<U8>(1));
2175  FW_ASSERT(
2176  _status == Fw::FW_SERIALIZE_OK,
2177  static_cast<FwAssertArgType>(_status)
2178  );
2179 #endif
2180 
2181 #if FW_AMPCS_COMPATIBLE
2182  // Serialize the argument size
2183  _status = _logBuff.serializeFrom(
2184  static_cast<U8>(sizeof(FwSizeType))
2185  );
2186  FW_ASSERT(
2187  _status == Fw::FW_SERIALIZE_OK,
2188  static_cast<FwAssertArgType>(_status)
2189  );
2190 #endif
2191  _status = _logBuff.serializeFrom(packetsPerContainer);
2192  FW_ASSERT(
2193  _status == Fw::FW_SERIALIZE_OK,
2194  static_cast<FwAssertArgType>(_status)
2195  );
2196 
2197  this->logOut_out(
2198  0,
2199  _id,
2200  _logTime,
2202  _logBuff
2203  );
2204  }
2205 
2206  // Emit the event on the text log port
2207 #if FW_ENABLE_TEXT_LOGGING
2208  if (this->isConnected_LogText_OutputPort(0)) {
2209 #if FW_OBJECT_NAMES == 1
2210  const char* _formatString =
2211  "(%s) %s: Failed to start Com DP recording: packetsPerContainer %" PRIu64 " is invalid (must be > 0)";
2212 #else
2213  const char* _formatString =
2214  "%s: Failed to start Com DP recording: packetsPerContainer %" PRIu64 " is invalid (must be > 0)";
2215 #endif
2216 
2217  Fw::TextLogString _logString;
2218  (void) _logString.format(
2219  _formatString,
2220 #if FW_OBJECT_NAMES == 1
2221  this->m_objName.toChar(),
2222 #endif
2223  "StartRecordingFailed ",
2224  packetsPerContainer
2225  );
2226 
2227  this->LogText_out(
2228  0,
2229  _id,
2230  _logTime,
2232  _logString
2233  );
2234  }
2235 #endif
2236  }
2237 
2238  // ----------------------------------------------------------------------
2239  // Event throttle reset functions
2240  // ----------------------------------------------------------------------
2241 
2244  {
2245  // Reset throttle counter
2246  this->m_DpBufferErrorThrottle = 0;
2247  }
2248 
2249  // ----------------------------------------------------------------------
2250  // Telemetry serialized write
2251  // ----------------------------------------------------------------------
2252 
2255  FwChanIdType id,
2256  Fw::TlmBuffer& _tlmBuff,
2257  Fw::Time _tlmTime
2258  ) const
2259  {
2260  if (this->isConnected_tlmOut_OutputPort(0)) {
2261  if (
2263  (_tlmTime == Fw::ZERO_TIME)
2264  ) {
2265  this->timeCaller_out(0, _tlmTime);
2266  }
2267 
2268  FwChanIdType _id;
2269  _id = this->getIdBase() + id;
2270 
2271  this->tlmOut_out(
2272  0,
2273  _id,
2274  _tlmTime,
2275  _tlmBuff
2276  );
2277  }
2278  }
2279 
2280  // ----------------------------------------------------------------------
2281  // Telemetry write functions
2282  // ----------------------------------------------------------------------
2283 
2286  bool arg,
2287  Fw::Time _tlmTime
2288  ) const
2289  {
2290  if (this->isConnected_tlmOut_OutputPort(0)) {
2291  Fw::TlmBuffer _tlmBuff;
2292  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
2293  FW_ASSERT(
2294  _stat == Fw::FW_SERIALIZE_OK,
2295  static_cast<FwAssertArgType>(_stat)
2296  );
2297 
2298  this->tlmWrite(
2300  _tlmBuff,
2301  _tlmTime
2302  );
2303  }
2304  }
2305 
2308  U32 arg,
2309  Fw::Time _tlmTime
2310  ) const
2311  {
2312  if (this->isConnected_tlmOut_OutputPort(0)) {
2313  Fw::TlmBuffer _tlmBuff;
2314  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
2315  FW_ASSERT(
2316  _stat == Fw::FW_SERIALIZE_OK,
2317  static_cast<FwAssertArgType>(_stat)
2318  );
2319 
2320  this->tlmWrite(
2322  _tlmBuff,
2323  _tlmTime
2324  );
2325  }
2326  }
2327 
2330  U32 arg,
2331  Fw::Time _tlmTime
2332  ) const
2333  {
2334  if (this->isConnected_tlmOut_OutputPort(0)) {
2335  Fw::TlmBuffer _tlmBuff;
2336  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
2337  FW_ASSERT(
2338  _stat == Fw::FW_SERIALIZE_OK,
2339  static_cast<FwAssertArgType>(_stat)
2340  );
2341 
2342  this->tlmWrite(
2344  _tlmBuff,
2345  _tlmTime
2346  );
2347  }
2348  }
2349 
2352  U32 arg,
2353  Fw::Time _tlmTime
2354  ) const
2355  {
2356  if (this->isConnected_tlmOut_OutputPort(0)) {
2357  Fw::TlmBuffer _tlmBuff;
2358  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
2359  FW_ASSERT(
2360  _stat == Fw::FW_SERIALIZE_OK,
2361  static_cast<FwAssertArgType>(_stat)
2362  );
2363 
2364  this->tlmWrite(
2366  _tlmBuff,
2367  _tlmTime
2368  );
2369  }
2370  }
2371 
2372  // ----------------------------------------------------------------------
2373  // Functions for managing data products
2374  // ----------------------------------------------------------------------
2375 
2378  DpContainer& container,
2379  Fw::Time timeTag
2380  )
2381  {
2382  // Update the time tag
2383  if (timeTag == Fw::ZERO_TIME) {
2384  // Get the time from the time port
2385  timeTag = this->getTime();
2386  }
2387  container.setTimeTag(timeTag);
2388  // Serialize the header into the packet
2389  container.serializeHeader();
2390  // Update the size of the buffer according to the data size
2391  const FwSizeType packetSize = container.getPacketSize();
2392  Fw::Buffer buffer = container.getBuffer();
2393  FW_ASSERT(packetSize <= buffer.getSize(), static_cast<FwAssertArgType>(packetSize),
2394  static_cast<FwAssertArgType>(buffer.getSize()));
2395  buffer.setSize(static_cast<U32>(packetSize));
2396  // Invalidate the buffer in the container, so it can't be reused
2397  container.invalidateBuffer();
2398  // Send the buffer
2399  this->productSendOut_out(0, container.getId(), buffer);
2400  }
2401 
2402  // ----------------------------------------------------------------------
2403  // Time
2404  // ----------------------------------------------------------------------
2405 
2407  getTime() const
2408  {
2409  if (this->isConnected_timeCaller_OutputPort(0)) {
2410  Fw::Time _time;
2411  this->timeCaller_out(0, _time);
2412  return _time;
2413  }
2414  else {
2415  return Fw::Time(TimeBase::TB_NONE, 0, 0);
2416  }
2417  }
2418 
2419  // ----------------------------------------------------------------------
2420  // Message dispatch functions
2421  // ----------------------------------------------------------------------
2422 
2423  Fw::QueuedComponentBase::MsgDispatchStatus ComLoggerDpComponentBase ::
2424  doDispatch()
2425  {
2426  ComponentIpcSerializableBuffer _msg;
2427  FwQueuePriorityType _priority = 0;
2428 
2429  Os::Queue::Status _msgStatus = this->m_queue.receive(
2430  _msg,
2432  _priority
2433  );
2434  FW_ASSERT(
2435  _msgStatus == Os::Queue::OP_OK,
2436  static_cast<FwAssertArgType>(_msgStatus)
2437  );
2438 
2439  // Reset to beginning of buffer
2440  _msg.resetDeser();
2441 
2442  FwEnumStoreType _desMsg = 0;
2443  Fw::SerializeStatus _deserStatus = _msg.deserializeTo(_desMsg);
2444  FW_ASSERT(
2445  _deserStatus == Fw::FW_SERIALIZE_OK,
2446  static_cast<FwAssertArgType>(_deserStatus)
2447  );
2448 
2449  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
2450 
2451  if (_msgType == COMLOGGERDP_COMPONENT_EXIT) {
2452  return MSG_DISPATCH_EXIT;
2453  }
2454 
2455  FwIndexType portNum = 0;
2456  _deserStatus = _msg.deserializeTo(portNum);
2457  FW_ASSERT(
2458  _deserStatus == Fw::FW_SERIALIZE_OK,
2459  static_cast<FwAssertArgType>(_deserStatus)
2460  );
2461 
2462  switch (_msgType) {
2463  // Handle async input port comIn
2464  case COMIN_COM: {
2465  // Deserialize argument data
2466  Fw::ComBuffer data;
2467  _deserStatus = _msg.deserializeTo(data);
2468  FW_ASSERT(
2469  _deserStatus == Fw::FW_SERIALIZE_OK,
2470  static_cast<FwAssertArgType>(_deserStatus)
2471  );
2472 
2473  // Deserialize argument context
2474  U32 context;
2475  _deserStatus = _msg.deserializeTo(context);
2476  FW_ASSERT(
2477  _deserStatus == Fw::FW_SERIALIZE_OK,
2478  static_cast<FwAssertArgType>(_deserStatus)
2479  );
2480  // Call handler function
2481  this->comIn_handler(
2482  portNum,
2483  data,
2484  context
2485  );
2486 
2487  break;
2488  }
2489 
2490  // Handle async input port pingIn
2491  case PINGIN_PING: {
2492  // Deserialize argument key
2493  U32 key;
2494  _deserStatus = _msg.deserializeTo(key);
2495  FW_ASSERT(
2496  _deserStatus == Fw::FW_SERIALIZE_OK,
2497  static_cast<FwAssertArgType>(_deserStatus)
2498  );
2499  // Call handler function
2500  this->pingIn_handler(
2501  portNum,
2502  key
2503  );
2504 
2505  break;
2506  }
2507 
2508  // Handle async input port schedIn
2509  case SCHEDIN_SCHED: {
2510  // Deserialize argument context
2511  U32 context;
2512  _deserStatus = _msg.deserializeTo(context);
2513  FW_ASSERT(
2514  _deserStatus == Fw::FW_SERIALIZE_OK,
2515  static_cast<FwAssertArgType>(_deserStatus)
2516  );
2517  // Call handler function
2518  this->schedIn_handler(
2519  portNum,
2520  context
2521  );
2522 
2523  break;
2524  }
2525 
2526  // Handle async input port startRecordingIn
2527  case STARTRECORDINGIN_COMLOGGERSTART: {
2528  // Deserialize argument packetsPerContainer
2529  FwSizeType packetsPerContainer;
2530  _deserStatus = _msg.deserializeTo(packetsPerContainer);
2531  FW_ASSERT(
2532  _deserStatus == Fw::FW_SERIALIZE_OK,
2533  static_cast<FwAssertArgType>(_deserStatus)
2534  );
2535 
2536  // Deserialize argument priority
2537  FwDpPriorityType priority;
2538  _deserStatus = _msg.deserializeTo(priority);
2539  FW_ASSERT(
2540  _deserStatus == Fw::FW_SERIALIZE_OK,
2541  static_cast<FwAssertArgType>(_deserStatus)
2542  );
2543  // Call handler function
2545  portNum,
2546  packetsPerContainer,
2547  priority
2548  );
2549 
2550  break;
2551  }
2552 
2553  // Handle async input port stopRecordingIn
2554  case STOPRECORDINGIN_COMLOGGERSTOP: {
2555  // Call handler function
2556  this->stopRecordingIn_handler(portNum);
2557 
2558  break;
2559  }
2560 
2561  // Handle command StartComDp
2562  case CMD_STARTCOMDP: {
2563  // Deserialize opcode
2564  FwOpcodeType _opCode = 0;
2565  _deserStatus = _msg.deserializeTo(_opCode);
2566  FW_ASSERT (
2567  _deserStatus == Fw::FW_SERIALIZE_OK,
2568  static_cast<FwAssertArgType>(_deserStatus)
2569  );
2570 
2571  // Deserialize command sequence
2572  U32 _cmdSeq = 0;
2573  _deserStatus = _msg.deserializeTo(_cmdSeq);
2574  FW_ASSERT (
2575  _deserStatus == Fw::FW_SERIALIZE_OK,
2576  static_cast<FwAssertArgType>(_deserStatus)
2577  );
2578 
2579  // Deserialize command argument buffer
2580  Fw::CmdArgBuffer args;
2581  _deserStatus = _msg.deserializeTo(args);
2582  FW_ASSERT (
2583  _deserStatus == Fw::FW_SERIALIZE_OK,
2584  static_cast<FwAssertArgType>(_deserStatus)
2585  );
2586 
2587  // Reset buffer
2588  args.resetDeser();
2589 
2590  // Deserialize argument packetsPerContainer
2591  FwSizeType packetsPerContainer;
2592  _deserStatus = args.deserializeTo(packetsPerContainer);
2593  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2595  this->cmdResponse_out(
2596  _opCode,
2597  _cmdSeq,
2599  );
2600  }
2601  // Don't crash the task if bad arguments were passed from the ground
2602  break;
2603  }
2604 
2605  // Deserialize argument priority
2606  FwDpPriorityType priority;
2607  _deserStatus = args.deserializeTo(priority);
2608  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2610  this->cmdResponse_out(
2611  _opCode,
2612  _cmdSeq,
2614  );
2615  }
2616  // Don't crash the task if bad arguments were passed from the ground
2617  break;
2618  }
2619 
2620  // Make sure there was no data left over.
2621  // That means the argument buffer size was incorrect.
2622 #if FW_CMD_CHECK_RESIDUAL
2623  if (args.getDeserializeSizeLeft() != 0) {
2625  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2626  }
2627  // Don't crash the task if bad arguments were passed from the ground
2628  break;
2629  }
2630 #endif
2631 
2632  // Call handler function
2633  this->StartComDp_cmdHandler(
2634  _opCode, _cmdSeq,
2635  packetsPerContainer,
2636  priority
2637  );
2638 
2639  break;
2640  }
2641 
2642  // Handle command UpdatePriority
2643  case CMD_UPDATEPRIORITY: {
2644  // Deserialize opcode
2645  FwOpcodeType _opCode = 0;
2646  _deserStatus = _msg.deserializeTo(_opCode);
2647  FW_ASSERT (
2648  _deserStatus == Fw::FW_SERIALIZE_OK,
2649  static_cast<FwAssertArgType>(_deserStatus)
2650  );
2651 
2652  // Deserialize command sequence
2653  U32 _cmdSeq = 0;
2654  _deserStatus = _msg.deserializeTo(_cmdSeq);
2655  FW_ASSERT (
2656  _deserStatus == Fw::FW_SERIALIZE_OK,
2657  static_cast<FwAssertArgType>(_deserStatus)
2658  );
2659 
2660  // Deserialize command argument buffer
2661  Fw::CmdArgBuffer args;
2662  _deserStatus = _msg.deserializeTo(args);
2663  FW_ASSERT (
2664  _deserStatus == Fw::FW_SERIALIZE_OK,
2665  static_cast<FwAssertArgType>(_deserStatus)
2666  );
2667 
2668  // Reset buffer
2669  args.resetDeser();
2670 
2671  // Deserialize argument priority
2672  FwDpPriorityType priority;
2673  _deserStatus = args.deserializeTo(priority);
2674  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2676  this->cmdResponse_out(
2677  _opCode,
2678  _cmdSeq,
2680  );
2681  }
2682  // Don't crash the task if bad arguments were passed from the ground
2683  break;
2684  }
2685 
2686  // Make sure there was no data left over.
2687  // That means the argument buffer size was incorrect.
2688 #if FW_CMD_CHECK_RESIDUAL
2689  if (args.getDeserializeSizeLeft() != 0) {
2691  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2692  }
2693  // Don't crash the task if bad arguments were passed from the ground
2694  break;
2695  }
2696 #endif
2697 
2698  // Call handler function
2700  _opCode, _cmdSeq,
2701  priority
2702  );
2703 
2704  break;
2705  }
2706 
2707  // Handle command StopComDp
2708  case CMD_STOPCOMDP: {
2709  // Deserialize opcode
2710  FwOpcodeType _opCode = 0;
2711  _deserStatus = _msg.deserializeTo(_opCode);
2712  FW_ASSERT (
2713  _deserStatus == Fw::FW_SERIALIZE_OK,
2714  static_cast<FwAssertArgType>(_deserStatus)
2715  );
2716 
2717  // Deserialize command sequence
2718  U32 _cmdSeq = 0;
2719  _deserStatus = _msg.deserializeTo(_cmdSeq);
2720  FW_ASSERT (
2721  _deserStatus == Fw::FW_SERIALIZE_OK,
2722  static_cast<FwAssertArgType>(_deserStatus)
2723  );
2724 
2725  // Deserialize command argument buffer
2726  Fw::CmdArgBuffer args;
2727  _deserStatus = _msg.deserializeTo(args);
2728  FW_ASSERT (
2729  _deserStatus == Fw::FW_SERIALIZE_OK,
2730  static_cast<FwAssertArgType>(_deserStatus)
2731  );
2732 
2733  // Reset buffer
2734  args.resetDeser();
2735 
2736  // Make sure there was no data left over.
2737  // That means the argument buffer size was incorrect.
2738 #if FW_CMD_CHECK_RESIDUAL
2739  if (args.getDeserializeSizeLeft() != 0) {
2741  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2742  }
2743  // Don't crash the task if bad arguments were passed from the ground
2744  break;
2745  }
2746 #endif
2747 
2748  // Call handler function
2749  this->StopComDp_cmdHandler(_opCode, _cmdSeq);
2750 
2751  break;
2752  }
2753 
2754  // Handle command CLEAR_COUNTERS
2755  case CMD_CLEAR_COUNTERS: {
2756  // Deserialize opcode
2757  FwOpcodeType _opCode = 0;
2758  _deserStatus = _msg.deserializeTo(_opCode);
2759  FW_ASSERT (
2760  _deserStatus == Fw::FW_SERIALIZE_OK,
2761  static_cast<FwAssertArgType>(_deserStatus)
2762  );
2763 
2764  // Deserialize command sequence
2765  U32 _cmdSeq = 0;
2766  _deserStatus = _msg.deserializeTo(_cmdSeq);
2767  FW_ASSERT (
2768  _deserStatus == Fw::FW_SERIALIZE_OK,
2769  static_cast<FwAssertArgType>(_deserStatus)
2770  );
2771 
2772  // Deserialize command argument buffer
2773  Fw::CmdArgBuffer args;
2774  _deserStatus = _msg.deserializeTo(args);
2775  FW_ASSERT (
2776  _deserStatus == Fw::FW_SERIALIZE_OK,
2777  static_cast<FwAssertArgType>(_deserStatus)
2778  );
2779 
2780  // Reset buffer
2781  args.resetDeser();
2782 
2783  // Make sure there was no data left over.
2784  // That means the argument buffer size was incorrect.
2785 #if FW_CMD_CHECK_RESIDUAL
2786  if (args.getDeserializeSizeLeft() != 0) {
2788  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2789  }
2790  // Don't crash the task if bad arguments were passed from the ground
2791  break;
2792  }
2793 #endif
2794 
2795  // Call handler function
2796  this->CLEAR_COUNTERS_cmdHandler(_opCode, _cmdSeq);
2797 
2798  break;
2799  }
2800 
2801  default:
2802  return MSG_DISPATCH_ERROR;
2803  }
2804 
2805  return MSG_DISPATCH_OK;
2806  }
2807 
2808  // ----------------------------------------------------------------------
2809  // Calls for messages received on special input ports
2810  // ----------------------------------------------------------------------
2811 
2812  void ComLoggerDpComponentBase ::
2813  m_p_cmdIn_in(
2814  Fw::PassiveComponentBase* callComp,
2815  FwIndexType portNum,
2816  FwOpcodeType opCode,
2817  U32 cmdSeq,
2818  Fw::CmdArgBuffer& args
2819  )
2820  {
2821  FW_ASSERT(callComp != nullptr);
2822  ComLoggerDpComponentBase* compPtr = static_cast<ComLoggerDpComponentBase*>(callComp);
2823  compPtr->cmdIn_handlerBase(
2824  portNum,
2825  opCode,
2826  cmdSeq,
2827  args
2828  );
2829  }
2830 
2831  // ----------------------------------------------------------------------
2832  // Calls for messages received on typed input ports
2833  // ----------------------------------------------------------------------
2834 
2835  void ComLoggerDpComponentBase ::
2836  m_p_comIn_in(
2837  Fw::PassiveComponentBase* callComp,
2838  FwIndexType portNum,
2839  Fw::ComBuffer& data,
2840  U32 context
2841  )
2842  {
2843  FW_ASSERT(callComp != nullptr);
2844  ComLoggerDpComponentBase* compPtr = static_cast<ComLoggerDpComponentBase*>(callComp);
2845  compPtr->comIn_handlerBase(
2846  portNum,
2847  data,
2848  context
2849  );
2850  }
2851 
2852  void ComLoggerDpComponentBase ::
2853  m_p_pingIn_in(
2854  Fw::PassiveComponentBase* callComp,
2855  FwIndexType portNum,
2856  U32 key
2857  )
2858  {
2859  FW_ASSERT(callComp != nullptr);
2860  ComLoggerDpComponentBase* compPtr = static_cast<ComLoggerDpComponentBase*>(callComp);
2861  compPtr->pingIn_handlerBase(
2862  portNum,
2863  key
2864  );
2865  }
2866 
2867  void ComLoggerDpComponentBase ::
2868  m_p_schedIn_in(
2869  Fw::PassiveComponentBase* callComp,
2870  FwIndexType portNum,
2871  U32 context
2872  )
2873  {
2874  FW_ASSERT(callComp != nullptr);
2875  ComLoggerDpComponentBase* compPtr = static_cast<ComLoggerDpComponentBase*>(callComp);
2876  compPtr->schedIn_handlerBase(
2877  portNum,
2878  context
2879  );
2880  }
2881 
2882  void ComLoggerDpComponentBase ::
2883  m_p_startRecordingIn_in(
2884  Fw::PassiveComponentBase* callComp,
2885  FwIndexType portNum,
2886  FwSizeType packetsPerContainer,
2887  FwDpPriorityType priority
2888  )
2889  {
2890  FW_ASSERT(callComp != nullptr);
2891  ComLoggerDpComponentBase* compPtr = static_cast<ComLoggerDpComponentBase*>(callComp);
2892  compPtr->startRecordingIn_handlerBase(
2893  portNum,
2894  packetsPerContainer,
2895  priority
2896  );
2897  }
2898 
2899  void ComLoggerDpComponentBase ::
2900  m_p_stopRecordingIn_in(
2901  Fw::PassiveComponentBase* callComp,
2902  FwIndexType portNum
2903  )
2904  {
2905  FW_ASSERT(callComp != nullptr);
2906  ComLoggerDpComponentBase* compPtr = static_cast<ComLoggerDpComponentBase*>(callComp);
2907  compPtr->stopRecordingIn_handlerBase(portNum);
2908  }
2909 
2910 #if !FW_DIRECT_PORT_CALLS
2911 
2912  // ----------------------------------------------------------------------
2913  // Invocation functions for special output ports
2914  // ----------------------------------------------------------------------
2915 
2916 #if FW_ENABLE_TEXT_LOGGING
2917 
2918  void ComLoggerDpComponentBase ::
2919  LogText_out(
2920  FwIndexType portNum,
2921  FwEventIdType id,
2922  Fw::Time& timeTag,
2923  const Fw::LogSeverity& severity,
2924  Fw::TextLogString& text
2925  ) const
2926  {
2927  FW_ASSERT(
2928  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
2929  static_cast<FwAssertArgType>(portNum)
2930  );
2931 
2932  FW_ASSERT(
2933  this->m_LogText_OutputPort[portNum].isConnected(),
2934  static_cast<FwAssertArgType>(portNum)
2935  );
2936  this->m_LogText_OutputPort[portNum].invoke(
2937  id,
2938  timeTag,
2939  severity,
2940  text
2941  );
2942  }
2943 
2944 #endif
2945 
2946  void ComLoggerDpComponentBase ::
2947  cmdRegOut_out(
2948  FwIndexType portNum,
2949  FwOpcodeType opCode
2950  ) const
2951  {
2952  FW_ASSERT(
2953  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
2954  static_cast<FwAssertArgType>(portNum)
2955  );
2956 
2957  FW_ASSERT(
2958  this->m_cmdRegOut_OutputPort[portNum].isConnected(),
2959  static_cast<FwAssertArgType>(portNum)
2960  );
2961  this->m_cmdRegOut_OutputPort[portNum].invoke(
2962  opCode
2963  );
2964  }
2965 
2966  void ComLoggerDpComponentBase ::
2967  cmdResponseOut_out(
2968  FwIndexType portNum,
2969  FwOpcodeType opCode,
2970  U32 cmdSeq,
2971  const Fw::CmdResponse& response
2972  ) const
2973  {
2974  FW_ASSERT(
2975  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
2976  static_cast<FwAssertArgType>(portNum)
2977  );
2978 
2979  FW_ASSERT(
2980  this->m_cmdResponseOut_OutputPort[portNum].isConnected(),
2981  static_cast<FwAssertArgType>(portNum)
2982  );
2983  this->m_cmdResponseOut_OutputPort[portNum].invoke(
2984  opCode,
2985  cmdSeq,
2986  response
2987  );
2988  }
2989 
2990  void ComLoggerDpComponentBase ::
2991  logOut_out(
2992  FwIndexType portNum,
2993  FwEventIdType id,
2994  Fw::Time& timeTag,
2995  const Fw::LogSeverity& severity,
2996  Fw::LogBuffer& args
2997  ) const
2998  {
2999  FW_ASSERT(
3000  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
3001  static_cast<FwAssertArgType>(portNum)
3002  );
3003 
3004  FW_ASSERT(
3005  this->m_logOut_OutputPort[portNum].isConnected(),
3006  static_cast<FwAssertArgType>(portNum)
3007  );
3008  this->m_logOut_OutputPort[portNum].invoke(
3009  id,
3010  timeTag,
3011  severity,
3012  args
3013  );
3014  }
3015 
3016  Fw::Success ComLoggerDpComponentBase ::
3017  productGetOut_out(
3018  FwIndexType portNum,
3019  FwDpIdType id,
3020  FwSizeType dataSize,
3021  Fw::Buffer& buffer
3022  ) const
3023  {
3024  FW_ASSERT(
3025  (0 <= portNum) && (portNum < this->getNum_productGetOut_OutputPorts()),
3026  static_cast<FwAssertArgType>(portNum)
3027  );
3028 
3029  FW_ASSERT(
3030  this->m_productGetOut_OutputPort[portNum].isConnected(),
3031  static_cast<FwAssertArgType>(portNum)
3032  );
3033  return this->m_productGetOut_OutputPort[portNum].invoke(
3034  id,
3035  dataSize,
3036  buffer
3037  );
3038  }
3039 
3040  void ComLoggerDpComponentBase ::
3041  productSendOut_out(
3042  FwIndexType portNum,
3043  FwDpIdType id,
3044  const Fw::Buffer& buffer
3045  ) const
3046  {
3047  FW_ASSERT(
3048  (0 <= portNum) && (portNum < this->getNum_productSendOut_OutputPorts()),
3049  static_cast<FwAssertArgType>(portNum)
3050  );
3051 
3052  FW_ASSERT(
3053  this->m_productSendOut_OutputPort[portNum].isConnected(),
3054  static_cast<FwAssertArgType>(portNum)
3055  );
3056  this->m_productSendOut_OutputPort[portNum].invoke(
3057  id,
3058  buffer
3059  );
3060  }
3061 
3062  void ComLoggerDpComponentBase ::
3063  timeCaller_out(
3064  FwIndexType portNum,
3065  Fw::Time& time
3066  ) const
3067  {
3068  FW_ASSERT(
3069  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
3070  static_cast<FwAssertArgType>(portNum)
3071  );
3072 
3073  FW_ASSERT(
3074  this->m_timeCaller_OutputPort[portNum].isConnected(),
3075  static_cast<FwAssertArgType>(portNum)
3076  );
3077  this->m_timeCaller_OutputPort[portNum].invoke(
3078  time
3079  );
3080  }
3081 
3082  void ComLoggerDpComponentBase ::
3083  tlmOut_out(
3084  FwIndexType portNum,
3085  FwChanIdType id,
3086  Fw::Time& timeTag,
3087  Fw::TlmBuffer& val
3088  ) const
3089  {
3090  FW_ASSERT(
3091  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
3092  static_cast<FwAssertArgType>(portNum)
3093  );
3094 
3095  FW_ASSERT(
3096  this->m_tlmOut_OutputPort[portNum].isConnected(),
3097  static_cast<FwAssertArgType>(portNum)
3098  );
3099  this->m_tlmOut_OutputPort[portNum].invoke(
3100  id,
3101  timeTag,
3102  val
3103  );
3104  }
3105 
3106 #endif
3107 
3108  // ----------------------------------------------------------------------
3109  // Private data product handling functions
3110  // ----------------------------------------------------------------------
3111 
3112  Fw::Success::T ComLoggerDpComponentBase ::
3113  dpGet(
3114  ContainerId::T containerId,
3115  FwSizeType dataSize,
3116  FwDpPriorityType priority,
3117  DpContainer& container
3118  )
3119  {
3120  const FwDpIdType baseId = this->getIdBase();
3121  const FwDpIdType globalId = baseId + containerId;
3122  const FwSizeType size = DpContainer::getPacketSizeForDataSize(dataSize);
3123  Fw::Buffer buffer;
3124  const Fw::Success::T status = this->productGetOut_out(0, globalId, size, buffer);
3125  if (status == Fw::Success::SUCCESS) {
3126  // Assign a fresh DpContainer into container
3127  // This action clears out all the container state
3128  container = DpContainer(globalId, buffer, baseId);
3129  container.setPriority(priority);
3130  }
3131  return status;
3132  }
3133 
3134 }
Serialization/Deserialization operation was successful.
Fw::InputComPort * get_comIn_InputPort(FwIndexType portNum)
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:157
void init()
Initialization function.
static constexpr FwIndexType getNum_logOut_OutputPorts()
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
static constexpr FwSizeType CAPACITY
Definition: CmdPortAc.hpp:36
static constexpr FwIndexType getNum_productGetOut_OutputPorts()
void setTimeTag(Fw::Time timeTag)
Set the time tag.
FwIdType FwOpcodeType
The type of a command opcode.
virtual ~ComLoggerDpComponentBase()
Destroy ComLoggerDpComponentBase object.
Operation succeeded.
Definition: Os.hpp:27
void init()
Initialization function.
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
Representing success.
PlatformSizeType FwSizeType
Svc::InputComLoggerStartPort * get_startRecordingIn_InputPort(FwIndexType portNum)
Failed to start recording due to invalid configuration.
static constexpr FwIndexType getNum_cmdRegOut_OutputPorts()
U32 FwDpPriorityType
The type of a data product priority.
void dpSend(DpContainer &container, Fw::Time timeTag=Fw::ZERO_TIME)
Send a data product.
Status receive(U8 *destination, FwSizeType capacity, BlockingType blockType, FwSizeType &actualSize, FwQueuePriorityType &priority) override
receive a message from the queue through delegate
Definition: Queue.cpp:71
I32 FwEnumStoreType
void addCallPort(InputDpSendPort *callPort)
Register an input port.
void setSize(FwSizeType size)
Definition: Buffer.cpp:131
void set_productSendOut_OutputPort(FwIndexType portNum, Fw::InputDpSendPort *port)
Connect port to productSendOut[portNum].
Status
status returned from the queue send function
Definition: Queue.hpp:30
static constexpr FwIndexType getNum_pingOut_OutputPorts()
static constexpr FwIndexType getNum_schedIn_InputPorts()
void init()
Initialization function.
Definition: SchedPortAc.cpp:73
BYTE pingInPortSize[Svc::PingPortBuffer::CAPACITY]
void init()
Initialization function.
Definition: CmdPortAc.cpp:89
bool isConnected_pingOut_OutputPort(FwIndexType portNum) const
SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG) override
Deserialize an 8-bit unsigned integer value.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Starts recording ComBuffers at the specified priority.
virtual void StartComDp_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, FwSizeType packetsPerContainer, FwDpPriorityType priority)=0
No room left in the buffer to serialize data.
void StartComDp_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void invoke(U32 key) const
Invoke a port connection.
Definition: PingPortAc.cpp:170
void tlmWrite_NumBuffersDropped(U32 arg, Fw::Time _tlmTime=Fw::Time()) const
void startRecordingIn_handlerBase(FwIndexType portNum, FwSizeType packetsPerContainer, FwDpPriorityType priority)
Handler base-class function for input port startRecordingIn.
const Time ZERO_TIME
Definition: Time.cpp:5
static constexpr FwIndexType getNum_productSendOut_OutputPorts()
void set_pingOut_OutputPort(FwIndexType portNum, Svc::InputPingPort *port)
Connect port to pingOut[portNum].
void init()
Initialization function.
Definition: TlmPortAc.cpp:171
void tlmWrite(FwChanIdType id, Fw::TlmBuffer &_tlmBuff, Fw::Time _tlmTime=Fw::Time()) const
Enum representing a command response.
No time base has been established (Required)
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
void addCallPort(InputCmdRegPort *callPort)
Register an input port.
virtual void pingIn_handler(FwIndexType portNum, U32 key)=0
Handler for input port pingIn.
void set_productGetOut_OutputPort(FwIndexType portNum, Fw::InputDpGetPort *port)
Connect port to productGetOut[portNum].
void StopComDp_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
static constexpr FwIndexType getNum_comIn_InputPorts()
Os::Queue m_queue
queue object for active component
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:177
void init()
Object initializer.
Definition: ObjBase.cpp:24
bool isConnected_cmdResponseOut_OutputPort(FwIndexType portNum) const
void init()
Initialization function.
Definition: ComPortAc.cpp:81
Svc::InputSchedPort * get_schedIn_InputPort(FwIndexType portNum)
SerializeStatus
forward declaration for string
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: CmdPortAc.cpp:95
void log_WARNING_HI_DpBufferError(U32 size)
Log event DpBufferError.
Message will block until space is available.
Definition: Queue.hpp:47
static constexpr FwSizeType CAPACITY
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
virtual void StopComDp_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command StopComDp.
FwIdType FwEventIdType
The type of an event identifier.
Svc::InputComLoggerStopPort * get_stopRecordingIn_InputPort(FwIndexType portNum)
void invoke(FwOpcodeType opCode) const
Invoke a port connection.
static constexpr FwSizeType CAPACITY
Definition: PingPortAc.hpp:34
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:40
void init()
Initialization function.
Definition: TimePortAc.cpp:151
bool isConnected_cmdRegOut_OutputPort(FwIndexType portNum) const
virtual void UpdatePriority_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, FwDpPriorityType priority)=0
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: ComPortAc.cpp:87
Less important informational events.
Os::Queue::Status createQueue(FwSizeType depth, FwSizeType msgSize)
static constexpr FwSizeType CAPACITY
Definition: ComPortAc.hpp:35
virtual void comIn_preMsgHook(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Pre-message hook for async input port comIn.
A less serious but recoverable event.
static constexpr FwIndexType getNum_pingIn_InputPorts()
Omit length from serialization.
ActiveComponentBase(const char *name)
Constructor.
void init()
Initialization function.
Definition: PingPortAc.cpp:151
void log_ACTIVITY_LO_PriorityUpdated(FwDpPriorityType priority) const
void invoke(Fw::Time &time) const
Invoke a port connection.
Definition: TimePortAc.cpp:170
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Serializable::SizeType getDeserializeSizeLeft() const override
Get remaining deserialization buffer size.
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke a port connection.
void invalidateBuffer()
Invalidate the packet buffer.
T
The raw enum type.
FwIdType FwChanIdType
The type of a telemetry channel identifier.
void addCallPort(InputPingPort *callPort)
Register an input port.
Definition: PingPortAc.cpp:157
Status send(const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override
send a message into the queue through delegate
Definition: Queue.cpp:54
virtual void comIn_handler(FwIndexType portNum, Fw::ComBuffer &data, U32 context)=0
Handler for input port comIn.
Fw::SerializeStatus serializeRecord_ComBufferRecord(const U8 *array, FwSizeType size)
void resetDeser() override
Reset deserialization pointer to beginning of buffer.
bool isConnected_logOut_OutputPort(FwIndexType portNum) const
A serious but recoverable event.
FwSizeType FwSizeStoreType
static constexpr FwIndexType getNum_stopRecordingIn_InputPorts()
void pingOut_out(FwIndexType portNum, U32 key) const
Invoke output port pingOut.
static constexpr FwSizeType getPacketSizeForDataSize(FwSizeType dataSize)
Get the packet size for a given data size.
void invoke(FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val) const
Invoke a port connection.
Definition: TlmPortAc.cpp:190
const char * toChar() const
Convert to a C-style char*.
bool isConnected() const
Definition: PortBase.cpp:38
Enum representing event severity.
FwSizeType getPacketSize() const
Get the packet size corresponding to the data size.
Fw::Buffer getBuffer() const
#define PRI_FwIndexType
virtual void UpdatePriority_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command UpdatePriority.
virtual void StartComDp_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command StartComDp.
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:58
void init()
Initialization function.
Definition: LogPortAc.cpp:180
void stopRecordingIn_handlerBase(FwIndexType portNum)
Handler base-class function for input port stopRecordingIn.
void setPortNum(FwIndexType portNum)
virtual void schedIn_handler(FwIndexType portNum, U32 context)=0
Handler for input port schedIn.
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:54
virtual void StopComDp_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
Svc::InputPingPort * get_pingIn_InputPort(FwIndexType portNum)
BlockingType
message type
Definition: Queue.hpp:46
FwSizeType getSize() const
Definition: Buffer.cpp:90
Command failed to deserialize.
PlatformQueuePriorityType FwQueuePriorityType
The type of queue priorities used.
void set_cmdResponseOut_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to cmdResponseOut[portNum].
Important informational events.
FwIdType FwDpIdType
The type of a data product identifier.
void comIn_handlerBase(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Handler base-class function for input port comIn.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: SchedPortAc.cpp:79
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args) const
Invoke a port connection.
Definition: LogPortAc.cpp:199
Updates the priority of the active container (if any) and of all future containers.
void schedIn_handlerBase(FwIndexType portNum, U32 context)
Handler base-class function for input port schedIn.
bool isConnected_timeCaller_OutputPort(FwIndexType portNum) const
message to exit active component task
A message was sent requesting an exit of the loop.
void log_WARNING_LO_StartRecordingFailed(FwSizeType packetsPerContainer) const
Fw::Success invoke(FwDpIdType id, FwSizeType dataSize, Fw::Buffer &buffer) const
virtual void startRecordingIn_handler(FwIndexType portNum, FwSizeType packetsPerContainer, FwDpPriorityType priority)=0
Handler for input port startRecordingIn.
PlatformIndexType FwIndexType
virtual void CLEAR_COUNTERS_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command CLEAR_COUNTERS.
void serializeHeader()
Definition: DpContainer.cpp:89
void addCallPort(InputDpGetPort *callPort)
Register an input port.
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:186
virtual void stopRecordingIn_handler(FwIndexType portNum)=0
Handler for input port stopRecordingIn.
static constexpr FwIndexType getNum_cmdResponseOut_OutputPorts()
void init()
Initialization function.
void incNumMsgDropped()
increment the number of messages dropped
virtual void schedIn_preMsgHook(FwIndexType portNum, U32 context)
Pre-message hook for async input port schedIn.
virtual void stopRecordingIn_preMsgHook(FwIndexType portNum)
Pre-message hook for async input port stopRecordingIn.
void init()
Initialization function.
Definition: PingPortAc.cpp:73
RateGroupDivider component implementation.
void set_cmdRegOut_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to cmdRegOut[portNum].
message sent/received okay
Definition: Queue.hpp:31
bool isConnected_productGetOut_OutputPort(FwIndexType portNum) const
U8 BYTE
byte type
Definition: BasicTypes.h:57
void init()
Initialization function.
static constexpr FwIndexType getNum_tlmOut_OutputPorts()
Fw::InputCmdPort * get_cmdIn_InputPort(FwIndexType portNum)
void cmdIn_handlerBase(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Handler base-class function for input port cmdIn.
Whether a partial container was sent when recording stopped.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: PingPortAc.cpp:79
FwDpIdType getId() const
void tlmWrite_NumQueueDrops(U32 arg, Fw::Time _tlmTime=Fw::Time()) const
Clears NumBuffersLogged and NumBuffersDropped counters and DpBufferError event throttle.
void UpdatePriority_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Message will return with status when space is unavailable.
Definition: Queue.hpp:48
void log_ACTIVITY_HI_ComDpStarted(FwSizeType packetsPerContainer) const
Implementation of malloc based allocator.
static constexpr FwIndexType getNum_startRecordingIn_InputPorts()
ComLoggerDpComponentBase(const char *compName="")
Construct ComLoggerDpComponentBase object.
void log_ACTIVITY_HI_ComDpStopped(const Svc::ComLoggerDp_PartialContainerStatus &partialContainer) const
void log_WARNING_HI_DpBufferError_ThrottleClear()
Reset throttle value for DpBufferError.
void init()
Initialization function.
void tlmWrite_NumBuffersLogged(U32 arg, Fw::Time _tlmTime=Fw::Time()) const
DpContainer()
Constructor with default initialization.
void invoke(FwDpIdType id, const Fw::Buffer &buffer) const
Invoke a port connection.
virtual void CLEAR_COUNTERS_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
bool isConnected_productSendOut_OutputPort(FwIndexType portNum) const
void init()
Initialization function.
virtual void startRecordingIn_preMsgHook(FwIndexType portNum, FwSizeType packetsPerContainer, FwDpPriorityType priority)
Pre-message hook for async input port startRecordingIn.
void tlmWrite_LoggingEnabled(bool arg, Fw::Time _tlmTime=Fw::Time()) const
static constexpr FwSizeType CAPACITY
Definition: SchedPortAc.hpp:34
Success/Failure.
void pingIn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port pingIn.
virtual void pingIn_preMsgHook(FwIndexType portNum, U32 key)
Pre-message hook for async input port pingIn.
bool isConnected_tlmOut_OutputPort(FwIndexType portNum) const
void regCommands()
Register commands with the Command Dispatcher.
PlatformAssertArgType FwAssertArgType
The type of arguments to assert functions.
void CLEAR_COUNTERS_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.
static constexpr FwIndexType getNum_cmdIn_InputPorts()
BYTE cmdPortSize[Fw::CmdPortBuffer::CAPACITY]
static constexpr FwIndexType getNum_timeCaller_OutputPorts()