F´ Flight Software - C/C++ Documentation devel
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FileManagerComponentAc.cpp
Go to the documentation of this file.
1// ======================================================================
2// \title FileManagerComponentAc.cpp
3// \author Generated by fpp-to-cpp
4// \brief cpp file for FileManager component base class
5// ======================================================================
6
7#include <cstdio>
8
10#include "Fw/Types/Assert.hpp"
11#if FW_ENABLE_TEXT_LOGGING
12#include "Fw/Types/String.hpp"
13#endif
14
15namespace Svc {
16
17 namespace {
18 enum MsgTypeEnum {
19 FILEMANAGER_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT,
20 PINGIN_PING,
21 CMD_CREATEDIRECTORY,
22 CMD_MOVEFILE,
23 CMD_REMOVEDIRECTORY,
24 CMD_REMOVEFILE,
25 CMD_SHELLCOMMAND,
26 CMD_APPENDFILE,
27 CMD_FILESIZE,
28 };
29
30 // Get the max size by constructing a union of the async input, command, and
31 // internal port serialization sizes
32 union BuffUnion {
35 };
36
37 // Define a message buffer class large enough to handle all the
38 // asynchronous inputs to the component
39 class ComponentIpcSerializableBuffer :
41 {
42
43 public:
44
45 enum {
46 // Max. message size = size of data + message id + port
47 SERIALIZATION_SIZE =
48 sizeof(BuffUnion) +
49 sizeof(NATIVE_INT_TYPE) +
50 sizeof(NATIVE_INT_TYPE)
51 };
52
53 NATIVE_UINT_TYPE getBuffCapacity() const {
54 return sizeof(m_buff);
55 }
56
57 U8* getBuffAddr() {
58 return m_buff;
59 }
60
61 const U8* getBuffAddr() const {
62 return m_buff;
63 }
64
65 private:
66 // Should be the max of all the input ports serialized sizes...
67 U8 m_buff[SERIALIZATION_SIZE];
68
69 };
70 }
71
72 // ----------------------------------------------------------------------
73 // Component initialization
74 // ----------------------------------------------------------------------
75
76 void FileManagerComponentBase ::
77 init(
78 NATIVE_INT_TYPE queueDepth,
79 NATIVE_INT_TYPE instance
80 )
81 {
82 // Initialize base class
84
85 // Connect input port cmdIn
86 for (
87 PlatformIntType port = 0;
88 port < static_cast<PlatformIntType>(this->getNum_cmdIn_InputPorts());
89 port++
90 ) {
91 this->m_cmdIn_InputPort[port].init();
92 this->m_cmdIn_InputPort[port].addCallComp(
93 this,
94 m_p_cmdIn_in
95 );
96 this->m_cmdIn_InputPort[port].setPortNum(port);
97
98#if FW_OBJECT_NAMES == 1
99 // The port name consists of this->m_objName and some extra info.
100 // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
101 // However, the compiler may assume that this->m_objName fills
102 // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
103 // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
104 // bytes to cover the extra info.
105 char portName[2*FW_OBJ_NAME_MAX_SIZE];
106 (void) snprintf(
107 portName,
108 sizeof(portName),
109 "%s_cmdIn_InputPort[%" PRI_PlatformIntType "]",
110 this->m_objName,
111 port
112 );
113 this->m_cmdIn_InputPort[port].setObjName(portName);
114#endif
115 }
116
117 // Connect input port pingIn
118 for (
119 PlatformIntType port = 0;
120 port < static_cast<PlatformIntType>(this->getNum_pingIn_InputPorts());
121 port++
122 ) {
123 this->m_pingIn_InputPort[port].init();
124 this->m_pingIn_InputPort[port].addCallComp(
125 this,
126 m_p_pingIn_in
127 );
128 this->m_pingIn_InputPort[port].setPortNum(port);
129
130#if FW_OBJECT_NAMES == 1
131 // The port name consists of this->m_objName and some extra info.
132 // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
133 // However, the compiler may assume that this->m_objName fills
134 // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
135 // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
136 // bytes to cover the extra info.
137 char portName[2*FW_OBJ_NAME_MAX_SIZE];
138 (void) snprintf(
139 portName,
140 sizeof(portName),
141 "%s_pingIn_InputPort[%" PRI_PlatformIntType "]",
142 this->m_objName,
143 port
144 );
145 this->m_pingIn_InputPort[port].setObjName(portName);
146#endif
147 }
148
149#if FW_ENABLE_TEXT_LOGGING == 1
150 // Connect output port LogText
151 for (
152 PlatformIntType port = 0;
153 port < static_cast<PlatformIntType>(this->getNum_LogText_OutputPorts());
154 port++
155 ) {
156 this->m_LogText_OutputPort[port].init();
157
158#if FW_OBJECT_NAMES == 1
159 // The port name consists of this->m_objName and some extra info.
160 // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
161 // However, the compiler may assume that this->m_objName fills
162 // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
163 // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
164 // bytes to cover the extra info.
165 char portName[2*FW_OBJ_NAME_MAX_SIZE];
166 (void) snprintf(
167 portName,
168 sizeof(portName),
169 "%s_LogText_OutputPort[%" PRI_PlatformIntType "]",
170 this->m_objName,
171 port
172 );
173 this->m_LogText_OutputPort[port].setObjName(portName);
174#endif
175 }
176#endif
177
178 // Connect output port cmdRegOut
179 for (
180 PlatformIntType port = 0;
181 port < static_cast<PlatformIntType>(this->getNum_cmdRegOut_OutputPorts());
182 port++
183 ) {
184 this->m_cmdRegOut_OutputPort[port].init();
185
186#if FW_OBJECT_NAMES == 1
187 // The port name consists of this->m_objName and some extra info.
188 // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
189 // However, the compiler may assume that this->m_objName fills
190 // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
191 // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
192 // bytes to cover the extra info.
193 char portName[2*FW_OBJ_NAME_MAX_SIZE];
194 (void) snprintf(
195 portName,
196 sizeof(portName),
197 "%s_cmdRegOut_OutputPort[%" PRI_PlatformIntType "]",
198 this->m_objName,
199 port
200 );
201 this->m_cmdRegOut_OutputPort[port].setObjName(portName);
202#endif
203 }
204
205 // Connect output port cmdResponseOut
206 for (
207 PlatformIntType port = 0;
208 port < static_cast<PlatformIntType>(this->getNum_cmdResponseOut_OutputPorts());
209 port++
210 ) {
211 this->m_cmdResponseOut_OutputPort[port].init();
212
213#if FW_OBJECT_NAMES == 1
214 // The port name consists of this->m_objName and some extra info.
215 // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
216 // However, the compiler may assume that this->m_objName fills
217 // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
218 // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
219 // bytes to cover the extra info.
220 char portName[2*FW_OBJ_NAME_MAX_SIZE];
221 (void) snprintf(
222 portName,
223 sizeof(portName),
224 "%s_cmdResponseOut_OutputPort[%" PRI_PlatformIntType "]",
225 this->m_objName,
226 port
227 );
228 this->m_cmdResponseOut_OutputPort[port].setObjName(portName);
229#endif
230 }
231
232 // Connect output port eventOut
233 for (
234 PlatformIntType port = 0;
235 port < static_cast<PlatformIntType>(this->getNum_eventOut_OutputPorts());
236 port++
237 ) {
238 this->m_eventOut_OutputPort[port].init();
239
240#if FW_OBJECT_NAMES == 1
241 // The port name consists of this->m_objName and some extra info.
242 // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
243 // However, the compiler may assume that this->m_objName fills
244 // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
245 // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
246 // bytes to cover the extra info.
247 char portName[2*FW_OBJ_NAME_MAX_SIZE];
248 (void) snprintf(
249 portName,
250 sizeof(portName),
251 "%s_eventOut_OutputPort[%" PRI_PlatformIntType "]",
252 this->m_objName,
253 port
254 );
255 this->m_eventOut_OutputPort[port].setObjName(portName);
256#endif
257 }
258
259 // Connect output port timeCaller
260 for (
261 PlatformIntType port = 0;
262 port < static_cast<PlatformIntType>(this->getNum_timeCaller_OutputPorts());
263 port++
264 ) {
265 this->m_timeCaller_OutputPort[port].init();
266
267#if FW_OBJECT_NAMES == 1
268 // The port name consists of this->m_objName and some extra info.
269 // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
270 // However, the compiler may assume that this->m_objName fills
271 // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
272 // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
273 // bytes to cover the extra info.
274 char portName[2*FW_OBJ_NAME_MAX_SIZE];
275 (void) snprintf(
276 portName,
277 sizeof(portName),
278 "%s_timeCaller_OutputPort[%" PRI_PlatformIntType "]",
279 this->m_objName,
280 port
281 );
282 this->m_timeCaller_OutputPort[port].setObjName(portName);
283#endif
284 }
285
286 // Connect output port tlmOut
287 for (
288 PlatformIntType port = 0;
289 port < static_cast<PlatformIntType>(this->getNum_tlmOut_OutputPorts());
290 port++
291 ) {
292 this->m_tlmOut_OutputPort[port].init();
293
294#if FW_OBJECT_NAMES == 1
295 // The port name consists of this->m_objName and some extra info.
296 // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
297 // However, the compiler may assume that this->m_objName fills
298 // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
299 // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
300 // bytes to cover the extra info.
301 char portName[2*FW_OBJ_NAME_MAX_SIZE];
302 (void) snprintf(
303 portName,
304 sizeof(portName),
305 "%s_tlmOut_OutputPort[%" PRI_PlatformIntType "]",
306 this->m_objName,
307 port
308 );
309 this->m_tlmOut_OutputPort[port].setObjName(portName);
310#endif
311 }
312
313 // Connect output port pingOut
314 for (
315 PlatformIntType port = 0;
316 port < static_cast<PlatformIntType>(this->getNum_pingOut_OutputPorts());
317 port++
318 ) {
319 this->m_pingOut_OutputPort[port].init();
320
321#if FW_OBJECT_NAMES == 1
322 // The port name consists of this->m_objName and some extra info.
323 // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
324 // However, the compiler may assume that this->m_objName fills
325 // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
326 // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
327 // bytes to cover the extra info.
328 char portName[2*FW_OBJ_NAME_MAX_SIZE];
329 (void) snprintf(
330 portName,
331 sizeof(portName),
332 "%s_pingOut_OutputPort[%" PRI_PlatformIntType "]",
333 this->m_objName,
334 port
335 );
336 this->m_pingOut_OutputPort[port].setObjName(portName);
337#endif
338 }
339
340 Os::Queue::QueueStatus qStat = this->createQueue(
341 queueDepth,
342 ComponentIpcSerializableBuffer::SERIALIZATION_SIZE
343 );
344 FW_ASSERT(
345 Os::Queue::QUEUE_OK == qStat,
346 static_cast<FwAssertArgType>(qStat)
347 );
348 }
349
350 // ----------------------------------------------------------------------
351 // Getters for special input ports
352 // ----------------------------------------------------------------------
353
354 Fw::InputCmdPort* FileManagerComponentBase ::
355 get_cmdIn_InputPort(NATIVE_INT_TYPE portNum)
356 {
357 FW_ASSERT(
358 portNum < this->getNum_cmdIn_InputPorts(),
359 static_cast<FwAssertArgType>(portNum)
360 );
361
362 return &this->m_cmdIn_InputPort[portNum];
363 }
364
365 // ----------------------------------------------------------------------
366 // Getters for typed input ports
367 // ----------------------------------------------------------------------
368
369 Svc::InputPingPort* FileManagerComponentBase ::
370 get_pingIn_InputPort(NATIVE_INT_TYPE portNum)
371 {
372 FW_ASSERT(
373 portNum < this->getNum_pingIn_InputPorts(),
374 static_cast<FwAssertArgType>(portNum)
375 );
376
377 return &this->m_pingIn_InputPort[portNum];
378 }
379
380 // ----------------------------------------------------------------------
381 // Connect input ports to special output ports
382 // ----------------------------------------------------------------------
383
384#if FW_ENABLE_TEXT_LOGGING == 1
385
386 void FileManagerComponentBase ::
387 set_LogText_OutputPort(
388 NATIVE_INT_TYPE portNum,
390 )
391 {
392 FW_ASSERT(
393 portNum < this->getNum_LogText_OutputPorts(),
394 static_cast<FwAssertArgType>(portNum)
395 );
396
397 this->m_LogText_OutputPort[portNum].addCallPort(port);
398 }
399
400#endif
401
402 void FileManagerComponentBase ::
403 set_cmdRegOut_OutputPort(
404 NATIVE_INT_TYPE portNum,
406 )
407 {
408 FW_ASSERT(
409 portNum < this->getNum_cmdRegOut_OutputPorts(),
410 static_cast<FwAssertArgType>(portNum)
411 );
412
413 this->m_cmdRegOut_OutputPort[portNum].addCallPort(port);
414 }
415
416 void FileManagerComponentBase ::
417 set_cmdResponseOut_OutputPort(
418 NATIVE_INT_TYPE portNum,
420 )
421 {
422 FW_ASSERT(
423 portNum < this->getNum_cmdResponseOut_OutputPorts(),
424 static_cast<FwAssertArgType>(portNum)
425 );
426
427 this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port);
428 }
429
430 void FileManagerComponentBase ::
431 set_eventOut_OutputPort(
432 NATIVE_INT_TYPE portNum,
433 Fw::InputLogPort* port
434 )
435 {
436 FW_ASSERT(
437 portNum < this->getNum_eventOut_OutputPorts(),
438 static_cast<FwAssertArgType>(portNum)
439 );
440
441 this->m_eventOut_OutputPort[portNum].addCallPort(port);
442 }
443
444 void FileManagerComponentBase ::
445 set_timeCaller_OutputPort(
446 NATIVE_INT_TYPE portNum,
448 )
449 {
450 FW_ASSERT(
451 portNum < this->getNum_timeCaller_OutputPorts(),
452 static_cast<FwAssertArgType>(portNum)
453 );
454
455 this->m_timeCaller_OutputPort[portNum].addCallPort(port);
456 }
457
458 void FileManagerComponentBase ::
459 set_tlmOut_OutputPort(
460 NATIVE_INT_TYPE portNum,
461 Fw::InputTlmPort* port
462 )
463 {
464 FW_ASSERT(
465 portNum < this->getNum_tlmOut_OutputPorts(),
466 static_cast<FwAssertArgType>(portNum)
467 );
468
469 this->m_tlmOut_OutputPort[portNum].addCallPort(port);
470 }
471
472 // ----------------------------------------------------------------------
473 // Connect typed input ports to typed output ports
474 // ----------------------------------------------------------------------
475
476 void FileManagerComponentBase ::
477 set_pingOut_OutputPort(
478 NATIVE_INT_TYPE portNum,
480 )
481 {
482 FW_ASSERT(
483 portNum < this->getNum_pingOut_OutputPorts(),
484 static_cast<FwAssertArgType>(portNum)
485 );
486
487 this->m_pingOut_OutputPort[portNum].addCallPort(port);
488 }
489
490#if FW_PORT_SERIALIZATION
491
492 // ----------------------------------------------------------------------
493 // Connect serial input ports to special output ports
494 // ----------------------------------------------------------------------
495
496#if FW_ENABLE_TEXT_LOGGING == 1
497
498 void FileManagerComponentBase ::
499 set_LogText_OutputPort(
500 NATIVE_INT_TYPE portNum,
501 Fw::InputSerializePort* port
502 )
503 {
504 FW_ASSERT(
505 portNum < this->getNum_LogText_OutputPorts(),
506 static_cast<FwAssertArgType>(portNum)
507 );
508
509 this->m_LogText_OutputPort[portNum].registerSerialPort(port);
510 }
511
512#endif
513
514 void FileManagerComponentBase ::
515 set_cmdRegOut_OutputPort(
516 NATIVE_INT_TYPE portNum,
517 Fw::InputSerializePort* port
518 )
519 {
520 FW_ASSERT(
521 portNum < this->getNum_cmdRegOut_OutputPorts(),
522 static_cast<FwAssertArgType>(portNum)
523 );
524
525 this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port);
526 }
527
528 void FileManagerComponentBase ::
529 set_cmdResponseOut_OutputPort(
530 NATIVE_INT_TYPE portNum,
531 Fw::InputSerializePort* port
532 )
533 {
534 FW_ASSERT(
535 portNum < this->getNum_cmdResponseOut_OutputPorts(),
536 static_cast<FwAssertArgType>(portNum)
537 );
538
539 this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port);
540 }
541
542 void FileManagerComponentBase ::
543 set_eventOut_OutputPort(
544 NATIVE_INT_TYPE portNum,
545 Fw::InputSerializePort* port
546 )
547 {
548 FW_ASSERT(
549 portNum < this->getNum_eventOut_OutputPorts(),
550 static_cast<FwAssertArgType>(portNum)
551 );
552
553 this->m_eventOut_OutputPort[portNum].registerSerialPort(port);
554 }
555
556 void FileManagerComponentBase ::
557 set_timeCaller_OutputPort(
558 NATIVE_INT_TYPE portNum,
559 Fw::InputSerializePort* port
560 )
561 {
562 FW_ASSERT(
563 portNum < this->getNum_timeCaller_OutputPorts(),
564 static_cast<FwAssertArgType>(portNum)
565 );
566
567 this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
568 }
569
570 void FileManagerComponentBase ::
571 set_tlmOut_OutputPort(
572 NATIVE_INT_TYPE portNum,
573 Fw::InputSerializePort* port
574 )
575 {
576 FW_ASSERT(
577 portNum < this->getNum_tlmOut_OutputPorts(),
578 static_cast<FwAssertArgType>(portNum)
579 );
580
581 this->m_tlmOut_OutputPort[portNum].registerSerialPort(port);
582 }
583
584#endif
585
586#if FW_PORT_SERIALIZATION
587
588 // ----------------------------------------------------------------------
589 // Connect serial input ports to typed output ports
590 // ----------------------------------------------------------------------
591
592 void FileManagerComponentBase ::
593 set_pingOut_OutputPort(
594 NATIVE_INT_TYPE portNum,
595 Fw::InputSerializePort* port
596 )
597 {
598 FW_ASSERT(
599 portNum < this->getNum_pingOut_OutputPorts(),
600 static_cast<FwAssertArgType>(portNum)
601 );
602
603 this->m_pingOut_OutputPort[portNum].registerSerialPort(port);
604 }
605
606#endif
607
608 // ----------------------------------------------------------------------
609 // Command registration
610 // ----------------------------------------------------------------------
611
612 void FileManagerComponentBase ::
613 regCommands()
614 {
615 FW_ASSERT(this->m_cmdRegOut_OutputPort[0].isConnected());
616
617 this->m_cmdRegOut_OutputPort[0].invoke(
618 this->getIdBase() + OPCODE_CREATEDIRECTORY
619 );
620
621 this->m_cmdRegOut_OutputPort[0].invoke(
622 this->getIdBase() + OPCODE_MOVEFILE
623 );
624
625 this->m_cmdRegOut_OutputPort[0].invoke(
626 this->getIdBase() + OPCODE_REMOVEDIRECTORY
627 );
628
629 this->m_cmdRegOut_OutputPort[0].invoke(
630 this->getIdBase() + OPCODE_REMOVEFILE
631 );
632
633 this->m_cmdRegOut_OutputPort[0].invoke(
634 this->getIdBase() + OPCODE_SHELLCOMMAND
635 );
636
637 this->m_cmdRegOut_OutputPort[0].invoke(
638 this->getIdBase() + OPCODE_APPENDFILE
639 );
640
641 this->m_cmdRegOut_OutputPort[0].invoke(
642 this->getIdBase() + OPCODE_FILESIZE
643 );
644 }
645
646 // ----------------------------------------------------------------------
647 // Component construction and destruction
648 // ----------------------------------------------------------------------
649
650 FileManagerComponentBase ::
651 FileManagerComponentBase(const char* compName) :
652 Fw::ActiveComponentBase(compName)
653 {
654
655 }
656
657 FileManagerComponentBase ::
658 ~FileManagerComponentBase()
659 {
660
661 }
662
663 // ----------------------------------------------------------------------
664 // Getters for numbers of special input ports
665 // ----------------------------------------------------------------------
666
667 NATIVE_INT_TYPE FileManagerComponentBase ::
668 getNum_cmdIn_InputPorts() const
669 {
670 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_cmdIn_InputPort));
671 }
672
673 // ----------------------------------------------------------------------
674 // Getters for numbers of typed input ports
675 // ----------------------------------------------------------------------
676
677 NATIVE_INT_TYPE FileManagerComponentBase ::
678 getNum_pingIn_InputPorts() const
679 {
680 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_pingIn_InputPort));
681 }
682
683 // ----------------------------------------------------------------------
684 // Getters for numbers of special output ports
685 // ----------------------------------------------------------------------
686
687#if FW_ENABLE_TEXT_LOGGING == 1
688
689 NATIVE_INT_TYPE FileManagerComponentBase ::
690 getNum_LogText_OutputPorts() const
691 {
692 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_LogText_OutputPort));
693 }
694
695#endif
696
697 NATIVE_INT_TYPE FileManagerComponentBase ::
698 getNum_cmdRegOut_OutputPorts() const
699 {
700 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_cmdRegOut_OutputPort));
701 }
702
703 NATIVE_INT_TYPE FileManagerComponentBase ::
704 getNum_cmdResponseOut_OutputPorts() const
705 {
706 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_cmdResponseOut_OutputPort));
707 }
708
709 NATIVE_INT_TYPE FileManagerComponentBase ::
710 getNum_eventOut_OutputPorts() const
711 {
712 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_eventOut_OutputPort));
713 }
714
715 NATIVE_INT_TYPE FileManagerComponentBase ::
716 getNum_timeCaller_OutputPorts() const
717 {
718 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_timeCaller_OutputPort));
719 }
720
721 NATIVE_INT_TYPE FileManagerComponentBase ::
722 getNum_tlmOut_OutputPorts() const
723 {
724 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_tlmOut_OutputPort));
725 }
726
727 // ----------------------------------------------------------------------
728 // Getters for numbers of typed output ports
729 // ----------------------------------------------------------------------
730
731 NATIVE_INT_TYPE FileManagerComponentBase ::
732 getNum_pingOut_OutputPorts() const
733 {
734 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_pingOut_OutputPort));
735 }
736
737 // ----------------------------------------------------------------------
738 // Connection status queries for special output ports
739 // ----------------------------------------------------------------------
740
741#if FW_ENABLE_TEXT_LOGGING == 1
742
743 bool FileManagerComponentBase ::
744 isConnected_LogText_OutputPort(NATIVE_INT_TYPE portNum)
745 {
746 FW_ASSERT(
747 portNum < this->getNum_LogText_OutputPorts(),
748 static_cast<FwAssertArgType>(portNum)
749 );
750
751 return this->m_LogText_OutputPort[portNum].isConnected();
752 }
753
754#endif
755
756 bool FileManagerComponentBase ::
757 isConnected_cmdRegOut_OutputPort(NATIVE_INT_TYPE portNum)
758 {
759 FW_ASSERT(
760 portNum < this->getNum_cmdRegOut_OutputPorts(),
761 static_cast<FwAssertArgType>(portNum)
762 );
763
764 return this->m_cmdRegOut_OutputPort[portNum].isConnected();
765 }
766
767 bool FileManagerComponentBase ::
768 isConnected_cmdResponseOut_OutputPort(NATIVE_INT_TYPE portNum)
769 {
770 FW_ASSERT(
771 portNum < this->getNum_cmdResponseOut_OutputPorts(),
772 static_cast<FwAssertArgType>(portNum)
773 );
774
775 return this->m_cmdResponseOut_OutputPort[portNum].isConnected();
776 }
777
778 bool FileManagerComponentBase ::
779 isConnected_eventOut_OutputPort(NATIVE_INT_TYPE portNum)
780 {
781 FW_ASSERT(
782 portNum < this->getNum_eventOut_OutputPorts(),
783 static_cast<FwAssertArgType>(portNum)
784 );
785
786 return this->m_eventOut_OutputPort[portNum].isConnected();
787 }
788
789 bool FileManagerComponentBase ::
790 isConnected_timeCaller_OutputPort(NATIVE_INT_TYPE portNum)
791 {
792 FW_ASSERT(
793 portNum < this->getNum_timeCaller_OutputPorts(),
794 static_cast<FwAssertArgType>(portNum)
795 );
796
797 return this->m_timeCaller_OutputPort[portNum].isConnected();
798 }
799
800 bool FileManagerComponentBase ::
801 isConnected_tlmOut_OutputPort(NATIVE_INT_TYPE portNum)
802 {
803 FW_ASSERT(
804 portNum < this->getNum_tlmOut_OutputPorts(),
805 static_cast<FwAssertArgType>(portNum)
806 );
807
808 return this->m_tlmOut_OutputPort[portNum].isConnected();
809 }
810
811 // ----------------------------------------------------------------------
812 // Connection status queries for typed output ports
813 // ----------------------------------------------------------------------
814
815 bool FileManagerComponentBase ::
816 isConnected_pingOut_OutputPort(NATIVE_INT_TYPE portNum)
817 {
818 FW_ASSERT(
819 portNum < this->getNum_pingOut_OutputPorts(),
820 static_cast<FwAssertArgType>(portNum)
821 );
822
823 return this->m_pingOut_OutputPort[portNum].isConnected();
824 }
825
826 // ----------------------------------------------------------------------
827 // Port handler base-class functions for typed input ports
828 //
829 // Call these functions directly to bypass the corresponding ports
830 // ----------------------------------------------------------------------
831
832 void FileManagerComponentBase ::
833 pingIn_handlerBase(
834 NATIVE_INT_TYPE portNum,
835 U32 key
836 )
837 {
838 // Make sure port number is valid
839 FW_ASSERT(
840 portNum < this->getNum_pingIn_InputPorts(),
841 static_cast<FwAssertArgType>(portNum)
842 );
843
844 // Call pre-message hook
845 pingIn_preMsgHook(
846 portNum,
847 key
848 );
849 ComponentIpcSerializableBuffer msg;
851
852 // Serialize message ID
853 _status = msg.serialize(
854 static_cast<NATIVE_INT_TYPE>(PINGIN_PING)
855 );
856 FW_ASSERT(
857 _status == Fw::FW_SERIALIZE_OK,
858 static_cast<FwAssertArgType>(_status)
859 );
860
861 // Serialize port number
862 _status = msg.serialize(portNum);
863 FW_ASSERT(
864 _status == Fw::FW_SERIALIZE_OK,
865 static_cast<FwAssertArgType>(_status)
866 );
867
868 // Serialize argument key
869 _status = msg.serialize(key);
870 FW_ASSERT(
871 _status == Fw::FW_SERIALIZE_OK,
872 static_cast<FwAssertArgType>(_status)
873 );
874
875 // Send message
877 Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
878
879 FW_ASSERT(
880 qStatus == Os::Queue::QUEUE_OK,
881 static_cast<FwAssertArgType>(qStatus)
882 );
883 }
884
885 // ----------------------------------------------------------------------
886 // Pre-message hooks for typed async input ports
887 //
888 // Each of these functions is invoked just before processing a message
889 // on the corresponding port. By default, they do nothing. You can
890 // override them to provide specific pre-message behavior.
891 // ----------------------------------------------------------------------
892
893 void FileManagerComponentBase ::
894 pingIn_preMsgHook(
895 NATIVE_INT_TYPE portNum,
896 U32 key
897 )
898 {
899 // Default: no-op
900 }
901
902 // ----------------------------------------------------------------------
903 // Invocation functions for typed output ports
904 // ----------------------------------------------------------------------
905
906 void FileManagerComponentBase ::
907 pingOut_out(
908 NATIVE_INT_TYPE portNum,
909 U32 key
910 )
911 {
912 FW_ASSERT(
913 portNum < this->getNum_pingOut_OutputPorts(),
914 static_cast<FwAssertArgType>(portNum)
915 );
916 this->m_pingOut_OutputPort[portNum].invoke(
917 key
918 );
919 }
920
921 // ----------------------------------------------------------------------
922 // Command response
923 // ----------------------------------------------------------------------
924
925 void FileManagerComponentBase ::
926 cmdResponse_out(
927 FwOpcodeType opCode,
928 U32 cmdSeq,
929 Fw::CmdResponse response
930 )
931 {
932 FW_ASSERT(this->m_cmdResponseOut_OutputPort[0].isConnected());
933 this->m_cmdResponseOut_OutputPort[0].invoke(opCode, cmdSeq, response);
934 }
935
936 // ----------------------------------------------------------------------
937 // Command handler base-class functions
938 //
939 // Call these functions directly to bypass the command input port
940 // ----------------------------------------------------------------------
941
942 void FileManagerComponentBase ::
943 CreateDirectory_cmdHandlerBase(
944 FwOpcodeType opCode,
945 U32 cmdSeq,
946 Fw::CmdArgBuffer& args
947 )
948 {
949 // Call pre-message hook
950 this->CreateDirectory_preMsgHook(opCode,cmdSeq);
951
952 // Defer deserializing arguments to the message dispatcher
953 // to avoid deserializing and reserializing just for IPC
954 ComponentIpcSerializableBuffer msg;
956
957 // Serialize for IPC
958 _status = msg.serialize(static_cast<NATIVE_INT_TYPE>(CMD_CREATEDIRECTORY));
959 FW_ASSERT (
960 _status == Fw::FW_SERIALIZE_OK,
961 static_cast<FwAssertArgType>(_status)
962 );
963
964 // Fake port number to make message dequeue work
965 NATIVE_INT_TYPE port = 0;
966
967 _status = msg.serialize(port);
968 FW_ASSERT (
969 _status == Fw::FW_SERIALIZE_OK,
970 static_cast<FwAssertArgType>(_status)
971 );
972
973 _status = msg.serialize(opCode);
974 FW_ASSERT (
975 _status == Fw::FW_SERIALIZE_OK,
976 static_cast<FwAssertArgType>(_status)
977 );
978
979 _status = msg.serialize(cmdSeq);
980 FW_ASSERT (
981 _status == Fw::FW_SERIALIZE_OK,
982 static_cast<FwAssertArgType>(_status)
983 );
984
985 _status = msg.serialize(args);
986 FW_ASSERT (
987 _status == Fw::FW_SERIALIZE_OK,
988 static_cast<FwAssertArgType>(_status)
989 );
990
991 // Send message
993 Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
994
995 FW_ASSERT(
996 qStatus == Os::Queue::QUEUE_OK,
997 static_cast<FwAssertArgType>(qStatus)
998 );
999 }
1000
1001 void FileManagerComponentBase ::
1002 MoveFile_cmdHandlerBase(
1003 FwOpcodeType opCode,
1004 U32 cmdSeq,
1005 Fw::CmdArgBuffer& args
1006 )
1007 {
1008 // Call pre-message hook
1009 this->MoveFile_preMsgHook(opCode,cmdSeq);
1010
1011 // Defer deserializing arguments to the message dispatcher
1012 // to avoid deserializing and reserializing just for IPC
1013 ComponentIpcSerializableBuffer msg;
1015
1016 // Serialize for IPC
1017 _status = msg.serialize(static_cast<NATIVE_INT_TYPE>(CMD_MOVEFILE));
1018 FW_ASSERT (
1019 _status == Fw::FW_SERIALIZE_OK,
1020 static_cast<FwAssertArgType>(_status)
1021 );
1022
1023 // Fake port number to make message dequeue work
1024 NATIVE_INT_TYPE port = 0;
1025
1026 _status = msg.serialize(port);
1027 FW_ASSERT (
1028 _status == Fw::FW_SERIALIZE_OK,
1029 static_cast<FwAssertArgType>(_status)
1030 );
1031
1032 _status = msg.serialize(opCode);
1033 FW_ASSERT (
1034 _status == Fw::FW_SERIALIZE_OK,
1035 static_cast<FwAssertArgType>(_status)
1036 );
1037
1038 _status = msg.serialize(cmdSeq);
1039 FW_ASSERT (
1040 _status == Fw::FW_SERIALIZE_OK,
1041 static_cast<FwAssertArgType>(_status)
1042 );
1043
1044 _status = msg.serialize(args);
1045 FW_ASSERT (
1046 _status == Fw::FW_SERIALIZE_OK,
1047 static_cast<FwAssertArgType>(_status)
1048 );
1049
1050 // Send message
1052 Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
1053
1054 FW_ASSERT(
1055 qStatus == Os::Queue::QUEUE_OK,
1056 static_cast<FwAssertArgType>(qStatus)
1057 );
1058 }
1059
1060 void FileManagerComponentBase ::
1061 RemoveDirectory_cmdHandlerBase(
1062 FwOpcodeType opCode,
1063 U32 cmdSeq,
1064 Fw::CmdArgBuffer& args
1065 )
1066 {
1067 // Call pre-message hook
1068 this->RemoveDirectory_preMsgHook(opCode,cmdSeq);
1069
1070 // Defer deserializing arguments to the message dispatcher
1071 // to avoid deserializing and reserializing just for IPC
1072 ComponentIpcSerializableBuffer msg;
1074
1075 // Serialize for IPC
1076 _status = msg.serialize(static_cast<NATIVE_INT_TYPE>(CMD_REMOVEDIRECTORY));
1077 FW_ASSERT (
1078 _status == Fw::FW_SERIALIZE_OK,
1079 static_cast<FwAssertArgType>(_status)
1080 );
1081
1082 // Fake port number to make message dequeue work
1083 NATIVE_INT_TYPE port = 0;
1084
1085 _status = msg.serialize(port);
1086 FW_ASSERT (
1087 _status == Fw::FW_SERIALIZE_OK,
1088 static_cast<FwAssertArgType>(_status)
1089 );
1090
1091 _status = msg.serialize(opCode);
1092 FW_ASSERT (
1093 _status == Fw::FW_SERIALIZE_OK,
1094 static_cast<FwAssertArgType>(_status)
1095 );
1096
1097 _status = msg.serialize(cmdSeq);
1098 FW_ASSERT (
1099 _status == Fw::FW_SERIALIZE_OK,
1100 static_cast<FwAssertArgType>(_status)
1101 );
1102
1103 _status = msg.serialize(args);
1104 FW_ASSERT (
1105 _status == Fw::FW_SERIALIZE_OK,
1106 static_cast<FwAssertArgType>(_status)
1107 );
1108
1109 // Send message
1111 Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
1112
1113 FW_ASSERT(
1114 qStatus == Os::Queue::QUEUE_OK,
1115 static_cast<FwAssertArgType>(qStatus)
1116 );
1117 }
1118
1119 void FileManagerComponentBase ::
1120 RemoveFile_cmdHandlerBase(
1121 FwOpcodeType opCode,
1122 U32 cmdSeq,
1123 Fw::CmdArgBuffer& args
1124 )
1125 {
1126 // Call pre-message hook
1127 this->RemoveFile_preMsgHook(opCode,cmdSeq);
1128
1129 // Defer deserializing arguments to the message dispatcher
1130 // to avoid deserializing and reserializing just for IPC
1131 ComponentIpcSerializableBuffer msg;
1133
1134 // Serialize for IPC
1135 _status = msg.serialize(static_cast<NATIVE_INT_TYPE>(CMD_REMOVEFILE));
1136 FW_ASSERT (
1137 _status == Fw::FW_SERIALIZE_OK,
1138 static_cast<FwAssertArgType>(_status)
1139 );
1140
1141 // Fake port number to make message dequeue work
1142 NATIVE_INT_TYPE port = 0;
1143
1144 _status = msg.serialize(port);
1145 FW_ASSERT (
1146 _status == Fw::FW_SERIALIZE_OK,
1147 static_cast<FwAssertArgType>(_status)
1148 );
1149
1150 _status = msg.serialize(opCode);
1151 FW_ASSERT (
1152 _status == Fw::FW_SERIALIZE_OK,
1153 static_cast<FwAssertArgType>(_status)
1154 );
1155
1156 _status = msg.serialize(cmdSeq);
1157 FW_ASSERT (
1158 _status == Fw::FW_SERIALIZE_OK,
1159 static_cast<FwAssertArgType>(_status)
1160 );
1161
1162 _status = msg.serialize(args);
1163 FW_ASSERT (
1164 _status == Fw::FW_SERIALIZE_OK,
1165 static_cast<FwAssertArgType>(_status)
1166 );
1167
1168 // Send message
1170 Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
1171
1172 FW_ASSERT(
1173 qStatus == Os::Queue::QUEUE_OK,
1174 static_cast<FwAssertArgType>(qStatus)
1175 );
1176 }
1177
1178 void FileManagerComponentBase ::
1179 ShellCommand_cmdHandlerBase(
1180 FwOpcodeType opCode,
1181 U32 cmdSeq,
1182 Fw::CmdArgBuffer& args
1183 )
1184 {
1185 // Call pre-message hook
1186 this->ShellCommand_preMsgHook(opCode,cmdSeq);
1187
1188 // Defer deserializing arguments to the message dispatcher
1189 // to avoid deserializing and reserializing just for IPC
1190 ComponentIpcSerializableBuffer msg;
1192
1193 // Serialize for IPC
1194 _status = msg.serialize(static_cast<NATIVE_INT_TYPE>(CMD_SHELLCOMMAND));
1195 FW_ASSERT (
1196 _status == Fw::FW_SERIALIZE_OK,
1197 static_cast<FwAssertArgType>(_status)
1198 );
1199
1200 // Fake port number to make message dequeue work
1201 NATIVE_INT_TYPE port = 0;
1202
1203 _status = msg.serialize(port);
1204 FW_ASSERT (
1205 _status == Fw::FW_SERIALIZE_OK,
1206 static_cast<FwAssertArgType>(_status)
1207 );
1208
1209 _status = msg.serialize(opCode);
1210 FW_ASSERT (
1211 _status == Fw::FW_SERIALIZE_OK,
1212 static_cast<FwAssertArgType>(_status)
1213 );
1214
1215 _status = msg.serialize(cmdSeq);
1216 FW_ASSERT (
1217 _status == Fw::FW_SERIALIZE_OK,
1218 static_cast<FwAssertArgType>(_status)
1219 );
1220
1221 _status = msg.serialize(args);
1222 FW_ASSERT (
1223 _status == Fw::FW_SERIALIZE_OK,
1224 static_cast<FwAssertArgType>(_status)
1225 );
1226
1227 // Send message
1229 Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
1230
1231 FW_ASSERT(
1232 qStatus == Os::Queue::QUEUE_OK,
1233 static_cast<FwAssertArgType>(qStatus)
1234 );
1235 }
1236
1237 void FileManagerComponentBase ::
1238 AppendFile_cmdHandlerBase(
1239 FwOpcodeType opCode,
1240 U32 cmdSeq,
1241 Fw::CmdArgBuffer& args
1242 )
1243 {
1244 // Call pre-message hook
1245 this->AppendFile_preMsgHook(opCode,cmdSeq);
1246
1247 // Defer deserializing arguments to the message dispatcher
1248 // to avoid deserializing and reserializing just for IPC
1249 ComponentIpcSerializableBuffer msg;
1251
1252 // Serialize for IPC
1253 _status = msg.serialize(static_cast<NATIVE_INT_TYPE>(CMD_APPENDFILE));
1254 FW_ASSERT (
1255 _status == Fw::FW_SERIALIZE_OK,
1256 static_cast<FwAssertArgType>(_status)
1257 );
1258
1259 // Fake port number to make message dequeue work
1260 NATIVE_INT_TYPE port = 0;
1261
1262 _status = msg.serialize(port);
1263 FW_ASSERT (
1264 _status == Fw::FW_SERIALIZE_OK,
1265 static_cast<FwAssertArgType>(_status)
1266 );
1267
1268 _status = msg.serialize(opCode);
1269 FW_ASSERT (
1270 _status == Fw::FW_SERIALIZE_OK,
1271 static_cast<FwAssertArgType>(_status)
1272 );
1273
1274 _status = msg.serialize(cmdSeq);
1275 FW_ASSERT (
1276 _status == Fw::FW_SERIALIZE_OK,
1277 static_cast<FwAssertArgType>(_status)
1278 );
1279
1280 _status = msg.serialize(args);
1281 FW_ASSERT (
1282 _status == Fw::FW_SERIALIZE_OK,
1283 static_cast<FwAssertArgType>(_status)
1284 );
1285
1286 // Send message
1288 Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
1289
1290 FW_ASSERT(
1291 qStatus == Os::Queue::QUEUE_OK,
1292 static_cast<FwAssertArgType>(qStatus)
1293 );
1294 }
1295
1296 void FileManagerComponentBase ::
1297 FileSize_cmdHandlerBase(
1298 FwOpcodeType opCode,
1299 U32 cmdSeq,
1300 Fw::CmdArgBuffer& args
1301 )
1302 {
1303 // Call pre-message hook
1304 this->FileSize_preMsgHook(opCode,cmdSeq);
1305
1306 // Defer deserializing arguments to the message dispatcher
1307 // to avoid deserializing and reserializing just for IPC
1308 ComponentIpcSerializableBuffer msg;
1310
1311 // Serialize for IPC
1312 _status = msg.serialize(static_cast<NATIVE_INT_TYPE>(CMD_FILESIZE));
1313 FW_ASSERT (
1314 _status == Fw::FW_SERIALIZE_OK,
1315 static_cast<FwAssertArgType>(_status)
1316 );
1317
1318 // Fake port number to make message dequeue work
1319 NATIVE_INT_TYPE port = 0;
1320
1321 _status = msg.serialize(port);
1322 FW_ASSERT (
1323 _status == Fw::FW_SERIALIZE_OK,
1324 static_cast<FwAssertArgType>(_status)
1325 );
1326
1327 _status = msg.serialize(opCode);
1328 FW_ASSERT (
1329 _status == Fw::FW_SERIALIZE_OK,
1330 static_cast<FwAssertArgType>(_status)
1331 );
1332
1333 _status = msg.serialize(cmdSeq);
1334 FW_ASSERT (
1335 _status == Fw::FW_SERIALIZE_OK,
1336 static_cast<FwAssertArgType>(_status)
1337 );
1338
1339 _status = msg.serialize(args);
1340 FW_ASSERT (
1341 _status == Fw::FW_SERIALIZE_OK,
1342 static_cast<FwAssertArgType>(_status)
1343 );
1344
1345 // Send message
1347 Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
1348
1349 FW_ASSERT(
1350 qStatus == Os::Queue::QUEUE_OK,
1351 static_cast<FwAssertArgType>(qStatus)
1352 );
1353 }
1354
1355 // ----------------------------------------------------------------------
1356 // Pre-message hooks for async commands
1357 //
1358 // Each of these functions is invoked just before processing the
1359 // corresponding command. By default they do nothing. You can
1360 // override them to provide specific pre-command behavior.
1361 // ----------------------------------------------------------------------
1362
1363 void FileManagerComponentBase ::
1364 CreateDirectory_preMsgHook(
1365 FwOpcodeType opCode,
1366 U32 cmdSeq
1367 )
1368 {
1369 // Defaults to no-op; can be overridden
1370 (void) opCode;
1371 (void) cmdSeq;
1372 }
1373
1374 void FileManagerComponentBase ::
1375 MoveFile_preMsgHook(
1376 FwOpcodeType opCode,
1377 U32 cmdSeq
1378 )
1379 {
1380 // Defaults to no-op; can be overridden
1381 (void) opCode;
1382 (void) cmdSeq;
1383 }
1384
1385 void FileManagerComponentBase ::
1386 RemoveDirectory_preMsgHook(
1387 FwOpcodeType opCode,
1388 U32 cmdSeq
1389 )
1390 {
1391 // Defaults to no-op; can be overridden
1392 (void) opCode;
1393 (void) cmdSeq;
1394 }
1395
1396 void FileManagerComponentBase ::
1397 RemoveFile_preMsgHook(
1398 FwOpcodeType opCode,
1399 U32 cmdSeq
1400 )
1401 {
1402 // Defaults to no-op; can be overridden
1403 (void) opCode;
1404 (void) cmdSeq;
1405 }
1406
1407 void FileManagerComponentBase ::
1408 ShellCommand_preMsgHook(
1409 FwOpcodeType opCode,
1410 U32 cmdSeq
1411 )
1412 {
1413 // Defaults to no-op; can be overridden
1414 (void) opCode;
1415 (void) cmdSeq;
1416 }
1417
1418 void FileManagerComponentBase ::
1419 AppendFile_preMsgHook(
1420 FwOpcodeType opCode,
1421 U32 cmdSeq
1422 )
1423 {
1424 // Defaults to no-op; can be overridden
1425 (void) opCode;
1426 (void) cmdSeq;
1427 }
1428
1429 void FileManagerComponentBase ::
1430 FileSize_preMsgHook(
1431 FwOpcodeType opCode,
1432 U32 cmdSeq
1433 )
1434 {
1435 // Defaults to no-op; can be overridden
1436 (void) opCode;
1437 (void) cmdSeq;
1438 }
1439
1440 // ----------------------------------------------------------------------
1441 // Event logging functions
1442 // ----------------------------------------------------------------------
1443
1444 void FileManagerComponentBase ::
1445 log_WARNING_HI_DirectoryCreateError(
1446 const Fw::LogStringArg& dirName,
1447 U32 status
1448 )
1449 {
1450 // Get the time
1451 Fw::Time _logTime;
1452 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1453 this->m_timeCaller_OutputPort[0].invoke(_logTime);
1454 }
1455
1456 FwEventIdType _id = static_cast<FwEventIdType>(0);
1457
1458 _id = this->getIdBase() + EVENTID_DIRECTORYCREATEERROR;
1459
1460 // Emit the event on the log port
1461 if (this->m_eventOut_OutputPort[0].isConnected()) {
1462 Fw::LogBuffer _logBuff;
1464
1465#if FW_AMPCS_COMPATIBLE
1466 // Serialize the number of arguments
1467 _status = _logBuff.serialize(static_cast<U8>(2));
1468 FW_ASSERT(
1469 _status == Fw::FW_SERIALIZE_OK,
1470 static_cast<FwAssertArgType>(_status)
1471 );
1472#endif
1473
1474 _status = dirName.serialize(_logBuff, 256);
1475 FW_ASSERT(
1476 _status == Fw::FW_SERIALIZE_OK,
1477 static_cast<FwAssertArgType>(_status)
1478 );
1479
1480#if FW_AMPCS_COMPATIBLE
1481 // Serialize the argument size
1482 _status = _logBuff.serialize(
1483 static_cast<U8>(sizeof(U32))
1484 );
1485 FW_ASSERT(
1486 _status == Fw::FW_SERIALIZE_OK,
1487 static_cast<FwAssertArgType>(_status)
1488 );
1489#endif
1490 _status = _logBuff.serialize(status);
1491 FW_ASSERT(
1492 _status == Fw::FW_SERIALIZE_OK,
1493 static_cast<FwAssertArgType>(_status)
1494 );
1495
1496 this->m_eventOut_OutputPort[0].invoke(
1497 _id,
1498 _logTime,
1500 _logBuff
1501 );
1502 }
1503
1504 // Emit the event on the text log port
1505#if FW_ENABLE_TEXT_LOGGING
1506 if (this->m_LogText_OutputPort[0].isConnected()) {
1507#if FW_OBJECT_NAMES == 1
1508 const char* _formatString =
1509 "(%s) %s: Could not create directory %s, returned status %" PRIu32 "";
1510#else
1511 const char* _formatString =
1512 "%s: Could not create directory %s, returned status %" PRIu32 "";
1513#endif
1514
1515 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
1516
1517 (void) snprintf(
1518 _textBuffer,
1520 _formatString,
1521#if FW_OBJECT_NAMES == 1
1522 this->m_objName,
1523#endif
1524 "DirectoryCreateError ",
1525 dirName.toChar(),
1526 status
1527 );
1528
1529 // Null terminate
1530 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
1531 Fw::TextLogString _logString = _textBuffer;
1532 this->m_LogText_OutputPort[0].invoke(
1533 _id,
1534 _logTime,
1536 _logString
1537 );
1538 }
1539#endif
1540 }
1541
1542 void FileManagerComponentBase ::
1543 log_WARNING_HI_DirectoryRemoveError(
1544 const Fw::LogStringArg& dirName,
1545 U32 status
1546 )
1547 {
1548 // Get the time
1549 Fw::Time _logTime;
1550 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1551 this->m_timeCaller_OutputPort[0].invoke(_logTime);
1552 }
1553
1554 FwEventIdType _id = static_cast<FwEventIdType>(0);
1555
1556 _id = this->getIdBase() + EVENTID_DIRECTORYREMOVEERROR;
1557
1558 // Emit the event on the log port
1559 if (this->m_eventOut_OutputPort[0].isConnected()) {
1560 Fw::LogBuffer _logBuff;
1562
1563#if FW_AMPCS_COMPATIBLE
1564 // Serialize the number of arguments
1565 _status = _logBuff.serialize(static_cast<U8>(2));
1566 FW_ASSERT(
1567 _status == Fw::FW_SERIALIZE_OK,
1568 static_cast<FwAssertArgType>(_status)
1569 );
1570#endif
1571
1572 _status = dirName.serialize(_logBuff, 256);
1573 FW_ASSERT(
1574 _status == Fw::FW_SERIALIZE_OK,
1575 static_cast<FwAssertArgType>(_status)
1576 );
1577
1578#if FW_AMPCS_COMPATIBLE
1579 // Serialize the argument size
1580 _status = _logBuff.serialize(
1581 static_cast<U8>(sizeof(U32))
1582 );
1583 FW_ASSERT(
1584 _status == Fw::FW_SERIALIZE_OK,
1585 static_cast<FwAssertArgType>(_status)
1586 );
1587#endif
1588 _status = _logBuff.serialize(status);
1589 FW_ASSERT(
1590 _status == Fw::FW_SERIALIZE_OK,
1591 static_cast<FwAssertArgType>(_status)
1592 );
1593
1594 this->m_eventOut_OutputPort[0].invoke(
1595 _id,
1596 _logTime,
1598 _logBuff
1599 );
1600 }
1601
1602 // Emit the event on the text log port
1603#if FW_ENABLE_TEXT_LOGGING
1604 if (this->m_LogText_OutputPort[0].isConnected()) {
1605#if FW_OBJECT_NAMES == 1
1606 const char* _formatString =
1607 "(%s) %s: Could not remove directory %s, returned status %" PRIu32 "";
1608#else
1609 const char* _formatString =
1610 "%s: Could not remove directory %s, returned status %" PRIu32 "";
1611#endif
1612
1613 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
1614
1615 (void) snprintf(
1616 _textBuffer,
1618 _formatString,
1619#if FW_OBJECT_NAMES == 1
1620 this->m_objName,
1621#endif
1622 "DirectoryRemoveError ",
1623 dirName.toChar(),
1624 status
1625 );
1626
1627 // Null terminate
1628 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
1629 Fw::TextLogString _logString = _textBuffer;
1630 this->m_LogText_OutputPort[0].invoke(
1631 _id,
1632 _logTime,
1634 _logString
1635 );
1636 }
1637#endif
1638 }
1639
1640 void FileManagerComponentBase ::
1641 log_WARNING_HI_FileMoveError(
1642 const Fw::LogStringArg& sourceFileName,
1643 const Fw::LogStringArg& destFileName,
1644 U32 status
1645 )
1646 {
1647 // Get the time
1648 Fw::Time _logTime;
1649 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1650 this->m_timeCaller_OutputPort[0].invoke(_logTime);
1651 }
1652
1653 FwEventIdType _id = static_cast<FwEventIdType>(0);
1654
1655 _id = this->getIdBase() + EVENTID_FILEMOVEERROR;
1656
1657 // Emit the event on the log port
1658 if (this->m_eventOut_OutputPort[0].isConnected()) {
1659 Fw::LogBuffer _logBuff;
1661
1662#if FW_AMPCS_COMPATIBLE
1663 // Serialize the number of arguments
1664 _status = _logBuff.serialize(static_cast<U8>(3));
1665 FW_ASSERT(
1666 _status == Fw::FW_SERIALIZE_OK,
1667 static_cast<FwAssertArgType>(_status)
1668 );
1669#endif
1670
1671 _status = sourceFileName.serialize(_logBuff, 256);
1672 FW_ASSERT(
1673 _status == Fw::FW_SERIALIZE_OK,
1674 static_cast<FwAssertArgType>(_status)
1675 );
1676
1677 _status = destFileName.serialize(_logBuff, 256);
1678 FW_ASSERT(
1679 _status == Fw::FW_SERIALIZE_OK,
1680 static_cast<FwAssertArgType>(_status)
1681 );
1682
1683#if FW_AMPCS_COMPATIBLE
1684 // Serialize the argument size
1685 _status = _logBuff.serialize(
1686 static_cast<U8>(sizeof(U32))
1687 );
1688 FW_ASSERT(
1689 _status == Fw::FW_SERIALIZE_OK,
1690 static_cast<FwAssertArgType>(_status)
1691 );
1692#endif
1693 _status = _logBuff.serialize(status);
1694 FW_ASSERT(
1695 _status == Fw::FW_SERIALIZE_OK,
1696 static_cast<FwAssertArgType>(_status)
1697 );
1698
1699 this->m_eventOut_OutputPort[0].invoke(
1700 _id,
1701 _logTime,
1703 _logBuff
1704 );
1705 }
1706
1707 // Emit the event on the text log port
1708#if FW_ENABLE_TEXT_LOGGING
1709 if (this->m_LogText_OutputPort[0].isConnected()) {
1710#if FW_OBJECT_NAMES == 1
1711 const char* _formatString =
1712 "(%s) %s: Could not move file %s to file %s, returned status %" PRIu32 "";
1713#else
1714 const char* _formatString =
1715 "%s: Could not move file %s to file %s, returned status %" PRIu32 "";
1716#endif
1717
1718 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
1719
1720 (void) snprintf(
1721 _textBuffer,
1723 _formatString,
1724#if FW_OBJECT_NAMES == 1
1725 this->m_objName,
1726#endif
1727 "FileMoveError ",
1728 sourceFileName.toChar(),
1729 destFileName.toChar(),
1730 status
1731 );
1732
1733 // Null terminate
1734 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
1735 Fw::TextLogString _logString = _textBuffer;
1736 this->m_LogText_OutputPort[0].invoke(
1737 _id,
1738 _logTime,
1740 _logString
1741 );
1742 }
1743#endif
1744 }
1745
1746 void FileManagerComponentBase ::
1747 log_WARNING_HI_FileRemoveError(
1748 const Fw::LogStringArg& fileName,
1749 U32 status
1750 )
1751 {
1752 // Get the time
1753 Fw::Time _logTime;
1754 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1755 this->m_timeCaller_OutputPort[0].invoke(_logTime);
1756 }
1757
1758 FwEventIdType _id = static_cast<FwEventIdType>(0);
1759
1760 _id = this->getIdBase() + EVENTID_FILEREMOVEERROR;
1761
1762 // Emit the event on the log port
1763 if (this->m_eventOut_OutputPort[0].isConnected()) {
1764 Fw::LogBuffer _logBuff;
1766
1767#if FW_AMPCS_COMPATIBLE
1768 // Serialize the number of arguments
1769 _status = _logBuff.serialize(static_cast<U8>(2));
1770 FW_ASSERT(
1771 _status == Fw::FW_SERIALIZE_OK,
1772 static_cast<FwAssertArgType>(_status)
1773 );
1774#endif
1775
1776 _status = fileName.serialize(_logBuff, 256);
1777 FW_ASSERT(
1778 _status == Fw::FW_SERIALIZE_OK,
1779 static_cast<FwAssertArgType>(_status)
1780 );
1781
1782#if FW_AMPCS_COMPATIBLE
1783 // Serialize the argument size
1784 _status = _logBuff.serialize(
1785 static_cast<U8>(sizeof(U32))
1786 );
1787 FW_ASSERT(
1788 _status == Fw::FW_SERIALIZE_OK,
1789 static_cast<FwAssertArgType>(_status)
1790 );
1791#endif
1792 _status = _logBuff.serialize(status);
1793 FW_ASSERT(
1794 _status == Fw::FW_SERIALIZE_OK,
1795 static_cast<FwAssertArgType>(_status)
1796 );
1797
1798 this->m_eventOut_OutputPort[0].invoke(
1799 _id,
1800 _logTime,
1802 _logBuff
1803 );
1804 }
1805
1806 // Emit the event on the text log port
1807#if FW_ENABLE_TEXT_LOGGING
1808 if (this->m_LogText_OutputPort[0].isConnected()) {
1809#if FW_OBJECT_NAMES == 1
1810 const char* _formatString =
1811 "(%s) %s: Could not remove file %s, returned status %" PRIu32 "";
1812#else
1813 const char* _formatString =
1814 "%s: Could not remove file %s, returned status %" PRIu32 "";
1815#endif
1816
1817 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
1818
1819 (void) snprintf(
1820 _textBuffer,
1822 _formatString,
1823#if FW_OBJECT_NAMES == 1
1824 this->m_objName,
1825#endif
1826 "FileRemoveError ",
1827 fileName.toChar(),
1828 status
1829 );
1830
1831 // Null terminate
1832 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
1833 Fw::TextLogString _logString = _textBuffer;
1834 this->m_LogText_OutputPort[0].invoke(
1835 _id,
1836 _logTime,
1838 _logString
1839 );
1840 }
1841#endif
1842 }
1843
1844 void FileManagerComponentBase ::
1845 log_WARNING_HI_ShellCommandFailed(
1846 const Fw::LogStringArg& command,
1847 U32 status
1848 )
1849 {
1850 // Get the time
1851 Fw::Time _logTime;
1852 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1853 this->m_timeCaller_OutputPort[0].invoke(_logTime);
1854 }
1855
1856 FwEventIdType _id = static_cast<FwEventIdType>(0);
1857
1858 _id = this->getIdBase() + EVENTID_SHELLCOMMANDFAILED;
1859
1860 // Emit the event on the log port
1861 if (this->m_eventOut_OutputPort[0].isConnected()) {
1862 Fw::LogBuffer _logBuff;
1864
1865#if FW_AMPCS_COMPATIBLE
1866 // Serialize the number of arguments
1867 _status = _logBuff.serialize(static_cast<U8>(2));
1868 FW_ASSERT(
1869 _status == Fw::FW_SERIALIZE_OK,
1870 static_cast<FwAssertArgType>(_status)
1871 );
1872#endif
1873
1874 _status = command.serialize(_logBuff, 256);
1875 FW_ASSERT(
1876 _status == Fw::FW_SERIALIZE_OK,
1877 static_cast<FwAssertArgType>(_status)
1878 );
1879
1880#if FW_AMPCS_COMPATIBLE
1881 // Serialize the argument size
1882 _status = _logBuff.serialize(
1883 static_cast<U8>(sizeof(U32))
1884 );
1885 FW_ASSERT(
1886 _status == Fw::FW_SERIALIZE_OK,
1887 static_cast<FwAssertArgType>(_status)
1888 );
1889#endif
1890 _status = _logBuff.serialize(status);
1891 FW_ASSERT(
1892 _status == Fw::FW_SERIALIZE_OK,
1893 static_cast<FwAssertArgType>(_status)
1894 );
1895
1896 this->m_eventOut_OutputPort[0].invoke(
1897 _id,
1898 _logTime,
1900 _logBuff
1901 );
1902 }
1903
1904 // Emit the event on the text log port
1905#if FW_ENABLE_TEXT_LOGGING
1906 if (this->m_LogText_OutputPort[0].isConnected()) {
1907#if FW_OBJECT_NAMES == 1
1908 const char* _formatString =
1909 "(%s) %s: Shell command %s failed with status %" PRIu32 "";
1910#else
1911 const char* _formatString =
1912 "%s: Shell command %s failed with status %" PRIu32 "";
1913#endif
1914
1915 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
1916
1917 (void) snprintf(
1918 _textBuffer,
1920 _formatString,
1921#if FW_OBJECT_NAMES == 1
1922 this->m_objName,
1923#endif
1924 "ShellCommandFailed ",
1925 command.toChar(),
1926 status
1927 );
1928
1929 // Null terminate
1930 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
1931 Fw::TextLogString _logString = _textBuffer;
1932 this->m_LogText_OutputPort[0].invoke(
1933 _id,
1934 _logTime,
1936 _logString
1937 );
1938 }
1939#endif
1940 }
1941
1942 void FileManagerComponentBase ::
1943 log_WARNING_HI_AppendFileFailed(
1944 const Fw::LogStringArg& source,
1945 const Fw::LogStringArg& target,
1946 U32 status
1947 )
1948 {
1949 // Get the time
1950 Fw::Time _logTime;
1951 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1952 this->m_timeCaller_OutputPort[0].invoke(_logTime);
1953 }
1954
1955 FwEventIdType _id = static_cast<FwEventIdType>(0);
1956
1957 _id = this->getIdBase() + EVENTID_APPENDFILEFAILED;
1958
1959 // Emit the event on the log port
1960 if (this->m_eventOut_OutputPort[0].isConnected()) {
1961 Fw::LogBuffer _logBuff;
1963
1964#if FW_AMPCS_COMPATIBLE
1965 // Serialize the number of arguments
1966 _status = _logBuff.serialize(static_cast<U8>(3));
1967 FW_ASSERT(
1968 _status == Fw::FW_SERIALIZE_OK,
1969 static_cast<FwAssertArgType>(_status)
1970 );
1971#endif
1972
1973 _status = source.serialize(_logBuff, 256);
1974 FW_ASSERT(
1975 _status == Fw::FW_SERIALIZE_OK,
1976 static_cast<FwAssertArgType>(_status)
1977 );
1978
1979 _status = target.serialize(_logBuff, 256);
1980 FW_ASSERT(
1981 _status == Fw::FW_SERIALIZE_OK,
1982 static_cast<FwAssertArgType>(_status)
1983 );
1984
1985#if FW_AMPCS_COMPATIBLE
1986 // Serialize the argument size
1987 _status = _logBuff.serialize(
1988 static_cast<U8>(sizeof(U32))
1989 );
1990 FW_ASSERT(
1991 _status == Fw::FW_SERIALIZE_OK,
1992 static_cast<FwAssertArgType>(_status)
1993 );
1994#endif
1995 _status = _logBuff.serialize(status);
1996 FW_ASSERT(
1997 _status == Fw::FW_SERIALIZE_OK,
1998 static_cast<FwAssertArgType>(_status)
1999 );
2000
2001 this->m_eventOut_OutputPort[0].invoke(
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->m_LogText_OutputPort[0].isConnected()) {
2012#if FW_OBJECT_NAMES == 1
2013 const char* _formatString =
2014 "(%s) %s: Appending %s onto %s failed with status %" PRIu32 "";
2015#else
2016 const char* _formatString =
2017 "%s: Appending %s onto %s failed with status %" PRIu32 "";
2018#endif
2019
2020 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
2021
2022 (void) snprintf(
2023 _textBuffer,
2025 _formatString,
2026#if FW_OBJECT_NAMES == 1
2027 this->m_objName,
2028#endif
2029 "AppendFileFailed ",
2030 source.toChar(),
2031 target.toChar(),
2032 status
2033 );
2034
2035 // Null terminate
2036 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
2037 Fw::TextLogString _logString = _textBuffer;
2038 this->m_LogText_OutputPort[0].invoke(
2039 _id,
2040 _logTime,
2042 _logString
2043 );
2044 }
2045#endif
2046 }
2047
2048 void FileManagerComponentBase ::
2049 log_ACTIVITY_HI_AppendFileSucceeded(
2050 const Fw::LogStringArg& source,
2051 const Fw::LogStringArg& target
2052 )
2053 {
2054 // Get the time
2055 Fw::Time _logTime;
2056 if (this->m_timeCaller_OutputPort[0].isConnected()) {
2057 this->m_timeCaller_OutputPort[0].invoke(_logTime);
2058 }
2059
2060 FwEventIdType _id = static_cast<FwEventIdType>(0);
2061
2062 _id = this->getIdBase() + EVENTID_APPENDFILESUCCEEDED;
2063
2064 // Emit the event on the log port
2065 if (this->m_eventOut_OutputPort[0].isConnected()) {
2066 Fw::LogBuffer _logBuff;
2068
2069#if FW_AMPCS_COMPATIBLE
2070 // Serialize the number of arguments
2071 _status = _logBuff.serialize(static_cast<U8>(2));
2072 FW_ASSERT(
2073 _status == Fw::FW_SERIALIZE_OK,
2074 static_cast<FwAssertArgType>(_status)
2075 );
2076#endif
2077
2078 _status = source.serialize(_logBuff, 256);
2079 FW_ASSERT(
2080 _status == Fw::FW_SERIALIZE_OK,
2081 static_cast<FwAssertArgType>(_status)
2082 );
2083
2084 _status = target.serialize(_logBuff, 256);
2085 FW_ASSERT(
2086 _status == Fw::FW_SERIALIZE_OK,
2087 static_cast<FwAssertArgType>(_status)
2088 );
2089
2090 this->m_eventOut_OutputPort[0].invoke(
2091 _id,
2092 _logTime,
2094 _logBuff
2095 );
2096 }
2097
2098 // Emit the event on the text log port
2099#if FW_ENABLE_TEXT_LOGGING
2100 if (this->m_LogText_OutputPort[0].isConnected()) {
2101#if FW_OBJECT_NAMES == 1
2102 const char* _formatString =
2103 "(%s) %s: Appended %s to the end of %s";
2104#else
2105 const char* _formatString =
2106 "%s: Appended %s to the end of %s";
2107#endif
2108
2109 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
2110
2111 (void) snprintf(
2112 _textBuffer,
2114 _formatString,
2115#if FW_OBJECT_NAMES == 1
2116 this->m_objName,
2117#endif
2118 "AppendFileSucceeded ",
2119 source.toChar(),
2120 target.toChar()
2121 );
2122
2123 // Null terminate
2124 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
2125 Fw::TextLogString _logString = _textBuffer;
2126 this->m_LogText_OutputPort[0].invoke(
2127 _id,
2128 _logTime,
2130 _logString
2131 );
2132 }
2133#endif
2134 }
2135
2136 void FileManagerComponentBase ::
2137 log_ACTIVITY_HI_ShellCommandSucceeded(const Fw::LogStringArg& command)
2138 {
2139 // Get the time
2140 Fw::Time _logTime;
2141 if (this->m_timeCaller_OutputPort[0].isConnected()) {
2142 this->m_timeCaller_OutputPort[0].invoke(_logTime);
2143 }
2144
2145 FwEventIdType _id = static_cast<FwEventIdType>(0);
2146
2147 _id = this->getIdBase() + EVENTID_SHELLCOMMANDSUCCEEDED;
2148
2149 // Emit the event on the log port
2150 if (this->m_eventOut_OutputPort[0].isConnected()) {
2151 Fw::LogBuffer _logBuff;
2153
2154#if FW_AMPCS_COMPATIBLE
2155 // Serialize the number of arguments
2156 _status = _logBuff.serialize(static_cast<U8>(1));
2157 FW_ASSERT(
2158 _status == Fw::FW_SERIALIZE_OK,
2159 static_cast<FwAssertArgType>(_status)
2160 );
2161#endif
2162
2163 _status = command.serialize(_logBuff, 256);
2164 FW_ASSERT(
2165 _status == Fw::FW_SERIALIZE_OK,
2166 static_cast<FwAssertArgType>(_status)
2167 );
2168
2169 this->m_eventOut_OutputPort[0].invoke(
2170 _id,
2171 _logTime,
2173 _logBuff
2174 );
2175 }
2176
2177 // Emit the event on the text log port
2178#if FW_ENABLE_TEXT_LOGGING
2179 if (this->m_LogText_OutputPort[0].isConnected()) {
2180#if FW_OBJECT_NAMES == 1
2181 const char* _formatString =
2182 "(%s) %s: Shell command %s succeeded";
2183#else
2184 const char* _formatString =
2185 "%s: Shell command %s succeeded";
2186#endif
2187
2188 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
2189
2190 (void) snprintf(
2191 _textBuffer,
2193 _formatString,
2194#if FW_OBJECT_NAMES == 1
2195 this->m_objName,
2196#endif
2197 "ShellCommandSucceeded ",
2198 command.toChar()
2199 );
2200
2201 // Null terminate
2202 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
2203 Fw::TextLogString _logString = _textBuffer;
2204 this->m_LogText_OutputPort[0].invoke(
2205 _id,
2206 _logTime,
2208 _logString
2209 );
2210 }
2211#endif
2212 }
2213
2214 void FileManagerComponentBase ::
2215 log_ACTIVITY_HI_CreateDirectorySucceeded(const Fw::LogStringArg& dirName)
2216 {
2217 // Get the time
2218 Fw::Time _logTime;
2219 if (this->m_timeCaller_OutputPort[0].isConnected()) {
2220 this->m_timeCaller_OutputPort[0].invoke(_logTime);
2221 }
2222
2223 FwEventIdType _id = static_cast<FwEventIdType>(0);
2224
2225 _id = this->getIdBase() + EVENTID_CREATEDIRECTORYSUCCEEDED;
2226
2227 // Emit the event on the log port
2228 if (this->m_eventOut_OutputPort[0].isConnected()) {
2229 Fw::LogBuffer _logBuff;
2231
2232#if FW_AMPCS_COMPATIBLE
2233 // Serialize the number of arguments
2234 _status = _logBuff.serialize(static_cast<U8>(1));
2235 FW_ASSERT(
2236 _status == Fw::FW_SERIALIZE_OK,
2237 static_cast<FwAssertArgType>(_status)
2238 );
2239#endif
2240
2241 _status = dirName.serialize(_logBuff, 256);
2242 FW_ASSERT(
2243 _status == Fw::FW_SERIALIZE_OK,
2244 static_cast<FwAssertArgType>(_status)
2245 );
2246
2247 this->m_eventOut_OutputPort[0].invoke(
2248 _id,
2249 _logTime,
2251 _logBuff
2252 );
2253 }
2254
2255 // Emit the event on the text log port
2256#if FW_ENABLE_TEXT_LOGGING
2257 if (this->m_LogText_OutputPort[0].isConnected()) {
2258#if FW_OBJECT_NAMES == 1
2259 const char* _formatString =
2260 "(%s) %s: Created directory %s successfully";
2261#else
2262 const char* _formatString =
2263 "%s: Created directory %s successfully";
2264#endif
2265
2266 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
2267
2268 (void) snprintf(
2269 _textBuffer,
2271 _formatString,
2272#if FW_OBJECT_NAMES == 1
2273 this->m_objName,
2274#endif
2275 "CreateDirectorySucceeded ",
2276 dirName.toChar()
2277 );
2278
2279 // Null terminate
2280 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
2281 Fw::TextLogString _logString = _textBuffer;
2282 this->m_LogText_OutputPort[0].invoke(
2283 _id,
2284 _logTime,
2286 _logString
2287 );
2288 }
2289#endif
2290 }
2291
2292 void FileManagerComponentBase ::
2293 log_ACTIVITY_HI_RemoveDirectorySucceeded(const Fw::LogStringArg& dirName)
2294 {
2295 // Get the time
2296 Fw::Time _logTime;
2297 if (this->m_timeCaller_OutputPort[0].isConnected()) {
2298 this->m_timeCaller_OutputPort[0].invoke(_logTime);
2299 }
2300
2301 FwEventIdType _id = static_cast<FwEventIdType>(0);
2302
2303 _id = this->getIdBase() + EVENTID_REMOVEDIRECTORYSUCCEEDED;
2304
2305 // Emit the event on the log port
2306 if (this->m_eventOut_OutputPort[0].isConnected()) {
2307 Fw::LogBuffer _logBuff;
2309
2310#if FW_AMPCS_COMPATIBLE
2311 // Serialize the number of arguments
2312 _status = _logBuff.serialize(static_cast<U8>(1));
2313 FW_ASSERT(
2314 _status == Fw::FW_SERIALIZE_OK,
2315 static_cast<FwAssertArgType>(_status)
2316 );
2317#endif
2318
2319 _status = dirName.serialize(_logBuff, 256);
2320 FW_ASSERT(
2321 _status == Fw::FW_SERIALIZE_OK,
2322 static_cast<FwAssertArgType>(_status)
2323 );
2324
2325 this->m_eventOut_OutputPort[0].invoke(
2326 _id,
2327 _logTime,
2329 _logBuff
2330 );
2331 }
2332
2333 // Emit the event on the text log port
2334#if FW_ENABLE_TEXT_LOGGING
2335 if (this->m_LogText_OutputPort[0].isConnected()) {
2336#if FW_OBJECT_NAMES == 1
2337 const char* _formatString =
2338 "(%s) %s: Removed directory %s successfully";
2339#else
2340 const char* _formatString =
2341 "%s: Removed directory %s successfully";
2342#endif
2343
2344 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
2345
2346 (void) snprintf(
2347 _textBuffer,
2349 _formatString,
2350#if FW_OBJECT_NAMES == 1
2351 this->m_objName,
2352#endif
2353 "RemoveDirectorySucceeded ",
2354 dirName.toChar()
2355 );
2356
2357 // Null terminate
2358 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
2359 Fw::TextLogString _logString = _textBuffer;
2360 this->m_LogText_OutputPort[0].invoke(
2361 _id,
2362 _logTime,
2364 _logString
2365 );
2366 }
2367#endif
2368 }
2369
2370 void FileManagerComponentBase ::
2371 log_ACTIVITY_HI_MoveFileSucceeded(
2372 const Fw::LogStringArg& sourceFileName,
2373 const Fw::LogStringArg& destFileName
2374 )
2375 {
2376 // Get the time
2377 Fw::Time _logTime;
2378 if (this->m_timeCaller_OutputPort[0].isConnected()) {
2379 this->m_timeCaller_OutputPort[0].invoke(_logTime);
2380 }
2381
2382 FwEventIdType _id = static_cast<FwEventIdType>(0);
2383
2384 _id = this->getIdBase() + EVENTID_MOVEFILESUCCEEDED;
2385
2386 // Emit the event on the log port
2387 if (this->m_eventOut_OutputPort[0].isConnected()) {
2388 Fw::LogBuffer _logBuff;
2390
2391#if FW_AMPCS_COMPATIBLE
2392 // Serialize the number of arguments
2393 _status = _logBuff.serialize(static_cast<U8>(2));
2394 FW_ASSERT(
2395 _status == Fw::FW_SERIALIZE_OK,
2396 static_cast<FwAssertArgType>(_status)
2397 );
2398#endif
2399
2400 _status = sourceFileName.serialize(_logBuff, 256);
2401 FW_ASSERT(
2402 _status == Fw::FW_SERIALIZE_OK,
2403 static_cast<FwAssertArgType>(_status)
2404 );
2405
2406 _status = destFileName.serialize(_logBuff, 256);
2407 FW_ASSERT(
2408 _status == Fw::FW_SERIALIZE_OK,
2409 static_cast<FwAssertArgType>(_status)
2410 );
2411
2412 this->m_eventOut_OutputPort[0].invoke(
2413 _id,
2414 _logTime,
2416 _logBuff
2417 );
2418 }
2419
2420 // Emit the event on the text log port
2421#if FW_ENABLE_TEXT_LOGGING
2422 if (this->m_LogText_OutputPort[0].isConnected()) {
2423#if FW_OBJECT_NAMES == 1
2424 const char* _formatString =
2425 "(%s) %s: Moved file %s to file %s successfully";
2426#else
2427 const char* _formatString =
2428 "%s: Moved file %s to file %s successfully";
2429#endif
2430
2431 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
2432
2433 (void) snprintf(
2434 _textBuffer,
2436 _formatString,
2437#if FW_OBJECT_NAMES == 1
2438 this->m_objName,
2439#endif
2440 "MoveFileSucceeded ",
2441 sourceFileName.toChar(),
2442 destFileName.toChar()
2443 );
2444
2445 // Null terminate
2446 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
2447 Fw::TextLogString _logString = _textBuffer;
2448 this->m_LogText_OutputPort[0].invoke(
2449 _id,
2450 _logTime,
2452 _logString
2453 );
2454 }
2455#endif
2456 }
2457
2458 void FileManagerComponentBase ::
2459 log_ACTIVITY_HI_RemoveFileSucceeded(const Fw::LogStringArg& fileName)
2460 {
2461 // Get the time
2462 Fw::Time _logTime;
2463 if (this->m_timeCaller_OutputPort[0].isConnected()) {
2464 this->m_timeCaller_OutputPort[0].invoke(_logTime);
2465 }
2466
2467 FwEventIdType _id = static_cast<FwEventIdType>(0);
2468
2469 _id = this->getIdBase() + EVENTID_REMOVEFILESUCCEEDED;
2470
2471 // Emit the event on the log port
2472 if (this->m_eventOut_OutputPort[0].isConnected()) {
2473 Fw::LogBuffer _logBuff;
2475
2476#if FW_AMPCS_COMPATIBLE
2477 // Serialize the number of arguments
2478 _status = _logBuff.serialize(static_cast<U8>(1));
2479 FW_ASSERT(
2480 _status == Fw::FW_SERIALIZE_OK,
2481 static_cast<FwAssertArgType>(_status)
2482 );
2483#endif
2484
2485 _status = fileName.serialize(_logBuff, 256);
2486 FW_ASSERT(
2487 _status == Fw::FW_SERIALIZE_OK,
2488 static_cast<FwAssertArgType>(_status)
2489 );
2490
2491 this->m_eventOut_OutputPort[0].invoke(
2492 _id,
2493 _logTime,
2495 _logBuff
2496 );
2497 }
2498
2499 // Emit the event on the text log port
2500#if FW_ENABLE_TEXT_LOGGING
2501 if (this->m_LogText_OutputPort[0].isConnected()) {
2502#if FW_OBJECT_NAMES == 1
2503 const char* _formatString =
2504 "(%s) %s: Removed file %s successfully";
2505#else
2506 const char* _formatString =
2507 "%s: Removed file %s successfully";
2508#endif
2509
2510 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
2511
2512 (void) snprintf(
2513 _textBuffer,
2515 _formatString,
2516#if FW_OBJECT_NAMES == 1
2517 this->m_objName,
2518#endif
2519 "RemoveFileSucceeded ",
2520 fileName.toChar()
2521 );
2522
2523 // Null terminate
2524 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
2525 Fw::TextLogString _logString = _textBuffer;
2526 this->m_LogText_OutputPort[0].invoke(
2527 _id,
2528 _logTime,
2530 _logString
2531 );
2532 }
2533#endif
2534 }
2535
2536 void FileManagerComponentBase ::
2537 log_ACTIVITY_HI_AppendFileStarted(
2538 const Fw::LogStringArg& source,
2539 const Fw::LogStringArg& target
2540 )
2541 {
2542 // Get the time
2543 Fw::Time _logTime;
2544 if (this->m_timeCaller_OutputPort[0].isConnected()) {
2545 this->m_timeCaller_OutputPort[0].invoke(_logTime);
2546 }
2547
2548 FwEventIdType _id = static_cast<FwEventIdType>(0);
2549
2550 _id = this->getIdBase() + EVENTID_APPENDFILESTARTED;
2551
2552 // Emit the event on the log port
2553 if (this->m_eventOut_OutputPort[0].isConnected()) {
2554 Fw::LogBuffer _logBuff;
2556
2557#if FW_AMPCS_COMPATIBLE
2558 // Serialize the number of arguments
2559 _status = _logBuff.serialize(static_cast<U8>(2));
2560 FW_ASSERT(
2561 _status == Fw::FW_SERIALIZE_OK,
2562 static_cast<FwAssertArgType>(_status)
2563 );
2564#endif
2565
2566 _status = source.serialize(_logBuff, 256);
2567 FW_ASSERT(
2568 _status == Fw::FW_SERIALIZE_OK,
2569 static_cast<FwAssertArgType>(_status)
2570 );
2571
2572 _status = target.serialize(_logBuff, 256);
2573 FW_ASSERT(
2574 _status == Fw::FW_SERIALIZE_OK,
2575 static_cast<FwAssertArgType>(_status)
2576 );
2577
2578 this->m_eventOut_OutputPort[0].invoke(
2579 _id,
2580 _logTime,
2582 _logBuff
2583 );
2584 }
2585
2586 // Emit the event on the text log port
2587#if FW_ENABLE_TEXT_LOGGING
2588 if (this->m_LogText_OutputPort[0].isConnected()) {
2589#if FW_OBJECT_NAMES == 1
2590 const char* _formatString =
2591 "(%s) %s: Appending file %s to the end of %s...";
2592#else
2593 const char* _formatString =
2594 "%s: Appending file %s to the end of %s...";
2595#endif
2596
2597 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
2598
2599 (void) snprintf(
2600 _textBuffer,
2602 _formatString,
2603#if FW_OBJECT_NAMES == 1
2604 this->m_objName,
2605#endif
2606 "AppendFileStarted ",
2607 source.toChar(),
2608 target.toChar()
2609 );
2610
2611 // Null terminate
2612 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
2613 Fw::TextLogString _logString = _textBuffer;
2614 this->m_LogText_OutputPort[0].invoke(
2615 _id,
2616 _logTime,
2618 _logString
2619 );
2620 }
2621#endif
2622 }
2623
2624 void FileManagerComponentBase ::
2625 log_ACTIVITY_HI_ShellCommandStarted(const Fw::LogStringArg& command)
2626 {
2627 // Get the time
2628 Fw::Time _logTime;
2629 if (this->m_timeCaller_OutputPort[0].isConnected()) {
2630 this->m_timeCaller_OutputPort[0].invoke(_logTime);
2631 }
2632
2633 FwEventIdType _id = static_cast<FwEventIdType>(0);
2634
2635 _id = this->getIdBase() + EVENTID_SHELLCOMMANDSTARTED;
2636
2637 // Emit the event on the log port
2638 if (this->m_eventOut_OutputPort[0].isConnected()) {
2639 Fw::LogBuffer _logBuff;
2641
2642#if FW_AMPCS_COMPATIBLE
2643 // Serialize the number of arguments
2644 _status = _logBuff.serialize(static_cast<U8>(1));
2645 FW_ASSERT(
2646 _status == Fw::FW_SERIALIZE_OK,
2647 static_cast<FwAssertArgType>(_status)
2648 );
2649#endif
2650
2651 _status = command.serialize(_logBuff, 256);
2652 FW_ASSERT(
2653 _status == Fw::FW_SERIALIZE_OK,
2654 static_cast<FwAssertArgType>(_status)
2655 );
2656
2657 this->m_eventOut_OutputPort[0].invoke(
2658 _id,
2659 _logTime,
2661 _logBuff
2662 );
2663 }
2664
2665 // Emit the event on the text log port
2666#if FW_ENABLE_TEXT_LOGGING
2667 if (this->m_LogText_OutputPort[0].isConnected()) {
2668#if FW_OBJECT_NAMES == 1
2669 const char* _formatString =
2670 "(%s) %s: Running shell command %s...";
2671#else
2672 const char* _formatString =
2673 "%s: Running shell command %s...";
2674#endif
2675
2676 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
2677
2678 (void) snprintf(
2679 _textBuffer,
2681 _formatString,
2682#if FW_OBJECT_NAMES == 1
2683 this->m_objName,
2684#endif
2685 "ShellCommandStarted ",
2686 command.toChar()
2687 );
2688
2689 // Null terminate
2690 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
2691 Fw::TextLogString _logString = _textBuffer;
2692 this->m_LogText_OutputPort[0].invoke(
2693 _id,
2694 _logTime,
2696 _logString
2697 );
2698 }
2699#endif
2700 }
2701
2702 void FileManagerComponentBase ::
2703 log_ACTIVITY_HI_CreateDirectoryStarted(const Fw::LogStringArg& dirName)
2704 {
2705 // Get the time
2706 Fw::Time _logTime;
2707 if (this->m_timeCaller_OutputPort[0].isConnected()) {
2708 this->m_timeCaller_OutputPort[0].invoke(_logTime);
2709 }
2710
2711 FwEventIdType _id = static_cast<FwEventIdType>(0);
2712
2713 _id = this->getIdBase() + EVENTID_CREATEDIRECTORYSTARTED;
2714
2715 // Emit the event on the log port
2716 if (this->m_eventOut_OutputPort[0].isConnected()) {
2717 Fw::LogBuffer _logBuff;
2719
2720#if FW_AMPCS_COMPATIBLE
2721 // Serialize the number of arguments
2722 _status = _logBuff.serialize(static_cast<U8>(1));
2723 FW_ASSERT(
2724 _status == Fw::FW_SERIALIZE_OK,
2725 static_cast<FwAssertArgType>(_status)
2726 );
2727#endif
2728
2729 _status = dirName.serialize(_logBuff, 256);
2730 FW_ASSERT(
2731 _status == Fw::FW_SERIALIZE_OK,
2732 static_cast<FwAssertArgType>(_status)
2733 );
2734
2735 this->m_eventOut_OutputPort[0].invoke(
2736 _id,
2737 _logTime,
2739 _logBuff
2740 );
2741 }
2742
2743 // Emit the event on the text log port
2744#if FW_ENABLE_TEXT_LOGGING
2745 if (this->m_LogText_OutputPort[0].isConnected()) {
2746#if FW_OBJECT_NAMES == 1
2747 const char* _formatString =
2748 "(%s) %s: Creating directory %s...";
2749#else
2750 const char* _formatString =
2751 "%s: Creating directory %s...";
2752#endif
2753
2754 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
2755
2756 (void) snprintf(
2757 _textBuffer,
2759 _formatString,
2760#if FW_OBJECT_NAMES == 1
2761 this->m_objName,
2762#endif
2763 "CreateDirectoryStarted ",
2764 dirName.toChar()
2765 );
2766
2767 // Null terminate
2768 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
2769 Fw::TextLogString _logString = _textBuffer;
2770 this->m_LogText_OutputPort[0].invoke(
2771 _id,
2772 _logTime,
2774 _logString
2775 );
2776 }
2777#endif
2778 }
2779
2780 void FileManagerComponentBase ::
2781 log_ACTIVITY_HI_RemoveDirectoryStarted(const Fw::LogStringArg& dirName)
2782 {
2783 // Get the time
2784 Fw::Time _logTime;
2785 if (this->m_timeCaller_OutputPort[0].isConnected()) {
2786 this->m_timeCaller_OutputPort[0].invoke(_logTime);
2787 }
2788
2789 FwEventIdType _id = static_cast<FwEventIdType>(0);
2790
2791 _id = this->getIdBase() + EVENTID_REMOVEDIRECTORYSTARTED;
2792
2793 // Emit the event on the log port
2794 if (this->m_eventOut_OutputPort[0].isConnected()) {
2795 Fw::LogBuffer _logBuff;
2797
2798#if FW_AMPCS_COMPATIBLE
2799 // Serialize the number of arguments
2800 _status = _logBuff.serialize(static_cast<U8>(1));
2801 FW_ASSERT(
2802 _status == Fw::FW_SERIALIZE_OK,
2803 static_cast<FwAssertArgType>(_status)
2804 );
2805#endif
2806
2807 _status = dirName.serialize(_logBuff, 256);
2808 FW_ASSERT(
2809 _status == Fw::FW_SERIALIZE_OK,
2810 static_cast<FwAssertArgType>(_status)
2811 );
2812
2813 this->m_eventOut_OutputPort[0].invoke(
2814 _id,
2815 _logTime,
2817 _logBuff
2818 );
2819 }
2820
2821 // Emit the event on the text log port
2822#if FW_ENABLE_TEXT_LOGGING
2823 if (this->m_LogText_OutputPort[0].isConnected()) {
2824#if FW_OBJECT_NAMES == 1
2825 const char* _formatString =
2826 "(%s) %s: Removing directory %s...";
2827#else
2828 const char* _formatString =
2829 "%s: Removing directory %s...";
2830#endif
2831
2832 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
2833
2834 (void) snprintf(
2835 _textBuffer,
2837 _formatString,
2838#if FW_OBJECT_NAMES == 1
2839 this->m_objName,
2840#endif
2841 "RemoveDirectoryStarted ",
2842 dirName.toChar()
2843 );
2844
2845 // Null terminate
2846 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
2847 Fw::TextLogString _logString = _textBuffer;
2848 this->m_LogText_OutputPort[0].invoke(
2849 _id,
2850 _logTime,
2852 _logString
2853 );
2854 }
2855#endif
2856 }
2857
2858 void FileManagerComponentBase ::
2859 log_ACTIVITY_HI_MoveFileStarted(
2860 const Fw::LogStringArg& sourceFileName,
2861 const Fw::LogStringArg& destFileName
2862 )
2863 {
2864 // Get the time
2865 Fw::Time _logTime;
2866 if (this->m_timeCaller_OutputPort[0].isConnected()) {
2867 this->m_timeCaller_OutputPort[0].invoke(_logTime);
2868 }
2869
2870 FwEventIdType _id = static_cast<FwEventIdType>(0);
2871
2872 _id = this->getIdBase() + EVENTID_MOVEFILESTARTED;
2873
2874 // Emit the event on the log port
2875 if (this->m_eventOut_OutputPort[0].isConnected()) {
2876 Fw::LogBuffer _logBuff;
2878
2879#if FW_AMPCS_COMPATIBLE
2880 // Serialize the number of arguments
2881 _status = _logBuff.serialize(static_cast<U8>(2));
2882 FW_ASSERT(
2883 _status == Fw::FW_SERIALIZE_OK,
2884 static_cast<FwAssertArgType>(_status)
2885 );
2886#endif
2887
2888 _status = sourceFileName.serialize(_logBuff, 256);
2889 FW_ASSERT(
2890 _status == Fw::FW_SERIALIZE_OK,
2891 static_cast<FwAssertArgType>(_status)
2892 );
2893
2894 _status = destFileName.serialize(_logBuff, 256);
2895 FW_ASSERT(
2896 _status == Fw::FW_SERIALIZE_OK,
2897 static_cast<FwAssertArgType>(_status)
2898 );
2899
2900 this->m_eventOut_OutputPort[0].invoke(
2901 _id,
2902 _logTime,
2904 _logBuff
2905 );
2906 }
2907
2908 // Emit the event on the text log port
2909#if FW_ENABLE_TEXT_LOGGING
2910 if (this->m_LogText_OutputPort[0].isConnected()) {
2911#if FW_OBJECT_NAMES == 1
2912 const char* _formatString =
2913 "(%s) %s: Moving file %s to file %s...";
2914#else
2915 const char* _formatString =
2916 "%s: Moving file %s to file %s...";
2917#endif
2918
2919 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
2920
2921 (void) snprintf(
2922 _textBuffer,
2924 _formatString,
2925#if FW_OBJECT_NAMES == 1
2926 this->m_objName,
2927#endif
2928 "MoveFileStarted ",
2929 sourceFileName.toChar(),
2930 destFileName.toChar()
2931 );
2932
2933 // Null terminate
2934 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
2935 Fw::TextLogString _logString = _textBuffer;
2936 this->m_LogText_OutputPort[0].invoke(
2937 _id,
2938 _logTime,
2940 _logString
2941 );
2942 }
2943#endif
2944 }
2945
2946 void FileManagerComponentBase ::
2947 log_ACTIVITY_HI_RemoveFileStarted(const Fw::LogStringArg& fileName)
2948 {
2949 // Get the time
2950 Fw::Time _logTime;
2951 if (this->m_timeCaller_OutputPort[0].isConnected()) {
2952 this->m_timeCaller_OutputPort[0].invoke(_logTime);
2953 }
2954
2955 FwEventIdType _id = static_cast<FwEventIdType>(0);
2956
2957 _id = this->getIdBase() + EVENTID_REMOVEFILESTARTED;
2958
2959 // Emit the event on the log port
2960 if (this->m_eventOut_OutputPort[0].isConnected()) {
2961 Fw::LogBuffer _logBuff;
2963
2964#if FW_AMPCS_COMPATIBLE
2965 // Serialize the number of arguments
2966 _status = _logBuff.serialize(static_cast<U8>(1));
2967 FW_ASSERT(
2968 _status == Fw::FW_SERIALIZE_OK,
2969 static_cast<FwAssertArgType>(_status)
2970 );
2971#endif
2972
2973 _status = fileName.serialize(_logBuff, 256);
2974 FW_ASSERT(
2975 _status == Fw::FW_SERIALIZE_OK,
2976 static_cast<FwAssertArgType>(_status)
2977 );
2978
2979 this->m_eventOut_OutputPort[0].invoke(
2980 _id,
2981 _logTime,
2983 _logBuff
2984 );
2985 }
2986
2987 // Emit the event on the text log port
2988#if FW_ENABLE_TEXT_LOGGING
2989 if (this->m_LogText_OutputPort[0].isConnected()) {
2990#if FW_OBJECT_NAMES == 1
2991 const char* _formatString =
2992 "(%s) %s: Removing file %s...";
2993#else
2994 const char* _formatString =
2995 "%s: Removing file %s...";
2996#endif
2997
2998 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
2999
3000 (void) snprintf(
3001 _textBuffer,
3003 _formatString,
3004#if FW_OBJECT_NAMES == 1
3005 this->m_objName,
3006#endif
3007 "RemoveFileStarted ",
3008 fileName.toChar()
3009 );
3010
3011 // Null terminate
3012 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
3013 Fw::TextLogString _logString = _textBuffer;
3014 this->m_LogText_OutputPort[0].invoke(
3015 _id,
3016 _logTime,
3018 _logString
3019 );
3020 }
3021#endif
3022 }
3023
3024 void FileManagerComponentBase ::
3025 log_ACTIVITY_HI_FileSizeSucceeded(
3026 const Fw::LogStringArg& fileName,
3027 U64 size
3028 )
3029 {
3030 // Get the time
3031 Fw::Time _logTime;
3032 if (this->m_timeCaller_OutputPort[0].isConnected()) {
3033 this->m_timeCaller_OutputPort[0].invoke(_logTime);
3034 }
3035
3036 FwEventIdType _id = static_cast<FwEventIdType>(0);
3037
3038 _id = this->getIdBase() + EVENTID_FILESIZESUCCEEDED;
3039
3040 // Emit the event on the log port
3041 if (this->m_eventOut_OutputPort[0].isConnected()) {
3042 Fw::LogBuffer _logBuff;
3044
3045#if FW_AMPCS_COMPATIBLE
3046 // Serialize the number of arguments
3047 _status = _logBuff.serialize(static_cast<U8>(2));
3048 FW_ASSERT(
3049 _status == Fw::FW_SERIALIZE_OK,
3050 static_cast<FwAssertArgType>(_status)
3051 );
3052#endif
3053
3054 _status = fileName.serialize(_logBuff, 256);
3055 FW_ASSERT(
3056 _status == Fw::FW_SERIALIZE_OK,
3057 static_cast<FwAssertArgType>(_status)
3058 );
3059
3060#if FW_AMPCS_COMPATIBLE
3061 // Serialize the argument size
3062 _status = _logBuff.serialize(
3063 static_cast<U8>(sizeof(U64))
3064 );
3065 FW_ASSERT(
3066 _status == Fw::FW_SERIALIZE_OK,
3067 static_cast<FwAssertArgType>(_status)
3068 );
3069#endif
3070 _status = _logBuff.serialize(size);
3071 FW_ASSERT(
3072 _status == Fw::FW_SERIALIZE_OK,
3073 static_cast<FwAssertArgType>(_status)
3074 );
3075
3076 this->m_eventOut_OutputPort[0].invoke(
3077 _id,
3078 _logTime,
3080 _logBuff
3081 );
3082 }
3083
3084 // Emit the event on the text log port
3085#if FW_ENABLE_TEXT_LOGGING
3086 if (this->m_LogText_OutputPort[0].isConnected()) {
3087#if FW_OBJECT_NAMES == 1
3088 const char* _formatString =
3089 "(%s) %s: The size of file %s is %" PRIu64 " B";
3090#else
3091 const char* _formatString =
3092 "%s: The size of file %s is %" PRIu64 " B";
3093#endif
3094
3095 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
3096
3097 (void) snprintf(
3098 _textBuffer,
3100 _formatString,
3101#if FW_OBJECT_NAMES == 1
3102 this->m_objName,
3103#endif
3104 "FileSizeSucceeded ",
3105 fileName.toChar(),
3106 size
3107 );
3108
3109 // Null terminate
3110 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
3111 Fw::TextLogString _logString = _textBuffer;
3112 this->m_LogText_OutputPort[0].invoke(
3113 _id,
3114 _logTime,
3116 _logString
3117 );
3118 }
3119#endif
3120 }
3121
3122 void FileManagerComponentBase ::
3123 log_WARNING_HI_FileSizeError(
3124 const Fw::LogStringArg& fileName,
3125 U32 status
3126 )
3127 {
3128 // Get the time
3129 Fw::Time _logTime;
3130 if (this->m_timeCaller_OutputPort[0].isConnected()) {
3131 this->m_timeCaller_OutputPort[0].invoke(_logTime);
3132 }
3133
3134 FwEventIdType _id = static_cast<FwEventIdType>(0);
3135
3136 _id = this->getIdBase() + EVENTID_FILESIZEERROR;
3137
3138 // Emit the event on the log port
3139 if (this->m_eventOut_OutputPort[0].isConnected()) {
3140 Fw::LogBuffer _logBuff;
3142
3143#if FW_AMPCS_COMPATIBLE
3144 // Serialize the number of arguments
3145 _status = _logBuff.serialize(static_cast<U8>(2));
3146 FW_ASSERT(
3147 _status == Fw::FW_SERIALIZE_OK,
3148 static_cast<FwAssertArgType>(_status)
3149 );
3150#endif
3151
3152 _status = fileName.serialize(_logBuff, 256);
3153 FW_ASSERT(
3154 _status == Fw::FW_SERIALIZE_OK,
3155 static_cast<FwAssertArgType>(_status)
3156 );
3157
3158#if FW_AMPCS_COMPATIBLE
3159 // Serialize the argument size
3160 _status = _logBuff.serialize(
3161 static_cast<U8>(sizeof(U32))
3162 );
3163 FW_ASSERT(
3164 _status == Fw::FW_SERIALIZE_OK,
3165 static_cast<FwAssertArgType>(_status)
3166 );
3167#endif
3168 _status = _logBuff.serialize(status);
3169 FW_ASSERT(
3170 _status == Fw::FW_SERIALIZE_OK,
3171 static_cast<FwAssertArgType>(_status)
3172 );
3173
3174 this->m_eventOut_OutputPort[0].invoke(
3175 _id,
3176 _logTime,
3178 _logBuff
3179 );
3180 }
3181
3182 // Emit the event on the text log port
3183#if FW_ENABLE_TEXT_LOGGING
3184 if (this->m_LogText_OutputPort[0].isConnected()) {
3185#if FW_OBJECT_NAMES == 1
3186 const char* _formatString =
3187 "(%s) %s: Failed to get the size of file %s, returned status %" PRIu32 "";
3188#else
3189 const char* _formatString =
3190 "%s: Failed to get the size of file %s, returned status %" PRIu32 "";
3191#endif
3192
3193 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
3194
3195 (void) snprintf(
3196 _textBuffer,
3198 _formatString,
3199#if FW_OBJECT_NAMES == 1
3200 this->m_objName,
3201#endif
3202 "FileSizeError ",
3203 fileName.toChar(),
3204 status
3205 );
3206
3207 // Null terminate
3208 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
3209 Fw::TextLogString _logString = _textBuffer;
3210 this->m_LogText_OutputPort[0].invoke(
3211 _id,
3212 _logTime,
3214 _logString
3215 );
3216 }
3217#endif
3218 }
3219
3220 void FileManagerComponentBase ::
3221 log_ACTIVITY_HI_FileSizeStarted(const Fw::LogStringArg& fileName)
3222 {
3223 // Get the time
3224 Fw::Time _logTime;
3225 if (this->m_timeCaller_OutputPort[0].isConnected()) {
3226 this->m_timeCaller_OutputPort[0].invoke(_logTime);
3227 }
3228
3229 FwEventIdType _id = static_cast<FwEventIdType>(0);
3230
3231 _id = this->getIdBase() + EVENTID_FILESIZESTARTED;
3232
3233 // Emit the event on the log port
3234 if (this->m_eventOut_OutputPort[0].isConnected()) {
3235 Fw::LogBuffer _logBuff;
3237
3238#if FW_AMPCS_COMPATIBLE
3239 // Serialize the number of arguments
3240 _status = _logBuff.serialize(static_cast<U8>(1));
3241 FW_ASSERT(
3242 _status == Fw::FW_SERIALIZE_OK,
3243 static_cast<FwAssertArgType>(_status)
3244 );
3245#endif
3246
3247 _status = fileName.serialize(_logBuff, 256);
3248 FW_ASSERT(
3249 _status == Fw::FW_SERIALIZE_OK,
3250 static_cast<FwAssertArgType>(_status)
3251 );
3252
3253 this->m_eventOut_OutputPort[0].invoke(
3254 _id,
3255 _logTime,
3257 _logBuff
3258 );
3259 }
3260
3261 // Emit the event on the text log port
3262#if FW_ENABLE_TEXT_LOGGING
3263 if (this->m_LogText_OutputPort[0].isConnected()) {
3264#if FW_OBJECT_NAMES == 1
3265 const char* _formatString =
3266 "(%s) %s: Checking size of file %s...";
3267#else
3268 const char* _formatString =
3269 "%s: Checking size of file %s...";
3270#endif
3271
3272 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
3273
3274 (void) snprintf(
3275 _textBuffer,
3277 _formatString,
3278#if FW_OBJECT_NAMES == 1
3279 this->m_objName,
3280#endif
3281 "FileSizeStarted ",
3282 fileName.toChar()
3283 );
3284
3285 // Null terminate
3286 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
3287 Fw::TextLogString _logString = _textBuffer;
3288 this->m_LogText_OutputPort[0].invoke(
3289 _id,
3290 _logTime,
3292 _logString
3293 );
3294 }
3295#endif
3296 }
3297
3298 // ----------------------------------------------------------------------
3299 // Telemetry write functions
3300 // ----------------------------------------------------------------------
3301
3302 void FileManagerComponentBase ::
3303 tlmWrite_CommandsExecuted(
3304 U32 arg,
3305 Fw::Time _tlmTime
3306 )
3307 {
3308 if (this->m_tlmOut_OutputPort[0].isConnected()) {
3309 if (
3310 this->m_timeCaller_OutputPort[0].isConnected() &&
3311 (_tlmTime == Fw::ZERO_TIME)
3312 ) {
3313 this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
3314 }
3315
3316 Fw::TlmBuffer _tlmBuff;
3317 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
3318 FW_ASSERT(
3319 _stat == Fw::FW_SERIALIZE_OK,
3320 static_cast<FwAssertArgType>(_stat)
3321 );
3322
3323 FwChanIdType _id;
3324
3325 _id = this->getIdBase() + CHANNELID_COMMANDSEXECUTED;
3326
3327 this->m_tlmOut_OutputPort[0].invoke(
3328 _id,
3329 _tlmTime,
3330 _tlmBuff
3331 );
3332 }
3333 }
3334
3335 void FileManagerComponentBase ::
3336 tlmWrite_Errors(
3337 U32 arg,
3338 Fw::Time _tlmTime
3339 )
3340 {
3341 if (this->m_tlmOut_OutputPort[0].isConnected()) {
3342 if (
3343 this->m_timeCaller_OutputPort[0].isConnected() &&
3344 (_tlmTime == Fw::ZERO_TIME)
3345 ) {
3346 this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
3347 }
3348
3349 Fw::TlmBuffer _tlmBuff;
3350 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
3351 FW_ASSERT(
3352 _stat == Fw::FW_SERIALIZE_OK,
3353 static_cast<FwAssertArgType>(_stat)
3354 );
3355
3356 FwChanIdType _id;
3357
3358 _id = this->getIdBase() + CHANNELID_ERRORS;
3359
3360 this->m_tlmOut_OutputPort[0].invoke(
3361 _id,
3362 _tlmTime,
3363 _tlmBuff
3364 );
3365 }
3366 }
3367
3368 // ----------------------------------------------------------------------
3369 // Time
3370 // ----------------------------------------------------------------------
3371
3372 Fw::Time FileManagerComponentBase ::
3373 getTime()
3374 {
3375 if (this->m_timeCaller_OutputPort[0].isConnected()) {
3376 Fw::Time _time;
3377 this->m_timeCaller_OutputPort[0].invoke(_time);
3378 return _time;
3379 }
3380 else {
3381 return Fw::Time(TB_NONE, 0, 0);
3382 }
3383 }
3384
3385 // ----------------------------------------------------------------------
3386 // Message dispatch functions
3387 // ----------------------------------------------------------------------
3388
3389 Fw::QueuedComponentBase::MsgDispatchStatus FileManagerComponentBase ::
3390 doDispatch()
3391 {
3392 ComponentIpcSerializableBuffer msg;
3393 NATIVE_INT_TYPE priority = 0;
3394
3395 Os::Queue::QueueStatus msgStatus = this->m_queue.receive(
3396 msg,
3397 priority,
3399 );
3400 FW_ASSERT(
3401 msgStatus == Os::Queue::QUEUE_OK,
3402 static_cast<FwAssertArgType>(msgStatus)
3403 );
3404
3405 // Reset to beginning of buffer
3406 msg.resetDeser();
3407
3408 NATIVE_INT_TYPE desMsg = 0;
3409 Fw::SerializeStatus deserStatus = msg.deserialize(desMsg);
3410 FW_ASSERT(
3411 deserStatus == Fw::FW_SERIALIZE_OK,
3412 static_cast<FwAssertArgType>(deserStatus)
3413 );
3414
3415 MsgTypeEnum msgType = static_cast<MsgTypeEnum>(desMsg);
3416
3417 if (msgType == FILEMANAGER_COMPONENT_EXIT) {
3418 return MSG_DISPATCH_EXIT;
3419 }
3420
3421 NATIVE_INT_TYPE portNum = 0;
3422 deserStatus = msg.deserialize(portNum);
3423 FW_ASSERT(
3424 deserStatus == Fw::FW_SERIALIZE_OK,
3425 static_cast<FwAssertArgType>(deserStatus)
3426 );
3427
3428 switch (msgType) {
3429 // Handle async input port pingIn
3430 case PINGIN_PING: {
3431 // Deserialize argument key
3432 U32 key;
3433 deserStatus = msg.deserialize(key);
3434 FW_ASSERT(
3435 deserStatus == Fw::FW_SERIALIZE_OK,
3436 static_cast<FwAssertArgType>(deserStatus)
3437 );
3438 // Call handler function
3439 this->pingIn_handler(
3440 portNum,
3441 key
3442 );
3443
3444 break;
3445 }
3446
3447 // Handle command CreateDirectory
3448 case CMD_CREATEDIRECTORY: {
3449 // Deserialize opcode
3450 FwOpcodeType opCode = 0;
3451 deserStatus = msg.deserialize(opCode);
3452 FW_ASSERT (
3453 deserStatus == Fw::FW_SERIALIZE_OK,
3454 static_cast<FwAssertArgType>(deserStatus)
3455 );
3456
3457 // Deserialize command sequence
3458 U32 cmdSeq = 0;
3459 deserStatus = msg.deserialize(cmdSeq);
3460 FW_ASSERT (
3461 deserStatus == Fw::FW_SERIALIZE_OK,
3462 static_cast<FwAssertArgType>(deserStatus)
3463 );
3464
3465 // Deserialize command argument buffer
3466 Fw::CmdArgBuffer args;
3467 deserStatus = msg.deserialize(args);
3468 FW_ASSERT (
3469 deserStatus == Fw::FW_SERIALIZE_OK,
3470 static_cast<FwAssertArgType>(deserStatus)
3471 );
3472
3473 // Reset buffer
3474 args.resetDeser();
3475
3476 // Deserialize argument dirName
3477 Fw::CmdStringArg dirName;
3478 deserStatus = args.deserialize(dirName);
3479 if (deserStatus != Fw::FW_SERIALIZE_OK) {
3480 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
3481 this->cmdResponse_out(
3482 opCode,
3483 cmdSeq,
3485 );
3486 }
3487 // Don't crash the task if bad arguments were passed from the ground
3488 break;
3489 }
3490
3491 // Make sure there was no data left over.
3492 // That means the argument buffer size was incorrect.
3493#if FW_CMD_CHECK_RESIDUAL
3494 if (args.getBuffLeft() != 0) {
3495 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
3496 this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
3497 }
3498 // Don't crash the task if bad arguments were passed from the ground
3499 break;
3500 }
3501#endif
3502
3503 // Call handler function
3504 this->CreateDirectory_cmdHandler(
3505 opCode, cmdSeq,
3506 dirName
3507 );
3508
3509 break;
3510 }
3511
3512 // Handle command MoveFile
3513 case CMD_MOVEFILE: {
3514 // Deserialize opcode
3515 FwOpcodeType opCode = 0;
3516 deserStatus = msg.deserialize(opCode);
3517 FW_ASSERT (
3518 deserStatus == Fw::FW_SERIALIZE_OK,
3519 static_cast<FwAssertArgType>(deserStatus)
3520 );
3521
3522 // Deserialize command sequence
3523 U32 cmdSeq = 0;
3524 deserStatus = msg.deserialize(cmdSeq);
3525 FW_ASSERT (
3526 deserStatus == Fw::FW_SERIALIZE_OK,
3527 static_cast<FwAssertArgType>(deserStatus)
3528 );
3529
3530 // Deserialize command argument buffer
3531 Fw::CmdArgBuffer args;
3532 deserStatus = msg.deserialize(args);
3533 FW_ASSERT (
3534 deserStatus == Fw::FW_SERIALIZE_OK,
3535 static_cast<FwAssertArgType>(deserStatus)
3536 );
3537
3538 // Reset buffer
3539 args.resetDeser();
3540
3541 // Deserialize argument sourceFileName
3542 Fw::CmdStringArg sourceFileName;
3543 deserStatus = args.deserialize(sourceFileName);
3544 if (deserStatus != Fw::FW_SERIALIZE_OK) {
3545 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
3546 this->cmdResponse_out(
3547 opCode,
3548 cmdSeq,
3550 );
3551 }
3552 // Don't crash the task if bad arguments were passed from the ground
3553 break;
3554 }
3555
3556 // Deserialize argument destFileName
3557 Fw::CmdStringArg destFileName;
3558 deserStatus = args.deserialize(destFileName);
3559 if (deserStatus != Fw::FW_SERIALIZE_OK) {
3560 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
3561 this->cmdResponse_out(
3562 opCode,
3563 cmdSeq,
3565 );
3566 }
3567 // Don't crash the task if bad arguments were passed from the ground
3568 break;
3569 }
3570
3571 // Make sure there was no data left over.
3572 // That means the argument buffer size was incorrect.
3573#if FW_CMD_CHECK_RESIDUAL
3574 if (args.getBuffLeft() != 0) {
3575 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
3576 this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
3577 }
3578 // Don't crash the task if bad arguments were passed from the ground
3579 break;
3580 }
3581#endif
3582
3583 // Call handler function
3584 this->MoveFile_cmdHandler(
3585 opCode, cmdSeq,
3586 sourceFileName,
3587 destFileName
3588 );
3589
3590 break;
3591 }
3592
3593 // Handle command RemoveDirectory
3594 case CMD_REMOVEDIRECTORY: {
3595 // Deserialize opcode
3596 FwOpcodeType opCode = 0;
3597 deserStatus = msg.deserialize(opCode);
3598 FW_ASSERT (
3599 deserStatus == Fw::FW_SERIALIZE_OK,
3600 static_cast<FwAssertArgType>(deserStatus)
3601 );
3602
3603 // Deserialize command sequence
3604 U32 cmdSeq = 0;
3605 deserStatus = msg.deserialize(cmdSeq);
3606 FW_ASSERT (
3607 deserStatus == Fw::FW_SERIALIZE_OK,
3608 static_cast<FwAssertArgType>(deserStatus)
3609 );
3610
3611 // Deserialize command argument buffer
3612 Fw::CmdArgBuffer args;
3613 deserStatus = msg.deserialize(args);
3614 FW_ASSERT (
3615 deserStatus == Fw::FW_SERIALIZE_OK,
3616 static_cast<FwAssertArgType>(deserStatus)
3617 );
3618
3619 // Reset buffer
3620 args.resetDeser();
3621
3622 // Deserialize argument dirName
3623 Fw::CmdStringArg dirName;
3624 deserStatus = args.deserialize(dirName);
3625 if (deserStatus != Fw::FW_SERIALIZE_OK) {
3626 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
3627 this->cmdResponse_out(
3628 opCode,
3629 cmdSeq,
3631 );
3632 }
3633 // Don't crash the task if bad arguments were passed from the ground
3634 break;
3635 }
3636
3637 // Make sure there was no data left over.
3638 // That means the argument buffer size was incorrect.
3639#if FW_CMD_CHECK_RESIDUAL
3640 if (args.getBuffLeft() != 0) {
3641 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
3642 this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
3643 }
3644 // Don't crash the task if bad arguments were passed from the ground
3645 break;
3646 }
3647#endif
3648
3649 // Call handler function
3650 this->RemoveDirectory_cmdHandler(
3651 opCode, cmdSeq,
3652 dirName
3653 );
3654
3655 break;
3656 }
3657
3658 // Handle command RemoveFile
3659 case CMD_REMOVEFILE: {
3660 // Deserialize opcode
3661 FwOpcodeType opCode = 0;
3662 deserStatus = msg.deserialize(opCode);
3663 FW_ASSERT (
3664 deserStatus == Fw::FW_SERIALIZE_OK,
3665 static_cast<FwAssertArgType>(deserStatus)
3666 );
3667
3668 // Deserialize command sequence
3669 U32 cmdSeq = 0;
3670 deserStatus = msg.deserialize(cmdSeq);
3671 FW_ASSERT (
3672 deserStatus == Fw::FW_SERIALIZE_OK,
3673 static_cast<FwAssertArgType>(deserStatus)
3674 );
3675
3676 // Deserialize command argument buffer
3677 Fw::CmdArgBuffer args;
3678 deserStatus = msg.deserialize(args);
3679 FW_ASSERT (
3680 deserStatus == Fw::FW_SERIALIZE_OK,
3681 static_cast<FwAssertArgType>(deserStatus)
3682 );
3683
3684 // Reset buffer
3685 args.resetDeser();
3686
3687 // Deserialize argument fileName
3688 Fw::CmdStringArg fileName;
3689 deserStatus = args.deserialize(fileName);
3690 if (deserStatus != Fw::FW_SERIALIZE_OK) {
3691 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
3692 this->cmdResponse_out(
3693 opCode,
3694 cmdSeq,
3696 );
3697 }
3698 // Don't crash the task if bad arguments were passed from the ground
3699 break;
3700 }
3701
3702 // Deserialize argument ignoreErrors
3703 bool ignoreErrors;
3704 deserStatus = args.deserialize(ignoreErrors);
3705 if (deserStatus != Fw::FW_SERIALIZE_OK) {
3706 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
3707 this->cmdResponse_out(
3708 opCode,
3709 cmdSeq,
3711 );
3712 }
3713 // Don't crash the task if bad arguments were passed from the ground
3714 break;
3715 }
3716
3717 // Make sure there was no data left over.
3718 // That means the argument buffer size was incorrect.
3719#if FW_CMD_CHECK_RESIDUAL
3720 if (args.getBuffLeft() != 0) {
3721 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
3722 this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
3723 }
3724 // Don't crash the task if bad arguments were passed from the ground
3725 break;
3726 }
3727#endif
3728
3729 // Call handler function
3730 this->RemoveFile_cmdHandler(
3731 opCode, cmdSeq,
3732 fileName,
3733 ignoreErrors
3734 );
3735
3736 break;
3737 }
3738
3739 // Handle command ShellCommand
3740 case CMD_SHELLCOMMAND: {
3741 // Deserialize opcode
3742 FwOpcodeType opCode = 0;
3743 deserStatus = msg.deserialize(opCode);
3744 FW_ASSERT (
3745 deserStatus == Fw::FW_SERIALIZE_OK,
3746 static_cast<FwAssertArgType>(deserStatus)
3747 );
3748
3749 // Deserialize command sequence
3750 U32 cmdSeq = 0;
3751 deserStatus = msg.deserialize(cmdSeq);
3752 FW_ASSERT (
3753 deserStatus == Fw::FW_SERIALIZE_OK,
3754 static_cast<FwAssertArgType>(deserStatus)
3755 );
3756
3757 // Deserialize command argument buffer
3758 Fw::CmdArgBuffer args;
3759 deserStatus = msg.deserialize(args);
3760 FW_ASSERT (
3761 deserStatus == Fw::FW_SERIALIZE_OK,
3762 static_cast<FwAssertArgType>(deserStatus)
3763 );
3764
3765 // Reset buffer
3766 args.resetDeser();
3767
3768 // Deserialize argument command
3769 Fw::CmdStringArg command;
3770 deserStatus = args.deserialize(command);
3771 if (deserStatus != Fw::FW_SERIALIZE_OK) {
3772 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
3773 this->cmdResponse_out(
3774 opCode,
3775 cmdSeq,
3777 );
3778 }
3779 // Don't crash the task if bad arguments were passed from the ground
3780 break;
3781 }
3782
3783 // Deserialize argument logFileName
3784 Fw::CmdStringArg logFileName;
3785 deserStatus = args.deserialize(logFileName);
3786 if (deserStatus != Fw::FW_SERIALIZE_OK) {
3787 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
3788 this->cmdResponse_out(
3789 opCode,
3790 cmdSeq,
3792 );
3793 }
3794 // Don't crash the task if bad arguments were passed from the ground
3795 break;
3796 }
3797
3798 // Make sure there was no data left over.
3799 // That means the argument buffer size was incorrect.
3800#if FW_CMD_CHECK_RESIDUAL
3801 if (args.getBuffLeft() != 0) {
3802 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
3803 this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
3804 }
3805 // Don't crash the task if bad arguments were passed from the ground
3806 break;
3807 }
3808#endif
3809
3810 // Call handler function
3811 this->ShellCommand_cmdHandler(
3812 opCode, cmdSeq,
3813 command,
3814 logFileName
3815 );
3816
3817 break;
3818 }
3819
3820 // Handle command AppendFile
3821 case CMD_APPENDFILE: {
3822 // Deserialize opcode
3823 FwOpcodeType opCode = 0;
3824 deserStatus = msg.deserialize(opCode);
3825 FW_ASSERT (
3826 deserStatus == Fw::FW_SERIALIZE_OK,
3827 static_cast<FwAssertArgType>(deserStatus)
3828 );
3829
3830 // Deserialize command sequence
3831 U32 cmdSeq = 0;
3832 deserStatus = msg.deserialize(cmdSeq);
3833 FW_ASSERT (
3834 deserStatus == Fw::FW_SERIALIZE_OK,
3835 static_cast<FwAssertArgType>(deserStatus)
3836 );
3837
3838 // Deserialize command argument buffer
3839 Fw::CmdArgBuffer args;
3840 deserStatus = msg.deserialize(args);
3841 FW_ASSERT (
3842 deserStatus == Fw::FW_SERIALIZE_OK,
3843 static_cast<FwAssertArgType>(deserStatus)
3844 );
3845
3846 // Reset buffer
3847 args.resetDeser();
3848
3849 // Deserialize argument source
3850 Fw::CmdStringArg source;
3851 deserStatus = args.deserialize(source);
3852 if (deserStatus != Fw::FW_SERIALIZE_OK) {
3853 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
3854 this->cmdResponse_out(
3855 opCode,
3856 cmdSeq,
3858 );
3859 }
3860 // Don't crash the task if bad arguments were passed from the ground
3861 break;
3862 }
3863
3864 // Deserialize argument target
3865 Fw::CmdStringArg target;
3866 deserStatus = args.deserialize(target);
3867 if (deserStatus != Fw::FW_SERIALIZE_OK) {
3868 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
3869 this->cmdResponse_out(
3870 opCode,
3871 cmdSeq,
3873 );
3874 }
3875 // Don't crash the task if bad arguments were passed from the ground
3876 break;
3877 }
3878
3879 // Make sure there was no data left over.
3880 // That means the argument buffer size was incorrect.
3881#if FW_CMD_CHECK_RESIDUAL
3882 if (args.getBuffLeft() != 0) {
3883 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
3884 this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
3885 }
3886 // Don't crash the task if bad arguments were passed from the ground
3887 break;
3888 }
3889#endif
3890
3891 // Call handler function
3892 this->AppendFile_cmdHandler(
3893 opCode, cmdSeq,
3894 source,
3895 target
3896 );
3897
3898 break;
3899 }
3900
3901 // Handle command FileSize
3902 case CMD_FILESIZE: {
3903 // Deserialize opcode
3904 FwOpcodeType opCode = 0;
3905 deserStatus = msg.deserialize(opCode);
3906 FW_ASSERT (
3907 deserStatus == Fw::FW_SERIALIZE_OK,
3908 static_cast<FwAssertArgType>(deserStatus)
3909 );
3910
3911 // Deserialize command sequence
3912 U32 cmdSeq = 0;
3913 deserStatus = msg.deserialize(cmdSeq);
3914 FW_ASSERT (
3915 deserStatus == Fw::FW_SERIALIZE_OK,
3916 static_cast<FwAssertArgType>(deserStatus)
3917 );
3918
3919 // Deserialize command argument buffer
3920 Fw::CmdArgBuffer args;
3921 deserStatus = msg.deserialize(args);
3922 FW_ASSERT (
3923 deserStatus == Fw::FW_SERIALIZE_OK,
3924 static_cast<FwAssertArgType>(deserStatus)
3925 );
3926
3927 // Reset buffer
3928 args.resetDeser();
3929
3930 // Deserialize argument fileName
3931 Fw::CmdStringArg fileName;
3932 deserStatus = args.deserialize(fileName);
3933 if (deserStatus != Fw::FW_SERIALIZE_OK) {
3934 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
3935 this->cmdResponse_out(
3936 opCode,
3937 cmdSeq,
3939 );
3940 }
3941 // Don't crash the task if bad arguments were passed from the ground
3942 break;
3943 }
3944
3945 // Make sure there was no data left over.
3946 // That means the argument buffer size was incorrect.
3947#if FW_CMD_CHECK_RESIDUAL
3948 if (args.getBuffLeft() != 0) {
3949 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
3950 this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
3951 }
3952 // Don't crash the task if bad arguments were passed from the ground
3953 break;
3954 }
3955#endif
3956
3957 // Call handler function
3958 this->FileSize_cmdHandler(
3959 opCode, cmdSeq,
3960 fileName
3961 );
3962
3963 break;
3964 }
3965
3966 default:
3967 return MSG_DISPATCH_ERROR;
3968 }
3969
3970 return MSG_DISPATCH_OK;
3971 }
3972
3973 // ----------------------------------------------------------------------
3974 // Calls for messages received on special input ports
3975 // ----------------------------------------------------------------------
3976
3977 void FileManagerComponentBase ::
3978 m_p_cmdIn_in(
3979 Fw::PassiveComponentBase* callComp,
3980 NATIVE_INT_TYPE portNum,
3981 FwOpcodeType opCode,
3982 U32 cmdSeq,
3983 Fw::CmdArgBuffer& args
3984 )
3985 {
3986 FW_ASSERT(callComp);
3987 FileManagerComponentBase* compPtr = static_cast<FileManagerComponentBase*>(callComp);
3988
3989 const U32 idBase = callComp->getIdBase();
3990 FW_ASSERT(opCode >= idBase, opCode, idBase);
3991
3992 // Select base class function based on opcode
3993 switch (opCode - idBase) {
3994 case OPCODE_CREATEDIRECTORY: {
3995 compPtr->CreateDirectory_cmdHandlerBase(
3996 opCode,
3997 cmdSeq,
3998 args
3999 );
4000 break;
4001 }
4002
4003 case OPCODE_MOVEFILE: {
4004 compPtr->MoveFile_cmdHandlerBase(
4005 opCode,
4006 cmdSeq,
4007 args
4008 );
4009 break;
4010 }
4011
4012 case OPCODE_REMOVEDIRECTORY: {
4013 compPtr->RemoveDirectory_cmdHandlerBase(
4014 opCode,
4015 cmdSeq,
4016 args
4017 );
4018 break;
4019 }
4020
4021 case OPCODE_REMOVEFILE: {
4022 compPtr->RemoveFile_cmdHandlerBase(
4023 opCode,
4024 cmdSeq,
4025 args
4026 );
4027 break;
4028 }
4029
4030 case OPCODE_SHELLCOMMAND: {
4031 compPtr->ShellCommand_cmdHandlerBase(
4032 opCode,
4033 cmdSeq,
4034 args
4035 );
4036 break;
4037 }
4038
4039 case OPCODE_APPENDFILE: {
4040 compPtr->AppendFile_cmdHandlerBase(
4041 opCode,
4042 cmdSeq,
4043 args
4044 );
4045 break;
4046 }
4047
4048 case OPCODE_FILESIZE: {
4049 compPtr->FileSize_cmdHandlerBase(
4050 opCode,
4051 cmdSeq,
4052 args
4053 );
4054 break;
4055 }
4056 }
4057 }
4058
4059 // ----------------------------------------------------------------------
4060 // Calls for messages received on typed input ports
4061 // ----------------------------------------------------------------------
4062
4063 void FileManagerComponentBase ::
4064 m_p_pingIn_in(
4065 Fw::PassiveComponentBase* callComp,
4066 NATIVE_INT_TYPE portNum,
4067 U32 key
4068 )
4069 {
4070 FW_ASSERT(callComp);
4071 FileManagerComponentBase* compPtr = static_cast<FileManagerComponentBase*>(callComp);
4072 compPtr->pingIn_handlerBase(
4073 portNum,
4074 key
4075 );
4076 }
4077
4078}
#define FW_ASSERT(...)
Definition Assert.hpp:14
PlatformIntType NATIVE_INT_TYPE
Definition BasicTypes.h:51
U8 BYTE
byte type
Definition BasicTypes.h:27
uint8_t U8
8-bit unsigned integer
Definition BasicTypes.h:26
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition BasicTypes.h:66
PlatformUIntType NATIVE_UINT_TYPE
Definition BasicTypes.h:52
int PlatformIntType
DefaultTypes.hpp provides fallback defaults for the platform types.
#define PRI_PlatformIntType
@ TB_NONE
No time base has been established.
Definition FpConfig.h:39
PlatformAssertArgType FwAssertArgType
Definition FpConfig.h:21
U32 FwChanIdType
Definition FpConfig.h:59
U32 FwEventIdType
Definition FpConfig.h:62
U32 FwOpcodeType
Definition FpConfig.h:56
#define FW_LOG_TEXT_BUFFER_SIZE
Max size of string for text log message.
Definition FpConfig.h:299
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects)
Definition FpConfig.h:88
@ ACTIVE_COMPONENT_EXIT
message to exit active component task
Enum representing a command response.
@ FORMAT_ERROR
Command failed to deserialize.
@ SERIALIZED_SIZE
The size of the serial representations of the port arguments.
Definition CmdPortAc.hpp:37
@ WARNING_HI
A serious but recoverable event.
@ ACTIVITY_HI
Important informational events.
const char * toChar() const override
Definition LogString.cpp:49
SerializeStatus serialize(SerializeBufferBase &buffer) const override
serialization function
Definition LogString.cpp:57
void init()
Object initializer.
Definition ObjBase.cpp:27
NATIVE_UINT_TYPE getBuffLeft() const
returns how much deserialization buffer is left
void resetDeser()
reset deserialization to beginning
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
@ QUEUE_OK
message sent/received okay
Definition Queue.hpp:28
QueueBlocking
Definition Queue.hpp:40
@ QUEUE_BLOCKING
Queue receive blocks until a message arrives.
Definition Queue.hpp:41
@ QUEUE_NONBLOCKING
Queue receive always returns even if there is no message.
Definition Queue.hpp:42
@ SERIALIZED_SIZE
The size of the serial representations of the port arguments.
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.
const Time ZERO_TIME
Definition Time.cpp:5
#define U64(C)
Definition sha.h:176