* rename the DiffractometerDevice class -> Diffractometer
[diffractometer.git] / src / pseudoaxis / PseudoAxis.h
blob12b508abfbc0859c37d48f371413a14366c1bf23
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_IsInitialised_read;
51 Tango::DevBoolean attr_IsInitialised_write;
52 Tango::DevDouble attr_relativeMove_write;
53 Tango::DevString *attr_mode_read;
54 Tango::DevString attr_mode_write;
55 Tango::DevString *attr_modeNames_read;
56 //@}
58 /**
59 * @name Device properties
60 * Device properties member data.
62 //@{
63 /**
64 * This is the tango url to the device Diffractometer.\nN.B : The instance of the diffractometer must be the same that this PseudoAxis
66 string diffractometerProxy;
67 /**
68 * This name must be register in the HKL library.
70 * i.e :
71 * For Eulerian 4 circles : psi, q, q2th, th2th
73 string pseudoAxisName;
74 //@}
76 /**@name Constructors
77 * Miscellaneous constructors */
78 //@{
79 /**
80 * Constructs a newly allocated Command object.
82 * @param cl Class.
83 * @param s Device Name
85 PseudoAxis(Tango::DeviceClass *cl,string &s);
86 /**
87 * Constructs a newly allocated Command object.
89 * @param cl Class.
90 * @param s Device Name
92 PseudoAxis(Tango::DeviceClass *cl,const char *s);
93 /**
94 * Constructs a newly allocated Command object.
96 * @param cl Class.
97 * @param s Device name
98 * @param d Device description.
100 PseudoAxis(Tango::DeviceClass *cl,const char *s,const char *d);
101 //@}
103 /**@name Destructor
104 * Only one desctructor is defined for this class */
105 //@{
107 * The object desctructor.
109 ~PseudoAxis() {delete_device();};
111 * will be called at device destruction or at init command.
113 void delete_device();
114 //@}
117 /**@name Miscellaneous methods */
118 //@{
120 * Initialize the device
122 virtual void init_device();
124 * Always executed method befor execution command method.
126 virtual void always_executed_hook();
128 //@}
131 * @name PseudoAxis methods prototypes
134 //@{
136 * Hardware acquisition for attributes.
138 virtual void read_attr_hardware(vector<long> &attr_list);
140 * Extract real attribute values for position acquisition result.
142 virtual void read_position(Tango::Attribute &attr);
144 * Write position attribute values to hardware.
146 virtual void write_position(Tango::WAttribute &attr);
148 * Extract real attribute values for offset acquisition result.
150 virtual void read_offset(Tango::Attribute &attr);
152 * Write offset attribute values to hardware.
154 virtual void write_offset(Tango::WAttribute &attr);
156 * Extract real attribute values for IsInitialised acquisition result.
158 virtual void read_IsInitialised(Tango::Attribute &attr);
160 * Write IsInitialised attribute values to hardware.
162 virtual void write_IsInitialised(Tango::WAttribute &attr);
164 * Extract real attribute values for relativeMove acquisition result.
166 virtual void read_relativeMove(Tango::Attribute &attr);
168 * Write relativeMove attribute values to hardware.
170 virtual void write_relativeMove(Tango::WAttribute &attr);
172 * Extract real attribute values for mode acquisition result.
174 virtual void read_mode(Tango::Attribute &attr);
176 * Write mode attribute values to hardware.
178 virtual void write_mode(Tango::WAttribute &attr);
180 * Extract real attribute values for modeNames acquisition result.
182 virtual void read_modeNames(Tango::Attribute &attr);
184 * Read/Write allowed for position attribute.
186 virtual bool is_position_allowed(Tango::AttReqType type);
188 * Read/Write allowed for offset attribute.
190 virtual bool is_offset_allowed(Tango::AttReqType type);
192 * Read/Write allowed for IsInitialised attribute.
194 virtual bool is_IsInitialised_allowed(Tango::AttReqType type);
196 * Read/Write allowed for relativeMove attribute.
198 virtual bool is_relativeMove_allowed(Tango::AttReqType type);
200 * Read/Write allowed for mode attribute.
202 virtual bool is_mode_allowed(Tango::AttReqType type);
204 * Read/Write allowed for modeNames attribute.
206 virtual bool is_modeNames_allowed(Tango::AttReqType type);
208 * Execution allowed for Stop command.
210 virtual bool is_Stop_allowed(const CORBA::Any &any);
212 * Execution allowed for MotorOFF command.
214 virtual bool is_MotorOFF_allowed(const CORBA::Any &any);
216 * Execution allowed for MotorON command.
218 virtual bool is_MotorON_allowed(const CORBA::Any &any);
220 * Execution allowed for MotorInit command.
222 virtual bool is_MotorInit_allowed(const CORBA::Any &any);
224 * Execution allowed for ComputeNewOffset command.
226 virtual bool is_ComputeNewOffset_allowed(const CORBA::Any &any);
228 * Execution allowed for Backward command.
230 virtual bool is_Backward_allowed(const CORBA::Any &any);
232 * Execution allowed for Forward command.
234 virtual bool is_Forward_allowed(const CORBA::Any &any);
236 * Execution allowed for DefinePosition command.
238 virtual bool is_DefinePosition_allowed(const CORBA::Any &any);
240 * Execution allowed for InitializeReferencePosition command.
242 virtual bool is_InitializeReferencePosition_allowed(const CORBA::Any &any);
244 * Execution allowed for GetModeParameters command.
246 virtual bool is_GetModeParameters_allowed(const CORBA::Any &any);
248 * Execution allowed for SetModeParameters command.
250 virtual bool is_SetModeParameters_allowed(const CORBA::Any &any);
252 * This command gets the device state (stored in its <i>device_state</i> data member) and returns it to the caller.
253 * @return State Code
254 * @exception DevFailed
256 virtual Tango::DevState dev_state();
258 * This command gets the device status (stored in its <i>device_status</i> data member) and returns it to the caller.
259 * @return Status description
260 * @exception DevFailed
262 virtual Tango::ConstDevString dev_status();
264 * Stop the pseudoAxes and all related axes.
265 * @exception DevFailed
267 void stop();
269 * Disable the pseudoAxis.
270 * @exception DevFailed
272 void motor_off();
274 * Activate the pseudoAxis
275 * @exception DevFailed
277 void motor_on();
279 * Some pseudoAxis must be initialized before we can used them.
280 * @exception DevFailed
282 void motor_init();
284 * The so smart program computes the offset to goal the user position.
285 * @param argin The new user position
286 * @exception DevFailed
288 void compute_new_offset(Tango::DevDouble);
290 * dummy command for V2 interface
291 * @exception DevFailed
293 void backward();
295 * dummy command for V2 interface
296 * @exception DevFailed
298 void forward();
300 * dummy command for V2 interface
301 * @param argin
302 * @exception DevFailed
304 void define_position(Tango::DevDouble);
306 * dummy command for V2 interface
307 * @exception DevFailed
309 void initialize_reference_position();
311 * this command return for the current mode, its parameters.
312 * @return parameters names and values
313 * @exception DevFailed
315 Tango::DevVarDoubleStringArray *get_mode_parameters();
318 * @param argin The parameters to set
319 * @exception DevFailed
321 void set_mode_parameters(const Tango::DevVarDoubleStringArray *);
324 * Read the device properties from database
326 void get_device_property();
327 //@}
329 // Here is the end of the automatic code generation part
330 //-------------------------------------------------------------
331 void set_hkl_library(Diffractometer_ns::TangoHKLAdapter* hkl_library);
334 protected :
335 // Add your own data members here
336 //-----------------------------------------
337 Diffractometer_ns::PseudoAxisAdapter * _buffer;
338 Diffractometer_ns::TangoHKLAdapter * _hklAdapter;
341 } // namespace_ns
343 #endif // _PSEUDOAXIS_H