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