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

Code to support multi instruments with one Prologix removed

parent 678f5c94
No related branches found
No related tags found
No related merge requests found
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
<Tr BGCOLOR="#CCCCFF"><Td><Hr></Td><Td><Hr></Td><Td><Hr></Td></Tr> <Tr BGCOLOR="#CCCCFF"><Td><Hr></Td><Td><Hr></Td><Td><Hr></Td></Tr>
<tr> <tr>
<td> Command NOT allowed for </td> <td> Command NOT allowed for </td>
<td> <font size="-1"> <li> MOVING </li> </font> </td> <td> <font size="-1"> <li> MOVING </li> <li> FAULT </li> </font> </td>
<td> .. </td> <td> .. </td>
</tr> </tr>
</table> </table>
......
...@@ -127,11 +127,19 @@ ...@@ -127,11 +127,19 @@
<td> <center><b> Default Value </b></center> </td> <td> <center><b> Default Value </b></center> </td>
</tr> </tr>
<tr> <tr>
<td> ClientSocketDevName </td> <td> Url </td>
<td> Name of the ClientSocketServer device which handles the communication </td> <td> Name or IP address<Br>
e.g : gpib1, 172.16.123.123 </td>
<td> String </td> <td> String </td>
<td> none </td> <td> none </td>
</tr> </tr>
<tr>
<td> Port </td>
<td> The IP port<Br>
default value : 1234 </td>
<td> short </td>
<td> none </td>
</tr>
<tr> <tr>
<td> ReadTimeout </td> <td> ReadTimeout </td>
<td> Read Timeout in milliseconds<Br> <td> Read Timeout in milliseconds<Br>
...@@ -409,7 +417,7 @@ ...@@ -409,7 +417,7 @@
<Tr BGCOLOR="#CCCCFF"><Td><Hr></Td><Td><Hr></Td><Td><Hr></Td></Tr> <Tr BGCOLOR="#CCCCFF"><Td><Hr></Td><Td><Hr></Td><Td><Hr></Td></Tr>
<tr> <tr>
<td> Command NOT allowed for </td> <td> Command NOT allowed for </td>
<td> <font size="-1"> <li> MOVING </li> </font> </td> <td> <font size="-1"> <li> MOVING </li> <li> FAULT </li> </font> </td>
<td> .. </td> <td> .. </td>
</tr> </tr>
</table> </table>
......
...@@ -19,11 +19,19 @@ ...@@ -19,11 +19,19 @@
<td> <center><b> Default Value </b></center> </td> <td> <center><b> Default Value </b></center> </td>
</tr> </tr>
<tr> <tr>
<td> ClientSocketDevName </td> <td> Url </td>
<td> Name of the ClientSocketServer device which handles the communication </td> <td> Name or IP address<Br>
e.g : gpib1, 172.16.123.123 </td>
<td> String </td> <td> String </td>
<td> none </td> <td> none </td>
</tr> </tr>
<tr>
<td> Port </td>
<td> The IP port<Br>
default value : 1234 </td>
<td> short </td>
<td> none </td>
</tr>
<tr> <tr>
<td> ReadTimeout </td> <td> ReadTimeout </td>
<td> Read Timeout in milliseconds<Br> <td> Read Timeout in milliseconds<Br>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
</parent> </parent>
<groupId>fr.soleil.device</groupId> <groupId>fr.soleil.device</groupId>
<artifactId>GpibPrologix-${aol}-${mode}</artifactId> <artifactId>GpibPrologix-${aol}-${mode}</artifactId>
<version>1.2.1-SNAPSHOT</version> <version>1.3.0</version>
<packaging>nar</packaging> <packaging>nar</packaging>
<name>GpibPrologix</name> <name>GpibPrologix</name>
<description>GpibPrologix device</description> <description>GpibPrologix device</description>
...@@ -39,13 +39,22 @@ ...@@ -39,13 +39,22 @@
<plugin> <plugin>
<groupId>org.freehep</groupId> <groupId>org.freehep</groupId>
<artifactId>freehep-nar-plugin</artifactId> <artifactId>freehep-nar-plugin</artifactId>
<configuration>
<cpp>
<defines>
<define>LOG4TANGO_HAVE_INT64_T</define>
<define>PROJECT_NAME=${project.name}</define>
<define>PROJECT_VERSION=${project.version}</define>
</defines>
</cpp>
</configuration>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>fr.soleil.lib</groupId> <groupId>fr.soleil.lib</groupId>
<artifactId>YAT4Tango-${aol}-${library}-${mode}</artifactId> <artifactId>YAT-${aol}-${library}-${mode}</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
<scm> <scm>
......
This diff is collapsed.
...@@ -39,8 +39,12 @@ ...@@ -39,8 +39,12 @@
#define GpibPrologix_H #define GpibPrologix_H
#include <tango.h> #include <tango.h>
#include <yat/network/ClientSocket.h>
#include <deque> #include <deque>
#include <DeviceProxyHelper.h>
/*----- PROTECTED REGION END -----*/ // GpibPrologix.h /*----- PROTECTED REGION END -----*/ // GpibPrologix.h
...@@ -72,8 +76,12 @@ public: ...@@ -72,8 +76,12 @@ public:
// Device property data members // Device property data members
public: public:
// ClientSocketDevName: Name of the ClientSocketServer device which handles the communication // Url: Name or IP address
string clientSocketDevName; // e.g : gpib1, 172.16.123.123
string url;
// Port: The IP port
// default value : 1234
Tango::DevShort port;
// ReadTimeout: Read Timeout in milliseconds // ReadTimeout: Read Timeout in milliseconds
// from 1 to 4000 // from 1 to 4000
// default value : 100 // default value : 100
...@@ -132,7 +140,7 @@ public: ...@@ -132,7 +140,7 @@ public:
/** /**
* The device object destructor. * The device object destructor.
*/ */
~GpibPrologix() {delete_device();}; ~GpibPrologix() {delete_device();}
// Miscellaneous methods // Miscellaneous methods
...@@ -262,32 +270,44 @@ public: ...@@ -262,32 +270,44 @@ public:
// Additional Method prototypes // Additional Method prototypes
protected : protected :
yat::ClientSocket* sock;
yat::Mutex m_lock;
//- proxy /**
Tango::DeviceProxyHelper* m_dsproxy; * Disconnect from the current socket
void create_proxy(); */
void delete_proxy(); void disconnect();
/**
* Connect to the current socket
*/
void connect();
void protect_special_caracters_in_cmd (std::string & cmd); void protect_special_caracters_in_cmd (std::string & cmd);
void set_address(); bool init_device_done;
bool properties_missing;
bool m_init_device_done; std::string read_cmd;
bool m_properties_missing;
std::string m_status_str; std::string status_str;
std::string m_error_init_msg; std::string info;
std::string error_init_msg;
//- use to display the 1st Eth com error (try to find com error origin...) //- use to display the 1st Eth com error (try to find com error origin...)
std::string m_com_last_error; std::string com_last_error;
Tango::DevState com_state;
Tango::DevState m_com_state; void write_internal (std::string cmd);
std::string read_internal (void);
//- for counting com errors //- for counting com errors
size_t m_com_error_counter; size_t com_error_counter;
size_t m_consecutive_com_error_counter; size_t consecutive_com_error_counter;
std::string m_start_date; bool last_com_was_error;
std::deque <std::string> m_failed_cmds; std::string start_date;
std::deque <std::string> failed_cmds;
/*----- PROTECTED REGION END -----*/ // GpibPrologix::Additional Method prototypes /*----- PROTECTED REGION END -----*/ // GpibPrologix::Additional Method prototypes
}; };
......
...@@ -5,10 +5,14 @@ ...@@ -5,10 +5,14 @@
<inheritances classname="Device_4Impl" sourcePath=""/> <inheritances classname="Device_4Impl" sourcePath=""/>
<identification contact="at synchrotron-soleil.fr - coquet" author="coquet" emailDomain="synchrotron-soleil.fr" classFamily="Communication" siteSpecific="" platform="All Platforms" bus="GPIB" manufacturer="none" reference=""/> <identification contact="at synchrotron-soleil.fr - coquet" author="coquet" emailDomain="synchrotron-soleil.fr" classFamily="Communication" siteSpecific="" platform="All Platforms" bus="GPIB" manufacturer="none" reference=""/>
</description> </description>
<deviceProperties name="ClientSocketDevName" description="Name of the ClientSocketServer device which handles the communication"> <deviceProperties name="Url" description="Name or IP address&#xA;e.g : gpib1, 172.16.123.123">
<type xsi:type="pogoDsl:StringType"/> <type xsi:type="pogoDsl:StringType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties> </deviceProperties>
<deviceProperties name="Port" description="The IP port&#xA;default value : 1234">
<type xsi:type="pogoDsl:ShortType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<deviceProperties name="ReadTimeout" description="Read Timeout in milliseconds&#xA;from 1 to 4000&#xA;default value : 100"> <deviceProperties name="ReadTimeout" description="Read Timeout in milliseconds&#xA;from 1 to 4000&#xA;default value : 100">
<type xsi:type="pogoDsl:ShortType"/> <type xsi:type="pogoDsl:ShortType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
...@@ -57,6 +61,7 @@ ...@@ -57,6 +61,7 @@
</argout> </argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<excludedStates>MOVING</excludedStates> <excludedStates>MOVING</excludedStates>
<excludedStates>FAULT</excludedStates>
</commands> </commands>
<commands name="Read" description="" execMethod="read" displayLevel="OPERATOR" polledPeriod="0"> <commands name="Read" description="" execMethod="read" displayLevel="OPERATOR" polledPeriod="0">
<argin description=""> <argin description="">
......
...@@ -44,8 +44,8 @@ static const char *HttpServer = "http://www.esrf.eu/computing/cs/tango/tango_doc ...@@ -44,8 +44,8 @@ static const char *HttpServer = "http://www.esrf.eu/computing/cs/tango/tango_doc
//============================================================================= //=============================================================================
#include <tango.h> // #include <tango.h>
#include "GpibPrologix.h" // #include <GpibPrologix.h>
#include "GpibPrologixClass.h" #include "GpibPrologixClass.h"
/*----- PROTECTED REGION END -----*/ // GpibPrologixClass.cpp /*----- PROTECTED REGION END -----*/ // GpibPrologixClass.cpp
...@@ -377,8 +377,21 @@ void GpibPrologixClass::set_default_property() ...@@ -377,8 +377,21 @@ void GpibPrologixClass::set_default_property()
// Set Default Class Properties // Set Default Class Properties
// Set Default device Properties // Set Default device Properties
prop_name = "ClientSocketDevName"; prop_name = "Url";
prop_desc = "Name of the ClientSocketServer device which handles the communication"; prop_desc = "Name or IP address\ne.g : gpib1, 172.16.123.123";
prop_def = "";
vect_data.clear();
if (prop_def.length()>0)
{
Tango::DbDatum data(prop_name);
data << vect_data ;
dev_def_prop.push_back(data);
add_wiz_dev_prop(prop_name, prop_desc, prop_def);
}
else
add_wiz_dev_prop(prop_name, prop_desc);
prop_name = "Port";
prop_desc = "The IP port\ndefault value : 1234";
prop_def = ""; prop_def = "";
vect_data.clear(); vect_data.clear();
if (prop_def.length()>0) if (prop_def.length()>0)
...@@ -614,7 +627,28 @@ void GpibPrologixClass::device_factory(const Tango::DevVarStringArray *devlist_p ...@@ -614,7 +627,28 @@ void GpibPrologixClass::device_factory(const Tango::DevVarStringArray *devlist_p
/*----- PROTECTED REGION ID(GpibPrologixClass::device_factory_before) ENABLED START -----*/ /*----- PROTECTED REGION ID(GpibPrologixClass::device_factory_before) ENABLED START -----*/
// Add your own code // Add your own code
for (unsigned long i=0 ; i<devlist_ptr->length() ; i++)
{
cout4 << "Device name : " << (*devlist_ptr)[i].in() << endl;
device_list.push_back(new GpibPrologix(this, (*devlist_ptr)[i]));
}
// erase : conflict with yat dyn attr -> can crash device if erase called
// Export devices to the outside world
for (unsigned long i=1 ; i<=devlist_ptr->length() ; i++)
{
// Add dynamic attributes if any
GpibPrologix *dev = static_cast<GpibPrologix *>(device_list[device_list.size()-i]);
dev->add_dynamic_attributes();
// Check before if database used.
if ((Tango::Util::_UseDb == true) && (Tango::Util::_FileDb == false))
export_device(dev);
else
export_device(dev, dev->get_name().c_str());
}
return;
/*----- PROTECTED REGION END -----*/ // GpibPrologixClass::device_factory_before /*----- PROTECTED REGION END -----*/ // GpibPrologixClass::device_factory_before
// Create devices and add it into the device list // Create devices and add it into the device list
...@@ -625,7 +659,7 @@ void GpibPrologixClass::device_factory(const Tango::DevVarStringArray *devlist_p ...@@ -625,7 +659,7 @@ void GpibPrologixClass::device_factory(const Tango::DevVarStringArray *devlist_p
} }
// Manage dynamic attributes if any // Manage dynamic attributes if any
// erase_dynamic_attributes(devlist_ptr, get_class_attr()->get_attr_list()); erase_dynamic_attributes(devlist_ptr, get_class_attr()->get_attr_list());
// Export devices to the outside world // Export devices to the outside world
for (unsigned long i=1 ; i<=devlist_ptr->length() ; i++) for (unsigned long i=1 ; i<=devlist_ptr->length() ; i++)
......
...@@ -42,8 +42,8 @@ ...@@ -42,8 +42,8 @@
#ifndef GpibPrologixClass_H #ifndef GpibPrologixClass_H
#define GpibPrologixClass_H #define GpibPrologixClass_H
#include <tango.h> // #include <tango.h>
#include <GpibPrologix.h> #include "GpibPrologix.h"
/*----- PROTECTED REGION END -----*/ // GpibPrologixClass.h /*----- PROTECTED REGION END -----*/ // GpibPrologixClass.h
......
...@@ -63,7 +63,8 @@ namespace GpibPrologix_ns ...@@ -63,7 +63,8 @@ namespace GpibPrologix_ns
bool GpibPrologix::is_Write_allowed(TANGO_UNUSED(const CORBA::Any &any)) bool GpibPrologix::is_Write_allowed(TANGO_UNUSED(const CORBA::Any &any))
{ {
// Compare device state with not allowed states. // Compare device state with not allowed states.
if (get_state()==Tango::MOVING) if (get_state()==Tango::MOVING ||
get_state()==Tango::FAULT)
{ {
/*----- PROTECTED REGION ID(GpibPrologix::WriteStateAllowed) ENABLED START -----*/ /*----- PROTECTED REGION ID(GpibPrologix::WriteStateAllowed) ENABLED START -----*/
......
...@@ -62,8 +62,6 @@ int main(int argc, char *argv[]) ...@@ -62,8 +62,6 @@ int main(int argc, char *argv[])
//---------------------------------------- //----------------------------------------
tg = Tango::Util::init(argc,argv); tg = Tango::Util::init(argc,argv);
tg->set_serial_model(Tango::BY_CLASS);
// Create the device server singleton // Create the device server singleton
// which will create everything // which will create everything
//---------------------------------------- //----------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment