F´ Flight Software - C/C++ Documentation  NASA-v1.6.0
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 "Svc/FileManager/FileManagerComponentAc.hpp"
17 #include "Os/FileSystem.hpp"
18 
19 namespace Svc {
20 
21  class FileManager :
22  public FileManagerComponentBase
23  {
24 
25  public:
26 
27  // ----------------------------------------------------------------------
28  // Construction, initialization, and destruction
29  // ----------------------------------------------------------------------
30 
34  const char *const compName
35  );
36 
39  void init(
40  const NATIVE_INT_TYPE queueDepth,
41  const NATIVE_INT_TYPE instance
42  );
43 
46  ~FileManager();
47 
48  PRIVATE:
49 
50  // ----------------------------------------------------------------------
51  // Command handler implementations
52  // ----------------------------------------------------------------------
53 
56  void CreateDirectory_cmdHandler(
57  const FwOpcodeType opCode,
58  const U32 cmdSeq,
59  const Fw::CmdStringArg& dirName
60  );
61 
64  void RemoveFile_cmdHandler(
65  const FwOpcodeType opCode,
66  const U32 cmdSeq,
67  const Fw::CmdStringArg& fileName
68  );
69 
72  void MoveFile_cmdHandler(
73  const FwOpcodeType opCode,
74  const U32 cmdSeq,
75  const Fw::CmdStringArg& sourceFileName,
76  const Fw::CmdStringArg& destFileName
77  );
78 
81  void RemoveDirectory_cmdHandler(
82  const FwOpcodeType opCode,
83  const U32 cmdSeq,
84  const Fw::CmdStringArg& dirName
85  );
86 
89  void ShellCommand_cmdHandler(
90  const FwOpcodeType opCode,
91  const U32 cmdSeq,
92  const Fw::CmdStringArg& command,
93  const Fw::CmdStringArg& logFileName
94  );
95 
98  void AppendFile_cmdHandler(
99  const FwOpcodeType opCode,
100  const U32 cmdSeq,
101  const Fw::CmdStringArg& source,
102  const Fw::CmdStringArg& target
103  );
104 
107  void pingIn_handler(
108  const NATIVE_INT_TYPE portNum,
109  U32 key
110  );
111 
112  PRIVATE:
113 
114  // ----------------------------------------------------------------------
115  // Helper methods
116  // ----------------------------------------------------------------------
117 
120  NATIVE_INT_TYPE systemCall(
121  const Fw::CmdStringArg& command,
122  const Fw::CmdStringArg& logFileName
123  ) const;
124 
127  void emitTelemetry(
128  const Os::FileSystem::Status status
129  );
130 
133  void sendCommandResponse(
134  const FwOpcodeType opCode,
135  const U32 cmdSeq,
136  const Os::FileSystem::Status status
137  );
138 
139  PRIVATE:
140 
141  // ----------------------------------------------------------------------
142  // Variables
143  // ----------------------------------------------------------------------
144 
147  U32 commandCount;
148 
151  U32 errorCount;
152 
153 
154  };
155 
156 } // end namespace Svc
157 
158 #endif
Svc::FileManager
Definition: FileManager.hpp:21
Os::FileSystem::Status
Status
Definition: FileSystem.hpp:15
Svc::FileManager::init
void init(const NATIVE_INT_TYPE queueDepth, const NATIVE_INT_TYPE instance)
Definition: FileManager.cpp:38
Fw::CmdStringArg
Definition: CmdString.hpp:11
FileSystem.hpp
NATIVE_INT_TYPE
int NATIVE_INT_TYPE
native integer type declaration
Definition: BasicTypes.hpp:27
FwOpcodeType
#define FwOpcodeType
Type representation for a command opcode.
Definition: FpConfig.hpp:62
Svc
Definition: ActiveRateGroupCfg.hpp:18
Svc::FileManager::~FileManager
~FileManager()
Definition: FileManager.cpp:47
Svc::FileManager::FileManager
FileManager(const char *const compName)
Definition: FileManager.cpp:27