Commit 95bb641d authored by Graziano Scalamera's avatar Graziano Scalamera
Browse files

First import from CVS release_10

parent c277af83
.nse_depinfo
bin
obj
# Eclipse
.cproject
.project
.settings
NAME_SRV = plcslu-srv
CXXFLAGS = -I/usr/include/mysql -L/usr/lib/mysql
LDFLAGS = -lmysqlclient
include ../makefiles/Make-9.3.4.in
This diff is collapsed.
0 nDB INT con 102 invia i comandi 6/9; con 103 esegue i cmd bool
2 TIME_SINC DATE_AND_TIME
10 OPN_VLVP_UH_01_CMD BOOL comando apertura valvola "P" Undulator Hall 01
10.1 CLD_VLVP_UH_01_CMD BOOL comando chiusura valvola "P" Undulator Hall 01
10.2 OPN_VLVP_UH_02_CMD BOOL
10.3 CLD_VLVP_UH_02_CMD BOOL
10.4 OPN_VLVP_UH_03_CMD BOOL
10.5 CLD_VLVP_UH_03_CMD BOOL
10.6 OPN_VLVP_SH_01_CMD BOOL comando apertura valvola "P" Safety Huch 01
10.7 CLD_VLVP_SH_01_CMD BOOL comando chiusura valvola "P" Safety Huch 01
10 OPN_VLVP_EH_01_CMD BOOL comando apertura valvola "P" Esperimental Hall 01
11.1 CLD_VLVP_EH_01_CMD BOOL comando chiusura valvola "P" Esperimental Hall 01
11.2 START_PMP_LSU_UH_01_CMD BOOL comando avviamento pompa Laser Seed Utenti Undulator Hall 01
11.3 STOP_PMP_LSU_UH_01_CMD BOOL comando arresto pompa Laser Seed Utenti Undulator Hall 01
11.4 START_PMP_LSU_UH_02_CMD BOOL
11.5 STOP_PMP_LSU_UH_02_CMD BOOL
11.6 START_PMP_LSU_UH_03_CMD BOOL
11.7 STOP_PMP_LSU_UH_03_CMD BOOL
12 START_PMP_LSU_SH_01_CMD BOOL
12.1 STOP_PMP_LSU_SH_01_CMD BOOL
12.2 START_PMP_LSU_EH_01_CMD BOOL
12.3 STOP_PMP_LSU_EH_01_CMD BOOL
12.4 s124 BOOL
12.5 s125 BOOL
12.6 s126 BOOL
12.7 s127 BOOL
13 s130 BOOL
13.1 s131 BOOL
13.2 s132 BOOL
13.3 s133 BOOL
13.4 s134 BOOL
13.5 s135 BOOL
13.6 s136 BOOL
13.7 s137 BOOL
14 spare140 WORD
16 OPN_CMD_BSH_LSU INT Codice apertura Beam Shutter Laser Seed Utenti da sala controllo
18 CLD_CMD_BSH_LSU INT Codice chiusura Beam Shutter Laser Seed Utentida sala controllo
20 OPN_CMD_BSH_TIMEX INT
22 CLD_CMD_BSH_TIMEX INT
24 OPN_CMD_BSH_DIPROI INT
26 CLD_CMD_BSH_DIPROI INT
28 OPN_CMD_BSH_LDM INT
30 CLD_CMD_BSH_LDM INT
32 s320 INT
34 s340 INT
36 s36 INT
38 s438 INT
40 s400 INT
42 s420 INT
44 s440 INT
46 s460 BOOL
46.1 s461 BOOL
46.2 s462 BOOL
46.3 s463 BOOL
46.4 s464 BOOL
46.5 s465 BOOL
46.6 s466 BOOL
46.7 s467 BOOL
47 s470 BOOL
47.1 s471 BOOL
47.2 s472 BOOL
47.3 s473 BOOL
47.4 s474 BOOL
47.5 s475 BOOL
47.6 s476 BOOL
47.7 s477 BOOL
This diff is collapsed.
0 nDB INT con 102 invia i comandi 6/9; con 103 esegue i cmd bool
2 TIME_SINC DATE_AND_TIME
10 OPN_VLVP_UH_01_CMD BOOL comando apertura valvola "P" Undulator Hall 01
10.1 CLD_VLVP_UH_01_CMD BOOL comando chiusura valvola "P" Undulator Hall 01
10.2 OPN_VLVP_UH_02_CMD BOOL
10.3 CLD_VLVP_UH_02_CMD BOOL
10.4 OPN_VLVP_UH_03_CMD BOOL
10.5 CLD_VLVP_UH_03_CMD BOOL
10.6 OPN_VLVP_SH_01_CMD BOOL comando apertura valvola "P" Safety Huch 01
10.7 CLD_VLVP_SH_01_CMD BOOL comando chiusura valvola "P" Safety Huch 01
10 OPN_VLVP_EH_01_CMD BOOL comando apertura valvola "P" Esperimental Hall 01
11.1 CLD_VLVP_EH_01_CMD BOOL comando chiusura valvola "P" Esperimental Hall 01
11.2 START_PMP_LSU_UH_01_CMD BOOL comando avviamento pompa Laser Seed Utenti Undulator Hall 01
11.3 STOP_PMP_LSU_UH_01_CMD BOOL comando arresto pompa Laser Seed Utenti Undulator Hall 01
11.4 START_PMP_LSU_UH_02_CMD BOOL
11.5 STOP_PMP_LSU_UH_02_CMD BOOL
11.6 START_PMP_LSU_UH_03_CMD BOOL
11.7 STOP_PMP_LSU_UH_03_CMD BOOL
12 START_PMP_LSU_SH_01_CMD BOOL
12.1 STOP_PMP_LSU_SH_01_CMD BOOL
12.2 START_PMP_LSU_EH_01_CMD BOOL
12.3 STOP_PMP_LSU_EH_01_CMD BOOL
12.4 START_PMP_LSU_EH_02_CMD BOOL
12.5 STOP_PMP_LSU_EH_02_CMD BOOL
12.6 OPN_VLVP_EH_02_CMD BOOL
12.7 CLD_VLVP_EH_02_CMD BOOL
13 s130 BOOL
13.1 s131 BOOL
13.2 s132 BOOL
13.3 s133 BOOL
13.4 s134 BOOL
13.5 s135 BOOL
13.6 s136 BOOL
13.7 s137 BOOL
14 spare140 WORD
16 OPN_CMD_BSH_LSU INT Codice apertura Beam Shutter Laser Seed Utenti da sala controllo
18 CLD_CMD_BSH_LSU INT Codice chiusura Beam Shutter Laser Seed Utentida sala controllo
20 OPN_CMD_BSH_TIMEX INT
22 CLD_CMD_BSH_TIMEX INT
24 OPN_CMD_BSH_DIPROI INT
26 CLD_CMD_BSH_DIPROI INT
28 OPN_CMD_BSH_LDM INT
30 CLD_CMD_BSH_LDM INT
32 OPN_CMD_BSH_UH INT
34 CLD_CMD_BSH_UH INT
36 OPN_CMD_BSH_TUBE_EOS1 INT
38 CLD_CMD_BSH_TUBE_EOS1 INT
40 OPN_CMD_BSH_TABLE_EOS1 INT
42 CLD_CMD_BSH_TABLE_EOS1 INT
44 OPN_CMD_BSH_TUBE_EOS2 INT
46 CLD_CMD_BSH_TABLE_EOS2 INT
48 OPN_CMD_BSH_TIMER INT
50 CLD_CMD_BSH_TIMER INT
52 OPN_CMD_BSH_BRD_TIMER INT
54 CLD_CMD_BSH_BRD_TIMER INT
56 s465 INT
58 s466 INT
60 Open_Bsh_SLR INT
62 Close_Bsh_SLR INT
64 s471 INT
66 s472 INT
68 s473 INT
70 s474 INT
72 OPN_CMD_BSH_EEHG INT
74 CLOSE_CMD_BSH_EEHG INT
76 OPN_CMD_SH_EEHG INT
78 CLOSE_CMD_SH_EEHG INT
80 OPN_CMD_BSH_FEL1 INT
82 CLOSE_CMD_BSH_FEL1 INT
84 OPN_CMD_BSH_FEL2 INT
86 CLOSE_CMD_BSH_FEL2 INT
88 s475 INT
90 s476 INT
92 s477 INT
94 s478 INT
96 s479 INT
98 s480 INT
static const char *RcsId = "$Header: /home/cvsadm/cvsroot/fermi/servers/plcslu/src/ClassFactory.cpp,v 1.1 2012-10-30 09:23:05 graziano Exp $";
//+=============================================================================
//
// file : ClassFactory.cpp
//
// description : C++ source for the class_factory method of the DServer
// device class. This method is responsible to create
// all class singletin for a device server. It is called
// at device server startup
//
// project : TANGO Device Server
//
// $Author: graziano $
//
// $Revision: 1.1 $
//
// $Log: ClassFactory.cpp,v $
// Revision 1.1 2012-10-30 09:23:05 graziano
// first commit
//
//
//
//
// 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
//=============================================================================
#include <tango.h>
#include <PLCsluClass.h>
/**
* Create PLCsluClass singleton and store it in DServer object.
*/
void Tango::DServer::class_factory()
{
add_class(PLCslu_ns::PLCsluClass::init("PLCslu"));
}
This diff is collapsed.
//=============================================================================
//
// file : PLCslu.h
//
// description : Include for the PLCslu class.
//
// project : plc low level configurable server
//
// $Author: graziano $
//
// $Revision: 1.8 $
//
// $Log: PLCslu.h,v $
// Revision 1.8 2018-04-10 14:40:50 graziano
// fixed tx db size
//
// Revision 1.7 2018-04-10 14:28:39 graziano
// fixed tx db size
//
// Revision 1.6 2017-09-14 07:07:05 graziano
// fixed bug
//
// Revision 1.5 2017-08-09 08:41:31 graziano
// fixed access_names2 and access_image2
//
// Revision 1.4 2017-08-09 08:15:35 graziano
// changed maintainance procedure with new badge reader
//
// Revision 1.3 2015-06-03 15:08:52 graziano
// added timer
//
// Revision 1.2 2012-11-06 08:46:19 graziano
// development
//
// Revision 1.1 2012-10-30 09:23:05 graziano
// first commit
//
//
//
//
// 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
//=============================================================================
#ifndef _PLCSLU_H
#define _PLCSLU_H
#include <tango.h>
#include <math.h>
#include <mysql.h>
#include <deque>
#include <omnithread.h>
#include <stdint.h>
//using namespace Tango;
/**
* @author $Author: graziano $
* @version $Revision: 1.8 $
*/
// Add your own constants definitions here.
//-----------------------------------------------
//size of dbstat in bit
#define MESG_STAT_MAX_LEN 1920
//size of dbalm in bit
#define MESG_ALM_MAX_LEN 1920
//size of dbacc in bit
#define MESG_ACC_MAX_LEN 2432
//size of dbacc2 in bit
#define MESG_ACC2_MAX_LEN 376
//max number of attributes
#define MAX_N_ATTR 100
#define MAX_N_CMD 100
#define MAX_N_BADGE 18
#define MAX_LEN_LABEL 100 //34
#define MAX_LEN_DESC 100 //60
//size of the message buffer
#define BUF_LEN 3000
#define ECHO_51_CMD 51
#define ECHO_50_CMD 50
//length of the raw state message
//#define NUM_SUPER_BLK 120
//length of the raw access message
#define NUM_ACC_BLK MESG_ACC_MAX_LEN/16 //152
//length of the raw access message
//#define NUM_ACC2_BLK MESG_ACC2_MAX_LEN/16
//timestamp size in bytes
#define TSTAMP_SIZE 8
#define MESG_PLC_TIMEOUT "Scaduto timeout risposta da PLC"
//db names length
#define DB_NAMES_LEN 116
//max size of the db query
#define DB_QUERY_LEN 1024
class plcsrvthread;
class plctimingthread;
#pragma pack(push, 1) // exact fit - no padding
namespace PLCslu_ns
{
#define SYNC_CMD 7777 //clock alignment cmd
typedef struct intlck_cmd { //length 48 bytes
u_short actDB; //command code
u_char year,
month,
day,
hour,
min,
sec,
msec,
wday; //timestamp for ck alignment
u_char blk[90];
} intlck_cmd_t;
#define NUM_DATA_BLK 228
typedef struct intlck_dbstat { //length 240 bytes (all)
u_short nDB;
u_short ver;
u_char month,
year,
hour,
day,
sec,
min,
wday,
msec;
u_char blk[NUM_DATA_BLK];//228 BYTES
} intlck_dbstat_t;
//single name len
#define PLC_NAME_LEN 16
// names
typedef unsigned char pers_name[PLC_NAME_LEN];
// structure for badge string
//badge string size in words
#define BADGE_SIZE 8
typedef u_short badge_t[BADGE_SIZE];
typedef struct intlck_dbacc{ //length 304 bytes (all)
u_short nDB;
u_short P_acc;
u_char month,
year,
hour,
day,
sec,
min,
wday,
msec;
u_short spare0; //WORD W#16#0
//u_short posti0_15; //BOOL FALSE indica il posto occupato
u_char posti0_7; //BOOL FALSE indica il posto occupato
u_char posti7_15; //BOOL FALSE indica il posto occupato
pers_name badge_l[18]; //STRING[14] FALSE indica il badge accettato
} intlck_dbacc_t;
typedef struct intlck_dbacc2{ //length 304 bytes (all)
u_short nDB;
u_short P_acc;
u_char month,
year,
hour,
day,
sec,
min,
wday,
msec;
u_short spare0; //WORD W#16#0
//u_short posti0_15; //BOOL FALSE indica il posto occupato
u_char posti0_7; //BOOL FALSE indica il posto occupato
pers_name badge_l[2]; //STRING[14] FALSE indica il badge accettato
} intlck_dbacc2_t;
//db names length
#define DB_NAMES_LEN 116
// timestamp
typedef u_short tstamp_t[TSTAMP_SIZE/2];
typedef struct tstamp_s {
u_short year,
month,
day,
hour,
min,
sec,
msec,
wday;
} tstamp__;
typedef struct log_msg { //length 48 bytes
u_short numDB; //command code
intlck_dbstat db51;
intlck_dbacc db50;
intlck_dbacc2 db49;
} log_msg_t;
/**
* Class Description:
*
*/
/*
* Device States Description:
* Tango::ON :
* Tango::FAULT :
* Tango::UNKNOWN :
*/
class log_list : public omni_mutex {
public:
log_list(void): empty(this) {}
~log_list(void) {}
void push_back(log_msg& a);
const log_msg pop_front(void);
protected:
list<log_msg> l_log;
omni_condition empty;
private:
};
class PLCslu: public TANGO_BASE_CLASS
{
public :
// Add your own data members here
//-----------------------------------------
u_char blk_db51_buffer[NUM_DATA_BLK];
pers_name blk_db50_buffer[18];
pers_name blk_db49_buffer[2];
char dbtable[80];
log_list mesg_list_log;
// Here is the Start of the automatic code generation part
//-------------------------------------------------------------
/**
* @name attributes
* Attributs member data.
*/
//@{
Tango::DevBoolean *attr_Stat_image_read;
Tango::DevBoolean *attr_Alarm_image_read;
Tango::DevBoolean *attr_Access_image_read;
Tango::DevString *attr_Access_names_read;
Tango::DevBoolean *attr_Access_image2_read;
Tango::DevString *attr_Access_names2_read;
#if 0
Tango::DevBoolean *attr_Memo_buttons_read;
#endif
//@}
/**
* @name Device properties
* Device properties member data.
*/
//@{
/**
* PLC connection parameters:
* IP
* port
*/
vector<string> connect_param;
/**
* database logging parameters:
* host
* port
* user
* pw
*/
vector<string> db_param;
/**
* Description file, list of attribute names, type, R/W and dimension
*/
vector<string> data_config;
/**
* timeout in ms, after this interval data becomes old
*/
Tango::DevLong timeout;
//@}
/**@name Constructors
* Miscellaneous constructors */
//@{
/**
* Constructs a newly allocated Command object.
*
* @param cl Class.
* @param s Device Name
*/
PLCslu(Tango::DeviceClass *cl,string &s);
/**
* Constructs a newly allocated Command object.
*
* @param cl Class.
* @param s Device Name
*/
PLCslu(Tango::DeviceClass *cl,const char *s);
/**
* Constructs a newly allocated Command object.
*
* @param cl Class.
* @param s Device name
* @param d Device description.
*/
PLCslu(Tango::DeviceClass *cl,const char *s,const char *d);
//@}
/**@name Destructor
* Only one desctructor is defined for this class */
//@{
/**
* The object desctructor.
*/
~PLCslu() {delete_device();};
/**
* will be called at device destruction or at init command.
*/
void delete_device();
//@}
/**@name Miscellaneous methods */
//@{
/**
* Initialize the device
*/
virtual void init_device();
/**
* Always executed method befor execution command method.
*/
virtual void always_executed_hook();
//@}
/**
* @name PLCslu methods prototypes
*/
//@{
/**
* Hardware acquisition for attributes.
*/
virtual void read_attr_hardware(vector<long> &attr_list);
/**
* Extract real attribute values for Stat_image acquisition result.
*/
virtual void read_Stat_image(Tango::Attribute &attr);
/**
* Extract real attribute values for Alarm_image acquisition result.
*/
virtual void read_Alarm_image(Tango::Attribute &attr);
/**
* Extract real attribute values for Access_image acquisition result.
*/
virtual void read_Access_image(Tango::Attribute &attr);
/**
* Extract real attribute values for Access_names acquisition result.
*/
virtual void read_Access_names(Tango::Attribute &attr);
/**
* Extract real attribute values for Access_image2 acquisition result.
*/
virtual void read_Access_image2(Tango::Attribute &attr);
/**
* Extract real attribute values for Access_names2 acquisition result.
*/
virtual void read_Access_names2(Tango::Attribute &attr);
#if 0
/**
* Extract real attribute values for Memo_buttons acquisition result.
*/
virtual void read_Memo_buttons(Tango::Attribute &attr);
#endif
/**
* Read/Write allowed for Stat_image attribute.
*/
virtual bool is_Stat_image_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for Alarm_image attribute.
*/
virtual bool is_Alarm_image_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for Access_image attribute.
*/
virtual bool is_Access_image_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for Access_names attribute.
*/
virtual bool is_Access_names_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for Access_image2 attribute.
*/
virtual bool is_Access_image2_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for Access_names2 attribute.
*/
virtual bool is_Access_names2_allowed(Tango::AttReqType type);
#if 0
/**
* Read/Write allowed for Memo_buttons attribute.
*/
virtual bool is_Memo_buttons_allowed(Tango::AttReqType type);
#endif
/**
* Execution allowed for Send_cmd command.
*/
virtual bool is_Send_cmd_allowed(const CORBA::Any &any);
/**
* Execution allowed for Acknowledge command.
*/
virtual bool is_Acknowledge_allowed(const CORBA::Any &any);
/**
*
* @param argin Command code, cmd argument
* @exception DevFailed