F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
DpWriterComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title DpWriterComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for DpWriter 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  DPWRITER_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT,
19  BUFFERSENDIN_BUFFERSEND,
20  SCHEDIN_SCHED,
21  CMD_CLEAR_EVENT_THROTTLE,
22  };
23 
24  // Get the max size by constructing a union of the async input, command, and
25  // internal port serialization sizes
26  union BuffUnion {
27  BYTE bufferSendInPortSize[Fw::InputBufferSendPort::SERIALIZED_SIZE];
30  };
31 
32  // Define a message buffer class large enough to handle all the
33  // asynchronous inputs to the component
34  class ComponentIpcSerializableBuffer :
36  {
37 
38  public:
39 
40  enum {
41  // Offset into data in buffer: Size of message ID and port number
42  DATA_OFFSET = sizeof(FwEnumStoreType) + sizeof(FwIndexType),
43  // Max data size
44  MAX_DATA_SIZE = sizeof(BuffUnion),
45  // Max message size: Size of message id + size of port + max data size
46  SERIALIZATION_SIZE = DATA_OFFSET + MAX_DATA_SIZE
47  };
48 
49  Fw::Serializable::SizeType getBuffCapacity() const {
50  return sizeof(m_buff);
51  }
52 
53  U8* getBuffAddr() {
54  return m_buff;
55  }
56 
57  const U8* getBuffAddr() const {
58  return m_buff;
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  // Component initialization
70  // ----------------------------------------------------------------------
71 
74  FwSizeType queueDepth,
75  FwEnumStoreType instance
76  )
77  {
78  // Initialize base class
80 
81  // Connect input port cmdIn
82  for (
83  FwIndexType port = 0;
84  port < static_cast<FwIndexType>(this->getNum_cmdIn_InputPorts());
85  port++
86  ) {
87  this->m_cmdIn_InputPort[port].init();
88  this->m_cmdIn_InputPort[port].addCallComp(
89  this,
90  m_p_cmdIn_in
91  );
92  this->m_cmdIn_InputPort[port].setPortNum(port);
93 
94 #if FW_OBJECT_NAMES == 1
95  Fw::ObjectName portName;
96  portName.format(
97  "%s_cmdIn_InputPort[%" PRI_FwIndexType "]",
98  this->m_objName.toChar(),
99  port
100  );
101  this->m_cmdIn_InputPort[port].setObjName(portName.toChar());
102 #endif
103  }
104 
105  // Connect input port bufferSendIn
106  for (
107  FwIndexType port = 0;
108  port < static_cast<FwIndexType>(this->getNum_bufferSendIn_InputPorts());
109  port++
110  ) {
111  this->m_bufferSendIn_InputPort[port].init();
112  this->m_bufferSendIn_InputPort[port].addCallComp(
113  this,
114  m_p_bufferSendIn_in
115  );
116  this->m_bufferSendIn_InputPort[port].setPortNum(port);
117 
118 #if FW_OBJECT_NAMES == 1
119  Fw::ObjectName portName;
120  portName.format(
121  "%s_bufferSendIn_InputPort[%" PRI_FwIndexType "]",
122  this->m_objName.toChar(),
123  port
124  );
125  this->m_bufferSendIn_InputPort[port].setObjName(portName.toChar());
126 #endif
127  }
128 
129  // Connect input port schedIn
130  for (
131  FwIndexType port = 0;
132  port < static_cast<FwIndexType>(this->getNum_schedIn_InputPorts());
133  port++
134  ) {
135  this->m_schedIn_InputPort[port].init();
136  this->m_schedIn_InputPort[port].addCallComp(
137  this,
138  m_p_schedIn_in
139  );
140  this->m_schedIn_InputPort[port].setPortNum(port);
141 
142 #if FW_OBJECT_NAMES == 1
143  Fw::ObjectName portName;
144  portName.format(
145  "%s_schedIn_InputPort[%" PRI_FwIndexType "]",
146  this->m_objName.toChar(),
147  port
148  );
149  this->m_schedIn_InputPort[port].setObjName(portName.toChar());
150 #endif
151  }
152 
153  // Connect output port cmdRegIn
154  for (
155  FwIndexType port = 0;
156  port < static_cast<FwIndexType>(this->getNum_cmdRegIn_OutputPorts());
157  port++
158  ) {
159  this->m_cmdRegIn_OutputPort[port].init();
160 
161 #if FW_OBJECT_NAMES == 1
162  Fw::ObjectName portName;
163  portName.format(
164  "%s_cmdRegIn_OutputPort[%" PRI_FwIndexType "]",
165  this->m_objName.toChar(),
166  port
167  );
168  this->m_cmdRegIn_OutputPort[port].setObjName(portName.toChar());
169 #endif
170  }
171 
172  // Connect output port cmdResponseOut
173  for (
174  FwIndexType port = 0;
175  port < static_cast<FwIndexType>(this->getNum_cmdResponseOut_OutputPorts());
176  port++
177  ) {
178  this->m_cmdResponseOut_OutputPort[port].init();
179 
180 #if FW_OBJECT_NAMES == 1
181  Fw::ObjectName portName;
182  portName.format(
183  "%s_cmdResponseOut_OutputPort[%" PRI_FwIndexType "]",
184  this->m_objName.toChar(),
185  port
186  );
187  this->m_cmdResponseOut_OutputPort[port].setObjName(portName.toChar());
188 #endif
189  }
190 
191  // Connect output port eventOut
192  for (
193  FwIndexType port = 0;
194  port < static_cast<FwIndexType>(this->getNum_eventOut_OutputPorts());
195  port++
196  ) {
197  this->m_eventOut_OutputPort[port].init();
198 
199 #if FW_OBJECT_NAMES == 1
200  Fw::ObjectName portName;
201  portName.format(
202  "%s_eventOut_OutputPort[%" PRI_FwIndexType "]",
203  this->m_objName.toChar(),
204  port
205  );
206  this->m_eventOut_OutputPort[port].setObjName(portName.toChar());
207 #endif
208  }
209 
210 #if FW_ENABLE_TEXT_LOGGING == 1
211  // Connect output port textEventOut
212  for (
213  FwIndexType port = 0;
214  port < static_cast<FwIndexType>(this->getNum_textEventOut_OutputPorts());
215  port++
216  ) {
217  this->m_textEventOut_OutputPort[port].init();
218 
219 #if FW_OBJECT_NAMES == 1
220  Fw::ObjectName portName;
221  portName.format(
222  "%s_textEventOut_OutputPort[%" PRI_FwIndexType "]",
223  this->m_objName.toChar(),
224  port
225  );
226  this->m_textEventOut_OutputPort[port].setObjName(portName.toChar());
227 #endif
228  }
229 #endif
230 
231  // Connect output port timeGetOut
232  for (
233  FwIndexType port = 0;
234  port < static_cast<FwIndexType>(this->getNum_timeGetOut_OutputPorts());
235  port++
236  ) {
237  this->m_timeGetOut_OutputPort[port].init();
238 
239 #if FW_OBJECT_NAMES == 1
240  Fw::ObjectName portName;
241  portName.format(
242  "%s_timeGetOut_OutputPort[%" PRI_FwIndexType "]",
243  this->m_objName.toChar(),
244  port
245  );
246  this->m_timeGetOut_OutputPort[port].setObjName(portName.toChar());
247 #endif
248  }
249 
250  // Connect output port tlmOut
251  for (
252  FwIndexType port = 0;
253  port < static_cast<FwIndexType>(this->getNum_tlmOut_OutputPorts());
254  port++
255  ) {
256  this->m_tlmOut_OutputPort[port].init();
257 
258 #if FW_OBJECT_NAMES == 1
259  Fw::ObjectName portName;
260  portName.format(
261  "%s_tlmOut_OutputPort[%" PRI_FwIndexType "]",
262  this->m_objName.toChar(),
263  port
264  );
265  this->m_tlmOut_OutputPort[port].setObjName(portName.toChar());
266 #endif
267  }
268 
269  // Connect output port deallocBufferSendOut
270  for (
271  FwIndexType port = 0;
272  port < static_cast<FwIndexType>(this->getNum_deallocBufferSendOut_OutputPorts());
273  port++
274  ) {
275  this->m_deallocBufferSendOut_OutputPort[port].init();
276 
277 #if FW_OBJECT_NAMES == 1
278  Fw::ObjectName portName;
279  portName.format(
280  "%s_deallocBufferSendOut_OutputPort[%" PRI_FwIndexType "]",
281  this->m_objName.toChar(),
282  port
283  );
284  this->m_deallocBufferSendOut_OutputPort[port].setObjName(portName.toChar());
285 #endif
286  }
287 
288  // Connect output port dpWrittenOut
289  for (
290  FwIndexType port = 0;
291  port < static_cast<FwIndexType>(this->getNum_dpWrittenOut_OutputPorts());
292  port++
293  ) {
294  this->m_dpWrittenOut_OutputPort[port].init();
295 
296 #if FW_OBJECT_NAMES == 1
297  Fw::ObjectName portName;
298  portName.format(
299  "%s_dpWrittenOut_OutputPort[%" PRI_FwIndexType "]",
300  this->m_objName.toChar(),
301  port
302  );
303  this->m_dpWrittenOut_OutputPort[port].setObjName(portName.toChar());
304 #endif
305  }
306 
307  // Connect output port procBufferSendOut
308  for (
309  FwIndexType port = 0;
310  port < static_cast<FwIndexType>(this->getNum_procBufferSendOut_OutputPorts());
311  port++
312  ) {
313  this->m_procBufferSendOut_OutputPort[port].init();
314 
315 #if FW_OBJECT_NAMES == 1
316  Fw::ObjectName portName;
317  portName.format(
318  "%s_procBufferSendOut_OutputPort[%" PRI_FwIndexType "]",
319  this->m_objName.toChar(),
320  port
321  );
322  this->m_procBufferSendOut_OutputPort[port].setObjName(portName.toChar());
323 #endif
324  }
325 
326  // Create the queue
327  Os::Queue::Status qStat = this->createQueue(
328  queueDepth,
329  static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
330  );
331  FW_ASSERT(
332  Os::Queue::Status::OP_OK == qStat,
333  static_cast<FwAssertArgType>(qStat)
334  );
335  }
336 
337  // ----------------------------------------------------------------------
338  // Getters for special input ports
339  // ----------------------------------------------------------------------
340 
343  {
344  FW_ASSERT(
345  (0 <= portNum) && (portNum < this->getNum_cmdIn_InputPorts()),
346  static_cast<FwAssertArgType>(portNum)
347  );
348 
349  return &this->m_cmdIn_InputPort[portNum];
350  }
351 
352  // ----------------------------------------------------------------------
353  // Getters for typed input ports
354  // ----------------------------------------------------------------------
355 
358  {
359  FW_ASSERT(
360  (0 <= portNum) && (portNum < this->getNum_bufferSendIn_InputPorts()),
361  static_cast<FwAssertArgType>(portNum)
362  );
363 
364  return &this->m_bufferSendIn_InputPort[portNum];
365  }
366 
369  {
370  FW_ASSERT(
371  (0 <= portNum) && (portNum < this->getNum_schedIn_InputPorts()),
372  static_cast<FwAssertArgType>(portNum)
373  );
374 
375  return &this->m_schedIn_InputPort[portNum];
376  }
377 
378  // ----------------------------------------------------------------------
379  // Connect input ports to special output ports
380  // ----------------------------------------------------------------------
381 
384  FwIndexType portNum,
385  Fw::InputCmdRegPort* port
386  )
387  {
388  FW_ASSERT(
389  (0 <= portNum) && (portNum < this->getNum_cmdRegIn_OutputPorts()),
390  static_cast<FwAssertArgType>(portNum)
391  );
392 
393  this->m_cmdRegIn_OutputPort[portNum].addCallPort(port);
394  }
395 
398  FwIndexType portNum,
400  )
401  {
402  FW_ASSERT(
403  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
404  static_cast<FwAssertArgType>(portNum)
405  );
406 
407  this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port);
408  }
409 
412  FwIndexType portNum,
413  Fw::InputLogPort* port
414  )
415  {
416  FW_ASSERT(
417  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
418  static_cast<FwAssertArgType>(portNum)
419  );
420 
421  this->m_eventOut_OutputPort[portNum].addCallPort(port);
422  }
423 
424 #if FW_ENABLE_TEXT_LOGGING == 1
425 
426  void DpWriterComponentBase ::
427  set_textEventOut_OutputPort(
428  FwIndexType portNum,
430  )
431  {
432  FW_ASSERT(
433  (0 <= portNum) && (portNum < this->getNum_textEventOut_OutputPorts()),
434  static_cast<FwAssertArgType>(portNum)
435  );
436 
437  this->m_textEventOut_OutputPort[portNum].addCallPort(port);
438  }
439 
440 #endif
441 
444  FwIndexType portNum,
445  Fw::InputTimePort* port
446  )
447  {
448  FW_ASSERT(
449  (0 <= portNum) && (portNum < this->getNum_timeGetOut_OutputPorts()),
450  static_cast<FwAssertArgType>(portNum)
451  );
452 
453  this->m_timeGetOut_OutputPort[portNum].addCallPort(port);
454  }
455 
458  FwIndexType portNum,
459  Fw::InputTlmPort* port
460  )
461  {
462  FW_ASSERT(
463  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
464  static_cast<FwAssertArgType>(portNum)
465  );
466 
467  this->m_tlmOut_OutputPort[portNum].addCallPort(port);
468  }
469 
470  // ----------------------------------------------------------------------
471  // Connect typed input ports to typed output ports
472  // ----------------------------------------------------------------------
473 
476  FwIndexType portNum,
478  )
479  {
480  FW_ASSERT(
481  (0 <= portNum) && (portNum < this->getNum_deallocBufferSendOut_OutputPorts()),
482  static_cast<FwAssertArgType>(portNum)
483  );
484 
485  this->m_deallocBufferSendOut_OutputPort[portNum].addCallPort(port);
486  }
487 
490  FwIndexType portNum,
492  )
493  {
494  FW_ASSERT(
495  (0 <= portNum) && (portNum < this->getNum_dpWrittenOut_OutputPorts()),
496  static_cast<FwAssertArgType>(portNum)
497  );
498 
499  this->m_dpWrittenOut_OutputPort[portNum].addCallPort(port);
500  }
501 
504  FwIndexType portNum,
506  )
507  {
508  FW_ASSERT(
509  (0 <= portNum) && (portNum < this->getNum_procBufferSendOut_OutputPorts()),
510  static_cast<FwAssertArgType>(portNum)
511  );
512 
513  this->m_procBufferSendOut_OutputPort[portNum].addCallPort(port);
514  }
515 
516 #if FW_PORT_SERIALIZATION
517 
518  // ----------------------------------------------------------------------
519  // Connect serial input ports to special output ports
520  // ----------------------------------------------------------------------
521 
524  FwIndexType portNum,
525  Fw::InputSerializePort* port
526  )
527  {
528  FW_ASSERT(
529  (0 <= portNum) && (portNum < this->getNum_cmdRegIn_OutputPorts()),
530  static_cast<FwAssertArgType>(portNum)
531  );
532 
533  this->m_cmdRegIn_OutputPort[portNum].registerSerialPort(port);
534  }
535 
538  FwIndexType portNum,
539  Fw::InputSerializePort* port
540  )
541  {
542  FW_ASSERT(
543  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
544  static_cast<FwAssertArgType>(portNum)
545  );
546 
547  this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port);
548  }
549 
552  FwIndexType portNum,
553  Fw::InputSerializePort* port
554  )
555  {
556  FW_ASSERT(
557  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
558  static_cast<FwAssertArgType>(portNum)
559  );
560 
561  this->m_eventOut_OutputPort[portNum].registerSerialPort(port);
562  }
563 
564 #if FW_ENABLE_TEXT_LOGGING == 1
565 
566  void DpWriterComponentBase ::
567  set_textEventOut_OutputPort(
568  FwIndexType portNum,
569  Fw::InputSerializePort* port
570  )
571  {
572  FW_ASSERT(
573  (0 <= portNum) && (portNum < this->getNum_textEventOut_OutputPorts()),
574  static_cast<FwAssertArgType>(portNum)
575  );
576 
577  this->m_textEventOut_OutputPort[portNum].registerSerialPort(port);
578  }
579 
580 #endif
581 
584  FwIndexType portNum,
585  Fw::InputSerializePort* port
586  )
587  {
588  FW_ASSERT(
589  (0 <= portNum) && (portNum < this->getNum_timeGetOut_OutputPorts()),
590  static_cast<FwAssertArgType>(portNum)
591  );
592 
593  this->m_timeGetOut_OutputPort[portNum].registerSerialPort(port);
594  }
595 
598  FwIndexType portNum,
599  Fw::InputSerializePort* port
600  )
601  {
602  FW_ASSERT(
603  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
604  static_cast<FwAssertArgType>(portNum)
605  );
606 
607  this->m_tlmOut_OutputPort[portNum].registerSerialPort(port);
608  }
609 
610 #endif
611 
612 #if FW_PORT_SERIALIZATION
613 
614  // ----------------------------------------------------------------------
615  // Connect serial input ports to typed output ports
616  // ----------------------------------------------------------------------
617 
620  FwIndexType portNum,
621  Fw::InputSerializePort* port
622  )
623  {
624  FW_ASSERT(
625  (0 <= portNum) && (portNum < this->getNum_deallocBufferSendOut_OutputPorts()),
626  static_cast<FwAssertArgType>(portNum)
627  );
628 
629  this->m_deallocBufferSendOut_OutputPort[portNum].registerSerialPort(port);
630  }
631 
634  FwIndexType portNum,
635  Fw::InputSerializePort* port
636  )
637  {
638  FW_ASSERT(
639  (0 <= portNum) && (portNum < this->getNum_dpWrittenOut_OutputPorts()),
640  static_cast<FwAssertArgType>(portNum)
641  );
642 
643  this->m_dpWrittenOut_OutputPort[portNum].registerSerialPort(port);
644  }
645 
648  FwIndexType portNum,
649  Fw::InputSerializePort* port
650  )
651  {
652  FW_ASSERT(
653  (0 <= portNum) && (portNum < this->getNum_procBufferSendOut_OutputPorts()),
654  static_cast<FwAssertArgType>(portNum)
655  );
656 
657  this->m_procBufferSendOut_OutputPort[portNum].registerSerialPort(port);
658  }
659 
660 #endif
661 
662  // ----------------------------------------------------------------------
663  // Command registration
664  // ----------------------------------------------------------------------
665 
668  {
669  FW_ASSERT(this->m_cmdRegIn_OutputPort[0].isConnected());
670 
671  this->m_cmdRegIn_OutputPort[0].invoke(
673  );
674  }
675 
676  // ----------------------------------------------------------------------
677  // Component construction and destruction
678  // ----------------------------------------------------------------------
679 
681  DpWriterComponentBase(const char* compName) :
682  Fw::ActiveComponentBase(compName)
683  {
684  // Write telemetry channel NumBuffersReceived
685  this->m_first_update_NumBuffersReceived = true;
686  this->m_last_NumBuffersReceived = 0;
687 
688  // Write telemetry channel NumBytesWritten
689  this->m_first_update_NumBytesWritten = true;
690  this->m_last_NumBytesWritten = 0;
691 
692  // Write telemetry channel NumSuccessfulWrites
693  this->m_first_update_NumSuccessfulWrites = true;
694  this->m_last_NumSuccessfulWrites = 0;
695 
696  // Write telemetry channel NumFailedWrites
697  this->m_first_update_NumFailedWrites = true;
698  this->m_last_NumFailedWrites = 0;
699 
700  // Write telemetry channel NumErrors
701  this->m_first_update_NumErrors = true;
702  this->m_last_NumErrors = 0;
703 
704  this->m_InvalidBufferThrottle = 0;
705  this->m_BufferTooSmallForPacketThrottle = 0;
706  this->m_InvalidHeaderHashThrottle = 0;
707  this->m_InvalidHeaderThrottle = 0;
708  this->m_BufferTooSmallForDataThrottle = 0;
709  this->m_FileOpenErrorThrottle = 0;
710  this->m_FileWriteErrorThrottle = 0;
711  }
712 
715  {
716 
717  }
718 
719  // ----------------------------------------------------------------------
720  // Getters for numbers of special input ports
721  // ----------------------------------------------------------------------
722 
725  {
726  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_cmdIn_InputPort));
727  }
728 
729  // ----------------------------------------------------------------------
730  // Getters for numbers of typed input ports
731  // ----------------------------------------------------------------------
732 
735  {
736  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_bufferSendIn_InputPort));
737  }
738 
741  {
742  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_schedIn_InputPort));
743  }
744 
745  // ----------------------------------------------------------------------
746  // Getters for numbers of special output ports
747  // ----------------------------------------------------------------------
748 
751  {
752  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_cmdRegIn_OutputPort));
753  }
754 
757  {
758  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_cmdResponseOut_OutputPort));
759  }
760 
763  {
764  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_eventOut_OutputPort));
765  }
766 
767 #if FW_ENABLE_TEXT_LOGGING == 1
768 
769  FwIndexType DpWriterComponentBase ::
770  getNum_textEventOut_OutputPorts() const
771  {
772  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_textEventOut_OutputPort));
773  }
774 
775 #endif
776 
779  {
780  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_timeGetOut_OutputPort));
781  }
782 
785  {
786  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_tlmOut_OutputPort));
787  }
788 
789  // ----------------------------------------------------------------------
790  // Getters for numbers of typed output ports
791  // ----------------------------------------------------------------------
792 
795  {
796  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_deallocBufferSendOut_OutputPort));
797  }
798 
801  {
802  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_dpWrittenOut_OutputPort));
803  }
804 
807  {
808  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_procBufferSendOut_OutputPort));
809  }
810 
811  // ----------------------------------------------------------------------
812  // Connection status queries for special output ports
813  // ----------------------------------------------------------------------
814 
817  {
818  FW_ASSERT(
819  (0 <= portNum) && (portNum < this->getNum_cmdRegIn_OutputPorts()),
820  static_cast<FwAssertArgType>(portNum)
821  );
822 
823  return this->m_cmdRegIn_OutputPort[portNum].isConnected();
824  }
825 
828  {
829  FW_ASSERT(
830  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
831  static_cast<FwAssertArgType>(portNum)
832  );
833 
834  return this->m_cmdResponseOut_OutputPort[portNum].isConnected();
835  }
836 
839  {
840  FW_ASSERT(
841  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
842  static_cast<FwAssertArgType>(portNum)
843  );
844 
845  return this->m_eventOut_OutputPort[portNum].isConnected();
846  }
847 
848 #if FW_ENABLE_TEXT_LOGGING == 1
849 
850  bool DpWriterComponentBase ::
851  isConnected_textEventOut_OutputPort(FwIndexType portNum)
852  {
853  FW_ASSERT(
854  (0 <= portNum) && (portNum < this->getNum_textEventOut_OutputPorts()),
855  static_cast<FwAssertArgType>(portNum)
856  );
857 
858  return this->m_textEventOut_OutputPort[portNum].isConnected();
859  }
860 
861 #endif
862 
865  {
866  FW_ASSERT(
867  (0 <= portNum) && (portNum < this->getNum_timeGetOut_OutputPorts()),
868  static_cast<FwAssertArgType>(portNum)
869  );
870 
871  return this->m_timeGetOut_OutputPort[portNum].isConnected();
872  }
873 
876  {
877  FW_ASSERT(
878  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
879  static_cast<FwAssertArgType>(portNum)
880  );
881 
882  return this->m_tlmOut_OutputPort[portNum].isConnected();
883  }
884 
885  // ----------------------------------------------------------------------
886  // Connection status queries for typed output ports
887  // ----------------------------------------------------------------------
888 
891  {
892  FW_ASSERT(
893  (0 <= portNum) && (portNum < this->getNum_deallocBufferSendOut_OutputPorts()),
894  static_cast<FwAssertArgType>(portNum)
895  );
896 
897  return this->m_deallocBufferSendOut_OutputPort[portNum].isConnected();
898  }
899 
902  {
903  FW_ASSERT(
904  (0 <= portNum) && (portNum < this->getNum_dpWrittenOut_OutputPorts()),
905  static_cast<FwAssertArgType>(portNum)
906  );
907 
908  return this->m_dpWrittenOut_OutputPort[portNum].isConnected();
909  }
910 
913  {
914  FW_ASSERT(
915  (0 <= portNum) && (portNum < this->getNum_procBufferSendOut_OutputPorts()),
916  static_cast<FwAssertArgType>(portNum)
917  );
918 
919  return this->m_procBufferSendOut_OutputPort[portNum].isConnected();
920  }
921 
922  // ----------------------------------------------------------------------
923  // Port handler base-class functions for typed input ports
924  //
925  // Call these functions directly to bypass the corresponding ports
926  // ----------------------------------------------------------------------
927 
930  FwIndexType portNum,
931  Fw::Buffer& fwBuffer
932  )
933  {
934  // Make sure port number is valid
935  FW_ASSERT(
936  (0 <= portNum) && (portNum < this->getNum_bufferSendIn_InputPorts()),
937  static_cast<FwAssertArgType>(portNum)
938  );
939 
940  // Call pre-message hook
942  portNum,
943  fwBuffer
944  );
945  ComponentIpcSerializableBuffer msg;
947 
948  // Serialize message ID
949  _status = msg.serialize(
950  static_cast<FwEnumStoreType>(BUFFERSENDIN_BUFFERSEND)
951  );
952  FW_ASSERT(
953  _status == Fw::FW_SERIALIZE_OK,
954  static_cast<FwAssertArgType>(_status)
955  );
956 
957  // Serialize port number
958  _status = msg.serialize(portNum);
959  FW_ASSERT(
960  _status == Fw::FW_SERIALIZE_OK,
961  static_cast<FwAssertArgType>(_status)
962  );
963 
964  // Serialize argument fwBuffer
965  _status = msg.serialize(fwBuffer);
966  FW_ASSERT(
967  _status == Fw::FW_SERIALIZE_OK,
968  static_cast<FwAssertArgType>(_status)
969  );
970 
971  // Send message
973  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
974 
975  FW_ASSERT(
976  qStatus == Os::Queue::OP_OK,
977  static_cast<FwAssertArgType>(qStatus)
978  );
979  }
980 
983  FwIndexType portNum,
984  U32 context
985  )
986  {
987  // Make sure port number is valid
988  FW_ASSERT(
989  (0 <= portNum) && (portNum < this->getNum_schedIn_InputPorts()),
990  static_cast<FwAssertArgType>(portNum)
991  );
992 
993  // Call pre-message hook
995  portNum,
996  context
997  );
998  ComponentIpcSerializableBuffer msg;
1000 
1001  // Serialize message ID
1002  _status = msg.serialize(
1003  static_cast<FwEnumStoreType>(SCHEDIN_SCHED)
1004  );
1005  FW_ASSERT(
1006  _status == Fw::FW_SERIALIZE_OK,
1007  static_cast<FwAssertArgType>(_status)
1008  );
1009 
1010  // Serialize port number
1011  _status = msg.serialize(portNum);
1012  FW_ASSERT(
1013  _status == Fw::FW_SERIALIZE_OK,
1014  static_cast<FwAssertArgType>(_status)
1015  );
1016 
1017  // Serialize argument context
1018  _status = msg.serialize(context);
1019  FW_ASSERT(
1020  _status == Fw::FW_SERIALIZE_OK,
1021  static_cast<FwAssertArgType>(_status)
1022  );
1023 
1024  // Send message
1026  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1027 
1028  FW_ASSERT(
1029  qStatus == Os::Queue::OP_OK,
1030  static_cast<FwAssertArgType>(qStatus)
1031  );
1032  }
1033 
1034  // ----------------------------------------------------------------------
1035  // Pre-message hooks for typed async input ports
1036  //
1037  // Each of these functions is invoked just before processing a message
1038  // on the corresponding port. By default, they do nothing. You can
1039  // override them to provide specific pre-message behavior.
1040  // ----------------------------------------------------------------------
1041 
1044  FwIndexType portNum,
1045  Fw::Buffer& fwBuffer
1046  )
1047  {
1048  // Default: no-op
1049  }
1050 
1053  FwIndexType portNum,
1054  U32 context
1055  )
1056  {
1057  // Default: no-op
1058  }
1059 
1060  // ----------------------------------------------------------------------
1061  // Invocation functions for typed output ports
1062  // ----------------------------------------------------------------------
1063 
1066  FwIndexType portNum,
1067  Fw::Buffer& fwBuffer
1068  )
1069  {
1070  FW_ASSERT(
1071  (0 <= portNum) && (portNum < this->getNum_deallocBufferSendOut_OutputPorts()),
1072  static_cast<FwAssertArgType>(portNum)
1073  );
1074 
1075  FW_ASSERT(
1076  this->m_deallocBufferSendOut_OutputPort[portNum].isConnected(),
1077  static_cast<FwAssertArgType>(portNum)
1078  );
1079  this->m_deallocBufferSendOut_OutputPort[portNum].invoke(
1080  fwBuffer
1081  );
1082  }
1083 
1086  FwIndexType portNum,
1087  const Fw::StringBase& fileName,
1088  FwDpPriorityType priority,
1089  FwSizeType size
1090  )
1091  {
1092  FW_ASSERT(
1093  (0 <= portNum) && (portNum < this->getNum_dpWrittenOut_OutputPorts()),
1094  static_cast<FwAssertArgType>(portNum)
1095  );
1096 
1097  FW_ASSERT(
1098  this->m_dpWrittenOut_OutputPort[portNum].isConnected(),
1099  static_cast<FwAssertArgType>(portNum)
1100  );
1101  this->m_dpWrittenOut_OutputPort[portNum].invoke(
1102  fileName,
1103  priority,
1104  size
1105  );
1106  }
1107 
1110  FwIndexType portNum,
1111  Fw::Buffer& fwBuffer
1112  )
1113  {
1114  FW_ASSERT(
1115  (0 <= portNum) && (portNum < this->getNum_procBufferSendOut_OutputPorts()),
1116  static_cast<FwAssertArgType>(portNum)
1117  );
1118 
1119  FW_ASSERT(
1120  this->m_procBufferSendOut_OutputPort[portNum].isConnected(),
1121  static_cast<FwAssertArgType>(portNum)
1122  );
1123  this->m_procBufferSendOut_OutputPort[portNum].invoke(
1124  fwBuffer
1125  );
1126  }
1127 
1128  // ----------------------------------------------------------------------
1129  // Command response
1130  // ----------------------------------------------------------------------
1131 
1134  FwOpcodeType opCode,
1135  U32 cmdSeq,
1136  Fw::CmdResponse response
1137  )
1138  {
1139  FW_ASSERT(this->m_cmdResponseOut_OutputPort[0].isConnected());
1140  this->m_cmdResponseOut_OutputPort[0].invoke(opCode, cmdSeq, response);
1141  }
1142 
1143  // ----------------------------------------------------------------------
1144  // Command handler base-class functions
1145  //
1146  // Call these functions directly to bypass the command input port
1147  // ----------------------------------------------------------------------
1148 
1151  FwOpcodeType opCode,
1152  U32 cmdSeq,
1153  Fw::CmdArgBuffer& args
1154  )
1155  {
1156  // Call pre-message hook
1157  this->CLEAR_EVENT_THROTTLE_preMsgHook(opCode,cmdSeq);
1158 
1159  // Defer deserializing arguments to the message dispatcher
1160  // to avoid deserializing and reserializing just for IPC
1161  ComponentIpcSerializableBuffer msg;
1163 
1164  // Serialize for IPC
1165  _status = msg.serialize(static_cast<FwEnumStoreType>(CMD_CLEAR_EVENT_THROTTLE));
1166  FW_ASSERT (
1167  _status == Fw::FW_SERIALIZE_OK,
1168  static_cast<FwAssertArgType>(_status)
1169  );
1170 
1171  // Fake port number to make message dequeue work
1172  FwIndexType port = 0;
1173 
1174  _status = msg.serialize(port);
1175  FW_ASSERT (
1176  _status == Fw::FW_SERIALIZE_OK,
1177  static_cast<FwAssertArgType>(_status)
1178  );
1179 
1180  _status = msg.serialize(opCode);
1181  FW_ASSERT (
1182  _status == Fw::FW_SERIALIZE_OK,
1183  static_cast<FwAssertArgType>(_status)
1184  );
1185 
1186  _status = msg.serialize(cmdSeq);
1187  FW_ASSERT (
1188  _status == Fw::FW_SERIALIZE_OK,
1189  static_cast<FwAssertArgType>(_status)
1190  );
1191 
1192  _status = msg.serialize(args);
1193  FW_ASSERT (
1194  _status == Fw::FW_SERIALIZE_OK,
1195  static_cast<FwAssertArgType>(_status)
1196  );
1197 
1198  // Send message
1200  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1201 
1202  FW_ASSERT(
1203  qStatus == Os::Queue::OP_OK,
1204  static_cast<FwAssertArgType>(qStatus)
1205  );
1206  }
1207 
1208  // ----------------------------------------------------------------------
1209  // Pre-message hooks for async commands
1210  //
1211  // Each of these functions is invoked just before processing the
1212  // corresponding command. By default they do nothing. You can
1213  // override them to provide specific pre-command behavior.
1214  // ----------------------------------------------------------------------
1215 
1218  FwOpcodeType opCode,
1219  U32 cmdSeq
1220  )
1221  {
1222  // Defaults to no-op; can be overridden
1223  (void) opCode;
1224  (void) cmdSeq;
1225  }
1226 
1227  // ----------------------------------------------------------------------
1228  // Event logging functions
1229  // ----------------------------------------------------------------------
1230 
1233  {
1234  // Check throttle value
1235  if (this->m_InvalidBufferThrottle >= EVENTID_INVALIDBUFFER_THROTTLE) {
1236  return;
1237  }
1238  else {
1239  (void) this->m_InvalidBufferThrottle.fetch_add(1);
1240  }
1241 
1242  // Get the time
1243  Fw::Time _logTime;
1244  if (this->m_timeGetOut_OutputPort[0].isConnected()) {
1245  this->m_timeGetOut_OutputPort[0].invoke(_logTime);
1246  }
1247 
1248  FwEventIdType _id = static_cast<FwEventIdType>(0);
1249 
1250  _id = this->getIdBase() + EVENTID_INVALIDBUFFER;
1251 
1252  // Emit the event on the log port
1253  if (this->m_eventOut_OutputPort[0].isConnected()) {
1254  Fw::LogBuffer _logBuff;
1255 
1256 #if FW_AMPCS_COMPATIBLE
1258  // Serialize the number of arguments
1259  _status = _logBuff.serialize(static_cast<U8>(0));
1260  FW_ASSERT(
1261  _status == Fw::FW_SERIALIZE_OK,
1262  static_cast<FwAssertArgType>(_status)
1263  );
1264 #endif
1265 
1266  this->m_eventOut_OutputPort[0].invoke(
1267  _id,
1268  _logTime,
1270  _logBuff
1271  );
1272  }
1273 
1274  // Emit the event on the text log port
1275 #if FW_ENABLE_TEXT_LOGGING
1276  if (this->m_textEventOut_OutputPort[0].isConnected()) {
1277 #if FW_OBJECT_NAMES == 1
1278  const char* _formatString =
1279  "(%s) %s: Received buffer is invalid";
1280 #else
1281  const char* _formatString =
1282  "%s: Received buffer is invalid";
1283 #endif
1284 
1285  Fw::TextLogString _logString;
1286  _logString.format(
1287  _formatString,
1288 #if FW_OBJECT_NAMES == 1
1289  this->m_objName.toChar(),
1290 #endif
1291  "InvalidBuffer "
1292  );
1293 
1294  this->m_textEventOut_OutputPort[0].invoke(
1295  _id,
1296  _logTime,
1298  _logString
1299  );
1300  }
1301 #endif
1302  }
1303 
1306  U32 bufferSize,
1307  U32 minSize
1308  )
1309  {
1310  // Check throttle value
1311  if (this->m_BufferTooSmallForPacketThrottle >= EVENTID_BUFFERTOOSMALLFORPACKET_THROTTLE) {
1312  return;
1313  }
1314  else {
1315  (void) this->m_BufferTooSmallForPacketThrottle.fetch_add(1);
1316  }
1317 
1318  // Get the time
1319  Fw::Time _logTime;
1320  if (this->m_timeGetOut_OutputPort[0].isConnected()) {
1321  this->m_timeGetOut_OutputPort[0].invoke(_logTime);
1322  }
1323 
1324  FwEventIdType _id = static_cast<FwEventIdType>(0);
1325 
1327 
1328  // Emit the event on the log port
1329  if (this->m_eventOut_OutputPort[0].isConnected()) {
1330  Fw::LogBuffer _logBuff;
1332 
1333 #if FW_AMPCS_COMPATIBLE
1334  // Serialize the number of arguments
1335  _status = _logBuff.serialize(static_cast<U8>(2));
1336  FW_ASSERT(
1337  _status == Fw::FW_SERIALIZE_OK,
1338  static_cast<FwAssertArgType>(_status)
1339  );
1340 #endif
1341 
1342 #if FW_AMPCS_COMPATIBLE
1343  // Serialize the argument size
1344  _status = _logBuff.serialize(
1345  static_cast<U8>(sizeof(U32))
1346  );
1347  FW_ASSERT(
1348  _status == Fw::FW_SERIALIZE_OK,
1349  static_cast<FwAssertArgType>(_status)
1350  );
1351 #endif
1352  _status = _logBuff.serialize(bufferSize);
1353  FW_ASSERT(
1354  _status == Fw::FW_SERIALIZE_OK,
1355  static_cast<FwAssertArgType>(_status)
1356  );
1357 
1358 #if FW_AMPCS_COMPATIBLE
1359  // Serialize the argument size
1360  _status = _logBuff.serialize(
1361  static_cast<U8>(sizeof(U32))
1362  );
1363  FW_ASSERT(
1364  _status == Fw::FW_SERIALIZE_OK,
1365  static_cast<FwAssertArgType>(_status)
1366  );
1367 #endif
1368  _status = _logBuff.serialize(minSize);
1369  FW_ASSERT(
1370  _status == Fw::FW_SERIALIZE_OK,
1371  static_cast<FwAssertArgType>(_status)
1372  );
1373 
1374  this->m_eventOut_OutputPort[0].invoke(
1375  _id,
1376  _logTime,
1378  _logBuff
1379  );
1380  }
1381 
1382  // Emit the event on the text log port
1383 #if FW_ENABLE_TEXT_LOGGING
1384  if (this->m_textEventOut_OutputPort[0].isConnected()) {
1385 #if FW_OBJECT_NAMES == 1
1386  const char* _formatString =
1387  "(%s) %s: Received buffer has size %" PRIu32 "; minimum required size is %" PRIu32 "";
1388 #else
1389  const char* _formatString =
1390  "%s: Received buffer has size %" PRIu32 "; minimum required size is %" PRIu32 "";
1391 #endif
1392 
1393  Fw::TextLogString _logString;
1394  _logString.format(
1395  _formatString,
1396 #if FW_OBJECT_NAMES == 1
1397  this->m_objName.toChar(),
1398 #endif
1399  "BufferTooSmallForPacket ",
1400  bufferSize,
1401  minSize
1402  );
1403 
1404  this->m_textEventOut_OutputPort[0].invoke(
1405  _id,
1406  _logTime,
1408  _logString
1409  );
1410  }
1411 #endif
1412  }
1413 
1416  U32 bufferSize,
1417  U32 storedHash,
1418  U32 computedHash
1419  )
1420  {
1421  // Check throttle value
1422  if (this->m_InvalidHeaderHashThrottle >= EVENTID_INVALIDHEADERHASH_THROTTLE) {
1423  return;
1424  }
1425  else {
1426  (void) this->m_InvalidHeaderHashThrottle.fetch_add(1);
1427  }
1428 
1429  // Get the time
1430  Fw::Time _logTime;
1431  if (this->m_timeGetOut_OutputPort[0].isConnected()) {
1432  this->m_timeGetOut_OutputPort[0].invoke(_logTime);
1433  }
1434 
1435  FwEventIdType _id = static_cast<FwEventIdType>(0);
1436 
1437  _id = this->getIdBase() + EVENTID_INVALIDHEADERHASH;
1438 
1439  // Emit the event on the log port
1440  if (this->m_eventOut_OutputPort[0].isConnected()) {
1441  Fw::LogBuffer _logBuff;
1443 
1444 #if FW_AMPCS_COMPATIBLE
1445  // Serialize the number of arguments
1446  _status = _logBuff.serialize(static_cast<U8>(3));
1447  FW_ASSERT(
1448  _status == Fw::FW_SERIALIZE_OK,
1449  static_cast<FwAssertArgType>(_status)
1450  );
1451 #endif
1452 
1453 #if FW_AMPCS_COMPATIBLE
1454  // Serialize the argument size
1455  _status = _logBuff.serialize(
1456  static_cast<U8>(sizeof(U32))
1457  );
1458  FW_ASSERT(
1459  _status == Fw::FW_SERIALIZE_OK,
1460  static_cast<FwAssertArgType>(_status)
1461  );
1462 #endif
1463  _status = _logBuff.serialize(bufferSize);
1464  FW_ASSERT(
1465  _status == Fw::FW_SERIALIZE_OK,
1466  static_cast<FwAssertArgType>(_status)
1467  );
1468 
1469 #if FW_AMPCS_COMPATIBLE
1470  // Serialize the argument size
1471  _status = _logBuff.serialize(
1472  static_cast<U8>(sizeof(U32))
1473  );
1474  FW_ASSERT(
1475  _status == Fw::FW_SERIALIZE_OK,
1476  static_cast<FwAssertArgType>(_status)
1477  );
1478 #endif
1479  _status = _logBuff.serialize(storedHash);
1480  FW_ASSERT(
1481  _status == Fw::FW_SERIALIZE_OK,
1482  static_cast<FwAssertArgType>(_status)
1483  );
1484 
1485 #if FW_AMPCS_COMPATIBLE
1486  // Serialize the argument size
1487  _status = _logBuff.serialize(
1488  static_cast<U8>(sizeof(U32))
1489  );
1490  FW_ASSERT(
1491  _status == Fw::FW_SERIALIZE_OK,
1492  static_cast<FwAssertArgType>(_status)
1493  );
1494 #endif
1495  _status = _logBuff.serialize(computedHash);
1496  FW_ASSERT(
1497  _status == Fw::FW_SERIALIZE_OK,
1498  static_cast<FwAssertArgType>(_status)
1499  );
1500 
1501  this->m_eventOut_OutputPort[0].invoke(
1502  _id,
1503  _logTime,
1505  _logBuff
1506  );
1507  }
1508 
1509  // Emit the event on the text log port
1510 #if FW_ENABLE_TEXT_LOGGING
1511  if (this->m_textEventOut_OutputPort[0].isConnected()) {
1512 #if FW_OBJECT_NAMES == 1
1513  const char* _formatString =
1514  "(%s) %s: Received a buffer of size %" PRIu32 " with an invalid header hash (stored %" PRIx32 ", computed %" PRIx32 ")";
1515 #else
1516  const char* _formatString =
1517  "%s: Received a buffer of size %" PRIu32 " with an invalid header hash (stored %" PRIx32 ", computed %" PRIx32 ")";
1518 #endif
1519 
1520  Fw::TextLogString _logString;
1521  _logString.format(
1522  _formatString,
1523 #if FW_OBJECT_NAMES == 1
1524  this->m_objName.toChar(),
1525 #endif
1526  "InvalidHeaderHash ",
1527  bufferSize,
1528  storedHash,
1529  computedHash
1530  );
1531 
1532  this->m_textEventOut_OutputPort[0].invoke(
1533  _id,
1534  _logTime,
1536  _logString
1537  );
1538  }
1539 #endif
1540  }
1541 
1544  U32 bufferSize,
1545  U32 errorCode
1546  )
1547  {
1548  // Check throttle value
1549  if (this->m_InvalidHeaderThrottle >= EVENTID_INVALIDHEADER_THROTTLE) {
1550  return;
1551  }
1552  else {
1553  (void) this->m_InvalidHeaderThrottle.fetch_add(1);
1554  }
1555 
1556  // Get the time
1557  Fw::Time _logTime;
1558  if (this->m_timeGetOut_OutputPort[0].isConnected()) {
1559  this->m_timeGetOut_OutputPort[0].invoke(_logTime);
1560  }
1561 
1562  FwEventIdType _id = static_cast<FwEventIdType>(0);
1563 
1564  _id = this->getIdBase() + EVENTID_INVALIDHEADER;
1565 
1566  // Emit the event on the log port
1567  if (this->m_eventOut_OutputPort[0].isConnected()) {
1568  Fw::LogBuffer _logBuff;
1570 
1571 #if FW_AMPCS_COMPATIBLE
1572  // Serialize the number of arguments
1573  _status = _logBuff.serialize(static_cast<U8>(2));
1574  FW_ASSERT(
1575  _status == Fw::FW_SERIALIZE_OK,
1576  static_cast<FwAssertArgType>(_status)
1577  );
1578 #endif
1579 
1580 #if FW_AMPCS_COMPATIBLE
1581  // Serialize the argument size
1582  _status = _logBuff.serialize(
1583  static_cast<U8>(sizeof(U32))
1584  );
1585  FW_ASSERT(
1586  _status == Fw::FW_SERIALIZE_OK,
1587  static_cast<FwAssertArgType>(_status)
1588  );
1589 #endif
1590  _status = _logBuff.serialize(bufferSize);
1591  FW_ASSERT(
1592  _status == Fw::FW_SERIALIZE_OK,
1593  static_cast<FwAssertArgType>(_status)
1594  );
1595 
1596 #if FW_AMPCS_COMPATIBLE
1597  // Serialize the argument size
1598  _status = _logBuff.serialize(
1599  static_cast<U8>(sizeof(U32))
1600  );
1601  FW_ASSERT(
1602  _status == Fw::FW_SERIALIZE_OK,
1603  static_cast<FwAssertArgType>(_status)
1604  );
1605 #endif
1606  _status = _logBuff.serialize(errorCode);
1607  FW_ASSERT(
1608  _status == Fw::FW_SERIALIZE_OK,
1609  static_cast<FwAssertArgType>(_status)
1610  );
1611 
1612  this->m_eventOut_OutputPort[0].invoke(
1613  _id,
1614  _logTime,
1616  _logBuff
1617  );
1618  }
1619 
1620  // Emit the event on the text log port
1621 #if FW_ENABLE_TEXT_LOGGING
1622  if (this->m_textEventOut_OutputPort[0].isConnected()) {
1623 #if FW_OBJECT_NAMES == 1
1624  const char* _formatString =
1625  "(%s) %s: Received buffer of size %" PRIu32 "; deserialization of packet header failed with error code %" PRIu32 "";
1626 #else
1627  const char* _formatString =
1628  "%s: Received buffer of size %" PRIu32 "; deserialization of packet header failed with error code %" PRIu32 "";
1629 #endif
1630 
1631  Fw::TextLogString _logString;
1632  _logString.format(
1633  _formatString,
1634 #if FW_OBJECT_NAMES == 1
1635  this->m_objName.toChar(),
1636 #endif
1637  "InvalidHeader ",
1638  bufferSize,
1639  errorCode
1640  );
1641 
1642  this->m_textEventOut_OutputPort[0].invoke(
1643  _id,
1644  _logTime,
1646  _logString
1647  );
1648  }
1649 #endif
1650  }
1651 
1654  U32 bufferSize,
1655  U32 minSize
1656  )
1657  {
1658  // Check throttle value
1659  if (this->m_BufferTooSmallForDataThrottle >= EVENTID_BUFFERTOOSMALLFORDATA_THROTTLE) {
1660  return;
1661  }
1662  else {
1663  (void) this->m_BufferTooSmallForDataThrottle.fetch_add(1);
1664  }
1665 
1666  // Get the time
1667  Fw::Time _logTime;
1668  if (this->m_timeGetOut_OutputPort[0].isConnected()) {
1669  this->m_timeGetOut_OutputPort[0].invoke(_logTime);
1670  }
1671 
1672  FwEventIdType _id = static_cast<FwEventIdType>(0);
1673 
1674  _id = this->getIdBase() + EVENTID_BUFFERTOOSMALLFORDATA;
1675 
1676  // Emit the event on the log port
1677  if (this->m_eventOut_OutputPort[0].isConnected()) {
1678  Fw::LogBuffer _logBuff;
1680 
1681 #if FW_AMPCS_COMPATIBLE
1682  // Serialize the number of arguments
1683  _status = _logBuff.serialize(static_cast<U8>(2));
1684  FW_ASSERT(
1685  _status == Fw::FW_SERIALIZE_OK,
1686  static_cast<FwAssertArgType>(_status)
1687  );
1688 #endif
1689 
1690 #if FW_AMPCS_COMPATIBLE
1691  // Serialize the argument size
1692  _status = _logBuff.serialize(
1693  static_cast<U8>(sizeof(U32))
1694  );
1695  FW_ASSERT(
1696  _status == Fw::FW_SERIALIZE_OK,
1697  static_cast<FwAssertArgType>(_status)
1698  );
1699 #endif
1700  _status = _logBuff.serialize(bufferSize);
1701  FW_ASSERT(
1702  _status == Fw::FW_SERIALIZE_OK,
1703  static_cast<FwAssertArgType>(_status)
1704  );
1705 
1706 #if FW_AMPCS_COMPATIBLE
1707  // Serialize the argument size
1708  _status = _logBuff.serialize(
1709  static_cast<U8>(sizeof(U32))
1710  );
1711  FW_ASSERT(
1712  _status == Fw::FW_SERIALIZE_OK,
1713  static_cast<FwAssertArgType>(_status)
1714  );
1715 #endif
1716  _status = _logBuff.serialize(minSize);
1717  FW_ASSERT(
1718  _status == Fw::FW_SERIALIZE_OK,
1719  static_cast<FwAssertArgType>(_status)
1720  );
1721 
1722  this->m_eventOut_OutputPort[0].invoke(
1723  _id,
1724  _logTime,
1726  _logBuff
1727  );
1728  }
1729 
1730  // Emit the event on the text log port
1731 #if FW_ENABLE_TEXT_LOGGING
1732  if (this->m_textEventOut_OutputPort[0].isConnected()) {
1733 #if FW_OBJECT_NAMES == 1
1734  const char* _formatString =
1735  "(%s) %s: Received buffer has size %" PRIu32 "; minimum required size is %" PRIu32 "";
1736 #else
1737  const char* _formatString =
1738  "%s: Received buffer has size %" PRIu32 "; minimum required size is %" PRIu32 "";
1739 #endif
1740 
1741  Fw::TextLogString _logString;
1742  _logString.format(
1743  _formatString,
1744 #if FW_OBJECT_NAMES == 1
1745  this->m_objName.toChar(),
1746 #endif
1747  "BufferTooSmallForData ",
1748  bufferSize,
1749  minSize
1750  );
1751 
1752  this->m_textEventOut_OutputPort[0].invoke(
1753  _id,
1754  _logTime,
1756  _logString
1757  );
1758  }
1759 #endif
1760  }
1761 
1764  U32 status,
1765  const Fw::StringBase& file
1766  )
1767  {
1768  // Check throttle value
1769  if (this->m_FileOpenErrorThrottle >= EVENTID_FILEOPENERROR_THROTTLE) {
1770  return;
1771  }
1772  else {
1773  (void) this->m_FileOpenErrorThrottle.fetch_add(1);
1774  }
1775 
1776  // Get the time
1777  Fw::Time _logTime;
1778  if (this->m_timeGetOut_OutputPort[0].isConnected()) {
1779  this->m_timeGetOut_OutputPort[0].invoke(_logTime);
1780  }
1781 
1782  FwEventIdType _id = static_cast<FwEventIdType>(0);
1783 
1784  _id = this->getIdBase() + EVENTID_FILEOPENERROR;
1785 
1786  // Emit the event on the log port
1787  if (this->m_eventOut_OutputPort[0].isConnected()) {
1788  Fw::LogBuffer _logBuff;
1790 
1791 #if FW_AMPCS_COMPATIBLE
1792  // Serialize the number of arguments
1793  _status = _logBuff.serialize(static_cast<U8>(2));
1794  FW_ASSERT(
1795  _status == Fw::FW_SERIALIZE_OK,
1796  static_cast<FwAssertArgType>(_status)
1797  );
1798 #endif
1799 
1800 #if FW_AMPCS_COMPATIBLE
1801  // Serialize the argument size
1802  _status = _logBuff.serialize(
1803  static_cast<U8>(sizeof(U32))
1804  );
1805  FW_ASSERT(
1806  _status == Fw::FW_SERIALIZE_OK,
1807  static_cast<FwAssertArgType>(_status)
1808  );
1809 #endif
1810  _status = _logBuff.serialize(status);
1811  FW_ASSERT(
1812  _status == Fw::FW_SERIALIZE_OK,
1813  static_cast<FwAssertArgType>(_status)
1814  );
1815 
1816  _status = file.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 200));
1817  FW_ASSERT(
1818  _status == Fw::FW_SERIALIZE_OK,
1819  static_cast<FwAssertArgType>(_status)
1820  );
1821 
1822  this->m_eventOut_OutputPort[0].invoke(
1823  _id,
1824  _logTime,
1826  _logBuff
1827  );
1828  }
1829 
1830  // Emit the event on the text log port
1831 #if FW_ENABLE_TEXT_LOGGING
1832  if (this->m_textEventOut_OutputPort[0].isConnected()) {
1833 #if FW_OBJECT_NAMES == 1
1834  const char* _formatString =
1835  "(%s) %s: Error %" PRIu32 " opening file %s";
1836 #else
1837  const char* _formatString =
1838  "%s: Error %" PRIu32 " opening file %s";
1839 #endif
1840 
1841  Fw::TextLogString _logString;
1842  _logString.format(
1843  _formatString,
1844 #if FW_OBJECT_NAMES == 1
1845  this->m_objName.toChar(),
1846 #endif
1847  "FileOpenError ",
1848  status,
1849  file.toChar()
1850  );
1851 
1852  this->m_textEventOut_OutputPort[0].invoke(
1853  _id,
1854  _logTime,
1856  _logString
1857  );
1858  }
1859 #endif
1860  }
1861 
1864  U32 status,
1865  U32 bytesWritten,
1866  U32 bytesToWrite,
1867  const Fw::StringBase& file
1868  )
1869  {
1870  // Check throttle value
1871  if (this->m_FileWriteErrorThrottle >= EVENTID_FILEWRITEERROR_THROTTLE) {
1872  return;
1873  }
1874  else {
1875  (void) this->m_FileWriteErrorThrottle.fetch_add(1);
1876  }
1877 
1878  // Get the time
1879  Fw::Time _logTime;
1880  if (this->m_timeGetOut_OutputPort[0].isConnected()) {
1881  this->m_timeGetOut_OutputPort[0].invoke(_logTime);
1882  }
1883 
1884  FwEventIdType _id = static_cast<FwEventIdType>(0);
1885 
1886  _id = this->getIdBase() + EVENTID_FILEWRITEERROR;
1887 
1888  // Emit the event on the log port
1889  if (this->m_eventOut_OutputPort[0].isConnected()) {
1890  Fw::LogBuffer _logBuff;
1892 
1893 #if FW_AMPCS_COMPATIBLE
1894  // Serialize the number of arguments
1895  _status = _logBuff.serialize(static_cast<U8>(4));
1896  FW_ASSERT(
1897  _status == Fw::FW_SERIALIZE_OK,
1898  static_cast<FwAssertArgType>(_status)
1899  );
1900 #endif
1901 
1902 #if FW_AMPCS_COMPATIBLE
1903  // Serialize the argument size
1904  _status = _logBuff.serialize(
1905  static_cast<U8>(sizeof(U32))
1906  );
1907  FW_ASSERT(
1908  _status == Fw::FW_SERIALIZE_OK,
1909  static_cast<FwAssertArgType>(_status)
1910  );
1911 #endif
1912  _status = _logBuff.serialize(status);
1913  FW_ASSERT(
1914  _status == Fw::FW_SERIALIZE_OK,
1915  static_cast<FwAssertArgType>(_status)
1916  );
1917 
1918 #if FW_AMPCS_COMPATIBLE
1919  // Serialize the argument size
1920  _status = _logBuff.serialize(
1921  static_cast<U8>(sizeof(U32))
1922  );
1923  FW_ASSERT(
1924  _status == Fw::FW_SERIALIZE_OK,
1925  static_cast<FwAssertArgType>(_status)
1926  );
1927 #endif
1928  _status = _logBuff.serialize(bytesWritten);
1929  FW_ASSERT(
1930  _status == Fw::FW_SERIALIZE_OK,
1931  static_cast<FwAssertArgType>(_status)
1932  );
1933 
1934 #if FW_AMPCS_COMPATIBLE
1935  // Serialize the argument size
1936  _status = _logBuff.serialize(
1937  static_cast<U8>(sizeof(U32))
1938  );
1939  FW_ASSERT(
1940  _status == Fw::FW_SERIALIZE_OK,
1941  static_cast<FwAssertArgType>(_status)
1942  );
1943 #endif
1944  _status = _logBuff.serialize(bytesToWrite);
1945  FW_ASSERT(
1946  _status == Fw::FW_SERIALIZE_OK,
1947  static_cast<FwAssertArgType>(_status)
1948  );
1949 
1950  _status = file.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 200));
1951  FW_ASSERT(
1952  _status == Fw::FW_SERIALIZE_OK,
1953  static_cast<FwAssertArgType>(_status)
1954  );
1955 
1956  this->m_eventOut_OutputPort[0].invoke(
1957  _id,
1958  _logTime,
1960  _logBuff
1961  );
1962  }
1963 
1964  // Emit the event on the text log port
1965 #if FW_ENABLE_TEXT_LOGGING
1966  if (this->m_textEventOut_OutputPort[0].isConnected()) {
1967 #if FW_OBJECT_NAMES == 1
1968  const char* _formatString =
1969  "(%s) %s: Error %" PRIu32 " while writing %" PRIu32 " of %" PRIu32 " bytes to %s";
1970 #else
1971  const char* _formatString =
1972  "%s: Error %" PRIu32 " while writing %" PRIu32 " of %" PRIu32 " bytes to %s";
1973 #endif
1974 
1975  Fw::TextLogString _logString;
1976  _logString.format(
1977  _formatString,
1978 #if FW_OBJECT_NAMES == 1
1979  this->m_objName.toChar(),
1980 #endif
1981  "FileWriteError ",
1982  status,
1983  bytesWritten,
1984  bytesToWrite,
1985  file.toChar()
1986  );
1987 
1988  this->m_textEventOut_OutputPort[0].invoke(
1989  _id,
1990  _logTime,
1992  _logString
1993  );
1994  }
1995 #endif
1996  }
1997 
2000  U32 bytes,
2001  const Fw::StringBase& file
2002  ) const
2003  {
2004  // Get the time
2005  Fw::Time _logTime;
2006  if (this->m_timeGetOut_OutputPort[0].isConnected()) {
2007  this->m_timeGetOut_OutputPort[0].invoke(_logTime);
2008  }
2009 
2010  FwEventIdType _id = static_cast<FwEventIdType>(0);
2011 
2012  _id = this->getIdBase() + EVENTID_FILEWRITTEN;
2013 
2014  // Emit the event on the log port
2015  if (this->m_eventOut_OutputPort[0].isConnected()) {
2016  Fw::LogBuffer _logBuff;
2018 
2019 #if FW_AMPCS_COMPATIBLE
2020  // Serialize the number of arguments
2021  _status = _logBuff.serialize(static_cast<U8>(2));
2022  FW_ASSERT(
2023  _status == Fw::FW_SERIALIZE_OK,
2024  static_cast<FwAssertArgType>(_status)
2025  );
2026 #endif
2027 
2028 #if FW_AMPCS_COMPATIBLE
2029  // Serialize the argument size
2030  _status = _logBuff.serialize(
2031  static_cast<U8>(sizeof(U32))
2032  );
2033  FW_ASSERT(
2034  _status == Fw::FW_SERIALIZE_OK,
2035  static_cast<FwAssertArgType>(_status)
2036  );
2037 #endif
2038  _status = _logBuff.serialize(bytes);
2039  FW_ASSERT(
2040  _status == Fw::FW_SERIALIZE_OK,
2041  static_cast<FwAssertArgType>(_status)
2042  );
2043 
2044  _status = file.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 200));
2045  FW_ASSERT(
2046  _status == Fw::FW_SERIALIZE_OK,
2047  static_cast<FwAssertArgType>(_status)
2048  );
2049 
2050  this->m_eventOut_OutputPort[0].invoke(
2051  _id,
2052  _logTime,
2054  _logBuff
2055  );
2056  }
2057 
2058  // Emit the event on the text log port
2059 #if FW_ENABLE_TEXT_LOGGING
2060  if (this->m_textEventOut_OutputPort[0].isConnected()) {
2061 #if FW_OBJECT_NAMES == 1
2062  const char* _formatString =
2063  "(%s) %s: Wrote %" PRIu32 " bytes to file %s";
2064 #else
2065  const char* _formatString =
2066  "%s: Wrote %" PRIu32 " bytes to file %s";
2067 #endif
2068 
2069  Fw::TextLogString _logString;
2070  _logString.format(
2071  _formatString,
2072 #if FW_OBJECT_NAMES == 1
2073  this->m_objName.toChar(),
2074 #endif
2075  "FileWritten ",
2076  bytes,
2077  file.toChar()
2078  );
2079 
2080  this->m_textEventOut_OutputPort[0].invoke(
2081  _id,
2082  _logTime,
2084  _logString
2085  );
2086  }
2087 #endif
2088  }
2089 
2090  // ----------------------------------------------------------------------
2091  // Event throttle reset functions
2092  // ----------------------------------------------------------------------
2093 
2096  {
2097  // Reset throttle counter
2098  this->m_InvalidBufferThrottle = 0;
2099  }
2100 
2103  {
2104  // Reset throttle counter
2105  this->m_BufferTooSmallForPacketThrottle = 0;
2106  }
2107 
2110  {
2111  // Reset throttle counter
2112  this->m_InvalidHeaderHashThrottle = 0;
2113  }
2114 
2117  {
2118  // Reset throttle counter
2119  this->m_InvalidHeaderThrottle = 0;
2120  }
2121 
2124  {
2125  // Reset throttle counter
2126  this->m_BufferTooSmallForDataThrottle = 0;
2127  }
2128 
2131  {
2132  // Reset throttle counter
2133  this->m_FileOpenErrorThrottle = 0;
2134  }
2135 
2138  {
2139  // Reset throttle counter
2140  this->m_FileWriteErrorThrottle = 0;
2141  }
2142 
2143  // ----------------------------------------------------------------------
2144  // Telemetry write functions
2145  // ----------------------------------------------------------------------
2146 
2149  U32 arg,
2150  Fw::Time _tlmTime
2151  )
2152  {
2153  // Check to see if it is the first time
2154  if (not this->m_first_update_NumBuffersReceived) {
2155  // Check to see if value has changed. If not, don't write it.
2156  if (arg == this->m_last_NumBuffersReceived) {
2157  return;
2158  }
2159  else {
2160  this->m_last_NumBuffersReceived = arg;
2161  }
2162  }
2163  else {
2164  this->m_first_update_NumBuffersReceived = false;
2165  this->m_last_NumBuffersReceived = arg;
2166  }
2167 
2168  if (this->m_tlmOut_OutputPort[0].isConnected()) {
2169  if (
2170  this->m_timeGetOut_OutputPort[0].isConnected() &&
2171  (_tlmTime == Fw::ZERO_TIME)
2172  ) {
2173  this->m_timeGetOut_OutputPort[0].invoke(_tlmTime);
2174  }
2175 
2176  Fw::TlmBuffer _tlmBuff;
2177  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
2178  FW_ASSERT(
2179  _stat == Fw::FW_SERIALIZE_OK,
2180  static_cast<FwAssertArgType>(_stat)
2181  );
2182 
2183  FwChanIdType _id;
2184 
2185  _id = this->getIdBase() + CHANNELID_NUMBUFFERSRECEIVED;
2186 
2187  this->m_tlmOut_OutputPort[0].invoke(
2188  _id,
2189  _tlmTime,
2190  _tlmBuff
2191  );
2192  }
2193  }
2194 
2197  U64 arg,
2198  Fw::Time _tlmTime
2199  )
2200  {
2201  // Check to see if it is the first time
2202  if (not this->m_first_update_NumBytesWritten) {
2203  // Check to see if value has changed. If not, don't write it.
2204  if (arg == this->m_last_NumBytesWritten) {
2205  return;
2206  }
2207  else {
2208  this->m_last_NumBytesWritten = arg;
2209  }
2210  }
2211  else {
2212  this->m_first_update_NumBytesWritten = false;
2213  this->m_last_NumBytesWritten = arg;
2214  }
2215 
2216  if (this->m_tlmOut_OutputPort[0].isConnected()) {
2217  if (
2218  this->m_timeGetOut_OutputPort[0].isConnected() &&
2219  (_tlmTime == Fw::ZERO_TIME)
2220  ) {
2221  this->m_timeGetOut_OutputPort[0].invoke(_tlmTime);
2222  }
2223 
2224  Fw::TlmBuffer _tlmBuff;
2225  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
2226  FW_ASSERT(
2227  _stat == Fw::FW_SERIALIZE_OK,
2228  static_cast<FwAssertArgType>(_stat)
2229  );
2230 
2231  FwChanIdType _id;
2232 
2233  _id = this->getIdBase() + CHANNELID_NUMBYTESWRITTEN;
2234 
2235  this->m_tlmOut_OutputPort[0].invoke(
2236  _id,
2237  _tlmTime,
2238  _tlmBuff
2239  );
2240  }
2241  }
2242 
2245  U32 arg,
2246  Fw::Time _tlmTime
2247  )
2248  {
2249  // Check to see if it is the first time
2250  if (not this->m_first_update_NumSuccessfulWrites) {
2251  // Check to see if value has changed. If not, don't write it.
2252  if (arg == this->m_last_NumSuccessfulWrites) {
2253  return;
2254  }
2255  else {
2256  this->m_last_NumSuccessfulWrites = arg;
2257  }
2258  }
2259  else {
2260  this->m_first_update_NumSuccessfulWrites = false;
2261  this->m_last_NumSuccessfulWrites = arg;
2262  }
2263 
2264  if (this->m_tlmOut_OutputPort[0].isConnected()) {
2265  if (
2266  this->m_timeGetOut_OutputPort[0].isConnected() &&
2267  (_tlmTime == Fw::ZERO_TIME)
2268  ) {
2269  this->m_timeGetOut_OutputPort[0].invoke(_tlmTime);
2270  }
2271 
2272  Fw::TlmBuffer _tlmBuff;
2273  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
2274  FW_ASSERT(
2275  _stat == Fw::FW_SERIALIZE_OK,
2276  static_cast<FwAssertArgType>(_stat)
2277  );
2278 
2279  FwChanIdType _id;
2280 
2281  _id = this->getIdBase() + CHANNELID_NUMSUCCESSFULWRITES;
2282 
2283  this->m_tlmOut_OutputPort[0].invoke(
2284  _id,
2285  _tlmTime,
2286  _tlmBuff
2287  );
2288  }
2289  }
2290 
2293  U32 arg,
2294  Fw::Time _tlmTime
2295  )
2296  {
2297  // Check to see if it is the first time
2298  if (not this->m_first_update_NumFailedWrites) {
2299  // Check to see if value has changed. If not, don't write it.
2300  if (arg == this->m_last_NumFailedWrites) {
2301  return;
2302  }
2303  else {
2304  this->m_last_NumFailedWrites = arg;
2305  }
2306  }
2307  else {
2308  this->m_first_update_NumFailedWrites = false;
2309  this->m_last_NumFailedWrites = arg;
2310  }
2311 
2312  if (this->m_tlmOut_OutputPort[0].isConnected()) {
2313  if (
2314  this->m_timeGetOut_OutputPort[0].isConnected() &&
2315  (_tlmTime == Fw::ZERO_TIME)
2316  ) {
2317  this->m_timeGetOut_OutputPort[0].invoke(_tlmTime);
2318  }
2319 
2320  Fw::TlmBuffer _tlmBuff;
2321  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
2322  FW_ASSERT(
2323  _stat == Fw::FW_SERIALIZE_OK,
2324  static_cast<FwAssertArgType>(_stat)
2325  );
2326 
2327  FwChanIdType _id;
2328 
2329  _id = this->getIdBase() + CHANNELID_NUMFAILEDWRITES;
2330 
2331  this->m_tlmOut_OutputPort[0].invoke(
2332  _id,
2333  _tlmTime,
2334  _tlmBuff
2335  );
2336  }
2337  }
2338 
2341  U32 arg,
2342  Fw::Time _tlmTime
2343  )
2344  {
2345  // Check to see if it is the first time
2346  if (not this->m_first_update_NumErrors) {
2347  // Check to see if value has changed. If not, don't write it.
2348  if (arg == this->m_last_NumErrors) {
2349  return;
2350  }
2351  else {
2352  this->m_last_NumErrors = arg;
2353  }
2354  }
2355  else {
2356  this->m_first_update_NumErrors = false;
2357  this->m_last_NumErrors = arg;
2358  }
2359 
2360  if (this->m_tlmOut_OutputPort[0].isConnected()) {
2361  if (
2362  this->m_timeGetOut_OutputPort[0].isConnected() &&
2363  (_tlmTime == Fw::ZERO_TIME)
2364  ) {
2365  this->m_timeGetOut_OutputPort[0].invoke(_tlmTime);
2366  }
2367 
2368  Fw::TlmBuffer _tlmBuff;
2369  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
2370  FW_ASSERT(
2371  _stat == Fw::FW_SERIALIZE_OK,
2372  static_cast<FwAssertArgType>(_stat)
2373  );
2374 
2375  FwChanIdType _id;
2376 
2377  _id = this->getIdBase() + CHANNELID_NUMERRORS;
2378 
2379  this->m_tlmOut_OutputPort[0].invoke(
2380  _id,
2381  _tlmTime,
2382  _tlmBuff
2383  );
2384  }
2385  }
2386 
2387  // ----------------------------------------------------------------------
2388  // Time
2389  // ----------------------------------------------------------------------
2390 
2392  getTime() const
2393  {
2394  if (this->m_timeGetOut_OutputPort[0].isConnected()) {
2395  Fw::Time _time;
2396  this->m_timeGetOut_OutputPort[0].invoke(_time);
2397  return _time;
2398  }
2399  else {
2400  return Fw::Time(TB_NONE, 0, 0);
2401  }
2402  }
2403 
2404  // ----------------------------------------------------------------------
2405  // Message dispatch functions
2406  // ----------------------------------------------------------------------
2407 
2408  Fw::QueuedComponentBase::MsgDispatchStatus DpWriterComponentBase ::
2409  doDispatch()
2410  {
2411  ComponentIpcSerializableBuffer _msg;
2412  FwQueuePriorityType _priority = 0;
2413 
2414  Os::Queue::Status _msgStatus = this->m_queue.receive(
2415  _msg,
2417  _priority
2418  );
2419  FW_ASSERT(
2420  _msgStatus == Os::Queue::OP_OK,
2421  static_cast<FwAssertArgType>(_msgStatus)
2422  );
2423 
2424  // Reset to beginning of buffer
2425  _msg.resetDeser();
2426 
2427  FwEnumStoreType _desMsg = 0;
2428  Fw::SerializeStatus _deserStatus = _msg.deserialize(_desMsg);
2429  FW_ASSERT(
2430  _deserStatus == Fw::FW_SERIALIZE_OK,
2431  static_cast<FwAssertArgType>(_deserStatus)
2432  );
2433 
2434  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
2435 
2436  if (_msgType == DPWRITER_COMPONENT_EXIT) {
2437  return MSG_DISPATCH_EXIT;
2438  }
2439 
2440  FwIndexType portNum = 0;
2441  _deserStatus = _msg.deserialize(portNum);
2442  FW_ASSERT(
2443  _deserStatus == Fw::FW_SERIALIZE_OK,
2444  static_cast<FwAssertArgType>(_deserStatus)
2445  );
2446 
2447  switch (_msgType) {
2448  // Handle async input port bufferSendIn
2449  case BUFFERSENDIN_BUFFERSEND: {
2450  // Deserialize argument fwBuffer
2451  Fw::Buffer fwBuffer;
2452  _deserStatus = _msg.deserialize(fwBuffer);
2453  FW_ASSERT(
2454  _deserStatus == Fw::FW_SERIALIZE_OK,
2455  static_cast<FwAssertArgType>(_deserStatus)
2456  );
2457  // Call handler function
2458  this->bufferSendIn_handler(
2459  portNum,
2460  fwBuffer
2461  );
2462 
2463  break;
2464  }
2465 
2466  // Handle async input port schedIn
2467  case SCHEDIN_SCHED: {
2468  // Deserialize argument context
2469  U32 context;
2470  _deserStatus = _msg.deserialize(context);
2471  FW_ASSERT(
2472  _deserStatus == Fw::FW_SERIALIZE_OK,
2473  static_cast<FwAssertArgType>(_deserStatus)
2474  );
2475  // Call handler function
2476  this->schedIn_handler(
2477  portNum,
2478  context
2479  );
2480 
2481  break;
2482  }
2483 
2484  // Handle command CLEAR_EVENT_THROTTLE
2485  case CMD_CLEAR_EVENT_THROTTLE: {
2486  // Deserialize opcode
2487  FwOpcodeType _opCode = 0;
2488  _deserStatus = _msg.deserialize(_opCode);
2489  FW_ASSERT (
2490  _deserStatus == Fw::FW_SERIALIZE_OK,
2491  static_cast<FwAssertArgType>(_deserStatus)
2492  );
2493 
2494  // Deserialize command sequence
2495  U32 _cmdSeq = 0;
2496  _deserStatus = _msg.deserialize(_cmdSeq);
2497  FW_ASSERT (
2498  _deserStatus == Fw::FW_SERIALIZE_OK,
2499  static_cast<FwAssertArgType>(_deserStatus)
2500  );
2501 
2502  // Deserialize command argument buffer
2503  Fw::CmdArgBuffer args;
2504  _deserStatus = _msg.deserialize(args);
2505  FW_ASSERT (
2506  _deserStatus == Fw::FW_SERIALIZE_OK,
2507  static_cast<FwAssertArgType>(_deserStatus)
2508  );
2509 
2510  // Reset buffer
2511  args.resetDeser();
2512 
2513  // Make sure there was no data left over.
2514  // That means the argument buffer size was incorrect.
2515 #if FW_CMD_CHECK_RESIDUAL
2516  if (args.getBuffLeft() != 0) {
2517  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
2518  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2519  }
2520  // Don't crash the task if bad arguments were passed from the ground
2521  break;
2522  }
2523 #endif
2524 
2525  // Call handler function
2526  this->CLEAR_EVENT_THROTTLE_cmdHandler(_opCode, _cmdSeq);
2527 
2528  break;
2529  }
2530 
2531  default:
2532  return MSG_DISPATCH_ERROR;
2533  }
2534 
2535  return MSG_DISPATCH_OK;
2536  }
2537 
2538  // ----------------------------------------------------------------------
2539  // Calls for messages received on special input ports
2540  // ----------------------------------------------------------------------
2541 
2542  void DpWriterComponentBase ::
2543  m_p_cmdIn_in(
2544  Fw::PassiveComponentBase* callComp,
2545  FwIndexType portNum,
2546  FwOpcodeType opCode,
2547  U32 cmdSeq,
2548  Fw::CmdArgBuffer& args
2549  )
2550  {
2551  FW_ASSERT(callComp);
2552  DpWriterComponentBase* compPtr = static_cast<DpWriterComponentBase*>(callComp);
2553 
2554  const U32 idBase = callComp->getIdBase();
2555  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
2556 
2557  // Select base class function based on opcode
2558  switch (opCode - idBase) {
2560  compPtr->CLEAR_EVENT_THROTTLE_cmdHandlerBase(
2561  opCode,
2562  cmdSeq,
2563  args
2564  );
2565  break;
2566  }
2567  }
2568  }
2569 
2570  // ----------------------------------------------------------------------
2571  // Calls for messages received on typed input ports
2572  // ----------------------------------------------------------------------
2573 
2574  void DpWriterComponentBase ::
2575  m_p_bufferSendIn_in(
2576  Fw::PassiveComponentBase* callComp,
2577  FwIndexType portNum,
2578  Fw::Buffer& fwBuffer
2579  )
2580  {
2581  FW_ASSERT(callComp);
2582  DpWriterComponentBase* compPtr = static_cast<DpWriterComponentBase*>(callComp);
2583  compPtr->bufferSendIn_handlerBase(
2584  portNum,
2585  fwBuffer
2586  );
2587  }
2588 
2589  void DpWriterComponentBase ::
2590  m_p_schedIn_in(
2591  Fw::PassiveComponentBase* callComp,
2592  FwIndexType portNum,
2593  U32 context
2594  )
2595  {
2596  FW_ASSERT(callComp);
2597  DpWriterComponentBase* compPtr = static_cast<DpWriterComponentBase*>(callComp);
2598  compPtr->schedIn_handlerBase(
2599  portNum,
2600  context
2601  );
2602  }
2603 
2604 }
Serialization/Deserialization operation was successful.
The size of the serial representations of the port arguments.
Definition: CmdPortAc.hpp:38
void deallocBufferSendOut_out(FwIndexType portNum, Fw::Buffer &fwBuffer)
Invoke output port deallocBufferSendOut.
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:134
FwIndexType getNum_cmdResponseOut_OutputPorts() const
Definition: Time.hpp:9
virtual ~DpWriterComponentBase()
Destroy DpWriterComponentBase object.
bool isConnected_procBufferSendOut_OutputPort(FwIndexType portNum)
Operation succeeded.
Definition: Os.hpp:26
void invoke(const Fw::StringBase &fileName, FwDpPriorityType priority, FwSizeType size) const
Invoke a port interface.
void schedIn_handlerBase(FwIndexType portNum, U32 context)
Handler base-class function for input port schedIn.
virtual void CLEAR_EVENT_THROTTLE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
PlatformSizeType FwSizeType
The size of the serial representations of the port arguments.
U32 FwDpPriorityType
The type of a data product priority.
Status receive(U8 *destination, FwSizeType capacity, BlockingType blockType, FwSizeType &actualSize, FwQueuePriorityType &priority) override
receive a message from the queue through delegate
Definition: Queue.cpp:59
void addCallPort(InputDpWrittenPort *callPort)
Register an input port.
I32 FwEnumStoreType
Status
status returned from the queue send function
Definition: Queue.hpp:30
#define FW_LOG_STRING_MAX_SIZE
Max size of log string parameter type.
Definition: FpConfig.h:219
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
void init()
Initialization function.
Definition: SchedPortAc.cpp:56
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void set_dpWrittenOut_OutputPort(FwIndexType portNum, Svc::InputDpWrittenPort *port)
Connect port to dpWrittenOut[portNum].
bool isConnected_deallocBufferSendOut_OutputPort(FwIndexType portNum)
void init()
Initialization function.
Definition: CmdPortAc.cpp:56
void log_WARNING_HI_BufferTooSmallForPacket(U32 bufferSize, U32 minSize)
void log_WARNING_HI_BufferTooSmallForData(U32 bufferSize, U32 minSize)
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
An error occurred when writing to a file.
U32 FwChanIdType
The type of a telemetry channel identifier.
const Time ZERO_TIME
Definition: Time.cpp:5
FwIndexType getNum_cmdRegIn_OutputPorts() const
void init()
Initialization function.
Definition: TlmPortAc.cpp:144
Enum representing a command response.
virtual void bufferSendIn_preMsgHook(FwIndexType portNum, Fw::Buffer &fwBuffer)
Pre-message hook for async input port bufferSendIn.
void addCallPort(InputCmdRegPort *callPort)
Register an input port.
The received buffer has an invalid header hash.
Os::Queue m_queue
queue object for active component
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:150
bool isConnected_tlmOut_OutputPort(FwIndexType portNum)
void tlmWrite_NumErrors(U32 arg, Fw::Time _tlmTime=Fw::Time())
void init()
Object initializer.
Definition: ObjBase.cpp:26
FwIndexType getNum_schedIn_InputPorts() const
U32 FwEventIdType
The type of an event identifier.
SerializeStatus
forward declaration for string
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: CmdPortAc.cpp:62
Fw::InputBufferSendPort * get_bufferSendIn_InputPort(FwIndexType portNum)
Message will block until space is available.
Definition: Queue.hpp:47
Received buffer is too small to hold a data product packet.
void log_WARNING_HI_InvalidBuffer_ThrottleClear()
Reset throttle value for InvalidBuffer.
void tlmWrite_NumFailedWrites(U32 arg, Fw::Time _tlmTime=Fw::Time())
void log_WARNING_HI_FileWriteError_ThrottleClear()
Reset throttle value for FileWriteError.
void invoke(FwOpcodeType opCode) const
Invoke a port interface.
U32 FwOpcodeType
The type of a command opcode.
void CLEAR_EVENT_THROTTLE_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:53
Serializable::SizeType getBuffLeft() const
returns how much deserialization buffer is left
void init()
Initialization function.
Definition: TimePortAc.cpp:128
FwIndexType getNum_timeGetOut_OutputPorts() const
bool isConnected_dpWrittenOut_OutputPort(FwIndexType portNum)
Less important informational events.
Os::Queue::Status createQueue(FwSizeType depth, FwSizeType msgSize)
#define FW_MIN(a, b)
MIN macro.
Definition: BasicTypes.h:95
void invoke(Fw::Buffer &fwBuffer) const
Invoke a port interface.
void procBufferSendOut_out(FwIndexType portNum, Fw::Buffer &fwBuffer)
Invoke output port procBufferSendOut.
void init()
Initialization function.
void addCallPort(InputBufferSendPort *callPort)
Register an input port.
void invoke(Fw::Time &time) const
Invoke a port interface.
Definition: TimePortAc.cpp:147
void dpWrittenOut_out(FwIndexType portNum, const Fw::StringBase &fileName, FwDpPriorityType priority, FwSizeType size)
Invoke output port dpWrittenOut.
Fw::InputCmdPort * get_cmdIn_InputPort(FwIndexType portNum)
void set_deallocBufferSendOut_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to deallocBufferSendOut[portNum].
const char * toChar() const
Definition: ObjectName.hpp:50
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke a port interface.
FwSizeType SizeType
void tlmWrite_NumBuffersReceived(U32 arg, Fw::Time _tlmTime=Fw::Time())
Status send(const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override
send a message into the queue through delegate
Definition: Queue.cpp:42
bool isConnected_eventOut_OutputPort(FwIndexType portNum)
void log_WARNING_HI_BufferTooSmallForData_ThrottleClear()
Reset throttle value for BufferTooSmallForData.
void resetDeser()
reset deserialization to beginning
void log_WARNING_HI_FileOpenError_ThrottleClear()
Reset throttle value for FileOpenError.
message to exit active component task
A serious but recoverable event.
An error occurred when opening a file.
void invoke(FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val) const
Invoke a port interface.
Definition: TlmPortAc.cpp:163
DpWriterComponentBase(const char *compName="")
Construct DpWriterComponentBase object.
bool isConnected() const
Definition: PortBase.cpp:42
void log_WARNING_HI_FileOpenError(U32 status, const Fw::StringBase &file)
void log_WARNING_HI_InvalidHeader_ThrottleClear()
Reset throttle value for InvalidHeader.
Received buffer is too small to hold the data specified in the header.
#define PRI_FwIndexType
void log_WARNING_HI_InvalidHeaderHash_ThrottleClear()
Reset throttle value for InvalidHeaderHash.
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:55
void init()
Initialization function.
Definition: LogPortAc.cpp:151
The size of the serial representations of the port arguments.
Definition: SchedPortAc.hpp:36
void setPortNum(FwIndexType portNum)
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:56
BlockingType
message type
Definition: Queue.hpp:46
void regCommands()
Register commands with the Command Dispatcher.
FwIndexType getNum_bufferSendIn_InputPorts() const
Command failed to deserialize.
PlatformQueuePriorityType FwQueuePriorityType
The type of queue priorities used.
Error occurred when deserializing the packet header.
void init()
Initialization function.
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: SchedPortAc.cpp:62
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args) const
Invoke a port interface.
Definition: LogPortAc.cpp:170
void set_cmdResponseOut_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to cmdResponseOut[portNum].
void log_ACTIVITY_LO_FileWritten(U32 bytes, const Fw::StringBase &file) const
A message was sent requesting an exit of the loop.
virtual void CLEAR_EVENT_THROTTLE_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command CLEAR_EVENT_THROTTLE.
No time base has been established.
Definition: FpConfig.h:30
virtual void schedIn_handler(FwIndexType portNum, U32 context)=0
Handler for input port schedIn.
FwIndexType getNum_tlmOut_OutputPorts() const
PlatformIndexType FwIndexType
void set_eventOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to eventOut[portNum].
FwIndexType getNum_cmdIn_InputPorts() const
virtual void bufferSendIn_handler(FwIndexType portNum, Fw::Buffer &fwBuffer)=0
Handler for input port bufferSendIn.
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition: BasicTypes.h:93
bool isConnected_cmdResponseOut_OutputPort(FwIndexType portNum)
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:157
FwIndexType getNum_dpWrittenOut_OutputPorts() const
void log_WARNING_HI_FileWriteError(U32 status, U32 bytesWritten, U32 bytesToWrite, const Fw::StringBase &file)
void init()
Initialization function.
void set_timeGetOut_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeGetOut[portNum].
RateGroupDivider component implementation.
bool isConnected_cmdRegIn_OutputPort(FwIndexType portNum)
message sent/received okay
Definition: Queue.hpp:31
U8 BYTE
byte type
Definition: BasicTypes.h:59
FwIndexType getNum_deallocBufferSendOut_OutputPorts() const
void bufferSendIn_handlerBase(FwIndexType portNum, Fw::Buffer &fwBuffer)
Handler base-class function for input port bufferSendIn.
void tlmWrite_NumBytesWritten(U64 arg, Fw::Time _tlmTime=Fw::Time())
virtual void schedIn_preMsgHook(FwIndexType portNum, U32 context)
Pre-message hook for async input port schedIn.
void log_WARNING_HI_InvalidHeaderHash(U32 bufferSize, U32 storedHash, U32 computedHash)
virtual SerializeStatus serialize(SerializeBufferBase &buffer) const
serialization function
Definition: StringBase.cpp:142
void log_WARNING_HI_InvalidHeader(U32 bufferSize, U32 errorCode)
void tlmWrite_NumSuccessfulWrites(U32 arg, Fw::Time _tlmTime=Fw::Time())
void log_WARNING_HI_BufferTooSmallForPacket_ThrottleClear()
Reset throttle value for BufferTooSmallForPacket.
Message will return with status when space is unavailable.
Definition: Queue.hpp:48
void set_procBufferSendOut_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to procBufferSendOut[portNum].
void init()
Initialization function.
FwIndexType getNum_procBufferSendOut_OutputPorts() const
#define FW_ASSERT(...)
Definition: Assert.hpp:14
void init()
Initialization function.
Svc::InputSchedPort * get_schedIn_InputPort(FwIndexType portNum)
void set_cmdRegIn_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to cmdRegIn[portNum].
FwIndexType getNum_eventOut_OutputPorts() const
virtual const CHAR * toChar() const =0
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.
bool isConnected_timeGetOut_OutputPort(FwIndexType portNum)
#define U64(C)
Definition: sha.h:180