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  ComponentIpcSerializableBuffer() : Fw::LinearBufferBase(m_buff, sizeof(m_buff)) {
51 
52  }
53 
54  private:
55  // Should be the max of all the input ports serialized sizes...
56  U8 m_buff[SERIALIZATION_SIZE];
57 
58  };
59  }
60 
61  // ----------------------------------------------------------------------
62  // Component initialization
63  // ----------------------------------------------------------------------
64 
67  FwSizeType queueDepth,
68  FwEnumStoreType instance
69  )
70  {
71  // Initialize base class
73 
74 #if !FW_DIRECT_PORT_CALLS
75  // Connect input port cmdIn
76  for (
77  FwIndexType port = 0;
78  port < static_cast<FwIndexType>(this->getNum_cmdIn_InputPorts());
79  port++
80  ) {
81  this->m_cmdIn_InputPort[port].init();
82  this->m_cmdIn_InputPort[port].addCallComp(
83  this,
84  m_p_cmdIn_in
85  );
86  this->m_cmdIn_InputPort[port].setPortNum(port);
87 
88 #if FW_OBJECT_NAMES == 1
89  Fw::ObjectName portName;
90  portName.format(
91  "%s_cmdIn_InputPort[%" PRI_FwIndexType "]",
92  this->m_objName.toChar(),
93  port
94  );
95  this->m_cmdIn_InputPort[port].setObjName(portName.toChar());
96 #endif
97  }
98 #endif
99 
100 #if !FW_DIRECT_PORT_CALLS
101  // Connect input port cancelIn
102  for (
103  FwIndexType port = 0;
104  port < static_cast<FwIndexType>(this->getNum_cancelIn_InputPorts());
105  port++
106  ) {
107  this->m_cancelIn_InputPort[port].init();
108  this->m_cancelIn_InputPort[port].addCallComp(
109  this,
110  m_p_cancelIn_in
111  );
112  this->m_cancelIn_InputPort[port].setPortNum(port);
113 
114 #if FW_OBJECT_NAMES == 1
115  Fw::ObjectName portName;
116  portName.format(
117  "%s_cancelIn_InputPort[%" PRI_FwIndexType "]",
118  this->m_objName.toChar(),
119  port
120  );
121  this->m_cancelIn_InputPort[port].setObjName(portName.toChar());
122 #endif
123  }
124 #endif
125 
126 #if !FW_DIRECT_PORT_CALLS
127  // Connect input port readIn
128  for (
129  FwIndexType port = 0;
130  port < static_cast<FwIndexType>(this->getNum_readIn_InputPorts());
131  port++
132  ) {
133  this->m_readIn_InputPort[port].init();
134  this->m_readIn_InputPort[port].addCallComp(
135  this,
136  m_p_readIn_in
137  );
138  this->m_readIn_InputPort[port].setPortNum(port);
139 
140 #if FW_OBJECT_NAMES == 1
141  Fw::ObjectName portName;
142  portName.format(
143  "%s_readIn_InputPort[%" PRI_FwIndexType "]",
144  this->m_objName.toChar(),
145  port
146  );
147  this->m_readIn_InputPort[port].setObjName(portName.toChar());
148 #endif
149  }
150 #endif
151 
152 #if !FW_DIRECT_PORT_CALLS
153  // Connect input port verifyIn
154  for (
155  FwIndexType port = 0;
156  port < static_cast<FwIndexType>(this->getNum_verifyIn_InputPorts());
157  port++
158  ) {
159  this->m_verifyIn_InputPort[port].init();
160  this->m_verifyIn_InputPort[port].addCallComp(
161  this,
162  m_p_verifyIn_in
163  );
164  this->m_verifyIn_InputPort[port].setPortNum(port);
165 
166 #if FW_OBJECT_NAMES == 1
167  Fw::ObjectName portName;
168  portName.format(
169  "%s_verifyIn_InputPort[%" PRI_FwIndexType "]",
170  this->m_objName.toChar(),
171  port
172  );
173  this->m_verifyIn_InputPort[port].setObjName(portName.toChar());
174 #endif
175  }
176 #endif
177 
178 #if !FW_DIRECT_PORT_CALLS
179  // Connect input port writeIn
180  for (
181  FwIndexType port = 0;
182  port < static_cast<FwIndexType>(this->getNum_writeIn_InputPorts());
183  port++
184  ) {
185  this->m_writeIn_InputPort[port].init();
186  this->m_writeIn_InputPort[port].addCallComp(
187  this,
188  m_p_writeIn_in
189  );
190  this->m_writeIn_InputPort[port].setPortNum(port);
191 
192 #if FW_OBJECT_NAMES == 1
193  Fw::ObjectName portName;
194  portName.format(
195  "%s_writeIn_InputPort[%" PRI_FwIndexType "]",
196  this->m_objName.toChar(),
197  port
198  );
199  this->m_writeIn_InputPort[port].setObjName(portName.toChar());
200 #endif
201  }
202 #endif
203 
204 #if !FW_DIRECT_PORT_CALLS
205  // Connect output port cmdRegOut
206  for (
207  FwIndexType port = 0;
208  port < static_cast<FwIndexType>(this->getNum_cmdRegOut_OutputPorts());
209  port++
210  ) {
211  this->m_cmdRegOut_OutputPort[port].init();
212 
213 #if FW_OBJECT_NAMES == 1
214  Fw::ObjectName portName;
215  portName.format(
216  "%s_cmdRegOut_OutputPort[%" PRI_FwIndexType "]",
217  this->m_objName.toChar(),
218  port
219  );
220  this->m_cmdRegOut_OutputPort[port].setObjName(portName.toChar());
221 #endif
222  }
223 #endif
224 
225 #if !FW_DIRECT_PORT_CALLS
226  // Connect output port cmdResponseOut
227  for (
228  FwIndexType port = 0;
229  port < static_cast<FwIndexType>(this->getNum_cmdResponseOut_OutputPorts());
230  port++
231  ) {
232  this->m_cmdResponseOut_OutputPort[port].init();
233 
234 #if FW_OBJECT_NAMES == 1
235  Fw::ObjectName portName;
236  portName.format(
237  "%s_cmdResponseOut_OutputPort[%" PRI_FwIndexType "]",
238  this->m_objName.toChar(),
239  port
240  );
241  this->m_cmdResponseOut_OutputPort[port].setObjName(portName.toChar());
242 #endif
243  }
244 #endif
245 
246 #if !FW_DIRECT_PORT_CALLS
247  // Connect output port logOut
248  for (
249  FwIndexType port = 0;
250  port < static_cast<FwIndexType>(this->getNum_logOut_OutputPorts());
251  port++
252  ) {
253  this->m_logOut_OutputPort[port].init();
254 
255 #if FW_OBJECT_NAMES == 1
256  Fw::ObjectName portName;
257  portName.format(
258  "%s_logOut_OutputPort[%" PRI_FwIndexType "]",
259  this->m_objName.toChar(),
260  port
261  );
262  this->m_logOut_OutputPort[port].setObjName(portName.toChar());
263 #endif
264  }
265 #endif
266 
267 #if !FW_DIRECT_PORT_CALLS && FW_ENABLE_TEXT_LOGGING
268  // Connect output port logTextOut
269  for (
270  FwIndexType port = 0;
271  port < static_cast<FwIndexType>(this->getNum_logTextOut_OutputPorts());
272  port++
273  ) {
274  this->m_logTextOut_OutputPort[port].init();
275 
276 #if FW_OBJECT_NAMES == 1
277  Fw::ObjectName portName;
278  portName.format(
279  "%s_logTextOut_OutputPort[%" PRI_FwIndexType "]",
280  this->m_objName.toChar(),
281  port
282  );
283  this->m_logTextOut_OutputPort[port].setObjName(portName.toChar());
284 #endif
285  }
286 #endif
287 
288 #if !FW_DIRECT_PORT_CALLS
289  // Connect output port prmGetOut
290  for (
291  FwIndexType port = 0;
292  port < static_cast<FwIndexType>(this->getNum_prmGetOut_OutputPorts());
293  port++
294  ) {
295  this->m_prmGetOut_OutputPort[port].init();
296 
297 #if FW_OBJECT_NAMES == 1
298  Fw::ObjectName portName;
299  portName.format(
300  "%s_prmGetOut_OutputPort[%" PRI_FwIndexType "]",
301  this->m_objName.toChar(),
302  port
303  );
304  this->m_prmGetOut_OutputPort[port].setObjName(portName.toChar());
305 #endif
306  }
307 #endif
308 
309 #if !FW_DIRECT_PORT_CALLS
310  // Connect output port prmSetOut
311  for (
312  FwIndexType port = 0;
313  port < static_cast<FwIndexType>(this->getNum_prmSetOut_OutputPorts());
314  port++
315  ) {
316  this->m_prmSetOut_OutputPort[port].init();
317 
318 #if FW_OBJECT_NAMES == 1
319  Fw::ObjectName portName;
320  portName.format(
321  "%s_prmSetOut_OutputPort[%" PRI_FwIndexType "]",
322  this->m_objName.toChar(),
323  port
324  );
325  this->m_prmSetOut_OutputPort[port].setObjName(portName.toChar());
326 #endif
327  }
328 #endif
329 
330 #if !FW_DIRECT_PORT_CALLS
331  // Connect output port timeCaller
332  for (
333  FwIndexType port = 0;
334  port < static_cast<FwIndexType>(this->getNum_timeCaller_OutputPorts());
335  port++
336  ) {
337  this->m_timeCaller_OutputPort[port].init();
338 
339 #if FW_OBJECT_NAMES == 1
340  Fw::ObjectName portName;
341  portName.format(
342  "%s_timeCaller_OutputPort[%" PRI_FwIndexType "]",
343  this->m_objName.toChar(),
344  port
345  );
346  this->m_timeCaller_OutputPort[port].setObjName(portName.toChar());
347 #endif
348  }
349 #endif
350 
351 #if !FW_DIRECT_PORT_CALLS
352  // Connect output port tlmOut
353  for (
354  FwIndexType port = 0;
355  port < static_cast<FwIndexType>(this->getNum_tlmOut_OutputPorts());
356  port++
357  ) {
358  this->m_tlmOut_OutputPort[port].init();
359 
360 #if FW_OBJECT_NAMES == 1
361  Fw::ObjectName portName;
362  portName.format(
363  "%s_tlmOut_OutputPort[%" PRI_FwIndexType "]",
364  this->m_objName.toChar(),
365  port
366  );
367  this->m_tlmOut_OutputPort[port].setObjName(portName.toChar());
368 #endif
369  }
370 #endif
371 
372 #if !FW_DIRECT_PORT_CALLS
373  // Connect output port readDoneOut
374  for (
375  FwIndexType port = 0;
376  port < static_cast<FwIndexType>(this->getNum_readDoneOut_OutputPorts());
377  port++
378  ) {
379  this->m_readDoneOut_OutputPort[port].init();
380 
381 #if FW_OBJECT_NAMES == 1
382  Fw::ObjectName portName;
383  portName.format(
384  "%s_readDoneOut_OutputPort[%" PRI_FwIndexType "]",
385  this->m_objName.toChar(),
386  port
387  );
388  this->m_readDoneOut_OutputPort[port].setObjName(portName.toChar());
389 #endif
390  }
391 #endif
392 
393 #if !FW_DIRECT_PORT_CALLS
394  // Connect output port verifyDoneOut
395  for (
396  FwIndexType port = 0;
397  port < static_cast<FwIndexType>(this->getNum_verifyDoneOut_OutputPorts());
398  port++
399  ) {
400  this->m_verifyDoneOut_OutputPort[port].init();
401 
402 #if FW_OBJECT_NAMES == 1
403  Fw::ObjectName portName;
404  portName.format(
405  "%s_verifyDoneOut_OutputPort[%" PRI_FwIndexType "]",
406  this->m_objName.toChar(),
407  port
408  );
409  this->m_verifyDoneOut_OutputPort[port].setObjName(portName.toChar());
410 #endif
411  }
412 #endif
413 
414 #if !FW_DIRECT_PORT_CALLS
415  // Connect output port writeDoneOut
416  for (
417  FwIndexType port = 0;
418  port < static_cast<FwIndexType>(this->getNum_writeDoneOut_OutputPorts());
419  port++
420  ) {
421  this->m_writeDoneOut_OutputPort[port].init();
422 
423 #if FW_OBJECT_NAMES == 1
424  Fw::ObjectName portName;
425  portName.format(
426  "%s_writeDoneOut_OutputPort[%" PRI_FwIndexType "]",
427  this->m_objName.toChar(),
428  port
429  );
430  this->m_writeDoneOut_OutputPort[port].setObjName(portName.toChar());
431 #endif
432  }
433 #endif
434 
435  // Create the queue
436  Os::Queue::Status qStat = this->createQueue(
437  queueDepth,
438  static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
439  );
440  FW_ASSERT(
441  Os::Queue::Status::OP_OK == qStat,
442  static_cast<FwAssertArgType>(qStat)
443  );
444  }
445 
446 #if !FW_DIRECT_PORT_CALLS
447 
448  // ----------------------------------------------------------------------
449  // Getters for special input ports
450  // ----------------------------------------------------------------------
451 
454  {
455  FW_ASSERT(
456  (0 <= portNum) && (portNum < this->getNum_cmdIn_InputPorts()),
457  static_cast<FwAssertArgType>(portNum)
458  );
459 
460  return &this->m_cmdIn_InputPort[portNum];
461  }
462 
463 #endif
464 
465 #if !FW_DIRECT_PORT_CALLS
466 
467  // ----------------------------------------------------------------------
468  // Getters for typed input ports
469  // ----------------------------------------------------------------------
470 
473  {
474  FW_ASSERT(
475  (0 <= portNum) && (portNum < this->getNum_cancelIn_InputPorts()),
476  static_cast<FwAssertArgType>(portNum)
477  );
478 
479  return &this->m_cancelIn_InputPort[portNum];
480  }
481 
484  {
485  FW_ASSERT(
486  (0 <= portNum) && (portNum < this->getNum_readIn_InputPorts()),
487  static_cast<FwAssertArgType>(portNum)
488  );
489 
490  return &this->m_readIn_InputPort[portNum];
491  }
492 
495  {
496  FW_ASSERT(
497  (0 <= portNum) && (portNum < this->getNum_verifyIn_InputPorts()),
498  static_cast<FwAssertArgType>(portNum)
499  );
500 
501  return &this->m_verifyIn_InputPort[portNum];
502  }
503 
506  {
507  FW_ASSERT(
508  (0 <= portNum) && (portNum < this->getNum_writeIn_InputPorts()),
509  static_cast<FwAssertArgType>(portNum)
510  );
511 
512  return &this->m_writeIn_InputPort[portNum];
513  }
514 
515 #endif
516 
517 #if !FW_DIRECT_PORT_CALLS
518 
519  // ----------------------------------------------------------------------
520  // Connect input ports to special output ports
521  // ----------------------------------------------------------------------
522 
525  FwIndexType portNum,
526  Fw::InputCmdRegPort* port
527  )
528  {
529  FW_ASSERT(
530  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
531  static_cast<FwAssertArgType>(portNum)
532  );
533 
534  this->m_cmdRegOut_OutputPort[portNum].addCallPort(port);
535  }
536 
539  FwIndexType portNum,
541  )
542  {
543  FW_ASSERT(
544  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
545  static_cast<FwAssertArgType>(portNum)
546  );
547 
548  this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port);
549  }
550 
553  FwIndexType portNum,
554  Fw::InputLogPort* port
555  )
556  {
557  FW_ASSERT(
558  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
559  static_cast<FwAssertArgType>(portNum)
560  );
561 
562  this->m_logOut_OutputPort[portNum].addCallPort(port);
563  }
564 
565 #if FW_ENABLE_TEXT_LOGGING == 1
566 
567  void FileWorkerComponentBase ::
568  set_logTextOut_OutputPort(
569  FwIndexType portNum,
571  )
572  {
573  FW_ASSERT(
574  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
575  static_cast<FwAssertArgType>(portNum)
576  );
577 
578  this->m_logTextOut_OutputPort[portNum].addCallPort(port);
579  }
580 
581 #endif
582 
585  FwIndexType portNum,
586  Fw::InputPrmGetPort* port
587  )
588  {
589  FW_ASSERT(
590  (0 <= portNum) && (portNum < this->getNum_prmGetOut_OutputPorts()),
591  static_cast<FwAssertArgType>(portNum)
592  );
593 
594  this->m_prmGetOut_OutputPort[portNum].addCallPort(port);
595  }
596 
599  FwIndexType portNum,
600  Fw::InputPrmSetPort* port
601  )
602  {
603  FW_ASSERT(
604  (0 <= portNum) && (portNum < this->getNum_prmSetOut_OutputPorts()),
605  static_cast<FwAssertArgType>(portNum)
606  );
607 
608  this->m_prmSetOut_OutputPort[portNum].addCallPort(port);
609  }
610 
613  FwIndexType portNum,
614  Fw::InputTimePort* port
615  )
616  {
617  FW_ASSERT(
618  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
619  static_cast<FwAssertArgType>(portNum)
620  );
621 
622  this->m_timeCaller_OutputPort[portNum].addCallPort(port);
623  }
624 
627  FwIndexType portNum,
628  Fw::InputTlmPort* port
629  )
630  {
631  FW_ASSERT(
632  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
633  static_cast<FwAssertArgType>(portNum)
634  );
635 
636  this->m_tlmOut_OutputPort[portNum].addCallPort(port);
637  }
638 
639 #endif
640 
641 #if !FW_DIRECT_PORT_CALLS
642 
643  // ----------------------------------------------------------------------
644  // Connect typed input ports to typed output ports
645  // ----------------------------------------------------------------------
646 
649  FwIndexType portNum,
651  )
652  {
653  FW_ASSERT(
654  (0 <= portNum) && (portNum < this->getNum_readDoneOut_OutputPorts()),
655  static_cast<FwAssertArgType>(portNum)
656  );
657 
658  this->m_readDoneOut_OutputPort[portNum].addCallPort(port);
659  }
660 
663  FwIndexType portNum,
665  )
666  {
667  FW_ASSERT(
668  (0 <= portNum) && (portNum < this->getNum_verifyDoneOut_OutputPorts()),
669  static_cast<FwAssertArgType>(portNum)
670  );
671 
672  this->m_verifyDoneOut_OutputPort[portNum].addCallPort(port);
673  }
674 
677  FwIndexType portNum,
679  )
680  {
681  FW_ASSERT(
682  (0 <= portNum) && (portNum < this->getNum_writeDoneOut_OutputPorts()),
683  static_cast<FwAssertArgType>(portNum)
684  );
685 
686  this->m_writeDoneOut_OutputPort[portNum].addCallPort(port);
687  }
688 
689 #endif
690 
691 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
692 
693  // ----------------------------------------------------------------------
694  // Connect serial input ports to special output ports
695  // ----------------------------------------------------------------------
696 
699  FwIndexType portNum,
700  Fw::InputSerializePort* port
701  )
702  {
703  FW_ASSERT(
704  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
705  static_cast<FwAssertArgType>(portNum)
706  );
707 
708  this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port);
709  }
710 
713  FwIndexType portNum,
714  Fw::InputSerializePort* port
715  )
716  {
717  FW_ASSERT(
718  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
719  static_cast<FwAssertArgType>(portNum)
720  );
721 
722  this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port);
723  }
724 
727  FwIndexType portNum,
728  Fw::InputSerializePort* port
729  )
730  {
731  FW_ASSERT(
732  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
733  static_cast<FwAssertArgType>(portNum)
734  );
735 
736  this->m_logOut_OutputPort[portNum].registerSerialPort(port);
737  }
738 
739 #if FW_ENABLE_TEXT_LOGGING == 1
740 
741  void FileWorkerComponentBase ::
742  set_logTextOut_OutputPort(
743  FwIndexType portNum,
744  Fw::InputSerializePort* port
745  )
746  {
747  FW_ASSERT(
748  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
749  static_cast<FwAssertArgType>(portNum)
750  );
751 
752  this->m_logTextOut_OutputPort[portNum].registerSerialPort(port);
753  }
754 
755 #endif
756 
759  FwIndexType portNum,
760  Fw::InputSerializePort* port
761  )
762  {
763  FW_ASSERT(
764  (0 <= portNum) && (portNum < this->getNum_prmSetOut_OutputPorts()),
765  static_cast<FwAssertArgType>(portNum)
766  );
767 
768  this->m_prmSetOut_OutputPort[portNum].registerSerialPort(port);
769  }
770 
773  FwIndexType portNum,
774  Fw::InputSerializePort* port
775  )
776  {
777  FW_ASSERT(
778  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
779  static_cast<FwAssertArgType>(portNum)
780  );
781 
782  this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
783  }
784 
787  FwIndexType portNum,
788  Fw::InputSerializePort* port
789  )
790  {
791  FW_ASSERT(
792  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
793  static_cast<FwAssertArgType>(portNum)
794  );
795 
796  this->m_tlmOut_OutputPort[portNum].registerSerialPort(port);
797  }
798 
799 #endif
800 
801 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
802 
803  // ----------------------------------------------------------------------
804  // Connect serial input ports to typed output ports
805  // ----------------------------------------------------------------------
806 
809  FwIndexType portNum,
810  Fw::InputSerializePort* port
811  )
812  {
813  FW_ASSERT(
814  (0 <= portNum) && (portNum < this->getNum_readDoneOut_OutputPorts()),
815  static_cast<FwAssertArgType>(portNum)
816  );
817 
818  this->m_readDoneOut_OutputPort[portNum].registerSerialPort(port);
819  }
820 
823  FwIndexType portNum,
824  Fw::InputSerializePort* port
825  )
826  {
827  FW_ASSERT(
828  (0 <= portNum) && (portNum < this->getNum_verifyDoneOut_OutputPorts()),
829  static_cast<FwAssertArgType>(portNum)
830  );
831 
832  this->m_verifyDoneOut_OutputPort[portNum].registerSerialPort(port);
833  }
834 
837  FwIndexType portNum,
838  Fw::InputSerializePort* port
839  )
840  {
841  FW_ASSERT(
842  (0 <= portNum) && (portNum < this->getNum_writeDoneOut_OutputPorts()),
843  static_cast<FwAssertArgType>(portNum)
844  );
845 
846  this->m_writeDoneOut_OutputPort[portNum].registerSerialPort(port);
847  }
848 
849 #endif
850 
851  // ----------------------------------------------------------------------
852  // Component construction and destruction
853  // ----------------------------------------------------------------------
854 
856  FileWorkerComponentBase(const char* compName) :
857  Fw::ActiveComponentBase(compName)
858  {
859  this->m_NotInIdleThrottle = 0;
860  this->m_CrcFailedThrottle = 0;
861  this->m_ReadFailedFileSizeThrottle = 0;
862  this->m_OpenFileErrorThrottle = 0;
863  this->m_WriteFileErrorThrottle = 0;
864  this->m_WriteValidationOpenErrorThrottle = 0;
865  this->m_WriteValidationReadErrorThrottle = 0;
866 
867  this->m_NotInIdleThrottleTime = Fw::Time();
868  this->m_CrcFailedThrottleTime = Fw::Time();
869  this->m_ReadFailedFileSizeThrottleTime = Fw::Time();
870  this->m_OpenFileErrorThrottleTime = Fw::Time();
871  this->m_WriteFileErrorThrottleTime = Fw::Time();
872  this->m_WriteValidationOpenErrorThrottleTime = Fw::Time();
873  this->m_WriteValidationReadErrorThrottleTime = Fw::Time();
874  }
875 
878  {
879 
880  }
881 
882 #if !FW_DIRECT_PORT_CALLS
883 
884  // ----------------------------------------------------------------------
885  // Connection status queries for special output ports
886  // ----------------------------------------------------------------------
887 
890  {
891  FW_ASSERT(
892  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
893  static_cast<FwAssertArgType>(portNum)
894  );
895 
896  return this->m_cmdRegOut_OutputPort[portNum].isConnected();
897  }
898 
901  {
902  FW_ASSERT(
903  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
904  static_cast<FwAssertArgType>(portNum)
905  );
906 
907  return this->m_cmdResponseOut_OutputPort[portNum].isConnected();
908  }
909 
912  {
913  FW_ASSERT(
914  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
915  static_cast<FwAssertArgType>(portNum)
916  );
917 
918  return this->m_logOut_OutputPort[portNum].isConnected();
919  }
920 
921 #if FW_ENABLE_TEXT_LOGGING == 1
922 
923  bool FileWorkerComponentBase ::
924  isConnected_logTextOut_OutputPort(FwIndexType portNum) const
925  {
926  FW_ASSERT(
927  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
928  static_cast<FwAssertArgType>(portNum)
929  );
930 
931  return this->m_logTextOut_OutputPort[portNum].isConnected();
932  }
933 
934 #endif
935 
938  {
939  FW_ASSERT(
940  (0 <= portNum) && (portNum < this->getNum_prmGetOut_OutputPorts()),
941  static_cast<FwAssertArgType>(portNum)
942  );
943 
944  return this->m_prmGetOut_OutputPort[portNum].isConnected();
945  }
946 
949  {
950  FW_ASSERT(
951  (0 <= portNum) && (portNum < this->getNum_prmSetOut_OutputPorts()),
952  static_cast<FwAssertArgType>(portNum)
953  );
954 
955  return this->m_prmSetOut_OutputPort[portNum].isConnected();
956  }
957 
960  {
961  FW_ASSERT(
962  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
963  static_cast<FwAssertArgType>(portNum)
964  );
965 
966  return this->m_timeCaller_OutputPort[portNum].isConnected();
967  }
968 
971  {
972  FW_ASSERT(
973  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
974  static_cast<FwAssertArgType>(portNum)
975  );
976 
977  return this->m_tlmOut_OutputPort[portNum].isConnected();
978  }
979 
980 #endif
981 
982 #if !FW_DIRECT_PORT_CALLS
983 
984  // ----------------------------------------------------------------------
985  // Connection status queries for typed output ports
986  // ----------------------------------------------------------------------
987 
990  {
991  FW_ASSERT(
992  (0 <= portNum) && (portNum < this->getNum_readDoneOut_OutputPorts()),
993  static_cast<FwAssertArgType>(portNum)
994  );
995 
996  return this->m_readDoneOut_OutputPort[portNum].isConnected();
997  }
998 
1001  {
1002  FW_ASSERT(
1003  (0 <= portNum) && (portNum < this->getNum_verifyDoneOut_OutputPorts()),
1004  static_cast<FwAssertArgType>(portNum)
1005  );
1006 
1007  return this->m_verifyDoneOut_OutputPort[portNum].isConnected();
1008  }
1009 
1012  {
1013  FW_ASSERT(
1014  (0 <= portNum) && (portNum < this->getNum_writeDoneOut_OutputPorts()),
1015  static_cast<FwAssertArgType>(portNum)
1016  );
1017 
1018  return this->m_writeDoneOut_OutputPort[portNum].isConnected();
1019  }
1020 
1021 #endif
1022 
1023  // ----------------------------------------------------------------------
1024  // Port handler base-class functions for special input ports
1025  //
1026  // Call these functions directly to bypass the corresponding ports
1027  // ----------------------------------------------------------------------
1028 
1031  FwIndexType portNum,
1032  FwOpcodeType opCode,
1033  U32 cmdSeq,
1034  Fw::CmdArgBuffer& args
1035  )
1036  {
1037 
1038  const U32 idBase = this->getIdBase();
1039  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
1040 
1041  // Select base class function based on opcode
1042  switch (opCode - idBase) {
1043  default:
1044  // Unknown opcode: ignore it
1045  break;
1046  }
1047  }
1048 
1049  // ----------------------------------------------------------------------
1050  // Port handler base-class functions for typed input ports
1051  //
1052  // Call these functions directly to bypass the corresponding ports
1053  // ----------------------------------------------------------------------
1054 
1057  {
1058  // Make sure port number is valid
1059  FW_ASSERT(
1060  (0 <= portNum) && (portNum < this->getNum_cancelIn_InputPorts()),
1061  static_cast<FwAssertArgType>(portNum)
1062  );
1063 
1064  // Lock guard mutex before calling
1065  this->lock();
1066 
1067  // Call handler function
1068  this->cancelIn_handler(portNum);
1069 
1070  // Unlock guard mutex
1071  this->unLock();
1072  }
1073 
1076  FwIndexType portNum,
1077  const Fw::StringBase& path,
1078  Fw::Buffer& buffer
1079  )
1080  {
1081  // Make sure port number is valid
1082  FW_ASSERT(
1083  (0 <= portNum) && (portNum < this->getNum_readIn_InputPorts()),
1084  static_cast<FwAssertArgType>(portNum)
1085  );
1086 
1087  // Call pre-message hook
1089  portNum,
1090  path,
1091  buffer
1092  );
1093  ComponentIpcSerializableBuffer msg;
1095 
1096  // Serialize message ID
1097  _status = msg.serializeFrom(
1098  static_cast<FwEnumStoreType>(READIN_FILEREAD)
1099  );
1100  FW_ASSERT(
1101  _status == Fw::FW_SERIALIZE_OK,
1102  static_cast<FwAssertArgType>(_status)
1103  );
1104 
1105  // Serialize port number
1106  _status = msg.serializeFrom(portNum);
1107  FW_ASSERT(
1108  _status == Fw::FW_SERIALIZE_OK,
1109  static_cast<FwAssertArgType>(_status)
1110  );
1111 
1112  // Serialize argument path
1113  _status = path.serializeTo(msg, 240);
1114  FW_ASSERT(
1115  _status == Fw::FW_SERIALIZE_OK,
1116  static_cast<FwAssertArgType>(_status)
1117  );
1118 
1119  // Serialize argument buffer
1120  _status = msg.serializeFrom(buffer);
1121  FW_ASSERT(
1122  _status == Fw::FW_SERIALIZE_OK,
1123  static_cast<FwAssertArgType>(_status)
1124  );
1125 
1126  // Send message
1128  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1129 
1130  FW_ASSERT(
1131  qStatus == Os::Queue::OP_OK,
1132  static_cast<FwAssertArgType>(qStatus)
1133  );
1134  }
1135 
1138  FwIndexType portNum,
1139  const Fw::StringBase& path,
1140  U32 crc
1141  )
1142  {
1143  // Make sure port number is valid
1144  FW_ASSERT(
1145  (0 <= portNum) && (portNum < this->getNum_verifyIn_InputPorts()),
1146  static_cast<FwAssertArgType>(portNum)
1147  );
1148 
1149  // Call pre-message hook
1151  portNum,
1152  path,
1153  crc
1154  );
1155  ComponentIpcSerializableBuffer msg;
1157 
1158  // Serialize message ID
1159  _status = msg.serializeFrom(
1160  static_cast<FwEnumStoreType>(VERIFYIN_VERIFYSTATUS)
1161  );
1162  FW_ASSERT(
1163  _status == Fw::FW_SERIALIZE_OK,
1164  static_cast<FwAssertArgType>(_status)
1165  );
1166 
1167  // Serialize port number
1168  _status = msg.serializeFrom(portNum);
1169  FW_ASSERT(
1170  _status == Fw::FW_SERIALIZE_OK,
1171  static_cast<FwAssertArgType>(_status)
1172  );
1173 
1174  // Serialize argument path
1175  _status = path.serializeTo(msg, 240);
1176  FW_ASSERT(
1177  _status == Fw::FW_SERIALIZE_OK,
1178  static_cast<FwAssertArgType>(_status)
1179  );
1180 
1181  // Serialize argument crc
1182  _status = msg.serializeFrom(crc);
1183  FW_ASSERT(
1184  _status == Fw::FW_SERIALIZE_OK,
1185  static_cast<FwAssertArgType>(_status)
1186  );
1187 
1188  // Send message
1190  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1191 
1192  FW_ASSERT(
1193  qStatus == Os::Queue::OP_OK,
1194  static_cast<FwAssertArgType>(qStatus)
1195  );
1196  }
1197 
1200  FwIndexType portNum,
1201  const Fw::StringBase& path,
1202  Fw::Buffer& buffer,
1203  FwSizeType offsetBytes,
1204  bool append
1205  )
1206  {
1207  // Make sure port number is valid
1208  FW_ASSERT(
1209  (0 <= portNum) && (portNum < this->getNum_writeIn_InputPorts()),
1210  static_cast<FwAssertArgType>(portNum)
1211  );
1212 
1213  // Call pre-message hook
1215  portNum,
1216  path,
1217  buffer,
1218  offsetBytes,
1219  append
1220  );
1221  ComponentIpcSerializableBuffer msg;
1223 
1224  // Serialize message ID
1225  _status = msg.serializeFrom(
1226  static_cast<FwEnumStoreType>(WRITEIN_FILEWRITE)
1227  );
1228  FW_ASSERT(
1229  _status == Fw::FW_SERIALIZE_OK,
1230  static_cast<FwAssertArgType>(_status)
1231  );
1232 
1233  // Serialize port number
1234  _status = msg.serializeFrom(portNum);
1235  FW_ASSERT(
1236  _status == Fw::FW_SERIALIZE_OK,
1237  static_cast<FwAssertArgType>(_status)
1238  );
1239 
1240  // Serialize argument path
1241  _status = path.serializeTo(msg, 240);
1242  FW_ASSERT(
1243  _status == Fw::FW_SERIALIZE_OK,
1244  static_cast<FwAssertArgType>(_status)
1245  );
1246 
1247  // Serialize argument buffer
1248  _status = msg.serializeFrom(buffer);
1249  FW_ASSERT(
1250  _status == Fw::FW_SERIALIZE_OK,
1251  static_cast<FwAssertArgType>(_status)
1252  );
1253 
1254  // Serialize argument offsetBytes
1255  _status = msg.serializeFrom(offsetBytes);
1256  FW_ASSERT(
1257  _status == Fw::FW_SERIALIZE_OK,
1258  static_cast<FwAssertArgType>(_status)
1259  );
1260 
1261  // Serialize argument append
1262  _status = msg.serializeFrom(append);
1263  FW_ASSERT(
1264  _status == Fw::FW_SERIALIZE_OK,
1265  static_cast<FwAssertArgType>(_status)
1266  );
1267 
1268  // Send message
1270  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1271 
1272  FW_ASSERT(
1273  qStatus == Os::Queue::OP_OK,
1274  static_cast<FwAssertArgType>(qStatus)
1275  );
1276  }
1277 
1278  // ----------------------------------------------------------------------
1279  // Pre-message hooks for typed async input ports
1280  //
1281  // Each of these functions is invoked just before processing a message
1282  // on the corresponding port. By default, they do nothing. You can
1283  // override them to provide specific pre-message behavior.
1284  // ----------------------------------------------------------------------
1285 
1288  FwIndexType portNum,
1289  const Fw::StringBase& path,
1290  Fw::Buffer& buffer
1291  )
1292  {
1293  // Default: no-op
1294  }
1295 
1298  FwIndexType portNum,
1299  const Fw::StringBase& path,
1300  U32 crc
1301  )
1302  {
1303  // Default: no-op
1304  }
1305 
1308  FwIndexType portNum,
1309  const Fw::StringBase& path,
1310  Fw::Buffer& buffer,
1311  FwSizeType offsetBytes,
1312  bool append
1313  )
1314  {
1315  // Default: no-op
1316  }
1317 
1318 #if !FW_DIRECT_PORT_CALLS
1319 
1320  // ----------------------------------------------------------------------
1321  // Invocation functions for typed output ports
1322  // ----------------------------------------------------------------------
1323 
1326  FwIndexType portNum,
1327  U32 status,
1328  FwSizeType sizeBytes
1329  ) const
1330  {
1331  FW_ASSERT(
1332  (0 <= portNum) && (portNum < this->getNum_readDoneOut_OutputPorts()),
1333  static_cast<FwAssertArgType>(portNum)
1334  );
1335 
1336  FW_ASSERT(
1337  this->m_readDoneOut_OutputPort[portNum].isConnected(),
1338  static_cast<FwAssertArgType>(portNum)
1339  );
1340  this->m_readDoneOut_OutputPort[portNum].invoke(
1341  status,
1342  sizeBytes
1343  );
1344  }
1345 
1348  FwIndexType portNum,
1349  U32 status,
1350  FwSizeType sizeBytes
1351  ) const
1352  {
1353  FW_ASSERT(
1354  (0 <= portNum) && (portNum < this->getNum_verifyDoneOut_OutputPorts()),
1355  static_cast<FwAssertArgType>(portNum)
1356  );
1357 
1358  FW_ASSERT(
1359  this->m_verifyDoneOut_OutputPort[portNum].isConnected(),
1360  static_cast<FwAssertArgType>(portNum)
1361  );
1362  this->m_verifyDoneOut_OutputPort[portNum].invoke(
1363  status,
1364  sizeBytes
1365  );
1366  }
1367 
1370  FwIndexType portNum,
1371  U32 status,
1372  FwSizeType sizeBytes
1373  ) const
1374  {
1375  FW_ASSERT(
1376  (0 <= portNum) && (portNum < this->getNum_writeDoneOut_OutputPorts()),
1377  static_cast<FwAssertArgType>(portNum)
1378  );
1379 
1380  FW_ASSERT(
1381  this->m_writeDoneOut_OutputPort[portNum].isConnected(),
1382  static_cast<FwAssertArgType>(portNum)
1383  );
1384  this->m_writeDoneOut_OutputPort[portNum].invoke(
1385  status,
1386  sizeBytes
1387  );
1388  }
1389 
1390 #endif
1391 
1392  // ----------------------------------------------------------------------
1393  // Event logging functions
1394  // ----------------------------------------------------------------------
1395 
1398  {
1399  // Get the time
1400  Fw::Time _logTime;
1401  if (this->isConnected_timeCaller_OutputPort(0)) {
1402  this->timeCaller_out(0, _logTime);
1403  }
1404 
1405  const FwEventIdType _id = this->getIdBase() + EVENTID_NOTINIDLE;
1406 
1407  // Check throttle value & throttle timeout
1408  {
1409  Os::ScopeLock scopedLock(this->m_eventLock);
1410 
1411  if (this->m_NotInIdleThrottle >= EVENTID_NOTINIDLE_THROTTLE) {
1412  // The counter has overflowed, check if time interval has passed
1413  if (Fw::TimeInterval(this->m_NotInIdleThrottleTime, _logTime) >= Fw::TimeInterval(10, 0)) {
1414  // Reset the count
1415  this->m_NotInIdleThrottle = 0;
1416  } else {
1417  // Throttle the event
1418  return;
1419  }
1420  }
1421 
1422  // Reset the throttle time if needed
1423  if (this->m_NotInIdleThrottle == 0) {
1424  // This is the first event, reset the throttle time
1425  this->m_NotInIdleThrottleTime = _logTime;
1426  }
1427 
1428  // Increment the count
1429  this->m_NotInIdleThrottle++;
1430  }
1431 
1432  // Emit the event on the log port
1433  if (this->isConnected_logOut_OutputPort(0)) {
1434  Fw::LogBuffer _logBuff;
1436 
1437 #if FW_AMPCS_COMPATIBLE
1438  // Serialize the number of arguments
1439  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1440  FW_ASSERT(
1441  _status == Fw::FW_SERIALIZE_OK,
1442  static_cast<FwAssertArgType>(_status)
1443  );
1444 #endif
1445 
1446 #if FW_AMPCS_COMPATIBLE
1447  // Serialize the argument size
1448  _status = _logBuff.serializeFrom(
1449  static_cast<U8>(sizeof(U32))
1450  );
1451  FW_ASSERT(
1452  _status == Fw::FW_SERIALIZE_OK,
1453  static_cast<FwAssertArgType>(_status)
1454  );
1455 #endif
1456  _status = _logBuff.serializeFrom(currState);
1457  FW_ASSERT(
1458  _status == Fw::FW_SERIALIZE_OK,
1459  static_cast<FwAssertArgType>(_status)
1460  );
1461 
1462  this->logOut_out(
1463  0,
1464  _id,
1465  _logTime,
1467  _logBuff
1468  );
1469  }
1470 
1471  // Emit the event on the text log port
1472 #if FW_ENABLE_TEXT_LOGGING
1473  if (this->isConnected_logTextOut_OutputPort(0)) {
1474 #if FW_OBJECT_NAMES == 1
1475  const char* _formatString =
1476  "(%s) %s: Not in IDLE state, currently in state: %" PRIu32 "";
1477 #else
1478  const char* _formatString =
1479  "%s: Not in IDLE state, currently in state: %" PRIu32 "";
1480 #endif
1481 
1482  Fw::TextLogString _logString;
1483  (void) _logString.format(
1484  _formatString,
1485 #if FW_OBJECT_NAMES == 1
1486  this->m_objName.toChar(),
1487 #endif
1488  "NotInIdle ",
1489  currState
1490  );
1491 
1492  this->logTextOut_out(
1493  0,
1494  _id,
1495  _logTime,
1497  _logString
1498  );
1499  }
1500 #endif
1501  }
1502 
1505  {
1506  // Get the time
1507  Fw::Time _logTime;
1508  if (this->isConnected_timeCaller_OutputPort(0)) {
1509  this->timeCaller_out(0, _logTime);
1510  }
1511 
1512  const FwEventIdType _id = this->getIdBase() + EVENTID_CRCFAILED;
1513 
1514  // Check throttle value & throttle timeout
1515  {
1516  Os::ScopeLock scopedLock(this->m_eventLock);
1517 
1518  if (this->m_CrcFailedThrottle >= EVENTID_CRCFAILED_THROTTLE) {
1519  // The counter has overflowed, check if time interval has passed
1520  if (Fw::TimeInterval(this->m_CrcFailedThrottleTime, _logTime) >= Fw::TimeInterval(10, 0)) {
1521  // Reset the count
1522  this->m_CrcFailedThrottle = 0;
1523  } else {
1524  // Throttle the event
1525  return;
1526  }
1527  }
1528 
1529  // Reset the throttle time if needed
1530  if (this->m_CrcFailedThrottle == 0) {
1531  // This is the first event, reset the throttle time
1532  this->m_CrcFailedThrottleTime = _logTime;
1533  }
1534 
1535  // Increment the count
1536  this->m_CrcFailedThrottle++;
1537  }
1538 
1539  // Emit the event on the log port
1540  if (this->isConnected_logOut_OutputPort(0)) {
1541  Fw::LogBuffer _logBuff;
1543 
1544 #if FW_AMPCS_COMPATIBLE
1545  // Serialize the number of arguments
1546  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1547  FW_ASSERT(
1548  _status == Fw::FW_SERIALIZE_OK,
1549  static_cast<FwAssertArgType>(_status)
1550  );
1551 #endif
1552 
1553 #if FW_AMPCS_COMPATIBLE
1554  // Serialize the argument size
1555  _status = _logBuff.serializeFrom(
1556  static_cast<U8>(sizeof(U32))
1557  );
1558  FW_ASSERT(
1559  _status == Fw::FW_SERIALIZE_OK,
1560  static_cast<FwAssertArgType>(_status)
1561  );
1562 #endif
1563  _status = _logBuff.serializeFrom(crcStat);
1564  FW_ASSERT(
1565  _status == Fw::FW_SERIALIZE_OK,
1566  static_cast<FwAssertArgType>(_status)
1567  );
1568 
1569  this->logOut_out(
1570  0,
1571  _id,
1572  _logTime,
1574  _logBuff
1575  );
1576  }
1577 
1578  // Emit the event on the text log port
1579 #if FW_ENABLE_TEXT_LOGGING
1580  if (this->isConnected_logTextOut_OutputPort(0)) {
1581 #if FW_OBJECT_NAMES == 1
1582  const char* _formatString =
1583  "(%s) %s: Failed CRC check with %" PRIu32 " status";
1584 #else
1585  const char* _formatString =
1586  "%s: Failed CRC check with %" PRIu32 " status";
1587 #endif
1588 
1589  Fw::TextLogString _logString;
1590  (void) _logString.format(
1591  _formatString,
1592 #if FW_OBJECT_NAMES == 1
1593  this->m_objName.toChar(),
1594 #endif
1595  "CrcFailed ",
1596  crcStat
1597  );
1598 
1599  this->logTextOut_out(
1600  0,
1601  _id,
1602  _logTime,
1604  _logString
1605  );
1606  }
1607 #endif
1608  }
1609 
1612  U32 crcExp,
1613  U32 crcCalculated
1614  ) const
1615  {
1616  // Get the time
1617  Fw::Time _logTime;
1618  if (this->isConnected_timeCaller_OutputPort(0)) {
1619  this->timeCaller_out(0, _logTime);
1620  }
1621 
1623 
1624  // Emit the event on the log port
1625  if (this->isConnected_logOut_OutputPort(0)) {
1626  Fw::LogBuffer _logBuff;
1628 
1629 #if FW_AMPCS_COMPATIBLE
1630  // Serialize the number of arguments
1631  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1632  FW_ASSERT(
1633  _status == Fw::FW_SERIALIZE_OK,
1634  static_cast<FwAssertArgType>(_status)
1635  );
1636 #endif
1637 
1638 #if FW_AMPCS_COMPATIBLE
1639  // Serialize the argument size
1640  _status = _logBuff.serializeFrom(
1641  static_cast<U8>(sizeof(U32))
1642  );
1643  FW_ASSERT(
1644  _status == Fw::FW_SERIALIZE_OK,
1645  static_cast<FwAssertArgType>(_status)
1646  );
1647 #endif
1648  _status = _logBuff.serializeFrom(crcExp);
1649  FW_ASSERT(
1650  _status == Fw::FW_SERIALIZE_OK,
1651  static_cast<FwAssertArgType>(_status)
1652  );
1653 
1654 #if FW_AMPCS_COMPATIBLE
1655  // Serialize the argument size
1656  _status = _logBuff.serializeFrom(
1657  static_cast<U8>(sizeof(U32))
1658  );
1659  FW_ASSERT(
1660  _status == Fw::FW_SERIALIZE_OK,
1661  static_cast<FwAssertArgType>(_status)
1662  );
1663 #endif
1664  _status = _logBuff.serializeFrom(crcCalculated);
1665  FW_ASSERT(
1666  _status == Fw::FW_SERIALIZE_OK,
1667  static_cast<FwAssertArgType>(_status)
1668  );
1669 
1670  this->logOut_out(
1671  0,
1672  _id,
1673  _logTime,
1675  _logBuff
1676  );
1677  }
1678 
1679  // Emit the event on the text log port
1680 #if FW_ENABLE_TEXT_LOGGING
1681  if (this->isConnected_logTextOut_OutputPort(0)) {
1682 #if FW_OBJECT_NAMES == 1
1683  const char* _formatString =
1684  "(%s) %s: Failed to verify file. Expected CRC %" PRIu32 ". Actual CRC %" PRIu32 "";
1685 #else
1686  const char* _formatString =
1687  "%s: Failed to verify file. Expected CRC %" PRIu32 ". Actual CRC %" PRIu32 "";
1688 #endif
1689 
1690  Fw::TextLogString _logString;
1691  (void) _logString.format(
1692  _formatString,
1693 #if FW_OBJECT_NAMES == 1
1694  this->m_objName.toChar(),
1695 #endif
1696  "CrcVerificationError ",
1697  crcExp,
1698  crcCalculated
1699  );
1700 
1701  this->logTextOut_out(
1702  0,
1703  _id,
1704  _logTime,
1706  _logString
1707  );
1708  }
1709 #endif
1710  }
1711 
1714  {
1715  // Get the time
1716  Fw::Time _logTime;
1717  if (this->isConnected_timeCaller_OutputPort(0)) {
1718  this->timeCaller_out(0, _logTime);
1719  }
1720 
1721  const FwEventIdType _id = this->getIdBase() + EVENTID_READFAILEDFILESIZE;
1722 
1723  // Check throttle value & throttle timeout
1724  {
1725  Os::ScopeLock scopedLock(this->m_eventLock);
1726 
1727  if (this->m_ReadFailedFileSizeThrottle >= EVENTID_READFAILEDFILESIZE_THROTTLE) {
1728  // The counter has overflowed, check if time interval has passed
1729  if (Fw::TimeInterval(this->m_ReadFailedFileSizeThrottleTime, _logTime) >= Fw::TimeInterval(10, 0)) {
1730  // Reset the count
1731  this->m_ReadFailedFileSizeThrottle = 0;
1732  } else {
1733  // Throttle the event
1734  return;
1735  }
1736  }
1737 
1738  // Reset the throttle time if needed
1739  if (this->m_ReadFailedFileSizeThrottle == 0) {
1740  // This is the first event, reset the throttle time
1741  this->m_ReadFailedFileSizeThrottleTime = _logTime;
1742  }
1743 
1744  // Increment the count
1745  this->m_ReadFailedFileSizeThrottle++;
1746  }
1747 
1748  // Emit the event on the log port
1749  if (this->isConnected_logOut_OutputPort(0)) {
1750  Fw::LogBuffer _logBuff;
1752 
1753 #if FW_AMPCS_COMPATIBLE
1754  // Serialize the number of arguments
1755  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1756  FW_ASSERT(
1757  _status == Fw::FW_SERIALIZE_OK,
1758  static_cast<FwAssertArgType>(_status)
1759  );
1760 #endif
1761 
1762 #if FW_AMPCS_COMPATIBLE
1763  // Serialize the argument size
1764  _status = _logBuff.serializeFrom(
1765  static_cast<U8>(sizeof(U32))
1766  );
1767  FW_ASSERT(
1768  _status == Fw::FW_SERIALIZE_OK,
1769  static_cast<FwAssertArgType>(_status)
1770  );
1771 #endif
1772  _status = _logBuff.serializeFrom(fsStat);
1773  FW_ASSERT(
1774  _status == Fw::FW_SERIALIZE_OK,
1775  static_cast<FwAssertArgType>(_status)
1776  );
1777 
1778  this->logOut_out(
1779  0,
1780  _id,
1781  _logTime,
1783  _logBuff
1784  );
1785  }
1786 
1787  // Emit the event on the text log port
1788 #if FW_ENABLE_TEXT_LOGGING
1789  if (this->isConnected_logTextOut_OutputPort(0)) {
1790 #if FW_OBJECT_NAMES == 1
1791  const char* _formatString =
1792  "(%s) %s: Failed to get filesize with stat %" PRIu32 " in read handler";
1793 #else
1794  const char* _formatString =
1795  "%s: Failed to get filesize with stat %" PRIu32 " in read handler";
1796 #endif
1797 
1798  Fw::TextLogString _logString;
1799  (void) _logString.format(
1800  _formatString,
1801 #if FW_OBJECT_NAMES == 1
1802  this->m_objName.toChar(),
1803 #endif
1804  "ReadFailedFileSize ",
1805  fsStat
1806  );
1807 
1808  this->logTextOut_out(
1809  0,
1810  _id,
1811  _logTime,
1813  _logString
1814  );
1815  }
1816 #endif
1817  }
1818 
1821  const Fw::StringBase& fileName,
1822  U32 fsStat
1823  )
1824  {
1825  // Get the time
1826  Fw::Time _logTime;
1827  if (this->isConnected_timeCaller_OutputPort(0)) {
1828  this->timeCaller_out(0, _logTime);
1829  }
1830 
1831  const FwEventIdType _id = this->getIdBase() + EVENTID_OPENFILEERROR;
1832 
1833  // Check throttle value & throttle timeout
1834  {
1835  Os::ScopeLock scopedLock(this->m_eventLock);
1836 
1837  if (this->m_OpenFileErrorThrottle >= EVENTID_OPENFILEERROR_THROTTLE) {
1838  // The counter has overflowed, check if time interval has passed
1839  if (Fw::TimeInterval(this->m_OpenFileErrorThrottleTime, _logTime) >= Fw::TimeInterval(10, 0)) {
1840  // Reset the count
1841  this->m_OpenFileErrorThrottle = 0;
1842  } else {
1843  // Throttle the event
1844  return;
1845  }
1846  }
1847 
1848  // Reset the throttle time if needed
1849  if (this->m_OpenFileErrorThrottle == 0) {
1850  // This is the first event, reset the throttle time
1851  this->m_OpenFileErrorThrottleTime = _logTime;
1852  }
1853 
1854  // Increment the count
1855  this->m_OpenFileErrorThrottle++;
1856  }
1857 
1858  // Emit the event on the log port
1859  if (this->isConnected_logOut_OutputPort(0)) {
1860  Fw::LogBuffer _logBuff;
1862 
1863 #if FW_AMPCS_COMPATIBLE
1864  // Serialize the number of arguments
1865  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1866  FW_ASSERT(
1867  _status == Fw::FW_SERIALIZE_OK,
1868  static_cast<FwAssertArgType>(_status)
1869  );
1870 #endif
1871 
1872  _status = fileName.serializeTo(
1873  _logBuff,
1874  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 240)
1875  );
1876  FW_ASSERT(
1877  _status == Fw::FW_SERIALIZE_OK,
1878  static_cast<FwAssertArgType>(_status)
1879  );
1880 
1881 #if FW_AMPCS_COMPATIBLE
1882  // Serialize the argument size
1883  _status = _logBuff.serializeFrom(
1884  static_cast<U8>(sizeof(U32))
1885  );
1886  FW_ASSERT(
1887  _status == Fw::FW_SERIALIZE_OK,
1888  static_cast<FwAssertArgType>(_status)
1889  );
1890 #endif
1891  _status = _logBuff.serializeFrom(fsStat);
1892  FW_ASSERT(
1893  _status == Fw::FW_SERIALIZE_OK,
1894  static_cast<FwAssertArgType>(_status)
1895  );
1896 
1897  this->logOut_out(
1898  0,
1899  _id,
1900  _logTime,
1902  _logBuff
1903  );
1904  }
1905 
1906  // Emit the event on the text log port
1907 #if FW_ENABLE_TEXT_LOGGING
1908  if (this->isConnected_logTextOut_OutputPort(0)) {
1909 #if FW_OBJECT_NAMES == 1
1910  const char* _formatString =
1911  "(%s) %s: Failed to open file %s with stat %" PRIu32 "";
1912 #else
1913  const char* _formatString =
1914  "%s: Failed to open file %s with stat %" PRIu32 "";
1915 #endif
1916 
1917  Fw::TextLogString _logString;
1918  (void) _logString.format(
1919  _formatString,
1920 #if FW_OBJECT_NAMES == 1
1921  this->m_objName.toChar(),
1922 #endif
1923  "OpenFileError ",
1924  fileName.toChar(),
1925  fsStat
1926  );
1927 
1928  this->logTextOut_out(
1929  0,
1930  _id,
1931  _logTime,
1933  _logString
1934  );
1935  }
1936 #endif
1937  }
1938 
1941  FwSizeType fileSize,
1942  const Fw::StringBase& fileName
1943  ) const
1944  {
1945  // Get the time
1946  Fw::Time _logTime;
1947  if (this->isConnected_timeCaller_OutputPort(0)) {
1948  this->timeCaller_out(0, _logTime);
1949  }
1950 
1951  const FwEventIdType _id = this->getIdBase() + EVENTID_READBEGIN;
1952 
1953  // Emit the event on the log port
1954  if (this->isConnected_logOut_OutputPort(0)) {
1955  Fw::LogBuffer _logBuff;
1957 
1958 #if FW_AMPCS_COMPATIBLE
1959  // Serialize the number of arguments
1960  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1961  FW_ASSERT(
1962  _status == Fw::FW_SERIALIZE_OK,
1963  static_cast<FwAssertArgType>(_status)
1964  );
1965 #endif
1966 
1967 #if FW_AMPCS_COMPATIBLE
1968  // Serialize the argument size
1969  _status = _logBuff.serializeFrom(
1970  static_cast<U8>(sizeof(FwSizeType))
1971  );
1972  FW_ASSERT(
1973  _status == Fw::FW_SERIALIZE_OK,
1974  static_cast<FwAssertArgType>(_status)
1975  );
1976 #endif
1977  _status = _logBuff.serializeFrom(fileSize);
1978  FW_ASSERT(
1979  _status == Fw::FW_SERIALIZE_OK,
1980  static_cast<FwAssertArgType>(_status)
1981  );
1982 
1983  _status = fileName.serializeTo(
1984  _logBuff,
1985  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 240)
1986  );
1987  FW_ASSERT(
1988  _status == Fw::FW_SERIALIZE_OK,
1989  static_cast<FwAssertArgType>(_status)
1990  );
1991 
1992  this->logOut_out(
1993  0,
1994  _id,
1995  _logTime,
1997  _logBuff
1998  );
1999  }
2000 
2001  // Emit the event on the text log port
2002 #if FW_ENABLE_TEXT_LOGGING
2003  if (this->isConnected_logTextOut_OutputPort(0)) {
2004 #if FW_OBJECT_NAMES == 1
2005  const char* _formatString =
2006  "(%s) %s: Reading %" PRIu64 " bytes from %s";
2007 #else
2008  const char* _formatString =
2009  "%s: Reading %" PRIu64 " bytes from %s";
2010 #endif
2011 
2012  Fw::TextLogString _logString;
2013  (void) _logString.format(
2014  _formatString,
2015 #if FW_OBJECT_NAMES == 1
2016  this->m_objName.toChar(),
2017 #endif
2018  "ReadBegin ",
2019  fileSize,
2020  fileName.toChar()
2021  );
2022 
2023  this->logTextOut_out(
2024  0,
2025  _id,
2026  _logTime,
2028  _logString
2029  );
2030  }
2031 #endif
2032  }
2033 
2036  FwSizeType fileSize,
2037  const Fw::StringBase& fileName
2038  ) const
2039  {
2040  // Get the time
2041  Fw::Time _logTime;
2042  if (this->isConnected_timeCaller_OutputPort(0)) {
2043  this->timeCaller_out(0, _logTime);
2044  }
2045 
2046  const FwEventIdType _id = this->getIdBase() + EVENTID_READCOMPLETED;
2047 
2048  // Emit the event on the log port
2049  if (this->isConnected_logOut_OutputPort(0)) {
2050  Fw::LogBuffer _logBuff;
2052 
2053 #if FW_AMPCS_COMPATIBLE
2054  // Serialize the number of arguments
2055  _status = _logBuff.serializeFrom(static_cast<U8>(2));
2056  FW_ASSERT(
2057  _status == Fw::FW_SERIALIZE_OK,
2058  static_cast<FwAssertArgType>(_status)
2059  );
2060 #endif
2061 
2062 #if FW_AMPCS_COMPATIBLE
2063  // Serialize the argument size
2064  _status = _logBuff.serializeFrom(
2065  static_cast<U8>(sizeof(FwSizeType))
2066  );
2067  FW_ASSERT(
2068  _status == Fw::FW_SERIALIZE_OK,
2069  static_cast<FwAssertArgType>(_status)
2070  );
2071 #endif
2072  _status = _logBuff.serializeFrom(fileSize);
2073  FW_ASSERT(
2074  _status == Fw::FW_SERIALIZE_OK,
2075  static_cast<FwAssertArgType>(_status)
2076  );
2077 
2078  _status = fileName.serializeTo(
2079  _logBuff,
2080  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 240)
2081  );
2082  FW_ASSERT(
2083  _status == Fw::FW_SERIALIZE_OK,
2084  static_cast<FwAssertArgType>(_status)
2085  );
2086 
2087  this->logOut_out(
2088  0,
2089  _id,
2090  _logTime,
2092  _logBuff
2093  );
2094  }
2095 
2096  // Emit the event on the text log port
2097 #if FW_ENABLE_TEXT_LOGGING
2098  if (this->isConnected_logTextOut_OutputPort(0)) {
2099 #if FW_OBJECT_NAMES == 1
2100  const char* _formatString =
2101  "(%s) %s: Finished reading %" PRIu64 " bytes from %s";
2102 #else
2103  const char* _formatString =
2104  "%s: Finished reading %" PRIu64 " bytes from %s";
2105 #endif
2106 
2107  Fw::TextLogString _logString;
2108  (void) _logString.format(
2109  _formatString,
2110 #if FW_OBJECT_NAMES == 1
2111  this->m_objName.toChar(),
2112 #endif
2113  "ReadCompleted ",
2114  fileSize,
2115  fileName.toChar()
2116  );
2117 
2118  this->logTextOut_out(
2119  0,
2120  _id,
2121  _logTime,
2123  _logString
2124  );
2125  }
2126 #endif
2127  }
2128 
2131  FwSizeType bytesRead,
2132  FwSizeType readSize,
2133  const Fw::StringBase& fileName
2134  ) const
2135  {
2136  // Get the time
2137  Fw::Time _logTime;
2138  if (this->isConnected_timeCaller_OutputPort(0)) {
2139  this->timeCaller_out(0, _logTime);
2140  }
2141 
2142  const FwEventIdType _id = this->getIdBase() + EVENTID_READERROR;
2143 
2144  // Emit the event on the log port
2145  if (this->isConnected_logOut_OutputPort(0)) {
2146  Fw::LogBuffer _logBuff;
2148 
2149 #if FW_AMPCS_COMPATIBLE
2150  // Serialize the number of arguments
2151  _status = _logBuff.serializeFrom(static_cast<U8>(3));
2152  FW_ASSERT(
2153  _status == Fw::FW_SERIALIZE_OK,
2154  static_cast<FwAssertArgType>(_status)
2155  );
2156 #endif
2157 
2158 #if FW_AMPCS_COMPATIBLE
2159  // Serialize the argument size
2160  _status = _logBuff.serializeFrom(
2161  static_cast<U8>(sizeof(FwSizeType))
2162  );
2163  FW_ASSERT(
2164  _status == Fw::FW_SERIALIZE_OK,
2165  static_cast<FwAssertArgType>(_status)
2166  );
2167 #endif
2168  _status = _logBuff.serializeFrom(bytesRead);
2169  FW_ASSERT(
2170  _status == Fw::FW_SERIALIZE_OK,
2171  static_cast<FwAssertArgType>(_status)
2172  );
2173 
2174 #if FW_AMPCS_COMPATIBLE
2175  // Serialize the argument size
2176  _status = _logBuff.serializeFrom(
2177  static_cast<U8>(sizeof(FwSizeType))
2178  );
2179  FW_ASSERT(
2180  _status == Fw::FW_SERIALIZE_OK,
2181  static_cast<FwAssertArgType>(_status)
2182  );
2183 #endif
2184  _status = _logBuff.serializeFrom(readSize);
2185  FW_ASSERT(
2186  _status == Fw::FW_SERIALIZE_OK,
2187  static_cast<FwAssertArgType>(_status)
2188  );
2189 
2190  _status = fileName.serializeTo(
2191  _logBuff,
2192  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 240)
2193  );
2194  FW_ASSERT(
2195  _status == Fw::FW_SERIALIZE_OK,
2196  static_cast<FwAssertArgType>(_status)
2197  );
2198 
2199  this->logOut_out(
2200  0,
2201  _id,
2202  _logTime,
2204  _logBuff
2205  );
2206  }
2207 
2208  // Emit the event on the text log port
2209 #if FW_ENABLE_TEXT_LOGGING
2210  if (this->isConnected_logTextOut_OutputPort(0)) {
2211 #if FW_OBJECT_NAMES == 1
2212  const char* _formatString =
2213  "(%s) %s: Failed after %" PRIu64 " of %" PRIu64 " bytes read to %s";
2214 #else
2215  const char* _formatString =
2216  "%s: Failed after %" PRIu64 " of %" PRIu64 " bytes read to %s";
2217 #endif
2218 
2219  Fw::TextLogString _logString;
2220  (void) _logString.format(
2221  _formatString,
2222 #if FW_OBJECT_NAMES == 1
2223  this->m_objName.toChar(),
2224 #endif
2225  "ReadError ",
2226  bytesRead,
2227  readSize,
2228  fileName.toChar()
2229  );
2230 
2231  this->logTextOut_out(
2232  0,
2233  _id,
2234  _logTime,
2236  _logString
2237  );
2238  }
2239 #endif
2240  }
2241 
2244  FwSizeType bytesRead,
2245  FwSizeType readSize,
2246  const Fw::StringBase& fileName
2247  ) const
2248  {
2249  // Get the time
2250  Fw::Time _logTime;
2251  if (this->isConnected_timeCaller_OutputPort(0)) {
2252  this->timeCaller_out(0, _logTime);
2253  }
2254 
2255  const FwEventIdType _id = this->getIdBase() + EVENTID_READABORTED;
2256 
2257  // Emit the event on the log port
2258  if (this->isConnected_logOut_OutputPort(0)) {
2259  Fw::LogBuffer _logBuff;
2261 
2262 #if FW_AMPCS_COMPATIBLE
2263  // Serialize the number of arguments
2264  _status = _logBuff.serializeFrom(static_cast<U8>(3));
2265  FW_ASSERT(
2266  _status == Fw::FW_SERIALIZE_OK,
2267  static_cast<FwAssertArgType>(_status)
2268  );
2269 #endif
2270 
2271 #if FW_AMPCS_COMPATIBLE
2272  // Serialize the argument size
2273  _status = _logBuff.serializeFrom(
2274  static_cast<U8>(sizeof(FwSizeType))
2275  );
2276  FW_ASSERT(
2277  _status == Fw::FW_SERIALIZE_OK,
2278  static_cast<FwAssertArgType>(_status)
2279  );
2280 #endif
2281  _status = _logBuff.serializeFrom(bytesRead);
2282  FW_ASSERT(
2283  _status == Fw::FW_SERIALIZE_OK,
2284  static_cast<FwAssertArgType>(_status)
2285  );
2286 
2287 #if FW_AMPCS_COMPATIBLE
2288  // Serialize the argument size
2289  _status = _logBuff.serializeFrom(
2290  static_cast<U8>(sizeof(FwSizeType))
2291  );
2292  FW_ASSERT(
2293  _status == Fw::FW_SERIALIZE_OK,
2294  static_cast<FwAssertArgType>(_status)
2295  );
2296 #endif
2297  _status = _logBuff.serializeFrom(readSize);
2298  FW_ASSERT(
2299  _status == Fw::FW_SERIALIZE_OK,
2300  static_cast<FwAssertArgType>(_status)
2301  );
2302 
2303  _status = fileName.serializeTo(
2304  _logBuff,
2305  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 240)
2306  );
2307  FW_ASSERT(
2308  _status == Fw::FW_SERIALIZE_OK,
2309  static_cast<FwAssertArgType>(_status)
2310  );
2311 
2312  this->logOut_out(
2313  0,
2314  _id,
2315  _logTime,
2317  _logBuff
2318  );
2319  }
2320 
2321  // Emit the event on the text log port
2322 #if FW_ENABLE_TEXT_LOGGING
2323  if (this->isConnected_logTextOut_OutputPort(0)) {
2324 #if FW_OBJECT_NAMES == 1
2325  const char* _formatString =
2326  "(%s) %s: Aborted after %" PRIu64 " of %" PRIu64 " bytes read to %s";
2327 #else
2328  const char* _formatString =
2329  "%s: Aborted after %" PRIu64 " of %" PRIu64 " bytes read to %s";
2330 #endif
2331 
2332  Fw::TextLogString _logString;
2333  (void) _logString.format(
2334  _formatString,
2335 #if FW_OBJECT_NAMES == 1
2336  this->m_objName.toChar(),
2337 #endif
2338  "ReadAborted ",
2339  bytesRead,
2340  readSize,
2341  fileName.toChar()
2342  );
2343 
2344  this->logTextOut_out(
2345  0,
2346  _id,
2347  _logTime,
2349  _logString
2350  );
2351  }
2352 #endif
2353  }
2354 
2357  FwSizeType bytesRead,
2358  FwSizeType readSize,
2359  const Fw::StringBase& fileName,
2360  U64 timeout
2361  ) const
2362  {
2363  // Get the time
2364  Fw::Time _logTime;
2365  if (this->isConnected_timeCaller_OutputPort(0)) {
2366  this->timeCaller_out(0, _logTime);
2367  }
2368 
2369  const FwEventIdType _id = this->getIdBase() + EVENTID_READTIMEOUT;
2370 
2371  // Emit the event on the log port
2372  if (this->isConnected_logOut_OutputPort(0)) {
2373  Fw::LogBuffer _logBuff;
2375 
2376 #if FW_AMPCS_COMPATIBLE
2377  // Serialize the number of arguments
2378  _status = _logBuff.serializeFrom(static_cast<U8>(4));
2379  FW_ASSERT(
2380  _status == Fw::FW_SERIALIZE_OK,
2381  static_cast<FwAssertArgType>(_status)
2382  );
2383 #endif
2384 
2385 #if FW_AMPCS_COMPATIBLE
2386  // Serialize the argument size
2387  _status = _logBuff.serializeFrom(
2388  static_cast<U8>(sizeof(FwSizeType))
2389  );
2390  FW_ASSERT(
2391  _status == Fw::FW_SERIALIZE_OK,
2392  static_cast<FwAssertArgType>(_status)
2393  );
2394 #endif
2395  _status = _logBuff.serializeFrom(bytesRead);
2396  FW_ASSERT(
2397  _status == Fw::FW_SERIALIZE_OK,
2398  static_cast<FwAssertArgType>(_status)
2399  );
2400 
2401 #if FW_AMPCS_COMPATIBLE
2402  // Serialize the argument size
2403  _status = _logBuff.serializeFrom(
2404  static_cast<U8>(sizeof(FwSizeType))
2405  );
2406  FW_ASSERT(
2407  _status == Fw::FW_SERIALIZE_OK,
2408  static_cast<FwAssertArgType>(_status)
2409  );
2410 #endif
2411  _status = _logBuff.serializeFrom(readSize);
2412  FW_ASSERT(
2413  _status == Fw::FW_SERIALIZE_OK,
2414  static_cast<FwAssertArgType>(_status)
2415  );
2416 
2417  _status = fileName.serializeTo(
2418  _logBuff,
2419  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 240)
2420  );
2421  FW_ASSERT(
2422  _status == Fw::FW_SERIALIZE_OK,
2423  static_cast<FwAssertArgType>(_status)
2424  );
2425 
2426 #if FW_AMPCS_COMPATIBLE
2427  // Serialize the argument size
2428  _status = _logBuff.serializeFrom(
2429  static_cast<U8>(sizeof(U64))
2430  );
2431  FW_ASSERT(
2432  _status == Fw::FW_SERIALIZE_OK,
2433  static_cast<FwAssertArgType>(_status)
2434  );
2435 #endif
2436  _status = _logBuff.serializeFrom(timeout);
2437  FW_ASSERT(
2438  _status == Fw::FW_SERIALIZE_OK,
2439  static_cast<FwAssertArgType>(_status)
2440  );
2441 
2442  this->logOut_out(
2443  0,
2444  _id,
2445  _logTime,
2447  _logBuff
2448  );
2449  }
2450 
2451  // Emit the event on the text log port
2452 #if FW_ENABLE_TEXT_LOGGING
2453  if (this->isConnected_logTextOut_OutputPort(0)) {
2454 #if FW_OBJECT_NAMES == 1
2455  const char* _formatString =
2456  "(%s) %s: Failed after %" PRIu64 " of %" PRIu64 " bytes read to %s after exceeding timeout of %" PRIu64 " microseconds";
2457 #else
2458  const char* _formatString =
2459  "%s: Failed after %" PRIu64 " of %" PRIu64 " bytes read to %s after exceeding timeout of %" PRIu64 " microseconds";
2460 #endif
2461 
2462  Fw::TextLogString _logString;
2463  (void) _logString.format(
2464  _formatString,
2465 #if FW_OBJECT_NAMES == 1
2466  this->m_objName.toChar(),
2467 #endif
2468  "ReadTimeout ",
2469  bytesRead,
2470  readSize,
2471  fileName.toChar(),
2472  timeout
2473  );
2474 
2475  this->logTextOut_out(
2476  0,
2477  _id,
2478  _logTime,
2480  _logString
2481  );
2482  }
2483 #endif
2484  }
2485 
2488  FwSizeType writeSize,
2489  const Fw::StringBase& fileName
2490  ) const
2491  {
2492  // Get the time
2493  Fw::Time _logTime;
2494  if (this->isConnected_timeCaller_OutputPort(0)) {
2495  this->timeCaller_out(0, _logTime);
2496  }
2497 
2498  const FwEventIdType _id = this->getIdBase() + EVENTID_WRITEBEGIN;
2499 
2500  // Emit the event on the log port
2501  if (this->isConnected_logOut_OutputPort(0)) {
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(
2531  _logBuff,
2532  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 240)
2533  );
2534  FW_ASSERT(
2535  _status == Fw::FW_SERIALIZE_OK,
2536  static_cast<FwAssertArgType>(_status)
2537  );
2538 
2539  this->logOut_out(
2540  0,
2541  _id,
2542  _logTime,
2544  _logBuff
2545  );
2546  }
2547 
2548  // Emit the event on the text log port
2549 #if FW_ENABLE_TEXT_LOGGING
2550  if (this->isConnected_logTextOut_OutputPort(0)) {
2551 #if FW_OBJECT_NAMES == 1
2552  const char* _formatString =
2553  "(%s) %s: Beginning write of size %" PRIu64 " to %s";
2554 #else
2555  const char* _formatString =
2556  "%s: Beginning write of size %" PRIu64 " to %s";
2557 #endif
2558 
2559  Fw::TextLogString _logString;
2560  (void) _logString.format(
2561  _formatString,
2562 #if FW_OBJECT_NAMES == 1
2563  this->m_objName.toChar(),
2564 #endif
2565  "WriteBegin ",
2566  writeSize,
2567  fileName.toChar()
2568  );
2569 
2570  this->logTextOut_out(
2571  0,
2572  _id,
2573  _logTime,
2575  _logString
2576  );
2577  }
2578 #endif
2579  }
2580 
2583  FwSizeType writeSize,
2584  const Fw::StringBase& fileName
2585  ) const
2586  {
2587  // Get the time
2588  Fw::Time _logTime;
2589  if (this->isConnected_timeCaller_OutputPort(0)) {
2590  this->timeCaller_out(0, _logTime);
2591  }
2592 
2593  const FwEventIdType _id = this->getIdBase() + EVENTID_WRITECOMPLETED;
2594 
2595  // Emit the event on the log port
2596  if (this->isConnected_logOut_OutputPort(0)) {
2597  Fw::LogBuffer _logBuff;
2599 
2600 #if FW_AMPCS_COMPATIBLE
2601  // Serialize the number of arguments
2602  _status = _logBuff.serializeFrom(static_cast<U8>(2));
2603  FW_ASSERT(
2604  _status == Fw::FW_SERIALIZE_OK,
2605  static_cast<FwAssertArgType>(_status)
2606  );
2607 #endif
2608 
2609 #if FW_AMPCS_COMPATIBLE
2610  // Serialize the argument size
2611  _status = _logBuff.serializeFrom(
2612  static_cast<U8>(sizeof(FwSizeType))
2613  );
2614  FW_ASSERT(
2615  _status == Fw::FW_SERIALIZE_OK,
2616  static_cast<FwAssertArgType>(_status)
2617  );
2618 #endif
2619  _status = _logBuff.serializeFrom(writeSize);
2620  FW_ASSERT(
2621  _status == Fw::FW_SERIALIZE_OK,
2622  static_cast<FwAssertArgType>(_status)
2623  );
2624 
2625  _status = fileName.serializeTo(
2626  _logBuff,
2627  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 240)
2628  );
2629  FW_ASSERT(
2630  _status == Fw::FW_SERIALIZE_OK,
2631  static_cast<FwAssertArgType>(_status)
2632  );
2633 
2634  this->logOut_out(
2635  0,
2636  _id,
2637  _logTime,
2639  _logBuff
2640  );
2641  }
2642 
2643  // Emit the event on the text log port
2644 #if FW_ENABLE_TEXT_LOGGING
2645  if (this->isConnected_logTextOut_OutputPort(0)) {
2646 #if FW_OBJECT_NAMES == 1
2647  const char* _formatString =
2648  "(%s) %s: Completed write of size %" PRIu64 " to %s";
2649 #else
2650  const char* _formatString =
2651  "%s: Completed write of size %" PRIu64 " to %s";
2652 #endif
2653 
2654  Fw::TextLogString _logString;
2655  (void) _logString.format(
2656  _formatString,
2657 #if FW_OBJECT_NAMES == 1
2658  this->m_objName.toChar(),
2659 #endif
2660  "WriteCompleted ",
2661  writeSize,
2662  fileName.toChar()
2663  );
2664 
2665  this->logTextOut_out(
2666  0,
2667  _id,
2668  _logTime,
2670  _logString
2671  );
2672  }
2673 #endif
2674  }
2675 
2678  FwSizeType bytesWritten,
2679  FwSizeType writeSize,
2680  const Fw::StringBase& fileName,
2681  I32 status
2682  )
2683  {
2684  // Get the time
2685  Fw::Time _logTime;
2686  if (this->isConnected_timeCaller_OutputPort(0)) {
2687  this->timeCaller_out(0, _logTime);
2688  }
2689 
2690  const FwEventIdType _id = this->getIdBase() + EVENTID_WRITEFILEERROR;
2691 
2692  // Check throttle value & throttle timeout
2693  {
2694  Os::ScopeLock scopedLock(this->m_eventLock);
2695 
2696  if (this->m_WriteFileErrorThrottle >= EVENTID_WRITEFILEERROR_THROTTLE) {
2697  // The counter has overflowed, check if time interval has passed
2698  if (Fw::TimeInterval(this->m_WriteFileErrorThrottleTime, _logTime) >= Fw::TimeInterval(10, 0)) {
2699  // Reset the count
2700  this->m_WriteFileErrorThrottle = 0;
2701  } else {
2702  // Throttle the event
2703  return;
2704  }
2705  }
2706 
2707  // Reset the throttle time if needed
2708  if (this->m_WriteFileErrorThrottle == 0) {
2709  // This is the first event, reset the throttle time
2710  this->m_WriteFileErrorThrottleTime = _logTime;
2711  }
2712 
2713  // Increment the count
2714  this->m_WriteFileErrorThrottle++;
2715  }
2716 
2717  // Emit the event on the log port
2718  if (this->isConnected_logOut_OutputPort(0)) {
2719  Fw::LogBuffer _logBuff;
2721 
2722 #if FW_AMPCS_COMPATIBLE
2723  // Serialize the number of arguments
2724  _status = _logBuff.serializeFrom(static_cast<U8>(4));
2725  FW_ASSERT(
2726  _status == Fw::FW_SERIALIZE_OK,
2727  static_cast<FwAssertArgType>(_status)
2728  );
2729 #endif
2730 
2731 #if FW_AMPCS_COMPATIBLE
2732  // Serialize the argument size
2733  _status = _logBuff.serializeFrom(
2734  static_cast<U8>(sizeof(FwSizeType))
2735  );
2736  FW_ASSERT(
2737  _status == Fw::FW_SERIALIZE_OK,
2738  static_cast<FwAssertArgType>(_status)
2739  );
2740 #endif
2741  _status = _logBuff.serializeFrom(bytesWritten);
2742  FW_ASSERT(
2743  _status == Fw::FW_SERIALIZE_OK,
2744  static_cast<FwAssertArgType>(_status)
2745  );
2746 
2747 #if FW_AMPCS_COMPATIBLE
2748  // Serialize the argument size
2749  _status = _logBuff.serializeFrom(
2750  static_cast<U8>(sizeof(FwSizeType))
2751  );
2752  FW_ASSERT(
2753  _status == Fw::FW_SERIALIZE_OK,
2754  static_cast<FwAssertArgType>(_status)
2755  );
2756 #endif
2757  _status = _logBuff.serializeFrom(writeSize);
2758  FW_ASSERT(
2759  _status == Fw::FW_SERIALIZE_OK,
2760  static_cast<FwAssertArgType>(_status)
2761  );
2762 
2763  _status = fileName.serializeTo(
2764  _logBuff,
2765  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 240)
2766  );
2767  FW_ASSERT(
2768  _status == Fw::FW_SERIALIZE_OK,
2769  static_cast<FwAssertArgType>(_status)
2770  );
2771 
2772 #if FW_AMPCS_COMPATIBLE
2773  // Serialize the argument size
2774  _status = _logBuff.serializeFrom(
2775  static_cast<U8>(sizeof(I32))
2776  );
2777  FW_ASSERT(
2778  _status == Fw::FW_SERIALIZE_OK,
2779  static_cast<FwAssertArgType>(_status)
2780  );
2781 #endif
2782  _status = _logBuff.serializeFrom(status);
2783  FW_ASSERT(
2784  _status == Fw::FW_SERIALIZE_OK,
2785  static_cast<FwAssertArgType>(_status)
2786  );
2787 
2788  this->logOut_out(
2789  0,
2790  _id,
2791  _logTime,
2793  _logBuff
2794  );
2795  }
2796 
2797  // Emit the event on the text log port
2798 #if FW_ENABLE_TEXT_LOGGING
2799  if (this->isConnected_logTextOut_OutputPort(0)) {
2800 #if FW_OBJECT_NAMES == 1
2801  const char* _formatString =
2802  "(%s) %s: Failed after %" PRIu64 " of %" PRIu64 " bytes written to %s with write status %" PRIi32 "";
2803 #else
2804  const char* _formatString =
2805  "%s: Failed after %" PRIu64 " of %" PRIu64 " bytes written to %s with write status %" PRIi32 "";
2806 #endif
2807 
2808  Fw::TextLogString _logString;
2809  (void) _logString.format(
2810  _formatString,
2811 #if FW_OBJECT_NAMES == 1
2812  this->m_objName.toChar(),
2813 #endif
2814  "WriteFileError ",
2815  bytesWritten,
2816  writeSize,
2817  fileName.toChar(),
2818  status
2819  );
2820 
2821  this->logTextOut_out(
2822  0,
2823  _id,
2824  _logTime,
2826  _logString
2827  );
2828  }
2829 #endif
2830  }
2831 
2834  const Fw::StringBase& hashFileName,
2835  I32 status
2836  )
2837  {
2838  // Get the time
2839  Fw::Time _logTime;
2840  if (this->isConnected_timeCaller_OutputPort(0)) {
2841  this->timeCaller_out(0, _logTime);
2842  }
2843 
2845 
2846  // Check throttle value & throttle timeout
2847  {
2848  Os::ScopeLock scopedLock(this->m_eventLock);
2849 
2850  if (this->m_WriteValidationOpenErrorThrottle >= EVENTID_WRITEVALIDATIONOPENERROR_THROTTLE) {
2851  // The counter has overflowed, check if time interval has passed
2852  if (Fw::TimeInterval(this->m_WriteValidationOpenErrorThrottleTime, _logTime) >= Fw::TimeInterval(10, 0)) {
2853  // Reset the count
2854  this->m_WriteValidationOpenErrorThrottle = 0;
2855  } else {
2856  // Throttle the event
2857  return;
2858  }
2859  }
2860 
2861  // Reset the throttle time if needed
2862  if (this->m_WriteValidationOpenErrorThrottle == 0) {
2863  // This is the first event, reset the throttle time
2864  this->m_WriteValidationOpenErrorThrottleTime = _logTime;
2865  }
2866 
2867  // Increment the count
2868  this->m_WriteValidationOpenErrorThrottle++;
2869  }
2870 
2871  // Emit the event on the log port
2872  if (this->isConnected_logOut_OutputPort(0)) {
2873  Fw::LogBuffer _logBuff;
2875 
2876 #if FW_AMPCS_COMPATIBLE
2877  // Serialize the number of arguments
2878  _status = _logBuff.serializeFrom(static_cast<U8>(2));
2879  FW_ASSERT(
2880  _status == Fw::FW_SERIALIZE_OK,
2881  static_cast<FwAssertArgType>(_status)
2882  );
2883 #endif
2884 
2885  _status = hashFileName.serializeTo(
2886  _logBuff,
2887  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 240)
2888  );
2889  FW_ASSERT(
2890  _status == Fw::FW_SERIALIZE_OK,
2891  static_cast<FwAssertArgType>(_status)
2892  );
2893 
2894 #if FW_AMPCS_COMPATIBLE
2895  // Serialize the argument size
2896  _status = _logBuff.serializeFrom(
2897  static_cast<U8>(sizeof(I32))
2898  );
2899  FW_ASSERT(
2900  _status == Fw::FW_SERIALIZE_OK,
2901  static_cast<FwAssertArgType>(_status)
2902  );
2903 #endif
2904  _status = _logBuff.serializeFrom(status);
2905  FW_ASSERT(
2906  _status == Fw::FW_SERIALIZE_OK,
2907  static_cast<FwAssertArgType>(_status)
2908  );
2909 
2910  this->logOut_out(
2911  0,
2912  _id,
2913  _logTime,
2915  _logBuff
2916  );
2917  }
2918 
2919  // Emit the event on the text log port
2920 #if FW_ENABLE_TEXT_LOGGING
2921  if (this->isConnected_logTextOut_OutputPort(0)) {
2922 #if FW_OBJECT_NAMES == 1
2923  const char* _formatString =
2924  "(%s) %s: Failed to open validation file %s with status %" PRIi32 "";
2925 #else
2926  const char* _formatString =
2927  "%s: Failed to open validation file %s with status %" PRIi32 "";
2928 #endif
2929 
2930  Fw::TextLogString _logString;
2931  (void) _logString.format(
2932  _formatString,
2933 #if FW_OBJECT_NAMES == 1
2934  this->m_objName.toChar(),
2935 #endif
2936  "WriteValidationOpenError ",
2937  hashFileName.toChar(),
2938  status
2939  );
2940 
2941  this->logTextOut_out(
2942  0,
2943  _id,
2944  _logTime,
2946  _logString
2947  );
2948  }
2949 #endif
2950  }
2951 
2954  const Fw::StringBase& hashFileName,
2955  I32 status
2956  )
2957  {
2958  // Get the time
2959  Fw::Time _logTime;
2960  if (this->isConnected_timeCaller_OutputPort(0)) {
2961  this->timeCaller_out(0, _logTime);
2962  }
2963 
2965 
2966  // Check throttle value & throttle timeout
2967  {
2968  Os::ScopeLock scopedLock(this->m_eventLock);
2969 
2970  if (this->m_WriteValidationReadErrorThrottle >= EVENTID_WRITEVALIDATIONREADERROR_THROTTLE) {
2971  // The counter has overflowed, check if time interval has passed
2972  if (Fw::TimeInterval(this->m_WriteValidationReadErrorThrottleTime, _logTime) >= Fw::TimeInterval(10, 0)) {
2973  // Reset the count
2974  this->m_WriteValidationReadErrorThrottle = 0;
2975  } else {
2976  // Throttle the event
2977  return;
2978  }
2979  }
2980 
2981  // Reset the throttle time if needed
2982  if (this->m_WriteValidationReadErrorThrottle == 0) {
2983  // This is the first event, reset the throttle time
2984  this->m_WriteValidationReadErrorThrottleTime = _logTime;
2985  }
2986 
2987  // Increment the count
2988  this->m_WriteValidationReadErrorThrottle++;
2989  }
2990 
2991  // Emit the event on the log port
2992  if (this->isConnected_logOut_OutputPort(0)) {
2993  Fw::LogBuffer _logBuff;
2995 
2996 #if FW_AMPCS_COMPATIBLE
2997  // Serialize the number of arguments
2998  _status = _logBuff.serializeFrom(static_cast<U8>(2));
2999  FW_ASSERT(
3000  _status == Fw::FW_SERIALIZE_OK,
3001  static_cast<FwAssertArgType>(_status)
3002  );
3003 #endif
3004 
3005  _status = hashFileName.serializeTo(
3006  _logBuff,
3007  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 240)
3008  );
3009  FW_ASSERT(
3010  _status == Fw::FW_SERIALIZE_OK,
3011  static_cast<FwAssertArgType>(_status)
3012  );
3013 
3014 #if FW_AMPCS_COMPATIBLE
3015  // Serialize the argument size
3016  _status = _logBuff.serializeFrom(
3017  static_cast<U8>(sizeof(I32))
3018  );
3019  FW_ASSERT(
3020  _status == Fw::FW_SERIALIZE_OK,
3021  static_cast<FwAssertArgType>(_status)
3022  );
3023 #endif
3024  _status = _logBuff.serializeFrom(status);
3025  FW_ASSERT(
3026  _status == Fw::FW_SERIALIZE_OK,
3027  static_cast<FwAssertArgType>(_status)
3028  );
3029 
3030  this->logOut_out(
3031  0,
3032  _id,
3033  _logTime,
3035  _logBuff
3036  );
3037  }
3038 
3039  // Emit the event on the text log port
3040 #if FW_ENABLE_TEXT_LOGGING
3041  if (this->isConnected_logTextOut_OutputPort(0)) {
3042 #if FW_OBJECT_NAMES == 1
3043  const char* _formatString =
3044  "(%s) %s: Failed to read validation file %s with status %" PRIi32 "";
3045 #else
3046  const char* _formatString =
3047  "%s: Failed to read validation file %s with status %" PRIi32 "";
3048 #endif
3049 
3050  Fw::TextLogString _logString;
3051  (void) _logString.format(
3052  _formatString,
3053 #if FW_OBJECT_NAMES == 1
3054  this->m_objName.toChar(),
3055 #endif
3056  "WriteValidationReadError ",
3057  hashFileName.toChar(),
3058  status
3059  );
3060 
3061  this->logTextOut_out(
3062  0,
3063  _id,
3064  _logTime,
3066  _logString
3067  );
3068  }
3069 #endif
3070  }
3071 
3074  const Fw::StringBase& hashFileName,
3075  FwSizeType bytesWritten,
3076  FwSizeType hashSize
3077  ) const
3078  {
3079  // Get the time
3080  Fw::Time _logTime;
3081  if (this->isConnected_timeCaller_OutputPort(0)) {
3082  this->timeCaller_out(0, _logTime);
3083  }
3084 
3086 
3087  // Emit the event on the log port
3088  if (this->isConnected_logOut_OutputPort(0)) {
3089  Fw::LogBuffer _logBuff;
3091 
3092 #if FW_AMPCS_COMPATIBLE
3093  // Serialize the number of arguments
3094  _status = _logBuff.serializeFrom(static_cast<U8>(3));
3095  FW_ASSERT(
3096  _status == Fw::FW_SERIALIZE_OK,
3097  static_cast<FwAssertArgType>(_status)
3098  );
3099 #endif
3100 
3101  _status = hashFileName.serializeTo(
3102  _logBuff,
3103  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 240)
3104  );
3105  FW_ASSERT(
3106  _status == Fw::FW_SERIALIZE_OK,
3107  static_cast<FwAssertArgType>(_status)
3108  );
3109 
3110 #if FW_AMPCS_COMPATIBLE
3111  // Serialize the argument size
3112  _status = _logBuff.serializeFrom(
3113  static_cast<U8>(sizeof(FwSizeType))
3114  );
3115  FW_ASSERT(
3116  _status == Fw::FW_SERIALIZE_OK,
3117  static_cast<FwAssertArgType>(_status)
3118  );
3119 #endif
3120  _status = _logBuff.serializeFrom(bytesWritten);
3121  FW_ASSERT(
3122  _status == Fw::FW_SERIALIZE_OK,
3123  static_cast<FwAssertArgType>(_status)
3124  );
3125 
3126 #if FW_AMPCS_COMPATIBLE
3127  // Serialize the argument size
3128  _status = _logBuff.serializeFrom(
3129  static_cast<U8>(sizeof(FwSizeType))
3130  );
3131  FW_ASSERT(
3132  _status == Fw::FW_SERIALIZE_OK,
3133  static_cast<FwAssertArgType>(_status)
3134  );
3135 #endif
3136  _status = _logBuff.serializeFrom(hashSize);
3137  FW_ASSERT(
3138  _status == Fw::FW_SERIALIZE_OK,
3139  static_cast<FwAssertArgType>(_status)
3140  );
3141 
3142  this->logOut_out(
3143  0,
3144  _id,
3145  _logTime,
3147  _logBuff
3148  );
3149  }
3150 
3151  // Emit the event on the text log port
3152 #if FW_ENABLE_TEXT_LOGGING
3153  if (this->isConnected_logTextOut_OutputPort(0)) {
3154 #if FW_OBJECT_NAMES == 1
3155  const char* _formatString =
3156  "(%s) %s: Failed to create hash file %s. Wrote %" PRIu64 " bytes when expected to write %" PRIu64 " bytes to hash file";
3157 #else
3158  const char* _formatString =
3159  "%s: Failed to create hash file %s. Wrote %" PRIu64 " bytes when expected to write %" PRIu64 " bytes to hash file";
3160 #endif
3161 
3162  Fw::TextLogString _logString;
3163  (void) _logString.format(
3164  _formatString,
3165 #if FW_OBJECT_NAMES == 1
3166  this->m_objName.toChar(),
3167 #endif
3168  "WriteValidationError ",
3169  hashFileName.toChar(),
3170  bytesWritten,
3171  hashSize
3172  );
3173 
3174  this->logTextOut_out(
3175  0,
3176  _id,
3177  _logTime,
3179  _logString
3180  );
3181  }
3182 #endif
3183  }
3184 
3187  FwSizeType bytesWritten,
3188  FwSizeType writeSize,
3189  const Fw::StringBase& fileName,
3190  U64 timeout
3191  ) const
3192  {
3193  // Get the time
3194  Fw::Time _logTime;
3195  if (this->isConnected_timeCaller_OutputPort(0)) {
3196  this->timeCaller_out(0, _logTime);
3197  }
3198 
3199  const FwEventIdType _id = this->getIdBase() + EVENTID_WRITETIMEOUT;
3200 
3201  // Emit the event on the log port
3202  if (this->isConnected_logOut_OutputPort(0)) {
3203  Fw::LogBuffer _logBuff;
3205 
3206 #if FW_AMPCS_COMPATIBLE
3207  // Serialize the number of arguments
3208  _status = _logBuff.serializeFrom(static_cast<U8>(4));
3209  FW_ASSERT(
3210  _status == Fw::FW_SERIALIZE_OK,
3211  static_cast<FwAssertArgType>(_status)
3212  );
3213 #endif
3214 
3215 #if FW_AMPCS_COMPATIBLE
3216  // Serialize the argument size
3217  _status = _logBuff.serializeFrom(
3218  static_cast<U8>(sizeof(FwSizeType))
3219  );
3220  FW_ASSERT(
3221  _status == Fw::FW_SERIALIZE_OK,
3222  static_cast<FwAssertArgType>(_status)
3223  );
3224 #endif
3225  _status = _logBuff.serializeFrom(bytesWritten);
3226  FW_ASSERT(
3227  _status == Fw::FW_SERIALIZE_OK,
3228  static_cast<FwAssertArgType>(_status)
3229  );
3230 
3231 #if FW_AMPCS_COMPATIBLE
3232  // Serialize the argument size
3233  _status = _logBuff.serializeFrom(
3234  static_cast<U8>(sizeof(FwSizeType))
3235  );
3236  FW_ASSERT(
3237  _status == Fw::FW_SERIALIZE_OK,
3238  static_cast<FwAssertArgType>(_status)
3239  );
3240 #endif
3241  _status = _logBuff.serializeFrom(writeSize);
3242  FW_ASSERT(
3243  _status == Fw::FW_SERIALIZE_OK,
3244  static_cast<FwAssertArgType>(_status)
3245  );
3246 
3247  _status = fileName.serializeTo(
3248  _logBuff,
3249  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 240)
3250  );
3251  FW_ASSERT(
3252  _status == Fw::FW_SERIALIZE_OK,
3253  static_cast<FwAssertArgType>(_status)
3254  );
3255 
3256 #if FW_AMPCS_COMPATIBLE
3257  // Serialize the argument size
3258  _status = _logBuff.serializeFrom(
3259  static_cast<U8>(sizeof(U64))
3260  );
3261  FW_ASSERT(
3262  _status == Fw::FW_SERIALIZE_OK,
3263  static_cast<FwAssertArgType>(_status)
3264  );
3265 #endif
3266  _status = _logBuff.serializeFrom(timeout);
3267  FW_ASSERT(
3268  _status == Fw::FW_SERIALIZE_OK,
3269  static_cast<FwAssertArgType>(_status)
3270  );
3271 
3272  this->logOut_out(
3273  0,
3274  _id,
3275  _logTime,
3277  _logBuff
3278  );
3279  }
3280 
3281  // Emit the event on the text log port
3282 #if FW_ENABLE_TEXT_LOGGING
3283  if (this->isConnected_logTextOut_OutputPort(0)) {
3284 #if FW_OBJECT_NAMES == 1
3285  const char* _formatString =
3286  "(%s) %s: Failed after %" PRIu64 " of %" PRIu64 " bytes written to %s after exceeding timeout of %" PRIu64 " microseconds";
3287 #else
3288  const char* _formatString =
3289  "%s: Failed after %" PRIu64 " of %" PRIu64 " bytes written to %s after exceeding timeout of %" PRIu64 " microseconds";
3290 #endif
3291 
3292  Fw::TextLogString _logString;
3293  (void) _logString.format(
3294  _formatString,
3295 #if FW_OBJECT_NAMES == 1
3296  this->m_objName.toChar(),
3297 #endif
3298  "WriteTimeout ",
3299  bytesWritten,
3300  writeSize,
3301  fileName.toChar(),
3302  timeout
3303  );
3304 
3305  this->logTextOut_out(
3306  0,
3307  _id,
3308  _logTime,
3310  _logString
3311  );
3312  }
3313 #endif
3314  }
3315 
3318  FwSizeType bytesWritten,
3319  FwSizeType writeSize,
3320  const Fw::StringBase& fileName
3321  ) const
3322  {
3323  // Get the time
3324  Fw::Time _logTime;
3325  if (this->isConnected_timeCaller_OutputPort(0)) {
3326  this->timeCaller_out(0, _logTime);
3327  }
3328 
3329  const FwEventIdType _id = this->getIdBase() + EVENTID_WRITEABORTED;
3330 
3331  // Emit the event on the log port
3332  if (this->isConnected_logOut_OutputPort(0)) {
3333  Fw::LogBuffer _logBuff;
3335 
3336 #if FW_AMPCS_COMPATIBLE
3337  // Serialize the number of arguments
3338  _status = _logBuff.serializeFrom(static_cast<U8>(3));
3339  FW_ASSERT(
3340  _status == Fw::FW_SERIALIZE_OK,
3341  static_cast<FwAssertArgType>(_status)
3342  );
3343 #endif
3344 
3345 #if FW_AMPCS_COMPATIBLE
3346  // Serialize the argument size
3347  _status = _logBuff.serializeFrom(
3348  static_cast<U8>(sizeof(FwSizeType))
3349  );
3350  FW_ASSERT(
3351  _status == Fw::FW_SERIALIZE_OK,
3352  static_cast<FwAssertArgType>(_status)
3353  );
3354 #endif
3355  _status = _logBuff.serializeFrom(bytesWritten);
3356  FW_ASSERT(
3357  _status == Fw::FW_SERIALIZE_OK,
3358  static_cast<FwAssertArgType>(_status)
3359  );
3360 
3361 #if FW_AMPCS_COMPATIBLE
3362  // Serialize the argument size
3363  _status = _logBuff.serializeFrom(
3364  static_cast<U8>(sizeof(FwSizeType))
3365  );
3366  FW_ASSERT(
3367  _status == Fw::FW_SERIALIZE_OK,
3368  static_cast<FwAssertArgType>(_status)
3369  );
3370 #endif
3371  _status = _logBuff.serializeFrom(writeSize);
3372  FW_ASSERT(
3373  _status == Fw::FW_SERIALIZE_OK,
3374  static_cast<FwAssertArgType>(_status)
3375  );
3376 
3377  _status = fileName.serializeTo(
3378  _logBuff,
3379  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 240)
3380  );
3381  FW_ASSERT(
3382  _status == Fw::FW_SERIALIZE_OK,
3383  static_cast<FwAssertArgType>(_status)
3384  );
3385 
3386  this->logOut_out(
3387  0,
3388  _id,
3389  _logTime,
3391  _logBuff
3392  );
3393  }
3394 
3395  // Emit the event on the text log port
3396 #if FW_ENABLE_TEXT_LOGGING
3397  if (this->isConnected_logTextOut_OutputPort(0)) {
3398 #if FW_OBJECT_NAMES == 1
3399  const char* _formatString =
3400  "(%s) %s: Aborted after %" PRIu64 " of %" PRIu64 " bytes written to %s";
3401 #else
3402  const char* _formatString =
3403  "%s: Aborted after %" PRIu64 " of %" PRIu64 " bytes written to %s";
3404 #endif
3405 
3406  Fw::TextLogString _logString;
3407  (void) _logString.format(
3408  _formatString,
3409 #if FW_OBJECT_NAMES == 1
3410  this->m_objName.toChar(),
3411 #endif
3412  "WriteAborted ",
3413  bytesWritten,
3414  writeSize,
3415  fileName.toChar()
3416  );
3417 
3418  this->logTextOut_out(
3419  0,
3420  _id,
3421  _logTime,
3423  _logString
3424  );
3425  }
3426 #endif
3427  }
3428 
3431  const Fw::StringBase& handler,
3432  const Fw::StringBase& issue
3433  ) const
3434  {
3435  // Get the time
3436  Fw::Time _logTime;
3437  if (this->isConnected_timeCaller_OutputPort(0)) {
3438  this->timeCaller_out(0, _logTime);
3439  }
3440 
3441  const FwEventIdType _id = this->getIdBase() + EVENTID_INVALIDINPUT;
3442 
3443  // Emit the event on the log port
3444  if (this->isConnected_logOut_OutputPort(0)) {
3445  Fw::LogBuffer _logBuff;
3447 
3448 #if FW_AMPCS_COMPATIBLE
3449  // Serialize the number of arguments
3450  _status = _logBuff.serializeFrom(static_cast<U8>(2));
3451  FW_ASSERT(
3452  _status == Fw::FW_SERIALIZE_OK,
3453  static_cast<FwAssertArgType>(_status)
3454  );
3455 #endif
3456 
3457  _status = handler.serializeTo(
3458  _logBuff,
3459  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 16)
3460  );
3461  FW_ASSERT(
3462  _status == Fw::FW_SERIALIZE_OK,
3463  static_cast<FwAssertArgType>(_status)
3464  );
3465 
3466  _status = issue.serializeTo(
3467  _logBuff,
3468  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 32)
3469  );
3470  FW_ASSERT(
3471  _status == Fw::FW_SERIALIZE_OK,
3472  static_cast<FwAssertArgType>(_status)
3473  );
3474 
3475  this->logOut_out(
3476  0,
3477  _id,
3478  _logTime,
3480  _logBuff
3481  );
3482  }
3483 
3484  // Emit the event on the text log port
3485 #if FW_ENABLE_TEXT_LOGGING
3486  if (this->isConnected_logTextOut_OutputPort(0)) {
3487 #if FW_OBJECT_NAMES == 1
3488  const char* _formatString =
3489  "(%s) %s: Invalid input in %s handler: %s";
3490 #else
3491  const char* _formatString =
3492  "%s: Invalid input in %s handler: %s";
3493 #endif
3494 
3495  Fw::TextLogString _logString;
3496  (void) _logString.format(
3497  _formatString,
3498 #if FW_OBJECT_NAMES == 1
3499  this->m_objName.toChar(),
3500 #endif
3501  "InvalidInput ",
3502  handler.toChar(),
3503  issue.toChar()
3504  );
3505 
3506  this->logTextOut_out(
3507  0,
3508  _id,
3509  _logTime,
3511  _logString
3512  );
3513  }
3514 #endif
3515  }
3516 
3517  // ----------------------------------------------------------------------
3518  // Event throttle reset functions
3519  // ----------------------------------------------------------------------
3520 
3523  {
3524  {
3525  Os::ScopeLock scopedLock(this->m_eventLock);
3526 
3527  // Reset throttle counter
3528  this->m_NotInIdleThrottle = 0;
3529 
3530  // Reset the throttle time
3531  this->m_NotInIdleThrottleTime = Fw::Time(0, 0);
3532  }
3533  }
3534 
3537  {
3538  {
3539  Os::ScopeLock scopedLock(this->m_eventLock);
3540 
3541  // Reset throttle counter
3542  this->m_CrcFailedThrottle = 0;
3543 
3544  // Reset the throttle time
3545  this->m_CrcFailedThrottleTime = Fw::Time(0, 0);
3546  }
3547  }
3548 
3551  {
3552  {
3553  Os::ScopeLock scopedLock(this->m_eventLock);
3554 
3555  // Reset throttle counter
3556  this->m_ReadFailedFileSizeThrottle = 0;
3557 
3558  // Reset the throttle time
3559  this->m_ReadFailedFileSizeThrottleTime = Fw::Time(0, 0);
3560  }
3561  }
3562 
3565  {
3566  {
3567  Os::ScopeLock scopedLock(this->m_eventLock);
3568 
3569  // Reset throttle counter
3570  this->m_OpenFileErrorThrottle = 0;
3571 
3572  // Reset the throttle time
3573  this->m_OpenFileErrorThrottleTime = Fw::Time(0, 0);
3574  }
3575  }
3576 
3579  {
3580  {
3581  Os::ScopeLock scopedLock(this->m_eventLock);
3582 
3583  // Reset throttle counter
3584  this->m_WriteFileErrorThrottle = 0;
3585 
3586  // Reset the throttle time
3587  this->m_WriteFileErrorThrottleTime = Fw::Time(0, 0);
3588  }
3589  }
3590 
3593  {
3594  {
3595  Os::ScopeLock scopedLock(this->m_eventLock);
3596 
3597  // Reset throttle counter
3598  this->m_WriteValidationOpenErrorThrottle = 0;
3599 
3600  // Reset the throttle time
3601  this->m_WriteValidationOpenErrorThrottleTime = Fw::Time(0, 0);
3602  }
3603  }
3604 
3607  {
3608  {
3609  Os::ScopeLock scopedLock(this->m_eventLock);
3610 
3611  // Reset throttle counter
3612  this->m_WriteValidationReadErrorThrottle = 0;
3613 
3614  // Reset the throttle time
3615  this->m_WriteValidationReadErrorThrottleTime = Fw::Time(0, 0);
3616  }
3617  }
3618 
3619  // ----------------------------------------------------------------------
3620  // Time
3621  // ----------------------------------------------------------------------
3622 
3624  getTime() const
3625  {
3626  if (this->isConnected_timeCaller_OutputPort(0)) {
3627  Fw::Time _time;
3628  this->timeCaller_out(0, _time);
3629  return _time;
3630  }
3631  else {
3632  return Fw::Time(TimeBase::TB_NONE, 0, 0);
3633  }
3634  }
3635 
3636  // ----------------------------------------------------------------------
3637  // Mutex operations for guarded ports
3638  //
3639  // You can override these operations to provide more sophisticated
3640  // synchronization
3641  // ----------------------------------------------------------------------
3642 
3645  {
3646  this->m_guardedPortMutex.lock();
3647  }
3648 
3651  {
3652  this->m_guardedPortMutex.unLock();
3653  }
3654 
3655  // ----------------------------------------------------------------------
3656  // Message dispatch functions
3657  // ----------------------------------------------------------------------
3658 
3659  Fw::QueuedComponentBase::MsgDispatchStatus FileWorkerComponentBase ::
3660  doDispatch()
3661  {
3662  ComponentIpcSerializableBuffer _msg;
3663  FwQueuePriorityType _priority = 0;
3664 
3665  Os::Queue::Status _msgStatus = this->m_queue.receive(
3666  _msg,
3668  _priority
3669  );
3670  FW_ASSERT(
3671  _msgStatus == Os::Queue::OP_OK,
3672  static_cast<FwAssertArgType>(_msgStatus)
3673  );
3674 
3675  // Reset to beginning of buffer
3676  _msg.resetDeser();
3677 
3678  FwEnumStoreType _desMsg = 0;
3679  Fw::SerializeStatus _deserStatus = _msg.deserializeTo(_desMsg);
3680  FW_ASSERT(
3681  _deserStatus == Fw::FW_SERIALIZE_OK,
3682  static_cast<FwAssertArgType>(_deserStatus)
3683  );
3684 
3685  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
3686 
3687  if (_msgType == FILEWORKER_COMPONENT_EXIT) {
3688  return MSG_DISPATCH_EXIT;
3689  }
3690 
3691  FwIndexType portNum = 0;
3692  _deserStatus = _msg.deserializeTo(portNum);
3693  FW_ASSERT(
3694  _deserStatus == Fw::FW_SERIALIZE_OK,
3695  static_cast<FwAssertArgType>(_deserStatus)
3696  );
3697 
3698  switch (_msgType) {
3699  // Handle async input port readIn
3700  case READIN_FILEREAD: {
3701  // Deserialize argument path
3702  char __fprime_ac_path_buffer[Fw::StringBase::BUFFER_SIZE(240)];
3703  Fw::ExternalString path(__fprime_ac_path_buffer, sizeof __fprime_ac_path_buffer);
3704  _deserStatus = _msg.deserializeTo(path);
3705  FW_ASSERT(
3706  _deserStatus == Fw::FW_SERIALIZE_OK,
3707  static_cast<FwAssertArgType>(_deserStatus)
3708  );
3709 
3710  // Deserialize argument buffer
3711  Fw::Buffer buffer;
3712  _deserStatus = _msg.deserializeTo(buffer);
3713  FW_ASSERT(
3714  _deserStatus == Fw::FW_SERIALIZE_OK,
3715  static_cast<FwAssertArgType>(_deserStatus)
3716  );
3717  // Call handler function
3718  this->readIn_handler(
3719  portNum,
3720  path,
3721  buffer
3722  );
3723 
3724  break;
3725  }
3726 
3727  // Handle async input port verifyIn
3728  case VERIFYIN_VERIFYSTATUS: {
3729  // Deserialize argument path
3730  char __fprime_ac_path_buffer[Fw::StringBase::BUFFER_SIZE(240)];
3731  Fw::ExternalString path(__fprime_ac_path_buffer, sizeof __fprime_ac_path_buffer);
3732  _deserStatus = _msg.deserializeTo(path);
3733  FW_ASSERT(
3734  _deserStatus == Fw::FW_SERIALIZE_OK,
3735  static_cast<FwAssertArgType>(_deserStatus)
3736  );
3737 
3738  // Deserialize argument crc
3739  U32 crc;
3740  _deserStatus = _msg.deserializeTo(crc);
3741  FW_ASSERT(
3742  _deserStatus == Fw::FW_SERIALIZE_OK,
3743  static_cast<FwAssertArgType>(_deserStatus)
3744  );
3745  // Call handler function
3746  this->verifyIn_handler(
3747  portNum,
3748  path,
3749  crc
3750  );
3751 
3752  break;
3753  }
3754 
3755  // Handle async input port writeIn
3756  case WRITEIN_FILEWRITE: {
3757  // Deserialize argument path
3758  char __fprime_ac_path_buffer[Fw::StringBase::BUFFER_SIZE(240)];
3759  Fw::ExternalString path(__fprime_ac_path_buffer, sizeof __fprime_ac_path_buffer);
3760  _deserStatus = _msg.deserializeTo(path);
3761  FW_ASSERT(
3762  _deserStatus == Fw::FW_SERIALIZE_OK,
3763  static_cast<FwAssertArgType>(_deserStatus)
3764  );
3765 
3766  // Deserialize argument buffer
3767  Fw::Buffer buffer;
3768  _deserStatus = _msg.deserializeTo(buffer);
3769  FW_ASSERT(
3770  _deserStatus == Fw::FW_SERIALIZE_OK,
3771  static_cast<FwAssertArgType>(_deserStatus)
3772  );
3773 
3774  // Deserialize argument offsetBytes
3775  FwSizeType offsetBytes;
3776  _deserStatus = _msg.deserializeTo(offsetBytes);
3777  FW_ASSERT(
3778  _deserStatus == Fw::FW_SERIALIZE_OK,
3779  static_cast<FwAssertArgType>(_deserStatus)
3780  );
3781 
3782  // Deserialize argument append
3783  bool append;
3784  _deserStatus = _msg.deserializeTo(append);
3785  FW_ASSERT(
3786  _deserStatus == Fw::FW_SERIALIZE_OK,
3787  static_cast<FwAssertArgType>(_deserStatus)
3788  );
3789  // Call handler function
3790  this->writeIn_handler(
3791  portNum,
3792  path,
3793  buffer,
3794  offsetBytes,
3795  append
3796  );
3797 
3798  break;
3799  }
3800 
3801  default:
3802  return MSG_DISPATCH_ERROR;
3803  }
3804 
3805  return MSG_DISPATCH_OK;
3806  }
3807 
3808  // ----------------------------------------------------------------------
3809  // Calls for messages received on special input ports
3810  // ----------------------------------------------------------------------
3811 
3812  void FileWorkerComponentBase ::
3813  m_p_cmdIn_in(
3814  Fw::PassiveComponentBase* callComp,
3815  FwIndexType portNum,
3816  FwOpcodeType opCode,
3817  U32 cmdSeq,
3818  Fw::CmdArgBuffer& args
3819  )
3820  {
3821  FW_ASSERT(callComp != nullptr);
3822  FileWorkerComponentBase* compPtr = static_cast<FileWorkerComponentBase*>(callComp);
3823  compPtr->cmdIn_handlerBase(
3824  portNum,
3825  opCode,
3826  cmdSeq,
3827  args
3828  );
3829  }
3830 
3831  // ----------------------------------------------------------------------
3832  // Calls for messages received on typed input ports
3833  // ----------------------------------------------------------------------
3834 
3835  void FileWorkerComponentBase ::
3836  m_p_cancelIn_in(
3837  Fw::PassiveComponentBase* callComp,
3838  FwIndexType portNum
3839  )
3840  {
3841  FW_ASSERT(callComp != nullptr);
3842  FileWorkerComponentBase* compPtr = static_cast<FileWorkerComponentBase*>(callComp);
3843  compPtr->cancelIn_handlerBase(portNum);
3844  }
3845 
3846  void FileWorkerComponentBase ::
3847  m_p_readIn_in(
3848  Fw::PassiveComponentBase* callComp,
3849  FwIndexType portNum,
3850  const Fw::StringBase& path,
3851  Fw::Buffer& buffer
3852  )
3853  {
3854  FW_ASSERT(callComp != nullptr);
3855  FileWorkerComponentBase* compPtr = static_cast<FileWorkerComponentBase*>(callComp);
3856  compPtr->readIn_handlerBase(
3857  portNum,
3858  path,
3859  buffer
3860  );
3861  }
3862 
3863  void FileWorkerComponentBase ::
3864  m_p_verifyIn_in(
3865  Fw::PassiveComponentBase* callComp,
3866  FwIndexType portNum,
3867  const Fw::StringBase& path,
3868  U32 crc
3869  )
3870  {
3871  FW_ASSERT(callComp != nullptr);
3872  FileWorkerComponentBase* compPtr = static_cast<FileWorkerComponentBase*>(callComp);
3873  compPtr->verifyIn_handlerBase(
3874  portNum,
3875  path,
3876  crc
3877  );
3878  }
3879 
3880  void FileWorkerComponentBase ::
3881  m_p_writeIn_in(
3882  Fw::PassiveComponentBase* callComp,
3883  FwIndexType portNum,
3884  const Fw::StringBase& path,
3885  Fw::Buffer& buffer,
3886  FwSizeType offsetBytes,
3887  bool append
3888  )
3889  {
3890  FW_ASSERT(callComp != nullptr);
3891  FileWorkerComponentBase* compPtr = static_cast<FileWorkerComponentBase*>(callComp);
3892  compPtr->writeIn_handlerBase(
3893  portNum,
3894  path,
3895  buffer,
3896  offsetBytes,
3897  append
3898  );
3899  }
3900 
3901 #if !FW_DIRECT_PORT_CALLS
3902 
3903  // ----------------------------------------------------------------------
3904  // Invocation functions for special output ports
3905  // ----------------------------------------------------------------------
3906 
3907  void FileWorkerComponentBase ::
3908  logOut_out(
3909  FwIndexType portNum,
3910  FwEventIdType id,
3911  Fw::Time& timeTag,
3912  const Fw::LogSeverity& severity,
3913  Fw::LogBuffer& args
3914  ) const
3915  {
3916  FW_ASSERT(
3917  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
3918  static_cast<FwAssertArgType>(portNum)
3919  );
3920 
3921  FW_ASSERT(
3922  this->m_logOut_OutputPort[portNum].isConnected(),
3923  static_cast<FwAssertArgType>(portNum)
3924  );
3925  this->m_logOut_OutputPort[portNum].invoke(
3926  id,
3927  timeTag,
3928  severity,
3929  args
3930  );
3931  }
3932 
3933 #if FW_ENABLE_TEXT_LOGGING
3934 
3935  void FileWorkerComponentBase ::
3936  logTextOut_out(
3937  FwIndexType portNum,
3938  FwEventIdType id,
3939  Fw::Time& timeTag,
3940  const Fw::LogSeverity& severity,
3941  Fw::TextLogString& text
3942  ) const
3943  {
3944  FW_ASSERT(
3945  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
3946  static_cast<FwAssertArgType>(portNum)
3947  );
3948 
3949  FW_ASSERT(
3950  this->m_logTextOut_OutputPort[portNum].isConnected(),
3951  static_cast<FwAssertArgType>(portNum)
3952  );
3953  this->m_logTextOut_OutputPort[portNum].invoke(
3954  id,
3955  timeTag,
3956  severity,
3957  text
3958  );
3959  }
3960 
3961 #endif
3962 
3963  void FileWorkerComponentBase ::
3964  timeCaller_out(
3965  FwIndexType portNum,
3966  Fw::Time& time
3967  ) const
3968  {
3969  FW_ASSERT(
3970  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
3971  static_cast<FwAssertArgType>(portNum)
3972  );
3973 
3974  FW_ASSERT(
3975  this->m_timeCaller_OutputPort[portNum].isConnected(),
3976  static_cast<FwAssertArgType>(portNum)
3977  );
3978  this->m_timeCaller_OutputPort[portNum].invoke(
3979  time
3980  );
3981  }
3982 
3983 #endif
3984 
3985 }
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:157
static constexpr FwIndexType getNum_verifyIn_InputPorts()
static constexpr FwSizeType CAPACITY
Definition: CmdPortAc.hpp:36
Completed the read operation and will return buffer.
Completed the write operation and will return buffer.
void log_WARNING_HI_ReadFailedFileSize(U32 fsStat)
void set_cmdRegOut_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to cmdRegOut[portNum].
bool isConnected_cmdRegOut_OutputPort(FwIndexType portNum) const
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:27
Error encountered while opening validation file.
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
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.
void log_WARNING_HI_WriteValidationReadError_ThrottleClear()
Reset throttle value for WriteValidationReadError.
message to exit active component task
static constexpr FwIndexType getNum_logOut_OutputPorts()
Svc::InputFileReadPort * get_readIn_InputPort(FwIndexType portNum)
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:89
Error encountered while creating validation file.
void log_WARNING_HI_WriteValidationOpenError(const Fw::StringBase &hashFileName, I32 status)
Completed the write operation and will return buffer.
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
bool isConnected_prmSetOut_OutputPort(FwIndexType portNum) const
virtual const CHAR * toChar() const =0
Convert to a C-style char*.
static constexpr FwSizeType CAPACITY
void log_WARNING_LO_ReadAborted(FwSizeType bytesRead, FwSizeType readSize, const Fw::StringBase &fileName) const
Received a buffer and initiating write operation.
void set_prmSetOut_OutputPort(FwIndexType portNum, Fw::InputPrmSetPort *port)
Connect port to prmSetOut[portNum].
Input VerifyStatus port.
void init()
Initialization function.
Definition: TlmPortAc.cpp:171
bool isConnected_readDoneOut_OutputPort(FwIndexType portNum) const
No time base has been established (Required)
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
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()
Os::Queue m_queue
queue object for active component
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:177
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
void log_WARNING_HI_InvalidInput(const Fw::StringBase &handler, const Fw::StringBase &issue) const
bool isConnected_timeCaller_OutputPort(FwIndexType portNum) const
SerializeStatus
forward declaration for string
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: CmdPortAc.cpp:95
Input FileRead port.
Message will block until space is available.
Definition: Queue.hpp:47
virtual void unLock()
Unlock the guarded mutex.
void log_ACTIVITY_LO_ReadCompleted(FwSizeType fileSize, const Fw::StringBase &fileName) const
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void writeDoneOut_out(FwIndexType portNum, U32 status, FwSizeType sizeBytes) const
Invoke output port writeDoneOut.
FwIdType FwEventIdType
The type of an event identifier.
Svc::InputFileWritePort * get_writeIn_InputPort(FwIndexType portNum)
bool isConnected_verifyDoneOut_OutputPort(FwIndexType portNum) const
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:40
void init()
Initialization function.
Definition: TimePortAc.cpp:151
static constexpr FwIndexType getNum_cmdResponseOut_OutputPorts()
Less important informational events.
Os::Queue::Status createQueue(FwSizeType depth, FwSizeType msgSize)
Invalid input arguments received on a port handler.
#define FW_MIN(a, b)
MIN macro (deprecated in C++, use std::min)
Definition: BasicTypes.h:99
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 connection.
Definition: TimePortAc.cpp:170
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)
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.
Error encountered while reading validation file.
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 verifyDoneOut_out(FwIndexType portNum, U32 status, FwSizeType sizeBytes) const
Invoke output port verifyDoneOut.
A string backed by an external buffer.
A serious but recoverable event.
Svc::InputCancelStatusPort * get_cancelIn_InputPort(FwIndexType portNum)
static constexpr FwSizeType CAPACITY
void set_writeDoneOut_OutputPort(FwIndexType portNum, Svc::InputSignalDonePort *port)
Connect port to writeDoneOut[portNum].
const char * toChar() const
Convert to a C-style char*.
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
Enum representing event severity.
void readDoneOut_out(FwIndexType portNum, U32 status, FwSizeType sizeBytes) const
Invoke output port readDoneOut.
#define PRI_FwIndexType
void cmdIn_handlerBase(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Handler base-class function for input port cmdIn.
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:58
void init()
Initialization function.
Definition: LogPortAc.cpp:180
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:54
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.
bool isConnected_tlmOut_OutputPort(FwIndexType portNum) const
void addCallPort(InputSignalDonePort *callPort)
Register an input port.
void log_WARNING_HI_WriteFileError_ThrottleClear()
Reset throttle value for WriteFileError.
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 connection.
Definition: LogPortAc.cpp:199
static constexpr FwIndexType getNum_cancelIn_InputPorts()
static constexpr FwSizeType CAPACITY
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
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:186
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:57
Svc::InputVerifyStatusPort * get_verifyIn_InputPort(FwIndexType portNum)
void invoke(U32 status, FwSizeType sizeBytes) const
Invoke a port connection.
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.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void init()
Initialization function.
FileWorkerComponentBase(const char *compName="")
Construct FileWorkerComponentBase object.
bool isConnected_logOut_OutputPort(FwIndexType portNum) const
bool isConnected_prmGetOut_OutputPort(FwIndexType portNum) const
virtual void verifyIn_preMsgHook(FwIndexType portNum, const Fw::StringBase &path, U32 crc)
Pre-message hook for async input port verifyIn.
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
bool isConnected_cmdResponseOut_OutputPort(FwIndexType portNum) const
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.
bool isConnected_writeDoneOut_OutputPort(FwIndexType portNum) const
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.
BYTE cmdPortSize[Fw::CmdPortBuffer::CAPACITY]