2 #include "AxisAttrib.h"
4 namespace Diffractometer_ns
7 AxisAttrib::AxisAttrib(char const *name
, AxisAdapter
& adapter
):
8 Tango::Attr(name
, Tango::DEV_DOUBLE
, Tango::READ_WRITE
),
11 Tango::UserDefaultAttrProp axis_prop
;
12 axis_prop
.set_label(name
);
13 axis_prop
.set_format("%7.4f");
15 std::string description
;
16 description
+= "The ";
18 description
+= " axis of the diffractometer";
19 axis_prop
.set_description(description
.c_str());
20 axis_prop
.set_unit("°");
21 this->set_default_properties(axis_prop
);
24 void AxisAttrib::read(Tango::DeviceImpl
*dev
,Tango::Attribute
&att
)
26 double read
= _adapter
.get_read();
27 double write
= _adapter
.get_write();
30 Tango::WAttribute
& watt
= dev
->get_device_attr()->get_w_attr_by_name(name
.c_str());
31 watt
.set_write_value(write
);
34 void AxisAttrib::write(Tango::DeviceImpl
*dev
,Tango::WAttribute
&att
)
38 att
.get_write_value(value
);
39 _adapter
.write(value
);
42 bool AxisAttrib::is_allowed(Tango::DeviceImpl
*dev
,Tango::AttReqType ty
)
44 if (dev
->get_state() == Tango::FAULT
||
45 dev
->get_state() == Tango::ALARM
)
46 if (type
== Tango::READ_REQ
)