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