Skip to content
Snippets Groups Projects
Commit 0a276358 authored by Alain BUTEAU's avatar Alain BUTEAU
Browse files

first tentative implementation of the protocol for V2 cryocooler generation as...

first tentative implementation of the protocol for V2 cryocooler generation as defined in the JIRA CTRLRFC-633
parent 86c52466
No related branches found
No related tags found
No related merge requests found
...@@ -107,6 +107,11 @@ public : ...@@ -107,6 +107,11 @@ public :
* DB number the device server writes in the PLC * DB number the device server writes in the PLC
*/ */
Tango::DevShort dbWriteNumber; Tango::DevShort dbWriteNumber;
/**
* If set to V1 , the protocol for writing is defined as in the CPU313C-2DP paragraph of the supplier document
* If set to V2 he protocol for writing is defined as in the CPU IM151-8 paragraph of the supplier document
*/
string cryoCoolerProtocol;
//@} //@}
/**@name Constructors /**@name Constructors
......
static const char *ClassId = "$Id: $";
static const char *CvsPath = "$Source: $";
static const char *SvnPath = "$HeadURL: $";
static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Vacuum/CryoCooler/src/CryoCoolerClass.cpp,v 1.3 2010-03-26 09:18:03 vince_soleil Exp $"; static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Vacuum/CryoCooler/src/CryoCoolerClass.cpp,v 1.3 2010-03-26 09:18:03 vince_soleil Exp $";
static const char *TagName = "$Name: not supported by cvs2svn $"; static const char *TagName = "$Name: not supported by cvs2svn $";
static const char *HttpServer= "http://www.esrf.fr/computing/cs/tango/tango_doc/ds_doc/"; static const char *HttpServer= "http://www.esrf.fr/computing/cs/tango/tango_doc/ds_doc/";
...@@ -349,6 +352,7 @@ void CryoCoolerClass::set_default_property() ...@@ -349,6 +352,7 @@ void CryoCoolerClass::set_default_property()
prop_name = "HardwarePollingTime"; prop_name = "HardwarePollingTime";
prop_desc = "time in ms for hardware polling"; prop_desc = "time in ms for hardware polling";
prop_def = ""; prop_def = "";
vect_data.clear();
if (prop_def.length()>0) if (prop_def.length()>0)
{ {
Tango::DbDatum data(prop_name); Tango::DbDatum data(prop_name);
...@@ -362,6 +366,7 @@ void CryoCoolerClass::set_default_property() ...@@ -362,6 +366,7 @@ void CryoCoolerClass::set_default_property()
prop_name = "PLCServerName"; prop_name = "PLCServerName";
prop_desc = ""; prop_desc = "";
prop_def = ""; prop_def = "";
vect_data.clear();
if (prop_def.length()>0) if (prop_def.length()>0)
{ {
Tango::DbDatum data(prop_name); Tango::DbDatum data(prop_name);
...@@ -375,6 +380,7 @@ void CryoCoolerClass::set_default_property() ...@@ -375,6 +380,7 @@ void CryoCoolerClass::set_default_property()
prop_name = "DbReadNumber"; prop_name = "DbReadNumber";
prop_desc = "DB number the device server reads in the PLC"; prop_desc = "DB number the device server reads in the PLC";
prop_def = ""; prop_def = "";
vect_data.clear();
if (prop_def.length()>0) if (prop_def.length()>0)
{ {
Tango::DbDatum data(prop_name); Tango::DbDatum data(prop_name);
...@@ -388,6 +394,22 @@ void CryoCoolerClass::set_default_property() ...@@ -388,6 +394,22 @@ void CryoCoolerClass::set_default_property()
prop_name = "DbWriteNumber"; prop_name = "DbWriteNumber";
prop_desc = "DB number the device server writes in the PLC"; prop_desc = "DB number the device server writes in the PLC";
prop_def = ""; 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 = "CryoCoolerProtocol";
prop_desc = "If set to V1 , the protocol for writing is defined as in the CPU313C-2DP paragraph of the supplier document\nIf set to V2 he protocol for writing is defined as in the CPU IM151-8 paragraph of the supplier document";
prop_def = "V1";
vect_data.clear();
vect_data.push_back("V1");
if (prop_def.length()>0) if (prop_def.length()>0)
{ {
Tango::DbDatum data(prop_name); Tango::DbDatum data(prop_name);
...@@ -433,17 +455,23 @@ void CryoCoolerClass::write_class_property() ...@@ -433,17 +455,23 @@ void CryoCoolerClass::write_class_property()
description << str_desc; description << str_desc;
data.push_back(description); data.push_back(description);
// put cvs location // put cvs or svn location
string rcsId(RcsId);
string filename(classname); string filename(classname);
start = rcsId.find("/"); filename += "Class.cpp";
// Create a string with the class ID to
// get the string into the binary
string class_id(ClassId);
// check for cvs information
string src_path(CvsPath);
start = src_path.find("/");
if (start!=string::npos) if (start!=string::npos)
{ {
filename += "Class.cpp"; end = src_path.find(filename);
end = rcsId.find(filename);
if (end>start) if (end>start)
{ {
string strloc = rcsId.substr(start, end-start); string strloc = src_path.substr(start, end-start);
// Check if specific repository // Check if specific repository
start = strloc.find("/cvsroot/"); start = strloc.find("/cvsroot/");
if (start!=string::npos && start>0) if (start!=string::npos && start>0)
...@@ -457,12 +485,35 @@ void CryoCoolerClass::write_class_property() ...@@ -457,12 +485,35 @@ void CryoCoolerClass::write_class_property()
data.push_back(cvs_loc); data.push_back(cvs_loc);
} }
} }
// check for svn information
else
{
string src_path(SvnPath);
start = src_path.find("://");
if (start!=string::npos)
{
end = src_path.find(filename);
if (end>start)
{
header = "$HeadURL: ";
start = header.length();
string strloc = src_path.substr(start, (end-start));
Tango::DbDatum svn_loc("svn_location");
svn_loc << strloc;
data.push_back(svn_loc);
}
}
}
// Get CVS or SVN revision tag
// Get CVS tag revision // CVS tag
string tagname(TagName); string tagname(TagName);
header = "$Name: "; header = "$Name: ";
start = header.length(); start = header.length();
string endstr(" $"); string endstr(" $");
end = tagname.find(endstr); end = tagname.find(endstr);
if (end!=string::npos && end>start) if (end!=string::npos && end>start)
{ {
...@@ -472,6 +523,30 @@ void CryoCoolerClass::write_class_property() ...@@ -472,6 +523,30 @@ void CryoCoolerClass::write_class_property()
data.push_back(cvs_tag); data.push_back(cvs_tag);
} }
// SVN tag
string svnpath(SvnPath);
header = "$HeadURL: ";
start = header.length();
end = svnpath.find(endstr);
if (end!=string::npos && end>start)
{
string strloc = svnpath.substr(start, end-start);
string tagstr ("/tags/");
start = strloc.find(tagstr);
if ( start!=string::npos )
{
start = start + tagstr.length();
end = strloc.find(filename);
string strtag = strloc.substr(start, end-start-1);
Tango::DbDatum svn_tag("svn_tag");
svn_tag << strtag;
data.push_back(svn_tag);
}
}
// Get URL location // Get URL location
string httpServ(HttpServer); string httpServ(HttpServer);
if (httpServ.length()>0) if (httpServ.length()>0)
......
...@@ -120,7 +120,11 @@ public: ...@@ -120,7 +120,11 @@ public:
// The CryoCoolerClass singleton definition // The CryoCoolerClass singleton definition
// //
class CryoCoolerClass : public Tango::DeviceClass class
#ifdef WIN32
__declspec(dllexport)
#endif
CryoCoolerClass : public Tango::DeviceClass
{ {
public: public:
// properties member data // properties member data
...@@ -149,6 +153,8 @@ protected: ...@@ -149,6 +153,8 @@ protected:
void attribute_factory(vector<Tango::Attr *> &); void attribute_factory(vector<Tango::Attr *> &);
void write_class_property(); void write_class_property();
void set_default_property(); void set_default_property();
string get_cvstag();
string get_cvsroot();
private: private:
void device_factory(const Tango::DevVarStringArray *); void device_factory(const Tango::DevVarStringArray *);
......
...@@ -214,6 +214,86 @@ namespace CryoCooler_ns ...@@ -214,6 +214,86 @@ namespace CryoCooler_ns
break; break;
//- USER_DEFINED_MSG ================ //- USER_DEFINED_MSG ================
//
// ------------------------------------- INTERFACE TO V2 CRYOCOOLER AS DESCRIBED BY CTRLRFC-633 -------------------------------------------------------------
//- SET_COMMAND ----------------
case CryoCooler_ns::SET_COMMAND_MSG:
{
DEBUG_STREAM << "CryoCoolerInterface::process_message handling SET_INT_MSG user msg" << std::endl;
//- get msg data...
struct HWProxy_ns::WInt * wi = 0;
_msg.detach_data(wi);
if (wi)
{
try
{
DEBUG_STREAM << "CryoCoolerInterface::process_message (1) trying to set command request " << wi->byte_offset << std::endl;
if (hwp_wr)
{
// V2_COMMAND_REQUEST_BYTE_0 = 0 dans le DBR
// wi->byte_offset contient le mot de commande telle que décrit dans le tableau de commandes , par exemple OPEN_V9 BYTE B#16#6 , 0
hwp_wr->write_byte ("CryoCoolerInterface::process_message (1) trying to write INT value ", V2_COMMAND_REQUEST_BYTE_0, wi->byte_offset);
// V2_COMMAND_REQUEST_BYTE_1 = 1 dans le DBR
hwp_wr->write_byte ("CryoCoolerInterface::process_message (1) trying to write INT value ", V2_COMMAND_REQUEST_BYTE_1, 0);
// V2_COMMAND_VALUE_BYTE = 2 dans le DBR . On écrit 0 dans les 4 octets car pas de valeur à écrire pour une commande
hwp_wr->write_real ("CryoCoolerInterface::process_message (1) trying to write INT value ", V2_COMMAND_VALUE_BYTE, 0);
}
}
catch (...)
{
this->com_status = hwp_wr->get_com_status();
this->com_state = hwp_wr->get_com_state();
this->last_error = hwp_wr->get_last_error();
delete wi;
break;
}
delete wi;
}
break;
}
case CryoCooler_ns::SET_REAL_V2_MSG:
{
DEBUG_STREAM << "CryoCoolerInterface::process_message handling SET_REAL_MSG user msg" << std::endl;
//- get msg data...
struct HWProxy_ns::WReal * wr = 0;
_msg.detach_data(wr);
if (wr)
{
try
{
DEBUG_STREAM << "CryoCoolerInterface::process_message (1) trying to write REAL value " << wr->value << " for command request " << wr->byte_offset << std::endl;
if (hwp_wr)
{
// V2_COMMAND_REQUEST_BYTE_0 = 0 dans le DBR
// wi->value telle que décrit dans le tableau de command , par exemple OPEN_V9 BYTE B#16#6 , 0
hwp_wr->write_byte ("CryoCoolerInterface::process_message (1) trying to write INT value ", V2_COMMAND_REQUEST_BYTE_0, wr->byte_offset);
// V2_COMMAND_REQUEST_BYTE_1 = 1 dans le DBR
hwp_wr->write_byte ("CryoCoolerInterface::process_message (1) trying to write INT value ", V2_COMMAND_REQUEST_BYTE_1, 0);
// V2_COMMAND_VALUE_BYTE = 2 dans le DBR . On écrit 0 dans les 4 octets car pas de valeur à écrire pour une commande
hwp_wr->write_real ("CryoCoolerInterface::process_message (1) trying to write INT value ", V2_COMMAND_VALUE_BYTE, wr->value);
}
}
catch (...)
{
this->com_status = hwp_wr->get_com_status();
this->com_state = hwp_wr->get_com_state();
this->last_error = hwp_wr->get_last_error();
delete wr;
break;
}
delete wr;
}
break;
}
// ------------------------------------- INTERFACE TO V1 CRYOCOOLER -------------------------------------------------------------
//- WRITE A REAL ---------------- //- WRITE A REAL ----------------
case HWProxy_ns::SET_REAL_MSG: case HWProxy_ns::SET_REAL_MSG:
{ {
...@@ -245,6 +325,10 @@ namespace CryoCooler_ns ...@@ -245,6 +325,10 @@ namespace CryoCooler_ns
} }
break; break;
} }
//- WRITE AN INT ---------------- //- WRITE AN INT ----------------
case HWProxy_ns::SET_INT_MSG: case HWProxy_ns::SET_INT_MSG:
{ {
......
#=============================================================================
#
# file : Makefile
#
# description : Include for the CryoCooler class.
#
# project : Makefile to generate a Tango server
#
# $Author: $
#
# $Revision: $
#
#
# copyleft : European Synchrotron Radiation Facility
# BP 220, Grenoble 38043
# FRANCE
#
#=============================================================================
# This file is generated by POGO
# (Program Obviously used to Generate tango Object)
#
# (c) - Software Engineering Group - ESRF
#=============================================================================
#
CLASS = CryoCooler
MAJOR_VERS = 1
MINOR_VERS = 0
RELEASE = Release_$(MAJOR_VERS)_$(MINOR_VERS)
#-----------------------------------------
# Set default home directories
#-----------------------------------------
TANGO_HOME = @prefix@
CPP_SERVERS = $(TANGO_HOME)/cppserver
ifdef no_debug
DEBUG = -O
else
DEBUG = -g
endif
ifdef _solaris
CC = CC
AR_SL = $(CC) -mt -G
VERS_OPT = -h
SL_EXT = so
endif
ifdef linux
CC = c++
CC_SHLIB = $(CC) -fPIC
AR = ar
AR_SL = $(CC) -fPIC -shared
SL_EXT = so
VERS_OPT = -Wl,-soname,
endif
INCLUDE_DIRS = -I$(TANGO_HOME)/include \
-I@ORB_PREFIX@/include \
-I. \
-I$(CPP_SERVERS)/include
OBJS_DIR = obj
LIB_DIRS = -L $(TANGO_HOME)/lib \
-L @ORB_PREFIX@/lib
TARGET_LIB = $(CPP_SERVERS)/lib/libtgclasses.a
#-----------------------------------------
# Set CXXFLAGS and LFLAGS
#-----------------------------------------
ifdef _solaris
CXXFLAGS = $(DEBUG) -mt -D_PTHREADS $(INCLUDE_DIRS)
LFLAGS = $(DEBUG) $(LIB_DIRS) \
-ltango \
-llog4tango \
-lomniORB4 \
-lomniDynamic4 \
-lomnithread \
-lCOS4 \
-lpthread \
-lposix4 -lsocket -lnsl
endif
ifdef linux
CXXFLAGS = $(DEBUG) -D_REENTRANT $(INCLUDE_DIRS)
LFLAGS = $(DEBUG) $(LIB_DIRS) \
-ltango \
-llog4tango \
-lomniORB4 \
-lomniDynamic4 \
-lomnithread \
-lCOS4 \
-ldl -lpthread
endif
#-----------------------------------------
# Set dependences
#-----------------------------------------
SVC_OBJS = $(OBJS_DIR)/main.o \
$(OBJS_DIR)/ClassFactory.o \
$(OBJS_DIR)/$(CLASS)Class.o \
$(OBJS_DIR)/$(CLASS)StateMachine.o \
$(OBJS_DIR)/$(CLASS).o
SHLIB_OBJS = $(OBJS_DIR)/$(CLASS)Class.so.o \
$(OBJS_DIR)/$(CLASS)StateMachine.so.o \
$(OBJS_DIR)/$(CLASS).so.o
SVC_INC = $(CLASS)Class.h \
$(CLASS).h
$(OBJS_DIR)/%.o: %.cpp $(SVC_INC)
$(CC) $(CXXFLAGS) -c $< -o $(OBJS_DIR)/$*.o
$(OBJS_DIR)/%.so.o: %.cpp $(SVC_INC)
$(CC_SHLIB) $(CXXFLAGS) -c $< -o $(OBJS_DIR)/$*.so.o
#-----------------------------------------
# Make Entry
#-----------------------------------------
all: $(CLASS)
$(CLASS): make_obj_dir make_bin_dir $(SVC_OBJS)
$(CC) $(SVC_OBJS) -o $(CLASS) $(LFLAGS)
@mv $(CLASS) bin/$(CLASS)
shlib: make_obj_dir make_shlib_dir $(SHLIB_OBJS)
$(AR_SL) -o \
shlib/$(CLASS).$(SL_EXT).$(MAJOR_VERS).$(MINOR_VERS) \
$(VERS_OPT)$(CLASS).$(SL_EXT).$(MAJOR_VERS) \
$(SHLIB_OBJS) $(LFLAGS)
@rm -f shlib/$(CLASS).$(SL_EXT)
@cd shlib; \
ln -s $(CLASS).$(SL_EXT).$(MAJOR_VERS).$(MINOR_VERS) $(CLASS).$(SL_EXT)
clean:
rm -f $(OBJS_DIR)/*.o \
$(OBJS_DIR)/*.so.o \
bin/$(CLASS) \
core
make_obj_dir:
@mkdir -p obj
make_bin_dir:
@mkdir -p bin
make_shlib_dir:
@mkdir -p shlib
#-----------------------------------------
# Install binary file
#-----------------------------------------
install:
cp bin/$(CLASS) $(TANGO_HOME)/bin
#-----------------------------------------
# Update class library and header files
# recompile without debug mode.
#-----------------------------------------
lib: clean
@make no_debug=1
cp *.h $(CPP_SERVERS)/include
ar ruv $(TARGET_LIB) $(CLASS).o
ar ruv $(TARGET_LIB) $(CLASS)Class.o
ar ruv $(TARGET_LIB) $(CLASS)StateMachine.o
ident $(TARGET_LIB) | grep $(CLASS)
#----------------------------------------------------
# Tag the CVS module corresponding to this class
#----------------------------------------------------
tag:
@cvstag "$(CLASS)-$(RELEASE)"
@make $(CLASS)
@make show_tag
show_tag:
@cvstag -d
/**
* Device Class Identification:
*
* Class Name : CryoCooler
* Contact : buteau@synchrotron-soleil.fr
* Class Family : Instrumentation
* Platform : All Platforms
* Bus : Not Applicable
* Manufacturer : none
* Reference :
*/
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment