ConOpSys V2970  P004.07
ANVILEX control operating system
Command_Base.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file Command_Base.h
3 //! @brief ConOpSys command 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/Commands/Command_Base.h $
7 //! $Revision: 2797 $
8 //! $Date: 2021-07-12 16:13:33 +0500 (Mo, 12 Jul 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 "Application_Resource_Configuration.h"
59 #include "Protocol_Base.h"
60 
61 //------------------------------------------------------------------------------
62 // Include ConOpSys application header files
63 //------------------------------------------------------------------------------
64 
65 //! @brief Command type enumeration
66 enum class TCommand_Type : U8
67 {
68 
69  //! @brief Undefined command type
71 
72  //! @brief System embedded command type
74 
75  //! @brief User application command type
77 
78 };
79 
80 //------------------------------------------------------------------------------
81 // Class declaration
82 //------------------------------------------------------------------------------
83 
84 //! @brief ConOpSys terminal command base class
86 {
87 
88  //----------------------------------------------------------------------------
89  // Public defines, methods and variables
90  //----------------------------------------------------------------------------
91 
92  public:
93 
94  //--------------------------------------------------------------------------
95  // Public defines
96  //--------------------------------------------------------------------------
97 
98  //! @brief Command descriptor structure
99  typedef struct
100  {
101 
102  //! @brief Pointer to the command name
104 
105  //! @brief Pointer to the command description text
107 
108  //! @brief Command type
110 
111  //! @brief Pointer to the command object
113 
115 
116  //--------------------------------------------------------------------------
117  // Public methods
118  //--------------------------------------------------------------------------
119 
120  //!-------------------------------------------------------------------------
121  //! @brief Class constructor method.
122  //! @note None
123  //! @param [in] *struct_Descriptor - Pointer to the command description
124  //! \par Override
125  //! Not allowed
126  //! @attention Don't call this method directly.
127  //! \par UML diagram
128  //! @dotfile TCommand_Base__TCommand_Base.dt
129  //--------------------------------------------------------------------------
130 
132 
133  //!-------------------------------------------------------------------------
134  //! @brief Class distructor method.
135  //! @note None
136  //! \par Override
137  //! Not allowed
138  //! @attention Don't call this method directly.
139  //! \par UML diagram
140  //! @dotfile TCommand_Base___TCommand_Base.dt
141  //--------------------------------------------------------------------------
142 
143  virtual ~TCommand_Base();
144 
145  //!-------------------------------------------------------------------------
146  //! @brief Test command name
147  //! @note This method test command name against given name and returns status.
148  //! @param [in] *c8_Command_String - Pointer to the command string
149  //! @return BOOL - Command name test status
150  //! @retval false - Command not queal
151  //! @retval true - Command not queal
152  //! \par Override
153  //! Not allowed
154  //! @attention None
155  //! \par UML diagram
156  //! @dotfile TCommand_Base__Is_Command_Name.dt
157  //--------------------------------------------------------------------------
158 
159  BOOL Is_Command_Name( C8 *c8_Command_String );
160 
161  //!-------------------------------------------------------------------------
162  //! @brief Execute command method
163  //! @note This method executes command specific functionality.
164  //! @param [in] *object_Protocol - Pointer to the communication link protocol
165  //! @return BOOL - Command execution status
166  //! @retval false - Command execution failed
167  //! @retval true - Command execution successfull
168  //! \par Override
169  //! Required
170  //! @attention None
171  //! \par UML diagram
172  //! @dotfile TCommand_Base__Execute.dt
173  //--------------------------------------------------------------------------
174 
175  virtual VOID Execute( TProtocol_Base *object_Protocol );
176 
177  //!-------------------------------------------------------------------------
178  //! @brief Send information about cpecific command over communication link protocol
179  //! @note This method sends information about specific command over specified communication link protocol.
180  //! @param [in] *object_Protocol - Pointer to the communication link protocol
181  //! @return None
182  //! \par Override
183  //! Not allowed
184  //! @attention None
185  //! \par UML diagram
186  //! @dotfile TCommand_Base__Send_Information.dt
187  //--------------------------------------------------------------------------
188 
189  VOID Send_Information( TProtocol_Base *object_Protocol );
190 
191  //----------------------------------------------------------------------------
192  // Protected defines, methods and variables
193  //----------------------------------------------------------------------------
194 
195  protected:
196 
197  //----------------------------------------------------------------------------
198  // Private defines, methods and variables
199  //----------------------------------------------------------------------------
200 
201  private:
202 
203  //--------------------------------------------------------------------------
204  // Private variables
205  //--------------------------------------------------------------------------
206 
207  //! @brief Command descriptor storage
209 
210 };
211 
212 //------------------------------------------------------------------------------
213 // End of file
214 //------------------------------------------------------------------------------
TCommand_Type
Command type enumeration.
Definition: Command_Base.h:67
@ e8_Application_Command
User application command type.
@ e8_Undefined_Command
Undefined command type.
@ e8_System_Command
System embedded command type.
int BOOL
Boolean datatype definition.
Definition: Defines.h:124
unsigned char U8
Binary 8-Bit unsigned integer datatype defenition.
Definition: Defines.h:183
void VOID
Datatypesess datatype definition.
Definition: Defines.h:105
char C8
ASCII 8-Bit char datatype defenition.
Definition: Defines.h:156
Communication protocol base class header file.
ConOpSys terminal command base class.
Definition: Command_Base.h:86
virtual ~TCommand_Base()
Class distructor method.
Definition: Command_Base.cpp:80
TCommand_Descriptor * struct_Descriptor
Command descriptor storage.
Definition: Command_Base.h:208
BOOL Is_Command_Name(C8 *c8_Command_String)
Test command name.
Definition: Command_Base.cpp:88
virtual VOID Execute(TProtocol_Base *object_Protocol)
Execute command method.
Definition: Command_Base.cpp:189
VOID Send_Information(TProtocol_Base *object_Protocol)
Send information about cpecific command over communication link protocol.
Definition: Command_Base.cpp:201
TCommand_Base(TCommand_Descriptor *struct_Descriptor)
Class constructor method.
Definition: Command_Base.cpp:68
Definition: Protocol_Base.h:57
Command descriptor structure.
Definition: Command_Base.h:100
TCommand_Base * object_Command
Pointer to the command object.
Definition: Command_Base.h:112
C8 * c8_Command_Description
Pointer to the command description text.
Definition: Command_Base.h:106
TCommand_Type e8_Command_Type
Command type.
Definition: Command_Base.h:109
C8 * c8_Command_Name
Pointer to the command name.
Definition: Command_Base.h:103