Skip to content
Snippets Groups Projects
Commit 20f280c4 authored by Arafat Nourredine's avatar Arafat Nourredine
Browse files

- Enhance code quality according to coding rules document: braces, variables name, etc ...

- Enhance properties management
parent cc373613
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,12 @@ This field 'name' will define the name of the application.
<groupId>fr.soleil.lib</groupId>
<artifactId>YAT4Tango-${aol}-${library}-${mode}</artifactId>
</dependency>
<dependency>
<groupId>fr.soleil.lib</groupId>
<artifactId>YAT-${aol}-shared-${mode}</artifactId>
</dependency>
</dependencies>
<build>
......@@ -42,8 +48,8 @@ This field 'name' will define the name of the application.
<developers>
<developer>
<id>coquet</id>
<name>coquet</name>
<id>noureddine</id>
<name>noureddine</name>
<url>http://controle/</url>
<organization>Synchrotron Soleil</organization>
<organizationUrl>http://www.synchrotron-soleil.fr</organizationUrl>
......
This diff is collapsed.
......@@ -52,6 +52,10 @@
#define _HEXAPODNEWPORT_H
#include <tango.h>
#include <yat4tango/PropertyHelper.h>
#include <yat4tango/InnerAppender.h>
#include <yat4tango/YatLogAdapter.h>
#include <yat4tango/DeviceInfo.h>
#include "task/HWProxy.h"
//using namespace Tango;
......@@ -168,7 +172,10 @@ public :
/**
* The object desctructor.
*/
~HexapodNewport() {delete_device();};
~HexapodNewport()
{
delete_device();
};
/**
* will be called at device destruction or at init command.
*/
......@@ -382,31 +389,33 @@ public :
protected:
// Add your own data members here
//-----------------------------------------
HWProxy * hwp;
bool properties_missing;
bool init_device_done;
bool communication_error;
std::string status_str;
std::string last_error;
//-
void try_to_move ();
//- counter of attributes to write for write_attributes calls
int nb_of_attr_to_write_count;
//- Tango overloaded method used to manage the simultaneous writing of h,k,l
void write_attributes_4(const Tango::AttributeValueList_4 & values, const Tango::ClntIdent &cl_ident)
throw (Tango::MultiDevFailed, Tango::DevFailed, CORBA::SystemException);
//-
template <class T> void write_wattribute (Tango::DevString attr_name, T value)
{
Tango::WAttribute & att = dev_attr->get_w_attr_by_name (attr_name);
att.set_write_value (value);
}
HWProxy * m_hwp;
bool m_properties_missing;
bool m_init_device_done;
bool m_communication_error;
std::string m_status_str;
std::string m_last_error;
//- counter of attributes to write for write_attributes calls
int m_nb_of_attr_to_write_count;
} ;
} // namespace_ns
......
This diff is collapsed.
......@@ -45,8 +45,7 @@ namespace HexapodNewport_ns
//- the status strings for ComState
const size_t HWP_STATE_MAX_SIZE = 7;
static const std::string hw_state_str[HWP_STATE_MAX_SIZE] =
{
static const std::string hw_state_str[HWP_STATE_MAX_SIZE] ={
"Unknown Error",
"Initialisation Error",
"Communication Error",
......@@ -98,6 +97,7 @@ namespace HexapodNewport_ns
//- structures for use with messages service to write values in the BT500
//- the structure to write a string
typedef struct LowLevelMsg
{
std::string cmd;
......@@ -118,11 +118,13 @@ namespace HexapodNewport_ns
//- HWProxy Class
//- read the HW
//------------------------------------------------------------------------
class HWProxy : public yat4tango::DeviceTask
{
public:
//- the configuration structure
typedef struct Config
{
//- members
......@@ -152,17 +154,45 @@ namespace HexapodNewport_ns
virtual ~HWProxy ();
//- the number of communication successfully done
unsigned long get_com_error (void) { return com_error; };
unsigned long get_com_error (void)
{
return m_com_error;
};
//- the number of communication errors
unsigned long get_com_success (void) { return com_success; };
unsigned long get_com_success (void)
{
return m_com_success;
};
//- the number of commands successfully done
unsigned long get_command_error (void) { return command_error; };
unsigned long get_command_error (void)
{
return m_command_error;
};
//- the number of command errors
unsigned long get_command_success (void) { return command_ok; };
unsigned long get_command_success (void)
{
return m_command_ok;
};
//- the state and status of communication
ComState get_com_state (void) {return com_state; };
std::string get_com_status (void) { return hw_state_str [com_state]; };
std::string get_last_error (void) { return last_error; };
ComState get_com_state (void)
{
return com_state;
};
std::string get_com_status (void)
{
return hw_state_str [com_state];
};
std::string get_last_error (void)
{
return m_last_error;
};
std::string get_hxp_status (void);
//- access to axes position individually
......@@ -198,9 +228,10 @@ namespace HexapodNewport_ns
bool write (std::string cmd);
//- the socket to the HXP for non blocking exchanges
yat::ClientSocket * sock_non_blocking;
yat::ClientSocket * m_sock_non_blocking;
//- the socket to the HXP for blocking commands
yat::ClientSocket * sock_blocking;
yat::ClientSocket * m_sock_blocking;
//- au cas ou....
yat::Mutex lock_wr;
......@@ -211,53 +242,53 @@ namespace HexapodNewport_ns
Config conf;
//- the host device
Tango::DeviceImpl * host_dev;
Tango::DeviceImpl * m_device;
//- the periodic execution time
size_t periodic_exec_ms;
size_t m_periodic_exec_ms;
//- the state and status stuff
ComState com_state;
std::string com_status;
std::string m_com_status;
std::string last_error;
std::string m_last_error;
//- for Com error attribute
unsigned long com_error;
unsigned long m_com_error;
//- for Com OK attribute
unsigned long com_success;
unsigned long m_com_success;
//- internal error counter
unsigned long consecutive_com_errors;
unsigned long m_consecutive_com_errors;
//- for command error (command refused by BT500)
unsigned long command_ok;
unsigned long command_error;
unsigned long consecutive_command_error;
unsigned long m_command_ok;
unsigned long m_command_error;
unsigned long m_consecutive_command_error;
//- the Hexapod State (the Group State of the internal State Machine)
int group_state;
Tango::DevState tango_state;
int request_for_moving;
yat::Timer request_for_moving_timer;
int m_group_state;
Tango::DevState m_tango_state;
int m_request_for_moving;
yat::Timer m_request_for_moving_timer;
//- the values read on the hard X Y Z U V W
double positions_read [NB_VIRTUAL_AXES];
double m_positions_read [NB_VIRTUAL_AXES];
//- the setpoints X Y Z U V W
double positions_setp [NB_VIRTUAL_AXES];
double m_positions_setp [NB_VIRTUAL_AXES];
//- the coordinate system Base X Y Z U V W
positions_t base_cs;
positions_t m_base_cs;
//- the coordinate system Work X Y Z U V W
positions_t work_cs;
positions_t m_work_cs;
//- the coordinate system Tool X Y Z U V W
positions_t tool_cs;
positions_t m_tool_cs;
//- the current coordinate system used to write on the Hexapod
std::string current_cs_name;
std::string m_name_current_cs;
} ;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment