F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
PrmDbImpl.hpp
Go to the documentation of this file.
1 
13 #ifndef PRMDBIMPL_HPP_
14 #define PRMDBIMPL_HPP_
15 
17 #include <Fw/Types/String.hpp>
18 #include <Os/Mutex.hpp>
22 #include <config/PrmDbImplCfg.hpp>
23 #include <cstring>
24 
25 namespace Svc {
26 
31 
38 
39 class PrmDbImpl final : public PrmDbComponentBase {
40  friend class PrmDbTester;
41 
43 
44  public:
51  PrmDbImpl(const char* name);
52 
58  void configure(const char* file);
59 
65  void readParamFile(); // NOTE: Assumed to run at initialization time. No guard of data structure.
66 
69  virtual ~PrmDbImpl();
70 
71  // Parameter update status for an individual parameter update or add
77  };
78 
79  // Enum to return status of parameter file load
83  };
84 
85  protected:
86  private:
87  Fw::String m_fileName;
88 
89  PrmDbFileLoadState m_state; // Current file load state of the parameter database
90 
91  // Pointers to the active and staging databases
92  // These point to the actual storage arrays below
93  // The active database is the ONLY one used for getting parameters
94  // The staging database is used for loading parameters from a file
95  // when commanded. Upon reading the file, the parameters are "staged"
96  // into the staging database, and then committed to the active database
97  // when a commit command is received.
98  PrmDbStore* m_activeDb;
99  PrmDbStore* m_stagingDb;
100 
101  // Actual storage for the active and staging databases
102  PrmDbStore m_dbStore1;
103  PrmDbStore m_dbStore2;
104 
108 
118  PrmLoadStatus readParamFileImpl(const Fw::StringBase& fileName, PrmDbType dbType);
119 
129  Fw::ParamValid getPrm_handler(FwIndexType portNum, FwPrmIdType id, Fw::ParamBuffer& val);
130 
139  void setPrm_handler(FwIndexType portNum, FwPrmIdType id, Fw::ParamBuffer& val);
140 
148  PrmDbImpl::PrmUpdateType updateAddPrmImpl(FwPrmIdType id, Fw::ParamBuffer& val, PrmDbType prmDbType);
149 
158  void pingIn_handler(FwIndexType portNum, U32 key);
159 
168  void PRM_SAVE_FILE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq);
169 
182  void PRM_LOAD_FILE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdStringArg& fileName, PrmDb_Merge merge);
183 
193  void PRM_COMMIT_STAGED_cmdHandler(FwOpcodeType opCode, U32 cmdSeq);
194 
198 
204  void clearDb(PrmDbType prmDbType);
205 
210  PrmDbStore* getDbPtr(PrmDbType dbType);
211 
216  static Fw::String getDbString(PrmDbType dbType);
217 
223  void dbCopy(PrmDbType dest, PrmDbType src);
224 };
225 } // namespace Svc
226 
227 #endif /* PRMDBIMPL_HPP_ */
Parameter already in database, updated parameter.
Definition: PrmDbImpl.hpp:75
State of parameter DB file load operations.
FwIdType FwOpcodeType
The type of a command opcode.
PrmDb_PrmWriteError PrmWriteError
Definition: PrmDbImpl.hpp:27
friend class PrmDbTester
Definition: PrmDbImpl.hpp:40
void readParamFile()
PrmDb file read function.
Definition: PrmDbImpl.cpp:57
FwIdType FwPrmIdType
The type of a parameter identifier.
PrmDbImpl(const char *name)
PrmDb constructor.
Definition: PrmDbImpl.cpp:42
PrmDb_PrmDbType PrmDbType
Definition: PrmDbImpl.hpp:29
Parameter added to database.
Definition: PrmDbImpl.hpp:74
Component class for managing parameters.
Definition: PrmDbImpl.hpp:39
File load error.
Definition: PrmDbImpl.hpp:82
void configure(const char *file)
PrmDb configure method.
Definition: PrmDbImpl.cpp:52
Auto-generated base for PrmDb component.
PrmDb_PrmReadError PrmReadError
Definition: PrmDbImpl.hpp:28
PrmDb_PrmDbFileLoadState PrmDbFileLoadState
Definition: PrmDbImpl.hpp:30
PlatformIndexType FwIndexType
File load successful.
Definition: PrmDbImpl.hpp:81
RateGroupDivider component implementation.
Enum representing parameter validity.
No slots available to add new parameter.
Definition: PrmDbImpl.hpp:73
virtual ~PrmDbImpl()
PrmDb destructor.
Definition: PrmDbImpl.cpp:50