ConOpSys V2970  P004.07
ANVILEX control operating system
Command_Manager_Base.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file Command_Manager_Base.h
3 //! @brief ConOpSys command manager base class header file.
4 //! @attention No special attention requered.
5 //! @copyright (C) 2015-2020 ANVILEX LLC
6 //! $HeadURL: https://192.168.3.4:8443/svn/P004_07/ConOpSys/Engine/Command_Manager_Base.h $
7 //! $Revision: 2581 $
8 //! $Date: 2021-04-11 17:48:33 +0500 (So, 11 Apr 2021) $
9 //! $Author: minch $
10 //------------------------------------------------------------------------------
11 //
12 // Redistribution and use in source and binary forms, with or without
13 // modification, are permitted provided that the following conditions are met:
14 //
15 // 1. Redistributions of source code must retain the above copyright notice,
16 // this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright notice,
19 // this list of conditions and the following disclaimer in the documentation
20 // and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of ANVILEX nor the names of its contributors may be
23 // used to endorse or promote products derived from this software without
24 // specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
30 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 // POSSIBILITY OF SUCH DAMAGE.
37 //
38 //------------------------------------------------------------------------------
39 
40 //------------------------------------------------------------------------------
41 // Protecting header files from mutual, recursive inclusion.
42 //------------------------------------------------------------------------------
43 
44 #pragma once
45 
46 //------------------------------------------------------------------------------
47 // Include standard libraries header files
48 //------------------------------------------------------------------------------
49 
50 //------------------------------------------------------------------------------
51 // Include thrid party header files
52 //------------------------------------------------------------------------------
53 
54 //------------------------------------------------------------------------------
55 // Include ConOpSys header files
56 //------------------------------------------------------------------------------
57 
58 #include "Command_Base.h"
59 
60 //------------------------------------------------------------------------------
61 // Include ConOpSys related commands headers
62 //------------------------------------------------------------------------------
63 
64 //------------------------------------------------------------------------------
65 // Include ConOpSys application header files
66 //------------------------------------------------------------------------------
67 
68 //------------------------------------------------------------------------------
69 // Class definitions
70 //------------------------------------------------------------------------------
71 
72 //! @brief ConOpSys terminal command manager base class
74 {
75 
76  //----------------------------------------------------------------------------
77  // Public defines, methods and variables
78  //----------------------------------------------------------------------------
79 
80  public:
81 
82  //!-------------------------------------------------------------------------
83  //! @brief Class constructor method
84  //! @note None
85  //! \par Override
86  //! Not allowed
87  //! @attention Don't call this method directly.
88  //--------------------------------------------------------------------------
89 
91 
92  //!-------------------------------------------------------------------------
93  //! @brief Class destructor method
94  //! @note None
95  //! \par Override
96  //! Not allowed
97  //! @attention Don't call this method directly.
98  //--------------------------------------------------------------------------
99 
100  virtual ~TCommand_Manager_Base();
101 
102  //!-------------------------------------------------------------------------
103  //! @brief Command manager initialisation method
104  //! @note None
105  //! \par Override
106  //! Not allowed
107  //! @attention Don't call this method directly.
108  //--------------------------------------------------------------------------
109 
110  virtual VOID Init();
111 
112  //!-------------------------------------------------------------------------
113  //! @brief Command manager finalisation method
114  //! @note None
115  //! \par Override
116  //! Not allowed
117  //! @attention Don't call this method directly.
118  //--------------------------------------------------------------------------
119 
120  virtual VOID Done();
121 
122  //!-------------------------------------------------------------------------
123  //! @brief Get command object index referenced by command object pointer
124  //! @note This method allows resovle command manager storage index of the command
125  //! @param [out] *u32_Storage_Index - Command manager storage index
126  //! @param [in] *object_Command - Pointer to the command object
127  //! @return BOOL - Execution status
128  //! @retval false - Command object not found in command manager storage
129  //! @retval true - Command object found in command manager storage
130  //! \par Override
131  //! Not allowed
132  //! @attention None
133  //--------------------------------------------------------------------------
134 
135  virtual BOOL Get_Index( U32 *u32_Storage_Index, TCommand_Base *object_Command );
136 
137  //!-------------------------------------------------------------------------
138  //! @brief Get pointer to the command object referenced by command manager storage index
139  //! @note None
140  //! @param [in] u32_Storage_Index - Command manager storage index
141  //! @param [out] **object_Command - Pointer to the command object
142  //! @return BOOL - Execution status
143  //! @retval false - Command object not found in command manager storage
144  //! @retval true - Command object found in command manager storage
145  //! \par Override
146  //! Not allowed
147  //! @attention None
148  //--------------------------------------------------------------------------
149 
150  virtual BOOL Get_Command_By_Storage_Index( U32 u32_Storage_Index, TCommand_Base **object_Command );
151 
152  //!-------------------------------------------------------------------------
153  //! @brief Test for command registered in command manager
154  //! @note None
155  //! @param [in] *object_Command - Pointer to the command object
156  //! @return BOOL - Execution status
157  //! @retval false - Command object not registered in command manager storage
158  //! @retval true - Command object registered in command manager storage
159  //! \par Override
160  //! Not allowed
161  //! @attention None
162  //--------------------------------------------------------------------------
163 
164  virtual BOOL Is_Registered( TCommand_Base *object_Command );
165 
166  //!-------------------------------------------------------------------------
167  //! @brief Performs registration of the command in command manager
168  //! @note None
169  //! @param [in] *object_Command - Pointer to the command object
170  //! @return BOOL - Execution status
171  //! @retval false - Command object registration successed
172  //! @retval true - Command object registration failed
173  //! \par Override
174  //! Not allowed
175  //! @attention None
176  //--------------------------------------------------------------------------
177 
178  virtual BOOL Register( TCommand_Base *object_Command );
179 
180  //!-------------------------------------------------------------------------
181  //! @brief Performs unregistration of the command in command manager
182  //! @note None
183  //! @param [in] *object_Command - Pointer to the command object
184  //! @return BOOL - Execution status
185  //! @retval false - Command object unregistration successed
186  //! @retval true - Command object unregistration failed
187  //! \par Override
188  //! Not allowed
189  //! @attention None
190  //--------------------------------------------------------------------------
191 
192  virtual BOOL Unregister( TCommand_Base *object_Command );
193 
194  //!-------------------------------------------------------------------------
195  //! @brief Execute command method
196  //! @note None
197  //! @param [in] *c8_Command_String - Pointer to the command name string
198  //! @param [in] *object_Protocol - Pointer to the communication protocol object
199  //! @return BOOL - Execution status
200  //! @retval false - Command name is not equal and command not executed
201  //! @retval true - Command name is equal and command executed
202  //! \par Override
203  //! Not allowed
204  //! @attention None
205  //--------------------------------------------------------------------------
206 
207  virtual BOOL Execute( C8 *c8_Command_String, TProtocol_Base *object_Protocol );
208 
209  //!-------------------------------------------------------------------------
210  //! @brief Get command count registered in command manager
211  //! @note None
212  //! @return U32 - Command count
213  //! \par Override
214  //! Not allowed
215  //! @attention None
216  //--------------------------------------------------------------------------
217 
218  virtual U32 Get_Command_Count();
219 
220  //!-------------------------------------------------------------------------
221  //! @brief Get command manager storage utilisation
222  //! @note None
223  //! @param [out] *u32_Command_Capacity - Pointer to the command manager capacity variable
224  //! @param [out] *u32_Command_Count - Pointer to the command count variable
225  //! @return None
226  //! \par Override
227  //! Not allowed
228  //! @attention None
229  //--------------------------------------------------------------------------
230 
231  virtual VOID Get_Usage( U32 *u32_Command_Capacity, U32 *u32_Command_Count );
232 
233  //!-------------------------------------------------------------------------
234  //! @brief Send boot information message over given protocol
235  //! @note None
236  //! @param [in] *object_Protocol - Pointer to the protocol object
237  //! @return None
238  //! \par Override
239  //! Not allowed
240  //! @attention None
241  //--------------------------------------------------------------------------
242 
243  virtual VOID Show_Boot_Information( TProtocol_Base *object_Protocol );
244 
245  //!-------------------------------------------------------------------------
246  //! @brief This method return OS status
247  //! @note None
248  //! @return U32 - OS status
249  //! \par Override
250  //! Required
251  //! @attention None
252  //--------------------------------------------------------------------------
253 
254  virtual U32 Get_OS_Status();
255 
256  //!-------------------------------------------------------------------------
257  //! @brief This method set module in operation mode
258  //! @note None
259  //! @return BOOL - Module status
260  //! @retval false - Module in error mode
261  //! @retval true - Module ready to operations
262  //! \par Override
263  //! Required
264  //! @attention None
265  //--------------------------------------------------------------------------
266 
267  virtual BOOL Start_Operation();
268 
269  //----------------------------------------------------------------------------
270  // Protected defines, methods and variables
271  //----------------------------------------------------------------------------
272 
273  protected:
274 
275  //! @brief Container for OS status
277 
278  //----------------------------------------------------------------------------
279  // Private defines, methods and variables
280  //----------------------------------------------------------------------------
281 
282  private:
283 
284 };
285 
286 //------------------------------------------------------------------------------
287 // End of file
288 //------------------------------------------------------------------------------
ConOpSys command base class header file.
int BOOL
Boolean datatype definition.
Definition: Defines.h:124
void VOID
Datatypesess datatype definition.
Definition: Defines.h:105
unsigned long U32
Binary 32-Bit unsigned integer datatype defenition.
Definition: Defines.h:203
char C8
ASCII 8-Bit char datatype defenition.
Definition: Defines.h:156
ConOpSys terminal command base class.
Definition: Command_Base.h:86
ConOpSys terminal command manager base class.
Definition: Command_Manager_Base.h:74
TCommand_Manager_Base()
Class constructor method.
Definition: Command_Manager_Base.cpp:78
virtual BOOL Start_Operation()
This method set module in operation mode.
Definition: Command_Manager_Base.cpp:233
virtual BOOL Execute(C8 *c8_Command_String, TProtocol_Base *object_Protocol)
Execute command method.
Definition: Command_Manager_Base.cpp:182
virtual BOOL Register(TCommand_Base *object_Command)
Performs registration of the command in command manager.
Definition: Command_Manager_Base.cpp:158
virtual VOID Done()
Command manager finalisation method.
Definition: Command_Manager_Base.cpp:106
virtual BOOL Unregister(TCommand_Base *object_Command)
Performs unregistration of the command in command manager.
Definition: Command_Manager_Base.cpp:170
virtual BOOL Get_Index(U32 *u32_Storage_Index, TCommand_Base *object_Command)
Get command object index referenced by command object pointer.
Definition: Command_Manager_Base.cpp:122
virtual ~TCommand_Manager_Base()
Class destructor method.
Definition: Command_Manager_Base.cpp:90
TOS_Status_Structure struct_OS_Status
Container for OS status.
Definition: Command_Manager_Base.h:276
virtual VOID Show_Boot_Information(TProtocol_Base *object_Protocol)
Send boot information message over given protocol.
Definition: Command_Manager_Base.cpp:114
virtual VOID Get_Usage(U32 *u32_Command_Capacity, U32 *u32_Command_Count)
Get command manager storage utilisation.
Definition: Command_Manager_Base.cpp:206
virtual BOOL Is_Registered(TCommand_Base *object_Command)
Test for command registered in command manager.
Definition: Command_Manager_Base.cpp:146
virtual U32 Get_OS_Status()
This method return OS status.
Definition: Command_Manager_Base.cpp:221
virtual VOID Init()
Command manager initialisation method.
Definition: Command_Manager_Base.cpp:98
virtual U32 Get_Command_Count()
Get command count registered in command manager.
Definition: Command_Manager_Base.cpp:194
virtual BOOL Get_Command_By_Storage_Index(U32 u32_Storage_Index, TCommand_Base **object_Command)
Get pointer to the command object referenced by command manager storage index.
Definition: Command_Manager_Base.cpp:134
Definition: Protocol_Base.h:57
OS parameter status structure.
Definition: Defines.h:855