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