diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..f768f7909ca84a190cd6d52a1522bf55d0a7e55d --- /dev/null +++ b/.gitignore @@ -0,0 +1,19 @@ +.pydevproject +.project +.cproject +.settings +obj +bin +core* +*~ +*.pyc +*.so +*.so* +.pylintrc +.metadata +.idea +.cvsignore +.nse_depinfo +software +oldsrc +CVS diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..65c5ca88a67c30becee01c5a8816d964b03862f9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..033ff9432e28212f620dd72b61e5fa04759e2bfb --- /dev/null +++ b/Makefile @@ -0,0 +1,6 @@ +NAME_SRV = accessconf-srv + +CXXFLAGS = -DRELEASE='"N$Name: $ "' +LDFLAGS = + +include ../Make.in diff --git a/README.md b/README.md index a9ff97e08e0f0d38646d3f0967858e4c50b6b4e3..745cb07bd98e6f6c2d1f63f9b67fe645705335b7 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,30 @@ -# accessconf +# Project Name + +accessconf + +## Description + +Tango device for accesconf, used in Elettra and FERMI. +Interfaces to a plcinterlock-srv and creates various dynamic commands and attibutes. + + +## Installation & deployment + +Follow the standard of Tango C++ server. + +## History + +2020-03-26: creation of project on gitlab + +# Credits + +Graziano Scalamera + +Elettra-Sincrotrone Trieste S.C.p.A. di interesse nazionale +Strada Statale 14 - km 163,5 in AREA Science Park +34149 Basovizza, Trieste ITALY + +## License + +GPL 3 diff --git a/accessconf_bsh_diproi.txt b/accessconf_bsh_diproi.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6f79ec6ce6ecb0282c77e833588ce456c249446 --- /dev/null +++ b/accessconf_bsh_diproi.txt @@ -0,0 +1,17 @@ +# +#attr:Plc_status:0:state:0:plc_state:check if low level server state = ON +# +attr:ValveStat:0:Stat_image:14.0:BSH_DIPROI_OPN:Beam stopper sicuramente aperto +attr:ValveStat:1:Stat_image:14.1:BSH_DIPROI_CLD:Beam stopper sicuramente chiuso +attr:ValveStat:2:Stat_image:0.0:spare:spare +attr:ValveStat:3:Stat_image:14.5:BSH_DIPROI_ERR_SW:TODO(OPERATION) +attr:ValveStat:4:Stat_image:0.0:spare:spare +attr:ValveStat:5:Stat_image:28.0:BSH_DIPROI_ERR_OPN:TODO(ERR OPEN) +attr:ValveStat:6:Stat_image:28.1:BSH_DIPROI_ERR_CLD:TODO(ERR CLOSE) +attr:ValveStat:7:Stat_image:28.4:BSH_DIPROI_OK_CONT:TODO(MEMCONT) +# +attr:AbiGroup:0:Stat_image:14.7:ABI_BSH_DIPROI:Abilitazione apertura beam stopper +# +cmd:open:Send_cmd:102:24.0 +cmd:close:Send_cmd:102:26.0 +# \ No newline at end of file diff --git a/accessconf_bsh_eehg.txt b/accessconf_bsh_eehg.txt new file mode 100644 index 0000000000000000000000000000000000000000..638ed5e6f22a0bc663b353b211983937df321f46 --- /dev/null +++ b/accessconf_bsh_eehg.txt @@ -0,0 +1,212 @@ +# +# Resource backup , created Fri Apr 20 15:32:38 CEST 2018 +# + +#--------------------------------------------------------- +# SERVER accessconf-srv/bsh_eehg, AccessConf device declaration +#--------------------------------------------------------- + +accessconf-srv/bsh_eehg/DEVICE/AccessConf: "slu/interlock/bsh_eehg.01",\ + "slu/interlock/sh_eehg.01" + + +# --- slu/interlock/bsh_eehg.01 properties + +slu/interlock/bsh_eehg.01->Attr_config_file: "" +slu/interlock/bsh_eehg.01->Attr_config_prop: #,\ + "#attr:Plc_status:0:state:0:plc_state:check if low level server state = ON",\ + #,\ + "attr:ValveStat:0:Stat_image:92.0:BSH_EEHG_OPN:Beam stopper sicuramente aperto",\ + "attr:ValveStat:1:Stat_image:92.4:BSH_EEHG_CLD:Beam stopper sicuramente chiuso",\ + attr:ValveStat:2:Stat_image:0.0:spare:spare,\ + attr:ValveStat:3:Stat_image:0.0:spare:TODO(CUTOFF),\ + attr:ValveStat:4:Stat_image:0.0:spare:spare,\ + "attr:ValveStat:5:Stat_image:157.0:ERR_BSH_EEHG_OPN:Controllo Hardware ingresso fail safe",\ + "attr:ValveStat:6:Stat_image:157.4:ERR_BSH_EEHG_CLD:Controllo Hardware ingresso fail safe",\ + "attr:ValveStat:7:Stat_image:156.6:ERR_BSH_EEHG_INTCK_ABI:Controllo Hardware ingresso fail safe",\ + "attr:ValveStat:8:Stat_image:36.7:BSH_EEHG_OK_CONT:controllo incollaggio contatti ok",\ + "attr:ValveStat:9:Stat_image:36.6:BSH_EEHG_NO_ERR_OPN:controllo errore in apertura ok",\ + "attr:ValveStat:10:Stat_image:36.5:BSH_EEHG_NO_ERR_CLD:controllo errore in chiusura ok",\ + #,\ + "attr:Errors:5:Stat_image:157.0:ERR_BSH_EEHG_OPN:Controllo Hardware ingresso fail safe",\ + "attr:Errors:6:Stat_image:157.4:ERR_BSH_EEHG_CLD:Controllo Hardware ingresso fail safe",\ + "attr:Errors:7:Stat_image:156.6:ERR_BSH_EEHG_INTCK_ABI:Controllo Hardware ingresso fail safe",\ + "attr:Errors:8:Stat_image:36.7:BSH_EEHG_OK_CONT:controllo incollaggio contatti ok",\ + "attr:Errors:9:Stat_image:36.6:BSH_EEHG_NO_ERR_OPN:controllo errore in apertura ok",\ + "attr:Errors:10:Stat_image:36.5:BSH_EEHG_NO_ERR_CLD:controllo errore in chiusura ok",\ + #,\ + "attr:AbiGroup:0:Stat_image:13.6:BSH_EEHG_ABI:beam shutter EEHG abilitato da Accessi Laser",\ + "attr:AbiGroup:1:Stat_image:94.6:BSH_EEHG_INTCK_ABI:beam shutter EEHG abilitato da INTCK",\ + #,\ + cmd:open:Send_cmd:102:72.0,\ + cmd:close:Send_cmd:102:74.0,\ + # +slu/interlock/bsh_eehg.01->Low_level_srv: "slu/interlock/plc_slu.01" +slu/interlock/bsh_eehg.01->__SubDevices: "slu/interlock/plc_slu.01" + +# --- slu/interlock/bsh_eehg.01 attribute properties + +slu/interlock/bsh_eehg.01/AbiGroup->comments: "13.6 - beam shutter EEHG abilitato da Accessi Laser",\ + "94.6 - beam shutter EEHG abilitato da INTCK" +slu/interlock/bsh_eehg.01/AbiGroup->labels: BSH_EEHG_ABI,\ + BSH_EEHG_INTCK_ABI +slu/interlock/bsh_eehg.01/AbiGroup->positions: "slu/interlock/plc_slu.01/Stat_image[110]",\ + "slu/interlock/plc_slu.01/Stat_image[758]" +slu/interlock/bsh_eehg.01/Errors->comments: "157.0 - Controllo Hardware ingresso fail safe",\ + "157.4 - Controllo Hardware ingresso fail safe",\ + "156.6 - Controllo Hardware ingresso fail safe",\ + "36.7 - controllo incollaggio contatti ok",\ + "36.6 - controllo errore in apertura ok",\ + "36.5 - controllo errore in chiusura ok" +slu/interlock/bsh_eehg.01/Errors->labels: ERR_BSH_EEHG_OPN,\ + ERR_BSH_EEHG_CLD,\ + ERR_BSH_EEHG_INTCK_ABI,\ + BSH_EEHG_OK_CONT,\ + BSH_EEHG_NO_ERR_OPN,\ + BSH_EEHG_NO_ERR_CLD +slu/interlock/bsh_eehg.01/Errors->positions: "slu/interlock/plc_slu.01/Stat_image[1256]",\ + "slu/interlock/plc_slu.01/Stat_image[1260]",\ + "slu/interlock/plc_slu.01/Stat_image[1254]",\ + "slu/interlock/plc_slu.01/Stat_image[295]",\ + "slu/interlock/plc_slu.01/Stat_image[294]",\ + "slu/interlock/plc_slu.01/Stat_image[293]" +slu/interlock/bsh_eehg.01/ValveStat->comments: "92.0 - Beam stopper sicuramente aperto",\ + "92.4 - Beam stopper sicuramente chiuso",\ + "0.0 - spare",\ + "0.0 - TODO(CUTOFF)",\ + "0.0 - spare",\ + "157.0 - Controllo Hardware ingresso fail safe",\ + "157.4 - Controllo Hardware ingresso fail safe",\ + "156.6 - Controllo Hardware ingresso fail safe",\ + "36.7 - controllo incollaggio contatti ok",\ + "36.6 - controllo errore in apertura ok",\ + "36.5 - controllo errore in chiusura ok" +slu/interlock/bsh_eehg.01/ValveStat->labels: BSH_EEHG_OPN,\ + BSH_EEHG_CLD,\ + spare,\ + spare,\ + spare,\ + ERR_BSH_EEHG_OPN,\ + ERR_BSH_EEHG_CLD,\ + ERR_BSH_EEHG_INTCK_ABI,\ + BSH_EEHG_OK_CONT,\ + BSH_EEHG_NO_ERR_OPN,\ + BSH_EEHG_NO_ERR_CLD +slu/interlock/bsh_eehg.01/ValveStat->positions: "slu/interlock/plc_slu.01/Stat_image[736]",\ + "slu/interlock/plc_slu.01/Stat_image[740]",\ + "slu/interlock/plc_slu.01/Stat_image[0]",\ + "slu/interlock/plc_slu.01/Stat_image[0]",\ + "slu/interlock/plc_slu.01/Stat_image[0]",\ + "slu/interlock/plc_slu.01/Stat_image[1256]",\ + "slu/interlock/plc_slu.01/Stat_image[1260]",\ + "slu/interlock/plc_slu.01/Stat_image[1254]",\ + "slu/interlock/plc_slu.01/Stat_image[295]",\ + "slu/interlock/plc_slu.01/Stat_image[294]",\ + "slu/interlock/plc_slu.01/Stat_image[293]" + +# --- slu/interlock/sh_eehg.01 properties + +slu/interlock/sh_eehg.01->Attr_config_file: "" +slu/interlock/sh_eehg.01->Attr_config_prop: #,\ + "#attr:Plc_status:0:state:0:plc_state:check if low level server state = ON",\ + #,\ + "attr:ValveStat:0:Stat_image:82.0:SH_EEHG_OPN:Beam stopper sicuramente aperto",\ + "attr:ValveStat:1:Stat_image:82.4:SH_EEHG_CLD:Beam stopper sicuramente chiuso",\ + attr:ValveStat:2:Stat_image:0.0:spare:spare,\ + attr:ValveStat:3:Stat_image:0.0:spare:TODO(CUTOFF),\ + attr:ValveStat:4:Stat_image:0.0:spare:spare,\ + "attr:ValveStat:5:Stat_image:158.0:ERR_SH_EEHG_OPN:Controllo Hardware ingresso fail safe",\ + "attr:ValveStat:6:Stat_image:158.3:ERR_SH_EEHG_CLD:Controllo Hardware ingresso fail safe",\ + attr:ValveStat:7:Stat_image:0.0:spare:spare,\ + "attr:ValveStat:8:Stat_image:37.7:SH_EEHG_OK_CONT:controllo incollaggio contatti ok",\ + "attr:ValveStat:9:Stat_image:37.6:SH_EEHG_NO_ERR_OPN:controllo errore in apertura ok",\ + "attr:ValveStat:10:Stat_image:37.5:SH_EEHG_NO_ERR_CLD:controllo errore in chiusura ok",\ + #,\ + "attr:Errors:0:Stat_image:158.0:ERR_SH_EEHG_OPN:Controllo Hardware ingresso fail safe",\ + "attr:Errors:1:Stat_image:158.3:ERR_SH_EEHG_CLD:Controllo Hardware ingresso fail safe",\ + "attr:Errors:2:Stat_image:37.7:SH_EEHG_OK_CONT:controllo incollaggio contatti ok",\ + "attr:Errors:3:Stat_image:37.6:SH_EEHG_NO_ERR_OPN:controllo errore in apertura ok",\ + "attr:Errors:4:Stat_image:37.5:SH_EEHG_NO_ERR_CLD:controllo errore in chiusura ok",\ + #,\ + "attr:AbiGroup:0:Stat_image:14.6:SH_EEHG_ABI:beam shutter (VLV) EEHG abilitato da Accessi Laser",\ + attr:AbiGroup:1:Stat_image:0.0:spare:spare,\ + #,\ + cmd:open:Send_cmd:102:76.0,\ + cmd:close:Send_cmd:102:78.0,\ + # +slu/interlock/sh_eehg.01->Low_level_srv: "slu/interlock/plc_slu.01" +slu/interlock/sh_eehg.01->__SubDevices: "slu/interlock/plc_slu.01",\ + "dserver/plcslu-srv/slu" + +# --- slu/interlock/sh_eehg.01 attribute properties + +slu/interlock/sh_eehg.01/AbiGroup->comments: "14.6 - beam shutter (VLV) EEHG abilitato da Accessi Laser",\ + "0.0 - spare" +slu/interlock/sh_eehg.01/AbiGroup->labels: SH_EEHG_ABI,\ + spare +slu/interlock/sh_eehg.01/AbiGroup->positions: "slu/interlock/plc_slu.01/Stat_image[118]",\ + "slu/interlock/plc_slu.01/Stat_image[0]" +slu/interlock/sh_eehg.01/Errors->comments: "158.0 - Controllo Hardware ingresso fail safe",\ + "158.3 - Controllo Hardware ingresso fail safe",\ + "37.7 - controllo incollaggio contatti ok",\ + "37.6 - controllo errore in apertura ok",\ + "37.5 - controllo errore in chiusura ok" +slu/interlock/sh_eehg.01/Errors->labels: ERR_SH_EEHG_OPN,\ + ERR_SH_EEHG_CLD,\ + SH_EEHG_OK_CONT,\ + SH_EEHG_NO_ERR_OPN,\ + SH_EEHG_NO_ERR_CLD +slu/interlock/sh_eehg.01/Errors->positions: "slu/interlock/plc_slu.01/Stat_image[1264]",\ + "slu/interlock/plc_slu.01/Stat_image[1267]",\ + "slu/interlock/plc_slu.01/Stat_image[303]",\ + "slu/interlock/plc_slu.01/Stat_image[302]",\ + "slu/interlock/plc_slu.01/Stat_image[301]" +slu/interlock/sh_eehg.01/ValveStat->comments: "82.0 - Beam stopper sicuramente aperto",\ + "82.4 - Beam stopper sicuramente chiuso",\ + "0.0 - spare",\ + "0.0 - TODO(CUTOFF)",\ + "0.0 - spare",\ + "158.0 - Controllo Hardware ingresso fail safe",\ + "158.3 - Controllo Hardware ingresso fail safe",\ + "0.0 - spare",\ + "37.7 - controllo incollaggio contatti ok",\ + "37.6 - controllo errore in apertura ok",\ + "37.5 - controllo errore in chiusura ok" +slu/interlock/sh_eehg.01/ValveStat->labels: SH_EEHG_OPN,\ + SH_EEHG_CLD,\ + spare,\ + spare,\ + spare,\ + ERR_SH_EEHG_OPN,\ + ERR_SH_EEHG_CLD,\ + spare,\ + SH_EEHG_OK_CONT,\ + SH_EEHG_NO_ERR_OPN,\ + SH_EEHG_NO_ERR_CLD +slu/interlock/sh_eehg.01/ValveStat->positions: "slu/interlock/plc_slu.01/Stat_image[656]",\ + "slu/interlock/plc_slu.01/Stat_image[660]",\ + "slu/interlock/plc_slu.01/Stat_image[0]",\ + "slu/interlock/plc_slu.01/Stat_image[0]",\ + "slu/interlock/plc_slu.01/Stat_image[0]",\ + "slu/interlock/plc_slu.01/Stat_image[1264]",\ + "slu/interlock/plc_slu.01/Stat_image[1267]",\ + "slu/interlock/plc_slu.01/Stat_image[0]",\ + "slu/interlock/plc_slu.01/Stat_image[303]",\ + "slu/interlock/plc_slu.01/Stat_image[302]",\ + "slu/interlock/plc_slu.01/Stat_image[301]" + +#--------------------------------------------------------- +# CLASS AccessConf properties +#--------------------------------------------------------- + +CLASS/AccessConf->cvs_location: "/home/cvsadm/cvsroot/fermi/servers/accessconf/src/" +CLASS/AccessConf->cvs_tag: release_08 +CLASS/AccessConf->Description: "" +CLASS/AccessConf->doc_url: "http://www.esrf.eu/computing/cs/tango/tango_doc/ds_doc/" +CLASS/AccessConf->InheritedFrom: Device_Impl +CLASS/AccessConf->ProjectTitle: "Storage Ring Access" + + +# --- dserver/accessconf-srv/bsh_eehg properties + +dserver/accessconf-srv/bsh_eehg->__SubDevices: "tmp/log/srv-admin-srf@22" diff --git a/accessconf_bsh_fel01.txt b/accessconf_bsh_fel01.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6e44845004214851e3a14c306fda218eb4cde2e --- /dev/null +++ b/accessconf_bsh_fel01.txt @@ -0,0 +1,22 @@ +# +#attr:Plc_status:0:state:0:plc_state:check if low level server state = ON +# +attr:ValveStat:0:Stat_image:94.0:BSH_FEL1_OPN:Beam stopper sicuramente aperto +attr:ValveStat:1:Stat_image:94.1:BSH_FEL1_CLD:Beam stopper sicuramente chiuso +attr:ValveStat:2:Stat_image:0.0:spare:spare +attr:ValveStat:3:Stat_image:0.0:spare:TODO(CUTOFF) +attr:ValveStat:4:Stat_image:0.0:spare:spare +attr:ValveStat:5:Stat_image:156.0:ERR_BSH_FEL1_OPN:Controllo Hardware ingresso fail safe +attr:ValveStat:6:Stat_image:156.1:ERR_BSH_FEL1_CLD:Controllo Hardware ingresso fail safe +attr:ValveStat:7:Stat_image:156.4:ERR_BSH_FEL1_INTCK_ABI:Controllo Hardware ingresso fail safe +attr:ValveStat:8:Stat_image:39.4:BSH_FEL1_OK_CONT:controllo incollaggio contatti ok +attr:ValveStat:9:Stat_image:38.6:BSH_FEL1_NO_ERR_CLD:controllo errore in chiusura ok +attr:ValveStat:10:Stat_image:38.7:BSH_FEL1_NO_ERR_OPN:controllo errore in apertura ok + +# +attr:AbiGroup:0:Stat_image:94.4:BSH_FEL1_INTCK_ABI:beam shutter FEL 1 abilitato da INTCK +attr:AbiGroup:1:Stat_image:12.6:BSH_FEL1_ABI:beam shutter FEL 1 abilitato da Accessi Laser +# +cmd:open:Send_cmd:102:80.0 +cmd:close:Send_cmd:102:82.0 +# \ No newline at end of file diff --git a/accessconf_bsh_fel02.txt b/accessconf_bsh_fel02.txt new file mode 100644 index 0000000000000000000000000000000000000000..d248dc400529eb442df465c1e356eb4eed0d6966 --- /dev/null +++ b/accessconf_bsh_fel02.txt @@ -0,0 +1,22 @@ +# +#attr:Plc_status:0:state:0:plc_state:check if low level server state = ON +# +attr:ValveStat:0:Stat_image:94.2:BSH_FEL2_OPN:Beam stopper sicuramente aperto +attr:ValveStat:1:Stat_image:94.3:BSH_FEL2_CLD:Beam stopper sicuramente chiuso +attr:ValveStat:2:Stat_image:0.0:spare:spare +attr:ValveStat:3:Stat_image:0.0:spare:TODO(CUTOFF) +attr:ValveStat:4:Stat_image:0.0:spare:spare +attr:ValveStat:5:Stat_image:156.2:ERR_BSH_FEL2_OPN:Controllo Hardware ingresso fail safe +attr:ValveStat:6:Stat_image:156.3:ERR_BSH_FEL2_CLD:Controllo Hardware ingresso fail safe +attr:ValveStat:7:Stat_image:156.5:ERR_BSH_FEL2_INTCK_ABI:Controllo Hardware ingresso fail safe +attr:ValveStat:8:Stat_image:39.5:BSH_FEL2_OK_CONT:controllo incollaggio contatti ok +attr:ValveStat:9:Stat_image:39.6:BSH_FEL2_NO_ERR_CLD:controllo errore in chiusura ok +attr:ValveStat:10:Stat_image:39.7:BSH_FEL2_NO_ERR_OPN:controllo errore in apertura ok + +# +attr:AbiGroup:0:Stat_image:94.5:BSH_FEL2_INTCK_ABI:beam shutter FEL 2 abilitato da INTCK +attr:AbiGroup:1:Stat_image:13.1:BSH_FEL2_ABI:beam shutter FEL 2 abilitato da Accessi Laser +# +cmd:open:Send_cmd:102:84.0 +cmd:close:Send_cmd:102:86.0 +# \ No newline at end of file diff --git a/accessconf_bsh_ldm.txt b/accessconf_bsh_ldm.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3a0392831e239d14c189385790b42a6ffb165ff --- /dev/null +++ b/accessconf_bsh_ldm.txt @@ -0,0 +1,17 @@ +# +#attr:Plc_status:0:state:0:plc_state:check if low level server state = ON +# +attr:ValveStat:0:Stat_image:15.0:BSH_LDM_OPN:Beam stopper sicuramente aperto +attr:ValveStat:1:Stat_image:15.1:BSH_LDM_CLD:Beam stopper sicuramente chiuso +attr:ValveStat:2:Stat_image:0.0:spare:spare +attr:ValveStat:3:Stat_image:15.5:BSH_LDM_ERR_SW:TODO(OPERATION) +attr:ValveStat:4:Stat_image:0.0:spare:spare +attr:ValveStat:5:Stat_image:29.0:BSH_LDM_ERR_OPN1:TODO(ERR OPEN) +attr:ValveStat:6:Stat_image:29.1:BSH_LDM_ERR_CLD1:TODO(ERR CLOSE) +attr:ValveStat:7:Stat_image:29.4:BSH_LDM_OK_CONT1:TODO(MEMCONT) +# +attr:AbiGroup:0:Stat_image:15.7:ABI_BSH_LDM:Abilitazione apertura beam stopper +# +cmd:open:Send_cmd:102:28.0 +cmd:close:Send_cmd:102:30.0 +# \ No newline at end of file diff --git a/accessconf_bsh_lsu.txt b/accessconf_bsh_lsu.txt new file mode 100644 index 0000000000000000000000000000000000000000..13ea6cee0f391540fa8baf7c3a9e453ae02a7dba --- /dev/null +++ b/accessconf_bsh_lsu.txt @@ -0,0 +1,17 @@ +# +#attr:Plc_status:0:state:0:plc_state:check if low level server state = ON +# +attr:ValveStat:0:Stat_image:12.0:BSH_SL_OPN:Beam stopper sicuramente aperto +attr:ValveStat:1:Stat_image:12.1:BSH_SL_CLD:Beam stopper sicuramente chiuso +attr:ValveStat:2:Stat_image:0.0:spare:spare +attr:ValveStat:3:Stat_image:12.5:BSH_SL_ERR_SW:TODO(OPERATION) +attr:ValveStat:4:Stat_image:0.0:spare:spare +attr:ValveStat:5:Stat_image:26.0:BSH_SL_ERR_OPN:TODO(ERR OPEN) +attr:ValveStat:6:Stat_image:26.1:BSH_SL_ERR_CLD:TODO(ERR CLOSE) +attr:ValveStat:7:Stat_image:26.4:BSH_OK_CONT:TODO(MEMCONT) +# +attr:AbiGroup:0:Stat_image:12.7:ABI_BSH_SL:Abilitazione apertura beam stopper +# +cmd:open:Send_cmd:102:16.0 +cmd:close:Send_cmd:102:18.0 +# \ No newline at end of file diff --git a/accessconf_bsh_slu.txt b/accessconf_bsh_slu.txt new file mode 100644 index 0000000000000000000000000000000000000000..13ea6cee0f391540fa8baf7c3a9e453ae02a7dba --- /dev/null +++ b/accessconf_bsh_slu.txt @@ -0,0 +1,17 @@ +# +#attr:Plc_status:0:state:0:plc_state:check if low level server state = ON +# +attr:ValveStat:0:Stat_image:12.0:BSH_SL_OPN:Beam stopper sicuramente aperto +attr:ValveStat:1:Stat_image:12.1:BSH_SL_CLD:Beam stopper sicuramente chiuso +attr:ValveStat:2:Stat_image:0.0:spare:spare +attr:ValveStat:3:Stat_image:12.5:BSH_SL_ERR_SW:TODO(OPERATION) +attr:ValveStat:4:Stat_image:0.0:spare:spare +attr:ValveStat:5:Stat_image:26.0:BSH_SL_ERR_OPN:TODO(ERR OPEN) +attr:ValveStat:6:Stat_image:26.1:BSH_SL_ERR_CLD:TODO(ERR CLOSE) +attr:ValveStat:7:Stat_image:26.4:BSH_OK_CONT:TODO(MEMCONT) +# +attr:AbiGroup:0:Stat_image:12.7:ABI_BSH_SL:Abilitazione apertura beam stopper +# +cmd:open:Send_cmd:102:16.0 +cmd:close:Send_cmd:102:18.0 +# \ No newline at end of file diff --git a/accessconf_bsh_timex.txt b/accessconf_bsh_timex.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ce2778377a4388c310bdf8c894b6225a5ba0a40 --- /dev/null +++ b/accessconf_bsh_timex.txt @@ -0,0 +1,17 @@ +# +#attr:Plc_status:0:state:0:plc_state:check if low level server state = ON +# +attr:ValveStat:0:Stat_image:13.0:BSH_TIMEX_OPN:Beam stopper sicuramente aperto +attr:ValveStat:1:Stat_image:13.1:BSH_TIMEX_CLD:Beam stopper sicuramente chiuso +attr:ValveStat:2:Stat_image:0.0:spare:spare +attr:ValveStat:3:Stat_image:13.5:BSH_TIMEX_ERR_SW:TODO(OPERATION) +attr:ValveStat:4:Stat_image:0.0:spare:spare +attr:ValveStat:5:Stat_image:27.0:BSH_TIMEX_ERR_OPN:TODO(ERR OPEN) +attr:ValveStat:6:Stat_image:27.1:BSH_TIMEX_ERR_CLD:TODO(ERR CLOSE) +attr:ValveStat:7:Stat_image:27.4:BSH_TIMEX_OK_CONT:TODO(MEMCONT) +# +attr:AbiGroup:0:Stat_image:13.7:ABI_BSH_TIMEX:Abilitazione apertura beam stopper +# +cmd:open:Send_cmd:102:20.0 +cmd:close:Send_cmd:102:22.0 +# \ No newline at end of file diff --git a/accessconf_laser_pss.txt b/accessconf_laser_pss.txt new file mode 100644 index 0000000000000000000000000000000000000000..5db195c960096610c89d9369e3b05346085f4d73 --- /dev/null +++ b/accessconf_laser_pss.txt @@ -0,0 +1,355 @@ +# +attr:Cover:0:Stat_image:54.1:CVR1_LSU_UH_CLD:CoVeR +attr:Cover:1:Stat_image:110.0:CVR_MBX1_MBX2_EOS2_CLD: +attr:Cover:2:Stat_image:58.0:CVR2_LSU_UH_CLD:I46 +attr:Cover:3:Stat_image:110.1:CVR_M21_M22_M23_EOS2_CLD: +attr:Cover:4:Stat_image:84.0:CVR_LSU_EH_1_CLD: I120.0 +attr:Cover:5:Stat_image:84.1:CVR_LSU_EH_2_CLD: +attr:Cover:6:Stat_image:103.1:BRD_CVR_CLD:Timer breadboard cover closed +attr:Cover:7:Stat_image:78.0:CVR_OUT_BRD_TIMER_CLD:coperchio breadboard fuori da mini hutch chiuso +attr:Cover:8:Stat_image:114.0:CVR1_BRD_MAG_CLD:Cover 1 breadboard magnedyn close +attr:Cover:9:Stat_image:112.0:CVR2_BRD_MAG_CLD:cover 2 breadboard magnedyn close +attr:Cover:10:Stat_image:103.2:DR_TIMER_MINI_HUTCH_CLD:porta minihutch chiusa +# EEHG +#attr:Cover_EEHG:0:Stat_image:82.1:CVR_EEHG_CLD:coperchio laser EEHG chiuso +# +attr:Door:0:Stat_image:72.1:DR_LSU_EH_01_CLD: DooR 1 LaserSeedUtenti in EH Chiusa +attr:Door:1:Stat_image:72.2:DR_LSU_EH_02_CLD: DooR 2 LaserSeedUtenti in EH Chiusa +attr:Door:2:Stat_image:80.1:DR_LSU_EH_03_CLD: +attr:Door:3:Stat_image:76.0:DR_LSU_EH_04_CLD:I74.0 +attr:Door:4:Stat_image:76.1:DR_LSU_EH_05_CLD: +attr:Door:5:Stat_image:106.0:DR_LSU_EH_06_CLD:I 200.0 +attr:Door:6:Stat_image:106.1:DR_LSU_EH_07_CLD: +attr:Door:7:Stat_image:106.2:DR_LSU_EH_08_CLD: +attr:Door:8:Stat_image:116.1:DR1_MAGNEDYN_CLD:porta 1 magnedyn chiusa +attr:Door:9:Stat_image:116.2:DR2_MAGNEDYN_CLD:porta 2 magnedyn chiusa +attr:Door:10:Stat_image:118.4:ACK_BDG_MAG:badge riconosciuto in porta magnedyn +attr:Door:11:Stat_image:119.0:PUL_OPN_DR2_MAG_IN_OUT:pulsante apriporta 2 azionato +attr:Door:12:Stat_image:103.2:DR_TIMER_MINI_HUTCH_CLD:porta mini hutch closed +attr:Door:13:Stat_image:22.3:EH_DOOR_CLOSED:tutte le porte di EH chiuse (quelle entro il muro, quindi porte Magnedyn escluse ) +# +attr:EmergencyButton:0:Stat_image:42.2:EB_LSU_SLCR_01:EmergencyButton +attr:EmergencyButton:1:Stat_image:44.0:EB_LSU_UTDR_01:I12.0 +attr:EmergencyButton:2:Stat_image:54.0:EB_LSU_UH_01:I40.0 +attr:EmergencyButton:3:Stat_image:80.0:EB_LSU_EH_01:I114.0 +attr:EmergencyButton:4:Stat_image:86.2:EB_BSH_TIMEX: +attr:EmergencyButton:5:Stat_image:88.2:EB_BSH_DIPROI: +attr:EmergencyButton:6:Stat_image:90.2:EB_BSH_LDM: +attr:EmergencyButton:7:Stat_image:102.2:EB_BSH_TIMER: +attr:EmergencyButton:8:Stat_image:108.2:NO_PUL_EME_EOS2: +attr:EmergencyButton:9:Stat_image:114.2:EB_BSH_MAGNEDYN:pulsante di emergenza (non premuto) +# EEHG +#attr:EmergencyButton_EEHG:0:Stat_image:38.2:NO_PUL_EME_EEHG:Pulsante emergenza EEHG non premuto +# +attr:PressureGauge:0:Stat_image:44.1:PG_LSU_UTDR_01:PressureGauge_LaserSeedUtenti_UTDR +attr:PressureGauge:1:Stat_image:44.5:PG_LSU_UTDR_02: +attr:PressureGauge:2:Stat_image:54.3:PG_LSU_UH_01: +attr:PressureGauge:3:Stat_image:54.7:PG_LSU_UH_02: +attr:PressureGauge:4:Stat_image:84.3:PG_LSU_EH_01: +attr:PressureGauge:5:Stat_image:84.7:PG_LSU_EH_02: +attr:PressureGauge:6:Stat_image:80.2:PG_LSU_EH_03: +attr:PressureGauge:7:Stat_image:80.6:PG_LSU_EH_04: +# +attr:BSH_Memory:0:Stat_image:32.0:M_BSH_LSU_CMD_SLCR:Memoria comando Beam Shutter LaseSeed Utenti preso da SLCR +attr:BSH_Memory:1:Stat_image:32.1:M_BSH_LSU_CMD_UTDR: +attr:BSH_Memory:2:Stat_image:32.2:M_BSH_LSU_CMD_UH: +attr:BSH_Memory:3:Stat_image:32.3:M_BSH_LSU_CMD_EH: +attr:BSH_Memory:4:Stat_image:32.4:M_BSH_LSU_CMD_TIMEX: +attr:BSH_Memory:5:Stat_image:32.5:M_BSH_LSU_CMD_DIPROI: +attr:BSH_Memory:6:Stat_image:32.6:M_BSH_LSU_CMD_LDM: +attr:BSH_Memory:7:Stat_image:32.7:M_BSH_LSU_CMD_TIMER: +attr:BSH_Memory:8:Stat_image:33.0:M_BSH_LSU_CMD_MAGNEDIN:comando da pulsantiera operativo (control) +# +attr:BSH_Abi:0:Stat_image:12.7:ABI_BSH_SLU:Abilitazione apertura beam shutter WSF +attr:BSH_Abi:1:Stat_image:13.7:ABI_BSH_TIMEX:Abilitazione apertura beam shutter WSF +attr:BSH_Abi:2:Stat_image:14.7:ABI_BSH_DIPROI:Abilitazione apertura beam shutter WSF +attr:BSH_Abi:3:Stat_image:15.7:ABI_BSH_LDM:Abilitazione apertura beam shutter WSF +attr:BSH_Abi:4:Stat_image:16.7:ABI_BSH_TIMER apertura beam shutter WSF +attr:BSH_Abi:5:Stat_image:17.7:ABI_BSH_BRD_TIMER apertura beam shutter WSF +attr:BSH_Abi:6:Stat_image:86.3:ABI_BSH_SLU_TIMEX:Linea Timex abilita Shutter Seed laser utenti +attr:BSH_Abi:7:Stat_image:88.3:ABI_BSH_SLU_DIPROI: +attr:BSH_Abi:8:Stat_image:90.3:ABI_BSH_SLU_LDM: +attr:BSH_Abi:9:Stat_image:102.3:ABI_BSH_SLU_TIMER: +attr:BSH_Abi:10:Stat_image:198.1:SOURCE_SHUTTER_ABI: +attr:BSH_Abi:11:Stat_image:114.3:ABI_BSH_SLU_MAGNEDYN:abilitazione all'apertura +attr:BSH_Abi:12:Stat_image:17.6:ABI_BSH_MAGNEDYN:Abilitazione apertura beam shutter magnedyn +attr:BSH_Abi:13:Stat_image:18.7:ABI_BSH_BRD_MAGNEDYN:Abilitazione apertura beam shutter BRD magnedyn +attr:BSH_Abi:14:Stat_image:12.6:BSH_FEL1_ABI:Abilitazione apertura beam shutter FEL1 da accessi laser +attr:BSH_Abi:15:Stat_image:94.4:BSH_FEL1_INTCK_ABI:beam shutter FEL 1 abilitato da INTCK +attr:BSH_Abi:16:Stat_image:13.1:BSH_FEL2_ABI:Abilitazione apertura beam shutter FEL2 da accessi laser +attr:BSH_Abi:17:Stat_image:94.5:BSH_FEL1_INTCK_ABI:beam shutter FEL 2 abilitato da INTCK +# EEHG +#attr:BSH_Abi_EEHG:0:Stat_image:13.6:BSH_EEHG_ABI:beam shutter EEHG abilitato da Accessi Laser +#attr:BSH_Abi_EEHG:1:Stat_image:94.6:BSH_EEHG_INTCK_ABI:beam shutter EEHG abilitato da INTCK +#attr:BSH_Abi_EEHG:2:Stat_image:14.6:SH_EEHG_ABI:beam shutter (VLV) EEHG abilitato da Accessi Laser +# +attr:Key:0:Stat_image:42.3:KEY_LASER_ON_OLD:Chiave laser ON bit a 1 +attr:Key:1:Stat_image:86.5:KEY_TIMEX_IN:Chiave Timex inserita +attr:Key:2:Stat_image:88.5:KEY_DIPROI_IN: +attr:Key:3:Stat_image:90.5:KEY_LDM_IN: +attr:Key:4:Stat_image:102.7:KEY_BRD_TIMER_MAINT:setta Timer in maintenance +attr:Key:5:Stat_image:102.5:KEY_BRD_TIMER_IN: +attr:Key:6:Stat_image:86.1:KEY_MASTER_IN_TIMEX:Chiave master abilita Timex +attr:Key:7:Stat_image:88.1:KEY_MASTER_IN_DIPROI: +attr:Key:8:Stat_image:90.1:KEY_MASTER_IN_LDM: +attr:Key:9:Stat_image:102.1:KEY_MASTER_IN_TIMER: +attr:Key:10:Stat_image:23.2:LASER_OFF: +attr:Key:11:Stat_image:23.3:LASER_ON: +attr:Key:12:Stat_image:23.4:LASER_MAINT:SLR, UTDR, UH in laser mantainance +attr:Key:13:Stat_image:23.5:LASER_MAINT_EH:EH in laser mantainance +attr:Key:14:Stat_image:114.1:KEY_MASTER_IN_MAGNEDYN:chiave master inserita +attr:Key:15:Stat_image:114.5:KEY_MAGNEDYN_IN:chiave magnedyn inserita +attr:Key:16:Stat_image:114.7:KEY_MAG_BRD_MAINTENANCE:chiave breadboard magnedyn inserita +attr:Key:17:Stat_image:94.7:KEY_FEL_UH_MAINTENANCE:Chiave in UH richiede Laser maintenance +attr:Key:18:Stat_image:38.5:LASER_MAINT_TIMER:timer in laser maintenance +attr:Key:19:Stat_image:39.2:LASER_MAINT_MAG:magnedyn in laser maintenance +attr:Key:20:Stat_image:24.0:LASER_OFF_EH: +attr:Key:21:Stat_image:24.1:LASER_ON_EH: +#EEHG +#attr:Key_EEHG:0:Stat_image:82.3:KEY_EEHG_IN:chiave bypass coperchi laser EEHG inserita +#attr:Key_EEHG:1:Stat_image:37.2:LASER_MAINT_EEHG:EEHG in laser maintenance +# +attr:BSH:0:Stat_image:40.0:BSH_SLU_SLCR_CLD:BeamSHutter_SeedLaserUtenti_SeedLaserControllRoom_Chiuso +attr:BSH:1:Stat_image:40.1:BSH_SLU_SLCR_OPN: +attr:BSH:2:Stat_image:40.6:BSH_SOURCE_SLCR_CLD:BeamSHutter_Sorgente_SeedLaserControllRoom_Chiuso +attr:BSH:3:Stat_image:40.7:BSH_SOURCE_SLCR_OPN: +attr:BSH:4:Stat_image:50.2:BSH_LSU_SLCR_PRESS:Pressione aria compressa +attr:BSH:5:Stat_image:86.0:BSH_LSU_TIMEX_CLD: +attr:BSH:6:Stat_image:86.2:EB_BSH_TIMEX: +attr:BSH:7:Stat_image:86.4:BSH_LSU_TIMEX_OPN: +attr:BSH:8:Stat_image:88.0:BSH_LSU_DIPROI_CLD: +attr:BSH:9:Stat_image:88.2:EB_BSH_DIPROI: +attr:BSH:10:Stat_image:88.4:BSH_LSU_DIPROI_OPN: +attr:BSH:11:Stat_image:90.0:BSH_LSU_LDM_CLD:I138.0 +attr:BSH:12:Stat_image:90.2:EB_BSH_LDM: +attr:BSH:13:Stat_image:90.4:BSH_LSU_LDM_OPN: +attr:BSH:14:Stat_image:102.0:BSH_LSU_TIMER_CLD: +attr:BSH:15:Stat_image:102.2:EB_BSH_TIMER: +attr:BSH:16:Stat_image:102.4:BSH_LSU_TIMER_OPN: +attr:BSH:17:Stat_image:103.0:BSH_BRD_TIMER_CLD: +attr:BSH:18:Stat_image:103.4:BSH_BRD_TIMER_OPN: +attr:BSH:19:Stat_image:116.0:BSH_SLU_MAGNEDYN_CLD:shutter magnedyn chiuso +attr:BSH:20:Stat_image:116.3:BSH_SLU_MAGNEDYN_BRD_CLD:shutter breadboard magnedyn chiuso +attr:BSH:21:Stat_image:116.4:BSH_SLU_MAGNEDYN_OPN:shutter magnedyn aperto +attr:BSH:22:Stat_image:116.7:BSH_SLU_MAGNEDYN_BRD_OPN:shutter breadboard magnedyn aperto +attr:BSH:23:Stat_image:118.0:BSH_SLU_MAGNEDYN_OPN_CMD:comando (da pulsantiera) +attr:BSH:24:Stat_image:118.1:BSH_SLU_MAGNEDYN_CLD_CMD:comando (da pulsantiera) +attr:BSH:25:Stat_image:118.2:BSH_MAGNEDYN_OPN_CMD:comando (da pulsantiera) +attr:BSH:26:Stat_image:118.3:BSH_MAGNEDYN_CLD_CMD:comando (da pulsantiera) +attr:BSH:27:Stat_image:118.5:BSH_MAGNEDYN_BRD_OPN_CMD:comando (da pulsantiera) +attr:BSH:28:Stat_image:118.6:BSH_MAGNEDYN_BRD_CLD_CMD:comando (da pulsantiera) +attr:BSH:29:Stat_image:0.0:spare:spare +attr:BSH:30:Stat_image:94.0:BSH_FEL1_OPN:beam shutter FEL 1 aperto +attr:BSH:31:Stat_image:94.1:BSH_FEL1_CLD:beam shutter FEL 1 chiuso +attr:BSH:32:Stat_image:94.2:BSH_FEL2_OPN:beam shutter FEL 2 aperto +attr:BSH:33:Stat_image:94.3:BSH_FEL2_CLD:beam shutter FEL 2 chiuso +# +#attr:BSH_EEHG:0:Stat_image:92.0:BSH_EEHG_OPN:beam shutter EEHG aperto +#attr:BSH_EEHG:1:Stat_image:92.4:BSH_EEHG_CLD:beam shutter EEHG chiuso +#attr:BSH_EEHG:2:Stat_image:82.0:SH_EEHG_OPN:beam shutter (VLV) EEHG aperto +#attr:BSH_EEHG:3:Stat_image:82.4:SH_EEHG_CLD:beam shutter (VLV) EEHG chiuso +# +attr:Errors:0:Stat_image:120.0:ERR_BSH_SLU_SLR_CLD:ERRore_BeamSHutter_SeedLaserUser_SeedLaserRoom_CLoseD +attr:Errors:1:Stat_image:120.1:ERR_BSH_SLU_SLR_OPN: +attr:Errors:2:Stat_image:120.3:ERR_NO_CMD_LSU_SLR: +attr:Errors:3:Stat_image:120.6:ERR_BSH_SOURCE_SLR_CLD: +attr:Errors:4:Stat_image:120.7:ERR_BSH_SOURCE_SLR_OPN: +attr:Errors:5:Stat_image:121.2:ERR_EB_LSU_SLR_01: +attr:Errors:6:Stat_image:121.3:ERR_KEY_LASER_ON: +attr:Errors:7:Stat_image:122.0:ERR_EB_LSU_UTDR_01: +attr:Errors:8:Stat_image:122.1:ERR_PG_LSU_UTDR_01: +attr:Errors:9:Stat_image:122.2:ERR_NO_CMD_LSU_UTDR: +attr:Errors:10:Stat_image:122.5:ERR_PG_LSU_UTDR_02: +attr:Errors:11:Stat_image:124.0:ERR_EB_LSU_UH_01: +attr:Errors:12:Stat_image:124.2:ERR_CVR1_LSU_UH_CLD: +attr:Errors:13:Stat_image:124.2:ERR_NO_CMD_LSU_UH: +attr:Errors:14:Stat_image:124.3:ERR_PG_LSU_UH_01: +attr:Errors:15:Stat_image:124.7:ERR_PG_LSU_UH_02: +attr:Errors:16:Stat_image:125.0:ERR_CVR2_LSU_UH_CLD: +attr:Errors:17:Stat_image:126.1:ERR_DR_LSU_EH_01_CLD: +attr:Errors:18:Stat_image:126.2:ERR_DR_LSU_EH_02_CLD: +attr:Errors:19:Stat_image:127.0:ERR_DR_LSU_EH_04_CLD: +attr:Errors:20:Stat_image:127.1:ERR_DR_LSU_EH_05_CLD: +attr:Errors:21:Stat_image:129.0:ERR_EB_LSU_EH_01: +attr:Errors:22:Stat_image:129.1:ERR_DR_LSU_EH_03_CLD: +attr:Errors:23:Stat_image:130.0:ERR_CVR_LSU_EH_1_CLD: +attr:Errors:24:Stat_image:130.1:ERR_CVR_LSU_EH_2_CLD: +attr:Errors:25:Stat_image:130.2:ERR_NO_CMD_LSU_EH: +attr:Errors:26:Stat_image:130.3:ERR_PG_LSU_EH_01: +attr:Errors:27:Stat_image:130.7:ERR_PG_LSU_EH_02: +attr:Errors:28:Stat_image:131.0:ERR_BSH_LSU_TIMEX_CLD: +attr:Errors:29:Stat_image:131.1:ERR_KEY_MASTER_IN_TIMEX: +attr:Errors:30:Stat_image:131.2:ERR_EB_BSH_TIMEX: +attr:Errors:31:Stat_image:131.3:ERR_ABI_BSH_SLU_TIMEX: +attr:Errors:32:Stat_image:131.4:ERR_BSH_LSU_TIMEX_OPN: +attr:Errors:33:Stat_image:131.5:ERR_KEY_TIMEX_IN: +attr:Errors:34:Stat_image:132.0:ERR_BSH_LSU_DIPROI_CLD: +attr:Errors:35:Stat_image:132.1:ERR_KEY_MASTER_IN_DIPROI: +attr:Errors:36:Stat_image:132.2:ERR_EB_BSH_DIPROI: +attr:Errors:37:Stat_image:132.3:ERR_ABI_BSH_SLU_DIPROI: +attr:Errors:38:Stat_image:132.4:ERR_BSH_LSU_DIPROI_OPN: +attr:Errors:39:Stat_image:132.5:ERR_KEY_DIPROI_IN: +attr:Errors:40:Stat_image:133.0:ERR_BSH_LSU_LDM_CLD: +attr:Errors:41:Stat_image:133.1:ERR_KEY_MASTER_IN_LDM: +attr:Errors:42:Stat_image:133.2:ERR_EB_BSH_LDM: +attr:Errors:43:Stat_image:133.3:ERR_ABI_BSH_SLU_LDM: +attr:Errors:44:Stat_image:133.4:ERR_BSH_LSU_LDM_OPN: +attr:Errors:45:Stat_image:133.5:ERR_KEY_LDM_IN: +attr:Errors:46:Stat_image:136.0:ERR_BSH_LSU_TIMER_CLD: +attr:Errors:47:Stat_image:136.1:ERR_KEY_MASTER_IN_TIMER: +attr:Errors:48:Stat_image:136.2:ERR_EB_BSH_TIMER: +attr:Errors:49:Stat_image:136.3:ERR_ABI_BSH_SLU_TIMER: +attr:Errors:50:Stat_image:136.4:ERR_BSH_LSU_TIMER_OPN: +attr:Errors:51:Stat_image:136.5:ERR_KEY_BRD_TIMER_IN: +attr:Errors:52:Stat_image:136.7:ERR_KEY_TIMER_CHAMBER_IN: +attr:Errors:53:Stat_image:137.0:ERR_BSH_BRD_TIMER_CLD: +attr:Errors:54:Stat_image:137.1:ERR_BRD_CVR_CLD: +attr:Errors:55:Stat_image:137.2:ERR_BRD_SCREEN_CLD: +attr:Errors:56:Stat_image:137.4:ERR_BSH_BRD_TIMER_OPN: +attr:Errors:57:Stat_image:138.0:ERR_BSH_LSU_TMR_OPN_OUT: +attr:Errors:58:Stat_image:138.1:ERR_BSH_BRD_TMR_OPN_OUT: +attr:Errors:59:Stat_image:128.0:ERR_BZDR_EH_01:errore su buzzer +attr:Errors:60:Stat_image:128.1:ERR_ELSER_SLU_EH_01_ON:errore su elettroserratura porta EH 1 +attr:Errors:61:Stat_image:128.2:ERR_ELSER_SLU_EH_02_ON:errore su elettroserratura porta EH 2 +#prossimi sono per pagina generale slu e eos1 +attr:Errors:62:Stat_image:123.0:ERR_BSH_SLU_OPN_CMD_OUT:errore su solenoide BSH SLU +attr:Errors:63:Stat_image:123.1:ERR_SOURCE_SHUTTER_ABI:errore su solenoide BSH SOURCE +#prossimi sono per eos1 e eos2 +attr:Errors:64:Stat_image:123.2:ERR_BSH_EOS2_TUBE_CMD_OU:errore su solenoide BSH EOS2 TUBE +attr:Errors:65:Stat_image:123.3:ERR_BSH_EOS2_SLR_CMD_OUT:errore su solenoide BSH EOS2 SOURCE +attr:Errors:66:Stat_image:120.4:ERR_BSH_EOS2_SLR_CLD:errore su chiusura beam shutter EOS 2 +attr:Errors:67:Stat_image:120.5:ERR_BSH_EOS2_SLR_OPN:errore su apertura beam shutter EOS 2 +attr:Errors:68:Stat_image:121.0:ERR_KEY_EOS1_MASTER:errore su chiave abilitazione master EOS 1 +attr:Errors:69:Stat_image:121.1:ERR_KEY_EOS1_ON:errore su chiave abilitazione EOS 1 +attr:Errors:70:Stat_image:121.4:ERR_KEY_EOS2_MASTER:errore su chiave abilitazione master EOS 2 +attr:Errors:71:Stat_image:121.5:ERR_KEY_EOS2_ON:errore su chiave abilitazione EOS 2 +attr:Errors:72:Stat_image:121.7:ERR_PG_EOS2_UH_01:errore su pressostato EOS2_UH_01 +attr:Errors:73:Stat_image:122.3:ERR_BSH_EOS2_TUBE_OPN:errore su apertura beam shutter EOS 2 TUBE +attr:Errors:74:Stat_image:122.6:ERR_PG_EOS2_UH_02:errore su pressostato EOS2_UH_02 +attr:Errors:75:Stat_image:122.7:ERR_BSH_EOS2_TUBE_CLD:errore su chiusura beam shutter EOS 2 TUBE +attr:Errors:76:Stat_image:144.0:ERR_BSH_EOS1_TABLE_OPN:errore su apertura beam shutter EOS 1 TABLE +attr:Errors:77:Stat_image:144.1:ERR_BSH_EOS1_TABLE_OPN_CMD:errore su comando apertura beam shutter EOS 1 TABLE +attr:Errors:78:Stat_image:144.2:ERR_BSH_EOS1_TUBE_OPN:errore su apertura beam shutter EOS 1 TUBE +attr:Errors:79:Stat_image:144.3:ERR_BSH_EOS1_TUBE_OPN_CMD:errore su comando apertura beam shutter EOS 1 TUBE +attr:Errors:80:Stat_image:144.4:ERR_BSH_EOS1_TABLE_CLD:errore su chiusura beam shutter EOS 1 TABLE +attr:Errors:81:Stat_image:144.5:ERR_BSH_EOS1_TABLE_CLD_CMD:errore su comando chiusura beam shutter EOS 1 TABLE +attr:Errors:82:Stat_image:144.6:ERR_BSH_EOS1_TUBE_CLD:errore su chiusura beam shutter EOS 1 TUBE +attr:Errors:83:Stat_image:144.7:ERR_BSH_EOS1_TUBE_CLD_CMD:errore su comando chiusura beam shutter EOS 1 TUBE +attr:Errors:84:Stat_image:145.0:ERR_EB_EOS1:errore su pulsante di emergenza EOS1 +attr:Errors:85:Stat_image:145.1:ERR_CVR_M10_M11_M12_EOS1_CLD:errore su chiusura coperchi EOS1 +attr:Errors:86:Stat_image:145.2:ERR_PG5_EOS1:errore su pressostato 5 EOS1_ +attr:Errors:87:Stat_image:145.3:ERR_KEY_EOS1_INT:errore su chiave interna EOS 1 +attr:Errors:88:Stat_image:145.6:ERR_PG6_EOS1:errore su pressostato 6 EOS2_ +attr:Errors:89:Stat_image:146.0:ERR_BSH_EOS2_TABLE_OPN:errore su apertura beam shutter EOS 2 TABLE +attr:Errors:90:Stat_image:146.1:ERR_BSH_EOS2_TABLE_OPN_CMD:errore su comando apertura beam shutter EOS 2 TABLE +attr:Errors:91:Stat_image:146.2:ERR_EB_EOS2:errore su pulsante di emergenza EOS2 +attr:Errors:92:Stat_image:146.3:ERR_BSH_EOS2_TUBE_OPN_CMD:errore su comando apertura beam shutter EOS 1 TUBE +attr:Errors:93:Stat_image:146.4:ERR_BSH_EOS2_TABLE_CLD:errore su chiusura beam shutter EOS 2 TABLE +attr:Errors:94:Stat_image:146.5:ERR_BSH_EOS2_TABLE_CLD_CMD:errore su comando chiusura beam shutter EOS 2 TABLE +attr:Errors:95:Stat_image:146.7:ERR_BSH_EOS2_TUBE_CLD_CMD:errore su comando chiusura beam shutter EOS 2 TUBE +attr:Errors:96:Stat_image:147.0:ERR_CVR_MBX1_MBX2_EOS2_CLD:errore su chiusura coperchi EOS2 +attr:Errors:97:Stat_image:147.1:ERR_CVR_M21_M22_M23_EOS2_CLD:errore su chiusura coperchi EOS2 +attr:Errors:98:Stat_image:147.3:ERR_KEY_EOS2_INT:errore su chiave interna EOS 2 +attr:Errors:99:Stat_image:148.0:BSH_EOS1_TUBE_CMD_OUT:errore su solenoide BSH EOS1 TUBE +attr:Errors:100:Stat_image:148.1:BSH_EOS1_TABLE_CMD_OUT:errore su solenoide BSH EOS2 TABLE +attr:Errors:101:Stat_image:149.1:BSH_EOS2_TABLE_CMD_OUT:errore su solenoide BSH EOS2 TABLE +#prossime per nuovo shutter SLU, non EOS +attr:Errors:102:Stat_image:125.3:ERR_BSH_UH_CLD:errore su chiusura beam shutter UH +attr:Errors:103:Stat_image:125.7:ERR_BSH_UH_OPN:errore su apertura beam shutter UH +attr:Errors:104:Stat_image:139.0:BSH_UH_CMD_OUT:errore su solenoide UH +attr:Errors:105:Stat_image:137.3:ERR_MAINT_CONFIRM: +#prossime: nuove Magnedyn +attr:Errors:106:Stat_image:152.1:ERR_KEY_MASTER_IN_MAGNED:chiave master +attr:Errors:107:Stat_image:152.2:ERR_EB_BSH_MAGNEDYN:pulsante emergenza +attr:Errors:108:Stat_image:152.3:ERR_ABI_BSH_SLU_MAGNEDYN:abilitazione apertura shutter +attr:Errors:109:Stat_image:152.5:ERR_KEY_MAGNEDYN_IN:chiave pannello utenti magnedyn +attr:Errors:110:Stat_image:152.7:ERR_KEY_MAG_BRD_MAINT:chiave maintenance magnedyn breadboard inserita +attr:Errors:111:Stat_image:153.0:ERR_BSH_SLU_MAGNEDYN_CLD:shutter magnedyn chiuso +attr:Errors:112:Stat_image:153.1:ERR_DR1_MAGNEDYN_CLD:prima porta bussola magnedyn chiusa +attr:Errors:113:Stat_image:153.2:ERR_DR2_MAGNEDYN_CLD:seconda porta bussola magnedyn chiusa +attr:Errors:114:Stat_image:153.3:ERR_BSH_SLU_MAG_BRD_CLD:shutter breadboard magnedyn chiuso +attr:Errors:115:Stat_image:153.4:ERR_BSH_SLU_MAGNEDYN_OPN:shutter magnedyn aperto +attr:Errors:116:Stat_image:153.7:ERR_BSH_SLU_MAG_BRD_OPN:shutter breadboard magnedyn aperto +attr:Errors:117:Stat_image:154.0:ERR_BSH_MAG_OPEN_OUT:errore su bobina shutter magnedyn +attr:Errors:118:Stat_image:154.1:ERR_ELSER_SLU_MAG_01_ON:errore su elettroserratura porta 1 magnedyn +attr:Errors:119:Stat_image:154.2:ERR_ELSER_SLU_MAG_02_ON:errore su elettroserratura porta 2 magnedyn +attr:Errors:120:Stat_image:154.3:ERR_BSH_BRD_MAG_OPEN_OUT:errore su bobina shutter breadboard magnedyn +attr:Errors:121:Stat_image:155.0:ERR_CVR2_BRD_MAG_CLD:errore su cover 2 breadboard magnedyn +#shutter spostati da plcint uh +attr:Errors:122:Stat_image:156.0:ERR_BSH_FEL1_OPN:Controllo Hardware ingresso fail safe +attr:Errors:123:Stat_image:156.1:ERR_BSH_FEL1_CLD:Controllo Hardware ingresso fail safe +attr:Errors:124:Stat_image:156.4:ERR_BSH_FEL1_INTCK_ABI:Controllo Hardware ingresso fail safe +attr:Errors:125:Stat_image:38.6:BSH_FEL1_NO_ERR_CLD:controllo errore in chiusura ok +attr:Errors:126:Stat_image:38.7:BSH_FEL1_NO_ERR_OPN:controllo errore in apertura ok +attr:Errors:127:Stat_image:39.4:BSH_FEL1_OK_CONT:controllo incollaggio contatti ok +attr:Errors:128:Stat_image:156.2:ERR_BSH_FEL2_OPN:Controllo Hardware ingresso fail safe +attr:Errors:129:Stat_image:156.3:ERR_BSH_FEL2_CLD:Controllo Hardware ingresso fail safe +attr:Errors:130:Stat_image:156.5:ERR_BSH_FEL2_INTCK_ABI:Controllo Hardware ingresso fail safe +attr:Errors:131:Stat_image:39.6:BSH_FEL2_NO_ERR_CLD:controllo errore in chiusura ok +attr:Errors:132:Stat_image:39.7:BSH_FEL2_NO_ERR_OPN:controllo errore in apertura ok +attr:Errors:133:Stat_image:39.5:BSH_FEL2_OK_CONT:controllo incollaggio contatti ok +attr:Errors:134:Stat_image:156.7:ERR_KEY_FEL_UH_MAINT:Controllo Hardware ingresso fail safe +attr:Errors:135:Stat_image:135.3:ERR_NO_PEOPLE_UH: +attr:Errors:136:Stat_image:159.0:ERR_BSH_FEL1_OPEN_OUT: +attr:Errors:137:Stat_image:159.1:ERR_BSH_FEL2_OPEN_OUT: +attr:Errors:138:Stat_image:159.2:ERR_TAB_UH_LASER_OFF_HAZ: +#EEHG +#attr:Errors_EEHG:0:Stat_image:157.0:ERR_BSH_EEHG_OPN:Controllo Hardware ingresso fail safe +#attr:Errors_EEHG:1:Stat_image:157.4:ERR_BSH_EEHG_CLD:Controllo Hardware ingresso fail safe +#attr:Errors_EEHG:2:Stat_image:156.6:ERR_BSH_EEHG_INTCK_ABI:Controllo Hardware ingresso fail safe +#attr:Errors_EEHG:3:Stat_image:36.5:BSH_EEHG_NO_ERR_CLD:controllo errore in chiusura ok +#attr:Errors_EEHG:4:Stat_image:36.6:BSH_EEHG_NO_ERR_OPN:controllo errore in apertura ok +#attr:Errors_EEHG:5:Stat_image:36.7:BSH_EEHG_OK_CONT:controllo incollaggio contatti ok +#attr:Errors_EEHG:6:Stat_image:158.0:ERR_SH_EEHG_OPN:Controllo Hardware ingresso fail safe +#attr:Errors_EEHG:7:Stat_image:158.4:ERR_SH_EEHG_CLD:Controllo Hardware ingresso fail safe +#attr:Errors_EEHG:8:Stat_image:37.5:SH_EEHG_NO_ERR_CLD:controllo errore in chiusura ok +#attr:Errors_EEHG:9:Stat_image:37.6:SH_EEHG_NO_ERR_OPN:controllo errore in apertura ok +#attr:Errors_EEHG:10:Stat_image:37.7:SH_EEHG_OK_CONT:controllo incollaggio contatti ok +#attr:Errors_EEHG:11:Stat_image:158.2:ERR_SH_EEHG_OPN_CMD:Controllo Hardware ingresso fail safe +#attr:Errors_EEHG:12:Stat_image:158.6:ERR_SH_EEHG_CLD_CMD:Controllo Hardware ingresso fail safe +#attr:Errors_EEHG:13:Stat_image:158.3:ERR_KEY_EEHG_IN:Controllo Hardware ingresso fail safe +#attr:Errors_EEHG:14:Stat_image:158.1:ERR_CVR_EEHG_CLD:Controllo Hardware ingresso fail safe +#attr:Errors_EEHG:15:Stat_image:157.2:ERR_EB_EEHG:Controllo Hardware ingresso fail safe +# +# +attr:Keys:0:Stat_image:42.4:KEY_EOS2_MASTER: +attr:Keys:1:Stat_image:42.5:KEY_EOS2_ON: +attr:Keys:2:Stat_image:110.3:KEY_EOS2_INT: +# +attr:Bsh_SLR:0:Stat_image:40.5:BSH_SLR_EOS2_OPN: +attr:Bsh_SLR:1:Stat_image:40.4:BSH_SLR_EOS2_CLD: +attr:Bsh_SLR:2:Stat_image:18.6:ABI_BSH_SLR_EOS2: +# +attr:Bsh_Tube:0:Stat_image:44.3:BSH_EOS2_TUBE_OPN: +attr:Bsh_Tube:1:Stat_image:44.7:BSH_EOS2_TUBE_CLD: +attr:Bsh_Tube:2:Stat_image:15.6:ABI_BSH_TUBE_EOS2: +# +attr:Bsh_Table:0:Stat_image:108.0:BSH_EOS2_TABLE_OPN: +attr:Bsh_Table:1:Stat_image:108.4:BSH_EOS2_TABLE_CLD: +attr:Bsh_Table:2:Stat_image:16.6:ABI_BSH_TABLE_EOS2: +# +attr:Pressure_gauges:0:Stat_image:42.7:PG_EOS2_UH_01: +attr:Pressure_gauges:1:Stat_image:44.6:PG_EOS2_UH_02: +# +attr:Plc_status:0:state:0.0:plc_state:check if low level server state = ON +# +attr:Badge_maintenance:0:Access_names2:0:string +attr:Badge_maintenance:1:Access_names2:1:string +# +cmd:open_bsh_slu:Send_cmd:102:16.0 +cmd:close_bsh_slu:Send_cmd:102:18.0 +# +cmd:Open_Bsh_SLR:Send_cmd:102:60.0 +cmd:Close_Bsh_SLR:Send_cmd:102:62.0 +cmd:Open_Bsh_Tube:Send_cmd:102:44.0 +cmd:Close_Bsh_Tube:Send_cmd:102:46.0 +cmd:Open_Bsh_Table:Send_cmd:102:48.0 +cmd:Close_Bsh_Table:Send_cmd:102:50.0 +# +#cmd:open_bsh_eehg:Send_cmd:102:72.0 +#cmd:close_bsh_eehg:Send_cmd:102:74.0 +#cmd:open_bsh_fel1:Send_cmd:102:80.0 +#cmd:close_bsh_fel1:Send_cmd:102:82.0 +#cmd:open_bsh_fel2:Send_cmd:102:84.0 +#cmd:close_bsh_fel2:Send_cmd:102:86.0 +# diff --git a/accessconf_pumps.txt b/accessconf_pumps.txt new file mode 100644 index 0000000000000000000000000000000000000000..d28224e54e292a8e2a89e812fed442f17476c2b1 --- /dev/null +++ b/accessconf_pumps.txt @@ -0,0 +1,32 @@ +# +attr:PMP_UH_01:0:Stat_image:208.5:PMP_SLU_UH_01_ON:Pump on +# +attr:PMP_UH_02:0:Stat_image:212.1:PMP_SLU_UH_02_ON:Pump on +# +attr:PMP_UH_03:0:Stat_image:212.5:PMP_SLU_UH_03_ON:Pump on +# +attr:PMP_SH_01:0:Stat_image:216.1:PMP_SLU_SH_01_ON:Pump on +# +attr:PMP_EH_01:0:Stat_image:236.1:PMP_SLU_EH_01_ON:Pump on +# +attr:PMP_EH_02:0:Stat_image:230.1:PMP_SLU_EH_02_ON:Pump on +# +# +cmd:Start_UH_01:Send_cmd:103:11.2 +cmd:Stop_UH_01:Send_cmd:103:11.3 +# +cmd:Start_UH_02:Send_cmd:103:11.4 +cmd:Stop_UH_02:Send_cmd:103:11.5 +# +cmd:Start_UH_03:Send_cmd:103:11.6 +cmd:Stop_UH_03:Send_cmd:103:11.7 +# +cmd:Start_SH_01:Send_cmd:103:12.0 +cmd:Stop_SH_01:Send_cmd:103:12.1 +# +cmd:Start_EH_01:Send_cmd:103:12.2 +cmd:Stop_EH_01:Send_cmd:103:12.3 +# +cmd:Start_EH_02:Send_cmd:103:12.4 +cmd:Stop_EH_02:Send_cmd:103:12.5 +# \ No newline at end of file diff --git a/accessconf_vlvp_eh_01.txt b/accessconf_vlvp_eh_01.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5e10f62df1d3093afda117bf7daf4723e54b311 --- /dev/null +++ b/accessconf_vlvp_eh_01.txt @@ -0,0 +1,19 @@ +# +attr:ValveStat:0:Stat_image:100.1:VLVP_SLU_EH_01_OPN:Valvola sicuramente aperta +attr:ValveStat:1:Stat_image:100.0:VLVP_SLU_EH_01_CLD:Valvola sicuramente chiusa +attr:ValveStat:2:Stat_image:0.0:spare:spare +attr:ValveStat:3:Stat_image:100.2:VLVP_SLU_EH_01_CUT_OFF:Cutoff +attr:ValveStat:4:Stat_image:0.0:spare:spare +attr:ValveStat:5:Stat_image:0.0:TODO:TODO(ERR OPEN) +attr:ValveStat:6:Stat_image:0.0:TODO:TODO(ERR CLOSE) +attr:ValveStat:7:Stat_image:0.0:TODO:TODO(MEMCONT) +# +attr:AbiGroup:0:Stat_image:0.0:TODO:TODO(OKINTCK) +# +#attr:Plc_status:0:state:0.0:plc_state:check if low level server state = ON +# +#attr:badge_ack_fake:0:Access_names:16:string +# +cmd:open:Send_cmd:103:11.0 +cmd:close:Send_cmd:103:11.1 +# \ No newline at end of file diff --git a/accessconf_vlvp_eh_02.txt b/accessconf_vlvp_eh_02.txt new file mode 100644 index 0000000000000000000000000000000000000000..137394418a8544b8c3ff9d0ce9a5e8e72ce847b9 --- /dev/null +++ b/accessconf_vlvp_eh_02.txt @@ -0,0 +1,19 @@ +# +attr:ValveStat:0:Stat_image:97.7:VLVP_SLU_EH_02_OPN:Valvola sicuramente aperta +attr:ValveStat:1:Stat_image:97.6:VLVP_SLU_EH_02_CLD:Valvola sicuramente chiusa +attr:ValveStat:2:Stat_image:0.0:spare:spare +attr:ValveStat:3:Stat_image:98.0:VLVP_SLU_EH_01_CUT_OFF:Cutoff +attr:ValveStat:4:Stat_image:0.0:spare:spare +attr:ValveStat:5:Stat_image:0.0:TODO:TODO(ERR OPEN) +attr:ValveStat:6:Stat_image:0.0:TODO:TODO(ERR CLOSE) +attr:ValveStat:7:Stat_image:0.0:TODO:TODO(MEMCONT) +# +attr:AbiGroup:0:Stat_image:0.0:TODO:TODO(OKINTCK) +# +#attr:Plc_status:0:state:0.0:plc_state:check if low level server state = ON +# +#attr:badge_ack_fake:0:Access_names:16:string +# +cmd:open:Send_cmd:103:12.6 +cmd:close:Send_cmd:103:12.7 +# \ No newline at end of file diff --git a/accessconf_vlvp_sh_01.txt b/accessconf_vlvp_sh_01.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ccd9d470c17474b565457cce90bf8ece98e9e39 --- /dev/null +++ b/accessconf_vlvp_sh_01.txt @@ -0,0 +1,19 @@ +# +attr:ValveStat:0:Stat_image:68.1:VLVP_SLU_SH_01_OPN:Valvola sicuramente aperta +attr:ValveStat:1:Stat_image:68.0:VLVP_SLU_SH_01_CLD:Valvola sicuramente chiusa +attr:ValveStat:2:Stat_image:0.0:spare:spare +attr:ValveStat:3:Stat_image:68.2:VLVP_SLU_SH_01_CUT_OFF:Cutoff +attr:ValveStat:4:Stat_image:0.0:spare:spare +attr:ValveStat:5:Stat_image:0.0:TODO:TODO(ERR OPEN) +attr:ValveStat:6:Stat_image:0.0:TODO:TODO(ERR CLOSE) +attr:ValveStat:7:Stat_image:0.0:TODO:TODO(MEMCONT) +# +attr:AbiGroup:0:Stat_image:0.0:TODO:TODO(OKINTCK) +# +#attr:Plc_status:0:state:0.0:plc_state:check if low level server state = ON +# +#attr:badge_ack_fake:0:Access_names:16:string +# +cmd:open:Send_cmd:103:10.6 +cmd:close:Send_cmd:103:10.7 +# \ No newline at end of file diff --git a/accessconf_vlvp_uh_01.txt b/accessconf_vlvp_uh_01.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c6f321a362a25a66371c2eafe7cc93140233cad --- /dev/null +++ b/accessconf_vlvp_uh_01.txt @@ -0,0 +1,19 @@ +# +attr:ValveStat:0:Stat_image:62.6:VLVP_SLU_UH_01_OPN:Valvola sicuramente aperta +attr:ValveStat:1:Stat_image:62.5:VLVP_SLU_UH_01_CLD:Valvola sicuramente chiusa +attr:ValveStat:2:Stat_image:0.0:spare:spare +attr:ValveStat:3:Stat_image:62.7:VLVP_SLU_UH_01_CUT_OFF:Cutoff +attr:ValveStat:4:Stat_image:0.0:spare:spare +attr:ValveStat:5:Stat_image:0.0:TODO:TODO(ERR OPEN) +attr:ValveStat:6:Stat_image:0.0:TODO:TODO(ERR CLOSE) +attr:ValveStat:7:Stat_image:0.0:TODO:TODO(MEMCONT) +# +attr:AbiGroup:0:Stat_image:0.0:TODO:TODO(OKINTCK) +# +#attr:Plc_status:0:state:0.0:plc_state:check if low level server state = ON +# +#attr:badge_ack_fake:0:Access_names:16:string +# +cmd:open:Send_cmd:103:10.0 +cmd:close:Send_cmd:103:10.1 +# \ No newline at end of file diff --git a/accessconf_vlvp_uh_02.txt b/accessconf_vlvp_uh_02.txt new file mode 100644 index 0000000000000000000000000000000000000000..d15a81b41c7428f031cf564031cb9843628ba0b5 --- /dev/null +++ b/accessconf_vlvp_uh_02.txt @@ -0,0 +1,19 @@ +# +attr:ValveStat:0:Stat_image:66.1:VLVP_SLU_UH_02_OPN:Valvola sicuramente aperta +attr:ValveStat:1:Stat_image:66.0:VLVP_SLU_UH_02_CLD:Valvola sicuramente chiusa +attr:ValveStat:2:Stat_image:0.0:spare:spare +attr:ValveStat:3:Stat_image:66.2:VLVP_SLU_UH_02_CUT_OFF:Cutoff +attr:ValveStat:4:Stat_image:0.0:spare:spare +attr:ValveStat:5:Stat_image:0.0:TODO:TODO(ERR OPEN) +attr:ValveStat:6:Stat_image:0.0:TODO:TODO(ERR CLOSE) +attr:ValveStat:7:Stat_image:0.0:TODO:TODO(MEMCONT) +# +attr:AbiGroup:0:Stat_image:0.0:TODO:TODO(OKINTCK) +# +#attr:Plc_status:0:state:0.0:plc_state:check if low level server state = ON +# +#attr:badge_ack_fake:0:Access_names:16:string +# +cmd:open:Send_cmd:103:10.2 +cmd:close:Send_cmd:103:10.3 +# \ No newline at end of file diff --git a/accessconf_vlvp_uh_03.txt b/accessconf_vlvp_uh_03.txt new file mode 100644 index 0000000000000000000000000000000000000000..61b5e4ae22749bf51d79ad50ebce5b11370fa961 --- /dev/null +++ b/accessconf_vlvp_uh_03.txt @@ -0,0 +1,19 @@ +# +attr:ValveStat:0:Stat_image:66.5:VLVP_SLU_UH_03_OPN:Valvola sicuramente aperta +attr:ValveStat:1:Stat_image:66.4:VLVP_SLU_UH_03_CLD:Valvola sicuramente chiusa +attr:ValveStat:2:Stat_image:0.0:spare:spare +attr:ValveStat:3:Stat_image:66.6:VLVP_SLU_UH_03_CUT_OFF:Cutoff +attr:ValveStat:4:Stat_image:0.0:spare:spare +attr:ValveStat:5:Stat_image:0.0:TODO:TODO(ERR OPEN) +attr:ValveStat:6:Stat_image:0.0:TODO:TODO(ERR CLOSE) +attr:ValveStat:7:Stat_image:0.0:TODO:TODO(MEMCONT) +# +attr:AbiGroup:0:Stat_image:0.0:TODO:TODO(OKINTCK) +# +#attr:Plc_status:0:state:0.0:plc_state:check if low level server state = ON +# +#attr:badge_ack_fake:0:Access_names:16:string +# +cmd:open:Send_cmd:103:10.4 +cmd:close:Send_cmd:103:10.5 +# \ No newline at end of file diff --git a/laser-pss-Attr-config-prop.txt b/laser-pss-Attr-config-prop.txt new file mode 100644 index 0000000000000000000000000000000000000000..aca7fa57ee09de60a82d29a97ac44b2dd1ac3461 --- /dev/null +++ b/laser-pss-Attr-config-prop.txt @@ -0,0 +1,42 @@ +# +attr:Cover_EEHG:0:Stat_image:82.1:CVR_EEHG_CLD:coperchio laser EEHG chiuso +# +attr:EmergencyButton_EEHG:0:Stat_image:92.2:NO_PUL_EME_EEHG:Pulsante emergenza EEHG non premuto +# +attr:BSH_Abi_EEHG:0:Stat_image:13.6:BSH_EEHG_ABI:beam shutter EEHG abilitato da Accessi Laser +attr:BSH_Abi_EEHG:1:Stat_image:94.6:BSH_EEHG_INTCK_ABI:beam shutter EEHG abilitato da INTCK +attr:BSH_Abi_EEHG:2:Stat_image:14.6:SH_EEHG_ABI:beam shutter (VLV) EEHG abilitato da Accessi Laser +# +attr:Key_EEHG:0:Stat_image:82.3:KEY_EEHG_IN:chiave bypass coperchi laser EEHG inserita +attr:Key_EEHG:1:Stat_image:37.2:LASER_MAINT_EEHG:EEHG in laser maintenance +# +attr:BSH_EEHG:0:Stat_image:92.0:BSH_EEHG_OPN:beam shutter EEHG aperto +attr:BSH_EEHG:1:Stat_image:92.4:BSH_EEHG_CLD:beam shutter EEHG chiuso +attr:BSH_EEHG:2:Stat_image:82.0:SH_EEHG_OPN:beam shutter (VLV) EEHG aperto +attr:BSH_EEHG:3:Stat_image:82.4:SH_EEHG_CLD:beam shutter (VLV) EEHG chiuso +# +attr:Errors_EEHG:0:Stat_image:157.0:ERR_BSH_EEHG_OPN:Controllo Hardware ingresso fail safe +attr:Errors_EEHG:1:Stat_image:157.4:ERR_BSH_EEHG_CLD:Controllo Hardware ingresso fail safe +attr:Errors_EEHG:2:Stat_image:156.6:ERR_BSH_EEHG_INTCK_ABI:Controllo Hardware ingresso fail safe +attr:Errors_EEHG:3:Stat_image:36.5:BSH_EEHG_NO_ERR_CLD:controllo errore in chiusura ok +attr:Errors_EEHG:4:Stat_image:36.6:BSH_EEHG_NO_ERR_OPN:controllo errore in apertura ok +attr:Errors_EEHG:5:Stat_image:36.7:BSH_EEHG_OK_CONT:controllo incollaggio contatti ok +attr:Errors_EEHG:6:Stat_image:158.0:ERR_SH_EEHG_OPN:Controllo Hardware ingresso fail safe +attr:Errors_EEHG:7:Stat_image:158.4:ERR_SH_EEHG_CLD:Controllo Hardware ingresso fail safe +attr:Errors_EEHG:8:Stat_image:37.5:SH_EEHG_NO_ERR_CLD:controllo errore in chiusura ok +attr:Errors_EEHG:9:Stat_image:37.6:SH_EEHG_NO_ERR_OPN:controllo errore in apertura ok +attr:Errors_EEHG:10:Stat_image:37.7:SH_EEHG_OK_CONT:controllo incollaggio contatti ok +attr:Errors_EEHG:11:Stat_image:158.2:ERR_SH_EEHG_OPN_CMD:Controllo Hardware ingresso fail safe +attr:Errors_EEHG:12:Stat_image:158.6:ERR_SH_EEHG_CLD_CMD:Controllo Hardware ingresso fail safe +attr:Errors_EEHG:13:Stat_image:158.3:ERR_KEY_EEHG_IN:Controllo Hardware ingresso fail safe +attr:Errors_EEHG:14:Stat_image:158.1:ERR_CVR_EEHG_CLD:Controllo Hardware ingresso fail safe +attr:Errors_EEHG:15:Stat_image:157.2:ERR_EB_EEHG:Controllo Hardware ingresso fail safe +# +cmd:open_bsh_eehg:Send_cmd:102:72.0 +cmd:close_bsh_eehg:Send_cmd:102:74.0 +cmd:open_sh_eehg:Send_cmd:102:76.0 +cmd:close_sh_eehg:Send_cmd:102:78.0 +cmd:open_bsh_fel1:Send_cmd:102:80.0 +cmd:close_bsh_fel1:Send_cmd:102:82.0 +cmd:open_bsh_fel2:Send_cmd:102:84.0 +cmd:close_bsh_fel2:Send_cmd:102:86.0 diff --git a/src/AccessConf.cpp b/src/AccessConf.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3fc7a9c7c67c9d93593be6304f75026659776315 --- /dev/null +++ b/src/AccessConf.cpp @@ -0,0 +1,2382 @@ +/*----- PROTECTED REGION ID(AccessConf.cpp) ENABLED START -----*/ +static const char *RcsId = "$Id: AccessConf.cpp,v 1.18 2019-11-06 08:28:04 graziano Exp $"; +//============================================================================= +// +// file : AccessConf.cpp +// +// description : C++ source for the AccessConf and its commands. +// The class is derived from Device. It represents the +// CORBA servant object which will be accessed from the +// network. All commands which can be executed on the +// AccessConf are implemented in this file. +// +// project : Storage Ring Access. +// +// $Author: graziano $ +// +// $Revision: 1.18 $ +// $Date: 2019-11-06 08:28:04 $ +// +// SVN only: +// $HeadURL: $ +// +// CVS only: +// $Source: /home/cvsadm/cvsroot/fermi/servers/accessconf/src/AccessConf.cpp,v $ +// $Log: AccessConf.cpp,v $ +// Revision 1.18 2019-11-06 08:28:04 graziano +// fixed archive events thresholds +// +// Revision 1.17 2019-11-06 08:23:36 graziano +// Added cutoff_ind to change/disable index for cutoff +// +// Revision 1.16 2019-02-06 16:06:41 graziano +// fixed ValveStat[4] (abi) value if not spare +// +// Revision 1.15 2019-01-17 12:31:49 graziano +// fixed +// +// Revision 1.14 2019-01-17 12:28:38 graziano +// fixed initial state/status +// +// Revision 1.13 2019-01-17 11:38:51 graziano +// Initialized state/status +// +// Revision 1.12 2018-12-31 14:19:50 graziano +// fixed 101 commands +// +// Revision 1.11 2018-12-31 14:07:59 graziano +// in valvestat fixed limit of 7 for inverted bits +// +// Revision 1.10 2018-06-26 10:22:42 graziano +// removed push event on status +// +// Revision 1.9 2017-08-23 14:16:23 claudio +// #1554 tango-9.2.5a +// +// Revision 1.8 2017-08-09 12:09:00 graziano +// fixed string attributes +// +// Revision 1.7 2016-11-21 09:06:22 graziano +// added archive event +// +// Revision 1.6 2016-01-07 10:44:44 graziano +// fixed +// +// Revision 1.5 2014-05-12 14:21:33 graziano +// fixed event errors +// +// Revision 1.4 2014-04-24 13:35:13 graziano +// fixed sync read +// +// Revision 1.3 2013-08-20 07:06:01 graziano +// event support +// +// Revision 1.2 2012-10-31 17:40:12 graziano +// fixed for valves +// +// Revision 1.1 2012-10-30 09:29:15 graziano +// *** empty log message *** +// +// +// +//============================================================================= +// This file is generated by POGO +// (Program Obviously used to Generate tango Object) +//============================================================================= + + +#include <AccessConf.h> +#include <AccessConfClass.h> +#include <math.h> +#include <stdint.h> + +const char srvver[] = RELEASE; + +/*----- PROTECTED REGION END -----*/ + + +/** + * AccessConf class description: + * + */ + +//================================================================ +// +// The following table gives the correspondence +// between command and method names. +// +// Command name | Method name +//---------------------------------------------------------------- +// State | Inherited (no method) +// Status | Inherited (no method) +//================================================================ + +namespace AccessConf_ns +{ + /*----- PROTECTED REGION ID(AccessConf::namespace_starting) ENABLED START -----*/ + + // static initializations +bool compare_attr_index (attr_desc_t i,attr_desc_t j) { return (i.attr_index < j.attr_index); }; + + /*----- PROTECTED REGION END -----*/ // AccessConf::namespace_starting + + + +//-------------------------------------------------------- +/** + * Method : AccessConf::AccessConf() + * Description : Constructors for a Tango device + * implementing the class AccessConf + */ +//-------------------------------------------------------- +AccessConf::AccessConf(Tango::DeviceClass *cl, string &s) + : TANGO_BASE_CLASS(cl, s.c_str()) +{ + /*----- PROTECTED REGION ID(AccessConf::constructor_1) ENABLED START -----*/ + + init_device(); + + /*----- PROTECTED REGION END -----*/ // AccessConf::constructor_1 +} +//-------------------------------------------------------- +AccessConf::AccessConf(Tango::DeviceClass *cl, const char *s) + : TANGO_BASE_CLASS(cl, s) +{ + /*----- PROTECTED REGION ID(AccessConf::constructor_2) ENABLED START -----*/ + + init_device(); + + /*----- PROTECTED REGION END -----*/ // AccessConf::constructor_2 +} +//-------------------------------------------------------- +AccessConf::AccessConf(Tango::DeviceClass *cl, const char *s, const char *d) + : TANGO_BASE_CLASS(cl, s, d) +{ + /*----- PROTECTED REGION ID(AccessConf::constructor_3) ENABLED START -----*/ + + init_device(); + + /*----- PROTECTED REGION END -----*/ // AccessConf::constructor_3 +} + + +//-------------------------------------------------------- +/** + * Method : AccessConf::delete_device()() + * Description : will be called at device destruction or at init command + */ +//-------------------------------------------------------- +void AccessConf::delete_device() +{ + /*----- PROTECTED REGION ID(AccessConf::delete_device) ENABLED START -----*/ + + // Delete device allocated objects + DEBUG_STREAM << __FUNCTION__<<": entering..." << endl; + delete[] attr_status_read; + + /*----- PROTECTED REGION END -----*/ // AccessConf::delete_device + delete[] attr_BoolScalarDyn_read; + delete[] attr_BoolSpectrumDyn_read; + delete[] attr_StringSpectrumDyn_read; + delete[] attr_Version_read; + + delete lldevice; + +} + + +//-------------------------------------------------------- +/** + * Method : AccessConf::init_device() + * Description : // will be called at device initialization. + */ +//-------------------------------------------------------- +void AccessConf::init_device() +{ + DEBUG_STREAM << "AccessConf::init_device() create device " << device_name << endl; + + /*----- PROTECTED REGION ID(AccessConf::init_device_before) ENABLED START -----*/ + + // Initialization before get_device_property() call + ValveStat_initialized = false; + created_attr = false; + set_change_event("State", true, false); //attribute name, implemented, detect, if not setting detect=false have to set abs_change or + set_archive_event("State", true, true); //attribute name, implemented, detect, if not setting detect=false have to set abs_change or + //set_change_event("Status", true, false); //attribute name, implemented, detect, if not setting detect=false have to set abs_change or + ecb.init(this); + /*----- PROTECTED REGION END -----*/ // AccessConf::init_device_before + + // Get the device properties (if any) from database + get_device_property(); + + attr_BoolScalarDyn_read = new Tango::DevBoolean[1]; + attr_BoolSpectrumDyn_read = new Tango::DevBoolean[MAX_ATTR_SIZE]; + attr_StringSpectrumDyn_read = new Tango::DevString[MAX_ATTR_SIZE]; + attr_Version_read = new Tango::DevString[1]; + + /*----- PROTECTED REGION ID(AccessConf::init_device) ENABLED START -----*/ + lldevice = new Tango::DeviceProxy(low_level_srv); + try { + if (lldevice->ping()) + { + set_state(Tango::ON); + set_status("Connected to device " + low_level_srv); + state_event = Tango::ON; + sprintf(status_str,"Connected to device %s", low_level_srv.c_str()); + } + } + catch(Tango::DevFailed &e) + { + set_state(Tango::UNKNOWN); + set_status("Failed to connect to device " + low_level_srv); + state_event = Tango::UNKNOWN; + sprintf(status_str,"Failed to connect to device %s", low_level_srv.c_str()); + } + + attr_status_read = new Tango::DevString[1]; + attr_status_read[0] = (char *)status_str; + // Initialize device + gettimeofday(&last_read, NULL); + + /*----- PROTECTED REGION END -----*/ // AccessConf::init_device +} + + + +//-------------------------------------------------------- +/** + * Method : AccessConf::get_device_property() + * Description : // Add your own code to initialize + */ +//-------------------------------------------------------- +void AccessConf::get_device_property() +{ + /*----- PROTECTED REGION ID(AccessConf::get_device_property_before) ENABLED START -----*/ + + // Initialize property data members + + /*----- PROTECTED REGION END -----*/ // AccessConf::get_device_property_before + + + // Read device properties from database. + Tango::DbData dev_prop; + dev_prop.push_back(Tango::DbDatum("Low_level_srv")); + dev_prop.push_back(Tango::DbDatum("Attr_config_file")); + dev_prop.push_back(Tango::DbDatum("Attr_config_prop")); + dev_prop.push_back(Tango::DbDatum("Cutoff_ind")); + + // is there at least one property to be read ? + if (dev_prop.size()>0) + { + // Call database and extract values + if (Tango::Util::instance()->_UseDb==true) + get_db_device()->get_property(dev_prop); + + // get instance on AccessConfClass to get class property + Tango::DbDatum def_prop, cl_prop; + AccessConfClass *ds_class = + (static_cast<AccessConfClass *>(get_device_class())); + int i = -1; + + // Try to initialize Low_level_srv from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> low_level_srv; + else { + // Try to initialize Low_level_srv from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> low_level_srv; + } + // And try to extract Low_level_srv value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> low_level_srv; + + // Try to initialize Attr_config_file from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> attr_config_file; + else { + // Try to initialize Attr_config_file from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> attr_config_file; + } + // And try to extract Attr_config_file value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> attr_config_file; + + // Try to initialize Attr_config_prop from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> attr_config_prop; + else { + // Try to initialize Attr_config_prop from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> attr_config_prop; + } + // And try to extract Attr_config_prop value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> attr_config_prop; + + // Try to initialize Cutoff_ind from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> cutoff_ind; + else { + // Try to initialize Cutoff_ind from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> cutoff_ind; + } + // And try to extract Cutoff_ind value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> cutoff_ind; + + + } + /*----- PROTECTED REGION ID(AccessConf::get_device_property_after) ENABLED START -----*/ + + // Check device property data members init + + /*----- PROTECTED REGION END -----*/ // AccessConf::get_device_property_after + +} + +//-------------------------------------------------------- +/** + * Method : AccessConf::always_executed_hook() + * Description : method always executed before any command is executed + */ +//-------------------------------------------------------- +void AccessConf::always_executed_hook() +{ + //INFO_STREAM << "AccessConf::always_executed_hook() " << device_name << endl; + /*----- PROTECTED REGION ID(AccessConf::always_executed_hook) ENABLED START -----*/ + + // code always executed before all requests +#if 0 + if(ValveStat_initialized) + { + map<string,attr_val_t >::iterator it_val = att_value.find("ValveStat"); + + if((it_val->second.val[5])||(it_val->second.val[6])/*||(!valve_stat[2])*/) + {//error occurred + + state_event = Tango::FAULT; + if(it_val->second.val[5]) + { + strcpy(status_str,"error opening"); + } + if(it_val->second.val[6]) + { + strcpy(status_str,"error closing"); + } + set_state(state_event); + set_status(status_str); + DEBUG_STREAM << __FUNCTION__ << " -> PUSHING FAULT ("<<status_str<<") "<<endl; + try { + push_change_event("state"); + push_archive_event("state"); + push_change_event("status"); + } catch(Tango::DevFailed &e) + { + DEBUG_STREAM << __func__<<": error pushing state="<<e.errors[0].desc<<endl; + } + // if(!valve_stat[2]){ + // set_status("pressure not ok"); + // } + } + else + {//no errors + if(it_val->second.val[0]){//opened? + if(it_val->second.val[1]) + {//closed? error + + state_event = Tango::FAULT; + strcpy(status_str,"SW both closed"); + set_state(state_event); + set_status(status_str); + DEBUG_STREAM << __FUNCTION__ << " -> PUSHING FAULT ("<<status_str<<") "<<endl; + try { + push_change_event("state"); + push_archive_event("state"); + push_change_event("status"); + } catch(Tango::DevFailed &e) + { + DEBUG_STREAM << "AccessConf::always_executed_hook() error pushing state="<<e.errors[0].desc<<endl; + } + } + else + {//opened + + state_event = Tango::OPEN; + strcpy(status_str,"----"); + set_state(state_event); + set_status(status_str); + DEBUG_STREAM << __FUNCTION__ << " -> PUSHING OPEN ("<<status_str<<") "<<endl; + try { + push_change_event("state"); + push_archive_event("state"); + push_change_event("status"); + } catch(Tango::DevFailed &e) + { + DEBUG_STREAM << "AccessConf::always_executed_hook() error pushing state="<<e.errors[0].desc<<endl; + } + } + } + else + { + if(it_val->second.val[1]) + {//closed? + + state_event = Tango::CLOSE; + strcpy(status_str,"----"); + set_state(state_event); + set_status(status_str); + DEBUG_STREAM << __FUNCTION__ << " -> PUSHING CLOSE ("<<status_str<<") "<<endl; + try { + push_change_event("state"); + push_archive_event("state"); + push_change_event("status"); + } catch(Tango::DevFailed &e) + { + DEBUG_STREAM << "AccessConf::always_executed_hook() error pushing state="<<e.errors[0].desc<<endl; + } + } + else + {//moving + + state_event = Tango::MOVING; + strcpy(status_str,"SW both opened"); + set_state(state_event); + set_status(status_str); + DEBUG_STREAM << __FUNCTION__ << " -> PUSHING MOVING ("<<status_str<<") "<<endl; + try { + push_change_event("state"); + push_archive_event("state"); + push_change_event("status"); + } catch(Tango::DevFailed &e) + { + DEBUG_STREAM << "AccessConf::always_executed_hook() error pushing state="<<e.errors[0].desc<<endl; + } + } + } +// if(is_local_ctrl){ +// set_status("local"); +// } + if(cutoff_ind >=0 && cutoff_ind < MAX_ATTR_SIZE) + { + if(!it_val->second.val[cutoff_ind]){ + strcpy(status_str,"cutoff"); + set_status(status_str); + try { + push_change_event("status"); + } catch(Tango::DevFailed &e) + { + DEBUG_STREAM << "AccessConf::always_executed_hook() error pushing status="<<e.errors[0].desc<<endl; + } + } + } + } + } +#endif + + /*----- PROTECTED REGION END -----*/ // AccessConf::always_executed_hook +} + + + +//-------------------------------------------------------- +/** + * Method : AccessConf::read_attr_hardware() + * Description : Hardware acquisition for attributes. + */ +//-------------------------------------------------------- +void AccessConf::read_attr_hardware(vector<long> &attr_list) +{ + //DEBUG_STREAM << "AccessConf::read_attr_hardware(vector<long> &attr_list) entering... " << endl; + /*----- PROTECTED REGION ID(AccessConf::read_attr_hardware) ENABLED START -----*/ + + // Add your own code + + struct timeval now; + gettimeofday(&now, NULL); + double diff_time_s = fabs((now.tv_sec - last_read.tv_sec) + ((double)(now.tv_usec - last_read.tv_usec))/1000000.0); + + if(diff_time_s < 1) + { + return; + } + gettimeofday(&last_read, NULL); + + try + { + vector<Tango::DeviceAttribute> *Dout; + //Tango::DeviceAttribute Dout; + + Dout = lldevice->read_attributes(remote_attr); + //Dout = lldevice->read_attribute(remote_attr[0]); + + //map<string,vector<Tango::DevBoolean> >::iterator attr_it; + map<string,rem_val_t >::iterator attr_it; + unsigned int i =0; + //for(attr_it=remote_att_value.begin(); attr_it != remote_att_value.end(); attr_it++) + for(vector<string>::iterator it = remote_attr.begin(); it != remote_attr.end(); it++) + { + attr_it = remote_att_value.find(*it); + if(attr_it == remote_att_value.end()) + { + WARN_STREAM << __FUNCTION__ << " remote attr=" << *it << " not found!"; + continue; + } + if(attr_it->first != "state") + { + map<string,string>::iterator it_type = remote_type.find(attr_it->first); + DEBUG_STREAM << __FUNCTION__ << " remote type=" << it_type->second; + if(it_type != remote_type.end() && it_type->second == "bool") + { + (*Dout)[i++] >> attr_it->second.val_b; //TODO: string + //Dout >> attr_it->second.val_b; //TODO: string + DEBUG_STREAM << __FUNCTION__ << " remote type=" << it_type->second << " name="<<attr_it->first<<" copyed="<<attr_it->second.val_b.size();// << " dout len="<<(*Dout)[i-1].get_dim_x(); + } + else if(it_type != remote_type.end() && it_type->second == "string") + { + //(*Dout)[i++] >> attr_it->second.val_s; //TODO: string + DEBUG_STREAM << __FUNCTION__ << " remote type=" << it_type->second << " name="<<attr_it->first<<" copyed="<<attr_it->second.val_s.size();// << " dout len="<<(*Dout)[i-1].get_dim_x(); + Tango::DeviceAttribute Dout2 = lldevice->read_attribute(attr_it->first.c_str()); + Dout2 >> attr_it->second.val_s; //TODO: string + } + } + else + { + (*Dout)[i++] >> ll_state; + DEBUG_STREAM << __FUNCTION__ << " read state=" << (int)ll_state; + } + } + delete Dout; + } + catch(Tango::DevFailed &e) + { + ll_state = Tango::FAULT; + stringstream tmp; + tmp << "error reading low level attributes err: " << e.errors[0].desc; + INFO_STREAM << __FUNCTION__ << ": " << tmp.str(); + } +#if 0 + + for(int i=0; i<attr_list.size(); i++) + { + string attr_name = dev_attr->get_attr_by_ind(attr_list[0]).get_name(); + DEBUG_STREAM << __func__<<": for attr="<<attr_name; + if(attr_name != "State") + return; + } + DEBUG_STREAM << __func__<<": State!!!!!!!!"; + + map<string,attr_val_t >::iterator it_val = att_value.find("ValveStat"); + + if((it_val->second.val[5])||(it_val->second.val[6])/*||(!valve_stat[2])*/) + {//error occurred + set_state(Tango::FAULT); + if(it_val->second.val[5]){ + set_status("error opening"); + } + if(it_val->second.val[6]){ + set_status("error closing"); + } +#if _PUSH_EVENTS + Tango::DevState sta = Tango::FAULT; + try { + push_change_event("state"); + push_archive_event("state"); + } catch(Tango::DevFailed &e) + { + DEBUG_STREAM << __func__<<": error pushing state="<<e.errors[0].desc<<endl; + } +#endif + // if(!valve_stat[2]){ + // set_status("pressure not ok"); + // } + } + else + {//no errors + if(it_val->second.val[0]){//opened? + if(it_val->second.val[1]) + {//closed? error + set_state(Tango::FAULT); + set_status("SW both closed"); +#if _PUSH_EVENTS + Tango::DevState sta = Tango::FAULT; + try { + push_change_event("state"); + push_archive_event("state"); + } catch(Tango::DevFailed &e) + { + DEBUG_STREAM << "AccessConf::always_executed_hook() error pushing state="<<e.errors[0].desc<<endl; + } +#endif + } + else + {//opened + set_state(Tango::OPEN); + set_status("----"); +#if _PUSH_EVENTS + Tango::DevState sta = Tango::OPEN; + try { + push_change_event("state"); + push_archive_event("state"); + } catch(Tango::DevFailed &e) + { + DEBUG_STREAM << "AccessConf::always_executed_hook() error pushing state="<<e.errors[0].desc<<endl; + } +#endif + } + } + else + { + if(it_val->second.val[1]) + {//closed? + set_state(Tango::CLOSE); + set_status("----"); +#if _PUSH_EVENTS + Tango::DevState sta = Tango::CLOSE; + try { + push_change_event("state"); + push_archive_event("state"); + } catch(Tango::DevFailed &e) + { + DEBUG_STREAM << "AccessConf::always_executed_hook() error pushing state="<<e.errors[0].desc<<endl; + } +#endif + } + else + {//moving + set_state(Tango::MOVING); + set_status("SW both opened"); +#if _PUSH_EVENTS + Tango::DevState sta = Tango::MOVING; + try { + push_change_event("state"); + push_archive_event("state"); + } catch(Tango::DevFailed &e) + { + DEBUG_STREAM << "AccessConf::always_executed_hook() error pushing state="<<e.errors[0].desc<<endl; + } +#endif + } + } +// if(is_local_ctrl){ +// set_status("local"); +// } + if(cutoff_ind >=0 && cutoff_ind < MAX_ATTR_SIZE) + { + if(!it_val->second.val[cutoff_ind]){ + set_status("cutoff"); + } + } + } +#endif + + /*----- PROTECTED REGION END -----*/ // AccessConf::read_attr_hardware + +} + + +//-------------------------------------------------------- +/** + * Read BoolScalarDyn attribute + * Description: + * + * Data type: Tango::DevBoolean + * Attr type: Scalar + */ +//-------------------------------------------------------- +void AccessConf::read_BoolScalarDyn(Tango::Attribute &attr) +{ + DEBUG_STREAM << "AccessConf::read_BoolScalarDyn(Tango::Attribute &attr) entering... " << endl; + /*----- PROTECTED REGION ID(AccessConf::read_BoolScalarDyn) ENABLED START -----*/ + + map<string,attr_val_t >::iterator it_val = att_value.find(attr.get_name()); + + if(it_val == att_value.end()) + { + Tango::Except::throw_exception( \ + (const char*)"Attribute Not Found", \ + (const char*)"Attribute Not Found", \ + __FUNCTION__, Tango::ERR); + } + + map<string,vector<attr_desc_t> >::iterator it_data = att_data.find(attr.get_name()); + + if(it_data == att_data.end()) + { + Tango::Except::throw_exception( \ + (const char*)"Attribute Not Found", \ + (const char*)"Attribute Not Found", \ + __FUNCTION__, Tango::ERR); + } + + for(vector<attr_desc_t>::iterator it_rem_attr = it_data->second.begin(); it_rem_attr != it_data->second.end(); it_rem_attr++) + { + DEBUG_STREAM << __FUNCTION__ << " looping " << it_rem_attr->remote_attr_name; + //map<string,vector<Tango::DevBoolean> >::iterator ll_attr_it = remote_att_value.find(it_rem_attr->remote_attr_name); + map<string,rem_val_t >::iterator ll_attr_it = remote_att_value.find(it_rem_attr->remote_attr_name); + if(ll_attr_it != remote_att_value.end()) + { + DEBUG_STREAM << __FUNCTION__ << " ll_attr_it->second.size()= " << ll_attr_it->second.val_b.size(); + DEBUG_STREAM << __FUNCTION__ << " " << attr.get_name() <<"["<< it_rem_attr->attr_index<<"]=" << it_rem_attr->remote_attr_name << "["<<it_rem_attr->remote_index<<"]"; + if(ll_attr_it->first != "state") + { + it_val->second.val[ it_rem_attr->attr_index ] = ll_attr_it->second.val_b.at(it_rem_attr->remote_index); + if(it_rem_attr->remote_index == 0) + it_val->second.val[ it_rem_attr->attr_index ] = true; + } + else + { + it_val->second.val[ it_rem_attr->attr_index ] = (ll_state == Tango::ON); + } + } + } + + // Set the attribute value + attr.set_value(&(it_val->second.val[0])); + + /*----- PROTECTED REGION END -----*/ // AccessConf::read_BoolScalarDyn +} +//-------------------------------------------------------- +/** + * Read BoolSpectrumDyn attribute + * Description: + * + * Data type: Tango::DevBoolean + * Attr type: Spectrum max = 1000 + */ +//-------------------------------------------------------- +void AccessConf::read_BoolSpectrumDyn(Tango::Attribute &attr) +{ + DEBUG_STREAM << "AccessConf::read_BoolSpectrumDyn(Tango::Attribute &attr) entering... " << endl; + /*----- PROTECTED REGION ID(AccessConf::read_BoolSpectrumDyn) ENABLED START -----*/ + + // Set the attribute value + map<string,attr_val_t >::iterator it_val = att_value.find(attr.get_name()); + + if(it_val == att_value.end()) + { + Tango::Except::throw_exception( \ + (const char*)"Attribute Not Found", \ + (const char*)"Attribute Not Found", \ + __FUNCTION__, Tango::ERR); + } + + map<string,vector<attr_desc_t> >::iterator it_data = att_data.find(attr.get_name()); + + if(it_data == att_data.end()) + { + Tango::Except::throw_exception( \ + (const char*)"Attribute Not Found", \ + (const char*)"Attribute Not Found", \ + __FUNCTION__, Tango::ERR); + } + + for(vector<attr_desc_t>::iterator it_rem_attr = it_data->second.begin(); it_rem_attr != it_data->second.end(); it_rem_attr++) + { + DEBUG_STREAM << __FUNCTION__ << " looping " << it_rem_attr->remote_attr_name; + //map<string,vector<Tango::DevBoolean> >::iterator ll_attr_it = remote_att_value.find(it_rem_attr->remote_attr_name); + map<string,rem_val_t >::iterator ll_attr_it = remote_att_value.find(it_rem_attr->remote_attr_name); + if(ll_attr_it != remote_att_value.end()) + { + //DEBUG_STREAM << __FUNCTION__ << " found value for " << it_rem_attr->remote_attr_name<<" attr idx="<<it_rem_attr->attr_index << " rem idx="<<it_rem_attr->remote_index; + it_val->second.val[ it_rem_attr->attr_index ] = ll_attr_it->second.val_b.at(it_rem_attr->remote_index); + DEBUG_STREAM << __FUNCTION__ << " " << attr.get_name() <<"["<< it_rem_attr->attr_index<<"]=" << it_rem_attr->remote_attr_name << "["<<it_rem_attr->remote_index<<"]="<<(int)ll_attr_it->second.val_b.at(it_rem_attr->remote_index); + if(it_rem_attr->remote_index == 0) + it_val->second.val[ it_rem_attr->attr_index ] = true; + if(attr.get_name() == "ValveStat") + { + int i=it_rem_attr->attr_index; + if(i==2 && it_rem_attr->remote_index == 0) + it_val->second.val[i]=true; + else if(i==4 && it_rem_attr->remote_index == 0 /*it_rem_attr->descr == "spare"*/) + it_val->second.val[i]=false; + else if(i>4 && i<=7) + it_val->second.val[i]=!it_val->second.val[i];//invert logic of ERR_ signals in order to have true -> error + } + } + } + + if(attr.get_name() == "ValveStat") + { + ValveStat_initialized = true; + } + + // Set the attribute value + attr.set_value(&(it_val->second.val[0]), it_data->second.size()); + + + if(attr.get_name() == "ValveStat" && ValveStat_initialized) + { + map<string,attr_val_t >::iterator it_val = att_value.find("ValveStat"); + + if((it_val->second.val[5])||(it_val->second.val[6])/*||(!valve_stat[2])*/) + {//error occurred + + state_event = Tango::FAULT; + set_state(state_event); + if(it_val->second.val[5]) + { + strcpy(status_str,"error opening"); + } + if(it_val->second.val[6]) + { + strcpy(status_str,"error closing"); + } + set_status(status_str); + DEBUG_STREAM << __FUNCTION__ << " -> PUSHING FAULT ("<<status_str<<") "<<endl; + try { + push_change_event("state"); + push_archive_event("state"); + //push_change_event("status"); + } catch(Tango::DevFailed &e) + { + DEBUG_STREAM << __func__<<": error pushing state="<<e.errors[0].desc<<endl; + } + // if(!valve_stat[2]){ + // set_status("pressure not ok"); + // } + } + else + {//no errors + if(it_val->second.val[0]){//opened? + if(it_val->second.val[1]) + {//closed? error + + state_event = Tango::FAULT; + set_state(state_event); + strcpy(status_str,"SW both closed"); + set_status(status_str); + DEBUG_STREAM << __FUNCTION__ << " -> PUSHING FAULT ("<<status_str<<") "<<endl; + try { + push_change_event("state"); + push_archive_event("state"); + //push_change_event("status"); + } catch(Tango::DevFailed &e) + { + DEBUG_STREAM << "AccessConf::always_executed_hook() error pushing state="<<e.errors[0].desc<<endl; + } + } + else + {//opened + + state_event = Tango::OPEN; + set_state(state_event); + strcpy(status_str,"----"); + set_status(status_str); + DEBUG_STREAM << __FUNCTION__ << " -> PUSHING OPEN ("<<status_str<<") "<<endl; + try { + push_change_event("state"); + push_archive_event("state"); + //push_change_event("status"); + } catch(Tango::DevFailed &e) + { + DEBUG_STREAM << "AccessConf::always_executed_hook() error pushing state="<<e.errors[0].desc<<endl; + } + } + } + else + { + if(it_val->second.val[1]) + {//closed? + + state_event = Tango::CLOSE; + set_state(state_event); + strcpy(status_str,"----"); + set_status(status_str); + DEBUG_STREAM << __FUNCTION__ << " -> PUSHING CLOSE ("<<status_str<<") "<<endl; + try { + push_change_event("state"); + push_archive_event("state"); + //push_change_event("status"); + } catch(Tango::DevFailed &e) + { + DEBUG_STREAM << "AccessConf::always_executed_hook() error pushing state="<<e.errors[0].desc<<endl; + } + } + else + {//moving + + state_event = Tango::MOVING; + set_state(state_event); + strcpy(status_str,"SW both opened"); + set_status(status_str); + DEBUG_STREAM << __FUNCTION__ << " -> PUSHING MOVING ("<<status_str<<") "<<endl; + try { + push_change_event("state"); + push_archive_event("state"); + //push_change_event("status"); + } catch(Tango::DevFailed &e) + { + DEBUG_STREAM << "AccessConf::always_executed_hook() error pushing state="<<e.errors[0].desc<<endl; + } + } + } +// if(is_local_ctrl){ +// set_status("local"); +// } + if(cutoff_ind >=0 && cutoff_ind < MAX_ATTR_SIZE) + { + if(!it_val->second.val[cutoff_ind]){ + strcpy(status_str,"cutoff"); + set_status(status_str); + try { + //push_change_event("status", attr_status_read, 1, 0, false); + } catch(Tango::DevFailed &e) + { + DEBUG_STREAM << "AccessConf::always_executed_hook() error pushing status="<<e.errors[0].desc<<endl; + } + } + } + } + } + + /*----- PROTECTED REGION END -----*/ // AccessConf::read_BoolSpectrumDyn +} +//-------------------------------------------------------- +/** + * Read StringSpectrumDyn attribute + * Description: + * + * Data type: Tango::DevString + * Attr type: Spectrum max = 1000 + */ +//-------------------------------------------------------- +void AccessConf::read_StringSpectrumDyn(Tango::Attribute &attr) +{ + //DEBUG_STREAM << "AccessConf::read_StringSpectrumDyn(Tango::Attribute &attr) entering... " << endl; + /*----- PROTECTED REGION ID(AccessConf::read_StringSpectrumDyn) ENABLED START -----*/ + + // Set the attribute value + map<string,attr_val_string_t >::iterator it_val = att_value_string.find(attr.get_name()); + + if(it_val == att_value_string.end()) + { + Tango::Except::throw_exception( \ + (const char*)"Attribute 1 Not Found", \ + (const char*)"Attribute 1 Not Found", \ + __FUNCTION__, Tango::ERR); + } + + map<string,vector<attr_desc_t> >::iterator it_data = att_data.find(attr.get_name()); + + if(it_data == att_data.end()) + { + Tango::Except::throw_exception( \ + (const char*)"Attribute 2 Not Found", \ + (const char*)"Attribute 2 Not Found", \ + __FUNCTION__, Tango::ERR); + } + //DEBUG_STREAM << __FUNCTION__ << " 0"; + map<string,rem_val_t >::iterator ll_attr_it; + for(vector<attr_desc_t>::iterator it_rem_attr = it_data->second.begin(); it_rem_attr != it_data->second.end(); it_rem_attr++) + { + //DEBUG_STREAM << __FUNCTION__ << " looping " << it_rem_attr->remote_attr_name; + //map<string,vector<Tango::DevBoolean> >::iterator ll_attr_it = remote_att_value.find(it_rem_attr->remote_attr_name); + ll_attr_it = remote_att_value.find(it_rem_attr->remote_attr_name); + //DEBUG_STREAM << __FUNCTION__ << " 1"; + if(ll_attr_it != remote_att_value.end()) + { + //DEBUG_STREAM << __FUNCTION__ << " 2 it_rem_attr->attr_index="<<it_rem_attr->attr_index<<" it_rem_attr->remote_index="<<it_rem_attr->remote_index; + strcpy(&(it_val->second.val[ it_rem_attr->attr_index ][0]),ll_attr_it->second.val_s.at(it_rem_attr->remote_index).c_str()); + //DEBUG_STREAM << __FUNCTION__ << " " << attr.get_name() <<"["<< it_rem_attr->attr_index<<"]=" << it_rem_attr->remote_attr_name << "["<<it_rem_attr->remote_index<<"]"; + //DEBUG_STREAM << "ind=" << it_rem_attr->attr_index << " string=" << (char *) (it_val->second.val[ it_rem_attr->attr_index]) << " ind rem=" << it_rem_attr->remote_index << " rem size="<<ll_attr_it->second.val_s.size(); + attr_StringSpectrumDyn_read[it_rem_attr->attr_index] = (char *) (it_val->second.val[ it_rem_attr->attr_index]); + //DEBUG_STREAM << __FUNCTION__ << " 3"; + } + } + + //DEBUG_STREAM << __FUNCTION__ << " before set_value"; + // Set the attribute value + attr.set_value(attr_StringSpectrumDyn_read, it_data->second.size()); + //DEBUG_STREAM << __FUNCTION__ << " after set_value"; + /*----- PROTECTED REGION END -----*/ // AccessConf::read_BoolSpectrumDyn +} + +//-------------------------------------------------------- +/** + * Read BoolScalarDyn attribute + * Description: + * + * Data type: Tango::DevBoolean + * Attr type: Scalar + */ +//-------------------------------------------------------- +void AccessConf::read_Version(Tango::Attribute &attr) +{ + //DEBUG_STREAM << "AccessConf::read_BoolScalarDyn(Tango::Attribute &attr) entering... " << endl; + /*----- PROTECTED REGION ID(AccessConf::read_BoolScalarDyn) ENABLED START -----*/ + + uint16_t plcver=0; + map<string,rem_val_t >::iterator ll_attr_it = remote_att_value.find("Stat_image"); + if(ll_attr_it != remote_att_value.end()) + { + for(int i=0; i<16; i++) + { + plcver |= ll_attr_it->second.val_b.at(16+i) << i; + DEBUG_STREAM << __FUNCTION__ << " now plcver=" << plcver; + } + } + + string tmp(srvver); + size_t pos = tmp.find("Name: "); + tmp = tmp.substr(pos+strlen("Name: ")); + + sprintf(version_str,"srv_ver:%s plc_ver:%d",tmp.c_str(),plcver); + + attr_Version_read[0] = (char *)version_str; + // Set the attribute value + attr.set_value(attr_Version_read); + + /*----- PROTECTED REGION END -----*/ // AccessConf::read_BoolScalarDyn +} + +//-------------------------------------------------------- +/** + * Method : AccessConf::AccessConfClass::add_dynamic_attributes() + * Description : Create the dynamic attributes if any + * for specified device. + */ +//-------------------------------------------------------- +void AccessConf::add_dynamic_attributes() +{ + /*----- PROTECTED REGION ID(AccessConf::Class::add_dynamic_attributes) ENABLED START -----*/ + + // Add your own code to create and add dynamic attributes if any + DEBUG_STREAM << __FUNCTION__ << " entering..."; + + if (attr_config_prop.empty() == false) + { + DEBUG_STREAM << __FUNCTION__ << " going to create from device property..."; + create_dynamic_attributes(attr_config_prop); + } + + if (attr_config_file.empty() == false) + { + DEBUG_STREAM << __FUNCTION__ << " going to create from file..."; + vector<string> attr_config; + string line; + attr_config.clear(); + ifstream infile (attr_config_file.c_str(), ios_base::in); + while (getline(infile, line, '\n')) + { + attr_config.push_back (line); + } + infile.close(); + DEBUG_STREAM <<__FUNCTION__ << "Read " << attr_config.size() << " lines.\n"; + create_dynamic_attributes(attr_config); + } + + + //if(done something) + { + map<string,vector<attr_desc_t> >::iterator attr_it; + for(attr_it=att_data.begin(); attr_it != att_data.end(); attr_it++) + { + Tango::Attr *att; + if (attr_it->second.size() == 1 && (attr_it->second.begin())->type == "bool") + { + att = new BoolScalarDynAttrib(attr_it->first); + } + else if((attr_it->second.begin())->type == "bool") + { + att = new BoolSpectrumDynAttrib(attr_it->first, attr_it->second.size()); + } + else if((attr_it->second.begin())->type == "string") + { + att = new StringSpectrumDynAttrib(attr_it->first, attr_it->second.size()); + } + + add_attribute(att); + set_change_event(attr_it->first, true, false); + set_archive_event(attr_it->first, true, true); + sort(attr_it->second.begin(), attr_it->second.end(),compare_attr_index); + } + } + created_attr = true; + init_attributeprop(); + + /*----- PROTECTED REGION END -----*/ // AccessConf::Class::add_dynamic_attributes + +} + +//-------------------------------------------------------- +/** + * Method : AccessConf::ControlBoxClass::create_dynamic_attributes() + * Description : Create the dynamic attributes if any + * for specified device. + */ +//-------------------------------------------------------- +void AccessConf::create_dynamic_attributes(vector<string> attr_config) +{ + DEBUG_STREAM << __FUNCTION__ << " entering..."; + + attr_val_t tmp_val; + vector<string> filter; + for(unsigned int i=0; i<MAX_ATTR_SIZE; i++) + tmp_val.val[i] = false; + attr_val_string_t tmp_val_string; + for(unsigned int i=0; i<MAX_ATTR_SIZE; i++) + tmp_val_string.val[i][0] = 0; + + for (unsigned int i = 0;i < attr_config.size();i++) + { + vector<string> results; + string_explode(attr_config[i], ":", &results); + if((results.size() == 6 || results.size() == 7) && results[0] == "attr" && results[5] != "string") + { + attr_desc_t tmp; + tmp.attr_index=atoi(results[2].c_str()); + tmp.remote_attr_name=results[3]; + //tmp.remote_index=atoi(results[4].c_str()); + int px1, px2; + sscanf(results[4].c_str(), "%d.%d", &px1, &px2); //byte.bit + tmp.remote_index=(px1)*8+px2; + tmp.descr=results[5]; + tmp.comment=(results.size() == 7) ? results[6] : ""; + tmp.type="bool"; + map<string,vector<attr_desc_t> >::iterator f = att_data.find(results[1]); + if(f!=att_data.end()) + { + f->second.push_back(tmp); + } + else + { + vector<attr_desc_t> tmp_v; + tmp_v.push_back(tmp); + att_data.insert(make_pair(results[1],tmp_v)); + att_value.insert(make_pair(results[1],tmp_val)); + } + vector<string>::iterator it=find(remote_attr.begin(), remote_attr.end(), results[3]); + if(it == remote_attr.end()) + { + vector<Tango::DevBoolean> tmp_rem_v_b; + vector<string> tmp_rem_v_s; + rem_val_t tmp_rem; + tmp_rem.val_b = tmp_rem_v_b; + tmp_rem.val_s = tmp_rem_v_s; + tmp_rem.loc_attr_name.push_back(results[1]); + remote_attr.push_back(results[3]); + remote_type.insert(make_pair(results[3], "bool")); + remote_att_value.insert(make_pair(results[3],tmp_rem)); + unsigned int tmp_eid = lldevice->subscribe_event(results[3], Tango::CHANGE_EVENT, &ecb, filter,true); //stateless subscription (doesn't fail if server not running) + DEBUG_STREAM << __func__<<": subscribed change event for "<<results[3]; + eid.push_back(tmp_eid); + } + //remote attribute already used + else + { + map<string,rem_val_t >::iterator it_rem_val = remote_att_value.find(results[3]); + if(it_rem_val != remote_att_value.end()) + { + if(find(it_rem_val->second.loc_attr_name.begin(),it_rem_val->second.loc_attr_name.end(),results[1]) == it_rem_val->second.loc_attr_name.end()) + it_rem_val->second.loc_attr_name.push_back(results[1]); + } + } + } + else if(results.size() == 6 && results[0] == "attr" && results[5] == "string") + { + attr_desc_t tmp; + tmp.attr_index=atoi(results[2].c_str()); + tmp.remote_attr_name=results[3]; + tmp.remote_index=atoi(results[4].c_str()); + tmp.descr=results[5]; + tmp.comment=""; + tmp.type="string"; + map<string,vector<attr_desc_t> >::iterator f = att_data.find(results[1]); + if(f!=att_data.end()) + { + f->second.push_back(tmp); + } + else + { + vector<attr_desc_t> tmp_v; + tmp_v.push_back(tmp); + att_data.insert(make_pair(results[1],tmp_v)); + att_value_string.insert(make_pair(results[1],tmp_val_string)); + } + vector<string>::iterator it=find(remote_attr.begin(), remote_attr.end(), results[3]); + if(it == remote_attr.end()) + { + vector<Tango::DevBoolean> tmp_rem_v_b; + vector<string> tmp_rem_v_s; + rem_val_t tmp_rem; + tmp_rem.val_b = tmp_rem_v_b; + tmp_rem.val_s = tmp_rem_v_s; + tmp_rem.loc_attr_name.push_back(results[1]); + remote_attr.push_back(results[3]); + remote_type.insert(make_pair(results[3], "string")); + remote_att_value.insert(make_pair(results[3],tmp_rem)); + unsigned int tmp_eid = lldevice->subscribe_event(results[3], Tango::CHANGE_EVENT, &ecb, filter,true); //stateless subscription (doesn't fail if server not running) + DEBUG_STREAM << __func__<<": subscribed change event for "<<results[3]; + eid.push_back(tmp_eid); + } + //remote attribute already used + else + { + map<string,rem_val_t >::iterator it_rem_val = remote_att_value.find(results[3]); + if(it_rem_val != remote_att_value.end()) + { + if(find(it_rem_val->second.loc_attr_name.begin(),it_rem_val->second.loc_attr_name.end(),results[1]) == it_rem_val->second.loc_attr_name.end()) + it_rem_val->second.loc_attr_name.push_back(results[1]); + } + } + } + else if((results.size() == 5 || results.size() == 9) && results[0] == "cmd") + { + cmd_desc_t tmp; + DEBUG_STREAM << __FUNCTION__ << " cmd, name="<<results[1]; + tmp.remote_cmd_name=results[2]; + tmp.cmd_code=atoi(results[3].c_str()); + //tmp.cmd_offset=atoi(results[4].c_str()); + int px1, px2; + sscanf(results[4].c_str(), "%d.%d", &px1, &px2); //byte.bit + tmp.cmd_offset=(px1)*8+px2; + if(results.size() == 9) + { + //tmp.cmd_offset2=atoi(results[5].c_str()); + sscanf(results[5].c_str(), "%d.%d", &px1, &px2); //byte.bit + tmp.cmd_offset2=(px1)*8+px2; + //tmp.cmd_offset3=atoi(results[6].c_str()); + sscanf(results[6].c_str(), "%d.%d", &px1, &px2); //byte.bit + tmp.cmd_offset3=(px1)*8+px2; + //tmp.cmd_offset4=atoi(results[7].c_str()); + sscanf(results[7].c_str(), "%d.%d", &px1, &px2); //byte.bit + tmp.cmd_offset4=(px1)*8+px2; + tmp.pass=results[8]; + } + else + { + tmp.cmd_offset2=-1; + tmp.cmd_offset3=-1; + tmp.cmd_offset4=-1; + tmp.pass=""; + } + //DEBUG_STREAM << __FUNCTION__ << " cmd name="<<tmp.remote_cmd_name; + map<string,cmd_desc_t>::iterator f = cmd_data.find(results[1]); + if(f!=cmd_data.end()) + { + //TODO: alert duplicate name + } + else + { + cmd_data.insert(make_pair(results[1],tmp)); + //DEBUG_STREAM << __FUNCTION__ << " inserted in map cmd name="<<tmp.remote_cmd_name; + switch(tmp.cmd_code) + { +#ifdef _OLD_101 + case 101: + create_dynamic_command(results[1].c_str(), Tango::DEV_USHORT, Tango::DEV_VOID, 1, 0); + break; +#endif + case 102: + create_dynamic_command(results[1].c_str(), Tango::DEV_VOID, Tango::DEV_VOID, 0, 0); + break; + case 101: + case 103: + if(results.size() == 5) + create_dynamic_command(results[1].c_str(), Tango::DEV_VOID, Tango::DEV_VOID, 0, 0); + else + create_dynamic_command(results[1].c_str(), Tango::DEVVAR_STRINGARRAY, Tango::DEV_VOID, 0, 0); + break; + default: + create_dynamic_command(results[1].c_str(), Tango::DEV_VOID, Tango::DEV_VOID, 0, 0); + break; + } + } + } + } + //DEBUG_STREAM << __FUNCTION__ << " exiting..."; +} + + + +//======================================================== +// Command execution methods +//======================================================== + + + /*----- PROTECTED REGION ID(AccessConf::namespace_ending) ENABLED START -----*/ + + // Additional Methods + +Tango::DevState AccessConf::dev_state() +{ + DEBUG_STREAM << __func__<<": entering..."; +// Tango::DevState result; + if(!ValveStat_initialized) + { + map<string,attr_val_t >::iterator it_val = att_value.find("ValveStat"); + + if(it_val == att_value.end()) + { + return state_event; + } + + map<string,vector<attr_desc_t> >::iterator it_data = att_data.find("ValveStat"); + + if(it_data == att_data.end()) + { + return state_event; + } + + + try + { + vector<Tango::DeviceAttribute> *Dout; + //Tango::DeviceAttribute Dout; + + Dout = lldevice->read_attributes(remote_attr); + //Dout = lldevice->read_attribute(remote_attr[0]); + + //map<string,vector<Tango::DevBoolean> >::iterator attr_it; + map<string,rem_val_t >::iterator attr_it; + unsigned int i =0; + for(attr_it=remote_att_value.begin(); attr_it != remote_att_value.end(); attr_it++) + { + if(attr_it->first != "state") + { + map<string,string>::iterator it_type = remote_type.find(attr_it->first); + DEBUG_STREAM << __FUNCTION__ << " remote type=" << it_type->second; + if(it_type != remote_type.end() && it_type->second == "bool") + { + (*Dout)[i++] >> attr_it->second.val_b; //TODO: string + //Dout >> attr_it->second.val_b; //TODO: string + DEBUG_STREAM << __FUNCTION__ << " remote type=" << it_type->second << " name="<<attr_it->first<<" copyed="<<attr_it->second.val_b.size();// << " dout len="<<(*Dout)[i-1].get_dim_x(); + } + else if(it_type != remote_type.end() && it_type->second == "string") + { + //(*Dout)[i++] >> attr_it->second.val_s; //TODO: string + DEBUG_STREAM << __FUNCTION__ << " remote type=" << it_type->second << " name="<<attr_it->first<<" copyed="<<attr_it->second.val_s.size();// << " dout len="<<(*Dout)[i-1].get_dim_x(); + Tango::DeviceAttribute Dout2 = lldevice->read_attribute(attr_it->first.c_str()); + Dout2 >> attr_it->second.val_s; //TODO: string + } + } + else + { + (*Dout)[i++] >> ll_state; + DEBUG_STREAM << __FUNCTION__ << " read state=" << (int)ll_state; + } + } + delete Dout; + } + catch(Tango::DevFailed &e) + { + ll_state = Tango::FAULT; + stringstream tmp; + tmp << "error reading low level attributes err: " << e.errors[0].desc; + INFO_STREAM << __FUNCTION__ << ": " << tmp.str(); + } + + + for(vector<attr_desc_t>::iterator it_rem_attr = it_data->second.begin(); it_rem_attr != it_data->second.end(); it_rem_attr++) + { + DEBUG_STREAM << __FUNCTION__ << " looping " << it_rem_attr->remote_attr_name; + //map<string,vector<Tango::DevBoolean> >::iterator ll_attr_it = remote_att_value.find(it_rem_attr->remote_attr_name); + map<string,rem_val_t >::iterator ll_attr_it = remote_att_value.find(it_rem_attr->remote_attr_name); + if(ll_attr_it != remote_att_value.end()) + { + //DEBUG_STREAM << __FUNCTION__ << " found value for " << it_rem_attr->remote_attr_name<<" attr idx="<<it_rem_attr->attr_index << " rem idx="<<it_rem_attr->remote_index; + it_val->second.val[ it_rem_attr->attr_index ] = ll_attr_it->second.val_b.at(it_rem_attr->remote_index); + DEBUG_STREAM << __FUNCTION__ << " ValveStat["<< it_rem_attr->attr_index<<"]=" << it_rem_attr->remote_attr_name << "["<<it_rem_attr->remote_index<<"]="<<(int)ll_attr_it->second.val_b.at(it_rem_attr->remote_index); + if(it_rem_attr->remote_index == 0) + it_val->second.val[ it_rem_attr->attr_index ] = true; + if(it_data->first == "ValveStat") + { + int i=it_rem_attr->attr_index; + if(i==2 && it_rem_attr->remote_index == 0) + it_val->second.val[i]=true; + else if(i==4 && it_rem_attr->remote_index == 0 /*it_rem_attr->descr == "spare"*/) + it_val->second.val[i]=false; + else if(i>4 && i<=7) + it_val->second.val[i]=!it_val->second.val[i];//invert logic of ERR_ signals in order to have true -> error + } + } + } + + ValveStat_initialized = true; + + + if((it_val->second.val[5])||(it_val->second.val[6])/*||(!valve_stat[2])*/) + {//error occurred + + state_event = Tango::FAULT; + set_state(state_event); + if(it_val->second.val[5]) + { + strcpy(status_str,"error opening"); + } + if(it_val->second.val[6]) + { + strcpy(status_str,"error closing"); + } + set_status(status_str); + DEBUG_STREAM << __FUNCTION__ << " -> PUSHING FAULT ("<<status_str<<") "<<endl; + try { + push_change_event("state"); + push_archive_event("state"); + //push_change_event("status"); + } catch(Tango::DevFailed &e) + { + DEBUG_STREAM << __func__<<": error pushing state="<<e.errors[0].desc<<endl; + } + // if(!valve_stat[2]){ + // set_status("pressure not ok"); + // } + } + else + {//no errors + if(it_val->second.val[0]){//opened? + if(it_val->second.val[1]) + {//closed? error + + state_event = Tango::FAULT; + set_state(state_event); + strcpy(status_str,"SW both closed"); + set_status(status_str); + DEBUG_STREAM << __FUNCTION__ << " -> PUSHING FAULT ("<<status_str<<") "<<endl; + try { + push_change_event("state"); + push_archive_event("state"); + //push_change_event("status"); + } catch(Tango::DevFailed &e) + { + DEBUG_STREAM << "AccessConf::always_executed_hook() error pushing state="<<e.errors[0].desc<<endl; + } + } + else + {//opened + + state_event = Tango::OPEN; + set_state(state_event); + strcpy(status_str,"----"); + set_status(status_str); + DEBUG_STREAM << __FUNCTION__ << " -> PUSHING OPEN ("<<status_str<<") "<<endl; + try { + push_change_event("state"); + push_archive_event("state"); + //push_change_event("status"); + } catch(Tango::DevFailed &e) + { + DEBUG_STREAM << "AccessConf::always_executed_hook() error pushing state="<<e.errors[0].desc<<endl; + } + } + } + else + { + if(it_val->second.val[1]) + {//closed? + + state_event = Tango::CLOSE; + set_state(state_event); + strcpy(status_str,"----"); + set_status(status_str); + DEBUG_STREAM << __FUNCTION__ << " -> PUSHING CLOSE ("<<status_str<<") "<<endl; + try { + push_change_event("state"); + push_archive_event("state"); + //push_change_event("status"); + } catch(Tango::DevFailed &e) + { + DEBUG_STREAM << "AccessConf::always_executed_hook() error pushing state="<<e.errors[0].desc<<endl; + } + } + else + {//moving + + state_event = Tango::MOVING; + set_state(state_event); + strcpy(status_str,"SW both opened"); + set_status(status_str); + DEBUG_STREAM << __FUNCTION__ << " -> PUSHING MOVING ("<<status_str<<") "<<endl; + try { + push_change_event("state"); + push_archive_event("state"); + //push_change_event("status"); + } catch(Tango::DevFailed &e) + { + DEBUG_STREAM << "AccessConf::always_executed_hook() error pushing state="<<e.errors[0].desc<<endl; + } + + + } + } + // if(is_local_ctrl){ + // set_status("local"); + // } + if(cutoff_ind >=0 && cutoff_ind < MAX_ATTR_SIZE) + { + if(!it_val->second.val[cutoff_ind]){ + strcpy(status_str,"cutoff"); + set_status(status_str); + try { + //push_change_event("status"); + } catch(Tango::DevFailed &e) + { + DEBUG_STREAM << "AccessConf::always_executed_hook() error pushing status="<<e.errors[0].desc<<endl; + } + } + } + } + + } + return state_event; +} + +Tango::ConstDevString AccessConf::dev_status() +{ + DEBUG_STREAM << __func__<<": entering..."; + Tango::ConstDevString result; + //sprintf(status_str,"The device is in UNKNOWN state."); + result = status_str; + + if(!ValveStat_initialized) + { + map<string,attr_val_t >::iterator it_val = att_value.find("ValveStat"); + + if(it_val == att_value.end()) + { + return result; + } + + map<string,vector<attr_desc_t> >::iterator it_data = att_data.find("ValveStat"); + + if(it_data == att_data.end()) + { + return result; + } + + try + { + vector<Tango::DeviceAttribute> *Dout; + //Tango::DeviceAttribute Dout; + + Dout = lldevice->read_attributes(remote_attr); + //Dout = lldevice->read_attribute(remote_attr[0]); + + //map<string,vector<Tango::DevBoolean> >::iterator attr_it; + map<string,rem_val_t >::iterator attr_it; + unsigned int i =0; + for(attr_it=remote_att_value.begin(); attr_it != remote_att_value.end(); attr_it++) + { + if(attr_it->first != "state") + { + map<string,string>::iterator it_type = remote_type.find(attr_it->first); + DEBUG_STREAM << __FUNCTION__ << " remote type=" << it_type->second; + if(it_type != remote_type.end() && it_type->second == "bool") + { + (*Dout)[i++] >> attr_it->second.val_b; //TODO: string + //Dout >> attr_it->second.val_b; //TODO: string + DEBUG_STREAM << __FUNCTION__ << " remote type=" << it_type->second << " name="<<attr_it->first<<" copyed="<<attr_it->second.val_b.size();// << " dout len="<<(*Dout)[i-1].get_dim_x(); + } + else if(it_type != remote_type.end() && it_type->second == "string") + { + //(*Dout)[i++] >> attr_it->second.val_s; //TODO: string + DEBUG_STREAM << __FUNCTION__ << " remote type=" << it_type->second << " name="<<attr_it->first<<" copyed="<<attr_it->second.val_s.size();// << " dout len="<<(*Dout)[i-1].get_dim_x(); + Tango::DeviceAttribute Dout2 = lldevice->read_attribute(attr_it->first.c_str()); + Dout2 >> attr_it->second.val_s; //TODO: string + } + } + else + { + (*Dout)[i++] >> ll_state; + DEBUG_STREAM << __FUNCTION__ << " read state=" << (int)ll_state; + } + } + delete Dout; + } + catch(Tango::DevFailed &e) + { + ll_state = Tango::FAULT; + stringstream tmp; + tmp << "error reading low level attributes err: " << e.errors[0].desc; + INFO_STREAM << __FUNCTION__ << ": " << tmp.str(); + } + + for(vector<attr_desc_t>::iterator it_rem_attr = it_data->second.begin(); it_rem_attr != it_data->second.end(); it_rem_attr++) + { + DEBUG_STREAM << __FUNCTION__ << " looping " << it_rem_attr->remote_attr_name; + //map<string,vector<Tango::DevBoolean> >::iterator ll_attr_it = remote_att_value.find(it_rem_attr->remote_attr_name); + map<string,rem_val_t >::iterator ll_attr_it = remote_att_value.find(it_rem_attr->remote_attr_name); + if(ll_attr_it != remote_att_value.end()) + { + //DEBUG_STREAM << __FUNCTION__ << " found value for " << it_rem_attr->remote_attr_name<<" attr idx="<<it_rem_attr->attr_index << " rem idx="<<it_rem_attr->remote_index; + it_val->second.val[ it_rem_attr->attr_index ] = ll_attr_it->second.val_b.at(it_rem_attr->remote_index); + DEBUG_STREAM << __FUNCTION__ << " ValveStat["<< it_rem_attr->attr_index<<"]=" << it_rem_attr->remote_attr_name << "["<<it_rem_attr->remote_index<<"]="<<(int)ll_attr_it->second.val_b.at(it_rem_attr->remote_index); + if(it_rem_attr->remote_index == 0) + it_val->second.val[ it_rem_attr->attr_index ] = true; + if(it_data->first == "ValveStat") + { + int i=it_rem_attr->attr_index; + if(i==2 && it_rem_attr->remote_index == 0) + it_val->second.val[i]=true; + else if(i==4 && it_rem_attr->remote_index == 0 /*it_rem_attr->descr == "spare"*/) + it_val->second.val[i]=false; + else if(i>4 && i<=7) + it_val->second.val[i]=!it_val->second.val[i];//invert logic of ERR_ signals in order to have true -> error + } + } + } + + ValveStat_initialized = true; + + + if((it_val->second.val[5])||(it_val->second.val[6])/*||(!valve_stat[2])*/) + {//error occurred + + state_event = Tango::FAULT; + set_state(state_event); + if(it_val->second.val[5]) + { + strcpy(status_str,"error opening"); + } + if(it_val->second.val[6]) + { + strcpy(status_str,"error closing"); + } + set_status(status_str); + DEBUG_STREAM << __FUNCTION__ << " -> PUSHING FAULT ("<<status_str<<") "<<endl; + try { + push_change_event("state"); + push_archive_event("state"); + //push_change_event("status"); + } catch(Tango::DevFailed &e) + { + DEBUG_STREAM << __func__<<": error pushing state="<<e.errors[0].desc<<endl; + } + // if(!valve_stat[2]){ + // set_status("pressure not ok"); + // } + } + else + {//no errors + if(it_val->second.val[0]){//opened? + if(it_val->second.val[1]) + {//closed? error + + state_event = Tango::FAULT; + set_state(state_event); + strcpy(status_str,"SW both closed"); + set_status(status_str); + DEBUG_STREAM << __FUNCTION__ << " -> PUSHING FAULT ("<<status_str<<") "<<endl; + try { + push_change_event("state"); + push_archive_event("state"); + //push_change_event("status"); + } catch(Tango::DevFailed &e) + { + DEBUG_STREAM << "AccessConf::always_executed_hook() error pushing state="<<e.errors[0].desc<<endl; + } + } + else + {//opened + + state_event = Tango::OPEN; + set_state(state_event); + strcpy(status_str,"----"); + set_status(status_str); + DEBUG_STREAM << __FUNCTION__ << " -> PUSHING OPEN ("<<status_str<<") "<<endl; + try { + push_change_event("state"); + push_archive_event("state"); + //push_change_event("status"); + } catch(Tango::DevFailed &e) + { + DEBUG_STREAM << "AccessConf::always_executed_hook() error pushing state="<<e.errors[0].desc<<endl; + } + } + } + else + { + if(it_val->second.val[1]) + {//closed? + + state_event = Tango::CLOSE; + set_state(state_event); + strcpy(status_str,"----"); + set_status(status_str); + DEBUG_STREAM << __FUNCTION__ << " -> PUSHING CLOSE ("<<status_str<<") "<<endl; + try { + push_change_event("state"); + push_archive_event("state"); + //push_change_event("status"); + } catch(Tango::DevFailed &e) + { + DEBUG_STREAM << "AccessConf::always_executed_hook() error pushing state="<<e.errors[0].desc<<endl; + } + } + else + {//moving + + state_event = Tango::MOVING; + set_state(state_event); + strcpy(status_str,"SW both opened"); + set_status(status_str); + DEBUG_STREAM << __FUNCTION__ << " -> PUSHING MOVING ("<<status_str<<") "<<endl; + try { + push_change_event("state"); + push_archive_event("state"); + //push_change_event("status"); + } catch(Tango::DevFailed &e) + { + DEBUG_STREAM << "AccessConf::always_executed_hook() error pushing state="<<e.errors[0].desc<<endl; + } + } + } + // if(is_local_ctrl){ + // set_status("local"); + // } + if(cutoff_ind >=0 && cutoff_ind < MAX_ATTR_SIZE) + { + if(!it_val->second.val[cutoff_ind]){ + strcpy(status_str,"cutoff"); + set_status(status_str); + try { + //push_change_event("status"); + } catch(Tango::DevFailed &e) + { + DEBUG_STREAM << "AccessConf::always_executed_hook() error pushing status="<<e.errors[0].desc<<endl; + } + } + } + } + + } + return result; +} + + + +//+------------------------------------------------------------------ +/** + * method: AccessConf::string_explode + * Explode a string +*/ +//+------------------------------------------------------------------ +void AccessConf::string_explode(string str, string separator, vector<string>* results) +{ + size_t found; + + found = str.find_first_of(separator); + while(found != string::npos) { + if(found > 0) { + results->push_back(str.substr(0,found)); + } + str = str.substr(found+1); + found = str.find_first_of(separator); + } + if(str.length() > 0) { + results->push_back(str); + } + +} + +//+------------------------------------------------------------------ +/** + * method: AccessConf::init_attributeprop + * + * description: + * + * + */ +//+------------------------------------------------------------------ +void AccessConf::init_attributeprop() +{ + + //DEBUG_STREAM << __FUNCTION__ << " entering..."; + Tango::Database *db = new Tango::Database(); + vector <Tango::DbData> vdb_datastat; + + for(map<string,vector<attr_desc_t> >::iterator it_att = att_data.begin(); it_att != att_data.end(); it_att++) + { + vector <string> lastat; + vector <string> destat; + vector <string> costat; + for(vector<attr_desc_t>::iterator it_v = it_att->second.begin(); it_v != it_att->second.end(); it_v++) + { + lastat.push_back(it_v->descr); + stringstream tmp2; + tmp2 << int(it_v->remote_index /8) << "." << it_v->remote_index %8 << " - " << it_v->comment; + costat.push_back(tmp2.str()); + stringstream tmp; + tmp << low_level_srv << "/" << it_v->remote_attr_name << "[" << it_v->remote_index << "]"; + destat.push_back(tmp.str()); + //DEBUG_STREAM << __FUNCTION__ << ": label=" << it_v->descr << " pos=" << tmp.str(); + } + Tango::DbData db_datastat; + Tango::DbDatum db_stat(it_att->first), lab_stat("labels"), des_stat("positions"), com_stat("comments"); + db_stat << (short int) 3; + db_datastat.push_back(db_stat); + lab_stat << lastat; + des_stat << destat; + com_stat << costat; + db_datastat.push_back(lab_stat); + db_datastat.push_back(des_stat); + db_datastat.push_back(com_stat); + vdb_datastat.push_back(db_datastat); + } + vector<Tango::DbData>::iterator ite; + + try { + db->set_timeout_millis(10000); + for( ite=vdb_datastat.begin() ; ite < vdb_datastat.end(); ite++ ){ + db->put_device_attribute_property(get_name(), *ite); + } + } catch (Tango::DevFailed &e) { + INFO_STREAM << "Intlkconf::init_attributeprop() init attributeprop failed"<<endl; + Tango::Except::print_exception(e); + } + delete db; +} + +long AccessConf::create_dynamic_command(const char* cmd_name, Tango::CmdArgType type_in, Tango::CmdArgType type_out, long size_in, long size_out) +{ + + std::vector< Tango::Command* >& command_list = get_device_class()->get_command_list(); + bool found = false; + std::vector< Tango::Command* >::iterator it; + for(it=command_list.begin(); it!= command_list.end(); it++) + { + if((*it)->get_name()==string(cmd_name)) + { + found = true; + break; + } + } + if(!found) + command_list.push_back(new CmdClass(cmd_name, + type_in, type_out, + "argin", + "argout", + Tango::OPERATOR, + size_in, + this)); + + return 0; +} + +void AccessConf::extract_values(Tango::DeviceAttribute *attr_value, vector<Tango::DevBoolean> &v_bo, vector<string> &v_string) +{ + + v_bo.clear(); + v_string.clear(); + + if (attr_value->get_type() == Tango::DEV_BOOLEAN) + { + *(attr_value) >> v_bo; + } + else if (attr_value->get_type() == Tango::DEV_STRING) + { + *(attr_value) >> v_string; + } + else + { + ostringstream o; + o << "unknown type=" << (int)attr_value->get_type() << ends; + throw o.str(); + } +} + +/*************************************************************************** + + CmdClass class + +***************************************************************************/ +CORBA::Any *CmdClass::execute(Tango::DeviceImpl *device,const CORBA::Any &in_any) +{ + + cout << "CmdClass::" << get_name() << ": entering..." << endl; + + //const Tango::DevVarLongArray *argin; + //extract(in_any, argin); + + Tango::DevShort argin; + mydevice = ((AccessConf*)device); + map< string,cmd_desc_t >::iterator f; + + /* for(f=mydevice->cmd_data.begin(); f!=mydevice->cmd_data.end(); f++) + { + cout << "cmd name="<<f->first<<" code="<<f->second.cmd_code<<" offset="<<f->second.cmd_offset<<endl; + }*/ + + if(mydevice!=0) + { + f = mydevice->cmd_data.find(get_name()); + } + + if(!mydevice || f== mydevice->cmd_data.end()) + { + Tango::Except::throw_exception( \ + (const char*)"Command Error", \ + (const char*)"Command Not Found", \ + __FUNCTION__, Tango::ERR); + } + + switch(f->second.cmd_code) + { +#ifdef _OLD_101 + case 101: + { + Tango::DevUShort argin_u; + extract(in_any, argin_u); + if(argin_u < 0 || argin_u > 15) + Tango::Except::throw_exception( \ + (const char*)"Command Error", \ + (const char*)"Argin out of range [0,15]", \ + __FUNCTION__, Tango::ERR); + vector<Tango::DevShort> param; + param.push_back(f->second.cmd_code); + Tango::DevShort posto; + if(f->second.cmd_offset != -1) + posto = f->second.cmd_offset + argin_u + 14*8; //posti occupati 14.0 - 15.7 + else + posto = argin_u + 14*8; //posti occupati 14.0 - 15.7 + param.push_back(posto); + cout << "CmdClass::" << get_name() << ": 101 - " << argin_u << " -> postioccupati="<< posto << endl; + Tango::DeviceData Din; + Din << param; + mydevice->lldevice->command_inout(f->second.remote_cmd_name.c_str(),Din); + break; + } +#endif + case 102: + { + vector<Tango::DevShort> param1; + param1.push_back(f->second.cmd_code); + if(f->second.cmd_offset != -1) + param1.push_back(f->second.cmd_offset); + param1.push_back(6); + + cout << "CmdClass::" << get_name() << ": 102 - " << f->second.cmd_offset << " - 6" << endl; + Tango::DeviceData Din1; + Din1 << param1; + mydevice->lldevice->command_inout(f->second.remote_cmd_name.c_str(),Din1); + + usleep(1100000); + + vector<Tango::DevShort> param2; + param2.push_back(f->second.cmd_code); + if(f->second.cmd_offset != -1) + param2.push_back(f->second.cmd_offset); + param2.push_back(9); + cout << "CmdClass::" << get_name() << ": 102 - " << f->second.cmd_offset << " - 9" << endl; + Tango::DeviceData Din2; + Din2 << param2; + mydevice->lldevice->command_inout(f->second.remote_cmd_name.c_str(),Din2); + break; + } + case 101: + case 103: + { + int offset; + vector<Tango::DevShort> param; + param.push_back(f->second.cmd_code); + if(f->second.cmd_offset2 == -1) + { + if(f->second.cmd_offset != -1) + { + param.push_back(f->second.cmd_offset); + offset = f->second.cmd_offset; + } + } + else + { + const Tango::DevVarStringArray *argin_s; + extract(in_any, argin_s); + vector<string> str; + str << (*argin_s); + vector<string>::iterator si; + if(str.size() != 2) + { + cout << "CmdClass::" << get_name() << ": bad argin number" << endl; + Tango::Except::throw_exception( \ + (const char*)"Invalid parameters", \ + (const char*)"Invalid parameters", \ + __FUNCTION__, Tango::ERR); + return new CORBA::Any(); + } + if(str.at(1) != f->second.pass) + { + cout << "CmdClass::" << get_name() << ": bad pass="<<str.at(1) << endl; + Tango::Except::throw_exception( \ + (const char*)"Invalid parameters", \ + (const char*)"Invalid parameters", \ + __FUNCTION__, Tango::ERR); + return new CORBA::Any(); + } + switch(atoi(str.at(0).c_str())) + { + case 0: + param.push_back(f->second.cmd_offset); + offset = f->second.cmd_offset; + break; + case 1: + param.push_back(f->second.cmd_offset2); + offset = f->second.cmd_offset2; + break; + case 2: + param.push_back(f->second.cmd_offset3); + offset = f->second.cmd_offset3; + break; + case 3: + param.push_back(f->second.cmd_offset4); + offset = f->second.cmd_offset4; + break; + default: + return new CORBA::Any(); + } + cout << "CmdClass::" << get_name() << ": found offset="<<atoi(str.at(0).c_str()) << endl; + } + + cout << "CmdClass::" << get_name() << ": 103 - " << offset << endl; + Tango::DeviceData Din; + Din << param; + mydevice->lldevice->command_inout(f->second.remote_cmd_name.c_str(),Din); + break; + } + default: + switch(in_type) + { + case Tango::DEV_SHORT: + { + cout << "CmdClass::" << get_name() << ": found in type short" << endl; + + extract(in_any, argin); + if(mydevice && f!= mydevice->cmd_data.end()) + { + vector<Tango::DevShort> param; + param.push_back(f->second.cmd_code); + /*if(f->second.cmd_offset != -1) + param.push_back(f->second.cmd_offset);*/ + param.push_back(argin); //TODO + Tango::DeviceData Din; + Din << param; + mydevice->lldevice->command_inout(f->second.remote_cmd_name.c_str(),Din); + } + break; + } + case Tango::DEV_VOID: + default: + { + cout << "CmdClass::" << get_name() << ": found in type void" << endl; + if(mydevice && f!= mydevice->cmd_data.end()) + { + vector<Tango::DevShort> param; + param.push_back(f->second.cmd_code); + if(f->second.cmd_offset != -1) + param.push_back(f->second.cmd_offset); + Tango::DeviceData Din; + Din << param; + mydevice->lldevice->command_inout(f->second.remote_cmd_name.c_str(),Din); + } + break; + } + } + break; + } + + + return new CORBA::Any(); + +} + +/* + * EventCallBack class methods + */ +EventCallBack::EventCallBack() +{ + //cout<<"EventCallBack::EventCallBack entering..."<<endl; + mydevice = NULL; + //mydevices.clear(); +} + +EventCallBack::~EventCallBack(void) +{ + //cout<<"EventCallBack::~EventCallBack entering..."<<endl; + mydevice = NULL; + //mydevices.clear(); +} + +void EventCallBack::push_event(Tango::EventData* ev) +{ + string event_name = ev->attr_name; + //cout << __func__<<": entering event="<<event_name << endl; + // Check if event is an error event. + if (ev->err) + { + cout<< __func__ << ": Exception on " << ev->attr_name << " err=" << ev->errors[0].desc << endl; + return; + } + //find event + map<string,rem_val_t >::iterator it_ev; + std::transform(event_name.begin(), event_name.end(), event_name.begin(), (int(*)(int))tolower); //transform to lowercase + + for(it_ev = (static_cast<AccessConf *>(mydevice))->remote_att_value.begin(); it_ev != (static_cast<AccessConf *>(mydevice))->remote_att_value.end(); it_ev++) + { + string remote_name=(static_cast<AccessConf *>(mydevice))->low_level_srv + "/" + it_ev->first; + std::transform(remote_name.begin(), remote_name.end(), remote_name.begin(), (int(*)(int))tolower); //transform to lowercase + //cout << __func__<<": 1 looking for: '"<<event_name<<"' now remote_name: '"<<remote_name<<"'"<<endl; + if(remote_name.find(event_name) != string::npos) //TODO: or == + { + //cout << __func__<<": 1 looking for: '"<<event_name<<"' FOUND 1'"<<endl; + break; + } + } + + if (it_ev == (static_cast<AccessConf *>(mydevice))->remote_att_value.end()) + { + //try to remove network domain and FQDN + string ev_name_str(event_name); + string::size_type pos_slash = ev_name_str.find("tango://"); + if (pos_slash != string::npos) //FQDN!! + { + //first remove network domain if any + string::size_type pos_dot = ev_name_str.find(".",8); //look for first . after tango:// + string::size_type pos_colon = ev_name_str.find(":",8); //look for first : after tango:// + pos_slash = ev_name_str.find('/',8); //look for first / after tango:// + if(pos_dot < pos_slash && pos_dot != string::npos && pos_colon != string::npos && pos_slash != string::npos) //dot is in the TANGO_HOST part + { + string ev_name_str_no_domain = ev_name_str.substr(0,pos_dot) + ev_name_str.substr(pos_colon); + for(it_ev = (static_cast<AccessConf *>(mydevice))->remote_att_value.begin(); it_ev != (static_cast<AccessConf *>(mydevice))->remote_att_value.end(); it_ev++) + { + string remote_name=(static_cast<AccessConf *>(mydevice))->low_level_srv + "/" + it_ev->first; + std::transform(remote_name.begin(), remote_name.end(), remote_name.begin(), (int(*)(int))tolower); //transform to lowercase + //cout << __func__<<": 2 looking for: '"<<ev_name_str_no_domain<<"' now remote_name: '"<<remote_name<<"'"<<endl; + if(remote_name.find(ev_name_str_no_domain) != string::npos) //TODO: or == + { + //cout << __func__<<": 2 looking for: '"<<ev_name_str_no_domain<<"' FOUND 2'"<<endl; + break; + } + } + } + if (it_ev == (static_cast<AccessConf *>(mydevice))->remote_att_value.end() && pos_slash != string::npos) + { + ev_name_str = ev_name_str.substr(pos_slash + 1);//remove FQDN + for(it_ev = (static_cast<AccessConf *>(mydevice))->remote_att_value.begin(); it_ev != (static_cast<AccessConf *>(mydevice))->remote_att_value.end(); it_ev++) + { + string remote_name=(static_cast<AccessConf *>(mydevice))->low_level_srv + "/" + it_ev->first; + std::transform(remote_name.begin(), remote_name.end(), remote_name.begin(), (int(*)(int))tolower); //transform to lowercase + //cout << __func__<<": 3 looking for: '"<<ev_name_str<<"' now remote_name: '"<<remote_name<<"'"<<endl; + if(remote_name.find(ev_name_str) != string::npos) //TODO: or == + { + //cout << __func__<<": 3 looking for: '"<<ev_name_str<<"' FOUND 3'"<<endl; + break; + } + } + } + } + if (it_ev == (static_cast<AccessConf *>(mydevice))->remote_att_value.end()) + { + /* + * shouldn't happen!!! + */ + ostringstream o; + o << "find_events(): event '" \ + << event_name << "' not found!" << ends; + cout <<__func__<< ": " << o.str() << endl; + return; + } + } + /*string remote_name=(static_cast<AccessConf *>(mydevice))->low_level_srv + "/" + it_ev->first; + std::transform(remote_name.begin(), remote_name.end(), remote_name.begin(), (int(*)(int))tolower); //transform to lowercase + cout << __func__<<": FOUND event="<<remote_name << endl;*/ + + /*if (it_ev == (static_cast<AccessConf *>(mydevice))->remote_att_value.end()) + { + return; + }*/ + + (static_cast<AccessConf *>(mydevice))->extract_values(ev->attr_value, it_ev->second.val_b_ev, it_ev->second.val_s_ev); + + + //iterate through local attributes, evaluates attrs involved and push events + for(vector<string>::iterator it_loc_attr=it_ev->second.loc_attr_name.begin(); it_loc_attr!=it_ev->second.loc_attr_name.end(); it_loc_attr++) + { + //cout << __func__<<": NOW looping local attr="<<*it_loc_attr << endl; + map<string,attr_val_t >::iterator it_val = (static_cast<AccessConf *>(mydevice))->att_value.find(*it_loc_attr); + map<string,vector<attr_desc_t> >::iterator it_data = (static_cast<AccessConf *>(mydevice))->att_data.find(*it_loc_attr); + + for(vector<attr_desc_t>::iterator it_rem_attr = it_data->second.begin(); it_rem_attr != it_data->second.end(); it_rem_attr++) + { + //cout << __FUNCTION__ << " -> looping " << it_rem_attr->remote_attr_name<<endl; + //map<string,vector<Tango::DevBoolean> >::iterator ll_attr_it = remote_att_value.find(it_rem_attr->remote_attr_name); + map<string,rem_val_t >::iterator ll_attr_it = (static_cast<AccessConf *>(mydevice))->remote_att_value.find(it_rem_attr->remote_attr_name); + if(ll_attr_it != (static_cast<AccessConf *>(mydevice))->remote_att_value.end()) + { + //cout << __FUNCTION__ << " -> found value for " << it_rem_attr->remote_attr_name<<" attr idx="<<it_rem_attr->attr_index << " rem idx="<<it_rem_attr->remote_index<<endl; + it_val->second.val[ it_rem_attr->attr_index ] = ll_attr_it->second.val_b_ev.at(it_rem_attr->remote_index); + //cout << __FUNCTION__ << " -> " << *it_loc_attr <<"["<< it_rem_attr->attr_index<<"]=" << it_rem_attr->remote_attr_name << "["<<it_rem_attr->remote_index<<"]="<<(int)ll_attr_it->second.val_b_ev.at(it_rem_attr->remote_index)<<endl; + if(it_rem_attr->remote_index == 0) + it_val->second.val[ it_rem_attr->attr_index ] = true; + if(*it_loc_attr == "ValveStat") + { + int i=it_rem_attr->attr_index; + if(i==2 && it_rem_attr->remote_index == 0) + it_val->second.val[i]=true; + else if(i==4 && it_rem_attr->remote_index == 0 /*it_rem_attr->descr == "spare"*/) + it_val->second.val[i]=false; + else if(i>4 && i<=7) + it_val->second.val[i]=!it_val->second.val[i];//invert logic of ERR_ signals in order to have true -> error + } + + /*else if string + { + strcpy(&(it_val->second.val[ it_rem_attr->attr_index ][0]),ll_attr_it->second.val_s_ev.at(it_rem_attr->remote_index).c_str()); + (static_cast<AccessConf *>(mydevice))->attr_StringSpectrumDyn_read[it_rem_attr->attr_index] = (char *) (it_val->second.val[ it_rem_attr->attr_index]); + }*/ + } + } + + //if ValveStat handle state for valves + if(*it_loc_attr == "ValveStat") + { + if((static_cast<AccessConf *>(mydevice))->created_attr) //first event arrives when attributes are not fully created + (static_cast<AccessConf *>(mydevice))->ValveStat_initialized = true; + + + + if((it_val->second.val[5]||it_val->second.val[6]/*||!valve_stat[2]*/) && (static_cast<AccessConf *>(mydevice))->created_attr) + {//error occurred + + (static_cast<AccessConf *>(mydevice))->state_event = Tango::FAULT; + (static_cast<AccessConf *>(mydevice))->set_state((static_cast<AccessConf *>(mydevice))->state_event); + if(it_val->second.val[5]) + { + strcpy((static_cast<AccessConf *>(mydevice))->status_str,"error opening"); + } + if(it_val->second.val[6]) + { + strcpy((static_cast<AccessConf *>(mydevice))->status_str,"error closing"); + } + (static_cast<AccessConf *>(mydevice))->set_status((static_cast<AccessConf *>(mydevice))->status_str); + //cout << __FUNCTION__ << " -> PUSHING FAULT ("<<(static_cast<AccessConf *>(mydevice))->status_str<<") "<<endl; + try { + (static_cast<AccessConf *>(mydevice))->push_change_event("state"); + (static_cast<AccessConf *>(mydevice))->push_archive_event("state"); + //(static_cast<AccessConf *>(mydevice))->push_change_event("status"); + } catch(Tango::DevFailed &e) + { + cout << __func__<<": error pushing state="<<e.errors[0].desc<<endl; + } + // if(!valve_stat[2]){ + // set_status("pressure not ok"); + // } + } + else if((static_cast<AccessConf *>(mydevice))->created_attr) + {//no errors + if(it_val->second.val[0]){//opened? + if(it_val->second.val[1]) + {//closed? error + + (static_cast<AccessConf *>(mydevice))->state_event = Tango::FAULT; + (static_cast<AccessConf *>(mydevice))->set_state((static_cast<AccessConf *>(mydevice))->state_event); + strcpy((static_cast<AccessConf *>(mydevice))->status_str,"SW both closed"); + (static_cast<AccessConf *>(mydevice))->set_status((static_cast<AccessConf *>(mydevice))->status_str); + //cout << __FUNCTION__ << " -> PUSHING FAULT ("<<(static_cast<AccessConf *>(mydevice))->status_str<<") "<<endl; + try { + (static_cast<AccessConf *>(mydevice))->push_change_event("state"); + (static_cast<AccessConf *>(mydevice))->push_archive_event("state"); + //(static_cast<AccessConf *>(mydevice))->push_change_event("status"); + } catch(Tango::DevFailed &e) + { + cout << __func__ <<" error pushing state="<<e.errors[0].desc<<endl; + } + } + else + {//opened + + (static_cast<AccessConf *>(mydevice))->state_event = Tango::OPEN; + (static_cast<AccessConf *>(mydevice))->set_state((static_cast<AccessConf *>(mydevice))->state_event); + strcpy((static_cast<AccessConf *>(mydevice))->status_str,"----"); + (static_cast<AccessConf *>(mydevice))->set_status((static_cast<AccessConf *>(mydevice))->status_str); + //cout << __FUNCTION__ << " -> PUSHING OPEN ("<<(static_cast<AccessConf *>(mydevice))->status_str<<") "<<endl; + try { + (static_cast<AccessConf *>(mydevice))->push_change_event("state"); + (static_cast<AccessConf *>(mydevice))->push_archive_event("state"); + //(static_cast<AccessConf *>(mydevice))->push_change_event("status"); + } catch(Tango::DevFailed &e) + { + cout << __func__ <<" error pushing state="<<e.errors[0].desc<<endl; + } + } + } + else + { + if(it_val->second.val[1]) + {//closed? + + (static_cast<AccessConf *>(mydevice))->state_event = Tango::CLOSE; + (static_cast<AccessConf *>(mydevice))->set_state((static_cast<AccessConf *>(mydevice))->state_event); + strcpy((static_cast<AccessConf *>(mydevice))->status_str,"----"); + (static_cast<AccessConf *>(mydevice))->set_status((static_cast<AccessConf *>(mydevice))->status_str); + //cout << __FUNCTION__ << " -> PUSHING CLOSE ("<<(static_cast<AccessConf *>(mydevice))->status_str<<") "<<endl; + try { + (static_cast<AccessConf *>(mydevice))->push_change_event("state"); + (static_cast<AccessConf *>(mydevice))->push_archive_event("state"); + //(static_cast<AccessConf *>(mydevice))->push_change_event("status"); + } catch(Tango::DevFailed &e) + { + cout << __func__ <<" error pushing state="<<e.errors[0].desc<<endl; + } + } + else + {//moving + + (static_cast<AccessConf *>(mydevice))->state_event = Tango::MOVING; + (static_cast<AccessConf *>(mydevice))->set_state((static_cast<AccessConf *>(mydevice))->state_event); + strcpy((static_cast<AccessConf *>(mydevice))->status_str,"SW both opened"); + (static_cast<AccessConf *>(mydevice))->set_status((static_cast<AccessConf *>(mydevice))->status_str); + //cout << __FUNCTION__ << " -> PUSHING MOVING ("<<(static_cast<AccessConf *>(mydevice))->status_str<<") "<<endl; + try { + (static_cast<AccessConf *>(mydevice))->push_change_event("state"); + (static_cast<AccessConf *>(mydevice))->push_archive_event("state"); + //(static_cast<AccessConf *>(mydevice))->push_change_event("status"); + } catch(Tango::DevFailed &e) + { + cout << __func__ <<" error pushing state="<<e.errors[0].desc<<endl; + } + } + } + // if(is_local_ctrl){ + // set_status("local"); + // } + if((static_cast<AccessConf *>(mydevice))->cutoff_ind >=0 && (static_cast<AccessConf *>(mydevice))->cutoff_ind < MAX_ATTR_SIZE) + { + if(!it_val->second.val[(static_cast<AccessConf *>(mydevice))->cutoff_ind]){ + strcpy((static_cast<AccessConf *>(mydevice))->status_str,"cutoff"); + (static_cast<AccessConf *>(mydevice))->set_status((static_cast<AccessConf *>(mydevice))->status_str); + //cout << __FUNCTION__ << " -> PUSHING ?? ("<<(static_cast<AccessConf *>(mydevice))->status_str<<") "<<endl; + try { + //(static_cast<AccessConf *>(mydevice))->push_change_event("status", (static_cast<AccessConf *>(mydevice))->attr_status_read, 1, 0, false); + } catch(Tango::DevFailed &e) + { + cout << __func__ <<" error pushing status="<<e.errors[0].desc<<endl; + } + } + } + } + } + if((static_cast<AccessConf *>(mydevice))->created_attr) + { + try { + // push the attribute value + (static_cast<AccessConf *>(mydevice))->push_change_event(*it_loc_attr,&(it_val->second.val[0]), it_data->second.size()); + (static_cast<AccessConf *>(mydevice))->push_archive_event(*it_loc_attr,&(it_val->second.val[0]), it_data->second.size()); + } catch(Tango::DevFailed &e) + { + cout << __func__ <<" error pushing state="<<e.errors[0].desc<<endl; + } + /*else if string + (static_cast<AccessConf *>(mydevice))->push_change_event(*it_loc_attr,(static_cast<AccessConf *>(mydevice))->attr_StringSpectrumDyn_read, it_data->second.size()); + */ + } + } + + +} /* push_event() */ + +void EventCallBack::init(Tango::DeviceImpl *p) +{ + //cout<<(int)now_log.tv_sec<<" "<<"EventCallBack::init entering..."<<endl; + mydevice = p; + //mydevices.push_back(p); +} + + /*----- PROTECTED REGION END -----*/ // AccessConf::namespace_ending +} // namespace diff --git a/src/AccessConf.h b/src/AccessConf.h new file mode 100644 index 0000000000000000000000000000000000000000..7966ca6fac133ad9b7d3549f687fbfa4cb84b27c --- /dev/null +++ b/src/AccessConf.h @@ -0,0 +1,372 @@ +/*----- PROTECTED REGION ID(AccessConf.h) ENABLED START -----*/ +//============================================================================= +// +// file : AccessConf.h +// +// description : Include for the AccessConf class. +// +// project : Storage Ring Access. +// +// $Author: graziano $ +// +// $Revision: 1.7 $ +// $Date: 2019-11-06 08:38:53 $ +// +// SVN only: +// $HeadURL: $ +// +// CVS only: +// $Source: /home/cvsadm/cvsroot/fermi/servers/accessconf/src/AccessConf.h,v $ +// $Log: AccessConf.h,v $ +// Revision 1.7 2019-11-06 08:38:53 graziano +// Fixed +// +// Revision 1.6 2019-11-06 08:23:36 graziano +// Added cutoff_ind to change/disable index for cutoff +// +// Revision 1.5 2017-08-23 14:16:23 claudio +// #1554 tango-9.2.5a +// +// Revision 1.4 2016-01-07 10:44:44 graziano +// fixed +// +// Revision 1.3 2013-08-20 07:06:01 graziano +// event support +// +// Revision 1.2 2012-10-31 17:40:12 graziano +// fixed for valves +// +// Revision 1.1 2012-10-30 09:29:15 graziano +// *** empty log message *** +// +// +// +//============================================================================= +// This file is generated by POGO +// (Program Obviously used to Generate tango Object) +//============================================================================= + + +#ifndef ACCESSCONF_H +#define ACCESSCONF_H + + +#include <tango.h> + +#define MAX_ATTR_SIZE 100 + +/*----- PROTECTED REGION END -----*/ + + +/** + * AccessConf class Description: + * + */ + +namespace AccessConf_ns +{ + /*----- PROTECTED REGION ID(AccessConf::Additional Class Declarations) ENABLED START -----*/ + + // Additional Class Declarations +class EventCallBack : public Tango::CallBack +{ + public: + EventCallBack(); + ~EventCallBack(void); + void push_event(Tango::EventData* ev); + void init(Tango::DeviceImpl *p); + private: + Tango::DeviceImpl *mydevice; + //vector<DeviceImpl *> mydevices; +}; + +typedef struct +{ + string remote_attr_name; + unsigned int attr_index; + unsigned int remote_index; + string descr; + string comment; + string type; + //Tango::DevBoolean val; + +} attr_desc_t; + +typedef struct +{ + Tango::DevBoolean val[MAX_ATTR_SIZE]; + +} attr_val_t; + +typedef struct +{ + vector<Tango::DevBoolean> val_b; + vector<string> val_s; + vector<Tango::DevBoolean> val_b_ev; + vector<string> val_s_ev; + vector<string> loc_attr_name; //list of local attributes interested in this remote value +} rem_val_t; + +typedef struct +{ + char val[MAX_ATTR_SIZE][128]; + +} attr_val_string_t; + +typedef struct +{ + string remote_cmd_name; + int cmd_code; + int cmd_offset; + int cmd_offset2; + int cmd_offset3; + int cmd_offset4; + string pass; + +} cmd_desc_t; + + /*----- PROTECTED REGION END -----*/ // AccessConf::Additional Class Declarations + + +class AccessConf : public TANGO_BASE_CLASS +{ + + friend class CmdClass; + /*----- PROTECTED REGION ID(AccessConf::Data Members) ENABLED START -----*/ + + // Add your own data members +public: + /** + * This command gets the device state (stored in its <i>device_state</i> data member) and returns it to the caller. + * @return State Code + * @exception DevFailed + */ + virtual Tango::DevState dev_state(); + /** + * This command gets the device status (stored in its <i>device_status</i> data member) and returns it to the caller. + * @return Status description + * @exception DevFailed + */ + virtual Tango::ConstDevString dev_status(); +protected: + + map<string,vector<attr_desc_t> > att_data; + map<string,attr_val_t > att_value; + map<string,attr_val_string_t > att_value_string; + vector<string> remote_attr; + map<string,string> remote_type; + //map<string,vector<Tango::DevBoolean> > remote_att_value; + map<string,rem_val_t > remote_att_value; + + vector<unsigned int> eid; + EventCallBack ecb; + friend class EventCallBack; + + Tango::DevState ll_state; + void string_explode(string, string, vector<string>*); + void init_attributeprop(); + long create_dynamic_command(const char* cmd_name, Tango::CmdArgType type_in, Tango::CmdArgType type_out, long size_in, long size_out); + void create_dynamic_attributes(vector<string> attr_config); + void extract_values(Tango::DeviceAttribute *attr_value, vector<Tango::DevBoolean> &v_bo, vector<string> &v_string); + + Tango::DeviceProxy *lldevice; + + struct timeval last_read; + + map<string,cmd_desc_t> cmd_data; + + char version_str[1024]; + char status_str[1024]; + Tango::DevString *attr_status_read; + Tango::DevState state_event; + + bool ValveStat_initialized; + bool created_attr; + + /*----- PROTECTED REGION END -----*/ // AccessConf::Data Members + + +// Device property data members +public: // Low_level_srv: + string low_level_srv; + // Attr_config_file: + string attr_config_file; + // Attr_config_prop: + vector<string> attr_config_prop; + // Cutoff_ind: + Tango::DevLong cutoff_ind; + + +// Attribute data members +public: + Tango::DevBoolean *attr_BoolScalarDyn_read; + Tango::DevBoolean *attr_BoolSpectrumDyn_read; + Tango::DevString *attr_StringSpectrumDyn_read; + Tango::DevString *attr_Version_read; + + + +// Constructors and destructors +public: + /** + * Constructs a newly allocated Command object. + * + * @param cl Class. + * @param s Device Name + */ + AccessConf(Tango::DeviceClass *cl,string &s); + /** + * Constructs a newly allocated Command object. + * + * @param cl Class. + * @param s Device Name + */ + AccessConf(Tango::DeviceClass *cl,const char *s); + /** + * Constructs a newly allocated Command object. + * + * @param cl Class. + * @param s Device name + * @param d Device description. + */ + AccessConf(Tango::DeviceClass *cl,const char *s,const char *d); + /** + * The object destructor. + */ + ~AccessConf() {delete_device();}; + + + +// Miscellaneous methods +public: + /** + * will be called at device destruction or at init command. + */ + void delete_device(); + /** + * Initialize the device + */ + virtual void init_device(); + /** + * Read the device properties from database + */ + void get_device_property(); + /** + * Always executed method before execution command method. + */ + virtual void always_executed_hook(); + + +// Attribute methods +public: + /** + * Method : AccessConf::read_attr_hardware() + * Description : Hardware acquisition for attributes. + */ + virtual void read_attr_hardware(vector<long> &attr_list); + + + /** + * BoolScalarDyn attribute related methods. + * Description: + * + * Data type: Tango::DevBoolean + * Attr type: Scalar + */ + virtual void read_BoolScalarDyn(Tango::Attribute &attr); + virtual bool is_BoolScalarDyn_allowed(Tango::AttReqType type); + + + + /** + * BoolSpectrumDyn attribute related methods. + * Description: + * + * Data type: Tango::DevBoolean + * Attr type: Spectrum max = 1000 + */ + virtual void read_BoolSpectrumDyn(Tango::Attribute &attr); + virtual bool is_BoolSpectrumDyn_allowed(Tango::AttReqType type); + + + + /** + * StringSpectrumDyn attribute related methods. + * Description: + * + * Data type: Tango::DevString + * Attr type: Spectrum max = 1000 + */ + virtual void read_StringSpectrumDyn(Tango::Attribute &attr); + virtual bool is_StringSpectrumDyn_allowed(Tango::AttReqType type); + + + /** + * Version attribute related methods. + * Description: + * + * Data type: Tango::DevBoolean + * Attr type: Scalar + */ + virtual void read_Version(Tango::Attribute &attr); + virtual bool is_Version_allowed(Tango::AttReqType type); + + + + /** + * Method : AccessConf::add_dynamic_attributes() + * Description : Add dynamic attributes if any. + */ + void add_dynamic_attributes(); + +// Command related methods +public: + + + + + /*----- PROTECTED REGION ID(AccessConf::Additional Method prototypes) ENABLED START -----*/ + + // Additional Method prototypes + + /*----- PROTECTED REGION END -----*/ // AccessConf::Additional Method prototypes + +}; + + /*----- PROTECTED REGION ID(AccessConf::Additional Classes Definitions) ENABLED START -----*/ + + // Additional Classes definitions +class CmdClass : public Tango::Command +{ +public: + CmdClass(const char *name, + Tango::CmdArgType in, + Tango::CmdArgType out, + const char *in_desc, + const char *out_desc, + Tango::DispLevel level, + int size_in, + Tango::DeviceImpl *dev) + :Command(name,in,out,in_desc,out_desc, level) {_max_in=size_in;}; + + CmdClass(const char *name, + Tango::CmdArgType in, + Tango::CmdArgType out, + int size_in, + Tango::DeviceImpl *dev) + :Command(name,in,out) {_max_in=size_in;}; + ~CmdClass() {}; + + virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any); + virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any) + {return true/*(static_cast<TangoLib *>(dev))->is_Cmd_allowed(any)*/;} + + int _max_in; + AccessConf *mydevice; +}; + + /*----- PROTECTED REGION END -----*/ // AccessConf::Additional Classes Definitions + +} // namespace + +#endif // ACCESSCONF_H diff --git a/src/AccessConfClass.cpp b/src/AccessConfClass.cpp new file mode 100644 index 0000000000000000000000000000000000000000..08d4e7833f105c661920fd113ecdfb95dabf6f3a --- /dev/null +++ b/src/AccessConfClass.cpp @@ -0,0 +1,720 @@ +/*----- PROTECTED REGION ID(AccessConfClass.cpp) ENABLED START -----*/ +static const char *RcsId = "$Id: AccessConfClass.cpp,v 1.2 2019-11-06 08:23:36 graziano Exp $"; +static const char *TagName = "$Name: $"; +static const char *CvsPath = "$Source: /home/cvsadm/cvsroot/fermi/servers/accessconf/src/AccessConfClass.cpp,v $"; +static const char *SvnPath = "$HeadURL: $"; +static const char *HttpServer = "http://www.esrf.eu/computing/cs/tango/tango_doc/ds_doc/"; +//============================================================================= +// +// file : AccessConfClass.cpp +// +// description : C++ source for the AccessConfClass. A singleton +// class derived from DeviceClass. It implements the +// command list and all properties and methods required +// by the �name� once per process. +// +// project : Storage Ring Access. +// +// $Author: graziano $ +// +// $Revision: 1.2 $ +// $Date: 2019-11-06 08:23:36 $ +// +// SVN only: +// $HeadURL: $ +// +// CVS only: +// $Source: /home/cvsadm/cvsroot/fermi/servers/accessconf/src/AccessConfClass.cpp,v $ +// $Log: AccessConfClass.cpp,v $ +// Revision 1.2 2019-11-06 08:23:36 graziano +// Added cutoff_ind to change/disable index for cutoff +// +// Revision 1.1 2012-10-30 09:29:15 graziano +// *** empty log message *** +// +// +// +//============================================================================= +// This file is generated by POGO +// (Program Obviously used to Generate tango Object) +//============================================================================= + + +#include <AccessConfClass.h> + +/*----- PROTECTED REGION END -----*/ + +//------------------------------------------------------------------- +/** + * Create AccessConfClass singleton and + * return it in a C function for Python usage + */ +//------------------------------------------------------------------- +extern "C" { +#ifdef _TG_WINDOWS_ + +__declspec(dllexport) + +#endif + + Tango::DeviceClass *_create_AccessConf_class(const char *name) { + return AccessConf_ns::AccessConfClass::init(name); + } +} + + +namespace AccessConf_ns +{ + + +//=================================================================== +// Initialize pointer for singleton pattern +//=================================================================== +AccessConfClass *AccessConfClass::_instance = NULL; + +//-------------------------------------------------------- +/** + * method : AccessConfClass::AccessConfClass(string &s) + * description : constructor for the AccessConfClass + * + * @param s The class name + */ +//-------------------------------------------------------- +AccessConfClass::AccessConfClass(string &s):DeviceClass(s) +{ + cout2 << "Entering AccessConfClass constructor" << endl; + set_default_property(); + get_class_property(); + write_class_property(); + + /*----- PROTECTED REGION ID(AccessConf::Class::constructor) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // AccessConf::Class::constructor + + cout2 << "Leaving AccessConfClass constructor" << endl; +} + + +//-------------------------------------------------------- +/** + * method : AccessConfClass::~AccessConfClass() + * description : destructor for the AccessConfClass + */ +//-------------------------------------------------------- +AccessConfClass::~AccessConfClass() +{ + /*----- PROTECTED REGION ID(AccessConf::Class::destructor) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // AccessConf::Class::destructor + + _instance = NULL; +} + + +//-------------------------------------------------------- +/** + * method : AccessConfClass::init + * description : Create the object if not already done. + * Otherwise, just return a pointer to the object + * + * @param name The class name + */ +//-------------------------------------------------------- +AccessConfClass *AccessConfClass::init(const char *name) +{ + if (_instance == NULL) + { + try + { + string s(name); + _instance = new AccessConfClass(s); + } + catch (bad_alloc) + { + throw; + } + } + return _instance; +} + +//-------------------------------------------------------- +/** + * method : AccessConfClass::instance + * description : Check if object already created, + * and return a pointer to the object + */ +//-------------------------------------------------------- +AccessConfClass *AccessConfClass::instance() +{ + if (_instance == NULL) + { + cerr << "Class is not initialised !!" << endl; + exit(-1); + } + return _instance; +} + + + + +//=================================================================== +// Command execution method calls +//=================================================================== + + + + +//=================================================================== +// Properties management +//=================================================================== + +//-------------------------------------------------------- +/** + * method : AccessConfClass::get_class_property + * description : Get the class property for specified name. + * + * @param name The property name + */ +//-------------------------------------------------------- +Tango::DbDatum AccessConfClass::get_class_property(string &prop_name) +{ + for (unsigned int i=0 ; i<cl_prop.size() ; i++) + if (cl_prop[i].name == prop_name) + return cl_prop[i]; + // if not found, returns an empty DbDatum + return Tango::DbDatum(prop_name); +} + + +//-------------------------------------------------------- +/** + * Method : AccessConf::AccessConfClass::get_default_device_property()() + * Description : Return the default value for device property. + */ +//-------------------------------------------------------- +Tango::DbDatum AccessConfClass::get_default_device_property(string &prop_name) +{ + for (unsigned int i=0 ; i<dev_def_prop.size() ; i++) + if (dev_def_prop[i].name == prop_name) + return dev_def_prop[i]; + // if not found, return an empty DbDatum + return Tango::DbDatum(prop_name); +} + + +//-------------------------------------------------------- +/** + * Method : AccessConf::AccessConfClass::get_default_class_property()() + * Description : Return the default value for class property. + */ +//-------------------------------------------------------- +Tango::DbDatum AccessConfClass::get_default_class_property(string &prop_name) +{ + for (unsigned int i=0 ; i<cl_def_prop.size() ; i++) + if (cl_def_prop[i].name == prop_name) + return cl_def_prop[i]; + // if not found, return an empty DbDatum + return Tango::DbDatum(prop_name); +} + + +//-------------------------------------------------------- +/** + * Method : AccessConf::AccessConfClass::get_class_property() + * Description : // Add your own code to initialize + */ +//-------------------------------------------------------- +void AccessConfClass::get_class_property() +{ +} + + +//-------------------------------------------------------- +/** + * Method : AccessConf::AccessConfClass::set_default_property() + * Description : Set default property (class and device) for wizard. + * For each property, add to wizard property name and description. + * If default value has been set, add it to wizard property and. + * store it in a DbDatum. + */ +//-------------------------------------------------------- +void AccessConfClass::set_default_property() +{ + string prop_name; + string prop_desc; + string prop_def; + vector<string> vect_data; + + // Set Default Class Properties + + // Set Default Device Properties + + prop_name = "Low_level_srv"; + prop_desc = ""; + 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 = "Attr_config_prop"; + prop_desc = ""; + 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 = "Attr_config_file"; + prop_desc = ""; + 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 = "Cutoff_ind"; + prop_desc = ""; + prop_def = "3"; + 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); +} + + +//-------------------------------------------------------- +/** + * Method : AccessConf::AccessConfClass::write_class_property() + * Description : Set class description fields as property in database + */ +//-------------------------------------------------------- +void AccessConfClass::write_class_property() +{ + // First time, check if database used + if (Tango::Util::_UseDb == false) + return; + + Tango::DbData data; + string classname = get_name(); + string header; + string::size_type start, end; + + // Put title + Tango::DbDatum title("ProjectTitle"); + string str_title("Storage Ring Access"); + title << str_title; + data.push_back(title); + + // Put Description + Tango::DbDatum description("Description"); + vector<string> str_desc; + str_desc.push_back(""); + description << str_desc; + data.push_back(description); + + // put cvs or svn location + string filename("AccessConf"); + filename += "Class.cpp"; + + // check for cvs information + string src_path(CvsPath); + start = src_path.find("/"); + if (start!=string::npos) + { + end = src_path.find(filename); + if (end>start) + { + string strloc = src_path.substr(start, end-start); + // Check if specific repository + start = strloc.find("/cvsroot/"); + if (start!=string::npos && start>0) + { + string repository = strloc.substr(0, start); + if (repository.find("/segfs/")!=string::npos) + strloc = "ESRF:" + strloc.substr(start, strloc.length()-start); + } + Tango::DbDatum cvs_loc("cvs_location"); + cvs_loc << strloc; + 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 + + // CVS tag + string tagname(TagName); + header = "$Name: "; + start = header.length(); + string endstr(" $"); + + end = tagname.find(endstr); + if (end!=string::npos && end>start) + { + string strtag = tagname.substr(start, end-start); + Tango::DbDatum cvs_tag("cvs_tag"); + cvs_tag << strtag; + 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 + string httpServ(HttpServer); + if (httpServ.length()>0) + { + Tango::DbDatum db_doc_url("doc_url"); + db_doc_url << httpServ; + data.push_back(db_doc_url); + } + + // Put inheritance + Tango::DbDatum inher_datum("InheritedFrom"); + vector<string> inheritance; + inheritance.push_back("Device_Impl"); + inher_datum << inheritance; + data.push_back(inher_datum); + + // Call database and and values + get_db_class()->put_property(data); +} + + + + +//=================================================================== +// Factory methods +//=================================================================== + + +//-------------------------------------------------------- +/** + * method : AccessConfClass::device_factory + * description : Create the device object(s) + * and store them in the device list + * + * @param *devlist_ptr The device name list + */ +//-------------------------------------------------------- +void AccessConfClass::device_factory(const Tango::DevVarStringArray *devlist_ptr) +{ + + /*----- PROTECTED REGION ID(AccessConf::Class::device_factory_before) ENABLED START -----*/ + + // Add your own code + + /*----- PROTECTED REGION END -----*/ // AccessConf::Class::device_factory_before + + // Create devices and add it into the device list + for (unsigned long i=0 ; i<devlist_ptr->length() ; i++) + { + cout4 << "Device name : " << (*devlist_ptr)[i].in() << endl; + device_list.push_back(new AccessConf(this, (*devlist_ptr)[i])); + } + + // Manage dynamic attributes if any + erase_dynamic_attributes(devlist_ptr, get_class_attr()->get_attr_list()); + + // Export devices to the outside world + for (unsigned long i=1 ; i<=devlist_ptr->length() ; i++) + { + // Add dynamic attributes if any + AccessConf *dev = static_cast<AccessConf *>(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()); + } + + /*----- PROTECTED REGION ID(AccessConf::Class::device_factory_after) ENABLED START -----*/ + + // Add your own code + + /*----- PROTECTED REGION END -----*/ // AccessConf::Class::device_factory_after + + +} + + +//-------------------------------------------------------- +/** + * Method : AccessConf::AccessConfClass::attribute_factory() + * Description : Create the attribute object(s) + * and store them in the attribute list + */ +//-------------------------------------------------------- +void AccessConfClass::attribute_factory(vector<Tango::Attr *> &att_list) +{ + /*----- PROTECTED REGION ID(AccessConf::Class::attribute_factory_before) ENABLED START -----*/ + + // Add your own code + + /*----- PROTECTED REGION END -----*/ // AccessConf::Class::attribute_factory_before + + +#if 0 + // Attribute : BoolScalarDyn + BoolScalarDynAttrib *boolscalardyn = new BoolScalarDynAttrib(); + Tango::UserDefaultAttrProp boolscalardyn_prop; + // description not set for BoolScalarDyn + // label not set for BoolScalarDyn + // unit not set for BoolScalarDyn + // standard_unit not set for BoolScalarDyn + // display_unit not set for BoolScalarDyn + // format not set for BoolScalarDyn + // max_value not set for BoolScalarDyn + // min_value not set for BoolScalarDyn + // max_alarm not set for BoolScalarDyn + // min_alarm not set for BoolScalarDyn + // max_warning not set for BoolScalarDyn + // min_warning not set for BoolScalarDyn + // delta_t not set for BoolScalarDyn + // delta_val not set for BoolScalarDyn + boolscalardyn->set_default_properties(boolscalardyn_prop); + // Not Polled + boolscalardyn->set_disp_level(Tango::OPERATOR); + // Not memorized + + // BoolScalarDyn does not fire change event + // BoolScalarDyn does not fire archive event + // BoolScalarDyn does not fire data_ready event + att_list.push_back(boolscalardyn); + + // Attribute : BoolSpectrumDyn + BoolSpectrumDynAttrib *boolspectrumdyn = new BoolSpectrumDynAttrib(); + Tango::UserDefaultAttrProp boolspectrumdyn_prop; + // description not set for BoolSpectrumDyn + // label not set for BoolSpectrumDyn + // unit not set for BoolSpectrumDyn + // standard_unit not set for BoolSpectrumDyn + // display_unit not set for BoolSpectrumDyn + // format not set for BoolSpectrumDyn + // max_value not set for BoolSpectrumDyn + // min_value not set for BoolSpectrumDyn + // max_alarm not set for BoolSpectrumDyn + // min_alarm not set for BoolSpectrumDyn + // max_warning not set for BoolSpectrumDyn + // min_warning not set for BoolSpectrumDyn + // delta_t not set for BoolSpectrumDyn + // delta_val not set for BoolSpectrumDyn + boolspectrumdyn->set_default_properties(boolspectrumdyn_prop); + // Not Polled + boolspectrumdyn->set_disp_level(Tango::OPERATOR); + // Not memorized + + // BoolSpectrumDyn does not fire change event + // BoolSpectrumDyn does not fire archive event + // BoolSpectrumDyn does not fire data_ready event + att_list.push_back(boolspectrumdyn); +#endif + // Attribute : Version + VersionAttrib *version = new VersionAttrib(); + Tango::UserDefaultAttrProp version_prop; + // description not set for Version + // label not set for Version + // unit not set for Version + // standard_unit not set for Version + // display_unit not set for Version + // format not set for Version + // max_value not set for Version + // min_value not set for Version + // max_alarm not set for Version + // min_alarm not set for Version + // max_warning not set for Version + // min_warning not set for Version + // delta_t not set for Version + // delta_val not set for Version + version->set_default_properties(version_prop); + // Not Polled + version->set_disp_level(Tango::OPERATOR); + // Not memorized + + // Version does not fire change event + // Version does not fire archive event + // Version does not fire data_ready event + att_list.push_back(version); + + // Create a list of static attributes + create_static_attribute_list(get_class_attr()->get_attr_list()); + + /*----- PROTECTED REGION ID(AccessConf::Class::attribute_factory_after) ENABLED START -----*/ + + // Add your own code + + /*----- PROTECTED REGION END -----*/ // AccessConf::Class::attribute_factory_after + +} + + +//-------------------------------------------------------- +/** + * Method : AccessConf::AccessConfClass::command_factory() + * Description : Create the command object(s) + * and store them in the command list + */ +//-------------------------------------------------------- +void AccessConfClass::command_factory() +{ + /*----- PROTECTED REGION ID(AccessConf::Class::command_factory_before) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // AccessConf::Class::command_factory_before + + + /*----- PROTECTED REGION ID(AccessConf::Class::command_factory_after) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // AccessConf::Class::command_factory_after + +} + + + + +//=================================================================== +// Dynamic attributes related methods +//=================================================================== + + +//-------------------------------------------------------- +/** + * method : AccessConfClass::create_static_attribute_list + * description : Create the a list of static attributes + * + * @param att_list the ceated attribute list + */ +//-------------------------------------------------------- +void AccessConfClass::create_static_attribute_list(vector<Tango::Attr *> &att_list) +{ + for (unsigned long i=0 ; i<att_list.size() ; i++) + { + string att_name(att_list[i]->get_name()); + transform(att_name.begin(), att_name.end(), att_name.begin(), ::tolower); + defaultAttList.push_back(att_name); + } + + cout2 << defaultAttList.size() << " attributes in default list" << endl; + + + /*----- PROTECTED REGION ID(AccessConf::Class::create_static_att_list) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // AccessConf::Class::create_static_att_list + +} + + +//-------------------------------------------------------- +/** + * method : AccessConfClass::erase_dynamic_attributes + * description : delete the dynamic attributes if any. + * + * @param devlist_ptr the device list pointer + * @param list of all attributes + */ +//-------------------------------------------------------- +void AccessConfClass::erase_dynamic_attributes(const Tango::DevVarStringArray *devlist_ptr, vector<Tango::Attr *> &att_list) +{ + Tango::Util *tg = Tango::Util::instance(); + //cout << __FUNCTION__<< ": entering..."<<endl; + for (unsigned long i=0 ; i<devlist_ptr->length() ; i++) + { + Tango::DeviceImpl *dev_impl = tg->get_device_by_name(((string)(*devlist_ptr)[i]).c_str()); + AccessConf *dev = static_cast<AccessConf *> (dev_impl); + + vector<Tango::Attribute *> &dev_att_list = dev->get_device_attr()->get_attribute_list(); + vector<Tango::Attribute *>::iterator ite_att; + for (ite_att=dev_att_list.begin() ; ite_att != dev_att_list.end() ; ++ite_att) + { + string att_name((*ite_att)->get_name_lower()); + if ((att_name == "state") || (att_name == "status")) + continue; + vector<string>::iterator ite_str = find(defaultAttList.begin(), defaultAttList.end(), att_name); + if (ite_str == defaultAttList.end()) + { + cout2 << att_name << " is a UNWANTED dynamic attribute for device " << (*devlist_ptr)[i] << endl; + Tango::Attribute &att = dev->get_device_attr()->get_attr_by_name(att_name.c_str()); + dev->remove_attribute(att_list[att.get_attr_idx()],true); + --ite_att; + } + } + } + /*----- PROTECTED REGION ID(AccessConf::Class::erase_dynamic_attributes) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // AccessConf::Class::erase_dynamic_attributes + +} + + + + /*----- PROTECTED REGION ID(AccessConf::Class::Additional Methods) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // AccessConf::Class::Additional Methods + +} // namespace diff --git a/src/AccessConfClass.h b/src/AccessConfClass.h new file mode 100644 index 0000000000000000000000000000000000000000..3509ddaf4662a66572d349ad3d73811b2e7649b0 --- /dev/null +++ b/src/AccessConfClass.h @@ -0,0 +1,187 @@ +/*----- PROTECTED REGION ID(AccessConfClass.h) ENABLED START -----*/ +//============================================================================= +// +// file : AccessConfClass.h +// +// description : Include for the AccessConfClass root class. +// This class is the singleton class for. +// the AccessConf device class.. +// It contains all properties and methods which the . +// AccessConf requires only once e.g. the commands. +// +// project : Storage Ring Access. +// +// $Author: graziano $ +// +// $Revision: 1.1 $ +// $Date: 2012-10-30 09:29:15 $ +// +// SVN only: +// $HeadURL: $ +// +// CVS only: +// $Source: /home/cvsadm/cvsroot/fermi/servers/accessconf/src/AccessConfClass.h,v $ +// $Log: AccessConfClass.h,v $ +// Revision 1.1 2012-10-30 09:29:15 graziano +// *** empty log message *** +// +// +// +//============================================================================= +// This file is generated by POGO +// (Program Obviously used to Generate tango Object) +//============================================================================= + + +#ifndef ACCESSCONFCLASS_H +#define ACCESSCONFCLASS_H + +#include <tango.h> +#include <AccessConf.h> + +/*----- PROTECTED REGION END -----*/ + +namespace AccessConf_ns +{ + /*----- PROTECTED REGION ID(AccessConf::classes for dynamic creation) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // AccessConf::classes for dynamic creation + + + +//========================================= +// Define classes for attributes +//========================================= +// Attribute Version class definition +class VersionAttrib: public Tango::Attr +{ +public: + VersionAttrib():Attr("Version", + Tango::DEV_STRING, Tango::READ) {}; + ~VersionAttrib() {}; + + VersionAttrib(const string &att_name):Attr(att_name.c_str(), + Tango::DEV_STRING, Tango::READ) {}; + + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<AccessConf *>(dev))->read_Version(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<AccessConf *>(dev))->is_Version_allowed(ty);} +}; + +// Attribute BoolScalarDyn class definition +class BoolScalarDynAttrib: public Tango::Attr +{ +public: + BoolScalarDynAttrib():Attr("BoolScalarDyn", + Tango::DEV_BOOLEAN, Tango::READ) {}; + ~BoolScalarDynAttrib() {}; + + BoolScalarDynAttrib(const string &att_name):Attr(att_name.c_str(), + Tango::DEV_BOOLEAN, Tango::READ) {}; + + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<AccessConf *>(dev))->read_BoolScalarDyn(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<AccessConf *>(dev))->is_BoolScalarDyn_allowed(ty);} +}; + +// Attribute BoolSpectrumDyn class definition +class BoolSpectrumDynAttrib: public Tango::SpectrumAttr +{ +public: + BoolSpectrumDynAttrib():SpectrumAttr("BoolSpectrumDyn", + Tango::DEV_BOOLEAN, Tango::READ, MAX_ATTR_SIZE) {}; + ~BoolSpectrumDynAttrib() {}; + + BoolSpectrumDynAttrib(const string &att_name, long size):SpectrumAttr(att_name.c_str(), + Tango::DEV_BOOLEAN, Tango::READ, size) {}; + + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<AccessConf *>(dev))->read_BoolSpectrumDyn(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<AccessConf *>(dev))->is_BoolSpectrumDyn_allowed(ty);} +}; + +// Attribute StringSpectrumDyn class definition +class StringSpectrumDynAttrib: public Tango::SpectrumAttr +{ +public: + StringSpectrumDynAttrib():SpectrumAttr("StringSpectrumDyn", + Tango::DEV_STRING, Tango::READ, MAX_ATTR_SIZE) {}; + ~StringSpectrumDynAttrib() {}; + + StringSpectrumDynAttrib(const string &att_name, long size):SpectrumAttr(att_name.c_str(), + Tango::DEV_STRING, Tango::READ, size) {}; + + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<AccessConf *>(dev))->read_StringSpectrumDyn(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<AccessConf *>(dev))->is_StringSpectrumDyn_allowed(ty);} +}; + + + + + +//========================================= +// Define classes for commands +//========================================= + + + + +/** + * The TemplateDevServClass singleton definition + */ + +class +#ifdef _TG_WINDOWS_ + __declspec(dllexport) +#endif + AccessConfClass : public Tango::DeviceClass +{ + /*----- PROTECTED REGION ID(AccessConf::Additionnal DServer data members) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // AccessConf::Additionnal DServer data members + + + +public: +// write class properties data members + Tango::DbData cl_prop; + Tango::DbData cl_def_prop; + Tango::DbData dev_def_prop; + +// Method prototypes + static AccessConfClass *init(const char *); + static AccessConfClass *instance(); + ~AccessConfClass(); + Tango::DbDatum get_class_property(string &); + Tango::DbDatum get_default_device_property(string &); + Tango::DbDatum get_default_class_property(string &); + +protected: + AccessConfClass(string &); + static AccessConfClass *_instance; + void command_factory(); + void attribute_factory(vector<Tango::Attr *> &); + void write_class_property(); + void set_default_property(); + void get_class_property(); + string get_cvstag(); + string get_cvsroot(); + +private: + void device_factory(const Tango::DevVarStringArray *); + void create_static_attribute_list(vector<Tango::Attr *> &); + void erase_dynamic_attributes(const Tango::DevVarStringArray *,vector<Tango::Attr *> &); + vector<string> defaultAttList; + + +}; + +} // namespace + +#endif // ACCESSCONFCLASS_H + diff --git a/src/AccessConfStateMachine.cpp b/src/AccessConfStateMachine.cpp new file mode 100644 index 0000000000000000000000000000000000000000..554932f367c7f1d40a4e022721444758500909ca --- /dev/null +++ b/src/AccessConfStateMachine.cpp @@ -0,0 +1,144 @@ +/*----- PROTECTED REGION ID(AccessConfStateMachine.cpp) ENABLED START -----*/ +static const char *RcsId = "$Id: AccessConfStateMachine.cpp,v 1.1 2012-10-30 09:29:15 graziano Exp $"; +//============================================================================= +// +// file : AccessConfStateMachine.cpp +// +// description : C++ source for the �name� and its alowed +// methods for commands and attributes +// +// project : Storage Ring Access. +// +// $Author: graziano $ +// +// $Revision: 1.1 $ +// $Date: 2012-10-30 09:29:15 $ +// +// SVN only: +// $HeadURL: $ +// +// CVS only: +// $Source: /home/cvsadm/cvsroot/fermi/servers/accessconf/src/AccessConfStateMachine.cpp,v $ +// $Log: AccessConfStateMachine.cpp,v $ +// Revision 1.1 2012-10-30 09:29:15 graziano +// *** empty log message *** +// +// +// +//============================================================================= +// This file is generated by POGO +// (Program Obviously used to Generate tango Object) +//============================================================================= + + + +#include <AccessConf.h> +#include <AccessConfClass.h> + +/*----- PROTECTED REGION END -----*/ + + +/* + * AccessConf states description: + * + */ + +namespace AccessConf_ns +{ + +//================================================= +// Attributes Allowed Methods +//================================================= +//-------------------------------------------------------- +/** + * Method : AccessConf::is_Version_allowed() + * Description : Execution allowed for Version attribute. + */ +//-------------------------------------------------------- + +bool AccessConf::is_Version_allowed(Tango::AttReqType type) +{ + // Not any excluded states for Version attribute in READ access. + + /*----- PROTECTED REGION ID(AccessConf::read_VersionAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // AccessConf::read_VersionAllowed_READ + + return true; +} + +//-------------------------------------------------------- +/** + * Method : AccessConf::is_BoolScalarDynState_allowed() + * Description : Execution allowed for BoolScalarDyn attribute. + */ +//-------------------------------------------------------- + +bool AccessConf::is_BoolScalarDyn_allowed(Tango::AttReqType type) +{ + // Not any excluded states for BoolScalarDyn attribute in READ access. + + /*----- PROTECTED REGION ID(AccessConf::read_BoolScalarDynStateAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // AccessConf::read_BoolScalarDynStateAllowed_READ + + return true; +} + +//-------------------------------------------------------- +/** + * Method : AccessConf::is_BoolSpectrumDynState_allowed() + * Description : Execution allowed for BoolSpectrumDyn attribute. + */ +//-------------------------------------------------------- + +bool AccessConf::is_BoolSpectrumDyn_allowed(Tango::AttReqType type) +{ + // Not any excluded states for BoolSpectrumDyn attribute in READ access. + + /*----- PROTECTED REGION ID(AccessConf::read_BoolSpectrumDynStateAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // AccessConf::read_BoolSpectrumDynStateAllowed_READ + + return true; +} + +//-------------------------------------------------------- +/** + * Method : AccessConf::is_StringSpectrumDynState_allowed() + * Description : Execution allowed for StringSpectrumDyn attribute. + */ +//-------------------------------------------------------- + +bool AccessConf::is_StringSpectrumDyn_allowed(Tango::AttReqType type) +{ + // Not any excluded states for StringSpectrumDyn attribute in READ access. + + /*----- PROTECTED REGION ID(AccessConf::read_StringSpectrumDynStateAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // AccessConf::read_StringSpectrumDynStateAllowed_READ + + return true; +} + + + /*----- PROTECTED REGION ID(AccessConf::are_dynamic_attributes_allowed) ENABLED START -----*/ + + // Add your code to check if dynamic attributes are alowed + + /*----- PROTECTED REGION END -----*/ // AccessConf::are_dynamic_attributes_allowed + + +//================================================= +// Commands Allowed Methods +//================================================= + + + + /*----- PROTECTED REGION ID(AccessConf::are_dynamic_commands_allowed) ENABLED START -----*/ + + // Add your code to check if dynamic commands are alowed + + /*----- PROTECTED REGION END -----*/ // AccessConf::are_dynamic_commands_allowed + +} // namespace AccessConf_ns diff --git a/src/ClassFactory.cpp b/src/ClassFactory.cpp new file mode 100644 index 0000000000000000000000000000000000000000..728122a0fbe469173aa4a9ea7db49fb79e026576 --- /dev/null +++ b/src/ClassFactory.cpp @@ -0,0 +1,53 @@ +/*----- PROTECTED REGION ID(AccessConf::ClassFactory.cpp) ENABLED START -----*/ +static const char *RcsId = "$Id: ClassFactory.cpp,v 1.1 2012-10-30 09:29:15 graziano Exp $"; +//============================================================================= +// +// file : ClassFactory.cpp +// +// description : C++ source for the class_factory method of the DServer +// device class. This method is responsible for the creation of +// all class singleton for a device server. It is called +// at device server startup. +// +// project : Storage Ring Access. +// +// $Author: graziano $ +// +// $Revision: 1.1 $ +// $Date: 2012-10-30 09:29:15 $ +// +// SVN only: +// $HeadURL: $ +// +// CVS only: +// $Source: /home/cvsadm/cvsroot/fermi/servers/accessconf/src/ClassFactory.cpp,v $ +// $Log: ClassFactory.cpp,v $ +// Revision 1.1 2012-10-30 09:29:15 graziano +// *** empty log message *** +// +// +// +//============================================================================= +// This file is generated by POGO +// (Program Obviously used to Generate tango Object) +//============================================================================= + + +#include <tango.h> +#include <AccessConfClass.h> + +// Add class header files if needed + + +/** + * Create AccessConf Class singleton and store it in DServer object. + */ + +void Tango::DServer::class_factory() +{ + // Add method class init if needed + + add_class(AccessConf_ns::AccessConfClass::init("AccessConf")); +} + +/*----- PROTECTED REGION END -----*/ diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c5314d311722a02f664152582d3f9c4bd14723f4 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,74 @@ +/*PROTECTED REGION ID(AccessConf::main.cpp) ENABLED START*/ +static const char *RcsId = "$Id: main.cpp,v 1.1 2012-10-30 09:29:15 graziano Exp $"; +//============================================================================= +// +// file : AccessConf.cpp +// +// description : C++ source for the AccessConf device server main. +// The main rule is to initialise (and create) the Tango +// system and to create the DServerClass singleton. +// The main should be the same for every Tango device server. +// +// project : Storage Ring Access. +// +// $Author: graziano $ +// +// $Revision: 1.1 $ +// $Date: 2012-10-30 09:29:15 $ +// +// SVN only: +// $HeadURL: $ +// +// CVS only: +// $Source: /home/cvsadm/cvsroot/fermi/servers/accessconf/src/main.cpp,v $ +// $Log: main.cpp,v $ +// Revision 1.1 2012-10-30 09:29:15 graziano +// *** empty log message *** +// +// +// +//============================================================================= +// This file is generated by POGO +// (Program Obviously used to Generate tango Object) +//============================================================================= + +#include <tango.h> + + +int main(int argc,char *argv[]) +{ + Tango::Util *tg = NULL; + try + { + // Initialise the device server + //---------------------------------------- + tg = Tango::Util::init(argc,argv); + + // Create the device server singleton + // which will create everything + //---------------------------------------- + tg->server_init(false); + + // Run the endless loop + //---------------------------------------- + cout << "Ready to accept request" << endl; + tg->server_run(); + } + catch (bad_alloc) + { + cout << "Can't allocate memory to store device object !!!" << endl; + cout << "Exiting" << endl; + } + catch (CORBA::Exception &e) + { + Tango::Except::print_exception(e); + + cout << "Received a CORBA_Exception" << endl; + cout << "Exiting" << endl; + } + if (tg!=NULL) + tg->server_cleanup(); + return(0); +} +/*PROTECTED REGION END*/ +//========================================================