Skip to content
Snippets Groups Projects
Commit 4f9b214f authored by Xavier ELATTAOUI's avatar Xavier ELATTAOUI
Browse files

Code clean up

parent 548651c9
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,7 @@
</parent>
<groupId>fr.soleil.device</groupId>
<artifactId>KeithleyDMM6500-${aol}-${mode}</artifactId>
<version>1.0.2</version>
<version>1.0.3</version>
<packaging>nar</packaging>
<name>KeithleyDMM6500</name>
<description>KeithleyDMM6500 device</description>
......
......@@ -33,7 +33,7 @@
//=============================================================================
#include <tango.h>
#include <KeithleyDMM6500Class.h>
#include "KeithleyDMM6500Class.h"
// Add class header files if needed
......
......@@ -129,11 +129,12 @@ void KeithleyDMM6500::delete_device()
/*----- PROTECTED REGION ID(KeithleyDMM6500::delete_device) ENABLED START -----*/
// Delete device allocated objects
if(m_task)
{
m_task->exit();
m_task = 0;
}
m_task_ptr.reset();
// if(m_task)
// {
// m_task->exit();
// m_task = 0;
// }
DELETE_SCALAR_ATTRIBUTE(attr_outputValue_read);
......@@ -162,7 +163,6 @@ void KeithleyDMM6500::init_device()
/*----- PROTECTED REGION ID(KeithleyDMM6500::init_device_before) ENABLED START -----*/
// Initialization before get_device_property() call
m_task = 0;
yat4tango::DeviceInfo::initialize( this, YAT_XSTR(PROJECT_NAME), YAT_XSTR(PROJECT_VERSION) );
yat4tango::Logging::initialize(this);
......@@ -182,15 +182,19 @@ void KeithleyDMM6500::init_device()
{
if (!communicationLinkName.empty() )
{
m_task = new KeithleyManager( this,
communicationLinkName,
configuration);
m_task_ptr.reset(new KeithleyManager(this, communicationLinkName, configuration));
// m_task = new KeithleyManager( this,
// communicationLinkName,
// configuration);
if ( m_task_ptr )
{
//- start thread
m_task->go();
m_task_ptr->go();
//- update mode
m_task->get_mode();
m_task_ptr->get_mode();
}
}
}
catch(...)
......@@ -344,9 +348,9 @@ void KeithleyDMM6500::read_outputValue(Tango::Attribute &attr)
{
// DEBUG_STREAM << "KeithleyDMM6500::read_outputValue(Tango::Attribute &attr) entering... " << endl;
/*----- PROTECTED REGION ID(KeithleyDMM6500::read_outputValue) ENABLED START -----*/
if (m_task)
if (m_task_ptr)
{
*attr_outputValue_read = m_task->get_data();
*attr_outputValue_read = m_task_ptr->get_data();
}
// Set the attribute value
......@@ -394,9 +398,9 @@ Tango::DevState KeithleyDMM6500::dev_state()
}
else
{
if (m_task)
if (m_task_ptr)
{
argout = m_task->get_state_status(m_status);
argout = m_task_ptr->get_state_status(m_status);
}
else
{
......@@ -425,9 +429,9 @@ void KeithleyDMM6500::autorange_on()
/*----- PROTECTED REGION ID(KeithleyDMM6500::autorange_on) ENABLED START -----*/
// Add your own code
if (m_task)
if (m_task_ptr)
{
m_task->enable_autorange();
m_task_ptr->enable_autorange();
}
/*----- PROTECTED REGION END -----*/ // KeithleyDMM6500::autorange_on
......@@ -445,9 +449,9 @@ void KeithleyDMM6500::autorange_off()
/*----- PROTECTED REGION ID(KeithleyDMM6500::autorange_off) ENABLED START -----*/
// Add your own code
if (m_task)
if (m_task_ptr)
{
m_task->disable_autorange();
m_task_ptr->disable_autorange();
}
/*----- PROTECTED REGION END -----*/ // KeithleyDMM6500::autorange_off
......@@ -469,9 +473,9 @@ Tango::DevString KeithleyDMM6500::autorange_enabled()
// Add your own code
std::string is_are("Autorange OFF.");
// Add your own code
if(m_task)
if(m_task_ptr)
{
bool enabled = m_task->is_autorange_enabled();
bool enabled = m_task_ptr->is_autorange_enabled();
if(enabled)
{
is_are = "Autorange ON.";
......@@ -496,9 +500,9 @@ void KeithleyDMM6500::set_voltmeter_mode()
/*----- PROTECTED REGION ID(KeithleyDMM6500::set_voltmeter_mode) ENABLED START -----*/
// Add your own code
if (m_task)
if (m_task_ptr)
{
m_task->set_voltmeter_mode();
m_task_ptr->set_voltmeter_mode();
}
/*----- PROTECTED REGION END -----*/ // KeithleyDMM6500::set_voltmeter_mode
......@@ -516,9 +520,9 @@ void KeithleyDMM6500::set_temperature_mode()
/*----- PROTECTED REGION ID(KeithleyDMM6500::set_temperature_mode) ENABLED START -----*/
// Add your own code
if (m_task)
if (m_task_ptr)
{
m_task->set_temperature_mode();
m_task_ptr->set_temperature_mode();
}
/*----- PROTECTED REGION END -----*/ // KeithleyDMM6500::set_temperature_mode
......@@ -538,9 +542,9 @@ Tango::DevString KeithleyDMM6500::get_mode()
/*----- PROTECTED REGION ID(KeithleyDMM6500::get_mode) ENABLED START -----*/
std::string mode("UNDEFINED");
// Add your own code
if (m_task)
if (m_task_ptr)
{
mode = m_task->get_mode();
mode = m_task_ptr->get_mode();
}
argout = Tango::string_dup(mode.c_str());
......@@ -561,9 +565,9 @@ void KeithleyDMM6500::set_nplc(Tango::DevDouble argin)
/*----- PROTECTED REGION ID(KeithleyDMM6500::set_nplc) ENABLED START -----*/
// Add your own code
if (m_task)
if (m_task_ptr)
{
m_task->set_nplc(argin);
m_task_ptr->set_nplc(argin);
}
/*----- PROTECTED REGION END -----*/ // KeithleyDMM6500::set_nplc
......@@ -583,9 +587,9 @@ Tango::DevDouble KeithleyDMM6500::get_nplc()
/*----- PROTECTED REGION ID(KeithleyDMM6500::get_nplc) ENABLED START -----*/
// Add your own code
if (m_task)
if (m_task_ptr)
{
argout = m_task->get_nplc();
argout = m_task_ptr->get_nplc();
}
/*----- PROTECTED REGION END -----*/ // KeithleyDMM6500::get_nplc
......@@ -606,9 +610,9 @@ Tango::DevString KeithleyDMM6500::get_range()
/*----- PROTECTED REGION ID(KeithleyDMM6500::get_range) ENABLED START -----*/
std::string response("");
// Add your own code
if ( m_task )
if ( m_task_ptr )
{
response = m_task->get_range();
response = m_task_ptr->get_range();
}
argout = Tango::string_dup(response.c_str());
......
......@@ -248,8 +248,8 @@ public:
// Additional Method prototypes
protected :
KeithleyManager * m_task;
// KeithleyManager * m_task;
yat::UniquePtr<KeithleyManager, yat4tango::DeviceTaskExiter> m_task_ptr;
std::string m_status;
/*----- PROTECTED REGION END -----*/ // KeithleyDMM6500::Additional Method prototypes
};
......
......@@ -34,7 +34,7 @@
//=============================================================================
#include <KeithleyDMM6500Class.h>
#include "KeithleyDMM6500Class.h"
/*----- PROTECTED REGION END -----*/ // KeithleyDMM6500Class.cpp
......
......@@ -38,7 +38,7 @@
#define KeithleyDMM6500Class_H
#include <tango.h>
#include <KeithleyDMM6500.h>
#include "KeithleyDMM6500.h"
/*----- PROTECTED REGION END -----*/ // KeithleyDMM6500Class.h
......
......@@ -29,7 +29,7 @@
// (Program Obviously used to Generate tango Object)
//=============================================================================
#include <KeithleyDMM6500.h>
#include "KeithleyDMM6500.h"
/*----- PROTECTED REGION END -----*/ // KeithleyDMM6500::KeithleyDMM6500StateMachine.cpp
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment