* use the HklAxis get_value_unit instead of the parameter method
[diffractometer.git] / src / pseudoaxis / PseudoAxisStateMachine.cpp
blob379533b65f516771863e3aeeb0d5dcd922e53b5f
1 static const char *RcsId = "$Header: /cvsroot/tango-ds/Instrumentation/Diffractometer/src/pseudoaxis/PseudoAxisStateMachine.cpp,v 1.3 2008/09/24 08:37:48 piccaf Exp $";
2 //+=============================================================================
3 //
4 // file : PseudoAxisStateMachine.cpp
5 //
6 // description : C++ source for the PseudoAxis and its alowed.
7 // method for commands and attributes
8 //
9 // project : TANGO Device Server
11 // $Author: piccaf $
13 // $Revision: 1.3 $
15 // $Log: PseudoAxisStateMachine.cpp,v $
16 // Revision 1.3 2008/09/24 08:37:48 piccaf
17 // * add dummy commandes for the Axis V2 interface
19 // Revision 1.2 2008/09/22 08:46:40 piccaf
20 // * add files from the new diffractometer Device
22 // Revision 1.4 2007/07/25 09:58:22 picca
23 // Can not write on an OFF PseudoAxe, and no more delta moving when writing on pseudoAxes
25 // * modification of the PseudoAxe state machine to forbid writting on an OFF PseudoAxe. close #6247
26 // * Now when we change from simulated to real state, update the libHKL from the hardware. so no more unsynchronyse state between the device and the HKL. close #4013 #6168 #6196
28 // Revision 1.3 2007/07/11 07:19:28 picca
29 // * add the "offset" and the "relativeMove" attributes to the PseudoAxes.
30 // * syntax in Kappa6C
32 // Revision 1.2 2007/05/15 08:26:58 hardion
33 // * Merge with branch DIFFRACTO_KAPPA_6C
35 // Revision 1.1.2.1 2006/08/25 15:08:22 hardion
36 // * Merge corrections of hubert
37 // * Create directory for each class of device
38 // * Fix problem when PseudoAxis is initialized on first
39 // * Tested on diffabs for the communication part
41 // Revision 1.3 2006/07/07 15:14:58 hardion
42 // * Fix bug 1974 ( initialize properties before initialize hklAdapter !!!)
43 // * Change State Machine (no more OFF state)
44 // * State ALARM == axis not initialized
45 // * Implements stop command
47 // Revision 1.2 2006/07/06 10:29:44 hardion
48 // * commit to keep modification about Pseudo axis management but it doesn't work ( Error Check the wavelength)
49 // try to come back to old version to see if the problem persists
51 // Revision 1.1 2006/03/29 16:45:47 hardion
52 // * Add PseudoAxis device
53 // * Add DiffractometerFactory which associates Diffracto and PseudoAxis
56 // copyleft : European Synchrotron Radiation Facility
57 // BP 220, Grenoble 38043
58 // FRANCE
60 //-=============================================================================
62 // This file is generated by POGO
63 // (Program Obviously used to Generate tango Object)
65 // (c) - Software Engineering Group - ESRF
66 //=============================================================================
68 #include <tango.h>
69 #include <PseudoAxis.h>
70 #include <PseudoAxisClass.h>
72 /*====================================================================
73 * This file contains the methods to allow commands and attributes
74 * read or write execution.
76 * If you wand to add your own code, add it between
77 * the "End/Re-Start of Generated Code" comments.
79 * If you want, you can also add your own methods.
80 *====================================================================
83 namespace PseudoAxis_ns
86 //=================================================
87 // Attributes Allowed Methods
88 //=================================================
90 //+----------------------------------------------------------------------------
92 // method : PseudoAxis::is_IsInitialised_allowed
93 //
94 // description : Read/Write allowed for IsInitialised attribute.
96 //-----------------------------------------------------------------------------
97 bool PseudoAxis::is_IsInitialised_allowed(Tango::AttReqType type)
99 // End of Generated Code
101 // Re-Start of Generated Code
102 return true;
103 }//+----------------------------------------------------------------------------
105 // method : PseudoAxis::is_offset_allowed
107 // description : Read/Write allowed for offset attribute.
109 //-----------------------------------------------------------------------------
110 bool PseudoAxis::is_offset_allowed(Tango::AttReqType type)
112 if (get_state() == Tango::MOVING)
114 // End of Generated Code
115 if(type == Tango::READ_REQ)
116 return true;
117 // Re-Start of Generated Code
118 return false;
120 return true;
122 //+----------------------------------------------------------------------------
124 // method : PseudoAxis::is_relativeMove_allowed
126 // description : Read/Write allowed for relativeMove attribute.
128 //-----------------------------------------------------------------------------
129 bool PseudoAxis::is_relativeMove_allowed(Tango::AttReqType type)
131 if (get_state() == Tango::OFF)
133 // End of Generated Code
134 if(type == Tango::READ_REQ)
135 return true;
136 // Re-Start of Generated Code
137 return false;
139 return true;
141 //+----------------------------------------------------------------------------
143 // method : PseudoAxis::is_position_allowed
145 // description : Read/Write allowed for position attribute.
147 //-----------------------------------------------------------------------------
148 bool PseudoAxis::is_position_allowed(Tango::AttReqType type)
150 if (get_state() == Tango::OFF)
152 // End of Generated Code
153 if(type == Tango::READ_REQ)
154 return true;
155 // Re-Start of Generated Code
156 return false;
158 return true;
160 //+----------------------------------------------------------------------------
162 // method : PseudoAxis::is_mode_allowed
164 // description : Read/Write allowed for mode attribute.
166 //-----------------------------------------------------------------------------
167 bool PseudoAxis::is_mode_allowed(Tango::AttReqType type)
169 // End of Generated Code
171 // Re-Start of Generated Code
172 return true;
174 //+----------------------------------------------------------------------------
176 // method : PseudoAxis::is_modeNames_allowed
178 // description : Read/Write allowed for modeNames attribute.
180 //-----------------------------------------------------------------------------
181 bool PseudoAxis::is_modeNames_allowed(Tango::AttReqType type)
183 // End of Generated Code
185 // Re-Start of Generated Code
186 return true;
189 //=================================================
190 // Commands Allowed Methods
191 //=================================================
193 //+----------------------------------------------------------------------------
195 // method : PseudoAxis::is_MotorOFF_allowed
197 // description : Execution allowed for MotorOFF command.
199 //-----------------------------------------------------------------------------
200 bool PseudoAxis::is_MotorOFF_allowed(const CORBA::Any &any)
202 if (get_state() == Tango::OFF ||
203 get_state() == Tango::MOVING)
205 // End of Generated Code
207 // Re-Start of Generated Code
208 return false;
210 return true;
212 //+----------------------------------------------------------------------------
214 // method : PseudoAxis::is_MotorON_allowed
216 // description : Execution allowed for MotorON command.
218 //-----------------------------------------------------------------------------
219 bool PseudoAxis::is_MotorON_allowed(const CORBA::Any &any)
221 if (get_state() == Tango::MOVING)
223 // End of Generated Code
225 // Re-Start of Generated Code
226 return false;
228 return true;
230 //+----------------------------------------------------------------------------
232 // method : PseudoAxis::is_ComputeNewOffset_allowed
234 // description : Execution allowed for ComputeNewOffset command.
236 //-----------------------------------------------------------------------------
237 bool PseudoAxis::is_ComputeNewOffset_allowed(const CORBA::Any &any)
239 if (get_state() == Tango::MOVING)
241 // End of Generated Code
243 // Re-Start of Generated Code
244 return false;
246 return true;
248 //+----------------------------------------------------------------------------
250 // method : PseudoAxis::is_Stop_allowed
252 // description : Execution allowed for Stop command.
254 //-----------------------------------------------------------------------------
255 bool PseudoAxis::is_Stop_allowed(const CORBA::Any &any)
257 if (get_state() == Tango::OFF ||
258 get_state() == Tango::DISABLE)
260 // End of Generated Code
262 // Re-Start of Generated Code
263 return false;
265 return true;
267 //+----------------------------------------------------------------------------
269 // method : PseudoAxis::is_MotorInit_allowed
271 // description : Execution allowed for MotorInit command.
273 //-----------------------------------------------------------------------------
274 bool PseudoAxis::is_MotorInit_allowed(const CORBA::Any &any)
276 if (get_state() == Tango::MOVING)
278 // End of Generated Code
280 // Re-Start of Generated Code
281 return false;
283 return true;
285 //+----------------------------------------------------------------------------
287 // method : PseudoAxis::is_Backward_allowed
289 // description : Execution allowed for Backward command.
291 //-----------------------------------------------------------------------------
292 bool PseudoAxis::is_Backward_allowed(const CORBA::Any &any)
294 // End of Generated Code
296 // Re-Start of Generated Code
297 return true;
299 //+----------------------------------------------------------------------------
301 // method : PseudoAxis::is_Forward_allowed
303 // description : Execution allowed for Forward command.
305 //-----------------------------------------------------------------------------
306 bool PseudoAxis::is_Forward_allowed(const CORBA::Any &any)
308 // End of Generated Code
310 // Re-Start of Generated Code
311 return true;
313 //+----------------------------------------------------------------------------
315 // method : PseudoAxis::is_DefinePosition_allowed
317 // description : Execution allowed for DefinePosition command.
319 //-----------------------------------------------------------------------------
320 bool PseudoAxis::is_DefinePosition_allowed(const CORBA::Any &any)
322 // End of Generated Code
324 // Re-Start of Generated Code
325 return true;
327 //+----------------------------------------------------------------------------
329 // method : PseudoAxis::is_InitializeReferencePosition_allowed
331 // description : Execution allowed for InitializeReferencePosition command.
333 //-----------------------------------------------------------------------------
334 bool PseudoAxis::is_InitializeReferencePosition_allowed(const CORBA::Any &any)
336 // End of Generated Code
338 // Re-Start of Generated Code
339 return true;
341 //+----------------------------------------------------------------------------
343 // method : PseudoAxis::is_GetModeParameters_allowed
345 // description : Execution allowed for GetModeParameters command.
347 //-----------------------------------------------------------------------------
348 bool PseudoAxis::is_GetModeParameters_allowed(const CORBA::Any &any)
350 // End of Generated Code
352 // Re-Start of Generated Code
353 return true;
355 //+----------------------------------------------------------------------------
357 // method : PseudoAxis::is_SetModeParameters_allowed
359 // description : Execution allowed for SetModeParameters command.
361 //-----------------------------------------------------------------------------
362 bool PseudoAxis::is_SetModeParameters_allowed(const CORBA::Any &any)
364 // End of Generated Code
366 // Re-Start of Generated Code
367 return true;
370 } // namespace PseudoAxis_ns