diff --git a/doc/doc_html/Attributes.html b/doc/doc_html/Attributes.html index de5bd8b914a3e39391ca3d140285144e063ef07b..1c88911dea6cfe7a4fd6670e46cb64406b4f0b6b 100755 --- a/doc/doc_html/Attributes.html +++ b/doc/doc_html/Attributes.html @@ -69,46 +69,46 @@ Revision: - Author: buteau </Center> <Br><Br><Br><Br><Br> -<!--- html Footer ---> - -<Center> -<Font size=-1> -<br> -<br> -<TABLE BORDER="1" WIDTH="100%"> - <Tr> - <!--- Hosted by Sourceforge ---> - <Td Align="Center"> - <Font size=-1> - <b>TANGO</b> is an open source project hosted by :<br> - <A href="http://sourceforge.net" Target="new"> - <IMG title="Sourceforge logo" - alt="Sourceforge logo small" - src="http://www.esrf.fr/computing/cs/tango/sourceforge.gif" - border=0> </a> - </Font> - </Td> - <!--- 2 Sourceforge Repositories ---> - <Td Align="Center"> - <Font size=-1> - Core and Tools : - <a href="http://tango-cs.cvs.sourceforge.net/tango-cs/" Target="new"> - CVS repository</a> on - <a href="https://sourceforge.net/projects/tango-cs" Target=new> - tango-cs project</a> - - <br> - - Device Servers : - <a href="http://tango-ds.cvs.sourceforge.net/tango-ds/" Target="new"> - CVS repository</a> on - <a href="https://sourceforge.net/projects/tango-ds" Target=new> - tango-ds project</a> - </Font> - </Td> - </Tr> -</Table> -</Font> -</Center> -</body> -</html> +<!--- html Footer ---> + +<Center> +<Font size=-1> +<br> +<br> +<TABLE BORDER="1" WIDTH="100%"> + <Tr> + <!--- Hosted by Sourceforge ---> + <Td Align="Center"> + <Font size=-1> + <b>TANGO</b> is an open source project hosted by :<br> + <A href="http://sourceforge.net" Target="new"> + <IMG title="Sourceforge logo" + alt="Sourceforge logo small" + src="http://www.esrf.fr/computing/cs/tango/sourceforge.gif" + border=0> </a> + </Font> + </Td> + <!--- 2 Sourceforge Repositories ---> + <Td Align="Center"> + <Font size=-1> + Core and Tools : + <a href="http://tango-cs.cvs.sourceforge.net/tango-cs/" Target="new"> + CVS repository</a> on + <a href="https://sourceforge.net/projects/tango-cs" Target=new> + tango-cs project</a> + + <br> + + Device Servers : + <a href="http://tango-ds.cvs.sourceforge.net/tango-ds/" Target="new"> + CVS repository</a> on + <a href="https://sourceforge.net/projects/tango-ds" Target=new> + tango-ds project</a> + </Font> + </Td> + </Tr> +</Table> +</Font> +</Center> +</body> +</html> diff --git a/doc/doc_html/Description.html b/doc/doc_html/Description.html index a17c7f1fa6a08570ddab413b660483843df3b12c..e9447e29e1f6da05c24204d7955166a081adb023 100755 --- a/doc/doc_html/Description.html +++ b/doc/doc_html/Description.html @@ -1,129 +1,129 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> -<HTML> -<HEAD> -<Title> Tango Device Server User s Guide </Title> -</HEAD> -<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#7F00FF" ALINK="#FF0000"> - -<P><!-------TITLE------></P> -<TABLE BORDER="0" WIDTH="100%"> - <TR> - <TD ALIGN="left"> - <A HREF="http://www.esrf.fr/" TARGET=new> - <IMG SRC="http://www.esrf.fr/gifs/logo/80.gif" BORDER=0 Height="60"></A> - - </TD> - <TD ALIGN="center"> - <A HREF="http://www.elettra.trieste.it/" TARGET=new> - <IMG SRC="http://www.esrf.fr/computing/cs/tango/elettra_logo.gif" BORDER=0 Height="60"></A> - </TD> - <TD ALIGN="center"> - <A HREF="http://www.synchrotron-soleil.fr/" TARGET=new> - <IMG SRC="http://www.esrf.fr/computing/cs/tango/soleil_logo.gif" BORDER=0 Height="60"></A> - </TD> - - <TD ALIGN="center"> - <A HREF="http://www.cells.es/" TARGET=new> - <IMG SRC="http://www.esrf.fr/computing/cs/tango/alba.jpg" BORDER=0 Height="45"></A> - </TD> - <TD ALIGN="Right"> - <H2><FONT COLOR="#7F00FF"> - <Br><Center><A HREF="http://www.tango-controls.org/" TARGET="_top"> TANGO </a> - </Center></FONT> - - </TD> - </TR> - <TR> - <TD ALIGN="left"> - <A HREF="http://www.desy.de/html/home/index_eng.html" TARGET=new> - <IMG SRC="http://www.esrf.fr/computing/cs/tango/desy.gif" BORDER=0 Height="44"></A> - </TD> - <TD ALIGN="center"> - <A HREF="http://www.maxlab.lu.se/maxlab/max4/index.html" TARGET=new> - - <IMG SRC="http://www.esrf.fr/computing/cs/tango/maxlab.gif" BORDER=0 Height="40"></A> - </TD> - <TD ALIGN="center"> - <A HREF="http://www.frm2.tum.de/en/index.html" TARGET=new> - <IMG SRC="http://www.esrf.fr/computing/cs/tango/frm-2.jpg" BORDER=0 Height="45"></A> - </TD> - <TD> - <!-- Empty --> - </TD> - - <TD ALIGN="Right"> - <H2><FONT COLOR="#7F00FF"> - <Center> Device Servers - </Center></FONT> - </TD> - </TR> -</TABLE> - -<HR WIDTH="100%"></H5> - - - - -<HR WIDTH="100%"></H5> -<Br> -<center> -<h1> -SingleShotAO Generic Device <Br> -Device Description <Br> <Br> -SingleShotAO Class <Br> -</h1> -<b> -Revision: - Author: buteau -</b> -</center> - - -<Center> -ADLink boards support for single shot AO operations [PCI-6208 and compatible boards] -<Br> -<Br> -</Center> - -<!--- html Footer ---> - -<Center> -<Font size=-1> -<br> -<br> -<TABLE BORDER="1" WIDTH="100%"> - <Tr> - <!--- Hosted by Sourceforge ---> - <Td Align="Center"> - <Font size=-1> - <b>TANGO</b> is an open source project hosted by :<br> - <A href="http://sourceforge.net" Target="new"> - <IMG title="Sourceforge logo" - alt="Sourceforge logo small" - src="http://www.esrf.fr/computing/cs/tango/sourceforge.gif" - border=0> </a> - </Font> - </Td> - <!--- 2 Sourceforge Repositories ---> - <Td Align="Center"> - <Font size=-1> - Core and Tools : - <a href="http://tango-cs.cvs.sourceforge.net/tango-cs/" Target="new"> - CVS repository</a> on - <a href="https://sourceforge.net/projects/tango-cs" Target=new> - tango-cs project</a> - - <br> - - Device Servers : - <a href="http://tango-ds.cvs.sourceforge.net/tango-ds/" Target="new"> - CVS repository</a> on - <a href="https://sourceforge.net/projects/tango-ds" Target=new> - tango-ds project</a> - </Font> - </Td> - </Tr> -</Table> -</Font> -</Center> -</body> -</html> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<Title> Tango Device Server User s Guide </Title> +</HEAD> +<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#7F00FF" ALINK="#FF0000"> + +<P><!-------TITLE------></P> +<TABLE BORDER="0" WIDTH="100%"> + <TR> + <TD ALIGN="left"> + <A HREF="http://www.esrf.fr/" TARGET=new> + <IMG SRC="http://www.esrf.fr/gifs/logo/80.gif" BORDER=0 Height="60"></A> + + </TD> + <TD ALIGN="center"> + <A HREF="http://www.elettra.trieste.it/" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/elettra_logo.gif" BORDER=0 Height="60"></A> + </TD> + <TD ALIGN="center"> + <A HREF="http://www.synchrotron-soleil.fr/" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/soleil_logo.gif" BORDER=0 Height="60"></A> + </TD> + + <TD ALIGN="center"> + <A HREF="http://www.cells.es/" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/alba.jpg" BORDER=0 Height="45"></A> + </TD> + <TD ALIGN="Right"> + <H2><FONT COLOR="#7F00FF"> + <Br><Center><A HREF="http://www.tango-controls.org/" TARGET="_top"> TANGO </a> + </Center></FONT> + + </TD> + </TR> + <TR> + <TD ALIGN="left"> + <A HREF="http://www.desy.de/html/home/index_eng.html" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/desy.gif" BORDER=0 Height="44"></A> + </TD> + <TD ALIGN="center"> + <A HREF="http://www.maxlab.lu.se/maxlab/max4/index.html" TARGET=new> + + <IMG SRC="http://www.esrf.fr/computing/cs/tango/maxlab.gif" BORDER=0 Height="40"></A> + </TD> + <TD ALIGN="center"> + <A HREF="http://www.frm2.tum.de/en/index.html" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/frm-2.jpg" BORDER=0 Height="45"></A> + </TD> + <TD> + <!-- Empty --> + </TD> + + <TD ALIGN="Right"> + <H2><FONT COLOR="#7F00FF"> + <Center> Device Servers + </Center></FONT> + </TD> + </TR> +</TABLE> + +<HR WIDTH="100%"></H5> + + + + +<HR WIDTH="100%"></H5> +<Br> +<center> +<h1> +SingleShotAO Generic Device <Br> +Device Description <Br> <Br> +SingleShotAO Class <Br> +</h1> +<b> +Revision: - Author: buteau +</b> +</center> + + +<Center> +ADLink boards support for single shot AO operations [PCI-6208 and compatible boards] +<Br> +<Br> +</Center> + +<!--- html Footer ---> + +<Center> +<Font size=-1> +<br> +<br> +<TABLE BORDER="1" WIDTH="100%"> + <Tr> + <!--- Hosted by Sourceforge ---> + <Td Align="Center"> + <Font size=-1> + <b>TANGO</b> is an open source project hosted by :<br> + <A href="http://sourceforge.net" Target="new"> + <IMG title="Sourceforge logo" + alt="Sourceforge logo small" + src="http://www.esrf.fr/computing/cs/tango/sourceforge.gif" + border=0> </a> + </Font> + </Td> + <!--- 2 Sourceforge Repositories ---> + <Td Align="Center"> + <Font size=-1> + Core and Tools : + <a href="http://tango-cs.cvs.sourceforge.net/tango-cs/" Target="new"> + CVS repository</a> on + <a href="https://sourceforge.net/projects/tango-cs" Target=new> + tango-cs project</a> + + <br> + + Device Servers : + <a href="http://tango-ds.cvs.sourceforge.net/tango-ds/" Target="new"> + CVS repository</a> on + <a href="https://sourceforge.net/projects/tango-ds" Target=new> + tango-ds project</a> + </Font> + </Td> + </Tr> +</Table> +</Font> +</Center> +</body> +</html> diff --git a/doc/doc_html/DevCommands.html b/doc/doc_html/DevCommands.html index 743fb02c34a770244e8c26ee22bd97589ff9e3e1..306b6711a5719a5f1086d005d1948c8f376e49be 100755 --- a/doc/doc_html/DevCommands.html +++ b/doc/doc_html/DevCommands.html @@ -117,46 +117,46 @@ The language device desctructor automatically calls the <i> delete_device() </i> </ul><Br> <Br> -<!--- html Footer ---> - -<Center> -<Font size=-1> -<br> -<br> -<TABLE BORDER="1" WIDTH="100%"> - <Tr> - <!--- Hosted by Sourceforge ---> - <Td Align="Center"> - <Font size=-1> - <b>TANGO</b> is an open source project hosted by :<br> - <A href="http://sourceforge.net" Target="new"> - <IMG title="Sourceforge logo" - alt="Sourceforge logo small" - src="http://www.esrf.fr/computing/cs/tango/sourceforge.gif" - border=0> </a> - </Font> - </Td> - <!--- 2 Sourceforge Repositories ---> - <Td Align="Center"> - <Font size=-1> - Core and Tools : - <a href="http://tango-cs.cvs.sourceforge.net/tango-cs/" Target="new"> - CVS repository</a> on - <a href="https://sourceforge.net/projects/tango-cs" Target=new> - tango-cs project</a> - - <br> - - Device Servers : - <a href="http://tango-ds.cvs.sourceforge.net/tango-ds/" Target="new"> - CVS repository</a> on - <a href="https://sourceforge.net/projects/tango-ds" Target=new> - tango-ds project</a> - </Font> - </Td> - </Tr> -</Table> -</Font> -</Center> -</body> -</html> +<!--- html Footer ---> + +<Center> +<Font size=-1> +<br> +<br> +<TABLE BORDER="1" WIDTH="100%"> + <Tr> + <!--- Hosted by Sourceforge ---> + <Td Align="Center"> + <Font size=-1> + <b>TANGO</b> is an open source project hosted by :<br> + <A href="http://sourceforge.net" Target="new"> + <IMG title="Sourceforge logo" + alt="Sourceforge logo small" + src="http://www.esrf.fr/computing/cs/tango/sourceforge.gif" + border=0> </a> + </Font> + </Td> + <!--- 2 Sourceforge Repositories ---> + <Td Align="Center"> + <Font size=-1> + Core and Tools : + <a href="http://tango-cs.cvs.sourceforge.net/tango-cs/" Target="new"> + CVS repository</a> on + <a href="https://sourceforge.net/projects/tango-cs" Target=new> + tango-cs project</a> + + <br> + + Device Servers : + <a href="http://tango-ds.cvs.sourceforge.net/tango-ds/" Target="new"> + CVS repository</a> on + <a href="https://sourceforge.net/projects/tango-ds" Target=new> + tango-ds project</a> + </Font> + </Td> + </Tr> +</Table> +</Font> +</Center> +</body> +</html> diff --git a/doc/doc_html/DevCommandsFrame.html b/doc/doc_html/DevCommandsFrame.html index f56da4036180e731a7abd94d44e495da48d4d64e..a696d50e0bf0b56077f6f4addb65cdd9084e6d4e 100755 --- a/doc/doc_html/DevCommandsFrame.html +++ b/doc/doc_html/DevCommandsFrame.html @@ -1,19 +1,19 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> -<HTML> -<HEAD> -<Title> Tango Device Server User's Guide </Title> -</HEAD> - -<FRAMESET cols="20%,80%"> -<FRAME src="DevCommandsList.html" name="DevCommandsList"> -<FRAME src="DevCommands.html" name="DevCommands"> -</FRAMESET> -<NOFRAMES> -<H2> -Frame Alert</H2> - -<P> -This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. -<BR> -Link to <A HREF="DevCommands.html">Non-frame version.</A></NOFRAMES> -</HTML> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<Title> Tango Device Server User's Guide </Title> +</HEAD> + +<FRAMESET cols="20%,80%"> +<FRAME src="DevCommandsList.html" name="DevCommandsList"> +<FRAME src="DevCommands.html" name="DevCommands"> +</FRAMESET> +<NOFRAMES> +<H2> +Frame Alert</H2> + +<P> +This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. +<BR> +Link to <A HREF="DevCommands.html">Non-frame version.</A></NOFRAMES> +</HTML> diff --git a/doc/doc_html/DevCommandsTable.html b/doc/doc_html/DevCommandsTable.html index ef79438511147dd61f80eccd7201fd7d7135941a..7c2194aa16025d7f197d1776a3795ac3ae818715 100755 --- a/doc/doc_html/DevCommandsTable.html +++ b/doc/doc_html/DevCommandsTable.html @@ -81,46 +81,46 @@ Revision: - Author: buteau </Table></Center> -<!--- html Footer ---> - -<Center> -<Font size=-1> -<br> -<br> -<TABLE BORDER="1" WIDTH="100%"> - <Tr> - <!--- Hosted by Sourceforge ---> - <Td Align="Center"> - <Font size=-1> - <b>TANGO</b> is an open source project hosted by :<br> - <A href="http://sourceforge.net" Target="new"> - <IMG title="Sourceforge logo" - alt="Sourceforge logo small" - src="http://www.esrf.fr/computing/cs/tango/sourceforge.gif" - border=0> </a> - </Font> - </Td> - <!--- 2 Sourceforge Repositories ---> - <Td Align="Center"> - <Font size=-1> - Core and Tools : - <a href="http://tango-cs.cvs.sourceforge.net/tango-cs/" Target="new"> - CVS repository</a> on - <a href="https://sourceforge.net/projects/tango-cs" Target=new> - tango-cs project</a> - - <br> - - Device Servers : - <a href="http://tango-ds.cvs.sourceforge.net/tango-ds/" Target="new"> - CVS repository</a> on - <a href="https://sourceforge.net/projects/tango-ds" Target=new> - tango-ds project</a> - </Font> - </Td> - </Tr> -</Table> -</Font> -</Center> -</body> -</html> +<!--- html Footer ---> + +<Center> +<Font size=-1> +<br> +<br> +<TABLE BORDER="1" WIDTH="100%"> + <Tr> + <!--- Hosted by Sourceforge ---> + <Td Align="Center"> + <Font size=-1> + <b>TANGO</b> is an open source project hosted by :<br> + <A href="http://sourceforge.net" Target="new"> + <IMG title="Sourceforge logo" + alt="Sourceforge logo small" + src="http://www.esrf.fr/computing/cs/tango/sourceforge.gif" + border=0> </a> + </Font> + </Td> + <!--- 2 Sourceforge Repositories ---> + <Td Align="Center"> + <Font size=-1> + Core and Tools : + <a href="http://tango-cs.cvs.sourceforge.net/tango-cs/" Target="new"> + CVS repository</a> on + <a href="https://sourceforge.net/projects/tango-cs" Target=new> + tango-cs project</a> + + <br> + + Device Servers : + <a href="http://tango-ds.cvs.sourceforge.net/tango-ds/" Target="new"> + CVS repository</a> on + <a href="https://sourceforge.net/projects/tango-ds" Target=new> + tango-ds project</a> + </Font> + </Td> + </Tr> +</Table> +</Font> +</Center> +</body> +</html> diff --git a/doc/doc_html/Properties.html b/doc/doc_html/Properties.html index d924365db046d187ba7eea5c2b6a427be106a702..3f676a09f083ef4890c2129cbfcecb8e83c6203d 100755 --- a/doc/doc_html/Properties.html +++ b/doc/doc_html/Properties.html @@ -99,46 +99,46 @@ There is no Class properties.<Br><Br> </Center></b> <Br> <Br> <Br> -<!--- html Footer ---> - -<Center> -<Font size=-1> -<br> -<br> -<TABLE BORDER="1" WIDTH="100%"> - <Tr> - <!--- Hosted by Sourceforge ---> - <Td Align="Center"> - <Font size=-1> - <b>TANGO</b> is an open source project hosted by :<br> - <A href="http://sourceforge.net" Target="new"> - <IMG title="Sourceforge logo" - alt="Sourceforge logo small" - src="http://www.esrf.fr/computing/cs/tango/sourceforge.gif" - border=0> </a> - </Font> - </Td> - <!--- 2 Sourceforge Repositories ---> - <Td Align="Center"> - <Font size=-1> - Core and Tools : - <a href="http://tango-cs.cvs.sourceforge.net/tango-cs/" Target="new"> - CVS repository</a> on - <a href="https://sourceforge.net/projects/tango-cs" Target=new> - tango-cs project</a> - - <br> - - Device Servers : - <a href="http://tango-ds.cvs.sourceforge.net/tango-ds/" Target="new"> - CVS repository</a> on - <a href="https://sourceforge.net/projects/tango-ds" Target=new> - tango-ds project</a> - </Font> - </Td> - </Tr> -</Table> -</Font> -</Center> -</body> -</html> +<!--- html Footer ---> + +<Center> +<Font size=-1> +<br> +<br> +<TABLE BORDER="1" WIDTH="100%"> + <Tr> + <!--- Hosted by Sourceforge ---> + <Td Align="Center"> + <Font size=-1> + <b>TANGO</b> is an open source project hosted by :<br> + <A href="http://sourceforge.net" Target="new"> + <IMG title="Sourceforge logo" + alt="Sourceforge logo small" + src="http://www.esrf.fr/computing/cs/tango/sourceforge.gif" + border=0> </a> + </Font> + </Td> + <!--- 2 Sourceforge Repositories ---> + <Td Align="Center"> + <Font size=-1> + Core and Tools : + <a href="http://tango-cs.cvs.sourceforge.net/tango-cs/" Target="new"> + CVS repository</a> on + <a href="https://sourceforge.net/projects/tango-cs" Target=new> + tango-cs project</a> + + <br> + + Device Servers : + <a href="http://tango-ds.cvs.sourceforge.net/tango-ds/" Target="new"> + CVS repository</a> on + <a href="https://sourceforge.net/projects/tango-ds" Target=new> + tango-ds project</a> + </Font> + </Td> + </Tr> +</Table> +</Font> +</Center> +</body> +</html> diff --git a/doc/doc_html/TangoDevStates.html b/doc/doc_html/TangoDevStates.html index e2164112d6e4de471c082ac26be9f939a65c4d36..7d7aef369600573ba7ee8dafb9bc2a773649b5c6 100755 --- a/doc/doc_html/TangoDevStates.html +++ b/doc/doc_html/TangoDevStates.html @@ -79,46 +79,46 @@ Revision: - Author: buteau </Table> </Center> -<!--- html Footer ---> - -<Center> -<Font size=-1> -<br> -<br> -<TABLE BORDER="1" WIDTH="100%"> - <Tr> - <!--- Hosted by Sourceforge ---> - <Td Align="Center"> - <Font size=-1> - <b>TANGO</b> is an open source project hosted by :<br> - <A href="http://sourceforge.net" Target="new"> - <IMG title="Sourceforge logo" - alt="Sourceforge logo small" - src="http://www.esrf.fr/computing/cs/tango/sourceforge.gif" - border=0> </a> - </Font> - </Td> - <!--- 2 Sourceforge Repositories ---> - <Td Align="Center"> - <Font size=-1> - Core and Tools : - <a href="http://tango-cs.cvs.sourceforge.net/tango-cs/" Target="new"> - CVS repository</a> on - <a href="https://sourceforge.net/projects/tango-cs" Target=new> - tango-cs project</a> - - <br> - - Device Servers : - <a href="http://tango-ds.cvs.sourceforge.net/tango-ds/" Target="new"> - CVS repository</a> on - <a href="https://sourceforge.net/projects/tango-ds" Target=new> - tango-ds project</a> - </Font> - </Td> - </Tr> -</Table> -</Font> -</Center> -</body> -</html> +<!--- html Footer ---> + +<Center> +<Font size=-1> +<br> +<br> +<TABLE BORDER="1" WIDTH="100%"> + <Tr> + <!--- Hosted by Sourceforge ---> + <Td Align="Center"> + <Font size=-1> + <b>TANGO</b> is an open source project hosted by :<br> + <A href="http://sourceforge.net" Target="new"> + <IMG title="Sourceforge logo" + alt="Sourceforge logo small" + src="http://www.esrf.fr/computing/cs/tango/sourceforge.gif" + border=0> </a> + </Font> + </Td> + <!--- 2 Sourceforge Repositories ---> + <Td Align="Center"> + <Font size=-1> + Core and Tools : + <a href="http://tango-cs.cvs.sourceforge.net/tango-cs/" Target="new"> + CVS repository</a> on + <a href="https://sourceforge.net/projects/tango-cs" Target=new> + tango-cs project</a> + + <br> + + Device Servers : + <a href="http://tango-ds.cvs.sourceforge.net/tango-ds/" Target="new"> + CVS repository</a> on + <a href="https://sourceforge.net/projects/tango-ds" Target=new> + tango-ds project</a> + </Font> + </Td> + </Tr> +</Table> +</Font> +</Center> +</body> +</html> diff --git a/src/ClassFactory.cpp b/src/ClassFactory.cpp index 0840fdd169a3949dcb751ff9b94052117e67b6e9..934d4c44a87951c0a59e467c2491801a69609e7d 100755 --- a/src/ClassFactory.cpp +++ b/src/ClassFactory.cpp @@ -1,62 +1,62 @@ -static const char *RcsId = "$Id: ClassFactory.cpp 13293 2009-04-07 10:53:56Z pascal_verdier $"; -//+============================================================================= -// -// 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 : TANGO Device Server -// -// $Author: pascal_verdier $ -// -// $Revision: 13293 $ -// $Date: 2009-04-07 12:53:56 +0200 (Tue, 07 Apr 2009) $ -// -// SVN only: -// $HeadURL: $ -// -// CVS only: -// $Source$ -// $Log$ -// Revision 3.4 2007/10/23 14:04:30 pascal_verdier -// Spelling mistakes correction -// -// Revision 3.3 2005/03/02 14:06:15 pascal_verdier -// namespace is different than class name. -// -// Revision 3.2 2004/10/25 14:12:00 pascal_verdier -// Minor changes. -// -// Revision 3.1 2004/09/06 09:27:05 pascal_verdier -// Modified for Tango 5 compatibility. -// -// -// copyleft : European Synchrotron Radiation Facility -// BP 220, Grenoble 38043 -// FRANCE -// -//-============================================================================= -// -// This file is generated by POGO -// (Program Obviously used to Generate tango Object) -// -// (c) - Software Engineering Group - ESRF -//============================================================================= - - -#include <tango.h> -#include <SingleShotAOClass.h> - -/** - * Create SingleShotAOClass singleton and store it in DServer object. - */ - -void Tango::DServer::class_factory() -{ - - add_class(SingleShotAO_ns::SingleShotAOClass::init("SingleShotAO")); - -} +static const char *RcsId = "$Id: ClassFactory.cpp 13293 2009-04-07 10:53:56Z pascal_verdier $"; +//+============================================================================= +// +// 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 : TANGO Device Server +// +// $Author: pascal_verdier $ +// +// $Revision: 13293 $ +// $Date: 2009-04-07 12:53:56 +0200 (Tue, 07 Apr 2009) $ +// +// SVN only: +// $HeadURL: $ +// +// CVS only: +// $Source$ +// $Log$ +// Revision 3.4 2007/10/23 14:04:30 pascal_verdier +// Spelling mistakes correction +// +// Revision 3.3 2005/03/02 14:06:15 pascal_verdier +// namespace is different than class name. +// +// Revision 3.2 2004/10/25 14:12:00 pascal_verdier +// Minor changes. +// +// Revision 3.1 2004/09/06 09:27:05 pascal_verdier +// Modified for Tango 5 compatibility. +// +// +// copyleft : European Synchrotron Radiation Facility +// BP 220, Grenoble 38043 +// FRANCE +// +//-============================================================================= +// +// This file is generated by POGO +// (Program Obviously used to Generate tango Object) +// +// (c) - Software Engineering Group - ESRF +//============================================================================= + + +#include <tango.h> +#include <SingleShotAOClass.h> + +/** + * Create SingleShotAOClass singleton and store it in DServer object. + */ + +void Tango::DServer::class_factory() +{ + + add_class(SingleShotAO_ns::SingleShotAOClass::init("SingleShotAO")); + +} diff --git a/src/SingleShotAO.cpp b/src/SingleShotAO.cpp index 46a79c43ed99cfd5b2f10a42b30bab28fbe69a00..80911971616622960f56ed9669f9cec2cbcc01f1 100755 --- a/src/SingleShotAO.cpp +++ b/src/SingleShotAO.cpp @@ -1,1017 +1,1017 @@ -static const char *RcsId = "$Id: DevServ.cpp 13293 2009-04-07 10:53:56Z pascal_verdier $"; -//+============================================================================= -// -// file : SingleShotAO.cpp -// -// description : C++ source for the SingleShotAO 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 -// SingleShotAO are implemented in this file. -// -// project : TANGO Device Server -// -// $Author: pascal_verdier $ -// -// $Revision: 13293 $ -// -// $Revision: 13293 $ -// $Date: 2009-04-07 12:53:56 +0200 (Tue, 07 Apr 2009) $ -// -// SVN only: -// $HeadURL: $ -// -// CVS only: -// $Source$ -// $Log$ -// Revision 3.5 2007/10/24 12:07:35 pascal_verdier -// Another spelling mistake correction -// -// Revision 3.4 2007/10/23 14:04:30 pascal_verdier -// Spelling mistakes correction -// -// Revision 3.3 2005/03/02 14:06:15 pascal_verdier -// namespace is different than class name. -// -// Revision 3.2 2004/11/08 11:33:16 pascal_verdier -// if device property not found in database, it takes class property value if exists. -// -// Revision 3.1 2004/09/06 09:27:05 pascal_verdier -// Modified for Tango 5 compatibility. -// -// -// copyleft : Synchrotron SOLEIL -// L'Orme des merisiers - Saint Aubin -// BP48 - 91192 Gif sur Yvette -// FRANCE -// -//-============================================================================= -// -// This file is generated by POGO -// (Program Obviously used to Generate tango Object) -// -// (c) - Software Engineering Group - ESRF -//============================================================================= - - - -//=================================================================== -// -// The following table gives the correspondence -// between commands and method name. -// -// Command name| Method name -// ---------------------------------------- -// State | dev_state() -// Status | dev_status() -// Abort | abort() -// -//=================================================================== - - -#include <tango.h> -#include <yat4tango/Logging.h> -#include <yat4tango/DeviceInfo.h> -#include <SingleShotAO.h> -#include <SingleShotAOClass.h> -#include "SingleShotAOTypesAndConsts.h" - - -namespace SingleShotAO_ns -{ - -//- check manager macro: -#define CHECK_MANAGER() \ - do \ - { \ - if (! m_manager) \ - THROW_DEVFAILED("DEVICE_ERROR", \ - "request aborted - the manager isn't accessible ", \ - "SingleShotAO::check_manager"); \ -} while (0) - - -//+---------------------------------------------------------------------------- -// -// method : SingleShotAO::SingleShotAO(string &s) -// -// description : constructor for simulated SingleShotAO -// -// in : - cl : Pointer to the DeviceClass object -// - s : Device name -// -//----------------------------------------------------------------------------- -SingleShotAO::SingleShotAO(Tango::DeviceClass *cl,string &s) -:TANGO_BASE_CLASS(cl,s.c_str()) -{ - init_device(); -} - -SingleShotAO::SingleShotAO(Tango::DeviceClass *cl,const char *s) -:TANGO_BASE_CLASS(cl,s) -{ - init_device(); -} - -SingleShotAO::SingleShotAO(Tango::DeviceClass *cl,const char *s,const char *d) -:TANGO_BASE_CLASS(cl,s,d) -{ - init_device(); -} - - -//+---------------------------------------------------------------------------- -// -// method : SingleShotAO::delete_device() -// -// description : will be called at device destruction or at init command. -// -//----------------------------------------------------------------------------- -void SingleShotAO::delete_device() -{ - // Delete device allocated objects - yat4tango::TraceHelper t("SingleShotAO::delete_device", this); - - if (m_manager) - { - m_manager->exit(); - m_manager = NULL; - } - - //- release the asl::SingleShotAO object - if (m_ssao) - { - delete m_ssao; - m_ssao = NULL; - } - - // remove dynamic attributes - if (m_dyn_attr_manager) - { - try - { - m_dyn_attr_manager->remove_attributes(); - } - catch (...) - { - //- ignore any error - } - } - - // delete dynamic attributes manager - if (m_dyn_attr_manager) - { - delete m_dyn_attr_manager; - m_dyn_attr_manager = NULL; - } - - //- remove the inner appender - yat4tango::Logging::release(this); - yat4tango::DeviceInfo::release(this); -} - - -//+---------------------------------------------------------------------------- -// -// method : SingleShotAO::init_device() -// -// description : will be called at device initialization. -// -//----------------------------------------------------------------------------- -void SingleShotAO::init_device() -{ - //- initialize the inner appender (first thing to do) - try - { - INFO_STREAM << "Create the InnerAppender & FileAppender in order to manage logs." << endl; - yat4tango::Logging::initialize(this); - - INFO_STREAM << "Create the DeviceInfo in order to manage info on versions." << endl; - yat4tango::DeviceInfo::initialize(this, YAT_XSTR(PROJECT_NAME), YAT_XSTR(PROJECT_VERSION)); - // yat4tango::DeviceInfo::add_dependency(this, "Dependency Name", YAT_XSTR(dependency_name_PROJECT_VERSION)); - // TODO: Add dependencies - } - catch (Tango::DevFailed &df) - { - ERROR_STREAM << df << std::endl; - m_state = Tango::FAULT; - m_currStatus = "initialization failed - could not instantiate the InnerAppender"; - return; - } - - INFO_STREAM << "Initializing device"; - - //- trace/profile this method - yat4tango::TraceHelper t("SingleShotAO::init_device", this); - - // Initialise variables to default values - //-------------------------------------------- - - //- init members - m_ssao = NULL; - critical_properties_missing = false; - isInitOk = false; - m_frequency = 0.0; - m_dyn_attr_manager = NULL; - m_state = Tango::INIT; - - // Initialise variables to default values - //-------------------------------------------- - try - { - get_device_property(); - } - catch (const Tango::DevFailed& df) - { - ERROR_STREAM << "SingleShotAO::init_device::Tango::DevFailed exception caught " - << "while trying to read device properties from TANGO database" - << std::endl; - ERROR_STREAM << df << std::endl; - m_currStatus = "Failed to get property. See log for details"; - m_state = Tango::FAULT; - return; - } - catch (...) - { - //- update internal state - ERROR_STREAM << "SingleShotAO::init_device::unknown exception caught " - << "while trying to read device properties from TANGO database" - << std::endl; - m_currStatus = "Failed to get property. See log for details"; - m_state = Tango::FAULT; - return; - } - - //- abort initialization if properties missing - if (critical_properties_missing) - { - ERROR_STREAM << "configuration error - unspecified or invalid device properties"; - m_currStatus = "configuration error [unspecified or invalid device properties]. See log for details"; - m_state = Tango::FAULT; - return; - } - - //- allocate the asl::SingleShotAO object - m_ssao = new asl::SingleShotAO; - if (m_ssao == 0) - { - m_currStatus = "Failed to create the SignleShotAO. See log for details"; - m_state = Tango::FAULT; - return; - } - - try - { - //- initialze the hardware - m_ssao->init(boardTypeId, boardNum); - } - catch(const asl::DAQException& de) - { - ERROR_STREAM << daq_to_tango_exception(de) << endl; - m_currStatus = "Failed to init the SignleShotAO. See log for details"; - m_state = Tango::FAULT; - return; - } - catch(...) - { - ERROR_STREAM << "SingleShotAO::init_device::unknown exception caught"<<std::endl; - m_currStatus = "Failed to init the SignleShotAO. See log for details"; - m_state = Tango::FAULT; - return; - } - - // initialize channel number according to board type - m_nb_chan = 0; - if (boardType == k6208_BOARD_TYPE) - { - m_nb_chan = 8; - } - if (boardType == k6216_BOARD_TYPE) - { - m_nb_chan = 16; - } - - - // construct the AO manager - //-------------------------------------------- - try - { - m_manager = new SingleShotAOManager(this); - } - catch (...) - { - ERROR_STREAM << "initialization failed - failed to create manager" << std::endl; - m_currStatus = "initialization failed [failed to create manager]. See log for details"; - m_state = Tango::FAULT; - return; - } - - // test the manager - if (!m_manager) - { - ERROR_STREAM << "initialization failed - the manager is not created" << std::endl; - m_currStatus = "initialization failed [the manager is not created]. See log for details"; - m_state = Tango::FAULT; - return; - } - - // get frequency value in database - try - { - m_frequency = yat4tango::PropertyHelper::get_memorized_attribute<double>(this,"frequency"); - DEBUG_STREAM << "Frequency : " << m_frequency << endl; - } - catch (...) - { - DEBUG_STREAM << "Failed to get frequency value. Maybe there is no value yet." << std::endl; - } - - - // initialize the AO manager - //-------------------------------------------- - try - { - m_manager->init(m_ssao, m_nb_chan, m_frequency); - } - catch (Tango::DevFailed & df) - { - ERROR_STREAM << df << std::endl; - m_currStatus = "initialization failed - Manager initialization failed [see device log for details]"; - m_state = Tango::FAULT; - return; - } - catch (...) - { - ERROR_STREAM << "initialization failed - failed to initialize manager" << std::endl; - m_currStatus = "initialization failed [failed to initialize manager]. See log for details"; - m_state = Tango::FAULT; - return; - } - - // create dynamic attribute manager - try - { - m_dyn_attr_manager = new yat4tango::DynamicAttributeManager(this); - } - catch (Tango::DevFailed &e) - { - ERROR_STREAM << e << std::endl; - m_currStatus = "Failed to create Dynamic Attribute Manager. See log for details"; - m_state = Tango::FAULT; - return; - } - catch (...) - { - ERROR_STREAM << "Failed to create Dynamic Attribute Manager" << std::endl; - m_currStatus = "Failed to create Dynamic Attribute Manager. See log for details"; - m_state = Tango::FAULT; - return; - } - - // add dynamic attributes: channel, speed & initial for each channel - std::vector<yat4tango::DynamicAttributeInfo> l_dynAttrList; - for (unsigned int l_cpt = 0; l_cpt < m_nb_chan; l_cpt++) - { - yat::OSStream oss; - oss << l_cpt; - - // ╔═══════════════╗ - // ║ Channel value ║ - // ╚═══════════════╝ - yat4tango::DynamicAttributeInfo dai_channel; - dai_channel.dev = this; - dai_channel.tai.name = kCHANNEL + oss.str(); - dai_channel.tai.label = kCHANNEL + oss.str(); - - //- describe the dyn attr we want... - dai_channel.tai.data_type = Tango::DEV_DOUBLE; - dai_channel.tai.data_format = Tango::SCALAR; - dai_channel.tai.writable = Tango::READ_WRITE; // soso - dai_channel.tai.disp_level = Tango::OPERATOR; - dai_channel.tai.unit = "V"; - dai_channel.tai.standard_unit = "V"; - dai_channel.tai.display_unit = "V"; - dai_channel.tai.max_value = "10.0"; - dai_channel.tai.min_value = "-10.0"; - dai_channel.tai.description = "Output value for channel " + oss.str() + " (in measurementUnit)."; - dai_channel.tai.format = "%1.1f"; - dai_channel.memorized = true; - dai_channel.cdb = false; - - //- read callback - dai_channel.rcb = yat4tango::DynamicAttributeReadCallback::instanciate(const_cast<SingleShotAO&>(*this), - &SingleShotAO::read_channel); - - //- write callback - dai_channel.wcb = yat4tango::DynamicAttributeWriteCallback::instanciate(const_cast<SingleShotAO&>(*this), - &SingleShotAO::write_channel); - - l_dynAttrList.push_back(dai_channel); - - - // ╔═══════════════╗ - // ║ Speed value ║ - // ╚═══════════════╝ - yat4tango::DynamicAttributeInfo dai_speed; - dai_speed.dev = this; - dai_speed.tai.name = kSPEED + oss.str(); - dai_speed.tai.label = kSPEED + oss.str(); - - //- describe the dyn attr we want... - dai_speed.tai.data_type = Tango::DEV_DOUBLE; - dai_speed.tai.data_format = Tango::SCALAR; - dai_speed.tai.writable = Tango::READ_WRITE; - dai_speed.tai.disp_level = Tango::OPERATOR; - dai_speed.tai.unit = "V/s"; - dai_speed.tai.standard_unit = "V/s"; - dai_speed.tai.display_unit = "V/s"; - dai_speed.tai.description = "Speed for ramp generation, in V/s. If speed is NULL, no ramp generated but direct write on channel output " + oss.str() + " (in measurementUnit)."; - dai_speed.tai.format = "%1.1f"; - - //- cleanup tango db option: cleanup tango db when removing this dyn. attr. (i.e. erase its properties from db) - dai_speed.memorized = true; - dai_speed.cdb = false; - - //- read callback - dai_speed.rcb = yat4tango::DynamicAttributeReadCallback::instanciate(const_cast<SingleShotAO&>(*this), - &SingleShotAO::read_speed); - - //- write callback - dai_speed.wcb = yat4tango::DynamicAttributeWriteCallback::instanciate(const_cast<SingleShotAO&>(*this), - &SingleShotAO::write_speed); - - l_dynAttrList.push_back(dai_speed); - - - // ╔═══════════════╗ - // ║ Initial value ║ - // ╚═══════════════╝ - yat4tango::DynamicAttributeInfo dai_initial; - dai_initial.dev = this; - dai_initial.tai.name = kINITIAL + oss.str(); - dai_initial.tai.label = kINITIAL + oss.str(); - - //- describe the dyn attr we want... - dai_initial.tai.data_type = Tango::DEV_DOUBLE; - dai_initial.tai.data_format = Tango::SCALAR; - dai_initial.tai.writable = Tango::READ_WRITE; - dai_initial.tai.disp_level = Tango::OPERATOR; - dai_initial.tai.unit = "V"; - dai_initial.tai.standard_unit = "V"; - dai_initial.tai.display_unit = "V"; - dai_initial.tai.description = "Initial value for ramp function, in V. Defaults to last written value in channel attribute " + oss.str() + "."; - dai_initial.tai.format = "%1.2f"; - - //- cleanup tango db option: cleanup tango db when removing this dyn. attr. (i.e. erase its properties from db) - dai_initial.memorized = true; - dai_initial.cdb = false; - - //- read callback - dai_initial.rcb = yat4tango::DynamicAttributeReadCallback::instanciate(const_cast<SingleShotAO&>(*this), - &SingleShotAO::read_initial); - - //- write callback - dai_initial.wcb = yat4tango::DynamicAttributeWriteCallback::instanciate(const_cast<SingleShotAO&>(*this), - &SingleShotAO::write_initial); - - l_dynAttrList.push_back(dai_initial); - } - - m_dyn_attr_manager->add_attributes(l_dynAttrList); - - // Get memorized values from database - for (unsigned int l_cpt = 0; l_cpt < m_nb_chan; l_cpt++) - { - yat::OSStream oss; - oss << l_cpt; - - // speed value - try - { - std::string attr_name = kSPEED + oss.str(); - std::string name = "__" + attr_name; - - double l_val = yat4tango::PropertyHelper::get_memorized_attribute<double>(this, name); - m_manager->set_speed(l_cpt, l_val); - } - catch (...) - { - // nothing to do - } - - // initial value - try - { - std::string attr_name = kINITIAL + oss.str(); - std::string name = "__" + attr_name; - - // To be activated with Tango 8 - //double l_val = yat4tango::PropertyHelper::get_memorized_attribute<double>(this,name); - double l_val = get_memorized_attribute<double>(name); - m_manager->set_initial(l_cpt, l_val); - } - catch (...) - { - //nothing to do - } - } - - //- GO for task - try - { - m_manager->go(); - } - catch (Tango::DevFailed & df) - { - ERROR_STREAM << df << std::endl; - m_currStatus = "initialization failed [failed to go for manager]"; - m_state = Tango::FAULT; - return; - } - catch (...) - { - ERROR_STREAM << "initialization failed - failed to go for manager" << std::endl; - m_currStatus = "initialization failed [failed to go for manager]. See log for details"; - m_state = Tango::FAULT; - return; - } - - //- update internal state - m_state = Tango::ON; - m_currStatus = "Device ready to execute AO request."; - isInitOk = true; -} - - -//+---------------------------------------------------------------------------- -// -// method : SingleShotAO::get_device_property() -// -// description : Read the device properties from database. -// -//----------------------------------------------------------------------------- -void SingleShotAO::get_device_property() -{ - // Initialize your default values here (if not done with POGO). - //------------------------------------------------------------------ - - // Read device properties from database.(Automatic code generation) - //------------------------------------------------------------------ - Tango::DbData dev_prop; - dev_prop.push_back(Tango::DbDatum("BoardNum")); - dev_prop.push_back(Tango::DbDatum("BoardType")); - - // Call database and extract values - //-------------------------------------------- - if (Tango::Util::instance()->_UseDb==true) - get_db_device()->get_property(dev_prop); - Tango::DbDatum def_prop, cl_prop; - SingleShotAOClass *ds_class = - (static_cast<SingleShotAOClass *>(get_device_class())); - int i = -1; - - // Try to initialize BoardNum from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> boardNum; - else { - // Try to initialize BoardNum from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> boardNum; - } - // And try to extract BoardNum value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> boardNum; - - // Try to initialize BoardType from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> boardType; - else { - // Try to initialize BoardType from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> boardType; - } - // And try to extract BoardType value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> boardType; - - - - // End of Automatic code generation - //------------------------------------------------------------------ - - critical_properties_missing = false; - - if (dev_prop[0].is_empty()) - { - ERROR_STREAM << "Required device property <BoardNum> is missing" << endl; - critical_properties_missing = true; - } - if (dev_prop[1].is_empty()) - { - ERROR_STREAM << "Required device property <BoardType> is missing" << endl; - critical_properties_missing = true; - } - - if (critical_properties_missing) { - return; - } - - //- <BoardNum> ----------------------- - if (boardNum > 7) - { - boardNum = 0; - ERROR_STREAM << "device property <BoardNum> is invalid. Valid range is [0..7]" << endl; - critical_properties_missing = true; - } - - //- <BoardType> ----------------------- - if (boardType == "MAO_6208") - { - boardType = k6208_BOARD_TYPE; - boardTypeId = adl::PCI6208; - } - else if (boardType == "MAO_6216") - { - boardType = k6216_BOARD_TYPE; - boardTypeId = adl::PCI6216; - } - else - { - boardType = kDEFAULT_BOARD_TYPE; - boardTypeId = adl::PCI6208; - ERROR_STREAM << "device property <BoardType> is invalid [supported hw: MAO_6208 or MAO_6216]" << endl; - critical_properties_missing = true; - } - -} - - -//+---------------------------------------------------------------------------- -// -// method : SingleShotAO::always_executed_hook() -// -// description : method always executed before any command is executed -// -//----------------------------------------------------------------------------- -void SingleShotAO::always_executed_hook() -{ - // nothing to do -} - - -//+---------------------------------------------------------------------------- -// -// method : SingleShotAO::read_attr_hardware -// -// description : Hardware acquisition for attributes. -// -//----------------------------------------------------------------------------- -void SingleShotAO::read_attr_hardware(vector<long> &attr_list) -{ - //DEBUG_STREAM << "SingleShotAO::read_attr_hardware(vector<long> &attr_list) entering... "<< endl; - // Add your own code here -} - - -//+---------------------------------------------------------------------------- -// -// method : SingleShotAO::read_frequency -// -// description : Extract real attribute values for Frequency acquisition result. -// -//----------------------------------------------------------------------------- -void SingleShotAO::read_frequency(Tango::Attribute &attr) -{ - //DEBUG_STREAM << "SingleShotAO::read_frequency(Tango::Attribute &attr) entering... "<< endl; - attr.set_value(&m_frequency); -} - - -//+---------------------------------------------------------------------------- -// -// method : SingleShotAO::write_frequency -// -// description : Write Frequency attribute values to hardware. -// -//----------------------------------------------------------------------------- -void SingleShotAO::write_frequency(Tango::WAttribute &attr) -{ - DEBUG_STREAM << "SingleShotAO::write_frequency(Tango::WAttribute &attr) entering... "<< endl; - if (dev_state() != Tango::ON) - { - THROW_DEVFAILED("DEVICE_ERROR", - "could not write frequency. The state must be ON.", - "SingleShotAO::write_frequency"); - } - CHECK_MANAGER(); - attr.get_write_value(m_frequency); - m_manager->write_frequency(m_frequency); - yat4tango::PropertyHelper::set_memorized_attribute(this, "frequency", m_frequency); -} - - -//+------------------------------------------------------------------ -/** -* method: SingleShotAO::dev_state -* -* description: method to execute "State" -* This command gets the device state (stored in its <i>device_state</i> data member) and returns it to the caller. -* -* @return State Code -* -*/ -//+------------------------------------------------------------------ -Tango::DevState SingleShotAO::dev_state() -{ - if (isInitOk) - { - CHECK_MANAGER(); - m_state = m_manager->get_state(); - } - return m_state; -} - - -//+------------------------------------------------------------------ -/** -* method: SingleShotAO::dev_status -* -* description: method to execute "Status" -* This command gets the device status (stored in its <i>device_status</i> data member) and returns it to the caller. -* -* @return Status description -* -*/ -//+------------------------------------------------------------------ -Tango::ConstDevString SingleShotAO::dev_status() -{ - static std::string s = ""; - yat::OSStream oss; - if (isInitOk) - { - CHECK_MANAGER(); - oss << m_manager->get_status() << std::endl; - } - else - { - oss << m_currStatus.c_str() << std::endl; - } - s = oss.str(); - return s.c_str(); -} - - -//+------------------------------------------------------------------ -/** -* method: SingleShotAO::read_channel -* -* description: method to execute "read_channel" for dynamic attributes -* -*/ -//+------------------------------------------------------------------ -void SingleShotAO::read_channel(yat4tango::DynamicAttributeReadCallbackData & cbd) -{ - yat::AutoMutex<> guard(m_lock); - - std::string l_attr_name = cbd.dya->get_name(); - - // name will be channelX - std::string l_str = l_attr_name.substr(7, 2); - yat::uint16 l_idx = atoi(l_str.c_str()); - - CHECK_MANAGER(); - // choose tab depending on l_idx - double l_val = m_manager->get_channel(l_idx); - cbd.tga->set_value(&l_val); -} - - -//+------------------------------------------------------------------ -/** -* method: SingleShotAO::write_channel -* -* description: method to execute "write_channel" for dynamic attributes -* -*/ -//+------------------------------------------------------------------ -void SingleShotAO::write_channel(yat4tango::DynamicAttributeWriteCallbackData & cbd) -{ - double l_val; - cbd.tga->get_write_value(l_val); - - std::string l_attr_name = cbd.dya->get_name(); - - // name will be channelX - std::string l_str = l_attr_name.substr(7, 2); - yat::uint16 l_idx = atoi(l_str.c_str()); - - CHECK_MANAGER(); - try - { - m_manager->write_channel(l_idx, l_val); - } - catch(Tango::DevFailed& df) - { - ERROR_STREAM << df<< endl; - RETHROW_DEVFAILED(df, - "DRIVER_FAILURE", - "could not write channel [caught Tango::DevFailed]", - "SingleShotAO::write_channel"); - } - catch(...) - { - ERROR_STREAM << "SingleShotAOManager::write_channel::unknown exception caught"<<std::endl; - THROW_DEVFAILED("DRIVER_FAILURE", - "could not write channel [unknown error]", - "SingleShotAO::write_channel"); - } -} - - -//+------------------------------------------------------------------ -/** -* method: SingleShotAO::read_speed -* -* description: method to execute "read_speed" for dynamic attributes -* -*/ -//+------------------------------------------------------------------ -void SingleShotAO::read_speed(yat4tango::DynamicAttributeReadCallbackData & cbd) -{ - yat::AutoMutex<> guard(m_lock); - - std::string l_attr_name = cbd.dya->get_name(); - - // name will be speedX - std::string l_str = l_attr_name.substr(5, 2); - yat::uint16 l_idx = atoi(l_str.c_str()); - - CHECK_MANAGER(); - // choose tab depending on l_idx - double l_val = m_manager->get_speed(l_idx); - cbd.tga->set_value(&l_val); -} - - -//+------------------------------------------------------------------ -/** -* method: SingleShotAO::write_speed -* -* description: method to execute "write_speed" for dynamic attributes -* -*/ -//+------------------------------------------------------------------ -void SingleShotAO::write_speed(yat4tango::DynamicAttributeWriteCallbackData & cbd) -{ - DEBUG_STREAM << "SingleShotAO::write_speed(): entering... !" << endl; - - double l_val; - cbd.tga->get_write_value(l_val); - - std::string l_attr_name = cbd.dya->get_name(); - - // name will be speedX - std::string l_str = l_attr_name.substr(5, 2); - yat::uint16 l_idx = atoi(l_str.c_str()); - if (l_val < 0) - { - l_val = -l_val; - } - - CHECK_MANAGER(); - try - { - m_manager->set_speed(l_idx, l_val); - } - catch(Tango::DevFailed& df) - { - ERROR_STREAM << df<< endl; - RETHROW_DEVFAILED(df, - "DRIVER_FAILURE", - "could not write initial [caught Tango::DevFailed]", - "SingleShotAO::write_initial"); - } - catch(...) - { - ERROR_STREAM << "SingleShotAO::write_initial::unknown exception caught"<<std::endl; - THROW_DEVFAILED("DRIVER_FAILURE", - "could not write initial [unknown error]", - "SingleShotAO::write_initial"); - } - // To be activated with Tango 8 - //yat4tango::PropertyHelper::set_memorized_attribute(this, l_attr_name, l_val); - std::string name = "__" + l_attr_name; - store_value_as_property(l_val, name); -} - - -//+------------------------------------------------------------------ -/** -* method: SingleShotAO::read_initial -* -* description: method to execute "read_initial" for dynamic attributes -* -*/ -//+------------------------------------------------------------------ -void SingleShotAO::read_initial(yat4tango::DynamicAttributeReadCallbackData & cbd) -{ - yat::AutoMutex<> guard(m_lock); - - std::string l_attr_name = cbd.dya->get_name(); - - // name will be initialX - std::string l_str = l_attr_name.substr(7, 2); - yat::uint16 l_idx = atoi(l_str.c_str()); - - CHECK_MANAGER(); - // choose tab depending on l_idx - double l_val = m_manager->get_initial(l_idx); - cbd.tga->set_value(&l_val); -} - - -//+------------------------------------------------------------------ -/** -* method: SingleShotAO::write_initial -* -* description: method to execute "write_initial" for dynamic attributes -* -*/ -//+------------------------------------------------------------------ -void SingleShotAO::write_initial(yat4tango::DynamicAttributeWriteCallbackData & cbd) -{ - DEBUG_STREAM << "SingleShotAO::write_initial(): entering... !" << endl; - - double l_val; - cbd.tga->get_write_value(l_val); - - std::string l_attr_name = cbd.dya->get_name(); - - // name will be initialX - std::string l_str = l_attr_name.substr(7, 2); - yat::uint16 l_idx = atoi(l_str.c_str()); - - CHECK_MANAGER(); - try - { - m_manager->set_initial(l_idx, l_val); - } - catch(Tango::DevFailed& df) - { - ERROR_STREAM << df<< endl; - RETHROW_DEVFAILED(df, - "DRIVER_FAILURE", - "could not write initial [caught Tango::DevFailed]", - "SingleShotAO::write_initial"); - } - catch(...) - { - ERROR_STREAM << "SingleShotAO::write_initial::unknown exception caught"<<std::endl; - THROW_DEVFAILED("DRIVER_FAILURE", - "could not write initial [unknown error]", - "SingleShotAO::write_initial"); - } - // To be activated with Tango 8 - //yat4tango::PropertyHelper::set_memorized_attribute(this, l_attr_name, l_val); - std::string name = "__" + l_attr_name; - store_value_as_property(l_val, name); -} - - -//+------------------------------------------------------------------ -/** - * method: SingleShotAO::abort - * - * description: method to execute "Abort" - * Aborts ramps in progress. - * - * - */ -//+------------------------------------------------------------------ -void SingleShotAO::abort() -{ - DEBUG_STREAM << "SingleShotAO::abort(): entering... !" << endl; - - // Add your own code to control device here - CHECK_MANAGER(); - try - { - m_manager->abort(); - } - catch(Tango::DevFailed& df) - { - ERROR_STREAM << df<< endl; - RETHROW_DEVFAILED(df, - "DRIVER_FAILURE", - "could not abort [caught Tango::DevFailed]", - "SingleShotAO::abort"); - } - catch(...) - { - ERROR_STREAM << "SingleShotAOManager::abort::unknown exception caught"<<std::endl; - THROW_DEVFAILED("DRIVER_FAILURE", - "could not abort [unknown error]", - "SingleShotAO::abort"); - } - -} - -} // namespace +static const char *RcsId = "$Id: DevServ.cpp 13293 2009-04-07 10:53:56Z pascal_verdier $"; +//+============================================================================= +// +// file : SingleShotAO.cpp +// +// description : C++ source for the SingleShotAO 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 +// SingleShotAO are implemented in this file. +// +// project : TANGO Device Server +// +// $Author: pascal_verdier $ +// +// $Revision: 13293 $ +// +// $Revision: 13293 $ +// $Date: 2009-04-07 12:53:56 +0200 (Tue, 07 Apr 2009) $ +// +// SVN only: +// $HeadURL: $ +// +// CVS only: +// $Source$ +// $Log$ +// Revision 3.5 2007/10/24 12:07:35 pascal_verdier +// Another spelling mistake correction +// +// Revision 3.4 2007/10/23 14:04:30 pascal_verdier +// Spelling mistakes correction +// +// Revision 3.3 2005/03/02 14:06:15 pascal_verdier +// namespace is different than class name. +// +// Revision 3.2 2004/11/08 11:33:16 pascal_verdier +// if device property not found in database, it takes class property value if exists. +// +// Revision 3.1 2004/09/06 09:27:05 pascal_verdier +// Modified for Tango 5 compatibility. +// +// +// copyleft : Synchrotron SOLEIL +// L'Orme des merisiers - Saint Aubin +// BP48 - 91192 Gif sur Yvette +// FRANCE +// +//-============================================================================= +// +// This file is generated by POGO +// (Program Obviously used to Generate tango Object) +// +// (c) - Software Engineering Group - ESRF +//============================================================================= + + + +//=================================================================== +// +// The following table gives the correspondence +// between commands and method name. +// +// Command name| Method name +// ---------------------------------------- +// State | dev_state() +// Status | dev_status() +// Abort | abort() +// +//=================================================================== + + +#include <tango.h> +#include <yat4tango/Logging.h> +#include <yat4tango/DeviceInfo.h> +#include <SingleShotAO.h> +#include <SingleShotAOClass.h> +#include "SingleShotAOTypesAndConsts.h" + + +namespace SingleShotAO_ns +{ + +//- check manager macro: +#define CHECK_MANAGER() \ + do \ + { \ + if (! m_manager) \ + THROW_DEVFAILED("DEVICE_ERROR", \ + "request aborted - the manager isn't accessible ", \ + "SingleShotAO::check_manager"); \ +} while (0) + + +//+---------------------------------------------------------------------------- +// +// method : SingleShotAO::SingleShotAO(string &s) +// +// description : constructor for simulated SingleShotAO +// +// in : - cl : Pointer to the DeviceClass object +// - s : Device name +// +//----------------------------------------------------------------------------- +SingleShotAO::SingleShotAO(Tango::DeviceClass *cl,string &s) +:TANGO_BASE_CLASS(cl,s.c_str()) +{ + init_device(); +} + +SingleShotAO::SingleShotAO(Tango::DeviceClass *cl,const char *s) +:TANGO_BASE_CLASS(cl,s) +{ + init_device(); +} + +SingleShotAO::SingleShotAO(Tango::DeviceClass *cl,const char *s,const char *d) +:TANGO_BASE_CLASS(cl,s,d) +{ + init_device(); +} + + +//+---------------------------------------------------------------------------- +// +// method : SingleShotAO::delete_device() +// +// description : will be called at device destruction or at init command. +// +//----------------------------------------------------------------------------- +void SingleShotAO::delete_device() +{ + // Delete device allocated objects + yat4tango::TraceHelper t("SingleShotAO::delete_device", this); + + if (m_manager) + { + m_manager->exit(); + m_manager = NULL; + } + + //- release the asl::SingleShotAO object + if (m_ssao) + { + delete m_ssao; + m_ssao = NULL; + } + + // remove dynamic attributes + if (m_dyn_attr_manager) + { + try + { + m_dyn_attr_manager->remove_attributes(); + } + catch (...) + { + //- ignore any error + } + } + + // delete dynamic attributes manager + if (m_dyn_attr_manager) + { + delete m_dyn_attr_manager; + m_dyn_attr_manager = NULL; + } + + //- remove the inner appender + yat4tango::Logging::release(this); + yat4tango::DeviceInfo::release(this); +} + + +//+---------------------------------------------------------------------------- +// +// method : SingleShotAO::init_device() +// +// description : will be called at device initialization. +// +//----------------------------------------------------------------------------- +void SingleShotAO::init_device() +{ + //- initialize the inner appender (first thing to do) + try + { + INFO_STREAM << "Create the InnerAppender & FileAppender in order to manage logs." << endl; + yat4tango::Logging::initialize(this); + + INFO_STREAM << "Create the DeviceInfo in order to manage info on versions." << endl; + yat4tango::DeviceInfo::initialize(this, YAT_XSTR(PROJECT_NAME), YAT_XSTR(PROJECT_VERSION)); + // yat4tango::DeviceInfo::add_dependency(this, "Dependency Name", YAT_XSTR(dependency_name_PROJECT_VERSION)); + // TODO: Add dependencies + } + catch (Tango::DevFailed &df) + { + ERROR_STREAM << df << std::endl; + m_state = Tango::FAULT; + m_currStatus = "initialization failed - could not instantiate the InnerAppender"; + return; + } + + INFO_STREAM << "Initializing device"; + + //- trace/profile this method + yat4tango::TraceHelper t("SingleShotAO::init_device", this); + + // Initialise variables to default values + //-------------------------------------------- + + //- init members + m_ssao = NULL; + critical_properties_missing = false; + isInitOk = false; + m_frequency = 0.0; + m_dyn_attr_manager = NULL; + m_state = Tango::INIT; + + // Initialise variables to default values + //-------------------------------------------- + try + { + get_device_property(); + } + catch (const Tango::DevFailed& df) + { + ERROR_STREAM << "SingleShotAO::init_device::Tango::DevFailed exception caught " + << "while trying to read device properties from TANGO database" + << std::endl; + ERROR_STREAM << df << std::endl; + m_currStatus = "Failed to get property. See log for details"; + m_state = Tango::FAULT; + return; + } + catch (...) + { + //- update internal state + ERROR_STREAM << "SingleShotAO::init_device::unknown exception caught " + << "while trying to read device properties from TANGO database" + << std::endl; + m_currStatus = "Failed to get property. See log for details"; + m_state = Tango::FAULT; + return; + } + + //- abort initialization if properties missing + if (critical_properties_missing) + { + ERROR_STREAM << "configuration error - unspecified or invalid device properties"; + m_currStatus = "configuration error [unspecified or invalid device properties]. See log for details"; + m_state = Tango::FAULT; + return; + } + + //- allocate the asl::SingleShotAO object + m_ssao = new asl::SingleShotAO; + if (m_ssao == 0) + { + m_currStatus = "Failed to create the SignleShotAO. See log for details"; + m_state = Tango::FAULT; + return; + } + + try + { + //- initialze the hardware + m_ssao->init(boardTypeId, boardNum); + } + catch(const asl::DAQException& de) + { + ERROR_STREAM << daq_to_tango_exception(de) << endl; + m_currStatus = "Failed to init the SignleShotAO. See log for details"; + m_state = Tango::FAULT; + return; + } + catch(...) + { + ERROR_STREAM << "SingleShotAO::init_device::unknown exception caught"<<std::endl; + m_currStatus = "Failed to init the SignleShotAO. See log for details"; + m_state = Tango::FAULT; + return; + } + + // initialize channel number according to board type + m_nb_chan = 0; + if (boardType == k6208_BOARD_TYPE) + { + m_nb_chan = 8; + } + if (boardType == k6216_BOARD_TYPE) + { + m_nb_chan = 16; + } + + + // construct the AO manager + //-------------------------------------------- + try + { + m_manager = new SingleShotAOManager(this); + } + catch (...) + { + ERROR_STREAM << "initialization failed - failed to create manager" << std::endl; + m_currStatus = "initialization failed [failed to create manager]. See log for details"; + m_state = Tango::FAULT; + return; + } + + // test the manager + if (!m_manager) + { + ERROR_STREAM << "initialization failed - the manager is not created" << std::endl; + m_currStatus = "initialization failed [the manager is not created]. See log for details"; + m_state = Tango::FAULT; + return; + } + + // get frequency value in database + try + { + m_frequency = yat4tango::PropertyHelper::get_memorized_attribute<double>(this,"frequency"); + DEBUG_STREAM << "Frequency : " << m_frequency << endl; + } + catch (...) + { + DEBUG_STREAM << "Failed to get frequency value. Maybe there is no value yet." << std::endl; + } + + + // initialize the AO manager + //-------------------------------------------- + try + { + m_manager->init(m_ssao, m_nb_chan, m_frequency); + } + catch (Tango::DevFailed & df) + { + ERROR_STREAM << df << std::endl; + m_currStatus = "initialization failed - Manager initialization failed [see device log for details]"; + m_state = Tango::FAULT; + return; + } + catch (...) + { + ERROR_STREAM << "initialization failed - failed to initialize manager" << std::endl; + m_currStatus = "initialization failed [failed to initialize manager]. See log for details"; + m_state = Tango::FAULT; + return; + } + + // create dynamic attribute manager + try + { + m_dyn_attr_manager = new yat4tango::DynamicAttributeManager(this); + } + catch (Tango::DevFailed &e) + { + ERROR_STREAM << e << std::endl; + m_currStatus = "Failed to create Dynamic Attribute Manager. See log for details"; + m_state = Tango::FAULT; + return; + } + catch (...) + { + ERROR_STREAM << "Failed to create Dynamic Attribute Manager" << std::endl; + m_currStatus = "Failed to create Dynamic Attribute Manager. See log for details"; + m_state = Tango::FAULT; + return; + } + + // add dynamic attributes: channel, speed & initial for each channel + std::vector<yat4tango::DynamicAttributeInfo> l_dynAttrList; + for (unsigned int l_cpt = 0; l_cpt < m_nb_chan; l_cpt++) + { + yat::OSStream oss; + oss << l_cpt; + + // ╔═══════════════╗ + // ║ Channel value ║ + // ╚═══════════════╝ + yat4tango::DynamicAttributeInfo dai_channel; + dai_channel.dev = this; + dai_channel.tai.name = kCHANNEL + oss.str(); + dai_channel.tai.label = kCHANNEL + oss.str(); + + //- describe the dyn attr we want... + dai_channel.tai.data_type = Tango::DEV_DOUBLE; + dai_channel.tai.data_format = Tango::SCALAR; + dai_channel.tai.writable = Tango::READ_WRITE; // soso + dai_channel.tai.disp_level = Tango::OPERATOR; + dai_channel.tai.unit = "V"; + dai_channel.tai.standard_unit = "V"; + dai_channel.tai.display_unit = "V"; + dai_channel.tai.max_value = "10.0"; + dai_channel.tai.min_value = "-10.0"; + dai_channel.tai.description = "Output value for channel " + oss.str() + " (in measurementUnit)."; + dai_channel.tai.format = "%1.1f"; + dai_channel.memorized = true; + dai_channel.cdb = false; + + //- read callback + dai_channel.rcb = yat4tango::DynamicAttributeReadCallback::instanciate(const_cast<SingleShotAO&>(*this), + &SingleShotAO::read_channel); + + //- write callback + dai_channel.wcb = yat4tango::DynamicAttributeWriteCallback::instanciate(const_cast<SingleShotAO&>(*this), + &SingleShotAO::write_channel); + + l_dynAttrList.push_back(dai_channel); + + + // ╔═══════════════╗ + // ║ Speed value ║ + // ╚═══════════════╝ + yat4tango::DynamicAttributeInfo dai_speed; + dai_speed.dev = this; + dai_speed.tai.name = kSPEED + oss.str(); + dai_speed.tai.label = kSPEED + oss.str(); + + //- describe the dyn attr we want... + dai_speed.tai.data_type = Tango::DEV_DOUBLE; + dai_speed.tai.data_format = Tango::SCALAR; + dai_speed.tai.writable = Tango::READ_WRITE; + dai_speed.tai.disp_level = Tango::OPERATOR; + dai_speed.tai.unit = "V/s"; + dai_speed.tai.standard_unit = "V/s"; + dai_speed.tai.display_unit = "V/s"; + dai_speed.tai.description = "Speed for ramp generation, in V/s. If speed is NULL, no ramp generated but direct write on channel output " + oss.str() + " (in measurementUnit)."; + dai_speed.tai.format = "%1.1f"; + + //- cleanup tango db option: cleanup tango db when removing this dyn. attr. (i.e. erase its properties from db) + dai_speed.memorized = true; + dai_speed.cdb = false; + + //- read callback + dai_speed.rcb = yat4tango::DynamicAttributeReadCallback::instanciate(const_cast<SingleShotAO&>(*this), + &SingleShotAO::read_speed); + + //- write callback + dai_speed.wcb = yat4tango::DynamicAttributeWriteCallback::instanciate(const_cast<SingleShotAO&>(*this), + &SingleShotAO::write_speed); + + l_dynAttrList.push_back(dai_speed); + + + // ╔═══════════════╗ + // ║ Initial value ║ + // ╚═══════════════╝ + yat4tango::DynamicAttributeInfo dai_initial; + dai_initial.dev = this; + dai_initial.tai.name = kINITIAL + oss.str(); + dai_initial.tai.label = kINITIAL + oss.str(); + + //- describe the dyn attr we want... + dai_initial.tai.data_type = Tango::DEV_DOUBLE; + dai_initial.tai.data_format = Tango::SCALAR; + dai_initial.tai.writable = Tango::READ_WRITE; + dai_initial.tai.disp_level = Tango::OPERATOR; + dai_initial.tai.unit = "V"; + dai_initial.tai.standard_unit = "V"; + dai_initial.tai.display_unit = "V"; + dai_initial.tai.description = "Initial value for ramp function, in V. Defaults to last written value in channel attribute " + oss.str() + "."; + dai_initial.tai.format = "%1.2f"; + + //- cleanup tango db option: cleanup tango db when removing this dyn. attr. (i.e. erase its properties from db) + dai_initial.memorized = true; + dai_initial.cdb = false; + + //- read callback + dai_initial.rcb = yat4tango::DynamicAttributeReadCallback::instanciate(const_cast<SingleShotAO&>(*this), + &SingleShotAO::read_initial); + + //- write callback + dai_initial.wcb = yat4tango::DynamicAttributeWriteCallback::instanciate(const_cast<SingleShotAO&>(*this), + &SingleShotAO::write_initial); + + l_dynAttrList.push_back(dai_initial); + } + + m_dyn_attr_manager->add_attributes(l_dynAttrList); + + // Get memorized values from database + for (unsigned int l_cpt = 0; l_cpt < m_nb_chan; l_cpt++) + { + yat::OSStream oss; + oss << l_cpt; + + // speed value + try + { + std::string attr_name = kSPEED + oss.str(); + std::string name = "__" + attr_name; + + double l_val = yat4tango::PropertyHelper::get_memorized_attribute<double>(this, name); + m_manager->set_speed(l_cpt, l_val); + } + catch (...) + { + // nothing to do + } + + // initial value + try + { + std::string attr_name = kINITIAL + oss.str(); + std::string name = "__" + attr_name; + + // To be activated with Tango 8 + //double l_val = yat4tango::PropertyHelper::get_memorized_attribute<double>(this,name); + double l_val = get_memorized_attribute<double>(name); + m_manager->set_initial(l_cpt, l_val); + } + catch (...) + { + //nothing to do + } + } + + //- GO for task + try + { + m_manager->go(); + } + catch (Tango::DevFailed & df) + { + ERROR_STREAM << df << std::endl; + m_currStatus = "initialization failed [failed to go for manager]"; + m_state = Tango::FAULT; + return; + } + catch (...) + { + ERROR_STREAM << "initialization failed - failed to go for manager" << std::endl; + m_currStatus = "initialization failed [failed to go for manager]. See log for details"; + m_state = Tango::FAULT; + return; + } + + //- update internal state + m_state = Tango::ON; + m_currStatus = "Device ready to execute AO request."; + isInitOk = true; +} + + +//+---------------------------------------------------------------------------- +// +// method : SingleShotAO::get_device_property() +// +// description : Read the device properties from database. +// +//----------------------------------------------------------------------------- +void SingleShotAO::get_device_property() +{ + // Initialize your default values here (if not done with POGO). + //------------------------------------------------------------------ + + // Read device properties from database.(Automatic code generation) + //------------------------------------------------------------------ + Tango::DbData dev_prop; + dev_prop.push_back(Tango::DbDatum("BoardNum")); + dev_prop.push_back(Tango::DbDatum("BoardType")); + + // Call database and extract values + //-------------------------------------------- + if (Tango::Util::instance()->_UseDb==true) + get_db_device()->get_property(dev_prop); + Tango::DbDatum def_prop, cl_prop; + SingleShotAOClass *ds_class = + (static_cast<SingleShotAOClass *>(get_device_class())); + int i = -1; + + // Try to initialize BoardNum from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> boardNum; + else { + // Try to initialize BoardNum from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> boardNum; + } + // And try to extract BoardNum value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> boardNum; + + // Try to initialize BoardType from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> boardType; + else { + // Try to initialize BoardType from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> boardType; + } + // And try to extract BoardType value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> boardType; + + + + // End of Automatic code generation + //------------------------------------------------------------------ + + critical_properties_missing = false; + + if (dev_prop[0].is_empty()) + { + ERROR_STREAM << "Required device property <BoardNum> is missing" << endl; + critical_properties_missing = true; + } + if (dev_prop[1].is_empty()) + { + ERROR_STREAM << "Required device property <BoardType> is missing" << endl; + critical_properties_missing = true; + } + + if (critical_properties_missing) { + return; + } + + //- <BoardNum> ----------------------- + if (boardNum > 7) + { + boardNum = 0; + ERROR_STREAM << "device property <BoardNum> is invalid. Valid range is [0..7]" << endl; + critical_properties_missing = true; + } + + //- <BoardType> ----------------------- + if (boardType == "MAO_6208") + { + boardType = k6208_BOARD_TYPE; + boardTypeId = adl::PCI6208; + } + else if (boardType == "MAO_6216") + { + boardType = k6216_BOARD_TYPE; + boardTypeId = adl::PCI6216; + } + else + { + boardType = kDEFAULT_BOARD_TYPE; + boardTypeId = adl::PCI6208; + ERROR_STREAM << "device property <BoardType> is invalid [supported hw: MAO_6208 or MAO_6216]" << endl; + critical_properties_missing = true; + } + +} + + +//+---------------------------------------------------------------------------- +// +// method : SingleShotAO::always_executed_hook() +// +// description : method always executed before any command is executed +// +//----------------------------------------------------------------------------- +void SingleShotAO::always_executed_hook() +{ + // nothing to do +} + + +//+---------------------------------------------------------------------------- +// +// method : SingleShotAO::read_attr_hardware +// +// description : Hardware acquisition for attributes. +// +//----------------------------------------------------------------------------- +void SingleShotAO::read_attr_hardware(vector<long> &attr_list) +{ + //DEBUG_STREAM << "SingleShotAO::read_attr_hardware(vector<long> &attr_list) entering... "<< endl; + // Add your own code here +} + + +//+---------------------------------------------------------------------------- +// +// method : SingleShotAO::read_frequency +// +// description : Extract real attribute values for Frequency acquisition result. +// +//----------------------------------------------------------------------------- +void SingleShotAO::read_frequency(Tango::Attribute &attr) +{ + //DEBUG_STREAM << "SingleShotAO::read_frequency(Tango::Attribute &attr) entering... "<< endl; + attr.set_value(&m_frequency); +} + + +//+---------------------------------------------------------------------------- +// +// method : SingleShotAO::write_frequency +// +// description : Write Frequency attribute values to hardware. +// +//----------------------------------------------------------------------------- +void SingleShotAO::write_frequency(Tango::WAttribute &attr) +{ + DEBUG_STREAM << "SingleShotAO::write_frequency(Tango::WAttribute &attr) entering... "<< endl; + if (dev_state() != Tango::ON) + { + THROW_DEVFAILED("DEVICE_ERROR", + "could not write frequency. The state must be ON.", + "SingleShotAO::write_frequency"); + } + CHECK_MANAGER(); + attr.get_write_value(m_frequency); + m_manager->write_frequency(m_frequency); + yat4tango::PropertyHelper::set_memorized_attribute(this, "frequency", m_frequency); +} + + +//+------------------------------------------------------------------ +/** +* method: SingleShotAO::dev_state +* +* description: method to execute "State" +* This command gets the device state (stored in its <i>device_state</i> data member) and returns it to the caller. +* +* @return State Code +* +*/ +//+------------------------------------------------------------------ +Tango::DevState SingleShotAO::dev_state() +{ + if (isInitOk) + { + CHECK_MANAGER(); + m_state = m_manager->get_state(); + } + return m_state; +} + + +//+------------------------------------------------------------------ +/** +* method: SingleShotAO::dev_status +* +* description: method to execute "Status" +* This command gets the device status (stored in its <i>device_status</i> data member) and returns it to the caller. +* +* @return Status description +* +*/ +//+------------------------------------------------------------------ +Tango::ConstDevString SingleShotAO::dev_status() +{ + static std::string s = ""; + yat::OSStream oss; + if (isInitOk) + { + CHECK_MANAGER(); + oss << m_manager->get_status() << std::endl; + } + else + { + oss << m_currStatus.c_str() << std::endl; + } + s = oss.str(); + return s.c_str(); +} + + +//+------------------------------------------------------------------ +/** +* method: SingleShotAO::read_channel +* +* description: method to execute "read_channel" for dynamic attributes +* +*/ +//+------------------------------------------------------------------ +void SingleShotAO::read_channel(yat4tango::DynamicAttributeReadCallbackData & cbd) +{ + yat::AutoMutex<> guard(m_lock); + + std::string l_attr_name = cbd.dya->get_name(); + + // name will be channelX + std::string l_str = l_attr_name.substr(7, 2); + yat::uint16 l_idx = atoi(l_str.c_str()); + + CHECK_MANAGER(); + // choose tab depending on l_idx + double l_val = m_manager->get_channel(l_idx); + cbd.tga->set_value(&l_val); +} + + +//+------------------------------------------------------------------ +/** +* method: SingleShotAO::write_channel +* +* description: method to execute "write_channel" for dynamic attributes +* +*/ +//+------------------------------------------------------------------ +void SingleShotAO::write_channel(yat4tango::DynamicAttributeWriteCallbackData & cbd) +{ + double l_val; + cbd.tga->get_write_value(l_val); + + std::string l_attr_name = cbd.dya->get_name(); + + // name will be channelX + std::string l_str = l_attr_name.substr(7, 2); + yat::uint16 l_idx = atoi(l_str.c_str()); + + CHECK_MANAGER(); + try + { + m_manager->write_channel(l_idx, l_val); + } + catch(Tango::DevFailed& df) + { + ERROR_STREAM << df<< endl; + RETHROW_DEVFAILED(df, + "DRIVER_FAILURE", + "could not write channel [caught Tango::DevFailed]", + "SingleShotAO::write_channel"); + } + catch(...) + { + ERROR_STREAM << "SingleShotAOManager::write_channel::unknown exception caught"<<std::endl; + THROW_DEVFAILED("DRIVER_FAILURE", + "could not write channel [unknown error]", + "SingleShotAO::write_channel"); + } +} + + +//+------------------------------------------------------------------ +/** +* method: SingleShotAO::read_speed +* +* description: method to execute "read_speed" for dynamic attributes +* +*/ +//+------------------------------------------------------------------ +void SingleShotAO::read_speed(yat4tango::DynamicAttributeReadCallbackData & cbd) +{ + yat::AutoMutex<> guard(m_lock); + + std::string l_attr_name = cbd.dya->get_name(); + + // name will be speedX + std::string l_str = l_attr_name.substr(5, 2); + yat::uint16 l_idx = atoi(l_str.c_str()); + + CHECK_MANAGER(); + // choose tab depending on l_idx + double l_val = m_manager->get_speed(l_idx); + cbd.tga->set_value(&l_val); +} + + +//+------------------------------------------------------------------ +/** +* method: SingleShotAO::write_speed +* +* description: method to execute "write_speed" for dynamic attributes +* +*/ +//+------------------------------------------------------------------ +void SingleShotAO::write_speed(yat4tango::DynamicAttributeWriteCallbackData & cbd) +{ + DEBUG_STREAM << "SingleShotAO::write_speed(): entering... !" << endl; + + double l_val; + cbd.tga->get_write_value(l_val); + + std::string l_attr_name = cbd.dya->get_name(); + + // name will be speedX + std::string l_str = l_attr_name.substr(5, 2); + yat::uint16 l_idx = atoi(l_str.c_str()); + if (l_val < 0) + { + l_val = -l_val; + } + + CHECK_MANAGER(); + try + { + m_manager->set_speed(l_idx, l_val); + } + catch(Tango::DevFailed& df) + { + ERROR_STREAM << df<< endl; + RETHROW_DEVFAILED(df, + "DRIVER_FAILURE", + "could not write initial [caught Tango::DevFailed]", + "SingleShotAO::write_initial"); + } + catch(...) + { + ERROR_STREAM << "SingleShotAO::write_initial::unknown exception caught"<<std::endl; + THROW_DEVFAILED("DRIVER_FAILURE", + "could not write initial [unknown error]", + "SingleShotAO::write_initial"); + } + // To be activated with Tango 8 + //yat4tango::PropertyHelper::set_memorized_attribute(this, l_attr_name, l_val); + std::string name = "__" + l_attr_name; + store_value_as_property(l_val, name); +} + + +//+------------------------------------------------------------------ +/** +* method: SingleShotAO::read_initial +* +* description: method to execute "read_initial" for dynamic attributes +* +*/ +//+------------------------------------------------------------------ +void SingleShotAO::read_initial(yat4tango::DynamicAttributeReadCallbackData & cbd) +{ + yat::AutoMutex<> guard(m_lock); + + std::string l_attr_name = cbd.dya->get_name(); + + // name will be initialX + std::string l_str = l_attr_name.substr(7, 2); + yat::uint16 l_idx = atoi(l_str.c_str()); + + CHECK_MANAGER(); + // choose tab depending on l_idx + double l_val = m_manager->get_initial(l_idx); + cbd.tga->set_value(&l_val); +} + + +//+------------------------------------------------------------------ +/** +* method: SingleShotAO::write_initial +* +* description: method to execute "write_initial" for dynamic attributes +* +*/ +//+------------------------------------------------------------------ +void SingleShotAO::write_initial(yat4tango::DynamicAttributeWriteCallbackData & cbd) +{ + DEBUG_STREAM << "SingleShotAO::write_initial(): entering... !" << endl; + + double l_val; + cbd.tga->get_write_value(l_val); + + std::string l_attr_name = cbd.dya->get_name(); + + // name will be initialX + std::string l_str = l_attr_name.substr(7, 2); + yat::uint16 l_idx = atoi(l_str.c_str()); + + CHECK_MANAGER(); + try + { + m_manager->set_initial(l_idx, l_val); + } + catch(Tango::DevFailed& df) + { + ERROR_STREAM << df<< endl; + RETHROW_DEVFAILED(df, + "DRIVER_FAILURE", + "could not write initial [caught Tango::DevFailed]", + "SingleShotAO::write_initial"); + } + catch(...) + { + ERROR_STREAM << "SingleShotAO::write_initial::unknown exception caught"<<std::endl; + THROW_DEVFAILED("DRIVER_FAILURE", + "could not write initial [unknown error]", + "SingleShotAO::write_initial"); + } + // To be activated with Tango 8 + //yat4tango::PropertyHelper::set_memorized_attribute(this, l_attr_name, l_val); + std::string name = "__" + l_attr_name; + store_value_as_property(l_val, name); +} + + +//+------------------------------------------------------------------ +/** + * method: SingleShotAO::abort + * + * description: method to execute "Abort" + * Aborts ramps in progress. + * + * + */ +//+------------------------------------------------------------------ +void SingleShotAO::abort() +{ + DEBUG_STREAM << "SingleShotAO::abort(): entering... !" << endl; + + // Add your own code to control device here + CHECK_MANAGER(); + try + { + m_manager->abort(); + } + catch(Tango::DevFailed& df) + { + ERROR_STREAM << df<< endl; + RETHROW_DEVFAILED(df, + "DRIVER_FAILURE", + "could not abort [caught Tango::DevFailed]", + "SingleShotAO::abort"); + } + catch(...) + { + ERROR_STREAM << "SingleShotAOManager::abort::unknown exception caught"<<std::endl; + THROW_DEVFAILED("DRIVER_FAILURE", + "could not abort [unknown error]", + "SingleShotAO::abort"); + } + +} + +} // namespace diff --git a/src/SingleShotAO.dsp b/src/SingleShotAO.dsp old mode 100644 new mode 100755 diff --git a/src/SingleShotAO.h b/src/SingleShotAO.h index 4289487d0415bdec78381068401d217fc4d1ebae..61f5f60f7bf8ed1a287dead8d17a84f5219e134c 100755 --- a/src/SingleShotAO.h +++ b/src/SingleShotAO.h @@ -1,356 +1,356 @@ -//============================================================================= -// -// file : SingleShotAO.h -// -// description : Include for the SingleShotAO class. -// -// project : SingleShotAO Generic Device -// -// $Author: pascal_verdier $ -// -// $Revision: 13293 $ -// $Date: 2009-04-07 12:53:56 +0200 (Tue, 07 Apr 2009) $ -// -// SVN only: -// $HeadURL: $ -// -// CVS only: -// $Source$ -// $Log$ -// Revision 3.5 2007/10/23 14:04:30 pascal_verdier -// Spelling mistakes correction -// -// Revision 3.4 2005/03/02 14:06:15 pascal_verdier -// namespace is different than class name. -// -// Revision 3.3 2004/10/25 14:12:00 pascal_verdier -// Minor changes. -// -// Revision 3.2 2004/09/06 09:27:05 pascal_verdier -// Modified for Tango 5 compatibility. -// -// -// copyleft : Synchrotron SOLEIL -// L'Orme des merisiers - Saint Aubin -// BP48 - 91192 Gif sur Yvette -// FRANCE -// -//============================================================================= -// -// This file is generated by POGO -// (Program Obviously used to Generate tango Object) -// -// (c) - Software Engineering Group - ESRF -//============================================================================= -#ifndef _SINGLESHOTAO_H -#define _SINGLESHOTAO_H - -#include <tango.h> -//using namespace Tango; - -#include <yat4tango/Logging.h> -#include <yat4tango/DeviceInfo.h> - -#include "SingleShotAOManager.h" - -/** - * @author $Author: pascal_verdier $ - * @version $Revision: 13293 $ - */ - - // Add your own constant definitions here. - //----------------------------------------------- - - -namespace SingleShotAO_ns -{ - -/** - * Class Description: - * ADLink boards support for single shot AO operations [PCI-6208 and compatible boards] - */ - -/* - * Device States Description: -* Tango::FAULT : Hardware / driver failure or fatal error occurred -* Tango::ON : Device ready to execute AO request -* Tango::INIT : Device initialization in progress -* Tango::MOVING : Ramp generation in progress - */ - - -class SingleShotAO: public TANGO_BASE_CLASS -{ -public : - // Add your own data members here - //----------------------------------------- - - - // Here is the Start of the automatic code generation part - //------------------------------------------------------------- -/** - * @name attributes - * Attribute member data. - */ -//@{ - Tango::DevDouble *attr_frequency_read; - Tango::DevDouble attr_frequency_write; -//@} - -/** - * @name Device properties - * Device properties member data. - */ -//@{ -/** - * The the board identifier in the cPCI crate [valid range is 0...7 - no default value] . - */ - Tango::DevShort boardNum; -/** - * The board type [MAO_xxxx - where <xxxx> is the ADlink board identifier - e.g. MAO_6208 - no default value] - */ - string boardType; -//@} - -/** - * @name Device properties - * Device property member data. - */ -//@{ -//@} - -/**@name Constructors - * Miscellaneous constructors */ -//@{ -/** - * Constructs a newly allocated Command object. - * - * @param cl Class. - * @param s Device Name - */ - SingleShotAO(Tango::DeviceClass *cl,string &s); -/** - * Constructs a newly allocated Command object. - * - * @param cl Class. - * @param s Device Name - */ - SingleShotAO(Tango::DeviceClass *cl,const char *s); -/** - * Constructs a newly allocated Command object. - * - * @param cl Class. - * @param s Device name - * @param d Device description. - */ - SingleShotAO(Tango::DeviceClass *cl,const char *s,const char *d); -//@} - -/**@name Destructor - * Only one destructor is defined for this class */ -//@{ -/** - * The object destructor. - */ - ~SingleShotAO() {delete_device();}; -/** - * will be called at device destruction or at init command. - */ - void delete_device(); -//@} - - -/**@name Miscellaneous methods */ -//@{ -/** - * Initialize the device - */ - virtual void init_device(); -/** - * Always executed method before execution command method. - */ - virtual void always_executed_hook(); - -//@} - -/** - * @name SingleShotAO methods prototypes - */ - -//@{ -/** - * Hardware acquisition for attributes. - */ - virtual void read_attr_hardware(vector<long> &attr_list); -/** - * Extract real attribute values for frequency acquisition result. - */ - virtual void read_frequency(Tango::Attribute &attr); -/** - * Write frequency attribute values to hardware. - */ - virtual void write_frequency(Tango::WAttribute &attr); -/** - * Read/Write allowed for frequency attribute. - */ - virtual bool is_frequency_allowed(Tango::AttReqType type); -/** - * Execution allowed for Abort command. - */ - virtual bool is_Abort_allowed(const CORBA::Any &any); -/** - * 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(); -/** - * Aborts ramps in progress. - * @exception DevFailed - */ - void abort(); - -/** - * Read the device properties from database - */ - void get_device_property(); -//@} - - // Here is the end of the automatic code generation part - //------------------------------------------------------------- - - //- read callback for dyn attr Channel<id> - void read_channel(yat4tango::DynamicAttributeReadCallbackData & cbd); - - //- write callback for dyn attr Channel<id> - void write_channel(yat4tango::DynamicAttributeWriteCallbackData & cbd); - - //- read callback for dyn attr Speed<id> - void read_speed(yat4tango::DynamicAttributeReadCallbackData & cbd); - - //- write callback for dyn attr Speed<id> - void write_speed(yat4tango::DynamicAttributeWriteCallbackData & cbd); - - //- read callback for dyn attr Initial<id> - void read_initial(yat4tango::DynamicAttributeReadCallbackData & cbd); - - //- write callback for dyn attr Initial<id> - void write_initial(yat4tango::DynamicAttributeWriteCallbackData & cbd); - - -protected : - // Add your own data members here - //----------------------------------------- - - //- the underlying single shot AO object - asl::SingleShotAO * m_ssao; - - //- asl hw id - unsigned short boardTypeId; - - //- are required device-properties specified? - bool critical_properties_missing; - - //- isInitOk - bool isInitOk; - - //- state - Tango::DevState m_state; - - //- status - std::string m_currStatus; - - //- dynamic attributes manager - yat4tango::DynamicAttributeManager * m_dyn_attr_manager; - - //- frequency - double m_frequency; - - //- thread safety - yat::Mutex m_lock; - //- manager for ramps - SingleShotAOManager * m_manager; - //- channel number - unsigned short m_nb_chan; - - // To be deleted with Tango 8 - //- Template class to store a current value in a Device property. - //- \param value Value to store. - //- \param property_name Name to use. - template <class T> - void store_value_as_property(T value, std::string property_name) - { - Tango::DbDatum current_value(property_name); - current_value << value; - Tango::DbData db_data; - db_data.push_back(current_value); - - try - { - get_db_device()->put_property(db_data); - } - catch(Tango::DevFailed &df) - { - ERROR_STREAM << df << endl; - RETHROW_DEVFAILED(df, - "SOFTWARE_FAILURE", - "Error while storing properties in database", - "SingleShotAO::store_value_as_property"); - } - } - - // To be deleted with Tango 8 - //- Template class to get a memorized attribute stored as a Device property. - //- \param property_name Name od the property to read. - template <class T> - T get_memorized_attribute(const std::string& property_name) - { - T value; - if (!Tango::Util::instance()->_UseDb) - { - //- throw exception - THROW_DEVFAILED("DEVICE_ERROR", - "No DATA BASE!", - "SingleShotAO::get_memorized_attribute"); - } - - Tango::DbData dev_prop; - dev_prop.push_back(Tango::DbDatum(property_name)); - - try - { - get_db_device()->get_property(dev_prop); - } - catch (Tango::DevFailed &df) - { - //- rethrow exception - RETHROW_DEVFAILED(df, - "DEVICE_ERROR", - "could not get Device properties! [caught Tango::DevFailed]", - "SingleShotAO::get_memorized_attribute"); - } - - if (dev_prop[0].is_empty()==false) - { - dev_prop[0] >> value; - } - else - { - //- throw exception - THROW_DEVFAILED("DATA_ERROR", - "No property stored in database!", - "SingleShotAO::get_memorized_attribute"); - } - return value; - } -}; - -} // namespace_ns - -#endif // _SINGLESHOTAO_H +//============================================================================= +// +// file : SingleShotAO.h +// +// description : Include for the SingleShotAO class. +// +// project : SingleShotAO Generic Device +// +// $Author: pascal_verdier $ +// +// $Revision: 13293 $ +// $Date: 2009-04-07 12:53:56 +0200 (Tue, 07 Apr 2009) $ +// +// SVN only: +// $HeadURL: $ +// +// CVS only: +// $Source$ +// $Log$ +// Revision 3.5 2007/10/23 14:04:30 pascal_verdier +// Spelling mistakes correction +// +// Revision 3.4 2005/03/02 14:06:15 pascal_verdier +// namespace is different than class name. +// +// Revision 3.3 2004/10/25 14:12:00 pascal_verdier +// Minor changes. +// +// Revision 3.2 2004/09/06 09:27:05 pascal_verdier +// Modified for Tango 5 compatibility. +// +// +// copyleft : Synchrotron SOLEIL +// L'Orme des merisiers - Saint Aubin +// BP48 - 91192 Gif sur Yvette +// FRANCE +// +//============================================================================= +// +// This file is generated by POGO +// (Program Obviously used to Generate tango Object) +// +// (c) - Software Engineering Group - ESRF +//============================================================================= +#ifndef _SINGLESHOTAO_H +#define _SINGLESHOTAO_H + +#include <tango.h> +//using namespace Tango; + +#include <yat4tango/Logging.h> +#include <yat4tango/DeviceInfo.h> + +#include "SingleShotAOManager.h" + +/** + * @author $Author: pascal_verdier $ + * @version $Revision: 13293 $ + */ + + // Add your own constant definitions here. + //----------------------------------------------- + + +namespace SingleShotAO_ns +{ + +/** + * Class Description: + * ADLink boards support for single shot AO operations [PCI-6208 and compatible boards] + */ + +/* + * Device States Description: +* Tango::FAULT : Hardware / driver failure or fatal error occurred +* Tango::ON : Device ready to execute AO request +* Tango::INIT : Device initialization in progress +* Tango::MOVING : Ramp generation in progress + */ + + +class SingleShotAO: public TANGO_BASE_CLASS +{ +public : + // Add your own data members here + //----------------------------------------- + + + // Here is the Start of the automatic code generation part + //------------------------------------------------------------- +/** + * @name attributes + * Attribute member data. + */ +//@{ + Tango::DevDouble *attr_frequency_read; + Tango::DevDouble attr_frequency_write; +//@} + +/** + * @name Device properties + * Device properties member data. + */ +//@{ +/** + * The the board identifier in the cPCI crate [valid range is 0...7 - no default value] . + */ + Tango::DevShort boardNum; +/** + * The board type [MAO_xxxx - where <xxxx> is the ADlink board identifier - e.g. MAO_6208 - no default value] + */ + string boardType; +//@} + +/** + * @name Device properties + * Device property member data. + */ +//@{ +//@} + +/**@name Constructors + * Miscellaneous constructors */ +//@{ +/** + * Constructs a newly allocated Command object. + * + * @param cl Class. + * @param s Device Name + */ + SingleShotAO(Tango::DeviceClass *cl,string &s); +/** + * Constructs a newly allocated Command object. + * + * @param cl Class. + * @param s Device Name + */ + SingleShotAO(Tango::DeviceClass *cl,const char *s); +/** + * Constructs a newly allocated Command object. + * + * @param cl Class. + * @param s Device name + * @param d Device description. + */ + SingleShotAO(Tango::DeviceClass *cl,const char *s,const char *d); +//@} + +/**@name Destructor + * Only one destructor is defined for this class */ +//@{ +/** + * The object destructor. + */ + ~SingleShotAO() {delete_device();}; +/** + * will be called at device destruction or at init command. + */ + void delete_device(); +//@} + + +/**@name Miscellaneous methods */ +//@{ +/** + * Initialize the device + */ + virtual void init_device(); +/** + * Always executed method before execution command method. + */ + virtual void always_executed_hook(); + +//@} + +/** + * @name SingleShotAO methods prototypes + */ + +//@{ +/** + * Hardware acquisition for attributes. + */ + virtual void read_attr_hardware(vector<long> &attr_list); +/** + * Extract real attribute values for frequency acquisition result. + */ + virtual void read_frequency(Tango::Attribute &attr); +/** + * Write frequency attribute values to hardware. + */ + virtual void write_frequency(Tango::WAttribute &attr); +/** + * Read/Write allowed for frequency attribute. + */ + virtual bool is_frequency_allowed(Tango::AttReqType type); +/** + * Execution allowed for Abort command. + */ + virtual bool is_Abort_allowed(const CORBA::Any &any); +/** + * 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(); +/** + * Aborts ramps in progress. + * @exception DevFailed + */ + void abort(); + +/** + * Read the device properties from database + */ + void get_device_property(); +//@} + + // Here is the end of the automatic code generation part + //------------------------------------------------------------- + + //- read callback for dyn attr Channel<id> + void read_channel(yat4tango::DynamicAttributeReadCallbackData & cbd); + + //- write callback for dyn attr Channel<id> + void write_channel(yat4tango::DynamicAttributeWriteCallbackData & cbd); + + //- read callback for dyn attr Speed<id> + void read_speed(yat4tango::DynamicAttributeReadCallbackData & cbd); + + //- write callback for dyn attr Speed<id> + void write_speed(yat4tango::DynamicAttributeWriteCallbackData & cbd); + + //- read callback for dyn attr Initial<id> + void read_initial(yat4tango::DynamicAttributeReadCallbackData & cbd); + + //- write callback for dyn attr Initial<id> + void write_initial(yat4tango::DynamicAttributeWriteCallbackData & cbd); + + +protected : + // Add your own data members here + //----------------------------------------- + + //- the underlying single shot AO object + asl::SingleShotAO * m_ssao; + + //- asl hw id + unsigned short boardTypeId; + + //- are required device-properties specified? + bool critical_properties_missing; + + //- isInitOk + bool isInitOk; + + //- state + Tango::DevState m_state; + + //- status + std::string m_currStatus; + + //- dynamic attributes manager + yat4tango::DynamicAttributeManager * m_dyn_attr_manager; + + //- frequency + double m_frequency; + + //- thread safety + yat::Mutex m_lock; + //- manager for ramps + SingleShotAOManager * m_manager; + //- channel number + unsigned short m_nb_chan; + + // To be deleted with Tango 8 + //- Template class to store a current value in a Device property. + //- \param value Value to store. + //- \param property_name Name to use. + template <class T> + void store_value_as_property(T value, std::string property_name) + { + Tango::DbDatum current_value(property_name); + current_value << value; + Tango::DbData db_data; + db_data.push_back(current_value); + + try + { + get_db_device()->put_property(db_data); + } + catch(Tango::DevFailed &df) + { + ERROR_STREAM << df << endl; + RETHROW_DEVFAILED(df, + "SOFTWARE_FAILURE", + "Error while storing properties in database", + "SingleShotAO::store_value_as_property"); + } + } + + // To be deleted with Tango 8 + //- Template class to get a memorized attribute stored as a Device property. + //- \param property_name Name od the property to read. + template <class T> + T get_memorized_attribute(const std::string& property_name) + { + T value; + if (!Tango::Util::instance()->_UseDb) + { + //- throw exception + THROW_DEVFAILED("DEVICE_ERROR", + "No DATA BASE!", + "SingleShotAO::get_memorized_attribute"); + } + + Tango::DbData dev_prop; + dev_prop.push_back(Tango::DbDatum(property_name)); + + try + { + get_db_device()->get_property(dev_prop); + } + catch (Tango::DevFailed &df) + { + //- rethrow exception + RETHROW_DEVFAILED(df, + "DEVICE_ERROR", + "could not get Device properties! [caught Tango::DevFailed]", + "SingleShotAO::get_memorized_attribute"); + } + + if (dev_prop[0].is_empty()==false) + { + dev_prop[0] >> value; + } + else + { + //- throw exception + THROW_DEVFAILED("DATA_ERROR", + "No property stored in database!", + "SingleShotAO::get_memorized_attribute"); + } + return value; + } +}; + +} // namespace_ns + +#endif // _SINGLESHOTAO_H diff --git a/src/SingleShotAOClass.cpp b/src/SingleShotAOClass.cpp index 77f417e9499f72b320af3486e399836819cea81e..e93187a49bbddf85c1b6bd09b993937ab31c7516 100755 --- a/src/SingleShotAOClass.cpp +++ b/src/SingleShotAOClass.cpp @@ -1,548 +1,548 @@ -static const char *ClassId = "$Id: DevServClass.cpp 13293 2009-04-07 10:53:56Z pascal_verdier $"; -static const char *TagName = "$Name: $"; -static const char *CvsPath = "$Source: $"; -static const char *SvnPath = "$HeadURL: $"; -static const char *HttpServer = "http://www.esrf.fr/computing/cs/tango/tango_doc/ds_doc/"; -//+============================================================================= -// -// file : SingleShotAOClass.cpp -// -// description : C++ source for the SingleShotAOClass. A singleton -// class derived from DeviceClass. It implements the -// command list and all properties and methods required -// by the SingleShotAO once per process. -// -// project : TANGO Device Server -// -// $Author: pascal_verdier $ -// -// $Revision: 13293 $ -// -// $Log$ -// Revision 3.11 2007/10/23 14:04:30 pascal_verdier -// Spelling mistakes correction -// -// Revision 3.10 2006/11/15 14:17:10 pascal_verdier -// Remove warnings from compiler. -// -// Revision 3.9 2006/06/26 09:31:03 pascal_verdier -// Tango-5.5 compatiblity. -// extern C method added to be used as shared library. -// VCC 6 project file generated if running on Win32. -// .obj, .so, executable files generated in separated directories. -// -// Revision 3.8 2005/09/08 08:45:23 pascal_verdier -// For Pogo-4.4.0 and above. -// -// Revision 3.7 2005/06/17 08:53:21 pascal_verdier -// CVS tags management added. -// -// Revision 3.6 2005/05/19 13:11:18 pascal_verdier -// *** empty log message *** -// -// Revision 3.5 2005/03/02 14:06:15 pascal_verdier -// namespace is different than class name. -// -// Revision 3.4 2004/12/10 13:23:27 pascal_verdier -// Pogo-4.0.0 (Ready for Tango5). -// -// Revision 3.3 2004/11/08 14:27:21 pascal_verdier -// *** empty log message *** -// -// Revision 3.2 2004/11/08 11:33:16 pascal_verdier -// if device property not found in database, it takes class property value if exists. -// -// Revision 3.1 2004/09/06 09:27:05 pascal_verdier -// Modified for Tango 5 compatibility. -// -// -// copyleft : European Synchrotron Radiation Facility -// BP 220, Grenoble 38043 -// FRANCE -// -//-============================================================================= -// -// This file is generated by POGO -// (Program Obviously used to Generate tango Object) -// -// (c) - Software Engineering Group - ESRF -//============================================================================= - - -#include <tango.h> - -#include <SingleShotAO.h> -#include <SingleShotAOClass.h> - - -//+---------------------------------------------------------------------------- -/** - * Create SingleShotAOClass singleton and return it in a C function for Python usage - */ -//+---------------------------------------------------------------------------- -extern "C" { -#ifdef WIN32 - -__declspec(dllexport) - -#endif - - Tango::DeviceClass *_create_SingleShotAO_class(const char *name) { - return SingleShotAO_ns::SingleShotAOClass::init(name); - } -} - - -namespace SingleShotAO_ns -{ -//+---------------------------------------------------------------------------- -// -// method : AbortClass::execute() -// -// description : method to trigger the execution of the command. -// PLEASE DO NOT MODIFY this method core without pogo -// -// in : - device : The device on which the command must be executed -// - in_any : The command input data -// -// returns : The command output data (packed in the Any object) -// -//----------------------------------------------------------------------------- -CORBA::Any *AbortClass::execute(Tango::DeviceImpl *device,const CORBA::Any &in_any) -{ - - cout2 << "AbortClass::execute(): arrived" << endl; - - ((static_cast<SingleShotAO *>(device))->abort()); - return new CORBA::Any(); -} - - - - -// -//---------------------------------------------------------------- -// Initialize pointer for singleton pattern -//---------------------------------------------------------------- -// -SingleShotAOClass *SingleShotAOClass::_instance = NULL; - -//+---------------------------------------------------------------------------- -// -// method : SingleShotAOClass::SingleShotAOClass(string &s) -// -// description : constructor for the SingleShotAOClass -// -// in : - s : The class name -// -//----------------------------------------------------------------------------- -SingleShotAOClass::SingleShotAOClass(string &s):DeviceClass(s) -{ - - cout2 << "Entering SingleShotAOClass constructor" << endl; - set_default_property(); - get_class_property(); - write_class_property(); - - cout2 << "Leaving SingleShotAOClass constructor" << endl; - -} -//+---------------------------------------------------------------------------- -// -// method : SingleShotAOClass::~SingleShotAOClass() -// -// description : destructor for the SingleShotAOClass -// -//----------------------------------------------------------------------------- -SingleShotAOClass::~SingleShotAOClass() -{ - _instance = NULL; -} - -//+---------------------------------------------------------------------------- -// -// method : SingleShotAOClass::instance -// -// description : Create the object if not already done. Otherwise, just -// return a pointer to the object -// -// in : - name : The class name -// -//----------------------------------------------------------------------------- -SingleShotAOClass *SingleShotAOClass::init(const char *name) -{ - if (_instance == NULL) - { - try - { - string s(name); - _instance = new SingleShotAOClass(s); - } - catch (bad_alloc) - { - throw; - } - } - return _instance; -} - -SingleShotAOClass *SingleShotAOClass::instance() -{ - if (_instance == NULL) - { - cerr << "Class is not initialised !!" << endl; - exit(-1); - } - return _instance; -} - -//+---------------------------------------------------------------------------- -// -// method : SingleShotAOClass::command_factory -// -// description : Create the command object(s) and store them in the -// command list -// -//----------------------------------------------------------------------------- -void SingleShotAOClass::command_factory() -{ - command_list.push_back(new AbortClass("Abort", - Tango::DEV_VOID, Tango::DEV_VOID, - "", - "", - Tango::OPERATOR)); - - // add polling if any - for (unsigned int i=0 ; i<command_list.size(); i++) - { - } -} - -//+---------------------------------------------------------------------------- -// -// method : SingleShotAOClass::get_class_property -// -// description : Get the class property for specified name. -// -// in : string name : The property name -// -//+---------------------------------------------------------------------------- -Tango::DbDatum SingleShotAOClass::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, return an empty DbDatum - return Tango::DbDatum(prop_name); -} -//+---------------------------------------------------------------------------- -// -// method : SingleShotAOClass::get_default_device_property() -// -// description : Return the default value for device property. -// -//----------------------------------------------------------------------------- -Tango::DbDatum SingleShotAOClass::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 : SingleShotAOClass::get_default_class_property() -// -// description : Return the default value for class property. -// -//----------------------------------------------------------------------------- -Tango::DbDatum SingleShotAOClass::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 : SingleShotAOClass::device_factory -// -// description : Create the device object(s) and store them in the -// device list -// -// in : Tango::DevVarStringArray *devlist_ptr : The device name list -// -//----------------------------------------------------------------------------- -void SingleShotAOClass::device_factory(const Tango::DevVarStringArray *devlist_ptr) -{ - - // Create all devices.(Automatic code generation) - //------------------------------------------------------------- - for (unsigned long i=0 ; i < devlist_ptr->length() ; i++) - { - cout4 << "Device name : " << (*devlist_ptr)[i].in() << endl; - - // Create devices and add it into the device list - //---------------------------------------------------- - device_list.push_back(new SingleShotAO(this, (*devlist_ptr)[i])); - - // Export device to the outside world - // Check before if database used. - //--------------------------------------------- - if ((Tango::Util::_UseDb == true) && (Tango::Util::_FileDb == false)) - export_device(device_list.back()); - else - export_device(device_list.back(), (*devlist_ptr)[i]); - } - // End of Automatic code generation - //------------------------------------------------------------- - -} -//+---------------------------------------------------------------------------- -// Method: SingleShotAOClass::attribute_factory(vector<Tango::Attr *> &att_list) -//----------------------------------------------------------------------------- -void SingleShotAOClass::attribute_factory(vector<Tango::Attr *> &att_list) -{ - // Attribute : frequency - frequencyAttrib *frequency = new frequencyAttrib(); - Tango::UserDefaultAttrProp frequency_prop; - frequency_prop.set_label("frequency"); - frequency_prop.set_unit("Hz"); - frequency_prop.set_standard_unit("Hz"); - frequency_prop.set_display_unit("Hz"); - frequency_prop.set_description("Sampling frequency for ramp generation on the board output channels, in Hz."); - frequency->set_default_properties(frequency_prop); - frequency->set_disp_level(Tango::EXPERT); - frequency->set_memorized(); - frequency->set_memorized_init(false); - att_list.push_back(frequency); - - // End of Automatic code generation - //------------------------------------------------------------- -} - -//+---------------------------------------------------------------------------- -// -// method : SingleShotAOClass::get_class_property() -// -// description : Read the class properties from database. -// -//----------------------------------------------------------------------------- -void SingleShotAOClass::get_class_property() -{ - // Initialize your default values here (if not done with POGO). - //------------------------------------------------------------------ - - // Read class properties from database.(Automatic code generation) - //------------------------------------------------------------------ - - // Call database and extract values - //-------------------------------------------- - if (Tango::Util::instance()->_UseDb==true) - get_db_class()->get_property(cl_prop); - Tango::DbDatum def_prop; - int i = -1; - - - // End of Automatic code generation - //------------------------------------------------------------------ - -} - -//+---------------------------------------------------------------------------- -// -// method : SingleShotAOClass::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 SingleShotAOClass::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 = "BoardNum"; - prop_desc = "The the board identifier in the cPCI crate [valid range is 0...7 - no default value] ."; - 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 = "BoardType"; - prop_desc = "The board type [MAO_xxxx - where <xxxx> is the ADlink board identifier - e.g. MAO_6208 - no default value]"; - 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); - -} -//+---------------------------------------------------------------------------- -// -// method : SingleShotAOClass::write_class_property -// -// description : Set class description as property in database -// -//----------------------------------------------------------------------------- -void SingleShotAOClass::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("SingleShotAO Generic Device"); - title << str_title; - data.push_back(title); - - // Put Description - Tango::DbDatum description("Description"); - vector<string> str_desc; - str_desc.push_back("ADLink boards support for single shot AO operations [PCI-6208 and compatible boards]"); - description << str_desc; - data.push_back(description); - - // put cvs or svn location - string filename(classname); - filename += "Class.cpp"; - - // Create a string with the class ID to - // get the string into the binary - string class_id(ClassId); - - // check for cvs information - string src_path(CvsPath); - start = src_path.find("/"); - if (start!=string::npos) - { - 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_4Impl"); - inher_datum << inheritance; - data.push_back(inher_datum); - - // Call database and and values - //-------------------------------------------- - get_db_class()->put_property(data); -} - -} // namespace +static const char *ClassId = "$Id: DevServClass.cpp 13293 2009-04-07 10:53:56Z pascal_verdier $"; +static const char *TagName = "$Name: $"; +static const char *CvsPath = "$Source: $"; +static const char *SvnPath = "$HeadURL: $"; +static const char *HttpServer = "http://www.esrf.fr/computing/cs/tango/tango_doc/ds_doc/"; +//+============================================================================= +// +// file : SingleShotAOClass.cpp +// +// description : C++ source for the SingleShotAOClass. A singleton +// class derived from DeviceClass. It implements the +// command list and all properties and methods required +// by the SingleShotAO once per process. +// +// project : TANGO Device Server +// +// $Author: pascal_verdier $ +// +// $Revision: 13293 $ +// +// $Log$ +// Revision 3.11 2007/10/23 14:04:30 pascal_verdier +// Spelling mistakes correction +// +// Revision 3.10 2006/11/15 14:17:10 pascal_verdier +// Remove warnings from compiler. +// +// Revision 3.9 2006/06/26 09:31:03 pascal_verdier +// Tango-5.5 compatiblity. +// extern C method added to be used as shared library. +// VCC 6 project file generated if running on Win32. +// .obj, .so, executable files generated in separated directories. +// +// Revision 3.8 2005/09/08 08:45:23 pascal_verdier +// For Pogo-4.4.0 and above. +// +// Revision 3.7 2005/06/17 08:53:21 pascal_verdier +// CVS tags management added. +// +// Revision 3.6 2005/05/19 13:11:18 pascal_verdier +// *** empty log message *** +// +// Revision 3.5 2005/03/02 14:06:15 pascal_verdier +// namespace is different than class name. +// +// Revision 3.4 2004/12/10 13:23:27 pascal_verdier +// Pogo-4.0.0 (Ready for Tango5). +// +// Revision 3.3 2004/11/08 14:27:21 pascal_verdier +// *** empty log message *** +// +// Revision 3.2 2004/11/08 11:33:16 pascal_verdier +// if device property not found in database, it takes class property value if exists. +// +// Revision 3.1 2004/09/06 09:27:05 pascal_verdier +// Modified for Tango 5 compatibility. +// +// +// copyleft : European Synchrotron Radiation Facility +// BP 220, Grenoble 38043 +// FRANCE +// +//-============================================================================= +// +// This file is generated by POGO +// (Program Obviously used to Generate tango Object) +// +// (c) - Software Engineering Group - ESRF +//============================================================================= + + +#include <tango.h> + +#include <SingleShotAO.h> +#include <SingleShotAOClass.h> + + +//+---------------------------------------------------------------------------- +/** + * Create SingleShotAOClass singleton and return it in a C function for Python usage + */ +//+---------------------------------------------------------------------------- +extern "C" { +#ifdef WIN32 + +__declspec(dllexport) + +#endif + + Tango::DeviceClass *_create_SingleShotAO_class(const char *name) { + return SingleShotAO_ns::SingleShotAOClass::init(name); + } +} + + +namespace SingleShotAO_ns +{ +//+---------------------------------------------------------------------------- +// +// method : AbortClass::execute() +// +// description : method to trigger the execution of the command. +// PLEASE DO NOT MODIFY this method core without pogo +// +// in : - device : The device on which the command must be executed +// - in_any : The command input data +// +// returns : The command output data (packed in the Any object) +// +//----------------------------------------------------------------------------- +CORBA::Any *AbortClass::execute(Tango::DeviceImpl *device,const CORBA::Any &in_any) +{ + + cout2 << "AbortClass::execute(): arrived" << endl; + + ((static_cast<SingleShotAO *>(device))->abort()); + return new CORBA::Any(); +} + + + + +// +//---------------------------------------------------------------- +// Initialize pointer for singleton pattern +//---------------------------------------------------------------- +// +SingleShotAOClass *SingleShotAOClass::_instance = NULL; + +//+---------------------------------------------------------------------------- +// +// method : SingleShotAOClass::SingleShotAOClass(string &s) +// +// description : constructor for the SingleShotAOClass +// +// in : - s : The class name +// +//----------------------------------------------------------------------------- +SingleShotAOClass::SingleShotAOClass(string &s):DeviceClass(s) +{ + + cout2 << "Entering SingleShotAOClass constructor" << endl; + set_default_property(); + get_class_property(); + write_class_property(); + + cout2 << "Leaving SingleShotAOClass constructor" << endl; + +} +//+---------------------------------------------------------------------------- +// +// method : SingleShotAOClass::~SingleShotAOClass() +// +// description : destructor for the SingleShotAOClass +// +//----------------------------------------------------------------------------- +SingleShotAOClass::~SingleShotAOClass() +{ + _instance = NULL; +} + +//+---------------------------------------------------------------------------- +// +// method : SingleShotAOClass::instance +// +// description : Create the object if not already done. Otherwise, just +// return a pointer to the object +// +// in : - name : The class name +// +//----------------------------------------------------------------------------- +SingleShotAOClass *SingleShotAOClass::init(const char *name) +{ + if (_instance == NULL) + { + try + { + string s(name); + _instance = new SingleShotAOClass(s); + } + catch (bad_alloc) + { + throw; + } + } + return _instance; +} + +SingleShotAOClass *SingleShotAOClass::instance() +{ + if (_instance == NULL) + { + cerr << "Class is not initialised !!" << endl; + exit(-1); + } + return _instance; +} + +//+---------------------------------------------------------------------------- +// +// method : SingleShotAOClass::command_factory +// +// description : Create the command object(s) and store them in the +// command list +// +//----------------------------------------------------------------------------- +void SingleShotAOClass::command_factory() +{ + command_list.push_back(new AbortClass("Abort", + Tango::DEV_VOID, Tango::DEV_VOID, + "", + "", + Tango::OPERATOR)); + + // add polling if any + for (unsigned int i=0 ; i<command_list.size(); i++) + { + } +} + +//+---------------------------------------------------------------------------- +// +// method : SingleShotAOClass::get_class_property +// +// description : Get the class property for specified name. +// +// in : string name : The property name +// +//+---------------------------------------------------------------------------- +Tango::DbDatum SingleShotAOClass::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, return an empty DbDatum + return Tango::DbDatum(prop_name); +} +//+---------------------------------------------------------------------------- +// +// method : SingleShotAOClass::get_default_device_property() +// +// description : Return the default value for device property. +// +//----------------------------------------------------------------------------- +Tango::DbDatum SingleShotAOClass::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 : SingleShotAOClass::get_default_class_property() +// +// description : Return the default value for class property. +// +//----------------------------------------------------------------------------- +Tango::DbDatum SingleShotAOClass::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 : SingleShotAOClass::device_factory +// +// description : Create the device object(s) and store them in the +// device list +// +// in : Tango::DevVarStringArray *devlist_ptr : The device name list +// +//----------------------------------------------------------------------------- +void SingleShotAOClass::device_factory(const Tango::DevVarStringArray *devlist_ptr) +{ + + // Create all devices.(Automatic code generation) + //------------------------------------------------------------- + for (unsigned long i=0 ; i < devlist_ptr->length() ; i++) + { + cout4 << "Device name : " << (*devlist_ptr)[i].in() << endl; + + // Create devices and add it into the device list + //---------------------------------------------------- + device_list.push_back(new SingleShotAO(this, (*devlist_ptr)[i])); + + // Export device to the outside world + // Check before if database used. + //--------------------------------------------- + if ((Tango::Util::_UseDb == true) && (Tango::Util::_FileDb == false)) + export_device(device_list.back()); + else + export_device(device_list.back(), (*devlist_ptr)[i]); + } + // End of Automatic code generation + //------------------------------------------------------------- + +} +//+---------------------------------------------------------------------------- +// Method: SingleShotAOClass::attribute_factory(vector<Tango::Attr *> &att_list) +//----------------------------------------------------------------------------- +void SingleShotAOClass::attribute_factory(vector<Tango::Attr *> &att_list) +{ + // Attribute : frequency + frequencyAttrib *frequency = new frequencyAttrib(); + Tango::UserDefaultAttrProp frequency_prop; + frequency_prop.set_label("frequency"); + frequency_prop.set_unit("Hz"); + frequency_prop.set_standard_unit("Hz"); + frequency_prop.set_display_unit("Hz"); + frequency_prop.set_description("Sampling frequency for ramp generation on the board output channels, in Hz."); + frequency->set_default_properties(frequency_prop); + frequency->set_disp_level(Tango::EXPERT); + frequency->set_memorized(); + frequency->set_memorized_init(false); + att_list.push_back(frequency); + + // End of Automatic code generation + //------------------------------------------------------------- +} + +//+---------------------------------------------------------------------------- +// +// method : SingleShotAOClass::get_class_property() +// +// description : Read the class properties from database. +// +//----------------------------------------------------------------------------- +void SingleShotAOClass::get_class_property() +{ + // Initialize your default values here (if not done with POGO). + //------------------------------------------------------------------ + + // Read class properties from database.(Automatic code generation) + //------------------------------------------------------------------ + + // Call database and extract values + //-------------------------------------------- + if (Tango::Util::instance()->_UseDb==true) + get_db_class()->get_property(cl_prop); + Tango::DbDatum def_prop; + int i = -1; + + + // End of Automatic code generation + //------------------------------------------------------------------ + +} + +//+---------------------------------------------------------------------------- +// +// method : SingleShotAOClass::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 SingleShotAOClass::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 = "BoardNum"; + prop_desc = "The the board identifier in the cPCI crate [valid range is 0...7 - no default value] ."; + 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 = "BoardType"; + prop_desc = "The board type [MAO_xxxx - where <xxxx> is the ADlink board identifier - e.g. MAO_6208 - no default value]"; + 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); + +} +//+---------------------------------------------------------------------------- +// +// method : SingleShotAOClass::write_class_property +// +// description : Set class description as property in database +// +//----------------------------------------------------------------------------- +void SingleShotAOClass::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("SingleShotAO Generic Device"); + title << str_title; + data.push_back(title); + + // Put Description + Tango::DbDatum description("Description"); + vector<string> str_desc; + str_desc.push_back("ADLink boards support for single shot AO operations [PCI-6208 and compatible boards]"); + description << str_desc; + data.push_back(description); + + // put cvs or svn location + string filename(classname); + filename += "Class.cpp"; + + // Create a string with the class ID to + // get the string into the binary + string class_id(ClassId); + + // check for cvs information + string src_path(CvsPath); + start = src_path.find("/"); + if (start!=string::npos) + { + 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_4Impl"); + inher_datum << inheritance; + data.push_back(inher_datum); + + // Call database and and values + //-------------------------------------------- + get_db_class()->put_property(data); +} + +} // namespace diff --git a/src/SingleShotAOClass.h b/src/SingleShotAOClass.h index 3f41d25c4d21b347124525671443f522739b2b0b..2214c6131c27988a5917433ba2e2d28c0557f714 100755 --- a/src/SingleShotAOClass.h +++ b/src/SingleShotAOClass.h @@ -1,161 +1,161 @@ -//============================================================================= -// -// file : SingleShotAOClass.h -// -// description : Include for the SingleShotAOClass root class. -// This class is the singleton class for -// the SingleShotAO device class. -// It contains all properties and methods which the -// SingleShotAO requires only once e.g. the commands. -// -// project : TANGO Device Server -// -// $Author: pascal_verdier $ -// -// $Revision: 14110 $ -// $Date: 2010-02-10 08:47:17 +0100 (Wed, 10 Feb 2010) $ -// -// SVN only: -// $HeadURL: $ -// -// CVS only: -// $Source$ -// $Log$ -// Revision 3.8 2009/04/07 10:53:56 pascal_verdier -// Tango-7 release. -// SVN tags added -// -// Revision 3.7 2008/04/07 12:01:57 pascal_verdier -// CVS put property modified. -// -// Revision 3.6 2007/10/23 14:04:30 pascal_verdier -// Spelling mistakes correction -// -// Revision 3.5 2007/09/14 14:36:08 pascal_verdier -// Add an ifdef WIN32 for dll generation -// -// Revision 3.4 2005/09/08 08:45:23 pascal_verdier -// For Pogo-4.4.0 and above. -// -// Revision 3.3 2005/03/02 14:06:15 pascal_verdier -// namespace is different than class name. -// -// Revision 3.2 2004/11/08 11:33:16 pascal_verdier -// if device property not found in database, it takes class property value if exists. -// -// Revision 3.1 2004/09/06 09:27:05 pascal_verdier -// Modified for Tango 5 compatibility. -// -// -// copyleft : European Synchrotron Radiation Facility -// BP 220, Grenoble 38043 -// FRANCE -// -//============================================================================= -// -// This file is generated by POGO -// (Program Obviously used to Generate tango Object) -// -// (c) - Software Engineering Group - ESRF -//============================================================================= - -#ifndef _SINGLESHOTAOCLASS_H -#define _SINGLESHOTAOCLASS_H - -#include <tango.h> -#include <SingleShotAO.h> - - -namespace SingleShotAO_ns -{//===================================== -// Define classes for attributes -//===================================== -class frequencyAttrib: public Tango::Attr -{ -public: - frequencyAttrib():Attr("frequency", Tango::DEV_DOUBLE, Tango::READ_WRITE) {}; - ~frequencyAttrib() {}; - - virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) - {(static_cast<SingleShotAO *>(dev))->read_frequency(att);} - virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att) - {(static_cast<SingleShotAO *>(dev))->write_frequency(att);} - virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) - {return (static_cast<SingleShotAO *>(dev))->is_frequency_allowed(ty);} -}; - -//========================================= -// Define classes for commands -//========================================= -class AbortClass : public Tango::Command -{ -public: - AbortClass(const char *name, - Tango::CmdArgType in, - Tango::CmdArgType out, - const char *in_desc, - const char *out_desc, - Tango::DispLevel level) - :Command(name,in,out,in_desc,out_desc, level) {}; - - AbortClass(const char *name, - Tango::CmdArgType in, - Tango::CmdArgType out) - :Command(name,in,out) {}; - ~AbortClass() {}; - - virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any); - virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any) - {return (static_cast<SingleShotAO *>(dev))->is_Abort_allowed(any);} -}; - - - -// -// The SingleShotAOClass singleton definition -// - -class -#ifdef _TG_WINDOWS_ - __declspec(dllexport) -#endif - SingleShotAOClass : public Tango::DeviceClass -{ -public: -// properties member data - -// add your own data members here -//------------------------------------ - -public: - Tango::DbData cl_prop; - Tango::DbData cl_def_prop; - Tango::DbData dev_def_prop; - -// Method prototypes - static SingleShotAOClass *init(const char *); - static SingleShotAOClass *instance(); - ~SingleShotAOClass(); - Tango::DbDatum get_class_property(string &); - Tango::DbDatum get_default_device_property(string &); - Tango::DbDatum get_default_class_property(string &); - -protected: - SingleShotAOClass(string &); - static SingleShotAOClass *_instance; - void command_factory(); - void get_class_property(); - void attribute_factory(vector<Tango::Attr *> &); - void write_class_property(); - void set_default_property(); - string get_cvstag(); - string get_cvsroot(); - -private: - void device_factory(const Tango::DevVarStringArray *); -}; - - -} // namespace SingleShotAO_ns - -#endif // _SINGLESHOTAOCLASS_H +//============================================================================= +// +// file : SingleShotAOClass.h +// +// description : Include for the SingleShotAOClass root class. +// This class is the singleton class for +// the SingleShotAO device class. +// It contains all properties and methods which the +// SingleShotAO requires only once e.g. the commands. +// +// project : TANGO Device Server +// +// $Author: pascal_verdier $ +// +// $Revision: 14110 $ +// $Date: 2010-02-10 08:47:17 +0100 (Wed, 10 Feb 2010) $ +// +// SVN only: +// $HeadURL: $ +// +// CVS only: +// $Source$ +// $Log$ +// Revision 3.8 2009/04/07 10:53:56 pascal_verdier +// Tango-7 release. +// SVN tags added +// +// Revision 3.7 2008/04/07 12:01:57 pascal_verdier +// CVS put property modified. +// +// Revision 3.6 2007/10/23 14:04:30 pascal_verdier +// Spelling mistakes correction +// +// Revision 3.5 2007/09/14 14:36:08 pascal_verdier +// Add an ifdef WIN32 for dll generation +// +// Revision 3.4 2005/09/08 08:45:23 pascal_verdier +// For Pogo-4.4.0 and above. +// +// Revision 3.3 2005/03/02 14:06:15 pascal_verdier +// namespace is different than class name. +// +// Revision 3.2 2004/11/08 11:33:16 pascal_verdier +// if device property not found in database, it takes class property value if exists. +// +// Revision 3.1 2004/09/06 09:27:05 pascal_verdier +// Modified for Tango 5 compatibility. +// +// +// copyleft : European Synchrotron Radiation Facility +// BP 220, Grenoble 38043 +// FRANCE +// +//============================================================================= +// +// This file is generated by POGO +// (Program Obviously used to Generate tango Object) +// +// (c) - Software Engineering Group - ESRF +//============================================================================= + +#ifndef _SINGLESHOTAOCLASS_H +#define _SINGLESHOTAOCLASS_H + +#include <tango.h> +#include <SingleShotAO.h> + + +namespace SingleShotAO_ns +{//===================================== +// Define classes for attributes +//===================================== +class frequencyAttrib: public Tango::Attr +{ +public: + frequencyAttrib():Attr("frequency", Tango::DEV_DOUBLE, Tango::READ_WRITE) {}; + ~frequencyAttrib() {}; + + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<SingleShotAO *>(dev))->read_frequency(att);} + virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att) + {(static_cast<SingleShotAO *>(dev))->write_frequency(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<SingleShotAO *>(dev))->is_frequency_allowed(ty);} +}; + +//========================================= +// Define classes for commands +//========================================= +class AbortClass : public Tango::Command +{ +public: + AbortClass(const char *name, + Tango::CmdArgType in, + Tango::CmdArgType out, + const char *in_desc, + const char *out_desc, + Tango::DispLevel level) + :Command(name,in,out,in_desc,out_desc, level) {}; + + AbortClass(const char *name, + Tango::CmdArgType in, + Tango::CmdArgType out) + :Command(name,in,out) {}; + ~AbortClass() {}; + + virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any); + virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any) + {return (static_cast<SingleShotAO *>(dev))->is_Abort_allowed(any);} +}; + + + +// +// The SingleShotAOClass singleton definition +// + +class +#ifdef _TG_WINDOWS_ + __declspec(dllexport) +#endif + SingleShotAOClass : public Tango::DeviceClass +{ +public: +// properties member data + +// add your own data members here +//------------------------------------ + +public: + Tango::DbData cl_prop; + Tango::DbData cl_def_prop; + Tango::DbData dev_def_prop; + +// Method prototypes + static SingleShotAOClass *init(const char *); + static SingleShotAOClass *instance(); + ~SingleShotAOClass(); + Tango::DbDatum get_class_property(string &); + Tango::DbDatum get_default_device_property(string &); + Tango::DbDatum get_default_class_property(string &); + +protected: + SingleShotAOClass(string &); + static SingleShotAOClass *_instance; + void command_factory(); + void get_class_property(); + void attribute_factory(vector<Tango::Attr *> &); + void write_class_property(); + void set_default_property(); + string get_cvstag(); + string get_cvsroot(); + +private: + void device_factory(const Tango::DevVarStringArray *); +}; + + +} // namespace SingleShotAO_ns + +#endif // _SINGLESHOTAOCLASS_H diff --git a/src/SingleShotAOManager.cpp b/src/SingleShotAOManager.cpp old mode 100644 new mode 100755 diff --git a/src/SingleShotAOManager.h b/src/SingleShotAOManager.h old mode 100644 new mode 100755 diff --git a/src/SingleShotAOStateMachine.cpp b/src/SingleShotAOStateMachine.cpp old mode 100644 new mode 100755 diff --git a/src/SingleShotAOTypesAndConsts.h b/src/SingleShotAOTypesAndConsts.h old mode 100644 new mode 100755 diff --git a/src/TangoClassID.txt b/src/TangoClassID.txt old mode 100644 new mode 100755 diff --git a/src/main.cpp b/src/main.cpp index f7270e75686c0d79656e95f2c32ceb6a63517a0f..bc614cce7b35fafa6606a2d461b1b4055bc8d82d 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,86 +1,86 @@ -static const char *RcsId = "$Id $"; -//+============================================================================= -// -// file : main.cpp -// -// description : C++ source for a TANGO 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 : TANGO Device Server -// -// $Author: pascal_verdier $ -// -// $Revision: 13293 $ $ -// $Date: 2009-04-07 12:53:56 +0200 (Tue, 07 Apr 2009) $ -// -// SVN only: -// $HeadURL: $ -// -// CVS only: -// $Source$ -// $Log$ -// Revision 3.2 2004/09/06 09:27:05 pascal_verdier -// Modified for Tango 5 compatibility. -// -// -// copyleft : European Synchrotron Radiation Facility -// BP 220, Grenoble 38043 -// FRANCE -// -//-============================================================================= -// -// This file is generated by POGO -// (Program Obviously used to Generate tango Object) -// -// (c) - Software Engineering Group - ESRF -//============================================================================= - -#include <tango.h> - -#if defined(ENABLE_CRASH_REPORT) -# include <crashreporting/crash_report.h> -#else -# define DECLARE_CRASH_HANDLER -# define INSTALL_CRASH_HANDLER -#endif - -DECLARE_CRASH_HANDLER; - -int main(int argc,char *argv[]) -{ - INSTALL_CRASH_HANDLER; - - Tango::Util *tg = 0; - 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; - } - tg->server_cleanup(); - return(0); -} +static const char *RcsId = "$Id $"; +//+============================================================================= +// +// file : main.cpp +// +// description : C++ source for a TANGO 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 : TANGO Device Server +// +// $Author: pascal_verdier $ +// +// $Revision: 13293 $ $ +// $Date: 2009-04-07 12:53:56 +0200 (Tue, 07 Apr 2009) $ +// +// SVN only: +// $HeadURL: $ +// +// CVS only: +// $Source$ +// $Log$ +// Revision 3.2 2004/09/06 09:27:05 pascal_verdier +// Modified for Tango 5 compatibility. +// +// +// copyleft : European Synchrotron Radiation Facility +// BP 220, Grenoble 38043 +// FRANCE +// +//-============================================================================= +// +// This file is generated by POGO +// (Program Obviously used to Generate tango Object) +// +// (c) - Software Engineering Group - ESRF +//============================================================================= + +#include <tango.h> + +#if defined(ENABLE_CRASH_REPORT) +# include <crashreporting/crash_report.h> +#else +# define DECLARE_CRASH_HANDLER +# define INSTALL_CRASH_HANDLER +#endif + +DECLARE_CRASH_HANDLER; + +int main(int argc,char *argv[]) +{ + INSTALL_CRASH_HANDLER; + + Tango::Util *tg = 0; + 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; + } + tg->server_cleanup(); + return(0); +}