F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
FileWorkerComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title FileWorkerComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for FileWorker 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  FILEWORKER_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT,
19  READIN_FILEREAD,
20  VERIFYIN_VERIFYSTATUS,
21  WRITEIN_FILEWRITE,
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 {
31  };
32 
33  // Define a message buffer class large enough to handle all the
34  // asynchronous inputs to the component
35  class ComponentIpcSerializableBuffer :
37  {
38 
39  public:
40 
41  enum {
42  // Offset into data in buffer: Size of message ID and port number
43  DATA_OFFSET = sizeof(FwEnumStoreType) + sizeof(FwIndexType),
44  // Max data size
45  MAX_DATA_SIZE = sizeof(BuffUnion),
46  // Max message size: Size of message id + size of port + max data size
47  SERIALIZATION_SIZE = DATA_OFFSET + MAX_DATA_SIZE
48  };
49 
50  Fw::Serializable::SizeType getCapacity() const {
51  return sizeof(m_buff);
52  }
53 
54  U8* getBuffAddr() {
55  return m_buff;
56  }
57 
58  const U8* getBuffAddr() const {
59  return m_buff;
60  }
61 
62  private:
63  // Should be the max of all the input ports serialized sizes...
64  U8 m_buff[SERIALIZATION_SIZE];
65 
66  };
67  }
68 
69  // ----------------------------------------------------------------------
70  // Component initialization
71  // ----------------------------------------------------------------------
72 
75  FwSizeType queueDepth,
76  FwEnumStoreType instance
77  )
78  {
79  // Initialize base class
81 
82  // Connect input port cmdIn
83  for (
84  FwIndexType port = 0;
85  port < static_cast<FwIndexType>(this->getNum_cmdIn_InputPorts());
86  port++
87  ) {
88  this->m_cmdIn_InputPort[port].init();
89  this->m_cmdIn_InputPort[port].addCallComp(
90  this,
91  m_p_cmdIn_in
92  );
93  this->m_cmdIn_InputPort[port].setPortNum(port);
94 
95 #if FW_OBJECT_NAMES == 1
96  Fw::ObjectName portName;
97  portName.format(
98  "%s_cmdIn_InputPort[%" PRI_FwIndexType "]",
99  this->m_objName.toChar(),
100  port
101  );
102  this->m_cmdIn_InputPort[port].setObjName(portName.toChar());
103 #endif
104  }
105 
106  // Connect input port cancelIn
107  for (
108  FwIndexType port = 0;
109  port < static_cast<FwIndexType>(this->getNum_cancelIn_InputPorts());
110  port++
111  ) {
112  this->m_cancelIn_InputPort[port].init();
113  this->m_cancelIn_InputPort[port].addCallComp(
114  this,
115  m_p_cancelIn_in
116  );
117  this->m_cancelIn_InputPort[port].setPortNum(port);
118 
119 #if FW_OBJECT_NAMES == 1
120  Fw::ObjectName portName;
121  portName.format(
122  "%s_cancelIn_InputPort[%" PRI_FwIndexType "]",
123  this->m_objName.toChar(),
124  port
125  );
126  this->m_cancelIn_InputPort[port].setObjName(portName.toChar());
127 #endif
128  }
129 
130  // Connect input port readIn
131  for (
132  FwIndexType port = 0;
133  port < static_cast<FwIndexType>(this->getNum_readIn_InputPorts());
134  port++
135  ) {
136  this->m_readIn_InputPort[port].init();
137  this->m_readIn_InputPort[port].addCallComp(
138  this,
139  m_p_readIn_in
140  );
141  this->m_readIn_InputPort[port].setPortNum(port);
142 
143 #if FW_OBJECT_NAMES == 1
144  Fw::ObjectName portName;
145  portName.format(
146  "%s_readIn_InputPort[%" PRI_FwIndexType "]",
147  this->m_objName.toChar(),
148  port
149  );
150  this->m_readIn_InputPort[port].setObjName(portName.toChar());
151 #endif
152  }
153 
154  // Connect input port verifyIn
155  for (
156  FwIndexType port = 0;
157  port < static_cast<FwIndexType>(this->getNum_verifyIn_InputPorts());
158  port++
159  ) {
160  this->m_verifyIn_InputPort[port].init();
161  this->m_verifyIn_InputPort[port].addCallComp(
162  this,
163  m_p_verifyIn_in
164  );
165  this->m_verifyIn_InputPort[port].setPortNum(port);
166 
167 #if FW_OBJECT_NAMES == 1
168  Fw::ObjectName portName;
169  portName.format(
170  "%s_verifyIn_InputPort[%" PRI_FwIndexType "]",
171  this->m_objName.toChar(),
172  port
173  );
174  this->m_verifyIn_InputPort[port].setObjName(portName.toChar());
175 #endif
176  }
177 
178  // Connect input port writeIn
179  for (
180  FwIndexType port = 0;
181  port < static_cast<FwIndexType>(this->getNum_writeIn_InputPorts());
182  port++
183  ) {
184  this->m_writeIn_InputPort[port].init();
185  this->m_writeIn_InputPort[port].addCallComp(
186  this,
187  m_p_writeIn_in
188  );
189  this->m_writeIn_InputPort[port].setPortNum(port);
190 
191 #if FW_OBJECT_NAMES == 1
192  Fw::ObjectName portName;
193  portName.format(
194  "%s_writeIn_InputPort[%" PRI_FwIndexType "]",
195  this->m_objName.toChar(),
196  port
197  );
198  this->m_writeIn_InputPort[port].setObjName(portName.toChar());
199 #endif
200  }
201 
202  // Connect output port cmdRegOut
203  for (
204  FwIndexType port = 0;
205  port < static_cast<FwIndexType>(this->getNum_cmdRegOut_OutputPorts());
206  port++
207  ) {
208  this->m_cmdRegOut_OutputPort[port].init();
209 
210 #if FW_OBJECT_NAMES == 1
211  Fw::ObjectName portName;
212  portName.format(
213  "%s_cmdRegOut_OutputPort[%" PRI_FwIndexType "]",
214  this->m_objName.toChar(),
215  port
216  );
217  this->m_cmdRegOut_OutputPort[port].setObjName(portName.toChar());
218 #endif
219  }
220 
221  // Connect output port cmdResponseOut
222  for (
223  FwIndexType port = 0;
224  port < static_cast<FwIndexType>(this->getNum_cmdResponseOut_OutputPorts());
225  port++
226  ) {
227  this->m_cmdResponseOut_OutputPort[port].init();
228 
229 #if FW_OBJECT_NAMES == 1
230  Fw::ObjectName portName;
231  portName.format(
232  "%s_cmdResponseOut_OutputPort[%" PRI_FwIndexType "]",
233  this->m_objName.toChar(),
234  port
235  );
236  this->m_cmdResponseOut_OutputPort[port].setObjName(portName.toChar());
237 #endif
238  }
239 
240  // Connect output port logOut
241  for (
242  FwIndexType port = 0;
243  port < static_cast<FwIndexType>(this->getNum_logOut_OutputPorts());
244  port++
245  ) {
246  this->m_logOut_OutputPort[port].init();
247 
248 #if FW_OBJECT_NAMES == 1
249  Fw::ObjectName portName;
250  portName.format(
251  "%s_logOut_OutputPort[%" PRI_FwIndexType "]",
252  this->m_objName.toChar(),
253  port
254  );
255  this->m_logOut_OutputPort[port].setObjName(portName.toChar());
256 #endif
257  }
258 
259 #if FW_ENABLE_TEXT_LOGGING == 1
260  // Connect output port logTextOut
261  for (
262  FwIndexType port = 0;
263  port < static_cast<FwIndexType>(this->getNum_logTextOut_OutputPorts());
264  port++
265  ) {
266  this->m_logTextOut_OutputPort[port].init();
267 
268 #if FW_OBJECT_NAMES == 1
269  Fw::ObjectName portName;
270  portName.format(
271  "%s_logTextOut_OutputPort[%" PRI_FwIndexType "]",
272  this->m_objName.toChar(),
273  port
274  );
275  this->m_logTextOut_OutputPort[port].setObjName(portName.toChar());
276 #endif
277  }
278 #endif
279 
280  // Connect output port prmGetOut
281  for (
282  FwIndexType port = 0;
283  port < static_cast<FwIndexType>(this->getNum_prmGetOut_OutputPorts());
284  port++
285  ) {
286  this->m_prmGetOut_OutputPort[port].init();
287 
288 #if FW_OBJECT_NAMES == 1
289  Fw::ObjectName portName;
290  portName.format(
291  "%s_prmGetOut_OutputPort[%" PRI_FwIndexType "]",
292  this->m_objName.toChar(),
293  port
294  );
295  this->m_prmGetOut_OutputPort[port].setObjName(portName.toChar());
296 #endif
297  }
298 
299  // Connect output port prmSetOut
300  for (
301  FwIndexType port = 0;
302  port < static_cast<FwIndexType>(this->getNum_prmSetOut_OutputPorts());
303  port++
304  ) {
305  this->m_prmSetOut_OutputPort[port].init();
306 
307 #if FW_OBJECT_NAMES == 1
308  Fw::ObjectName portName;
309  portName.format(
310  "%s_prmSetOut_OutputPort[%" PRI_FwIndexType "]",
311  this->m_objName.toChar(),
312  port
313  );
314  this->m_prmSetOut_OutputPort[port].setObjName(portName.toChar());
315 #endif
316  }
317 
318  // Connect output port timeCaller
319  for (
320  FwIndexType port = 0;
321  port < static_cast<FwIndexType>(this->getNum_timeCaller_OutputPorts());
322  port++
323  ) {
324  this->m_timeCaller_OutputPort[port].init();
325 
326 #if FW_OBJECT_NAMES == 1
327  Fw::ObjectName portName;
328  portName.format(
329  "%s_timeCaller_OutputPort[%" PRI_FwIndexType "]",
330  this->m_objName.toChar(),
331  port
332  );
333  this->m_timeCaller_OutputPort[port].setObjName(portName.toChar());
334 #endif
335  }
336 
337  // Connect output port tlmOut
338  for (
339  FwIndexType port = 0;
340  port < static_cast<FwIndexType>(this->getNum_tlmOut_OutputPorts());
341  port++
342  ) {
343  this->m_tlmOut_OutputPort[port].init();
344 
345 #if FW_OBJECT_NAMES == 1
346  Fw::ObjectName portName;
347  portName.format(
348  "%s_tlmOut_OutputPort[%" PRI_FwIndexType "]",
349  this->m_objName.toChar(),
350  port
351  );
352  this->m_tlmOut_OutputPort[port].setObjName(portName.toChar());
353 #endif
354  }
355 
356  // Connect output port readDoneOut
357  for (
358  FwIndexType port = 0;
359  port < static_cast<FwIndexType>(this->getNum_readDoneOut_OutputPorts());
360  port++
361  ) {
362  this->m_readDoneOut_OutputPort[port].init();
363 
364 #if FW_OBJECT_NAMES == 1
365  Fw::ObjectName portName;
366  portName.format(
367  "%s_readDoneOut_OutputPort[%" PRI_FwIndexType "]",
368  this->m_objName.toChar(),
369  port
370  );
371  this->m_readDoneOut_OutputPort[port].setObjName(portName.toChar());
372 #endif
373  }
374 
375  // Connect output port verifyDoneOut
376  for (
377  FwIndexType port = 0;
378  port < static_cast<FwIndexType>(this->getNum_verifyDoneOut_OutputPorts());
379  port++
380  ) {
381  this->m_verifyDoneOut_OutputPort[port].init();
382 
383 #if FW_OBJECT_NAMES == 1
384  Fw::ObjectName portName;
385  portName.format(
386  "%s_verifyDoneOut_OutputPort[%" PRI_FwIndexType "]",
387  this->m_objName.toChar(),
388  port
389  );
390  this->m_verifyDoneOut_OutputPort[port].setObjName(portName.toChar());
391 #endif
392  }
393 
394  // Connect output port writeDoneOut
395  for (
396  FwIndexType port = 0;
397  port < static_cast<FwIndexType>(this->getNum_writeDoneOut_OutputPorts());
398  port++
399  ) {
400  this->m_writeDoneOut_OutputPort[port].init();
401 
402 #if FW_OBJECT_NAMES == 1
403  Fw::ObjectName portName;
404  portName.format(
405  "%s_writeDoneOut_OutputPort[%" PRI_FwIndexType "]",
406  this->m_objName.toChar(),
407  port
408  );
409  this->m_writeDoneOut_OutputPort[port].setObjName(portName.toChar());
410 #endif
411  }
412 
413  // Create the queue
414  Os::Queue::Status qStat = this->createQueue(
415  queueDepth,
416  static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
417  );
418  FW_ASSERT(
419  Os::Queue::Status::OP_OK == qStat,
420  static_cast<FwAssertArgType>(qStat)
421  );
422  }
423 
424  // ----------------------------------------------------------------------
425  // Getters for special input ports
426  // ----------------------------------------------------------------------
427 
430  {
431  FW_ASSERT(
432  (0 <= portNum) && (portNum < this->getNum_cmdIn_InputPorts()),
433  static_cast<FwAssertArgType>(portNum)
434  );
435 
436  return &this->m_cmdIn_InputPort[portNum];
437  }
438 
439  // ----------------------------------------------------------------------
440  // Getters for typed input ports
441  // ----------------------------------------------------------------------
442 
445  {
446  FW_ASSERT(
447  (0 <= portNum) && (portNum < this->getNum_cancelIn_InputPorts()),
448  static_cast<FwAssertArgType>(portNum)
449  );
450 
451  return &this->m_cancelIn_InputPort[portNum];
452  }
453 
456  {
457  FW_ASSERT(
458  (0 <= portNum) && (portNum < this->getNum_readIn_InputPorts()),
459  static_cast<FwAssertArgType>(portNum)
460  );
461 
462  return &this->m_readIn_InputPort[portNum];
463  }
464 
467  {
468  FW_ASSERT(
469  (0 <= portNum) && (portNum < this->getNum_verifyIn_InputPorts()),
470  static_cast<FwAssertArgType>(portNum)
471  );
472 
473  return &this->m_verifyIn_InputPort[portNum];
474  }
475 
478  {
479  FW_ASSERT(
480  (0 <= portNum) && (portNum < this->getNum_writeIn_InputPorts()),
481  static_cast<FwAssertArgType>(portNum)
482  );
483 
484  return &this->m_writeIn_InputPort[portNum];
485  }
486 
487  // ----------------------------------------------------------------------
488  // Connect input ports to special output ports
489  // ----------------------------------------------------------------------
490 
493  FwIndexType portNum,
494  Fw::InputCmdRegPort* port
495  )
496  {
497  FW_ASSERT(
498  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
499  static_cast<FwAssertArgType>(portNum)
500  );
501 
502  this->m_cmdRegOut_OutputPort[portNum].addCallPort(port);
503  }
504 
507  FwIndexType portNum,
509  )
510  {
511  FW_ASSERT(
512  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
513  static_cast<FwAssertArgType>(portNum)
514  );
515 
516  this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port);
517  }
518 
521  FwIndexType portNum,
522  Fw::InputLogPort* port
523  )
524  {
525  FW_ASSERT(
526  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
527  static_cast<FwAssertArgType>(portNum)
528  );
529 
530  this->m_logOut_OutputPort[portNum].addCallPort(port);
531  }
532 
533 #if FW_ENABLE_TEXT_LOGGING == 1
534 
535  void FileWorkerComponentBase ::
536  set_logTextOut_OutputPort(
537  FwIndexType portNum,
539  )
540  {
541  FW_ASSERT(
542  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
543  static_cast<FwAssertArgType>(portNum)
544  );
545 
546  this->m_logTextOut_OutputPort[portNum].addCallPort(port);
547  }
548 
549 #endif
550 
553  FwIndexType portNum,
554  Fw::InputPrmGetPort* port
555  )
556  {
557  FW_ASSERT(
558  (0 <= portNum) && (portNum < this->getNum_prmGetOut_OutputPorts()),
559  static_cast<FwAssertArgType>(portNum)
560  );
561 
562  this->m_prmGetOut_OutputPort[portNum].addCallPort(port);
563  }
564 
567  FwIndexType portNum,
568  Fw::InputPrmSetPort* port
569  )
570  {
571  FW_ASSERT(
572  (0 <= portNum) && (portNum < this->getNum_prmSetOut_OutputPorts()),
573  static_cast<FwAssertArgType>(portNum)
574  );
575 
576  this->m_prmSetOut_OutputPort[portNum].addCallPort(port);
577  }
578 
581  FwIndexType portNum,
582  Fw::InputTimePort* port
583  )
584  {
585  FW_ASSERT(
586  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
587  static_cast<FwAssertArgType>(portNum)
588  );
589 
590  this->m_timeCaller_OutputPort[portNum].addCallPort(port);
591  }
592 
595  FwIndexType portNum,
596  Fw::InputTlmPort* port
597  )
598  {
599  FW_ASSERT(
600  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
601  static_cast<FwAssertArgType>(portNum)
602  );
603 
604  this->m_tlmOut_OutputPort[portNum].addCallPort(port);
605  }
606 
607  // ----------------------------------------------------------------------
608  // Connect typed input ports to typed output ports
609  // ----------------------------------------------------------------------
610 
613  FwIndexType portNum,
615  )
616  {
617  FW_ASSERT(
618  (0 <= portNum) && (portNum < this->getNum_readDoneOut_OutputPorts()),
619  static_cast<FwAssertArgType>(portNum)
620  );
621 
622  this->m_readDoneOut_OutputPort[portNum].addCallPort(port);
623  }
624 
627  FwIndexType portNum,
629  )
630  {
631  FW_ASSERT(
632  (0 <= portNum) && (portNum < this->getNum_verifyDoneOut_OutputPorts()),
633  static_cast<FwAssertArgType>(portNum)
634  );
635 
636  this->m_verifyDoneOut_OutputPort[portNum].addCallPort(port);
637  }
638 
641  FwIndexType portNum,
643  )
644  {
645  FW_ASSERT(
646  (0 <= portNum) && (portNum < this->getNum_writeDoneOut_OutputPorts()),
647  static_cast<FwAssertArgType>(portNum)
648  );
649 
650  this->m_writeDoneOut_OutputPort[portNum].addCallPort(port);
651  }
652 
653 #if FW_PORT_SERIALIZATION
654 
655  // ----------------------------------------------------------------------
656  // Connect serial input ports to special output ports
657  // ----------------------------------------------------------------------
658 
661  FwIndexType portNum,
662  Fw::InputSerializePort* port
663  )
664  {
665  FW_ASSERT(
666  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
667  static_cast<FwAssertArgType>(portNum)
668  );
669 
670  this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port);
671  }
672 
675  FwIndexType portNum,
676  Fw::InputSerializePort* port
677  )
678  {
679  FW_ASSERT(
680  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
681  static_cast<FwAssertArgType>(portNum)
682  );
683 
684  this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port);
685  }
686 
689  FwIndexType portNum,
690  Fw::InputSerializePort* port
691  )
692  {
693  FW_ASSERT(
694  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
695  static_cast<FwAssertArgType>(portNum)
696  );
697 
698  this->m_logOut_OutputPort[portNum].registerSerialPort(port);
699  }
700 
701 #if FW_ENABLE_TEXT_LOGGING == 1
702 
703  void FileWorkerComponentBase ::
704  set_logTextOut_OutputPort(
705  FwIndexType portNum,
706  Fw::InputSerializePort* port
707  )
708  {
709  FW_ASSERT(
710  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
711  static_cast<FwAssertArgType>(portNum)
712  );
713 
714  this->m_logTextOut_OutputPort[portNum].registerSerialPort(port);
715  }
716 
717 #endif
718 
721  FwIndexType portNum,
722  Fw::InputSerializePort* port
723  )
724  {
725  FW_ASSERT(
726  (0 <= portNum) && (portNum < this->getNum_prmSetOut_OutputPorts()),
727  static_cast<FwAssertArgType>(portNum)
728  );
729 
730  this->m_prmSetOut_OutputPort[portNum].registerSerialPort(port);
731  }
732 
735  FwIndexType portNum,
736  Fw::InputSerializePort* port
737  )
738  {
739  FW_ASSERT(
740  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
741  static_cast<FwAssertArgType>(portNum)
742  );
743 
744  this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
745  }
746 
749  FwIndexType portNum,
750  Fw::InputSerializePort* port
751  )
752  {
753  FW_ASSERT(
754  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
755  static_cast<FwAssertArgType>(portNum)
756  );
757 
758  this->m_tlmOut_OutputPort[portNum].registerSerialPort(port);
759  }
760 
761 #endif
762 
763 #if FW_PORT_SERIALIZATION
764 
765  // ----------------------------------------------------------------------
766  // Connect serial input ports to typed output ports
767  // ----------------------------------------------------------------------
768 
771  FwIndexType portNum,
772  Fw::InputSerializePort* port
773  )
774  {
775  FW_ASSERT(
776  (0 <= portNum) && (portNum < this->getNum_readDoneOut_OutputPorts()),
777  static_cast<FwAssertArgType>(portNum)
778  );
779 
780  this->m_readDoneOut_OutputPort[portNum].registerSerialPort(port);
781  }
782 
785  FwIndexType portNum,
786  Fw::InputSerializePort* port
787  )
788  {
789  FW_ASSERT(
790  (0 <= portNum) && (portNum < this->getNum_verifyDoneOut_OutputPorts()),
791  static_cast<FwAssertArgType>(portNum)
792  );
793 
794  this->m_verifyDoneOut_OutputPort[portNum].registerSerialPort(port);
795  }
796 
799  FwIndexType portNum,
800  Fw::InputSerializePort* port
801  )
802  {
803  FW_ASSERT(
804  (0 <= portNum) && (portNum < this->getNum_writeDoneOut_OutputPorts()),
805  static_cast<FwAssertArgType>(portNum)
806  );
807 
808  this->m_writeDoneOut_OutputPort[portNum].registerSerialPort(port);
809  }
810 
811 #endif
812 
813  // ----------------------------------------------------------------------
814  // Component construction and destruction
815  // ----------------------------------------------------------------------
816 
818  FileWorkerComponentBase(const char* compName) :
819  Fw::ActiveComponentBase(compName)
820  {
821  this->m_NotInIdleThrottle = 0;
822  this->m_CrcFailedThrottle = 0;
823  this->m_ReadFailedFileSizeThrottle = 0;
824  this->m_OpenFileErrorThrottle = 0;
825  this->m_WriteFileErrorThrottle = 0;
826  this->m_WriteValidationOpenErrorThrottle = 0;
827  this->m_WriteValidationReadErrorThrottle = 0;
828 
829  this->m_NotInIdleThrottleTime = Fw::Time();
830  this->m_CrcFailedThrottleTime = Fw::Time();
831  this->m_ReadFailedFileSizeThrottleTime = Fw::Time();
832  this->m_OpenFileErrorThrottleTime = Fw::Time();
833  this->m_WriteFileErrorThrottleTime = Fw::Time();
834  this->m_WriteValidationOpenErrorThrottleTime = Fw::Time();
835  this->m_WriteValidationReadErrorThrottleTime = Fw::Time();
836  }
837 
840  {
841 
842  }
843 
844  // ----------------------------------------------------------------------
845  // Connection status queries for special output ports
846  // ----------------------------------------------------------------------
847 
850  {
851  FW_ASSERT(
852  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
853  static_cast<FwAssertArgType>(portNum)
854  );
855 
856  return this->m_cmdRegOut_OutputPort[portNum].isConnected();
857  }
858 
861  {
862  FW_ASSERT(
863  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
864  static_cast<FwAssertArgType>(portNum)
865  );
866 
867  return this->m_cmdResponseOut_OutputPort[portNum].isConnected();
868  }
869 
872  {
873  FW_ASSERT(
874  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
875  static_cast<FwAssertArgType>(portNum)
876  );
877 
878  return this->m_logOut_OutputPort[portNum].isConnected();
879  }
880 
881 #if FW_ENABLE_TEXT_LOGGING == 1
882 
883  bool FileWorkerComponentBase ::
884  isConnected_logTextOut_OutputPort(FwIndexType portNum)
885  {
886  FW_ASSERT(
887  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
888  static_cast<FwAssertArgType>(portNum)
889  );
890 
891  return this->m_logTextOut_OutputPort[portNum].isConnected();
892  }
893 
894 #endif
895 
898  {
899  FW_ASSERT(
900  (0 <= portNum) && (portNum < this->getNum_prmGetOut_OutputPorts()),
901  static_cast<FwAssertArgType>(portNum)
902  );
903 
904  return this->m_prmGetOut_OutputPort[portNum].isConnected();
905  }
906 
909  {
910  FW_ASSERT(
911  (0 <= portNum) && (portNum < this->getNum_prmSetOut_OutputPorts()),
912  static_cast<FwAssertArgType>(portNum)
913  );
914 
915  return this->m_prmSetOut_OutputPort[portNum].isConnected();
916  }
917 
920  {
921  FW_ASSERT(
922  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
923  static_cast<FwAssertArgType>(portNum)
924  );
925 
926  return this->m_timeCaller_OutputPort[portNum].isConnected();
927  }
928 
931  {
932  FW_ASSERT(
933  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
934  static_cast<FwAssertArgType>(portNum)
935  );
936 
937  return this->m_tlmOut_OutputPort[portNum].isConnected();
938  }
939 
940  // ----------------------------------------------------------------------
941  // Connection status queries for typed output ports
942  // ----------------------------------------------------------------------
943 
946  {
947  FW_ASSERT(
948  (0 <= portNum) && (portNum < this->getNum_readDoneOut_OutputPorts()),
949  static_cast<FwAssertArgType>(portNum)
950  );
951 
952  return this->m_readDoneOut_OutputPort[portNum].isConnected();
953  }
954 
957  {
958  FW_ASSERT(
959  (0 <= portNum) && (portNum < this->getNum_verifyDoneOut_OutputPorts()),
960  static_cast<FwAssertArgType>(portNum)
961  );
962 
963  return this->m_verifyDoneOut_OutputPort[portNum].isConnected();
964  }
965 
968  {
969  FW_ASSERT(
970  (0 <= portNum) && (portNum < this->getNum_writeDoneOut_OutputPorts()),
971  static_cast<FwAssertArgType>(portNum)
972  );
973 
974  return this->m_writeDoneOut_OutputPort[portNum].isConnected();
975  }
976 
977  // ----------------------------------------------------------------------
978  // Port handler base-class functions for typed input ports
979  //
980  // Call these functions directly to bypass the corresponding ports
981  // ----------------------------------------------------------------------
982 
985  {
986  // Make sure port number is valid
987  FW_ASSERT(
988  (0 <= portNum) && (portNum < this->getNum_cancelIn_InputPorts()),
989  static_cast<FwAssertArgType>(portNum)
990  );
991 
992  // Lock guard mutex before calling
993  this->lock();
994 
995  // Call handler function
996  this->cancelIn_handler(portNum);
997 
998  // Unlock guard mutex
999  this->unLock();
1000  }
1001 
1004  FwIndexType portNum,
1005  const Fw::StringBase& path,
1006  Fw::Buffer& buffer
1007  )
1008  {
1009  // Make sure port number is valid
1010  FW_ASSERT(
1011  (0 <= portNum) && (portNum < this->getNum_readIn_InputPorts()),
1012  static_cast<FwAssertArgType>(portNum)
1013  );
1014 
1015  // Call pre-message hook
1017  portNum,
1018  path,
1019  buffer
1020  );
1021  ComponentIpcSerializableBuffer msg;
1023 
1024  // Serialize message ID
1025  _status = msg.serializeFrom(
1026  static_cast<FwEnumStoreType>(READIN_FILEREAD)
1027  );
1028  FW_ASSERT(
1029  _status == Fw::FW_SERIALIZE_OK,
1030  static_cast<FwAssertArgType>(_status)
1031  );
1032 
1033  // Serialize port number
1034  _status = msg.serializeFrom(portNum);
1035  FW_ASSERT(
1036  _status == Fw::FW_SERIALIZE_OK,
1037  static_cast<FwAssertArgType>(_status)
1038  );
1039 
1040  // Serialize argument path
1041  _status = path.serializeTo(msg, 200);
1042  FW_ASSERT(
1043  _status == Fw::FW_SERIALIZE_OK,
1044  static_cast<FwAssertArgType>(_status)
1045  );
1046 
1047  // Serialize argument buffer
1048  _status = msg.serializeFrom(buffer);
1049  FW_ASSERT(
1050  _status == Fw::FW_SERIALIZE_OK,
1051  static_cast<FwAssertArgType>(_status)
1052  );
1053 
1054  // Send message
1056  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1057 
1058  FW_ASSERT(
1059  qStatus == Os::Queue::OP_OK,
1060  static_cast<FwAssertArgType>(qStatus)
1061  );
1062  }
1063 
1066  FwIndexType portNum,
1067  const Fw::StringBase& path,
1068  U32 crc
1069  )
1070  {
1071  // Make sure port number is valid
1072  FW_ASSERT(
1073  (0 <= portNum) && (portNum < this->getNum_verifyIn_InputPorts()),
1074  static_cast<FwAssertArgType>(portNum)
1075  );
1076 
1077  // Call pre-message hook
1079  portNum,
1080  path,
1081  crc
1082  );
1083  ComponentIpcSerializableBuffer msg;
1085 
1086  // Serialize message ID
1087  _status = msg.serializeFrom(
1088  static_cast<FwEnumStoreType>(VERIFYIN_VERIFYSTATUS)
1089  );
1090  FW_ASSERT(
1091  _status == Fw::FW_SERIALIZE_OK,
1092  static_cast<FwAssertArgType>(_status)
1093  );
1094 
1095  // Serialize port number
1096  _status = msg.serializeFrom(portNum);
1097  FW_ASSERT(
1098  _status == Fw::FW_SERIALIZE_OK,
1099  static_cast<FwAssertArgType>(_status)
1100  );
1101 
1102  // Serialize argument path
1103  _status = path.serializeTo(msg, 200);
1104  FW_ASSERT(
1105  _status == Fw::FW_SERIALIZE_OK,
1106  static_cast<FwAssertArgType>(_status)
1107  );
1108 
1109  // Serialize argument crc
1110  _status = msg.serializeFrom(crc);
1111  FW_ASSERT(
1112  _status == Fw::FW_SERIALIZE_OK,
1113  static_cast<FwAssertArgType>(_status)
1114  );
1115 
1116  // Send message
1118  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1119 
1120  FW_ASSERT(
1121  qStatus == Os::Queue::OP_OK,
1122  static_cast<FwAssertArgType>(qStatus)
1123  );
1124  }
1125 
1128  FwIndexType portNum,
1129  const Fw::StringBase& path,
1130  Fw::Buffer& buffer,
1131  FwSizeType offsetBytes,
1132  bool append
1133  )
1134  {
1135  // Make sure port number is valid
1136  FW_ASSERT(
1137  (0 <= portNum) && (portNum < this->getNum_writeIn_InputPorts()),
1138  static_cast<FwAssertArgType>(portNum)
1139  );
1140 
1141  // Call pre-message hook
1143  portNum,
1144  path,
1145  buffer,
1146  offsetBytes,
1147  append
1148  );
1149  ComponentIpcSerializableBuffer msg;
1151 
1152  // Serialize message ID
1153  _status = msg.serializeFrom(
1154  static_cast<FwEnumStoreType>(WRITEIN_FILEWRITE)
1155  );
1156  FW_ASSERT(
1157  _status == Fw::FW_SERIALIZE_OK,
1158  static_cast<FwAssertArgType>(_status)
1159  );
1160 
1161  // Serialize port number
1162  _status = msg.serializeFrom(portNum);
1163  FW_ASSERT(
1164  _status == Fw::FW_SERIALIZE_OK,
1165  static_cast<FwAssertArgType>(_status)
1166  );
1167 
1168  // Serialize argument path
1169  _status = path.serializeTo(msg, 200);
1170  FW_ASSERT(
1171  _status == Fw::FW_SERIALIZE_OK,
1172  static_cast<FwAssertArgType>(_status)
1173  );
1174 
1175  // Serialize argument buffer
1176  _status = msg.serializeFrom(buffer);
1177  FW_ASSERT(
1178  _status == Fw::FW_SERIALIZE_OK,
1179  static_cast<FwAssertArgType>(_status)
1180  );
1181 
1182  // Serialize argument offsetBytes
1183  _status = msg.serializeFrom(offsetBytes);
1184  FW_ASSERT(
1185  _status == Fw::FW_SERIALIZE_OK,
1186  static_cast<FwAssertArgType>(_status)
1187  );
1188 
1189  // Serialize argument append
1190  _status = msg.serializeFrom(append);
1191  FW_ASSERT(
1192  _status == Fw::FW_SERIALIZE_OK,
1193  static_cast<FwAssertArgType>(_status)
1194  );
1195 
1196  // Send message
1198  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1199 
1200  FW_ASSERT(
1201  qStatus == Os::Queue::OP_OK,
1202  static_cast<FwAssertArgType>(qStatus)
1203  );
1204  }
1205 
1206  // ----------------------------------------------------------------------
1207  // Pre-message hooks for typed async input ports
1208  //
1209  // Each of these functions is invoked just before processing a message
1210  // on the corresponding port. By default, they do nothing. You can
1211  // override them to provide specific pre-message behavior.
1212  // ----------------------------------------------------------------------
1213 
1216  FwIndexType portNum,
1217  const Fw::StringBase& path,
1218  Fw::Buffer& buffer
1219  )
1220  {
1221  // Default: no-op
1222  }
1223 
1226  FwIndexType portNum,
1227  const Fw::StringBase& path,
1228  U32 crc
1229  )
1230  {
1231  // Default: no-op
1232  }
1233 
1236  FwIndexType portNum,
1237  const Fw::StringBase& path,
1238  Fw::Buffer& buffer,
1239  FwSizeType offsetBytes,
1240  bool append
1241  )
1242  {
1243  // Default: no-op
1244  }
1245 
1246  // ----------------------------------------------------------------------
1247  // Invocation functions for typed output ports
1248  // ----------------------------------------------------------------------
1249 
1252  FwIndexType portNum,
1253  U32 status,
1254  FwSizeType sizeBytes
1255  )
1256  {
1257  FW_ASSERT(
1258  (0 <= portNum) && (portNum < this->getNum_readDoneOut_OutputPorts()),
1259  static_cast<FwAssertArgType>(portNum)
1260  );
1261 
1262  FW_ASSERT(
1263  this->m_readDoneOut_OutputPort[portNum].isConnected(),
1264  static_cast<FwAssertArgType>(portNum)
1265  );
1266  this->m_readDoneOut_OutputPort[portNum].invoke(
1267  status,
1268  sizeBytes
1269  );
1270  }
1271 
1274  FwIndexType portNum,
1275  U32 status,
1276  FwSizeType sizeBytes
1277  )
1278  {
1279  FW_ASSERT(
1280  (0 <= portNum) && (portNum < this->getNum_verifyDoneOut_OutputPorts()),
1281  static_cast<FwAssertArgType>(portNum)
1282  );
1283 
1284  FW_ASSERT(
1285  this->m_verifyDoneOut_OutputPort[portNum].isConnected(),
1286  static_cast<FwAssertArgType>(portNum)
1287  );
1288  this->m_verifyDoneOut_OutputPort[portNum].invoke(
1289  status,
1290  sizeBytes
1291  );
1292  }
1293 
1296  FwIndexType portNum,
1297  U32 status,
1298  FwSizeType sizeBytes
1299  )
1300  {
1301  FW_ASSERT(
1302  (0 <= portNum) && (portNum < this->getNum_writeDoneOut_OutputPorts()),
1303  static_cast<FwAssertArgType>(portNum)
1304  );
1305 
1306  FW_ASSERT(
1307  this->m_writeDoneOut_OutputPort[portNum].isConnected(),
1308  static_cast<FwAssertArgType>(portNum)
1309  );
1310  this->m_writeDoneOut_OutputPort[portNum].invoke(
1311  status,
1312  sizeBytes
1313  );
1314  }
1315 
1316  // ----------------------------------------------------------------------
1317  // Event logging functions
1318  // ----------------------------------------------------------------------
1319 
1322  {
1323  // Get the time
1324  Fw::Time _logTime;
1325  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1326  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1327  }
1328 
1329  FwEventIdType _id = static_cast<FwEventIdType>(0);
1330 
1331  _id = this->getIdBase() + EVENTID_NOTINIDLE;
1332 
1333  // Check throttle value & throttle timeout
1334  {
1335  Os::ScopeLock scopedLock(this->m_eventLock);
1336 
1337  if (this->m_NotInIdleThrottle >= EVENTID_NOTINIDLE_THROTTLE) {
1338  // The counter has overflowed, check if time interval has passed
1339  if (Fw::TimeInterval(this->m_NotInIdleThrottleTime, _logTime) >= Fw::TimeInterval(10, 0)) {
1340  // Reset the count
1341  this->m_NotInIdleThrottle = 0;
1342  } else {
1343  // Throttle the event
1344  return;
1345  }
1346  }
1347 
1348  // Reset the throttle time if needed
1349  if (this->m_NotInIdleThrottle == 0) {
1350  // This is the first event, reset the throttle time
1351  this->m_NotInIdleThrottleTime = _logTime;
1352  }
1353 
1354  // Increment the count
1355  this->m_NotInIdleThrottle++;
1356  }
1357 
1358  // Emit the event on the log port
1359  if (this->m_logOut_OutputPort[0].isConnected()) {
1360  Fw::LogBuffer _logBuff;
1362 
1363 #if FW_AMPCS_COMPATIBLE
1364  // Serialize the number of arguments
1365  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1366  FW_ASSERT(
1367  _status == Fw::FW_SERIALIZE_OK,
1368  static_cast<FwAssertArgType>(_status)
1369  );
1370 #endif
1371 
1372 #if FW_AMPCS_COMPATIBLE
1373  // Serialize the argument size
1374  _status = _logBuff.serializeFrom(
1375  static_cast<U8>(sizeof(U32))
1376  );
1377  FW_ASSERT(
1378  _status == Fw::FW_SERIALIZE_OK,
1379  static_cast<FwAssertArgType>(_status)
1380  );
1381 #endif
1382  _status = _logBuff.serializeFrom(currState);
1383  FW_ASSERT(
1384  _status == Fw::FW_SERIALIZE_OK,
1385  static_cast<FwAssertArgType>(_status)
1386  );
1387 
1388  this->m_logOut_OutputPort[0].invoke(
1389  _id,
1390  _logTime,
1392  _logBuff
1393  );
1394  }
1395 
1396  // Emit the event on the text log port
1397 #if FW_ENABLE_TEXT_LOGGING
1398  if (this->m_logTextOut_OutputPort[0].isConnected()) {
1399 #if FW_OBJECT_NAMES == 1
1400  const char* _formatString =
1401  "(%s) %s: Not in IDLE state, currently in state: %" PRIu32 "";
1402 #else
1403  const char* _formatString =
1404  "%s: Not in IDLE state, currently in state: %" PRIu32 "";
1405 #endif
1406 
1407  Fw::TextLogString _logString;
1408  _logString.format(
1409  _formatString,
1410 #if FW_OBJECT_NAMES == 1
1411  this->m_objName.toChar(),
1412 #endif
1413  "NotInIdle ",
1414  currState
1415  );
1416 
1417  this->m_logTextOut_OutputPort[0].invoke(
1418  _id,
1419  _logTime,
1421  _logString
1422  );
1423  }
1424 #endif
1425  }
1426 
1429  {
1430  // Get the time
1431  Fw::Time _logTime;
1432  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1433  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1434  }
1435 
1436  FwEventIdType _id = static_cast<FwEventIdType>(0);
1437 
1438  _id = this->getIdBase() + EVENTID_CRCFAILED;
1439 
1440  // Check throttle value & throttle timeout
1441  {
1442  Os::ScopeLock scopedLock(this->m_eventLock);
1443 
1444  if (this->m_CrcFailedThrottle >= EVENTID_CRCFAILED_THROTTLE) {
1445  // The counter has overflowed, check if time interval has passed
1446  if (Fw::TimeInterval(this->m_CrcFailedThrottleTime, _logTime) >= Fw::TimeInterval(10, 0)) {
1447  // Reset the count
1448  this->m_CrcFailedThrottle = 0;
1449  } else {
1450  // Throttle the event
1451  return;
1452  }
1453  }
1454 
1455  // Reset the throttle time if needed
1456  if (this->m_CrcFailedThrottle == 0) {
1457  // This is the first event, reset the throttle time
1458  this->m_CrcFailedThrottleTime = _logTime;
1459  }
1460 
1461  // Increment the count
1462  this->m_CrcFailedThrottle++;
1463  }
1464 
1465  // Emit the event on the log port
1466  if (this->m_logOut_OutputPort[0].isConnected()) {
1467  Fw::LogBuffer _logBuff;
1469 
1470 #if FW_AMPCS_COMPATIBLE
1471  // Serialize the number of arguments
1472  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1473  FW_ASSERT(
1474  _status == Fw::FW_SERIALIZE_OK,
1475  static_cast<FwAssertArgType>(_status)
1476  );
1477 #endif
1478 
1479 #if FW_AMPCS_COMPATIBLE
1480  // Serialize the argument size
1481  _status = _logBuff.serializeFrom(
1482  static_cast<U8>(sizeof(U32))
1483  );
1484  FW_ASSERT(
1485  _status == Fw::FW_SERIALIZE_OK,
1486  static_cast<FwAssertArgType>(_status)
1487  );
1488 #endif
1489  _status = _logBuff.serializeFrom(crcStat);
1490  FW_ASSERT(
1491  _status == Fw::FW_SERIALIZE_OK,
1492  static_cast<FwAssertArgType>(_status)
1493  );
1494 
1495  this->m_logOut_OutputPort[0].invoke(
1496  _id,
1497  _logTime,
1499  _logBuff
1500  );
1501  }
1502 
1503  // Emit the event on the text log port
1504 #if FW_ENABLE_TEXT_LOGGING
1505  if (this->m_logTextOut_OutputPort[0].isConnected()) {
1506 #if FW_OBJECT_NAMES == 1
1507  const char* _formatString =
1508  "(%s) %s: Failed CRC check with %" PRIu32 " status";
1509 #else
1510  const char* _formatString =
1511  "%s: Failed CRC check with %" PRIu32 " status";
1512 #endif
1513 
1514  Fw::TextLogString _logString;
1515  _logString.format(
1516  _formatString,
1517 #if FW_OBJECT_NAMES == 1
1518  this->m_objName.toChar(),
1519 #endif
1520  "CrcFailed ",
1521  crcStat
1522  );
1523 
1524  this->m_logTextOut_OutputPort[0].invoke(
1525  _id,
1526  _logTime,
1528  _logString
1529  );
1530  }
1531 #endif
1532  }
1533 
1536  U32 crcExp,
1537  U32 crcCalculated
1538  ) const
1539  {
1540  // Get the time
1541  Fw::Time _logTime;
1542  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1543  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1544  }
1545 
1546  FwEventIdType _id = static_cast<FwEventIdType>(0);
1547 
1548  _id = this->getIdBase() + EVENTID_CRCVERIFICATIONERROR;
1549 
1550  // Emit the event on the log port
1551  if (this->m_logOut_OutputPort[0].isConnected()) {
1552  Fw::LogBuffer _logBuff;
1554 
1555 #if FW_AMPCS_COMPATIBLE
1556  // Serialize the number of arguments
1557  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1558  FW_ASSERT(
1559  _status == Fw::FW_SERIALIZE_OK,
1560  static_cast<FwAssertArgType>(_status)
1561  );
1562 #endif
1563 
1564 #if FW_AMPCS_COMPATIBLE
1565  // Serialize the argument size
1566  _status = _logBuff.serializeFrom(
1567  static_cast<U8>(sizeof(U32))
1568  );
1569  FW_ASSERT(
1570  _status == Fw::FW_SERIALIZE_OK,
1571  static_cast<FwAssertArgType>(_status)
1572  );
1573 #endif
1574  _status = _logBuff.serializeFrom(crcExp);
1575  FW_ASSERT(
1576  _status == Fw::FW_SERIALIZE_OK,
1577  static_cast<FwAssertArgType>(_status)
1578  );
1579 
1580 #if FW_AMPCS_COMPATIBLE
1581  // Serialize the argument size
1582  _status = _logBuff.serializeFrom(
1583  static_cast<U8>(sizeof(U32))
1584  );
1585  FW_ASSERT(
1586  _status == Fw::FW_SERIALIZE_OK,
1587  static_cast<FwAssertArgType>(_status)
1588  );
1589 #endif
1590  _status = _logBuff.serializeFrom(crcCalculated);
1591  FW_ASSERT(
1592  _status == Fw::FW_SERIALIZE_OK,
1593  static_cast<FwAssertArgType>(_status)
1594  );
1595 
1596  this->m_logOut_OutputPort[0].invoke(
1597  _id,
1598  _logTime,
1600  _logBuff
1601  );
1602  }
1603 
1604  // Emit the event on the text log port
1605 #if FW_ENABLE_TEXT_LOGGING
1606  if (this->m_logTextOut_OutputPort[0].isConnected()) {
1607 #if FW_OBJECT_NAMES == 1
1608  const char* _formatString =
1609  "(%s) %s: Failed to verify file. Expected CRC %" PRIu32 ". Actual CRC %" PRIu32 "";
1610 #else
1611  const char* _formatString =
1612  "%s: Failed to verify file. Expected CRC %" PRIu32 ". Actual CRC %" PRIu32 "";
1613 #endif
1614 
1615  Fw::TextLogString _logString;
1616  _logString.format(
1617  _formatString,
1618 #if FW_OBJECT_NAMES == 1
1619  this->m_objName.toChar(),
1620 #endif
1621  "CrcVerificationError ",
1622  crcExp,
1623  crcCalculated
1624  );
1625 
1626  this->m_logTextOut_OutputPort[0].invoke(
1627  _id,
1628  _logTime,
1630  _logString
1631  );
1632  }
1633 #endif
1634  }
1635 
1638  {
1639  // Get the time
1640  Fw::Time _logTime;
1641  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1642  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1643  }
1644 
1645  FwEventIdType _id = static_cast<FwEventIdType>(0);
1646 
1647  _id = this->getIdBase() + EVENTID_READFAILEDFILESIZE;
1648 
1649  // Check throttle value & throttle timeout
1650  {
1651  Os::ScopeLock scopedLock(this->m_eventLock);
1652 
1653  if (this->m_ReadFailedFileSizeThrottle >= EVENTID_READFAILEDFILESIZE_THROTTLE) {
1654  // The counter has overflowed, check if time interval has passed
1655  if (Fw::TimeInterval(this->m_ReadFailedFileSizeThrottleTime, _logTime) >= Fw::TimeInterval(10, 0)) {
1656  // Reset the count
1657  this->m_ReadFailedFileSizeThrottle = 0;
1658  } else {
1659  // Throttle the event
1660  return;
1661  }
1662  }
1663 
1664  // Reset the throttle time if needed
1665  if (this->m_ReadFailedFileSizeThrottle == 0) {
1666  // This is the first event, reset the throttle time
1667  this->m_ReadFailedFileSizeThrottleTime = _logTime;
1668  }
1669 
1670  // Increment the count
1671  this->m_ReadFailedFileSizeThrottle++;
1672  }
1673 
1674  // Emit the event on the log port
1675  if (this->m_logOut_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>(1));
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(fsStat);
1699  FW_ASSERT(
1700  _status == Fw::FW_SERIALIZE_OK,
1701  static_cast<FwAssertArgType>(_status)
1702  );
1703 
1704  this->m_logOut_OutputPort[0].invoke(
1705  _id,
1706  _logTime,
1708  _logBuff
1709  );
1710  }
1711 
1712  // Emit the event on the text log port
1713 #if FW_ENABLE_TEXT_LOGGING
1714  if (this->m_logTextOut_OutputPort[0].isConnected()) {
1715 #if FW_OBJECT_NAMES == 1
1716  const char* _formatString =
1717  "(%s) %s: Failed to get filesize with stat %" PRIu32 " in read handler";
1718 #else
1719  const char* _formatString =
1720  "%s: Failed to get filesize with stat %" PRIu32 " in read handler";
1721 #endif
1722 
1723  Fw::TextLogString _logString;
1724  _logString.format(
1725  _formatString,
1726 #if FW_OBJECT_NAMES == 1
1727  this->m_objName.toChar(),
1728 #endif
1729  "ReadFailedFileSize ",
1730  fsStat
1731  );
1732 
1733  this->m_logTextOut_OutputPort[0].invoke(
1734  _id,
1735  _logTime,
1737  _logString
1738  );
1739  }
1740 #endif
1741  }
1742 
1745  const Fw::StringBase& fileName,
1746  U32 fsStat
1747  )
1748  {
1749  // Get the time
1750  Fw::Time _logTime;
1751  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1752  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1753  }
1754 
1755  FwEventIdType _id = static_cast<FwEventIdType>(0);
1756 
1757  _id = this->getIdBase() + EVENTID_OPENFILEERROR;
1758 
1759  // Check throttle value & throttle timeout
1760  {
1761  Os::ScopeLock scopedLock(this->m_eventLock);
1762 
1763  if (this->m_OpenFileErrorThrottle >= EVENTID_OPENFILEERROR_THROTTLE) {
1764  // The counter has overflowed, check if time interval has passed
1765  if (Fw::TimeInterval(this->m_OpenFileErrorThrottleTime, _logTime) >= Fw::TimeInterval(10, 0)) {
1766  // Reset the count
1767  this->m_OpenFileErrorThrottle = 0;
1768  } else {
1769  // Throttle the event
1770  return;
1771  }
1772  }
1773 
1774  // Reset the throttle time if needed
1775  if (this->m_OpenFileErrorThrottle == 0) {
1776  // This is the first event, reset the throttle time
1777  this->m_OpenFileErrorThrottleTime = _logTime;
1778  }
1779 
1780  // Increment the count
1781  this->m_OpenFileErrorThrottle++;
1782  }
1783 
1784  // Emit the event on the log port
1785  if (this->m_logOut_OutputPort[0].isConnected()) {
1786  Fw::LogBuffer _logBuff;
1788 
1789 #if FW_AMPCS_COMPATIBLE
1790  // Serialize the number of arguments
1791  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1792  FW_ASSERT(
1793  _status == Fw::FW_SERIALIZE_OK,
1794  static_cast<FwAssertArgType>(_status)
1795  );
1796 #endif
1797 
1798  _status = fileName.serializeTo(_logBuff, FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 200));
1799  FW_ASSERT(
1800  _status == Fw::FW_SERIALIZE_OK,
1801  static_cast<FwAssertArgType>(_status)
1802  );
1803 
1804 #if FW_AMPCS_COMPATIBLE
1805  // Serialize the argument size
1806  _status = _logBuff.serializeFrom(
1807  static_cast<U8>(sizeof(U32))
1808  );
1809  FW_ASSERT(
1810  _status == Fw::FW_SERIALIZE_OK,
1811  static_cast<FwAssertArgType>(_status)
1812  );
1813 #endif
1814  _status = _logBuff.serializeFrom(fsStat);
1815  FW_ASSERT(
1816  _status == Fw::FW_SERIALIZE_OK,
1817  static_cast<FwAssertArgType>(_status)
1818  );
1819 
1820  this->m_logOut_OutputPort[0].invoke(
1821  _id,
1822  _logTime,
1824  _logBuff
1825  );
1826  }
1827 
1828  // Emit the event on the text log port
1829 #if FW_ENABLE_TEXT_LOGGING
1830  if (this->m_logTextOut_OutputPort[0].isConnected()) {
1831 #if FW_OBJECT_NAMES == 1
1832  const char* _formatString =
1833  "(%s) %s: Failed to open file %s with stat %" PRIu32 "";
1834 #else
1835  const char* _formatString =
1836  "%s: Failed to open file %s with stat %" PRIu32 "";
1837 #endif
1838 
1839  Fw::TextLogString _logString;
1840  _logString.format(
1841  _formatString,
1842 #if FW_OBJECT_NAMES == 1
1843  this->m_objName.toChar(),
1844 #endif
1845  "OpenFileError ",
1846  fileName.toChar(),
1847  fsStat
1848  );
1849 
1850  this->m_logTextOut_OutputPort[0].invoke(
1851  _id,
1852  _logTime,
1854  _logString
1855  );
1856  }
1857 #endif
1858  }
1859 
1862  FwSizeType fileSize,
1863  const Fw::StringBase& fileName
1864  ) const
1865  {
1866  // Get the time
1867  Fw::Time _logTime;
1868  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1869  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1870  }
1871 
1872  FwEventIdType _id = static_cast<FwEventIdType>(0);
1873 
1874  _id = this->getIdBase() + EVENTID_READBEGIN;
1875 
1876  // Emit the event on the log port
1877  if (this->m_logOut_OutputPort[0].isConnected()) {
1878  Fw::LogBuffer _logBuff;
1880 
1881 #if FW_AMPCS_COMPATIBLE
1882  // Serialize the number of arguments
1883  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1884  FW_ASSERT(
1885  _status == Fw::FW_SERIALIZE_OK,
1886  static_cast<FwAssertArgType>(_status)
1887  );
1888 #endif
1889 
1890 #if FW_AMPCS_COMPATIBLE
1891  // Serialize the argument size
1892  _status = _logBuff.serializeFrom(
1893  static_cast<U8>(sizeof(FwSizeType))
1894  );
1895  FW_ASSERT(
1896  _status == Fw::FW_SERIALIZE_OK,
1897  static_cast<FwAssertArgType>(_status)
1898  );
1899 #endif
1900  _status = _logBuff.serializeFrom(fileSize);
1901  FW_ASSERT(
1902  _status == Fw::FW_SERIALIZE_OK,
1903  static_cast<FwAssertArgType>(_status)
1904  );
1905 
1906  _status = fileName.serializeTo(_logBuff, FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 200));
1907  FW_ASSERT(
1908  _status == Fw::FW_SERIALIZE_OK,
1909  static_cast<FwAssertArgType>(_status)
1910  );
1911 
1912  this->m_logOut_OutputPort[0].invoke(
1913  _id,
1914  _logTime,
1916  _logBuff
1917  );
1918  }
1919 
1920  // Emit the event on the text log port
1921 #if FW_ENABLE_TEXT_LOGGING
1922  if (this->m_logTextOut_OutputPort[0].isConnected()) {
1923 #if FW_OBJECT_NAMES == 1
1924  const char* _formatString =
1925  "(%s) %s: Reading %" PRIu64 " bytes from %s";
1926 #else
1927  const char* _formatString =
1928  "%s: Reading %" PRIu64 " bytes from %s";
1929 #endif
1930 
1931  Fw::TextLogString _logString;
1932  _logString.format(
1933  _formatString,
1934 #if FW_OBJECT_NAMES == 1
1935  this->m_objName.toChar(),
1936 #endif
1937  "ReadBegin ",
1938  fileSize,
1939  fileName.toChar()
1940  );
1941 
1942  this->m_logTextOut_OutputPort[0].invoke(
1943  _id,
1944  _logTime,
1946  _logString
1947  );
1948  }
1949 #endif
1950  }
1951 
1954  FwSizeType fileSize,
1955  const Fw::StringBase& fileName
1956  ) const
1957  {
1958  // Get the time
1959  Fw::Time _logTime;
1960  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1961  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1962  }
1963 
1964  FwEventIdType _id = static_cast<FwEventIdType>(0);
1965 
1966  _id = this->getIdBase() + EVENTID_READCOMPLETED;
1967 
1968  // Emit the event on the log port
1969  if (this->m_logOut_OutputPort[0].isConnected()) {
1970  Fw::LogBuffer _logBuff;
1972 
1973 #if FW_AMPCS_COMPATIBLE
1974  // Serialize the number of arguments
1975  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1976  FW_ASSERT(
1977  _status == Fw::FW_SERIALIZE_OK,
1978  static_cast<FwAssertArgType>(_status)
1979  );
1980 #endif
1981 
1982 #if FW_AMPCS_COMPATIBLE
1983  // Serialize the argument size
1984  _status = _logBuff.serializeFrom(
1985  static_cast<U8>(sizeof(FwSizeType))
1986  );
1987  FW_ASSERT(
1988  _status == Fw::FW_SERIALIZE_OK,
1989  static_cast<FwAssertArgType>(_status)
1990  );
1991 #endif
1992  _status = _logBuff.serializeFrom(fileSize);
1993  FW_ASSERT(
1994  _status == Fw::FW_SERIALIZE_OK,
1995  static_cast<FwAssertArgType>(_status)
1996  );
1997 
1998  _status = fileName.serializeTo(_logBuff, FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 200));
1999  FW_ASSERT(
2000  _status == Fw::FW_SERIALIZE_OK,
2001  static_cast<FwAssertArgType>(_status)
2002  );
2003 
2004  this->m_logOut_OutputPort[0].invoke(
2005  _id,
2006  _logTime,
2008  _logBuff
2009  );
2010  }
2011 
2012  // Emit the event on the text log port
2013 #if FW_ENABLE_TEXT_LOGGING
2014  if (this->m_logTextOut_OutputPort[0].isConnected()) {
2015 #if FW_OBJECT_NAMES == 1
2016  const char* _formatString =
2017  "(%s) %s: Finished reading %" PRIu64 " bytes from %s";
2018 #else
2019  const char* _formatString =
2020  "%s: Finished reading %" PRIu64 " bytes from %s";
2021 #endif
2022 
2023  Fw::TextLogString _logString;
2024  _logString.format(
2025  _formatString,
2026 #if FW_OBJECT_NAMES == 1
2027  this->m_objName.toChar(),
2028 #endif
2029  "ReadCompleted ",
2030  fileSize,
2031  fileName.toChar()
2032  );
2033 
2034  this->m_logTextOut_OutputPort[0].invoke(
2035  _id,
2036  _logTime,
2038  _logString
2039  );
2040  }
2041 #endif
2042  }
2043 
2046  FwSizeType bytesRead,
2047  FwSizeType readSize,
2048  const Fw::StringBase& fileName
2049  ) const
2050  {
2051  // Get the time
2052  Fw::Time _logTime;
2053  if (this->m_timeCaller_OutputPort[0].isConnected()) {
2054  this->m_timeCaller_OutputPort[0].invoke(_logTime);
2055  }
2056 
2057  FwEventIdType _id = static_cast<FwEventIdType>(0);
2058 
2059  _id = this->getIdBase() + EVENTID_READERROR;
2060 
2061  // Emit the event on the log port
2062  if (this->m_logOut_OutputPort[0].isConnected()) {
2063  Fw::LogBuffer _logBuff;
2065 
2066 #if FW_AMPCS_COMPATIBLE
2067  // Serialize the number of arguments
2068  _status = _logBuff.serializeFrom(static_cast<U8>(3));
2069  FW_ASSERT(
2070  _status == Fw::FW_SERIALIZE_OK,
2071  static_cast<FwAssertArgType>(_status)
2072  );
2073 #endif
2074 
2075 #if FW_AMPCS_COMPATIBLE
2076  // Serialize the argument size
2077  _status = _logBuff.serializeFrom(
2078  static_cast<U8>(sizeof(FwSizeType))
2079  );
2080  FW_ASSERT(
2081  _status == Fw::FW_SERIALIZE_OK,
2082  static_cast<FwAssertArgType>(_status)
2083  );
2084 #endif
2085  _status = _logBuff.serializeFrom(bytesRead);
2086  FW_ASSERT(
2087  _status == Fw::FW_SERIALIZE_OK,
2088  static_cast<FwAssertArgType>(_status)
2089  );
2090 
2091 #if FW_AMPCS_COMPATIBLE
2092  // Serialize the argument size
2093  _status = _logBuff.serializeFrom(
2094  static_cast<U8>(sizeof(FwSizeType))
2095  );
2096  FW_ASSERT(
2097  _status == Fw::FW_SERIALIZE_OK,
2098  static_cast<FwAssertArgType>(_status)
2099  );
2100 #endif
2101  _status = _logBuff.serializeFrom(readSize);
2102  FW_ASSERT(
2103  _status == Fw::FW_SERIALIZE_OK,
2104  static_cast<FwAssertArgType>(_status)
2105  );
2106 
2107  _status = fileName.serializeTo(_logBuff, FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 200));
2108  FW_ASSERT(
2109  _status == Fw::FW_SERIALIZE_OK,
2110  static_cast<FwAssertArgType>(_status)
2111  );
2112 
2113  this->m_logOut_OutputPort[0].invoke(
2114  _id,
2115  _logTime,
2117  _logBuff
2118  );
2119  }
2120 
2121  // Emit the event on the text log port
2122 #if FW_ENABLE_TEXT_LOGGING
2123  if (this->m_logTextOut_OutputPort[0].isConnected()) {
2124 #if FW_OBJECT_NAMES == 1
2125  const char* _formatString =
2126  "(%s) %s: Failed after %" PRIu64 " of %" PRIu64 " bytes read to %s";
2127 #else
2128  const char* _formatString =
2129  "%s: Failed after %" PRIu64 " of %" PRIu64 " bytes read to %s";
2130 #endif
2131 
2132  Fw::TextLogString _logString;
2133  _logString.format(
2134  _formatString,
2135 #if FW_OBJECT_NAMES == 1
2136  this->m_objName.toChar(),
2137 #endif
2138  "ReadError ",
2139  bytesRead,
2140  readSize,
2141  fileName.toChar()
2142  );
2143 
2144  this->m_logTextOut_OutputPort[0].invoke(
2145  _id,
2146  _logTime,
2148  _logString
2149  );
2150  }
2151 #endif
2152  }
2153 
2156  FwSizeType bytesRead,
2157  FwSizeType readSize,
2158  const Fw::StringBase& fileName
2159  ) const
2160  {
2161  // Get the time
2162  Fw::Time _logTime;
2163  if (this->m_timeCaller_OutputPort[0].isConnected()) {
2164  this->m_timeCaller_OutputPort[0].invoke(_logTime);
2165  }
2166 
2167  FwEventIdType _id = static_cast<FwEventIdType>(0);
2168 
2169  _id = this->getIdBase() + EVENTID_READABORTED;
2170 
2171  // Emit the event on the log port
2172  if (this->m_logOut_OutputPort[0].isConnected()) {
2173  Fw::LogBuffer _logBuff;
2175 
2176 #if FW_AMPCS_COMPATIBLE
2177  // Serialize the number of arguments
2178  _status = _logBuff.serializeFrom(static_cast<U8>(3));
2179  FW_ASSERT(
2180  _status == Fw::FW_SERIALIZE_OK,
2181  static_cast<FwAssertArgType>(_status)
2182  );
2183 #endif
2184 
2185 #if FW_AMPCS_COMPATIBLE
2186  // Serialize the argument size
2187  _status = _logBuff.serializeFrom(
2188  static_cast<U8>(sizeof(FwSizeType))
2189  );
2190  FW_ASSERT(
2191  _status == Fw::FW_SERIALIZE_OK,
2192  static_cast<FwAssertArgType>(_status)
2193  );
2194 #endif
2195  _status = _logBuff.serializeFrom(bytesRead);
2196  FW_ASSERT(
2197  _status == Fw::FW_SERIALIZE_OK,
2198  static_cast<FwAssertArgType>(_status)
2199  );
2200 
2201 #if FW_AMPCS_COMPATIBLE
2202  // Serialize the argument size
2203  _status = _logBuff.serializeFrom(
2204  static_cast<U8>(sizeof(FwSizeType))
2205  );
2206  FW_ASSERT(
2207  _status == Fw::FW_SERIALIZE_OK,
2208  static_cast<FwAssertArgType>(_status)
2209  );
2210 #endif
2211  _status = _logBuff.serializeFrom(readSize);
2212  FW_ASSERT(
2213  _status == Fw::FW_SERIALIZE_OK,
2214  static_cast<FwAssertArgType>(_status)
2215  );
2216 
2217  _status = fileName.serializeTo(_logBuff, FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 200));
2218  FW_ASSERT(
2219  _status == Fw::FW_SERIALIZE_OK,
2220  static_cast<FwAssertArgType>(_status)
2221  );
2222 
2223  this->m_logOut_OutputPort[0].invoke(
2224  _id,
2225  _logTime,
2227  _logBuff
2228  );
2229  }
2230 
2231  // Emit the event on the text log port
2232 #if FW_ENABLE_TEXT_LOGGING
2233  if (this->m_logTextOut_OutputPort[0].isConnected()) {
2234 #if FW_OBJECT_NAMES == 1
2235  const char* _formatString =
2236  "(%s) %s: Aborted after %" PRIu64 " of %" PRIu64 " bytes read to %s";
2237 #else
2238  const char* _formatString =
2239  "%s: Aborted after %" PRIu64 " of %" PRIu64 " bytes read to %s";
2240 #endif
2241 
2242  Fw::TextLogString _logString;
2243  _logString.format(
2244  _formatString,
2245 #if FW_OBJECT_NAMES == 1
2246  this->m_objName.toChar(),
2247 #endif
2248  "ReadAborted ",
2249  bytesRead,
2250  readSize,
2251  fileName.toChar()
2252  );
2253 
2254  this->m_logTextOut_OutputPort[0].invoke(
2255  _id,
2256  _logTime,
2258  _logString
2259  );
2260  }
2261 #endif
2262  }
2263 
2266  FwSizeType bytesRead,
2267  FwSizeType readSize,
2268  const Fw::StringBase& fileName,
2269  U64 timeout
2270  ) const
2271  {
2272  // Get the time
2273  Fw::Time _logTime;
2274  if (this->m_timeCaller_OutputPort[0].isConnected()) {
2275  this->m_timeCaller_OutputPort[0].invoke(_logTime);
2276  }
2277 
2278  FwEventIdType _id = static_cast<FwEventIdType>(0);
2279 
2280  _id = this->getIdBase() + EVENTID_READTIMEOUT;
2281 
2282  // Emit the event on the log port
2283  if (this->m_logOut_OutputPort[0].isConnected()) {
2284  Fw::LogBuffer _logBuff;
2286 
2287 #if FW_AMPCS_COMPATIBLE
2288  // Serialize the number of arguments
2289  _status = _logBuff.serializeFrom(static_cast<U8>(4));
2290  FW_ASSERT(
2291  _status == Fw::FW_SERIALIZE_OK,
2292  static_cast<FwAssertArgType>(_status)
2293  );
2294 #endif
2295 
2296 #if FW_AMPCS_COMPATIBLE
2297  // Serialize the argument size
2298  _status = _logBuff.serializeFrom(
2299  static_cast<U8>(sizeof(FwSizeType))
2300  );
2301  FW_ASSERT(
2302  _status == Fw::FW_SERIALIZE_OK,
2303  static_cast<FwAssertArgType>(_status)
2304  );
2305 #endif
2306  _status = _logBuff.serializeFrom(bytesRead);
2307  FW_ASSERT(
2308  _status == Fw::FW_SERIALIZE_OK,
2309  static_cast<FwAssertArgType>(_status)
2310  );
2311 
2312 #if FW_AMPCS_COMPATIBLE
2313  // Serialize the argument size
2314  _status = _logBuff.serializeFrom(
2315  static_cast<U8>(sizeof(FwSizeType))
2316  );
2317  FW_ASSERT(
2318  _status == Fw::FW_SERIALIZE_OK,
2319  static_cast<FwAssertArgType>(_status)
2320  );
2321 #endif
2322  _status = _logBuff.serializeFrom(readSize);
2323  FW_ASSERT(
2324  _status == Fw::FW_SERIALIZE_OK,
2325  static_cast<FwAssertArgType>(_status)
2326  );
2327 
2328  _status = fileName.serializeTo(_logBuff, FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 200));
2329  FW_ASSERT(
2330  _status == Fw::FW_SERIALIZE_OK,
2331  static_cast<FwAssertArgType>(_status)
2332  );
2333 
2334 #if FW_AMPCS_COMPATIBLE
2335  // Serialize the argument size
2336  _status = _logBuff.serializeFrom(
2337  static_cast<U8>(sizeof(U64))
2338  );
2339  FW_ASSERT(
2340  _status == Fw::FW_SERIALIZE_OK,
2341  static_cast<FwAssertArgType>(_status)
2342  );
2343 #endif
2344  _status = _logBuff.serializeFrom(timeout);
2345  FW_ASSERT(
2346  _status == Fw::FW_SERIALIZE_OK,
2347  static_cast<FwAssertArgType>(_status)
2348  );
2349 
2350  this->m_logOut_OutputPort[0].invoke(
2351  _id,
2352  _logTime,
2354  _logBuff
2355  );
2356  }
2357 
2358  // Emit the event on the text log port
2359 #if FW_ENABLE_TEXT_LOGGING
2360  if (this->m_logTextOut_OutputPort[0].isConnected()) {
2361 #if FW_OBJECT_NAMES == 1
2362  const char* _formatString =
2363  "(%s) %s: Failed after %" PRIu64 " of %" PRIu64 " bytes read to %s after exceeding timeout of %" PRIu64 " microseconds";
2364 #else
2365  const char* _formatString =
2366  "%s: Failed after %" PRIu64 " of %" PRIu64 " bytes read to %s after exceeding timeout of %" PRIu64 " microseconds";
2367 #endif
2368 
2369  Fw::TextLogString _logString;
2370  _logString.format(
2371  _formatString,
2372 #if FW_OBJECT_NAMES == 1
2373  this->m_objName.toChar(),
2374 #endif
2375  "ReadTimeout ",
2376  bytesRead,
2377  readSize,
2378  fileName.toChar(),
2379  timeout
2380  );
2381 
2382  this->m_logTextOut_OutputPort[0].invoke(
2383  _id,
2384  _logTime,
2386  _logString
2387  );
2388  }
2389 #endif
2390  }
2391 
2394  FwSizeType writeSize,
2395  const Fw::StringBase& fileName
2396  ) const
2397  {
2398  // Get the time
2399  Fw::Time _logTime;
2400  if (this->m_timeCaller_OutputPort[0].isConnected()) {
2401  this->m_timeCaller_OutputPort[0].invoke(_logTime);
2402  }
2403 
2404  FwEventIdType _id = static_cast<FwEventIdType>(0);
2405 
2406  _id = this->getIdBase() + EVENTID_WRITEBEGIN;
2407 
2408  // Emit the event on the log port
2409  if (this->m_logOut_OutputPort[0].isConnected()) {
2410  Fw::LogBuffer _logBuff;
2412 
2413 #if FW_AMPCS_COMPATIBLE
2414  // Serialize the number of arguments
2415  _status = _logBuff.serializeFrom(static_cast<U8>(2));
2416  FW_ASSERT(
2417  _status == Fw::FW_SERIALIZE_OK,
2418  static_cast<FwAssertArgType>(_status)
2419  );
2420 #endif
2421 
2422 #if FW_AMPCS_COMPATIBLE
2423  // Serialize the argument size
2424  _status = _logBuff.serializeFrom(
2425  static_cast<U8>(sizeof(FwSizeType))
2426  );
2427  FW_ASSERT(
2428  _status == Fw::FW_SERIALIZE_OK,
2429  static_cast<FwAssertArgType>(_status)
2430  );
2431 #endif
2432  _status = _logBuff.serializeFrom(writeSize);
2433  FW_ASSERT(
2434  _status == Fw::FW_SERIALIZE_OK,
2435  static_cast<FwAssertArgType>(_status)
2436  );
2437 
2438  _status = fileName.serializeTo(_logBuff, FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 200));
2439  FW_ASSERT(
2440  _status == Fw::FW_SERIALIZE_OK,
2441  static_cast<FwAssertArgType>(_status)
2442  );
2443 
2444  this->m_logOut_OutputPort[0].invoke(
2445  _id,
2446  _logTime,
2448  _logBuff
2449  );
2450  }
2451 
2452  // Emit the event on the text log port
2453 #if FW_ENABLE_TEXT_LOGGING
2454  if (this->m_logTextOut_OutputPort[0].isConnected()) {
2455 #if FW_OBJECT_NAMES == 1
2456  const char* _formatString =
2457  "(%s) %s: Beginning write of size %" PRIu64 " to %s";
2458 #else
2459  const char* _formatString =
2460  "%s: Beginning write of size %" PRIu64 " to %s";
2461 #endif
2462 
2463  Fw::TextLogString _logString;
2464  _logString.format(
2465  _formatString,
2466 #if FW_OBJECT_NAMES == 1
2467  this->m_objName.toChar(),
2468 #endif
2469  "WriteBegin ",
2470  writeSize,
2471  fileName.toChar()
2472  );
2473 
2474  this->m_logTextOut_OutputPort[0].invoke(
2475  _id,
2476  _logTime,
2478  _logString
2479  );
2480  }
2481 #endif
2482  }
2483 
2486  FwSizeType writeSize,
2487  const Fw::StringBase& fileName
2488  ) const
2489  {
2490  // Get the time
2491  Fw::Time _logTime;
2492  if (this->m_timeCaller_OutputPort[0].isConnected()) {
2493  this->m_timeCaller_OutputPort[0].invoke(_logTime);
2494  }
2495 
2496  FwEventIdType _id = static_cast<FwEventIdType>(0);
2497 
2498  _id = this->getIdBase() + EVENTID_WRITECOMPLETED;
2499 
2500  // Emit the event on the log port
2501  if (this->m_logOut_OutputPort[0].isConnected()) {
2502  Fw::LogBuffer _logBuff;
2504 
2505 #if FW_AMPCS_COMPATIBLE
2506  // Serialize the number of arguments
2507  _status = _logBuff.serializeFrom(static_cast<U8>(2));
2508  FW_ASSERT(
2509  _status == Fw::FW_SERIALIZE_OK,
2510  static_cast<FwAssertArgType>(_status)
2511  );
2512 #endif
2513 
2514 #if FW_AMPCS_COMPATIBLE
2515  // Serialize the argument size
2516  _status = _logBuff.serializeFrom(
2517  static_cast<U8>(sizeof(FwSizeType))
2518  );
2519  FW_ASSERT(
2520  _status == Fw::FW_SERIALIZE_OK,
2521  static_cast<FwAssertArgType>(_status)
2522  );
2523 #endif
2524  _status = _logBuff.serializeFrom(writeSize);
2525  FW_ASSERT(
2526  _status == Fw::FW_SERIALIZE_OK,
2527  static_cast<FwAssertArgType>(_status)
2528  );
2529 
2530  _status = fileName.serializeTo(_logBuff, FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 200));
2531  FW_ASSERT(
2532  _status == Fw::FW_SERIALIZE_OK,
2533  static_cast<FwAssertArgType>(_status)
2534  );
2535 
2536  this->m_logOut_OutputPort[0].invoke(
2537  _id,
2538  _logTime,
2540  _logBuff
2541  );
2542  }
2543 
2544  // Emit the event on the text log port
2545 #if FW_ENABLE_TEXT_LOGGING
2546  if (this->m_logTextOut_OutputPort[0].isConnected()) {
2547 #if FW_OBJECT_NAMES == 1
2548  const char* _formatString =
2549  "(%s) %s: Completed write of size %" PRIu64 " to %s";
2550 #else
2551  const char* _formatString =
2552  "%s: Completed write of size %" PRIu64 " to %s";
2553 #endif
2554 
2555  Fw::TextLogString _logString;
2556  _logString.format(
2557  _formatString,
2558 #if FW_OBJECT_NAMES == 1
2559  this->m_objName.toChar(),
2560 #endif
2561  "WriteCompleted ",
2562  writeSize,
2563  fileName.toChar()
2564  );
2565 
2566  this->m_logTextOut_OutputPort[0].invoke(
2567  _id,
2568  _logTime,
2570  _logString
2571  );
2572  }
2573 #endif
2574  }
2575 
2578  FwSizeType bytesWritten,
2579  FwSizeType writeSize,
2580  const Fw::StringBase& fileName,
2581  I32 status
2582  )
2583  {
2584  // Get the time
2585  Fw::Time _logTime;
2586  if (this->m_timeCaller_OutputPort[0].isConnected()) {
2587  this->m_timeCaller_OutputPort[0].invoke(_logTime);
2588  }
2589 
2590  FwEventIdType _id = static_cast<FwEventIdType>(0);
2591 
2592  _id = this->getIdBase() + EVENTID_WRITEFILEERROR;
2593 
2594  // Check throttle value & throttle timeout
2595  {
2596  Os::ScopeLock scopedLock(this->m_eventLock);
2597 
2598  if (this->m_WriteFileErrorThrottle >= EVENTID_WRITEFILEERROR_THROTTLE) {
2599  // The counter has overflowed, check if time interval has passed
2600  if (Fw::TimeInterval(this->m_WriteFileErrorThrottleTime, _logTime) >= Fw::TimeInterval(10, 0)) {
2601  // Reset the count
2602  this->m_WriteFileErrorThrottle = 0;
2603  } else {
2604  // Throttle the event
2605  return;
2606  }
2607  }
2608 
2609  // Reset the throttle time if needed
2610  if (this->m_WriteFileErrorThrottle == 0) {
2611  // This is the first event, reset the throttle time
2612  this->m_WriteFileErrorThrottleTime = _logTime;
2613  }
2614 
2615  // Increment the count
2616  this->m_WriteFileErrorThrottle++;
2617  }
2618 
2619  // Emit the event on the log port
2620  if (this->m_logOut_OutputPort[0].isConnected()) {
2621  Fw::LogBuffer _logBuff;
2623 
2624 #if FW_AMPCS_COMPATIBLE
2625  // Serialize the number of arguments
2626  _status = _logBuff.serializeFrom(static_cast<U8>(4));
2627  FW_ASSERT(
2628  _status == Fw::FW_SERIALIZE_OK,
2629  static_cast<FwAssertArgType>(_status)
2630  );
2631 #endif
2632 
2633 #if FW_AMPCS_COMPATIBLE
2634  // Serialize the argument size
2635  _status = _logBuff.serializeFrom(
2636  static_cast<U8>(sizeof(FwSizeType))
2637  );
2638  FW_ASSERT(
2639  _status == Fw::FW_SERIALIZE_OK,
2640  static_cast<FwAssertArgType>(_status)
2641  );
2642 #endif
2643  _status = _logBuff.serializeFrom(bytesWritten);
2644  FW_ASSERT(
2645  _status == Fw::FW_SERIALIZE_OK,
2646  static_cast<FwAssertArgType>(_status)
2647  );
2648 
2649 #if FW_AMPCS_COMPATIBLE
2650  // Serialize the argument size
2651  _status = _logBuff.serializeFrom(
2652  static_cast<U8>(sizeof(FwSizeType))
2653  );
2654  FW_ASSERT(
2655  _status == Fw::FW_SERIALIZE_OK,
2656  static_cast<FwAssertArgType>(_status)
2657  );
2658 #endif
2659  _status = _logBuff.serializeFrom(writeSize);
2660  FW_ASSERT(
2661  _status == Fw::FW_SERIALIZE_OK,
2662  static_cast<FwAssertArgType>(_status)
2663  );
2664 
2665  _status = fileName.serializeTo(_logBuff, FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 200));
2666  FW_ASSERT(
2667  _status == Fw::FW_SERIALIZE_OK,
2668  static_cast<FwAssertArgType>(_status)
2669  );
2670 
2671 #if FW_AMPCS_COMPATIBLE
2672  // Serialize the argument size
2673  _status = _logBuff.serializeFrom(
2674  static_cast<U8>(sizeof(I32))
2675  );
2676  FW_ASSERT(
2677  _status == Fw::FW_SERIALIZE_OK,
2678  static_cast<FwAssertArgType>(_status)
2679  );
2680 #endif
2681  _status = _logBuff.serializeFrom(status);
2682  FW_ASSERT(
2683  _status == Fw::FW_SERIALIZE_OK,
2684  static_cast<FwAssertArgType>(_status)
2685  );
2686 
2687  this->m_logOut_OutputPort[0].invoke(
2688  _id,
2689  _logTime,
2691  _logBuff
2692  );
2693  }
2694 
2695  // Emit the event on the text log port
2696 #if FW_ENABLE_TEXT_LOGGING
2697  if (this->m_logTextOut_OutputPort[0].isConnected()) {
2698 #if FW_OBJECT_NAMES == 1
2699  const char* _formatString =
2700  "(%s) %s: Failed after %" PRIu64 " of %" PRIu64 " bytes written to %s with write status %" PRIi32 "";
2701 #else
2702  const char* _formatString =
2703  "%s: Failed after %" PRIu64 " of %" PRIu64 " bytes written to %s with write status %" PRIi32 "";
2704 #endif
2705 
2706  Fw::TextLogString _logString;
2707  _logString.format(
2708  _formatString,
2709 #if FW_OBJECT_NAMES == 1
2710  this->m_objName.toChar(),
2711 #endif
2712  "WriteFileError ",
2713  bytesWritten,
2714  writeSize,
2715  fileName.toChar(),
2716  status
2717  );
2718 
2719  this->m_logTextOut_OutputPort[0].invoke(
2720  _id,
2721  _logTime,
2723  _logString
2724  );
2725  }
2726 #endif
2727  }
2728 
2731  const Fw::StringBase& hashFileName,
2732  I32 status
2733  )
2734  {
2735  // Get the time
2736  Fw::Time _logTime;
2737  if (this->m_timeCaller_OutputPort[0].isConnected()) {
2738  this->m_timeCaller_OutputPort[0].invoke(_logTime);
2739  }
2740 
2741  FwEventIdType _id = static_cast<FwEventIdType>(0);
2742 
2744 
2745  // Check throttle value & throttle timeout
2746  {
2747  Os::ScopeLock scopedLock(this->m_eventLock);
2748 
2749  if (this->m_WriteValidationOpenErrorThrottle >= EVENTID_WRITEVALIDATIONOPENERROR_THROTTLE) {
2750  // The counter has overflowed, check if time interval has passed
2751  if (Fw::TimeInterval(this->m_WriteValidationOpenErrorThrottleTime, _logTime) >= Fw::TimeInterval(10, 0)) {
2752  // Reset the count
2753  this->m_WriteValidationOpenErrorThrottle = 0;
2754  } else {
2755  // Throttle the event
2756  return;
2757  }
2758  }
2759 
2760  // Reset the throttle time if needed
2761  if (this->m_WriteValidationOpenErrorThrottle == 0) {
2762  // This is the first event, reset the throttle time
2763  this->m_WriteValidationOpenErrorThrottleTime = _logTime;
2764  }
2765 
2766  // Increment the count
2767  this->m_WriteValidationOpenErrorThrottle++;
2768  }
2769 
2770  // Emit the event on the log port
2771  if (this->m_logOut_OutputPort[0].isConnected()) {
2772  Fw::LogBuffer _logBuff;
2774 
2775 #if FW_AMPCS_COMPATIBLE
2776  // Serialize the number of arguments
2777  _status = _logBuff.serializeFrom(static_cast<U8>(2));
2778  FW_ASSERT(
2779  _status == Fw::FW_SERIALIZE_OK,
2780  static_cast<FwAssertArgType>(_status)
2781  );
2782 #endif
2783 
2784  _status = hashFileName.serializeTo(_logBuff, FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 200));
2785  FW_ASSERT(
2786  _status == Fw::FW_SERIALIZE_OK,
2787  static_cast<FwAssertArgType>(_status)
2788  );
2789 
2790 #if FW_AMPCS_COMPATIBLE
2791  // Serialize the argument size
2792  _status = _logBuff.serializeFrom(
2793  static_cast<U8>(sizeof(I32))
2794  );
2795  FW_ASSERT(
2796  _status == Fw::FW_SERIALIZE_OK,
2797  static_cast<FwAssertArgType>(_status)
2798  );
2799 #endif
2800  _status = _logBuff.serializeFrom(status);
2801  FW_ASSERT(
2802  _status == Fw::FW_SERIALIZE_OK,
2803  static_cast<FwAssertArgType>(_status)
2804  );
2805 
2806  this->m_logOut_OutputPort[0].invoke(
2807  _id,
2808  _logTime,
2810  _logBuff
2811  );
2812  }
2813 
2814  // Emit the event on the text log port
2815 #if FW_ENABLE_TEXT_LOGGING
2816  if (this->m_logTextOut_OutputPort[0].isConnected()) {
2817 #if FW_OBJECT_NAMES == 1
2818  const char* _formatString =
2819  "(%s) %s: Failed to open validation file %s with status %" PRIi32 "";
2820 #else
2821  const char* _formatString =
2822  "%s: Failed to open validation file %s with status %" PRIi32 "";
2823 #endif
2824 
2825  Fw::TextLogString _logString;
2826  _logString.format(
2827  _formatString,
2828 #if FW_OBJECT_NAMES == 1
2829  this->m_objName.toChar(),
2830 #endif
2831  "WriteValidationOpenError ",
2832  hashFileName.toChar(),
2833  status
2834  );
2835 
2836  this->m_logTextOut_OutputPort[0].invoke(
2837  _id,
2838  _logTime,
2840  _logString
2841  );
2842  }
2843 #endif
2844  }
2845 
2848  const Fw::StringBase& hashFileName,
2849  I32 status
2850  )
2851  {
2852  // Get the time
2853  Fw::Time _logTime;
2854  if (this->m_timeCaller_OutputPort[0].isConnected()) {
2855  this->m_timeCaller_OutputPort[0].invoke(_logTime);
2856  }
2857 
2858  FwEventIdType _id = static_cast<FwEventIdType>(0);
2859 
2861 
2862  // Check throttle value & throttle timeout
2863  {
2864  Os::ScopeLock scopedLock(this->m_eventLock);
2865 
2866  if (this->m_WriteValidationReadErrorThrottle >= EVENTID_WRITEVALIDATIONREADERROR_THROTTLE) {
2867  // The counter has overflowed, check if time interval has passed
2868  if (Fw::TimeInterval(this->m_WriteValidationReadErrorThrottleTime, _logTime) >= Fw::TimeInterval(10, 0)) {
2869  // Reset the count
2870  this->m_WriteValidationReadErrorThrottle = 0;
2871  } else {
2872  // Throttle the event
2873  return;
2874  }
2875  }
2876 
2877  // Reset the throttle time if needed
2878  if (this->m_WriteValidationReadErrorThrottle == 0) {
2879  // This is the first event, reset the throttle time
2880  this->m_WriteValidationReadErrorThrottleTime = _logTime;
2881  }
2882 
2883  // Increment the count
2884  this->m_WriteValidationReadErrorThrottle++;
2885  }
2886 
2887  // Emit the event on the log port
2888  if (this->m_logOut_OutputPort[0].isConnected()) {
2889  Fw::LogBuffer _logBuff;
2891 
2892 #if FW_AMPCS_COMPATIBLE
2893  // Serialize the number of arguments
2894  _status = _logBuff.serializeFrom(static_cast<U8>(2));
2895  FW_ASSERT(
2896  _status == Fw::FW_SERIALIZE_OK,
2897  static_cast<FwAssertArgType>(_status)
2898  );
2899 #endif
2900 
2901  _status = hashFileName.serializeTo(_logBuff, FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 200));
2902  FW_ASSERT(
2903  _status == Fw::FW_SERIALIZE_OK,
2904  static_cast<FwAssertArgType>(_status)
2905  );
2906 
2907 #if FW_AMPCS_COMPATIBLE
2908  // Serialize the argument size
2909  _status = _logBuff.serializeFrom(
2910  static_cast<U8>(sizeof(I32))
2911  );
2912  FW_ASSERT(
2913  _status == Fw::FW_SERIALIZE_OK,
2914  static_cast<FwAssertArgType>(_status)
2915  );
2916 #endif
2917  _status = _logBuff.serializeFrom(status);
2918  FW_ASSERT(
2919  _status == Fw::FW_SERIALIZE_OK,
2920  static_cast<FwAssertArgType>(_status)
2921  );
2922 
2923  this->m_logOut_OutputPort[0].invoke(
2924  _id,
2925  _logTime,
2927  _logBuff
2928  );
2929  }
2930 
2931  // Emit the event on the text log port
2932 #if FW_ENABLE_TEXT_LOGGING
2933  if (this->m_logTextOut_OutputPort[0].isConnected()) {
2934 #if FW_OBJECT_NAMES == 1
2935  const char* _formatString =
2936  "(%s) %s: Failed to read validation file %s with status %" PRIi32 "";
2937 #else
2938  const char* _formatString =
2939  "%s: Failed to read validation file %s with status %" PRIi32 "";
2940 #endif
2941 
2942  Fw::TextLogString _logString;
2943  _logString.format(
2944  _formatString,
2945 #if FW_OBJECT_NAMES == 1
2946  this->m_objName.toChar(),
2947 #endif
2948  "WriteValidationReadError ",
2949  hashFileName.toChar(),
2950  status
2951  );
2952 
2953  this->m_logTextOut_OutputPort[0].invoke(
2954  _id,
2955  _logTime,
2957  _logString
2958  );
2959  }
2960 #endif
2961  }
2962 
2965  const Fw::StringBase& hashFileName,
2966  FwSizeType bytesWritten,
2967  FwSizeType hashSize
2968  ) const
2969  {
2970  // Get the time
2971  Fw::Time _logTime;
2972  if (this->m_timeCaller_OutputPort[0].isConnected()) {
2973  this->m_timeCaller_OutputPort[0].invoke(_logTime);
2974  }
2975 
2976  FwEventIdType _id = static_cast<FwEventIdType>(0);
2977 
2978  _id = this->getIdBase() + EVENTID_WRITEVALIDATIONERROR;
2979 
2980  // Emit the event on the log port
2981  if (this->m_logOut_OutputPort[0].isConnected()) {
2982  Fw::LogBuffer _logBuff;
2984 
2985 #if FW_AMPCS_COMPATIBLE
2986  // Serialize the number of arguments
2987  _status = _logBuff.serializeFrom(static_cast<U8>(3));
2988  FW_ASSERT(
2989  _status == Fw::FW_SERIALIZE_OK,
2990  static_cast<FwAssertArgType>(_status)
2991  );
2992 #endif
2993 
2994  _status = hashFileName.serializeTo(_logBuff, FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 200));
2995  FW_ASSERT(
2996  _status == Fw::FW_SERIALIZE_OK,
2997  static_cast<FwAssertArgType>(_status)
2998  );
2999 
3000 #if FW_AMPCS_COMPATIBLE
3001  // Serialize the argument size
3002  _status = _logBuff.serializeFrom(
3003  static_cast<U8>(sizeof(FwSizeType))
3004  );
3005  FW_ASSERT(
3006  _status == Fw::FW_SERIALIZE_OK,
3007  static_cast<FwAssertArgType>(_status)
3008  );
3009 #endif
3010  _status = _logBuff.serializeFrom(bytesWritten);
3011  FW_ASSERT(
3012  _status == Fw::FW_SERIALIZE_OK,
3013  static_cast<FwAssertArgType>(_status)
3014  );
3015 
3016 #if FW_AMPCS_COMPATIBLE
3017  // Serialize the argument size
3018  _status = _logBuff.serializeFrom(
3019  static_cast<U8>(sizeof(FwSizeType))
3020  );
3021  FW_ASSERT(
3022  _status == Fw::FW_SERIALIZE_OK,
3023  static_cast<FwAssertArgType>(_status)
3024  );
3025 #endif
3026  _status = _logBuff.serializeFrom(hashSize);
3027  FW_ASSERT(
3028  _status == Fw::FW_SERIALIZE_OK,
3029  static_cast<FwAssertArgType>(_status)
3030  );
3031 
3032  this->m_logOut_OutputPort[0].invoke(
3033  _id,
3034  _logTime,
3036  _logBuff
3037  );
3038  }
3039 
3040  // Emit the event on the text log port
3041 #if FW_ENABLE_TEXT_LOGGING
3042  if (this->m_logTextOut_OutputPort[0].isConnected()) {
3043 #if FW_OBJECT_NAMES == 1
3044  const char* _formatString =
3045  "(%s) %s: Failed to create hash file %s. Wrote %" PRIu64 " bytes when expected to write %" PRIu64 " bytes to hash file";
3046 #else
3047  const char* _formatString =
3048  "%s: Failed to create hash file %s. Wrote %" PRIu64 " bytes when expected to write %" PRIu64 " bytes to hash file";
3049 #endif
3050 
3051  Fw::TextLogString _logString;
3052  _logString.format(
3053  _formatString,
3054 #if FW_OBJECT_NAMES == 1
3055  this->m_objName.toChar(),
3056 #endif
3057  "WriteValidationError ",
3058  hashFileName.toChar(),
3059  bytesWritten,
3060  hashSize
3061  );
3062 
3063  this->m_logTextOut_OutputPort[0].invoke(
3064  _id,
3065  _logTime,
3067  _logString
3068  );
3069  }
3070 #endif
3071  }
3072 
3075  FwSizeType bytesWritten,
3076  FwSizeType writeSize,
3077  const Fw::StringBase& fileName,
3078  U64 timeout
3079  ) const
3080  {
3081  // Get the time
3082  Fw::Time _logTime;
3083  if (this->m_timeCaller_OutputPort[0].isConnected()) {
3084  this->m_timeCaller_OutputPort[0].invoke(_logTime);
3085  }
3086 
3087  FwEventIdType _id = static_cast<FwEventIdType>(0);
3088 
3089  _id = this->getIdBase() + EVENTID_WRITETIMEOUT;
3090 
3091  // Emit the event on the log port
3092  if (this->m_logOut_OutputPort[0].isConnected()) {
3093  Fw::LogBuffer _logBuff;
3095 
3096 #if FW_AMPCS_COMPATIBLE
3097  // Serialize the number of arguments
3098  _status = _logBuff.serializeFrom(static_cast<U8>(4));
3099  FW_ASSERT(
3100  _status == Fw::FW_SERIALIZE_OK,
3101  static_cast<FwAssertArgType>(_status)
3102  );
3103 #endif
3104 
3105 #if FW_AMPCS_COMPATIBLE
3106  // Serialize the argument size
3107  _status = _logBuff.serializeFrom(
3108  static_cast<U8>(sizeof(FwSizeType))
3109  );
3110  FW_ASSERT(
3111  _status == Fw::FW_SERIALIZE_OK,
3112  static_cast<FwAssertArgType>(_status)
3113  );
3114 #endif
3115  _status = _logBuff.serializeFrom(bytesWritten);
3116  FW_ASSERT(
3117  _status == Fw::FW_SERIALIZE_OK,
3118  static_cast<FwAssertArgType>(_status)
3119  );
3120 
3121 #if FW_AMPCS_COMPATIBLE
3122  // Serialize the argument size
3123  _status = _logBuff.serializeFrom(
3124  static_cast<U8>(sizeof(FwSizeType))
3125  );
3126  FW_ASSERT(
3127  _status == Fw::FW_SERIALIZE_OK,
3128  static_cast<FwAssertArgType>(_status)
3129  );
3130 #endif
3131  _status = _logBuff.serializeFrom(writeSize);
3132  FW_ASSERT(
3133  _status == Fw::FW_SERIALIZE_OK,
3134  static_cast<FwAssertArgType>(_status)
3135  );
3136 
3137  _status = fileName.serializeTo(_logBuff, FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 200));
3138  FW_ASSERT(
3139  _status == Fw::FW_SERIALIZE_OK,
3140  static_cast<FwAssertArgType>(_status)
3141  );
3142 
3143 #if FW_AMPCS_COMPATIBLE
3144  // Serialize the argument size
3145  _status = _logBuff.serializeFrom(
3146  static_cast<U8>(sizeof(U64))
3147  );
3148  FW_ASSERT(
3149  _status == Fw::FW_SERIALIZE_OK,
3150  static_cast<FwAssertArgType>(_status)
3151  );
3152 #endif
3153  _status = _logBuff.serializeFrom(timeout);
3154  FW_ASSERT(
3155  _status == Fw::FW_SERIALIZE_OK,
3156  static_cast<FwAssertArgType>(_status)
3157  );
3158 
3159  this->m_logOut_OutputPort[0].invoke(
3160  _id,
3161  _logTime,
3163  _logBuff
3164  );
3165  }
3166 
3167  // Emit the event on the text log port
3168 #if FW_ENABLE_TEXT_LOGGING
3169  if (this->m_logTextOut_OutputPort[0].isConnected()) {
3170 #if FW_OBJECT_NAMES == 1
3171  const char* _formatString =
3172  "(%s) %s: Failed after %" PRIu64 " of %" PRIu64 " bytes written to %s after exceeding timeout of %" PRIu64 " microseconds";
3173 #else
3174  const char* _formatString =
3175  "%s: Failed after %" PRIu64 " of %" PRIu64 " bytes written to %s after exceeding timeout of %" PRIu64 " microseconds";
3176 #endif
3177 
3178  Fw::TextLogString _logString;
3179  _logString.format(
3180  _formatString,
3181 #if FW_OBJECT_NAMES == 1
3182  this->m_objName.toChar(),
3183 #endif
3184  "WriteTimeout ",
3185  bytesWritten,
3186  writeSize,
3187  fileName.toChar(),
3188  timeout
3189  );
3190 
3191  this->m_logTextOut_OutputPort[0].invoke(
3192  _id,
3193  _logTime,
3195  _logString
3196  );
3197  }
3198 #endif
3199  }
3200 
3203  FwSizeType bytesWritten,
3204  FwSizeType writeSize,
3205  const Fw::StringBase& fileName
3206  ) const
3207  {
3208  // Get the time
3209  Fw::Time _logTime;
3210  if (this->m_timeCaller_OutputPort[0].isConnected()) {
3211  this->m_timeCaller_OutputPort[0].invoke(_logTime);
3212  }
3213 
3214  FwEventIdType _id = static_cast<FwEventIdType>(0);
3215 
3216  _id = this->getIdBase() + EVENTID_WRITEABORTED;
3217 
3218  // Emit the event on the log port
3219  if (this->m_logOut_OutputPort[0].isConnected()) {
3220  Fw::LogBuffer _logBuff;
3222 
3223 #if FW_AMPCS_COMPATIBLE
3224  // Serialize the number of arguments
3225  _status = _logBuff.serializeFrom(static_cast<U8>(3));
3226  FW_ASSERT(
3227  _status == Fw::FW_SERIALIZE_OK,
3228  static_cast<FwAssertArgType>(_status)
3229  );
3230 #endif
3231 
3232 #if FW_AMPCS_COMPATIBLE
3233  // Serialize the argument size
3234  _status = _logBuff.serializeFrom(
3235  static_cast<U8>(sizeof(FwSizeType))
3236  );
3237  FW_ASSERT(
3238  _status == Fw::FW_SERIALIZE_OK,
3239  static_cast<FwAssertArgType>(_status)
3240  );
3241 #endif
3242  _status = _logBuff.serializeFrom(bytesWritten);
3243  FW_ASSERT(
3244  _status == Fw::FW_SERIALIZE_OK,
3245  static_cast<FwAssertArgType>(_status)
3246  );
3247 
3248 #if FW_AMPCS_COMPATIBLE
3249  // Serialize the argument size
3250  _status = _logBuff.serializeFrom(
3251  static_cast<U8>(sizeof(FwSizeType))
3252  );
3253  FW_ASSERT(
3254  _status == Fw::FW_SERIALIZE_OK,
3255  static_cast<FwAssertArgType>(_status)
3256  );
3257 #endif
3258  _status = _logBuff.serializeFrom(writeSize);
3259  FW_ASSERT(
3260  _status == Fw::FW_SERIALIZE_OK,
3261  static_cast<FwAssertArgType>(_status)
3262  );
3263 
3264  _status = fileName.serializeTo(_logBuff, FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 200));
3265  FW_ASSERT(
3266  _status == Fw::FW_SERIALIZE_OK,
3267  static_cast<FwAssertArgType>(_status)
3268  );
3269 
3270  this->m_logOut_OutputPort[0].invoke(
3271  _id,
3272  _logTime,
3274  _logBuff
3275  );
3276  }
3277 
3278  // Emit the event on the text log port
3279 #if FW_ENABLE_TEXT_LOGGING
3280  if (this->m_logTextOut_OutputPort[0].isConnected()) {
3281 #if FW_OBJECT_NAMES == 1
3282  const char* _formatString =
3283  "(%s) %s: Aborted after %" PRIu64 " of %" PRIu64 " bytes written to %s";
3284 #else
3285  const char* _formatString =
3286  "%s: Aborted after %" PRIu64 " of %" PRIu64 " bytes written to %s";
3287 #endif
3288 
3289  Fw::TextLogString _logString;
3290  _logString.format(
3291  _formatString,
3292 #if FW_OBJECT_NAMES == 1
3293  this->m_objName.toChar(),
3294 #endif
3295  "WriteAborted ",
3296  bytesWritten,
3297  writeSize,
3298  fileName.toChar()
3299  );
3300 
3301  this->m_logTextOut_OutputPort[0].invoke(
3302  _id,
3303  _logTime,
3305  _logString
3306  );
3307  }
3308 #endif
3309  }
3310 
3311  // ----------------------------------------------------------------------
3312  // Event throttle reset functions
3313  // ----------------------------------------------------------------------
3314 
3317  {
3318  {
3319  Os::ScopeLock scopedLock(this->m_eventLock);
3320 
3321  // Reset throttle counter
3322  this->m_NotInIdleThrottle = 0;
3323 
3324  // Reset the throttle time
3325  this->m_NotInIdleThrottleTime = Fw::Time(0, 0);
3326  }
3327  }
3328 
3331  {
3332  {
3333  Os::ScopeLock scopedLock(this->m_eventLock);
3334 
3335  // Reset throttle counter
3336  this->m_CrcFailedThrottle = 0;
3337 
3338  // Reset the throttle time
3339  this->m_CrcFailedThrottleTime = Fw::Time(0, 0);
3340  }
3341  }
3342 
3345  {
3346  {
3347  Os::ScopeLock scopedLock(this->m_eventLock);
3348 
3349  // Reset throttle counter
3350  this->m_ReadFailedFileSizeThrottle = 0;
3351 
3352  // Reset the throttle time
3353  this->m_ReadFailedFileSizeThrottleTime = Fw::Time(0, 0);
3354  }
3355  }
3356 
3359  {
3360  {
3361  Os::ScopeLock scopedLock(this->m_eventLock);
3362 
3363  // Reset throttle counter
3364  this->m_OpenFileErrorThrottle = 0;
3365 
3366  // Reset the throttle time
3367  this->m_OpenFileErrorThrottleTime = Fw::Time(0, 0);
3368  }
3369  }
3370 
3373  {
3374  {
3375  Os::ScopeLock scopedLock(this->m_eventLock);
3376 
3377  // Reset throttle counter
3378  this->m_WriteFileErrorThrottle = 0;
3379 
3380  // Reset the throttle time
3381  this->m_WriteFileErrorThrottleTime = Fw::Time(0, 0);
3382  }
3383  }
3384 
3387  {
3388  {
3389  Os::ScopeLock scopedLock(this->m_eventLock);
3390 
3391  // Reset throttle counter
3392  this->m_WriteValidationOpenErrorThrottle = 0;
3393 
3394  // Reset the throttle time
3395  this->m_WriteValidationOpenErrorThrottleTime = Fw::Time(0, 0);
3396  }
3397  }
3398 
3401  {
3402  {
3403  Os::ScopeLock scopedLock(this->m_eventLock);
3404 
3405  // Reset throttle counter
3406  this->m_WriteValidationReadErrorThrottle = 0;
3407 
3408  // Reset the throttle time
3409  this->m_WriteValidationReadErrorThrottleTime = Fw::Time(0, 0);
3410  }
3411  }
3412 
3413  // ----------------------------------------------------------------------
3414  // Time
3415  // ----------------------------------------------------------------------
3416 
3418  getTime() const
3419  {
3420  if (this->m_timeCaller_OutputPort[0].isConnected()) {
3421  Fw::Time _time;
3422  this->m_timeCaller_OutputPort[0].invoke(_time);
3423  return _time;
3424  }
3425  else {
3426  return Fw::Time(TimeBase::TB_NONE, 0, 0);
3427  }
3428  }
3429 
3430  // ----------------------------------------------------------------------
3431  // Mutex operations for guarded ports
3432  //
3433  // You can override these operations to provide more sophisticated
3434  // synchronization
3435  // ----------------------------------------------------------------------
3436 
3439  {
3440  this->m_guardedPortMutex.lock();
3441  }
3442 
3445  {
3446  this->m_guardedPortMutex.unLock();
3447  }
3448 
3449  // ----------------------------------------------------------------------
3450  // Message dispatch functions
3451  // ----------------------------------------------------------------------
3452 
3453  Fw::QueuedComponentBase::MsgDispatchStatus FileWorkerComponentBase ::
3454  doDispatch()
3455  {
3456  ComponentIpcSerializableBuffer _msg;
3457  FwQueuePriorityType _priority = 0;
3458 
3459  Os::Queue::Status _msgStatus = this->m_queue.receive(
3460  _msg,
3462  _priority
3463  );
3464  FW_ASSERT(
3465  _msgStatus == Os::Queue::OP_OK,
3466  static_cast<FwAssertArgType>(_msgStatus)
3467  );
3468 
3469  // Reset to beginning of buffer
3470  _msg.resetDeser();
3471 
3472  FwEnumStoreType _desMsg = 0;
3473  Fw::SerializeStatus _deserStatus = _msg.deserializeTo(_desMsg);
3474  FW_ASSERT(
3475  _deserStatus == Fw::FW_SERIALIZE_OK,
3476  static_cast<FwAssertArgType>(_deserStatus)
3477  );
3478 
3479  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
3480 
3481  if (_msgType == FILEWORKER_COMPONENT_EXIT) {
3482  return MSG_DISPATCH_EXIT;
3483  }
3484 
3485  FwIndexType portNum = 0;
3486  _deserStatus = _msg.deserializeTo(portNum);
3487  FW_ASSERT(
3488  _deserStatus == Fw::FW_SERIALIZE_OK,
3489  static_cast<FwAssertArgType>(_deserStatus)
3490  );
3491 
3492  switch (_msgType) {
3493  // Handle async input port readIn
3494  case READIN_FILEREAD: {
3495  // Deserialize argument path
3496  char __fprime_ac_path_buffer[Fw::StringBase::BUFFER_SIZE(200)];
3497  Fw::ExternalString path(__fprime_ac_path_buffer, sizeof __fprime_ac_path_buffer);
3498  _deserStatus = _msg.deserializeTo(path);
3499  FW_ASSERT(
3500  _deserStatus == Fw::FW_SERIALIZE_OK,
3501  static_cast<FwAssertArgType>(_deserStatus)
3502  );
3503 
3504  // Deserialize argument buffer
3505  Fw::Buffer buffer;
3506  _deserStatus = _msg.deserializeTo(buffer);
3507  FW_ASSERT(
3508  _deserStatus == Fw::FW_SERIALIZE_OK,
3509  static_cast<FwAssertArgType>(_deserStatus)
3510  );
3511  // Call handler function
3512  this->readIn_handler(
3513  portNum,
3514  path,
3515  buffer
3516  );
3517 
3518  break;
3519  }
3520 
3521  // Handle async input port verifyIn
3522  case VERIFYIN_VERIFYSTATUS: {
3523  // Deserialize argument path
3524  char __fprime_ac_path_buffer[Fw::StringBase::BUFFER_SIZE(200)];
3525  Fw::ExternalString path(__fprime_ac_path_buffer, sizeof __fprime_ac_path_buffer);
3526  _deserStatus = _msg.deserializeTo(path);
3527  FW_ASSERT(
3528  _deserStatus == Fw::FW_SERIALIZE_OK,
3529  static_cast<FwAssertArgType>(_deserStatus)
3530  );
3531 
3532  // Deserialize argument crc
3533  U32 crc;
3534  _deserStatus = _msg.deserializeTo(crc);
3535  FW_ASSERT(
3536  _deserStatus == Fw::FW_SERIALIZE_OK,
3537  static_cast<FwAssertArgType>(_deserStatus)
3538  );
3539  // Call handler function
3540  this->verifyIn_handler(
3541  portNum,
3542  path,
3543  crc
3544  );
3545 
3546  break;
3547  }
3548 
3549  // Handle async input port writeIn
3550  case WRITEIN_FILEWRITE: {
3551  // Deserialize argument path
3552  char __fprime_ac_path_buffer[Fw::StringBase::BUFFER_SIZE(200)];
3553  Fw::ExternalString path(__fprime_ac_path_buffer, sizeof __fprime_ac_path_buffer);
3554  _deserStatus = _msg.deserializeTo(path);
3555  FW_ASSERT(
3556  _deserStatus == Fw::FW_SERIALIZE_OK,
3557  static_cast<FwAssertArgType>(_deserStatus)
3558  );
3559 
3560  // Deserialize argument buffer
3561  Fw::Buffer buffer;
3562  _deserStatus = _msg.deserializeTo(buffer);
3563  FW_ASSERT(
3564  _deserStatus == Fw::FW_SERIALIZE_OK,
3565  static_cast<FwAssertArgType>(_deserStatus)
3566  );
3567 
3568  // Deserialize argument offsetBytes
3569  FwSizeType offsetBytes;
3570  _deserStatus = _msg.deserializeTo(offsetBytes);
3571  FW_ASSERT(
3572  _deserStatus == Fw::FW_SERIALIZE_OK,
3573  static_cast<FwAssertArgType>(_deserStatus)
3574  );
3575 
3576  // Deserialize argument append
3577  bool append;
3578  _deserStatus = _msg.deserializeTo(append);
3579  FW_ASSERT(
3580  _deserStatus == Fw::FW_SERIALIZE_OK,
3581  static_cast<FwAssertArgType>(_deserStatus)
3582  );
3583  // Call handler function
3584  this->writeIn_handler(
3585  portNum,
3586  path,
3587  buffer,
3588  offsetBytes,
3589  append
3590  );
3591 
3592  break;
3593  }
3594 
3595  default:
3596  return MSG_DISPATCH_ERROR;
3597  }
3598 
3599  return MSG_DISPATCH_OK;
3600  }
3601 
3602  // ----------------------------------------------------------------------
3603  // Calls for messages received on special input ports
3604  // ----------------------------------------------------------------------
3605 
3606  void FileWorkerComponentBase ::
3607  m_p_cmdIn_in(
3608  Fw::PassiveComponentBase* callComp,
3609  FwIndexType portNum,
3610  FwOpcodeType opCode,
3611  U32 cmdSeq,
3612  Fw::CmdArgBuffer& args
3613  )
3614  {
3615  FW_ASSERT(callComp);
3616 
3617  const U32 idBase = callComp->getIdBase();
3618  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
3619  }
3620 
3621  // ----------------------------------------------------------------------
3622  // Calls for messages received on typed input ports
3623  // ----------------------------------------------------------------------
3624 
3625  void FileWorkerComponentBase ::
3626  m_p_cancelIn_in(
3627  Fw::PassiveComponentBase* callComp,
3628  FwIndexType portNum
3629  )
3630  {
3631  FW_ASSERT(callComp);
3632  FileWorkerComponentBase* compPtr = static_cast<FileWorkerComponentBase*>(callComp);
3633  compPtr->cancelIn_handlerBase(portNum);
3634  }
3635 
3636  void FileWorkerComponentBase ::
3637  m_p_readIn_in(
3638  Fw::PassiveComponentBase* callComp,
3639  FwIndexType portNum,
3640  const Fw::StringBase& path,
3641  Fw::Buffer& buffer
3642  )
3643  {
3644  FW_ASSERT(callComp);
3645  FileWorkerComponentBase* compPtr = static_cast<FileWorkerComponentBase*>(callComp);
3646  compPtr->readIn_handlerBase(
3647  portNum,
3648  path,
3649  buffer
3650  );
3651  }
3652 
3653  void FileWorkerComponentBase ::
3654  m_p_verifyIn_in(
3655  Fw::PassiveComponentBase* callComp,
3656  FwIndexType portNum,
3657  const Fw::StringBase& path,
3658  U32 crc
3659  )
3660  {
3661  FW_ASSERT(callComp);
3662  FileWorkerComponentBase* compPtr = static_cast<FileWorkerComponentBase*>(callComp);
3663  compPtr->verifyIn_handlerBase(
3664  portNum,
3665  path,
3666  crc
3667  );
3668  }
3669 
3670  void FileWorkerComponentBase ::
3671  m_p_writeIn_in(
3672  Fw::PassiveComponentBase* callComp,
3673  FwIndexType portNum,
3674  const Fw::StringBase& path,
3675  Fw::Buffer& buffer,
3676  FwSizeType offsetBytes,
3677  bool append
3678  )
3679  {
3680  FW_ASSERT(callComp);
3681  FileWorkerComponentBase* compPtr = static_cast<FileWorkerComponentBase*>(callComp);
3682  compPtr->writeIn_handlerBase(
3683  portNum,
3684  path,
3685  buffer,
3686  offsetBytes,
3687  append
3688  );
3689  }
3690 
3691 }
void verifyDoneOut_out(FwIndexType portNum, U32 status, FwSizeType sizeBytes)
Invoke output port verifyDoneOut.
Serialization/Deserialization operation was successful.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:134
static constexpr FwIndexType getNum_verifyIn_InputPorts()
void log_WARNING_HI_ReadFailedFileSize(U32 fsStat)
void set_cmdRegOut_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to cmdRegOut[portNum].
FwIdType FwOpcodeType
The type of a command opcode.
void readIn_handlerBase(FwIndexType portNum, const Fw::StringBase &path, Fw::Buffer &buffer)
Handler base-class function for input port readIn.
Operation succeeded.
Definition: Os.hpp:26
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
The size of the serial representations of the port arguments.
virtual void cancelIn_handler(FwIndexType portNum)=0
Handler for input port cancelIn.
PlatformSizeType FwSizeType
virtual ~FileWorkerComponentBase()
Destroy FileWorkerComponentBase object.
Status receive(U8 *destination, FwSizeType capacity, BlockingType blockType, FwSizeType &actualSize, FwQueuePriorityType &priority) override
receive a message from the queue through delegate
Definition: Queue.cpp:71
Error encountered while creating validation file.
Error encountered while reading validation file.
void init()
Initialization function.
I32 FwEnumStoreType
Input SignalDone port.
Status
status returned from the queue send function
Definition: Queue.hpp:30
void verifyIn_handlerBase(FwIndexType portNum, const Fw::StringBase &path, U32 crc)
Handler base-class function for input port verifyIn.
Received a buffer and initiating write operation.
void log_WARNING_HI_WriteValidationReadError_ThrottleClear()
Reset throttle value for WriteValidationReadError.
static constexpr FwIndexType getNum_logOut_OutputPorts()
Svc::InputFileReadPort * get_readIn_InputPort(FwIndexType portNum)
Completed the write operation and will return buffer.
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
void set_readDoneOut_OutputPort(FwIndexType portNum, Svc::InputSignalDonePort *port)
Connect port to readDoneOut[portNum].
void init()
Initialization function.
Definition: CmdPortAc.cpp:56
void log_WARNING_HI_WriteValidationOpenError(const Fw::StringBase &hashFileName, I32 status)
bool isConnected_timeCaller_OutputPort(FwIndexType portNum)
void unLock()
unlock the mutex and assert success
Definition: Mutex.cpp:41
void addCallPort(InputPrmSetPort *callPort)
Register an input port.
void log_WARNING_HI_WriteTimeout(FwSizeType bytesWritten, FwSizeType writeSize, const Fw::StringBase &fileName, U64 timeout) const
virtual const CHAR * toChar() const =0
Convert to a C-style char*.
void log_WARNING_LO_ReadAborted(FwSizeType bytesRead, FwSizeType readSize, const Fw::StringBase &fileName) const
bool isConnected_writeDoneOut_OutputPort(FwIndexType portNum)
void set_prmSetOut_OutputPort(FwIndexType portNum, Fw::InputPrmSetPort *port)
Connect port to prmSetOut[portNum].
Input VerifyStatus port.
bool isConnected_tlmOut_OutputPort(FwIndexType portNum)
bool isConnected_cmdRegOut_OutputPort(FwIndexType portNum)
bool isConnected_verifyDoneOut_OutputPort(FwIndexType portNum)
void init()
Initialization function.
Definition: TlmPortAc.cpp:144
The size of the serial representations of the port arguments.
Definition: CmdPortAc.hpp:38
bool isConnected_logOut_OutputPort(FwIndexType portNum)
No time base has been established (Required)
void addCallPort(InputCmdRegPort *callPort)
Register an input port.
void log_ACTIVITY_LO_WriteBegin(FwSizeType writeSize, const Fw::StringBase &fileName) const
static constexpr FwIndexType getNum_cmdRegOut_OutputPorts()
void init()
Initialization function.
static constexpr FwIndexType getNum_readDoneOut_OutputPorts()
Completed the write operation and will return buffer.
Os::Queue m_queue
queue object for active component
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:150
void addCallPort(InputPrmGetPort *callPort)
Register an input port.
void set_cmdResponseOut_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to cmdResponseOut[portNum].
void init()
Object initializer.
Definition: ObjBase.cpp:24
bool isConnected_prmGetOut_OutputPort(FwIndexType portNum)
SerializeStatus
forward declaration for string
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: CmdPortAc.cpp:62
Input FileRead port.
Message will block until space is available.
Definition: Queue.hpp:47
virtual void unLock()
Unlock the guarded mutex.
The size of the serial representations of the port arguments.
void log_ACTIVITY_LO_ReadCompleted(FwSizeType fileSize, const Fw::StringBase &fileName) const
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Completed the read operation and will return buffer.
FwIdType FwEventIdType
The type of an event identifier.
Svc::InputFileWritePort * get_writeIn_InputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_verifyDoneOut_OutputPorts()
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:31
bool isConnected_cmdResponseOut_OutputPort(FwIndexType portNum)
void init()
Initialization function.
Definition: TimePortAc.cpp:128
static constexpr FwIndexType getNum_cmdResponseOut_OutputPorts()
Less important informational events.
Os::Queue::Status createQueue(FwSizeType depth, FwSizeType msgSize)
#define FW_MIN(a, b)
MIN macro (deprecated in C++, use std::min)
Definition: BasicTypes.h:94
A less serious but recoverable event.
virtual void writeIn_handler(FwIndexType portNum, const Fw::StringBase &path, Fw::Buffer &buffer, FwSizeType offsetBytes, bool append)=0
Handler for input port writeIn.
void log_WARNING_HI_OpenFileError(const Fw::StringBase &fileName, U32 fsStat)
static constexpr FwIndexType getNum_prmSetOut_OutputPorts()
void invoke(Fw::Time &time) const
Invoke a port interface.
Definition: TimePortAc.cpp:147
void readDoneOut_out(FwIndexType portNum, U32 status, FwSizeType sizeBytes)
Invoke output port readDoneOut.
static constexpr FwIndexType getNum_readIn_InputPorts()
static constexpr FwIndexType getNum_writeDoneOut_OutputPorts()
void log_ACTIVITY_LO_WriteCompleted(FwSizeType writeSize, const Fw::StringBase &fileName) const
Fw::InputCmdPort * get_cmdIn_InputPort(FwIndexType portNum)
const char * toChar() const
Convert to a C-style char*.
Definition: ObjectName.hpp:50
bool isConnected_prmSetOut_OutputPort(FwIndexType portNum)
FwSizeType SizeType
Input CancelStatus port.
Status send(const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override
send a message into the queue through delegate
Definition: Queue.cpp:54
virtual void verifyIn_handler(FwIndexType portNum, const Fw::StringBase &path, U32 crc)=0
Handler for input port verifyIn.
Input FileWrite port.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void log_WARNING_HI_CrcFailed_ThrottleClear()
Reset throttle value for CrcFailed.
static constexpr FwIndexType getNum_prmGetOut_OutputPorts()
void writeDoneOut_out(FwIndexType portNum, U32 status, FwSizeType sizeBytes)
Invoke output port writeDoneOut.
A string backed by an external buffer.
A serious but recoverable event.
Svc::InputCancelStatusPort * get_cancelIn_InputPort(FwIndexType portNum)
void set_writeDoneOut_OutputPort(FwIndexType portNum, Svc::InputSignalDonePort *port)
Connect port to writeDoneOut[portNum].
virtual void readIn_handler(FwIndexType portNum, const Fw::StringBase &path, Fw::Buffer &buffer)=0
Handler for input port readIn.
bool isConnected() const
Definition: PortBase.cpp:38
#define PRI_FwIndexType
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
void init()
Initialization function.
Definition: LogPortAc.cpp:151
void log_WARNING_HI_WriteFileError(FwSizeType bytesWritten, FwSizeType writeSize, const Fw::StringBase &fileName, I32 status)
virtual void readIn_preMsgHook(FwIndexType portNum, const Fw::StringBase &path, Fw::Buffer &buffer)
Pre-message hook for async input port readIn.
static constexpr FwIndexType getNum_timeCaller_OutputPorts()
void setPortNum(FwIndexType portNum)
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:53
void log_WARNING_HI_NotInIdle(U32 currState)
BlockingType
message type
Definition: Queue.hpp:46
void log_WARNING_LO_WriteAborted(FwSizeType bytesWritten, FwSizeType writeSize, const Fw::StringBase &fileName) const
void log_ACTIVITY_LO_ReadBegin(FwSizeType fileSize, const Fw::StringBase &fileName) const
void cancelIn_handlerBase(FwIndexType portNum)
Handler base-class function for input port cancelIn.
void addCallPort(InputSignalDonePort *callPort)
Register an input port.
void log_WARNING_HI_WriteFileError_ThrottleClear()
Reset throttle value for WriteFileError.
bool isConnected_readDoneOut_OutputPort(FwIndexType portNum)
void init()
Initialization function.
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
PlatformQueuePriorityType FwQueuePriorityType
The type of queue priorities used.
virtual void lock()
Lock the guarded mutex.
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
void log_WARNING_HI_NotInIdle_ThrottleClear()
Reset throttle value for NotInIdle.
void log_WARNING_HI_WriteValidationReadError(const Fw::StringBase &hashFileName, I32 status)
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args) const
Invoke a port interface.
Definition: LogPortAc.cpp:170
static constexpr FwIndexType getNum_cancelIn_InputPorts()
A message was sent requesting an exit of the loop.
PlatformIndexType FwIndexType
static constexpr FwIndexType getNum_tlmOut_OutputPorts()
locks a mutex within the current scope
Definition: Mutex.hpp:80
Error encountered while opening validation file.
void log_WARNING_LO_CrcVerificationError(U32 crcExp, U32 crcCalculated) const
void log_WARNING_HI_WriteValidationOpenError_ThrottleClear()
Reset throttle value for WriteValidationOpenError.
void set_prmGetOut_OutputPort(FwIndexType portNum, Fw::InputPrmGetPort *port)
Connect port to prmGetOut[portNum].
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:157
void init()
Initialization function.
static constexpr FwIndexType getNum_cmdIn_InputPorts()
RateGroupDivider component implementation.
void init()
Initialization function.
message sent/received okay
Definition: Queue.hpp:31
U8 BYTE
byte type
Definition: BasicTypes.h:56
Svc::InputVerifyStatusPort * get_verifyIn_InputPort(FwIndexType portNum)
void invoke(U32 status, FwSizeType sizeBytes) const
Invoke a port interface.
void log_WARNING_LO_WriteValidationError(const Fw::StringBase &hashFileName, FwSizeType bytesWritten, FwSizeType hashSize) const
void writeIn_handlerBase(FwIndexType portNum, const Fw::StringBase &path, Fw::Buffer &buffer, FwSizeType offsetBytes, bool append)
Handler base-class function for input port writeIn.
Message will return with status when space is unavailable.
Definition: Queue.hpp:48
static constexpr FwIndexType getNum_writeIn_InputPorts()
Implementation of malloc based allocator.
virtual void writeIn_preMsgHook(FwIndexType portNum, const Fw::StringBase &path, Fw::Buffer &buffer, FwSizeType offsetBytes, bool append)
Pre-message hook for async input port writeIn.
void set_verifyDoneOut_OutputPort(FwIndexType portNum, Svc::InputSignalDonePort *port)
Connect port to verifyDoneOut[portNum].
static constexpr SizeType BUFFER_SIZE(SizeType maxLength)
Get the size of a null-terminated string buffer.
void init()
Initialization function.
The size of the serial representations of the port arguments.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void init()
Initialization function.
FileWorkerComponentBase(const char *compName="")
Construct FileWorkerComponentBase object.
virtual void verifyIn_preMsgHook(FwIndexType portNum, const Fw::StringBase &path, U32 crc)
Pre-message hook for async input port verifyIn.
message to exit active component task
void log_WARNING_HI_ReadError(FwSizeType bytesRead, FwSizeType readSize, const Fw::StringBase &fileName) const
void init()
Initialization function.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
void log_WARNING_HI_OpenFileError_ThrottleClear()
Reset throttle value for OpenFileError.
void log_WARNING_HI_ReadTimeout(FwSizeType bytesRead, FwSizeType readSize, const Fw::StringBase &fileName, U64 timeout) const
void init()
Initialization function.
void log_WARNING_HI_ReadFailedFileSize_ThrottleClear()
Reset throttle value for ReadFailedFileSize.
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.
void lock()
lock the mutex and assert success
Definition: Mutex.cpp:34
SerializeStatus serializeTo(SerialBufferBase &buffer, Endianness mode=Endianness::BIG) const override
Serialize the contents of this object to a buffer.
#define U64(C)
Definition: sha.h:181