* switch the initialized attribut to the config struct
[diffractometer.git] / src / PseudoAxis / PseudoAxis.h
blobbee19a34c187a776acdacff209cec181aa838ac1
1 #ifndef _PSEUDOAXIS_H
2 #define _PSEUDOAXIS_H
4 #include <tango.h>
6 #include "TangoHKLAdapter.h"
8 //forward declaration
9 //namespace hkl { class PseudoAxe; }
11 // Add your own constants definitions here.
12 //-----------------------------------------------
13 namespace PseudoAxis_ns
16 /**
17 * Class Description:
22 * Device States Description:
23 * Tango::OFF : Communication broken with the motion controller
24 * Tango::STANDBY : Axis OK, waiting for commands
25 * Tango::MOVING : Axis is moving
26 * Tango::FAULT : Failure on the axis. Can be hardware failure .
27 * Tango::ALARM : Alarm on the axis. can be soft or hard limit, abort input...
28 * Tango::DISABLE : For debug purpose
32 class PseudoAxis: public Tango::Device_3Impl
34 public :
35 // Add your own data members here
36 //-----------------------------------------
39 // Here is the Start of the automatic code generation part
40 //-------------------------------------------------------------
41 /**
42 * @name attributes
43 * Attributs member data.
45 //@{
46 Tango::DevDouble *attr_position_read;
47 Tango::DevDouble attr_position_write;
48 Tango::DevDouble *attr_offset_read;
49 Tango::DevDouble attr_offset_write;
50 Tango::DevBoolean *attr_initialized_read;
51 Tango::DevBoolean attr_initialized_write;
52 Tango::DevDouble attr_relativeMove_write;
53 Tango::DevString *attr_mode_read;
54 Tango::DevString attr_mode_write;
55 Tango::DevBoolean *attr_IsInitialised_read;
56 Tango::DevBoolean attr_IsInitialised_write;
57 Tango::DevString *attr_modeNames_read;
58 //@}
60 /**
61 * @name Device properties
62 * Device properties member data.
64 //@{
65 /**
66 * This is the tango url to the device Diffractometer.\nN.B : The instance of the diffractometer must be the same that this PseudoAxis
68 string diffractometerProxy;
69 /**
70 * This name must be register in the HKL library.
72 * i.e :
73 * For Eulerian 4 circles : psi, q, q2th, th2th
75 string pseudoAxisName;
76 //@}
78 /**@name Constructors
79 * Miscellaneous constructors */
80 //@{
81 /**
82 * Constructs a newly allocated Command object.
84 * @param cl Class.
85 * @param s Device Name
87 PseudoAxis(Tango::DeviceClass *cl,string &s);
88 /**
89 * Constructs a newly allocated Command object.
91 * @param cl Class.
92 * @param s Device Name
94 PseudoAxis(Tango::DeviceClass *cl,const char *s);
95 /**
96 * Constructs a newly allocated Command object.
98 * @param cl Class.
99 * @param s Device name
100 * @param d Device description.
102 PseudoAxis(Tango::DeviceClass *cl,const char *s,const char *d);
103 //@}
105 /**@name Destructor
106 * Only one desctructor is defined for this class */
107 //@{
109 * The object desctructor.
111 ~PseudoAxis() {delete_device();};
113 * will be called at device destruction or at init command.
115 void delete_device();
116 //@}
119 /**@name Miscellaneous methods */
120 //@{
122 * Initialize the device
124 virtual void init_device();
126 * Always executed method befor execution command method.
128 virtual void always_executed_hook();
130 //@}
133 * @name PseudoAxis methods prototypes
136 //@{
138 * Hardware acquisition for attributes.
140 virtual void read_attr_hardware(vector<long> &attr_list);
142 * Extract real attribute values for position acquisition result.
144 virtual void read_position(Tango::Attribute &attr);
146 * Write position attribute values to hardware.
148 virtual void write_position(Tango::WAttribute &attr);
150 * Extract real attribute values for offset acquisition result.
152 virtual void read_offset(Tango::Attribute &attr);
154 * Write offset attribute values to hardware.
156 virtual void write_offset(Tango::WAttribute &attr);
158 * Extract real attribute values for initialized acquisition result.
160 virtual void read_initialized(Tango::Attribute &attr);
162 * Write initialized attribute values to hardware.
164 virtual void write_initialized(Tango::WAttribute &attr);
166 * Extract real attribute values for relativeMove acquisition result.
168 virtual void read_relativeMove(Tango::Attribute &attr);
170 * Write relativeMove attribute values to hardware.
172 virtual void write_relativeMove(Tango::WAttribute &attr);
174 * Extract real attribute values for mode acquisition result.
176 virtual void read_mode(Tango::Attribute &attr);
178 * Write mode attribute values to hardware.
180 virtual void write_mode(Tango::WAttribute &attr);
182 * Extract real attribute values for IsInitialised acquisition result.
184 virtual void read_IsInitialised(Tango::Attribute &attr);
186 * Write IsInitialised attribute values to hardware.
188 virtual void write_IsInitialised(Tango::WAttribute &attr);
190 * Extract real attribute values for modeNames acquisition result.
192 virtual void read_modeNames(Tango::Attribute &attr);
194 * Read/Write allowed for position attribute.
196 virtual bool is_position_allowed(Tango::AttReqType type);
198 * Read/Write allowed for offset attribute.
200 virtual bool is_offset_allowed(Tango::AttReqType type);
202 * Read/Write allowed for initialized attribute.
204 virtual bool is_initialized_allowed(Tango::AttReqType type);
206 * Read/Write allowed for relativeMove attribute.
208 virtual bool is_relativeMove_allowed(Tango::AttReqType type);
210 * Read/Write allowed for mode attribute.
212 virtual bool is_mode_allowed(Tango::AttReqType type);
214 * Read/Write allowed for IsInitialised attribute.
216 virtual bool is_IsInitialised_allowed(Tango::AttReqType type);
218 * Read/Write allowed for modeNames attribute.
220 virtual bool is_modeNames_allowed(Tango::AttReqType type);
222 * Execution allowed for Stop command.
224 virtual bool is_Stop_allowed(const CORBA::Any &any);
226 * Execution allowed for On command.
228 virtual bool is_On_allowed(const CORBA::Any &any);
230 * Execution allowed for MotorOFF command.
232 virtual bool is_MotorOFF_allowed(const CORBA::Any &any);
234 * Execution allowed for MotorON command.
236 virtual bool is_MotorON_allowed(const CORBA::Any &any);
238 * Execution allowed for MotorInit command.
240 virtual bool is_MotorInit_allowed(const CORBA::Any &any);
242 * Execution allowed for ComputeNewOffset command.
244 virtual bool is_ComputeNewOffset_allowed(const CORBA::Any &any);
246 * Execution allowed for Backward command.
248 virtual bool is_Backward_allowed(const CORBA::Any &any);
250 * Execution allowed for Forward command.
252 virtual bool is_Forward_allowed(const CORBA::Any &any);
254 * Execution allowed for DefinePosition command.
256 virtual bool is_DefinePosition_allowed(const CORBA::Any &any);
258 * Execution allowed for InitializeReferencePosition command.
260 virtual bool is_InitializeReferencePosition_allowed(const CORBA::Any &any);
262 * Execution allowed for GetModeParameters command.
264 virtual bool is_GetModeParameters_allowed(const CORBA::Any &any);
266 * Execution allowed for SetModeParameters command.
268 virtual bool is_SetModeParameters_allowed(const CORBA::Any &any);
270 * This command gets the device state (stored in its <i>device_state</i> data member) and returns it to the caller.
271 * @return State Code
272 * @exception DevFailed
274 virtual Tango::DevState dev_state();
276 * This command gets the device status (stored in its <i>device_status</i> data member) and returns it to the caller.
277 * @return Status description
278 * @exception DevFailed
280 virtual Tango::ConstDevString dev_status();
282 * Stop the pseudoAxes and all related axes.
283 * @exception DevFailed
285 void stop();
287 * Activate the pseudoAxis and all related motors.
288 * @exception DevFailed
290 void on();
292 * DEPRECATED
293 * @exception DevFailed
295 void motor_off();
297 * DEPRECATED
298 * @exception DevFailed
300 void motor_on();
302 * DEPRECATED
303 * @exception DevFailed
305 void motor_init();
307 * The so smart program computes the offset to goal the user position.
308 * @param argin The new user position
309 * @exception DevFailed
311 void compute_new_offset(Tango::DevDouble);
313 * dummy command for V2 interface
314 * @exception DevFailed
316 void backward();
318 * dummy command for V2 interface
319 * @exception DevFailed
321 void forward();
323 * dummy command for V2 interface
324 * @param argin
325 * @exception DevFailed
327 void define_position(Tango::DevDouble);
329 * dummy command for V2 interface
330 * @exception DevFailed
332 void initialize_reference_position();
334 * this command return for the current mode, its parameters.
335 * @return parameters names and values
336 * @exception DevFailed
338 Tango::DevVarDoubleStringArray *get_mode_parameters();
341 * @param argin The parameters to set
342 * @exception DevFailed
344 void set_mode_parameters(const Tango::DevVarDoubleStringArray *);
347 * Read the device properties from database
349 void get_device_property();
350 //@}
352 // Here is the end of the automatic code generation part
353 //-------------------------------------------------------------
354 void set_hkl_library(Diffractometer_ns::TangoHKLAdapter* hkl_library);
357 protected :
358 // Add your own data members here
359 //-----------------------------------------
360 Diffractometer_ns::PseudoAxisAdapter * _buffer;
361 Diffractometer_ns::TangoHKLAdapter * _hklAdapter;
362 Diffractometer_ns::PseudoAxisConfig _config;
365 } // namespace_ns
367 #endif // _PSEUDOAXIS_H