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