ConOpSys V2970  P004.07
ANVILEX control operating system
Function_Block_Switch_Button_Controller.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file Function_Block_Switch_Button_Controller.h
3 //! @author ANVILEX GmbH
4 //! @version V1.0
5 //! @date 18.05.2016
6 //! @brief Toggle button controller class header file.
7 //! @attention
8 //!
9 //! COPYRIGHT(C) 2020 ANVILEX GmbH
10 //!
11 //! Redistribution and use in source and binary forms, with or without
12 //! modification, are permitted provided that the following conditions are met:
13 //!
14 //! 1. Redistributions of source code must retain the above copyright notice,
15 //! this list of conditions and the following disclaimer.
16 //!
17 //! 2. Redistributions in binary form must reproduce the above copyright notice,
18 //! this list of conditions and the following disclaimer in the documentation
19 //! and/or other materials provided with the distribution.
20 //!
21 //! 3. Neither the name of ANVILEX nor the names of its contributors may be
22 //! used to endorse or promote products derived from this software without
23 //! specific prior written permission.
24 //!
25 //! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 //! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 //! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 //! ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
29 //! LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 //! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 //! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 //! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 //! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 //! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 //! POSSIBILITY OF SUCH DAMAGE.
36 //------------------------------------------------------------------------------
37 
38 //------------------------------------------------------------------------------
39 // Protecting header files from mutual, recursive inclusion.
40 //------------------------------------------------------------------------------
41 
42 #pragma once
43 
44 //------------------------------------------------------------------------------
45 // Include standard libraries header files
46 //------------------------------------------------------------------------------
47 
48 //------------------------------------------------------------------------------
49 // Include thrid party header files
50 //------------------------------------------------------------------------------
51 
52 //------------------------------------------------------------------------------
53 // Include ConOpSys header files
54 //------------------------------------------------------------------------------
55 
56 #include "Function_Block_Base.h"
57 
58 //------------------------------------------------------------------------------
59 // Include ConOpSys application header files
60 //------------------------------------------------------------------------------
61 
62 //------------------------------------------------------------------------------
63 // Macros
64 //------------------------------------------------------------------------------
65 
66 //------------------------------------------------------------------------------
67 // Class declarations
68 //------------------------------------------------------------------------------
69 
70 //! @brief Function block TFunction_Block_Switch_Button_Controller class declaration
72 {
73 
74  //----------------------------------------------------------------------------
75  // Public defines, methods and variables
76  //----------------------------------------------------------------------------
77 
78  public:
79 
80  //!-------------------------------------------------------------------------
81  //! @brief Class constructor method.
82  //! @note None
83  //! \par Override
84  //! Not allowed
85  //! @attention Don't call this method directly.
86  //--------------------------------------------------------------------------
87 
89 
90  //!-------------------------------------------------------------------------
91  //! @brief Class destructor method.
92  //! @note None
93  //! \par Override
94  //! Not allowed
95  //! @attention Don't call this method directly.
96  //--------------------------------------------------------------------------
97 
99 
100  //!-------------------------------------------------------------------------
101  //! @brief Function block initialisation method.
102  //! @note None
103  //! @return None
104  //! \par Override
105  //! Not allowed
106  //! @attention None
107  //--------------------------------------------------------------------------
108 
109  virtual VOID Init();
110 
111  //!-------------------------------------------------------------------------
112  //! @brief Function block execution method.
113  //! @note None
114  //! @return None
115  //! \par Override
116  //! Not allowed
117  //! @attention None
118  //--------------------------------------------------------------------------
119 
120  virtual VOID Execute();
121 
122  //!-------------------------------------------------------------------------
123  //! @brief Send information about Function block over communication link protocol
124  //! @note This method sends information about Function block over specified communication link protocol.
125  //! @param [in] *object_Protocol - Pointer to the communication link protocol
126  //! @return None
127  //! \par Override
128  //! Not allowed
129  //! @attention None
130  //--------------------------------------------------------------------------
131 
132  virtual VOID Send_Information( TProtocol_Base *object_Protocol );
133 
134  //--------------------------------------------------------------------------
135  // Function block parameter connectors
136  //--------------------------------------------------------------------------
137 
138  //--------------------------------------------------------------------------
139  // Function block input connectors
140  //--------------------------------------------------------------------------
141 
142 
143  //! @brief Block enable input signal (active high)
145 
146  //! @brief Block toggle input signal (active high)
148 
149  //! @brief Block emergency stop input signal (active low)
151 
152  //! @brief Internal stop signal
154 
155  //! @brief Press counter limit
157 
158  //--------------------------------------------------------------------------
159  // Function block output connectors
160  //--------------------------------------------------------------------------
161 
162  //! @brief Block output signal
164 
165  //! @brief Press state
167 
168  //----------------------------------------------------------------------------
169  // Protected defines, methods and variables
170  //----------------------------------------------------------------------------
171 
172  protected:
173 
174  //----------------------------------------------------------------------------
175  // Private defines, methods and variables
176  //----------------------------------------------------------------------------
177 
178  private:
179 
180  //! @brief Internal state
181  BOOL bool_State = (BOOL)false;
182 
183  //! @brief Previous output state
185 
186  //! @brief New input state
188 
189  //! @brief Previous input state
191 
192  //! @brief Press counter
194 
195  //! @brief Button controller state definition
196  typedef enum
197  {
198 
199  //! @brief Pressed state
201 
202  //! @brief Not pressed state
204 
205  //! @brief Ready state
207 
208  //! @brief Press state
210 
211  //! @brief Error state
212  enum_Error
213 
215 
216  //! @brief Controller FSM state
217  TController_FSM_State enum_Controller_FSM_State = TController_FSM_State::enum_Ready;
218 
219 };
220 
221 //------------------------------------------------------------------------------
222 // End of file
223 //------------------------------------------------------------------------------
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
Function block base class header file.
Function block input connector class.
Definition: Block_Input_Connector.h:83
Function block output connector class.
Definition: Block_Output_Connector.h:59
Function block base class for device.
Definition: Function_Block_Base.h:96
Function block TFunction_Block_Switch_Button_Controller class declaration.
Definition: Function_Block_Switch_Button_Controller.h:72
TBlock_Output_Connector object_bool_Output
Block output signal.
Definition: Function_Block_Switch_Button_Controller.h:163
U32 u32_Press_Count
Press counter.
Definition: Function_Block_Switch_Button_Controller.h:193
BOOL bool_New_Input_State
New input state.
Definition: Function_Block_Switch_Button_Controller.h:187
virtual ~TFunction_Block_Switch_Button_Controller()
Class destructor method.
Definition: Function_Block_Switch_Button_Controller.cpp:92
BOOL bool_Previous_Input_State
Previous input state.
Definition: Function_Block_Switch_Button_Controller.h:190
TBlock_Input_Connector object_bool_Internal_Stop_Input
Internal stop signal.
Definition: Function_Block_Switch_Button_Controller.h:153
virtual VOID Execute()
Function block execution method.
Definition: Function_Block_Switch_Button_Controller.cpp:115
TBlock_Input_Connector object_bool_Enable_Input
Block enable input signal (active high)
Definition: Function_Block_Switch_Button_Controller.h:144
BOOL bool_State
Internal state.
Definition: Function_Block_Switch_Button_Controller.h:181
TFunction_Block_Switch_Button_Controller()
Class constructor method.
Definition: Function_Block_Switch_Button_Controller.cpp:66
TController_FSM_State enum_Controller_FSM_State
Controller FSM state.
Definition: Function_Block_Switch_Button_Controller.h:217
TBlock_Input_Connector object_bool_Toggle_Input
Block toggle input signal (active high)
Definition: Function_Block_Switch_Button_Controller.h:147
TBlock_Output_Connector object_bool_Output_Press_State
Press state.
Definition: Function_Block_Switch_Button_Controller.h:166
TBlock_Input_Connector object_bool_Emergency_Stop_Input
Block emergency stop input signal (active low)
Definition: Function_Block_Switch_Button_Controller.h:150
TBlock_Input_Connector object_U32_Press_Counter_Limit
Press counter limit.
Definition: Function_Block_Switch_Button_Controller.h:156
virtual VOID Send_Information(TProtocol_Base *object_Protocol)
Send information about Function block over communication link protocol.
Definition: Function_Block_Switch_Button_Controller.cpp:346
BOOL bool_Previous_Output_State
Previous output state.
Definition: Function_Block_Switch_Button_Controller.h:184
virtual VOID Init()
Function block initialisation method.
Definition: Function_Block_Switch_Button_Controller.cpp:100
TController_FSM_State
Button controller state definition.
Definition: Function_Block_Switch_Button_Controller.h:197
@ enum_Pressed
Pressed state.
Definition: Function_Block_Switch_Button_Controller.h:200
@ enum_Ready
Ready state.
Definition: Function_Block_Switch_Button_Controller.h:206
@ enum_Press
Press state.
Definition: Function_Block_Switch_Button_Controller.h:209
@ enum_Not_Pressed
Not pressed state.
Definition: Function_Block_Switch_Button_Controller.h:203
@ enum_Error
Error state.
Definition: Function_Block_Switch_Button_Controller.h:212
Definition: Protocol_Base.h:57