2 #include "PseudoAxesAttrib.h"
3 #include "PseudoAxes/PseudoAxes.h"
5 namespace Diffractometer_ns
11 PseudoAxesAxisAttrib::PseudoAxesAxisAttrib(char const *name
, PseudoAxesAdapter
& adapter
, size_t idx
):
12 Tango::Attr(name
, Tango::DEV_DOUBLE
, Tango::READ_WRITE
),
16 Tango::UserDefaultAttrProp axis_prop
;
17 axis_prop
.set_label(name
);
18 axis_prop
.set_format("%7.4f");
20 std::string description
;
21 description
+= "The ";
23 description
+= " pseudo axes axis of the diffractometer";
24 axis_prop
.set_description(description
.c_str());
25 axis_prop
.set_unit("°");
26 this->set_default_properties(axis_prop
);
29 void PseudoAxesAxisAttrib::read(Tango::DeviceImpl
*dev
, Tango::Attribute
&att
)
31 PseudoAxes_ns::PseudoAxes
*device
= (PseudoAxes_ns::PseudoAxes
*)dev
;
33 // use Tango to aknowledge for the write part.
34 Tango::WAttribute
& att_w
= dev
->get_device_attr()->get_w_attr_by_name(att
.get_name().c_str());
35 att
.set_value(&device
->config
.read
.data
[_idx
]);
36 att_w
.set_write_value(device
->config
.write
.data
[_idx
]);
39 void PseudoAxesAxisAttrib::write(Tango::DeviceImpl
*dev
, Tango::WAttribute
&att
)
42 att
.get_write_value(value
);
43 _adapter
.set_axis_value(_idx
, value
);
46 bool PseudoAxesAxisAttrib::is_allowed(Tango::DeviceImpl
*dev
,Tango::AttReqType type
)
48 if (dev
->get_state() == Tango::FAULT
||
49 dev
->get_state() == Tango::ALARM
)
50 if (type
== Tango::READ_REQ
)