F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
FileManager.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title FileManager.hpp
3 // \author bocchino
4 // \brief hpp file for FileManager component implementation class
5 //
6 // \copyright
7 // Copyright 2009-2015, by the California Institute of Technology.
8 // ALL RIGHTS RESERVED. United States Government Sponsorship
9 // acknowledged.
10 //
11 // ======================================================================
12 
13 #ifndef Svc_FileManager_HPP
14 #define Svc_FileManager_HPP
15 
16 #include "Os/FileSystem.hpp"
18 
19 namespace Svc {
20 
21 class FileManager final : public FileManagerComponentBase {
22  public:
23  // ----------------------------------------------------------------------
24  // Construction, initialization, and destruction
25  // ----------------------------------------------------------------------
26 
29  FileManager(const char* const compName
30  );
31 
34  ~FileManager();
35 
36  private:
37  // ----------------------------------------------------------------------
38  // Command handler implementations
39  // ----------------------------------------------------------------------
40 
43  void CreateDirectory_cmdHandler(const FwOpcodeType opCode,
44  const U32 cmdSeq,
45  const Fw::CmdStringArg& dirName
46  );
47 
50  void RemoveFile_cmdHandler(const FwOpcodeType opCode,
51  const U32 cmdSeq,
52  const Fw::CmdStringArg& fileName,
53  const bool ignoreErrors
54  );
55 
58  void MoveFile_cmdHandler(const FwOpcodeType opCode,
59  const U32 cmdSeq,
60  const Fw::CmdStringArg& sourceFileName,
61  const Fw::CmdStringArg& destFileName
62  );
63 
66  void RemoveDirectory_cmdHandler(const FwOpcodeType opCode,
67  const U32 cmdSeq,
68  const Fw::CmdStringArg& dirName
69  );
70 
73  void ShellCommand_cmdHandler(const FwOpcodeType opCode,
74  const U32 cmdSeq,
75  const Fw::CmdStringArg& command,
76  const Fw::CmdStringArg& logFileName
77  );
78 
81  void AppendFile_cmdHandler(const FwOpcodeType opCode,
82  const U32 cmdSeq,
83  const Fw::CmdStringArg& source,
84  const Fw::CmdStringArg& target
85  );
86 
89  void FileSize_cmdHandler(const FwOpcodeType opCode,
90  const U32 cmdSeq,
91  const Fw::CmdStringArg& fileName
92  );
93 
96  void pingIn_handler(const FwIndexType portNum,
97  U32 key
98  );
99 
100  private:
101  // ----------------------------------------------------------------------
102  // Helper methods
103  // ----------------------------------------------------------------------
104 
107  int systemCall(const Fw::CmdStringArg& command,
108  const Fw::CmdStringArg& logFileName
109  ) const;
110 
113  void emitTelemetry(const Os::FileSystem::Status status
114  );
115 
118  void sendCommandResponse(const FwOpcodeType opCode,
119  const U32 cmdSeq,
120  const Os::FileSystem::Status status
121  );
122 
123  private:
124  // ----------------------------------------------------------------------
125  // Variables
126  // ----------------------------------------------------------------------
127 
130  U32 commandCount;
131 
134  U32 errorCount;
135 };
136 
137 } // end namespace Svc
138 
139 #endif
FwIdType FwOpcodeType
The type of a command opcode.
FileManager(const char *const compName)
Definition: FileManager.cpp:27
Auto-generated base for FileManager component.
PlatformIndexType FwIndexType
RateGroupDivider component implementation.