From 85cf7409d9e5199339be68662b8b6733d263117a Mon Sep 17 00:00:00 2001 From: System User Date: Thu, 21 Jan 2010 16:21:25 +0100 Subject: [PATCH] * implemente the MotorOn method. --- src/AxisAdapter.cpp | 12 ++++++++---- src/AxisAdapter.h | 3 +++ src/PseudoAxis/PseudoAxis.cpp | 11 ++--------- src/PseudoAxisAdapter.cpp | 5 +++++ src/PseudoAxisAdapter.h | 1 + src/TangoHKLAdapter.cpp | 8 ++++++++ src/TangoHKLAdapter.h | 2 ++ 7 files changed, 29 insertions(+), 13 deletions(-) diff --git a/src/AxisAdapter.cpp b/src/AxisAdapter.cpp index 8d04c89..5d30121 100644 --- a/src/AxisAdapter.cpp +++ b/src/AxisAdapter.cpp @@ -13,7 +13,8 @@ namespace Diffractometer_ns { _axis_w_real(axis_w_real) { _proxy_name = ""; - _proxy_stop_command_name = ""; + _proxy_stop_command_name = "Stop"; + _proxy_on_command_name = "On"; _proxy = NULL; this->from_HklAxis(); _state = Tango::UNKNOWN; @@ -46,9 +47,6 @@ namespace Diffractometer_ns { res = true; - // set the stop command name for now "Stop" should depend of the type of the Device. - _proxy_stop_command_name = "Stop"; - // read the read/write position _proxy->read() >> positions; _proxy_name = proxy_name; @@ -161,4 +159,10 @@ namespace Diffractometer_ns { if(this->is_ready()) _proxy->get_device_proxy()->command_inout(_proxy_stop_command_name); } + + void AxisAdapter::on(void) + { + if(this->is_ready()) + _proxy->get_device_proxy()->command_inout(_proxy_on_command_name); + } } diff --git a/src/AxisAdapter.h b/src/AxisAdapter.h index db55308..f26ca10 100644 --- a/src/AxisAdapter.h +++ b/src/AxisAdapter.h @@ -43,11 +43,14 @@ namespace Diffractometer_ns { void stop(void); + void on(void); + private: TangoHKLAdapter * _hklAdapter; std::string _proxy_name; std::string _proxy_stop_command_name; + std::string _proxy_on_command_name; Tango::AttributeProxy *_proxy; HklAxis *_axis_r; HklAxis *_axis_w; diff --git a/src/PseudoAxis/PseudoAxis.cpp b/src/PseudoAxis/PseudoAxis.cpp index b21139b..98e9ebd 100644 --- a/src/PseudoAxis/PseudoAxis.cpp +++ b/src/PseudoAxis/PseudoAxis.cpp @@ -523,15 +523,8 @@ void PseudoAxis::motor_on() DEBUG_STREAM << "PseudoAxis::motor_on(): entering... !" << endl; // Add your own code to control device here -/* - if (_hklAdapter) - _hklAdapter->update(); - if (_buffer){ - _hklAdapter->pseudo_axis_init(_buffer, true); - // idem initialize - _hklAdapter->update(); - } -*/ + if(_buffer) + _buffer->on(); } //+------------------------------------------------------------------ diff --git a/src/PseudoAxisAdapter.cpp b/src/PseudoAxisAdapter.cpp index 5a5b2c6..54ba744 100644 --- a/src/PseudoAxisAdapter.cpp +++ b/src/PseudoAxisAdapter.cpp @@ -137,4 +137,9 @@ namespace Diffractometer_ns { _hklAdapter.pseudo_axis_set_is_initialised(this, init); } + + void PseudoAxisAdapter::on(void) + { + _hklAdapter.pseudo_axis_on(this); + } } diff --git a/src/PseudoAxisAdapter.h b/src/PseudoAxisAdapter.h index 28a5074..e586518 100644 --- a/src/PseudoAxisAdapter.h +++ b/src/PseudoAxisAdapter.h @@ -33,6 +33,7 @@ namespace Diffractometer_ns { void set_mode(Tango::DevString const & mode); bool get_is_initialised(void); void set_is_initialised(Tango::DevBoolean init); + void on(void); private: TangoHKLAdapter &_hklAdapter; std::string _devicename; diff --git a/src/TangoHKLAdapter.cpp b/src/TangoHKLAdapter.cpp index f7966a0..eec2cdf 100644 --- a/src/TangoHKLAdapter.cpp +++ b/src/TangoHKLAdapter.cpp @@ -1560,6 +1560,14 @@ namespace Diffractometer_ns ""); } + void TangoHKLAdapter::pseudo_axis_on(PseudoAxisAdapter *buffer) + { + omni_mutex_lock lock(_lock); + + for(size_t i=0; i_axes.size(); ++i) + buffer->_axes[i]->on(); + } + /*******************/ /* pseudoAxes part */ /*******************/ diff --git a/src/TangoHKLAdapter.h b/src/TangoHKLAdapter.h index 2cbe4c2..35091de 100644 --- a/src/TangoHKLAdapter.h +++ b/src/TangoHKLAdapter.h @@ -205,6 +205,8 @@ namespace Diffractometer_ns { void pseudo_axis_set_is_initialised(PseudoAxisAdapter *buffer, Tango::DevBoolean init); + void pseudo_axis_on(PseudoAxisAdapter *buffer); + /*******************/ /* PseudoAxes Part */ /*******************/ -- 2.11.4.GIT