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