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 
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  // 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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  portNum < this->getNum_deallocBufferSendOut_OutputPorts(),
1072  static_cast<FwAssertArgType>(portNum)
1073  );
1074  this->m_deallocBufferSendOut_OutputPort[portNum].invoke(
1075  fwBuffer
1076  );
1077  }
1078 
1081  FwIndexType portNum,
1082  const Fw::StringBase& fileName,
1083  FwDpPriorityType priority,
1084  FwSizeType size
1085  )
1086  {
1087  FW_ASSERT(
1088  portNum < this->getNum_dpWrittenOut_OutputPorts(),
1089  static_cast<FwAssertArgType>(portNum)
1090  );
1091  this->m_dpWrittenOut_OutputPort[portNum].invoke(
1092  fileName,
1093  priority,
1094  size
1095  );
1096  }
1097 
1100  FwIndexType portNum,
1101  Fw::Buffer& fwBuffer
1102  )
1103  {
1104  FW_ASSERT(
1105  portNum < this->getNum_procBufferSendOut_OutputPorts(),
1106  static_cast<FwAssertArgType>(portNum)
1107  );
1108  this->m_procBufferSendOut_OutputPort[portNum].invoke(
1109  fwBuffer
1110  );
1111  }
1112 
1113  // ----------------------------------------------------------------------
1114  // Command response
1115  // ----------------------------------------------------------------------
1116 
1119  FwOpcodeType opCode,
1120  U32 cmdSeq,
1121  Fw::CmdResponse response
1122  )
1123  {
1124  FW_ASSERT(this->m_cmdResponseOut_OutputPort[0].isConnected());
1125  this->m_cmdResponseOut_OutputPort[0].invoke(opCode, cmdSeq, response);
1126  }
1127 
1128  // ----------------------------------------------------------------------
1129  // Command handler base-class functions
1130  //
1131  // Call these functions directly to bypass the command input port
1132  // ----------------------------------------------------------------------
1133 
1136  FwOpcodeType opCode,
1137  U32 cmdSeq,
1138  Fw::CmdArgBuffer& args
1139  )
1140  {
1141  // Call pre-message hook
1142  this->CLEAR_EVENT_THROTTLE_preMsgHook(opCode,cmdSeq);
1143 
1144  // Defer deserializing arguments to the message dispatcher
1145  // to avoid deserializing and reserializing just for IPC
1146  ComponentIpcSerializableBuffer msg;
1148 
1149  // Serialize for IPC
1150  _status = msg.serialize(static_cast<FwEnumStoreType>(CMD_CLEAR_EVENT_THROTTLE));
1151  FW_ASSERT (
1152  _status == Fw::FW_SERIALIZE_OK,
1153  static_cast<FwAssertArgType>(_status)
1154  );
1155 
1156  // Fake port number to make message dequeue work
1157  FwIndexType port = 0;
1158 
1159  _status = msg.serialize(port);
1160  FW_ASSERT (
1161  _status == Fw::FW_SERIALIZE_OK,
1162  static_cast<FwAssertArgType>(_status)
1163  );
1164 
1165  _status = msg.serialize(opCode);
1166  FW_ASSERT (
1167  _status == Fw::FW_SERIALIZE_OK,
1168  static_cast<FwAssertArgType>(_status)
1169  );
1170 
1171  _status = msg.serialize(cmdSeq);
1172  FW_ASSERT (
1173  _status == Fw::FW_SERIALIZE_OK,
1174  static_cast<FwAssertArgType>(_status)
1175  );
1176 
1177  _status = msg.serialize(args);
1178  FW_ASSERT (
1179  _status == Fw::FW_SERIALIZE_OK,
1180  static_cast<FwAssertArgType>(_status)
1181  );
1182 
1183  // Send message
1185  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1186 
1187  FW_ASSERT(
1188  qStatus == Os::Queue::OP_OK,
1189  static_cast<FwAssertArgType>(qStatus)
1190  );
1191  }
1192 
1193  // ----------------------------------------------------------------------
1194  // Pre-message hooks for async commands
1195  //
1196  // Each of these functions is invoked just before processing the
1197  // corresponding command. By default they do nothing. You can
1198  // override them to provide specific pre-command behavior.
1199  // ----------------------------------------------------------------------
1200 
1203  FwOpcodeType opCode,
1204  U32 cmdSeq
1205  )
1206  {
1207  // Defaults to no-op; can be overridden
1208  (void) opCode;
1209  (void) cmdSeq;
1210  }
1211 
1212  // ----------------------------------------------------------------------
1213  // Event logging functions
1214  // ----------------------------------------------------------------------
1215 
1218  {
1219  // Check throttle value
1220  if (this->m_InvalidBufferThrottle >= EVENTID_INVALIDBUFFER_THROTTLE) {
1221  return;
1222  }
1223  else {
1224  this->m_InvalidBufferThrottle++;
1225  }
1226 
1227  // Get the time
1228  Fw::Time _logTime;
1229  if (this->m_timeGetOut_OutputPort[0].isConnected()) {
1230  this->m_timeGetOut_OutputPort[0].invoke(_logTime);
1231  }
1232 
1233  FwEventIdType _id = static_cast<FwEventIdType>(0);
1234 
1235  _id = this->getIdBase() + EVENTID_INVALIDBUFFER;
1236 
1237  // Emit the event on the log port
1238  if (this->m_eventOut_OutputPort[0].isConnected()) {
1239  Fw::LogBuffer _logBuff;
1240 
1241 #if FW_AMPCS_COMPATIBLE
1243  // Serialize the number of arguments
1244  _status = _logBuff.serialize(static_cast<U8>(0));
1245  FW_ASSERT(
1246  _status == Fw::FW_SERIALIZE_OK,
1247  static_cast<FwAssertArgType>(_status)
1248  );
1249 #endif
1250 
1251  this->m_eventOut_OutputPort[0].invoke(
1252  _id,
1253  _logTime,
1255  _logBuff
1256  );
1257  }
1258 
1259  // Emit the event on the text log port
1260 #if FW_ENABLE_TEXT_LOGGING
1261  if (this->m_textEventOut_OutputPort[0].isConnected()) {
1262 #if FW_OBJECT_NAMES == 1
1263  const char* _formatString =
1264  "(%s) %s: Received buffer is invalid";
1265 #else
1266  const char* _formatString =
1267  "%s: Received buffer is invalid";
1268 #endif
1269 
1270  Fw::TextLogString _logString;
1271  _logString.format(
1272  _formatString,
1273 #if FW_OBJECT_NAMES == 1
1274  this->m_objName.toChar(),
1275 #endif
1276  "InvalidBuffer "
1277  );
1278 
1279  this->m_textEventOut_OutputPort[0].invoke(
1280  _id,
1281  _logTime,
1283  _logString
1284  );
1285  }
1286 #endif
1287  }
1288 
1291  U32 bufferSize,
1292  U32 minSize
1293  )
1294  {
1295  // Check throttle value
1296  if (this->m_BufferTooSmallForPacketThrottle >= EVENTID_BUFFERTOOSMALLFORPACKET_THROTTLE) {
1297  return;
1298  }
1299  else {
1300  this->m_BufferTooSmallForPacketThrottle++;
1301  }
1302 
1303  // Get the time
1304  Fw::Time _logTime;
1305  if (this->m_timeGetOut_OutputPort[0].isConnected()) {
1306  this->m_timeGetOut_OutputPort[0].invoke(_logTime);
1307  }
1308 
1309  FwEventIdType _id = static_cast<FwEventIdType>(0);
1310 
1312 
1313  // Emit the event on the log port
1314  if (this->m_eventOut_OutputPort[0].isConnected()) {
1315  Fw::LogBuffer _logBuff;
1317 
1318 #if FW_AMPCS_COMPATIBLE
1319  // Serialize the number of arguments
1320  _status = _logBuff.serialize(static_cast<U8>(2));
1321  FW_ASSERT(
1322  _status == Fw::FW_SERIALIZE_OK,
1323  static_cast<FwAssertArgType>(_status)
1324  );
1325 #endif
1326 
1327 #if FW_AMPCS_COMPATIBLE
1328  // Serialize the argument size
1329  _status = _logBuff.serialize(
1330  static_cast<U8>(sizeof(U32))
1331  );
1332  FW_ASSERT(
1333  _status == Fw::FW_SERIALIZE_OK,
1334  static_cast<FwAssertArgType>(_status)
1335  );
1336 #endif
1337  _status = _logBuff.serialize(bufferSize);
1338  FW_ASSERT(
1339  _status == Fw::FW_SERIALIZE_OK,
1340  static_cast<FwAssertArgType>(_status)
1341  );
1342 
1343 #if FW_AMPCS_COMPATIBLE
1344  // Serialize the argument size
1345  _status = _logBuff.serialize(
1346  static_cast<U8>(sizeof(U32))
1347  );
1348  FW_ASSERT(
1349  _status == Fw::FW_SERIALIZE_OK,
1350  static_cast<FwAssertArgType>(_status)
1351  );
1352 #endif
1353  _status = _logBuff.serialize(minSize);
1354  FW_ASSERT(
1355  _status == Fw::FW_SERIALIZE_OK,
1356  static_cast<FwAssertArgType>(_status)
1357  );
1358 
1359  this->m_eventOut_OutputPort[0].invoke(
1360  _id,
1361  _logTime,
1363  _logBuff
1364  );
1365  }
1366 
1367  // Emit the event on the text log port
1368 #if FW_ENABLE_TEXT_LOGGING
1369  if (this->m_textEventOut_OutputPort[0].isConnected()) {
1370 #if FW_OBJECT_NAMES == 1
1371  const char* _formatString =
1372  "(%s) %s: Received buffer has size %" PRIu32 "; minimum required size is %" PRIu32 "";
1373 #else
1374  const char* _formatString =
1375  "%s: Received buffer has size %" PRIu32 "; minimum required size is %" PRIu32 "";
1376 #endif
1377 
1378  Fw::TextLogString _logString;
1379  _logString.format(
1380  _formatString,
1381 #if FW_OBJECT_NAMES == 1
1382  this->m_objName.toChar(),
1383 #endif
1384  "BufferTooSmallForPacket ",
1385  bufferSize,
1386  minSize
1387  );
1388 
1389  this->m_textEventOut_OutputPort[0].invoke(
1390  _id,
1391  _logTime,
1393  _logString
1394  );
1395  }
1396 #endif
1397  }
1398 
1401  U32 bufferSize,
1402  U32 storedHash,
1403  U32 computedHash
1404  )
1405  {
1406  // Check throttle value
1407  if (this->m_InvalidHeaderHashThrottle >= EVENTID_INVALIDHEADERHASH_THROTTLE) {
1408  return;
1409  }
1410  else {
1411  this->m_InvalidHeaderHashThrottle++;
1412  }
1413 
1414  // Get the time
1415  Fw::Time _logTime;
1416  if (this->m_timeGetOut_OutputPort[0].isConnected()) {
1417  this->m_timeGetOut_OutputPort[0].invoke(_logTime);
1418  }
1419 
1420  FwEventIdType _id = static_cast<FwEventIdType>(0);
1421 
1422  _id = this->getIdBase() + EVENTID_INVALIDHEADERHASH;
1423 
1424  // Emit the event on the log port
1425  if (this->m_eventOut_OutputPort[0].isConnected()) {
1426  Fw::LogBuffer _logBuff;
1428 
1429 #if FW_AMPCS_COMPATIBLE
1430  // Serialize the number of arguments
1431  _status = _logBuff.serialize(static_cast<U8>(3));
1432  FW_ASSERT(
1433  _status == Fw::FW_SERIALIZE_OK,
1434  static_cast<FwAssertArgType>(_status)
1435  );
1436 #endif
1437 
1438 #if FW_AMPCS_COMPATIBLE
1439  // Serialize the argument size
1440  _status = _logBuff.serialize(
1441  static_cast<U8>(sizeof(U32))
1442  );
1443  FW_ASSERT(
1444  _status == Fw::FW_SERIALIZE_OK,
1445  static_cast<FwAssertArgType>(_status)
1446  );
1447 #endif
1448  _status = _logBuff.serialize(bufferSize);
1449  FW_ASSERT(
1450  _status == Fw::FW_SERIALIZE_OK,
1451  static_cast<FwAssertArgType>(_status)
1452  );
1453 
1454 #if FW_AMPCS_COMPATIBLE
1455  // Serialize the argument size
1456  _status = _logBuff.serialize(
1457  static_cast<U8>(sizeof(U32))
1458  );
1459  FW_ASSERT(
1460  _status == Fw::FW_SERIALIZE_OK,
1461  static_cast<FwAssertArgType>(_status)
1462  );
1463 #endif
1464  _status = _logBuff.serialize(storedHash);
1465  FW_ASSERT(
1466  _status == Fw::FW_SERIALIZE_OK,
1467  static_cast<FwAssertArgType>(_status)
1468  );
1469 
1470 #if FW_AMPCS_COMPATIBLE
1471  // Serialize the argument size
1472  _status = _logBuff.serialize(
1473  static_cast<U8>(sizeof(U32))
1474  );
1475  FW_ASSERT(
1476  _status == Fw::FW_SERIALIZE_OK,
1477  static_cast<FwAssertArgType>(_status)
1478  );
1479 #endif
1480  _status = _logBuff.serialize(computedHash);
1481  FW_ASSERT(
1482  _status == Fw::FW_SERIALIZE_OK,
1483  static_cast<FwAssertArgType>(_status)
1484  );
1485 
1486  this->m_eventOut_OutputPort[0].invoke(
1487  _id,
1488  _logTime,
1490  _logBuff
1491  );
1492  }
1493 
1494  // Emit the event on the text log port
1495 #if FW_ENABLE_TEXT_LOGGING
1496  if (this->m_textEventOut_OutputPort[0].isConnected()) {
1497 #if FW_OBJECT_NAMES == 1
1498  const char* _formatString =
1499  "(%s) %s: Received a buffer of size %" PRIu32 " with an invalid header hash (stored %" PRIx32 ", computed %" PRIx32 ")";
1500 #else
1501  const char* _formatString =
1502  "%s: Received a buffer of size %" PRIu32 " with an invalid header hash (stored %" PRIx32 ", computed %" PRIx32 ")";
1503 #endif
1504 
1505  Fw::TextLogString _logString;
1506  _logString.format(
1507  _formatString,
1508 #if FW_OBJECT_NAMES == 1
1509  this->m_objName.toChar(),
1510 #endif
1511  "InvalidHeaderHash ",
1512  bufferSize,
1513  storedHash,
1514  computedHash
1515  );
1516 
1517  this->m_textEventOut_OutputPort[0].invoke(
1518  _id,
1519  _logTime,
1521  _logString
1522  );
1523  }
1524 #endif
1525  }
1526 
1529  U32 bufferSize,
1530  U32 errorCode
1531  )
1532  {
1533  // Check throttle value
1534  if (this->m_InvalidHeaderThrottle >= EVENTID_INVALIDHEADER_THROTTLE) {
1535  return;
1536  }
1537  else {
1538  this->m_InvalidHeaderThrottle++;
1539  }
1540 
1541  // Get the time
1542  Fw::Time _logTime;
1543  if (this->m_timeGetOut_OutputPort[0].isConnected()) {
1544  this->m_timeGetOut_OutputPort[0].invoke(_logTime);
1545  }
1546 
1547  FwEventIdType _id = static_cast<FwEventIdType>(0);
1548 
1549  _id = this->getIdBase() + EVENTID_INVALIDHEADER;
1550 
1551  // Emit the event on the log port
1552  if (this->m_eventOut_OutputPort[0].isConnected()) {
1553  Fw::LogBuffer _logBuff;
1555 
1556 #if FW_AMPCS_COMPATIBLE
1557  // Serialize the number of arguments
1558  _status = _logBuff.serialize(static_cast<U8>(2));
1559  FW_ASSERT(
1560  _status == Fw::FW_SERIALIZE_OK,
1561  static_cast<FwAssertArgType>(_status)
1562  );
1563 #endif
1564 
1565 #if FW_AMPCS_COMPATIBLE
1566  // Serialize the argument size
1567  _status = _logBuff.serialize(
1568  static_cast<U8>(sizeof(U32))
1569  );
1570  FW_ASSERT(
1571  _status == Fw::FW_SERIALIZE_OK,
1572  static_cast<FwAssertArgType>(_status)
1573  );
1574 #endif
1575  _status = _logBuff.serialize(bufferSize);
1576  FW_ASSERT(
1577  _status == Fw::FW_SERIALIZE_OK,
1578  static_cast<FwAssertArgType>(_status)
1579  );
1580 
1581 #if FW_AMPCS_COMPATIBLE
1582  // Serialize the argument size
1583  _status = _logBuff.serialize(
1584  static_cast<U8>(sizeof(U32))
1585  );
1586  FW_ASSERT(
1587  _status == Fw::FW_SERIALIZE_OK,
1588  static_cast<FwAssertArgType>(_status)
1589  );
1590 #endif
1591  _status = _logBuff.serialize(errorCode);
1592  FW_ASSERT(
1593  _status == Fw::FW_SERIALIZE_OK,
1594  static_cast<FwAssertArgType>(_status)
1595  );
1596 
1597  this->m_eventOut_OutputPort[0].invoke(
1598  _id,
1599  _logTime,
1601  _logBuff
1602  );
1603  }
1604 
1605  // Emit the event on the text log port
1606 #if FW_ENABLE_TEXT_LOGGING
1607  if (this->m_textEventOut_OutputPort[0].isConnected()) {
1608 #if FW_OBJECT_NAMES == 1
1609  const char* _formatString =
1610  "(%s) %s: Received buffer of size %" PRIu32 "; deserialization of packet header failed with error code %" PRIu32 "";
1611 #else
1612  const char* _formatString =
1613  "%s: Received buffer of size %" PRIu32 "; deserialization of packet header failed with error code %" PRIu32 "";
1614 #endif
1615 
1616  Fw::TextLogString _logString;
1617  _logString.format(
1618  _formatString,
1619 #if FW_OBJECT_NAMES == 1
1620  this->m_objName.toChar(),
1621 #endif
1622  "InvalidHeader ",
1623  bufferSize,
1624  errorCode
1625  );
1626 
1627  this->m_textEventOut_OutputPort[0].invoke(
1628  _id,
1629  _logTime,
1631  _logString
1632  );
1633  }
1634 #endif
1635  }
1636 
1639  U32 bufferSize,
1640  U32 minSize
1641  )
1642  {
1643  // Check throttle value
1644  if (this->m_BufferTooSmallForDataThrottle >= EVENTID_BUFFERTOOSMALLFORDATA_THROTTLE) {
1645  return;
1646  }
1647  else {
1648  this->m_BufferTooSmallForDataThrottle++;
1649  }
1650 
1651  // Get the time
1652  Fw::Time _logTime;
1653  if (this->m_timeGetOut_OutputPort[0].isConnected()) {
1654  this->m_timeGetOut_OutputPort[0].invoke(_logTime);
1655  }
1656 
1657  FwEventIdType _id = static_cast<FwEventIdType>(0);
1658 
1659  _id = this->getIdBase() + EVENTID_BUFFERTOOSMALLFORDATA;
1660 
1661  // Emit the event on the log port
1662  if (this->m_eventOut_OutputPort[0].isConnected()) {
1663  Fw::LogBuffer _logBuff;
1665 
1666 #if FW_AMPCS_COMPATIBLE
1667  // Serialize the number of arguments
1668  _status = _logBuff.serialize(static_cast<U8>(2));
1669  FW_ASSERT(
1670  _status == Fw::FW_SERIALIZE_OK,
1671  static_cast<FwAssertArgType>(_status)
1672  );
1673 #endif
1674 
1675 #if FW_AMPCS_COMPATIBLE
1676  // Serialize the argument size
1677  _status = _logBuff.serialize(
1678  static_cast<U8>(sizeof(U32))
1679  );
1680  FW_ASSERT(
1681  _status == Fw::FW_SERIALIZE_OK,
1682  static_cast<FwAssertArgType>(_status)
1683  );
1684 #endif
1685  _status = _logBuff.serialize(bufferSize);
1686  FW_ASSERT(
1687  _status == Fw::FW_SERIALIZE_OK,
1688  static_cast<FwAssertArgType>(_status)
1689  );
1690 
1691 #if FW_AMPCS_COMPATIBLE
1692  // Serialize the argument size
1693  _status = _logBuff.serialize(
1694  static_cast<U8>(sizeof(U32))
1695  );
1696  FW_ASSERT(
1697  _status == Fw::FW_SERIALIZE_OK,
1698  static_cast<FwAssertArgType>(_status)
1699  );
1700 #endif
1701  _status = _logBuff.serialize(minSize);
1702  FW_ASSERT(
1703  _status == Fw::FW_SERIALIZE_OK,
1704  static_cast<FwAssertArgType>(_status)
1705  );
1706 
1707  this->m_eventOut_OutputPort[0].invoke(
1708  _id,
1709  _logTime,
1711  _logBuff
1712  );
1713  }
1714 
1715  // Emit the event on the text log port
1716 #if FW_ENABLE_TEXT_LOGGING
1717  if (this->m_textEventOut_OutputPort[0].isConnected()) {
1718 #if FW_OBJECT_NAMES == 1
1719  const char* _formatString =
1720  "(%s) %s: Received buffer has size %" PRIu32 "; minimum required size is %" PRIu32 "";
1721 #else
1722  const char* _formatString =
1723  "%s: Received buffer has size %" PRIu32 "; minimum required size is %" PRIu32 "";
1724 #endif
1725 
1726  Fw::TextLogString _logString;
1727  _logString.format(
1728  _formatString,
1729 #if FW_OBJECT_NAMES == 1
1730  this->m_objName.toChar(),
1731 #endif
1732  "BufferTooSmallForData ",
1733  bufferSize,
1734  minSize
1735  );
1736 
1737  this->m_textEventOut_OutputPort[0].invoke(
1738  _id,
1739  _logTime,
1741  _logString
1742  );
1743  }
1744 #endif
1745  }
1746 
1749  U32 status,
1750  const Fw::StringBase& file
1751  )
1752  {
1753  // Check throttle value
1754  if (this->m_FileOpenErrorThrottle >= EVENTID_FILEOPENERROR_THROTTLE) {
1755  return;
1756  }
1757  else {
1758  this->m_FileOpenErrorThrottle++;
1759  }
1760 
1761  // Get the time
1762  Fw::Time _logTime;
1763  if (this->m_timeGetOut_OutputPort[0].isConnected()) {
1764  this->m_timeGetOut_OutputPort[0].invoke(_logTime);
1765  }
1766 
1767  FwEventIdType _id = static_cast<FwEventIdType>(0);
1768 
1769  _id = this->getIdBase() + EVENTID_FILEOPENERROR;
1770 
1771  // Emit the event on the log port
1772  if (this->m_eventOut_OutputPort[0].isConnected()) {
1773  Fw::LogBuffer _logBuff;
1775 
1776 #if FW_AMPCS_COMPATIBLE
1777  // Serialize the number of arguments
1778  _status = _logBuff.serialize(static_cast<U8>(2));
1779  FW_ASSERT(
1780  _status == Fw::FW_SERIALIZE_OK,
1781  static_cast<FwAssertArgType>(_status)
1782  );
1783 #endif
1784 
1785 #if FW_AMPCS_COMPATIBLE
1786  // Serialize the argument size
1787  _status = _logBuff.serialize(
1788  static_cast<U8>(sizeof(U32))
1789  );
1790  FW_ASSERT(
1791  _status == Fw::FW_SERIALIZE_OK,
1792  static_cast<FwAssertArgType>(_status)
1793  );
1794 #endif
1795  _status = _logBuff.serialize(status);
1796  FW_ASSERT(
1797  _status == Fw::FW_SERIALIZE_OK,
1798  static_cast<FwAssertArgType>(_status)
1799  );
1800 
1801  _status = file.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 200));
1802  FW_ASSERT(
1803  _status == Fw::FW_SERIALIZE_OK,
1804  static_cast<FwAssertArgType>(_status)
1805  );
1806 
1807  this->m_eventOut_OutputPort[0].invoke(
1808  _id,
1809  _logTime,
1811  _logBuff
1812  );
1813  }
1814 
1815  // Emit the event on the text log port
1816 #if FW_ENABLE_TEXT_LOGGING
1817  if (this->m_textEventOut_OutputPort[0].isConnected()) {
1818 #if FW_OBJECT_NAMES == 1
1819  const char* _formatString =
1820  "(%s) %s: Error %" PRIu32 " opening file %s";
1821 #else
1822  const char* _formatString =
1823  "%s: Error %" PRIu32 " opening file %s";
1824 #endif
1825 
1826  Fw::TextLogString _logString;
1827  _logString.format(
1828  _formatString,
1829 #if FW_OBJECT_NAMES == 1
1830  this->m_objName.toChar(),
1831 #endif
1832  "FileOpenError ",
1833  status,
1834  file.toChar()
1835  );
1836 
1837  this->m_textEventOut_OutputPort[0].invoke(
1838  _id,
1839  _logTime,
1841  _logString
1842  );
1843  }
1844 #endif
1845  }
1846 
1849  U32 status,
1850  U32 bytesWritten,
1851  U32 bytesToWrite,
1852  const Fw::StringBase& file
1853  )
1854  {
1855  // Check throttle value
1856  if (this->m_FileWriteErrorThrottle >= EVENTID_FILEWRITEERROR_THROTTLE) {
1857  return;
1858  }
1859  else {
1860  this->m_FileWriteErrorThrottle++;
1861  }
1862 
1863  // Get the time
1864  Fw::Time _logTime;
1865  if (this->m_timeGetOut_OutputPort[0].isConnected()) {
1866  this->m_timeGetOut_OutputPort[0].invoke(_logTime);
1867  }
1868 
1869  FwEventIdType _id = static_cast<FwEventIdType>(0);
1870 
1871  _id = this->getIdBase() + EVENTID_FILEWRITEERROR;
1872 
1873  // Emit the event on the log port
1874  if (this->m_eventOut_OutputPort[0].isConnected()) {
1875  Fw::LogBuffer _logBuff;
1877 
1878 #if FW_AMPCS_COMPATIBLE
1879  // Serialize the number of arguments
1880  _status = _logBuff.serialize(static_cast<U8>(4));
1881  FW_ASSERT(
1882  _status == Fw::FW_SERIALIZE_OK,
1883  static_cast<FwAssertArgType>(_status)
1884  );
1885 #endif
1886 
1887 #if FW_AMPCS_COMPATIBLE
1888  // Serialize the argument size
1889  _status = _logBuff.serialize(
1890  static_cast<U8>(sizeof(U32))
1891  );
1892  FW_ASSERT(
1893  _status == Fw::FW_SERIALIZE_OK,
1894  static_cast<FwAssertArgType>(_status)
1895  );
1896 #endif
1897  _status = _logBuff.serialize(status);
1898  FW_ASSERT(
1899  _status == Fw::FW_SERIALIZE_OK,
1900  static_cast<FwAssertArgType>(_status)
1901  );
1902 
1903 #if FW_AMPCS_COMPATIBLE
1904  // Serialize the argument size
1905  _status = _logBuff.serialize(
1906  static_cast<U8>(sizeof(U32))
1907  );
1908  FW_ASSERT(
1909  _status == Fw::FW_SERIALIZE_OK,
1910  static_cast<FwAssertArgType>(_status)
1911  );
1912 #endif
1913  _status = _logBuff.serialize(bytesWritten);
1914  FW_ASSERT(
1915  _status == Fw::FW_SERIALIZE_OK,
1916  static_cast<FwAssertArgType>(_status)
1917  );
1918 
1919 #if FW_AMPCS_COMPATIBLE
1920  // Serialize the argument size
1921  _status = _logBuff.serialize(
1922  static_cast<U8>(sizeof(U32))
1923  );
1924  FW_ASSERT(
1925  _status == Fw::FW_SERIALIZE_OK,
1926  static_cast<FwAssertArgType>(_status)
1927  );
1928 #endif
1929  _status = _logBuff.serialize(bytesToWrite);
1930  FW_ASSERT(
1931  _status == Fw::FW_SERIALIZE_OK,
1932  static_cast<FwAssertArgType>(_status)
1933  );
1934 
1935  _status = file.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 200));
1936  FW_ASSERT(
1937  _status == Fw::FW_SERIALIZE_OK,
1938  static_cast<FwAssertArgType>(_status)
1939  );
1940 
1941  this->m_eventOut_OutputPort[0].invoke(
1942  _id,
1943  _logTime,
1945  _logBuff
1946  );
1947  }
1948 
1949  // Emit the event on the text log port
1950 #if FW_ENABLE_TEXT_LOGGING
1951  if (this->m_textEventOut_OutputPort[0].isConnected()) {
1952 #if FW_OBJECT_NAMES == 1
1953  const char* _formatString =
1954  "(%s) %s: Error %" PRIu32 " while writing %" PRIu32 " of %" PRIu32 " bytes to %s";
1955 #else
1956  const char* _formatString =
1957  "%s: Error %" PRIu32 " while writing %" PRIu32 " of %" PRIu32 " bytes to %s";
1958 #endif
1959 
1960  Fw::TextLogString _logString;
1961  _logString.format(
1962  _formatString,
1963 #if FW_OBJECT_NAMES == 1
1964  this->m_objName.toChar(),
1965 #endif
1966  "FileWriteError ",
1967  status,
1968  bytesWritten,
1969  bytesToWrite,
1970  file.toChar()
1971  );
1972 
1973  this->m_textEventOut_OutputPort[0].invoke(
1974  _id,
1975  _logTime,
1977  _logString
1978  );
1979  }
1980 #endif
1981  }
1982 
1985  U32 bytes,
1986  const Fw::StringBase& file
1987  ) const
1988  {
1989  // Get the time
1990  Fw::Time _logTime;
1991  if (this->m_timeGetOut_OutputPort[0].isConnected()) {
1992  this->m_timeGetOut_OutputPort[0].invoke(_logTime);
1993  }
1994 
1995  FwEventIdType _id = static_cast<FwEventIdType>(0);
1996 
1997  _id = this->getIdBase() + EVENTID_FILEWRITTEN;
1998 
1999  // Emit the event on the log port
2000  if (this->m_eventOut_OutputPort[0].isConnected()) {
2001  Fw::LogBuffer _logBuff;
2003 
2004 #if FW_AMPCS_COMPATIBLE
2005  // Serialize the number of arguments
2006  _status = _logBuff.serialize(static_cast<U8>(2));
2007  FW_ASSERT(
2008  _status == Fw::FW_SERIALIZE_OK,
2009  static_cast<FwAssertArgType>(_status)
2010  );
2011 #endif
2012 
2013 #if FW_AMPCS_COMPATIBLE
2014  // Serialize the argument size
2015  _status = _logBuff.serialize(
2016  static_cast<U8>(sizeof(U32))
2017  );
2018  FW_ASSERT(
2019  _status == Fw::FW_SERIALIZE_OK,
2020  static_cast<FwAssertArgType>(_status)
2021  );
2022 #endif
2023  _status = _logBuff.serialize(bytes);
2024  FW_ASSERT(
2025  _status == Fw::FW_SERIALIZE_OK,
2026  static_cast<FwAssertArgType>(_status)
2027  );
2028 
2029  _status = file.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 200));
2030  FW_ASSERT(
2031  _status == Fw::FW_SERIALIZE_OK,
2032  static_cast<FwAssertArgType>(_status)
2033  );
2034 
2035  this->m_eventOut_OutputPort[0].invoke(
2036  _id,
2037  _logTime,
2039  _logBuff
2040  );
2041  }
2042 
2043  // Emit the event on the text log port
2044 #if FW_ENABLE_TEXT_LOGGING
2045  if (this->m_textEventOut_OutputPort[0].isConnected()) {
2046 #if FW_OBJECT_NAMES == 1
2047  const char* _formatString =
2048  "(%s) %s: Wrote %" PRIu32 " bytes to file %s";
2049 #else
2050  const char* _formatString =
2051  "%s: Wrote %" PRIu32 " bytes to file %s";
2052 #endif
2053 
2054  Fw::TextLogString _logString;
2055  _logString.format(
2056  _formatString,
2057 #if FW_OBJECT_NAMES == 1
2058  this->m_objName.toChar(),
2059 #endif
2060  "FileWritten ",
2061  bytes,
2062  file.toChar()
2063  );
2064 
2065  this->m_textEventOut_OutputPort[0].invoke(
2066  _id,
2067  _logTime,
2069  _logString
2070  );
2071  }
2072 #endif
2073  }
2074 
2075  // ----------------------------------------------------------------------
2076  // Event throttle reset functions
2077  // ----------------------------------------------------------------------
2078 
2081  {
2082  // Reset throttle counter
2083  this->m_InvalidBufferThrottle = 0;
2084  }
2085 
2088  {
2089  // Reset throttle counter
2090  this->m_BufferTooSmallForPacketThrottle = 0;
2091  }
2092 
2095  {
2096  // Reset throttle counter
2097  this->m_InvalidHeaderHashThrottle = 0;
2098  }
2099 
2102  {
2103  // Reset throttle counter
2104  this->m_InvalidHeaderThrottle = 0;
2105  }
2106 
2109  {
2110  // Reset throttle counter
2111  this->m_BufferTooSmallForDataThrottle = 0;
2112  }
2113 
2116  {
2117  // Reset throttle counter
2118  this->m_FileOpenErrorThrottle = 0;
2119  }
2120 
2123  {
2124  // Reset throttle counter
2125  this->m_FileWriteErrorThrottle = 0;
2126  }
2127 
2128  // ----------------------------------------------------------------------
2129  // Telemetry write functions
2130  // ----------------------------------------------------------------------
2131 
2134  U32 arg,
2135  Fw::Time _tlmTime
2136  )
2137  {
2138  // Check to see if it is the first time
2139  if (not this->m_first_update_NumBuffersReceived) {
2140  // Check to see if value has changed. If not, don't write it.
2141  if (arg == this->m_last_NumBuffersReceived) {
2142  return;
2143  }
2144  else {
2145  this->m_last_NumBuffersReceived = arg;
2146  }
2147  }
2148  else {
2149  this->m_first_update_NumBuffersReceived = false;
2150  this->m_last_NumBuffersReceived = arg;
2151  }
2152 
2153  if (this->m_tlmOut_OutputPort[0].isConnected()) {
2154  if (
2155  this->m_timeGetOut_OutputPort[0].isConnected() &&
2156  (_tlmTime == Fw::ZERO_TIME)
2157  ) {
2158  this->m_timeGetOut_OutputPort[0].invoke(_tlmTime);
2159  }
2160 
2161  Fw::TlmBuffer _tlmBuff;
2162  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
2163  FW_ASSERT(
2164  _stat == Fw::FW_SERIALIZE_OK,
2165  static_cast<FwAssertArgType>(_stat)
2166  );
2167 
2168  FwChanIdType _id;
2169 
2170  _id = this->getIdBase() + CHANNELID_NUMBUFFERSRECEIVED;
2171 
2172  this->m_tlmOut_OutputPort[0].invoke(
2173  _id,
2174  _tlmTime,
2175  _tlmBuff
2176  );
2177  }
2178  }
2179 
2182  U64 arg,
2183  Fw::Time _tlmTime
2184  )
2185  {
2186  // Check to see if it is the first time
2187  if (not this->m_first_update_NumBytesWritten) {
2188  // Check to see if value has changed. If not, don't write it.
2189  if (arg == this->m_last_NumBytesWritten) {
2190  return;
2191  }
2192  else {
2193  this->m_last_NumBytesWritten = arg;
2194  }
2195  }
2196  else {
2197  this->m_first_update_NumBytesWritten = false;
2198  this->m_last_NumBytesWritten = arg;
2199  }
2200 
2201  if (this->m_tlmOut_OutputPort[0].isConnected()) {
2202  if (
2203  this->m_timeGetOut_OutputPort[0].isConnected() &&
2204  (_tlmTime == Fw::ZERO_TIME)
2205  ) {
2206  this->m_timeGetOut_OutputPort[0].invoke(_tlmTime);
2207  }
2208 
2209  Fw::TlmBuffer _tlmBuff;
2210  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
2211  FW_ASSERT(
2212  _stat == Fw::FW_SERIALIZE_OK,
2213  static_cast<FwAssertArgType>(_stat)
2214  );
2215 
2216  FwChanIdType _id;
2217 
2218  _id = this->getIdBase() + CHANNELID_NUMBYTESWRITTEN;
2219 
2220  this->m_tlmOut_OutputPort[0].invoke(
2221  _id,
2222  _tlmTime,
2223  _tlmBuff
2224  );
2225  }
2226  }
2227 
2230  U32 arg,
2231  Fw::Time _tlmTime
2232  )
2233  {
2234  // Check to see if it is the first time
2235  if (not this->m_first_update_NumSuccessfulWrites) {
2236  // Check to see if value has changed. If not, don't write it.
2237  if (arg == this->m_last_NumSuccessfulWrites) {
2238  return;
2239  }
2240  else {
2241  this->m_last_NumSuccessfulWrites = arg;
2242  }
2243  }
2244  else {
2245  this->m_first_update_NumSuccessfulWrites = false;
2246  this->m_last_NumSuccessfulWrites = arg;
2247  }
2248 
2249  if (this->m_tlmOut_OutputPort[0].isConnected()) {
2250  if (
2251  this->m_timeGetOut_OutputPort[0].isConnected() &&
2252  (_tlmTime == Fw::ZERO_TIME)
2253  ) {
2254  this->m_timeGetOut_OutputPort[0].invoke(_tlmTime);
2255  }
2256 
2257  Fw::TlmBuffer _tlmBuff;
2258  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
2259  FW_ASSERT(
2260  _stat == Fw::FW_SERIALIZE_OK,
2261  static_cast<FwAssertArgType>(_stat)
2262  );
2263 
2264  FwChanIdType _id;
2265 
2266  _id = this->getIdBase() + CHANNELID_NUMSUCCESSFULWRITES;
2267 
2268  this->m_tlmOut_OutputPort[0].invoke(
2269  _id,
2270  _tlmTime,
2271  _tlmBuff
2272  );
2273  }
2274  }
2275 
2278  U32 arg,
2279  Fw::Time _tlmTime
2280  )
2281  {
2282  // Check to see if it is the first time
2283  if (not this->m_first_update_NumFailedWrites) {
2284  // Check to see if value has changed. If not, don't write it.
2285  if (arg == this->m_last_NumFailedWrites) {
2286  return;
2287  }
2288  else {
2289  this->m_last_NumFailedWrites = arg;
2290  }
2291  }
2292  else {
2293  this->m_first_update_NumFailedWrites = false;
2294  this->m_last_NumFailedWrites = arg;
2295  }
2296 
2297  if (this->m_tlmOut_OutputPort[0].isConnected()) {
2298  if (
2299  this->m_timeGetOut_OutputPort[0].isConnected() &&
2300  (_tlmTime == Fw::ZERO_TIME)
2301  ) {
2302  this->m_timeGetOut_OutputPort[0].invoke(_tlmTime);
2303  }
2304 
2305  Fw::TlmBuffer _tlmBuff;
2306  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
2307  FW_ASSERT(
2308  _stat == Fw::FW_SERIALIZE_OK,
2309  static_cast<FwAssertArgType>(_stat)
2310  );
2311 
2312  FwChanIdType _id;
2313 
2314  _id = this->getIdBase() + CHANNELID_NUMFAILEDWRITES;
2315 
2316  this->m_tlmOut_OutputPort[0].invoke(
2317  _id,
2318  _tlmTime,
2319  _tlmBuff
2320  );
2321  }
2322  }
2323 
2326  U32 arg,
2327  Fw::Time _tlmTime
2328  )
2329  {
2330  // Check to see if it is the first time
2331  if (not this->m_first_update_NumErrors) {
2332  // Check to see if value has changed. If not, don't write it.
2333  if (arg == this->m_last_NumErrors) {
2334  return;
2335  }
2336  else {
2337  this->m_last_NumErrors = arg;
2338  }
2339  }
2340  else {
2341  this->m_first_update_NumErrors = false;
2342  this->m_last_NumErrors = arg;
2343  }
2344 
2345  if (this->m_tlmOut_OutputPort[0].isConnected()) {
2346  if (
2347  this->m_timeGetOut_OutputPort[0].isConnected() &&
2348  (_tlmTime == Fw::ZERO_TIME)
2349  ) {
2350  this->m_timeGetOut_OutputPort[0].invoke(_tlmTime);
2351  }
2352 
2353  Fw::TlmBuffer _tlmBuff;
2354  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
2355  FW_ASSERT(
2356  _stat == Fw::FW_SERIALIZE_OK,
2357  static_cast<FwAssertArgType>(_stat)
2358  );
2359 
2360  FwChanIdType _id;
2361 
2362  _id = this->getIdBase() + CHANNELID_NUMERRORS;
2363 
2364  this->m_tlmOut_OutputPort[0].invoke(
2365  _id,
2366  _tlmTime,
2367  _tlmBuff
2368  );
2369  }
2370  }
2371 
2372  // ----------------------------------------------------------------------
2373  // Time
2374  // ----------------------------------------------------------------------
2375 
2378  {
2379  if (this->m_timeGetOut_OutputPort[0].isConnected()) {
2380  Fw::Time _time;
2381  this->m_timeGetOut_OutputPort[0].invoke(_time);
2382  return _time;
2383  }
2384  else {
2385  return Fw::Time(TB_NONE, 0, 0);
2386  }
2387  }
2388 
2389  // ----------------------------------------------------------------------
2390  // Message dispatch functions
2391  // ----------------------------------------------------------------------
2392 
2393  Fw::QueuedComponentBase::MsgDispatchStatus DpWriterComponentBase ::
2394  doDispatch()
2395  {
2396  ComponentIpcSerializableBuffer msg;
2397  FwQueuePriorityType priority = 0;
2398 
2399  Os::Queue::Status msgStatus = this->m_queue.receive(
2400  msg,
2402  priority
2403  );
2404  FW_ASSERT(
2405  msgStatus == Os::Queue::OP_OK,
2406  static_cast<FwAssertArgType>(msgStatus)
2407  );
2408 
2409  // Reset to beginning of buffer
2410  msg.resetDeser();
2411 
2412  FwEnumStoreType desMsg = 0;
2413  Fw::SerializeStatus deserStatus = msg.deserialize(desMsg);
2414  FW_ASSERT(
2415  deserStatus == Fw::FW_SERIALIZE_OK,
2416  static_cast<FwAssertArgType>(deserStatus)
2417  );
2418 
2419  MsgTypeEnum msgType = static_cast<MsgTypeEnum>(desMsg);
2420 
2421  if (msgType == DPWRITER_COMPONENT_EXIT) {
2422  return MSG_DISPATCH_EXIT;
2423  }
2424 
2425  FwIndexType portNum = 0;
2426  deserStatus = msg.deserialize(portNum);
2427  FW_ASSERT(
2428  deserStatus == Fw::FW_SERIALIZE_OK,
2429  static_cast<FwAssertArgType>(deserStatus)
2430  );
2431 
2432  switch (msgType) {
2433  // Handle async input port bufferSendIn
2434  case BUFFERSENDIN_BUFFERSEND: {
2435  // Deserialize argument fwBuffer
2436  Fw::Buffer fwBuffer;
2437  deserStatus = msg.deserialize(fwBuffer);
2438  FW_ASSERT(
2439  deserStatus == Fw::FW_SERIALIZE_OK,
2440  static_cast<FwAssertArgType>(deserStatus)
2441  );
2442  // Call handler function
2443  this->bufferSendIn_handler(
2444  portNum,
2445  fwBuffer
2446  );
2447 
2448  break;
2449  }
2450 
2451  // Handle async input port schedIn
2452  case SCHEDIN_SCHED: {
2453  // Deserialize argument context
2454  U32 context;
2455  deserStatus = msg.deserialize(context);
2456  FW_ASSERT(
2457  deserStatus == Fw::FW_SERIALIZE_OK,
2458  static_cast<FwAssertArgType>(deserStatus)
2459  );
2460  // Call handler function
2461  this->schedIn_handler(
2462  portNum,
2463  context
2464  );
2465 
2466  break;
2467  }
2468 
2469  // Handle command CLEAR_EVENT_THROTTLE
2470  case CMD_CLEAR_EVENT_THROTTLE: {
2471  // Deserialize opcode
2472  FwOpcodeType opCode = 0;
2473  deserStatus = msg.deserialize(opCode);
2474  FW_ASSERT (
2475  deserStatus == Fw::FW_SERIALIZE_OK,
2476  static_cast<FwAssertArgType>(deserStatus)
2477  );
2478 
2479  // Deserialize command sequence
2480  U32 cmdSeq = 0;
2481  deserStatus = msg.deserialize(cmdSeq);
2482  FW_ASSERT (
2483  deserStatus == Fw::FW_SERIALIZE_OK,
2484  static_cast<FwAssertArgType>(deserStatus)
2485  );
2486 
2487  // Deserialize command argument buffer
2488  Fw::CmdArgBuffer args;
2489  deserStatus = msg.deserialize(args);
2490  FW_ASSERT (
2491  deserStatus == Fw::FW_SERIALIZE_OK,
2492  static_cast<FwAssertArgType>(deserStatus)
2493  );
2494 
2495  // Reset buffer
2496  args.resetDeser();
2497 
2498  // Make sure there was no data left over.
2499  // That means the argument buffer size was incorrect.
2500 #if FW_CMD_CHECK_RESIDUAL
2501  if (args.getBuffLeft() != 0) {
2502  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
2503  this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2504  }
2505  // Don't crash the task if bad arguments were passed from the ground
2506  break;
2507  }
2508 #endif
2509 
2510  // Call handler function
2511  this->CLEAR_EVENT_THROTTLE_cmdHandler(opCode, cmdSeq);
2512 
2513  break;
2514  }
2515 
2516  default:
2517  return MSG_DISPATCH_ERROR;
2518  }
2519 
2520  return MSG_DISPATCH_OK;
2521  }
2522 
2523  // ----------------------------------------------------------------------
2524  // Calls for messages received on special input ports
2525  // ----------------------------------------------------------------------
2526 
2527  void DpWriterComponentBase ::
2528  m_p_cmdIn_in(
2529  Fw::PassiveComponentBase* callComp,
2530  FwIndexType portNum,
2531  FwOpcodeType opCode,
2532  U32 cmdSeq,
2533  Fw::CmdArgBuffer& args
2534  )
2535  {
2536  FW_ASSERT(callComp);
2537  DpWriterComponentBase* compPtr = static_cast<DpWriterComponentBase*>(callComp);
2538 
2539  const U32 idBase = callComp->getIdBase();
2540  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
2541 
2542  // Select base class function based on opcode
2543  switch (opCode - idBase) {
2545  compPtr->CLEAR_EVENT_THROTTLE_cmdHandlerBase(
2546  opCode,
2547  cmdSeq,
2548  args
2549  );
2550  break;
2551  }
2552  }
2553  }
2554 
2555  // ----------------------------------------------------------------------
2556  // Calls for messages received on typed input ports
2557  // ----------------------------------------------------------------------
2558 
2559  void DpWriterComponentBase ::
2560  m_p_bufferSendIn_in(
2561  Fw::PassiveComponentBase* callComp,
2562  FwIndexType portNum,
2563  Fw::Buffer& fwBuffer
2564  )
2565  {
2566  FW_ASSERT(callComp);
2567  DpWriterComponentBase* compPtr = static_cast<DpWriterComponentBase*>(callComp);
2568  compPtr->bufferSendIn_handlerBase(
2569  portNum,
2570  fwBuffer
2571  );
2572  }
2573 
2574  void DpWriterComponentBase ::
2575  m_p_schedIn_in(
2576  Fw::PassiveComponentBase* callComp,
2577  FwIndexType portNum,
2578  U32 context
2579  )
2580  {
2581  FW_ASSERT(callComp);
2582  DpWriterComponentBase* compPtr = static_cast<DpWriterComponentBase*>(callComp);
2583  compPtr->schedIn_handlerBase(
2584  portNum,
2585  context
2586  );
2587  }
2588 
2589 }
Serialization/Deserialization operation was successful.
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.
Received buffer is too small to hold the data specified in the header.
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
void addCallPort(InputDpWrittenPort *callPort)
Register an input port.
NATIVE_UINT_TYPE SizeType
Status
status returned from the queue send function
Definition: Queue.hpp:30
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.
PlatformSizeType FwSizeType
Definition: FpConfig.h:35
The received buffer has an invalid header hash.
An error occurred when opening a file.
const Time ZERO_TIME
Definition: Time.cpp:5
FwIndexType getNum_cmdRegIn_OutputPorts() const
I32 FwEnumStoreType
Definition: FpConfig.h:64
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.
PlatformIndexType FwIndexType
Definition: FpConfig.h:25
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
The size of the serial representations of the port arguments.
Definition: CmdPortAc.hpp:37
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:45
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.
void CLEAR_EVENT_THROTTLE_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
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)
void setPortNum(NATIVE_INT_TYPE portNum)
Less important informational events.
Os::Queue::Status createQueue(FwSizeType depth, FwSizeType msgSize)
Received buffer is too small to hold a data product packet.
#define FW_MIN(a, b)
MIN macro.
Definition: BasicTypes.h:72
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)
U32 FwOpcodeType
Definition: FpConfig.h:91
The size of the serial representations of the port arguments.
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.
No time base has been established.
Definition: FpConfig.h:70
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
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.
U32 FwDpPriorityType
Definition: FpConfig.h:119
A serious but recoverable event.
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.
void log_WARNING_HI_InvalidHeaderHash_ThrottleClear()
Reset throttle value for InvalidHeaderHash.
U32 FwEventIdType
Definition: FpConfig.h:103
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:55
void init()
Initialization function.
Definition: LogPortAc.cpp:151
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:30
BlockingType
message type
Definition: Queue.hpp:44
#define PRI_PlatformIntType
An error occurred when writing to a file.
void regCommands()
Register commands with the Command Dispatcher.
FwIndexType getNum_bufferSendIn_InputPorts() const
Command failed to deserialize.
void init()
Initialization function.
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
Error occurred when deserializing the packet header.
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
PlatformQueuePriorityType FwQueuePriorityType
Definition: FpConfig.h:55
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
message to exit active component task
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.
virtual void schedIn_handler(FwIndexType portNum, U32 context)=0
Handler for input port schedIn.
FwIndexType getNum_tlmOut_OutputPorts() const
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:70
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].
bool isConnected_cmdRegIn_OutputPort(FwIndexType portNum)
message sent/received okay
Definition: Queue.hpp:31
U8 BYTE
byte type
Definition: BasicTypes.h:31
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:46
The size of the serial representations of the port arguments.
Definition: SchedPortAc.hpp:36
Status receive(U8 *destination, FwSizeType capacity, BlockingType blockType, FwSizeType &actualSize, FwQueuePriorityType &priority) override
receive a message from the queue through delegate
void set_procBufferSendOut_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to procBufferSendOut[portNum].
void init()
Initialization function.
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:148
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
#define FW_LOG_STRING_MAX_SIZE
Max size of log string parameter type.
Definition: FpConfig.h:319
virtual const CHAR * toChar() const =0
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.
U32 FwChanIdType
Definition: FpConfig.h:95
bool isConnected_timeGetOut_OutputPort(FwIndexType portNum)
#define U64(C)
Definition: sha.h:180