From e0b58982a9f371497f7dfa2a7e4a471ce4fbe708 Mon Sep 17 00:00:00 2001 From: Sylvain Dupuy <sylvain.dupuy@synchrotron-soleil.fr> Date: Wed, 29 Sep 2004 15:42:14 +0000 Subject: [PATCH] Initial import. --- doc/doc_html/Attributes.html | 105 ++++ doc/doc_html/Description.html | 62 +++ doc/doc_html/DevCommands.html | 101 ++++ doc/doc_html/DevCommandsFrame.html | 20 + doc/doc_html/DevCommandsList.html | 17 + doc/doc_html/DevCommandsTable.html | 76 +++ doc/doc_html/Properties.html | 83 +++ doc/doc_html/TangoDevStates.html | 78 +++ doc/doc_html/index.html | 93 ++++ include/LecroyException.h | 179 +++++++ include/SocketException.h | 76 +++ include/SocketLecroy.h | 86 +++ include/Waveform.h | 120 +++++ include/WaveformException.h | 75 +++ include/Xstring.h | 31 ++ src/AcquireWaveformLecroy.cpp | 566 ++++++++++++++++++++ src/AcquireWaveformLecroy.h | 217 ++++++++ src/AcquireWaveformLecroyClass.cpp | 298 +++++++++++ src/AcquireWaveformLecroyClass.h | 74 +++ src/ClassFactory.cpp | 47 ++ src/Doxyfile | 831 +++++++++++++++++++++++++++++ src/LecroyException.cpp | 207 +++++++ src/Makefile | 91 ++++ src/Makefile.VC | 55 ++ src/README | 40 ++ src/SocketException.cpp | 85 +++ src/SocketLecroy.cpp | 329 ++++++++++++ src/Waveform.cpp | 265 +++++++++ src/WaveformException.cpp | 85 +++ src/main.cpp | 74 +++ 30 files changed, 4466 insertions(+) create mode 100644 doc/doc_html/Attributes.html create mode 100644 doc/doc_html/Description.html create mode 100644 doc/doc_html/DevCommands.html create mode 100644 doc/doc_html/DevCommandsFrame.html create mode 100644 doc/doc_html/DevCommandsList.html create mode 100644 doc/doc_html/DevCommandsTable.html create mode 100644 doc/doc_html/Properties.html create mode 100644 doc/doc_html/TangoDevStates.html create mode 100644 doc/doc_html/index.html create mode 100644 include/LecroyException.h create mode 100644 include/SocketException.h create mode 100644 include/SocketLecroy.h create mode 100644 include/Waveform.h create mode 100644 include/WaveformException.h create mode 100644 include/Xstring.h create mode 100644 src/AcquireWaveformLecroy.cpp create mode 100644 src/AcquireWaveformLecroy.h create mode 100644 src/AcquireWaveformLecroyClass.cpp create mode 100644 src/AcquireWaveformLecroyClass.h create mode 100644 src/ClassFactory.cpp create mode 100644 src/Doxyfile create mode 100644 src/LecroyException.cpp create mode 100644 src/Makefile create mode 100644 src/Makefile.VC create mode 100644 src/README create mode 100644 src/SocketException.cpp create mode 100644 src/SocketLecroy.cpp create mode 100644 src/Waveform.cpp create mode 100644 src/WaveformException.cpp create mode 100644 src/main.cpp diff --git a/doc/doc_html/Attributes.html b/doc/doc_html/Attributes.html new file mode 100644 index 0000000..02b3526 --- /dev/null +++ b/doc/doc_html/Attributes.html @@ -0,0 +1,105 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<Title> Tango Device Server User's Guide </Title> + <META NAME="GENERATOR" CONTENT="Mozilla/3.01Gold (X11; I; HP-UX B.10.20 9000/735) [Netscape]"> +</HEAD> +<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#FF0000" ALINK="#FF0000"> + +<P><!-------TITLE------></P> +<table width="100%" height="20%"><tr> +<td align=LEFT> +<FONT COLOR="#0000FF"><FONT SIZE=+4>Synchrotron </FONT></FONT> +<FONT COLOR="#0000FF"><FONT SIZE=+4>Soleil</FONT></FONT> +<H5>Saint-Aubin - BP 48 91192 GIF-sur-YVETTE CEDEX<BR> +</td><td> +<A href="http://www.synchrotron-soleil.fr/"> +<IMG SRC="http://controle/images/logo-150.gif" + ALT="SOLEIL Logo" ALIGN=RIGHT border="0"></A> +</td></tr></table> + +<HR WIDTH="100%"></H5> + +<Br> +<center> +<h1> +Acquire_Waveform_Lecroy_Prj<Br> +Device Attributes Description +</h1> +<Br> +<b> +Revision: - Author: x.elattaoui +</b> +</center> + + +<Br> +<Table Border=2 Cellpadding=3 CELLSPACING=0 WIDTH="100%"> +<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> +<Td COLSPAN=4> <Font Size=+2><Center><b>Scalar Attributes</b></td></Font></Center> +<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> +<Td><Center><b>Attribute name</b></td></Center> +<Td><Center><b>Data Type</b></td></Center> +<Td><Center><b>R/W Type</b></td></Center> +<Td><Center><b>Expert</b></td></Center> +<Tr><Td><b><Center>waveArray1</b><Br>( Length of the first array. This first array contains data of simples waveforms. )</Center></Td> +<Td><Center>DEV_LONG</Center></Td><Td><Center>READ</Center></Td><Td><Center>No</Center></Td></Tr> + +<Tr><Td><b><Center>waveArrayCount</b><Br>( Length of the two arrays. If the length of wavearray1 is different of this length that's means data are present in the array wavearray2. Which is used for complex data as math operations on a waveform. )</Center></Td> +<Td><Center>DEV_LONG</Center></Td><Td><Center>READ</Center></Td><Td><Center>No</Center></Td></Tr> + +<Tr><Td><b><Center>nominalBits</b><Br>( ADC resolution. For simple data this ADC is an 8 bits resolution else it's can be 10 up to 12 bits )</Center></Td> +<Td><Center>DEV_SHORT</Center></Td><Td><Center>READ</Center></Td><Td><Center>No</Center></Td></Tr> + +<Tr><Td><b><Center>horizontalInterval</b><Br>( Sampling interval for time domain waveforms Needed to scale the waveform data stored in the rawWaveformData attribute. )</Center></Td> +<Td><Center>DEV_DOUBLE</Center></Td><Td><Center>READ</Center></Td><Td><Center>No</Center></Td></Tr> + +<Tr><Td><b><Center>horizontalOffset</b><Br>( Trigger offset for the first sweep of the trigger, seconds between the trigger and the first data point. Needed to scale the waveform data stored in the rawWaveformData attribute. )</Center></Td> +<Td><Center>DEV_DOUBLE</Center></Td><Td><Center>READ</Center></Td><Td><Center>No</Center></Td></Tr> + +<Tr><Td><b><Center>verticalGain</b><Br>( The vertical gain. Used to scale the waveform data stored in the rawWaveformData attribute. )</Center></Td> +<Td><Center>DEV_DOUBLE</Center></Td><Td><Center>READ</Center></Td><Td><Center>No</Center></Td></Tr> + +<Tr><Td><b><Center>verticalOffset</b><Br>( Needed to scale the waveform data stored in the rawWaveformData attribute. )</Center></Td> +<Td><Center>DEV_DOUBLE</Center></Td><Td><Center>READ</Center></Td><Td><Center>No</Center></Td></Tr> + +<Tr><Td><b><Center>triggerTime</b></Center></Td> +<Td><Center>DEV_STRING</Center></Td><Td><Center>READ</Center></Td><Td><Center>No</Center></Td></Tr> + +</Table> +</Center> +<Br><Br><Br><Br><Br> +<Table Border=2 Cellpadding=3 CELLSPACING=0 WIDTH="100%"> +<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> +<Td COLSPAN=4> <Font Size=+2><Center><b>Spectrum Attributes</b></td></Font></Center> +<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> +<Td><Center><b>Attribute name</b></td></Center> +<Td><Center><b>Data Type</b></td></Center> +<Td><Center><b>X Data Length</b></td></Center> +<Td><Center><b>Expert</b></td></Center> +<Tr><Td><b><Center>rawWaveformData</b><Br>( Gets the raw waveform data. Maximum size : 150000 data )</Center></Td> +<Td><Center>DEV_SHORT</Center></Td><Td><Center>150000</Center></Td><Td><Center>No</Center></Td></Tr> + +<Tr><Td><b><Center>verticalScaledData</b><Br>( Gets the scaled waveform data. Maximum size : 150000 data )</Center></Td> +<Td><Center>DEV_DOUBLE</Center></Td><Td><Center>150000</Center></Td><Td><Center>No</Center></Td></Tr> + +</Table> +</Center> +<Br><Br><Br><Br><Br> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<Title> Tango Device Server User's Guide </Title> + <META NAME="GENERATOR" CONTENT="Mozilla/3.01Gold (X11; I; HP-UX B.10.20 9000/735) [Netscape]"> +</HEAD> +<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#FF0000" ALINK="#FF0000"> + +<P><!-------TITLE------></P> + +<Center> +<Br> +<HR WIDTH="100%"></H5> +<H3>(c) SOLEIL : Groupe ICA Contr�le et Acquisitions </H33> +</Center> +</body> +</html> diff --git a/doc/doc_html/Description.html b/doc/doc_html/Description.html new file mode 100644 index 0000000..10e8c5a --- /dev/null +++ b/doc/doc_html/Description.html @@ -0,0 +1,62 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<Title> Tango Device Server User's Guide </Title> + <META NAME="GENERATOR" CONTENT="Mozilla/3.01Gold (X11; I; HP-UX B.10.20 9000/735) [Netscape]"> +</HEAD> +<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#FF0000" ALINK="#FF0000"> + +<P><!-------TITLE------></P> +<table width="100%" height="20%"><tr> +<td align=LEFT> +<FONT COLOR="#0000FF"><FONT SIZE=+4>Synchrotron </FONT></FONT> +<FONT COLOR="#0000FF"><FONT SIZE=+4>Soleil</FONT></FONT> +<H5>Saint-Aubin - BP 48 91192 GIF-sur-YVETTE CEDEX<BR> +</td><td> +<A href="http://www.synchrotron-soleil.fr/"> +<IMG SRC="http://controle/images/logo-150.gif" + ALT="SOLEIL Logo" ALIGN=RIGHT border="0"></A> +</td></tr></table> + +<HR WIDTH="100%"></H5> + +<Br> +<center> +<h1> +Acquire_Waveform_Lecroy_Prj<Br> +Device Description +</h1> +<Br> +<b> +Revision: - Author: x.elattaoui +</b> +</center> + + +<Center> +<Br> +<Br> +<Br> +<Br> +<Br> +<Br> +This Page Must Be Filled by <Br> +The Programmer +</Center> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<Title> Tango Device Server User's Guide </Title> + <META NAME="GENERATOR" CONTENT="Mozilla/3.01Gold (X11; I; HP-UX B.10.20 9000/735) [Netscape]"> +</HEAD> +<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#FF0000" ALINK="#FF0000"> + +<P><!-------TITLE------></P> + +<Center> +<Br> +<HR WIDTH="100%"></H5> +<H3>(c) SOLEIL : Groupe ICA Contr�le et Acquisitions </H33> +</Center> +</body> +</html> diff --git a/doc/doc_html/DevCommands.html b/doc/doc_html/DevCommands.html new file mode 100644 index 0000000..9047eac --- /dev/null +++ b/doc/doc_html/DevCommands.html @@ -0,0 +1,101 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<Title> Tango Device Server User's Guide </Title> + <META NAME="GENERATOR" CONTENT="Mozilla/3.01Gold (X11; I; HP-UX B.10.20 9000/735) [Netscape]"> +</HEAD> +<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#FF0000" ALINK="#FF0000"> + +<P><!-------TITLE------></P> +<table width="100%" height="20%"><tr> +<td align=LEFT> +<FONT COLOR="#0000FF"><FONT SIZE=+4>Synchrotron </FONT></FONT> +<FONT COLOR="#0000FF"><FONT SIZE=+4>Soleil</FONT></FONT> +<H5>Saint-Aubin - BP 48 91192 GIF-sur-YVETTE CEDEX<BR> +</td><td> +<A href="http://www.synchrotron-soleil.fr/"> +<IMG SRC="http://controle/images/logo-150.gif" + ALT="SOLEIL Logo" ALIGN=RIGHT border="0"></A> +</td></tr></table> + +<HR WIDTH="100%"></H5> + +<Br> +<center> +<h1> +Acquire_Waveform_Lecroy_Prj<Br> +Device Commands Description +</h1> +<Br> +<b> +Revision: - Author: x.elattaoui +</b> +</center> + + +<Br> +<Br> +<Br> +<A NAME="Init"><!-- --></A> +<A NAME="Init"><!-- --></A> +<h2>1 - Init</h2> +<ul> +<Li><Strong>Description: </Strong> This commands re-initialise a device keeping the same network connection.<Br> +After an Init command executed on a device, it is not necessary for client to re-connect to the device.<Br> +This command first calls the device <i> delete_device() </i>method and then execute its <i> init_device()</i> method.<Br> +For C++ device server, all the memory allocated in the <i> nit_device() </i> method must be freed in the <i> delete_device() </i> method.<Br> +The language device desctructor automatically calls the <i> delete_device() </i> method.<Br>  +<Li><Strong>Argin:<Br>DEV_VOID</Strong> + : none.<Br>  +<Li><Strong>Argout:<Br>DEV_VOID</Strong> + : none.<Br>  +<Li><Strong>Command allowed for: </Strong><Ul> +<Li>Tango::OPEN<Li>Tango::CLOSE<Li>Tango::FAULT<Li>Tango::ALARM</Ul> +<Br>  +</ul><Br> +<Br> +<A NAME="State"><!-- --></A> +<A NAME="State"><!-- --></A> +<h2>2 - State</h2> +<ul> +<Li><Strong>Description: </Strong> This command gets the device state (stored in its <i>device_state</i> data member) and returns it to the caller.<Br>  +<Li><Strong>Argin:<Br>DEV_VOID</Strong> + : none.<Br>  +<Li><Strong>Argout:<Br>DEV_STATE</Strong> + : State Code<Br>  +<Li><Strong>Command allowed for: </Strong><Ul> +<Li>Tango::OPEN<Li>Tango::CLOSE<Li>Tango::FAULT<Li>Tango::ALARM</Ul> +<Br>  +</ul><Br> +<Br> +<A NAME="Status"><!-- --></A> +<A NAME="Status"><!-- --></A> +<h2>3 - Status</h2> +<ul> +<Li><Strong>Description: </Strong> This command gets the device status (stored in its <i>device_status</i> data member) and returns it to the caller.<Br>  +<Li><Strong>Argin:<Br>DEV_VOID</Strong> + : none.<Br>  +<Li><Strong>Argout:<Br>CONST_DEV_STRING</Strong> + : Status descrition<Br>  +<Li><Strong>Command allowed for: </Strong><Ul> +<Li>Tango::OPEN<Li>Tango::CLOSE<Li>Tango::FAULT<Li>Tango::ALARM</Ul> +<Br>  +</ul><Br> +<Br> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<Title> Tango Device Server User's Guide </Title> + <META NAME="GENERATOR" CONTENT="Mozilla/3.01Gold (X11; I; HP-UX B.10.20 9000/735) [Netscape]"> +</HEAD> +<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#FF0000" ALINK="#FF0000"> + +<P><!-------TITLE------></P> + +<Center> +<Br> +<HR WIDTH="100%"></H5> +<H3>(c) SOLEIL : Groupe ICA Contr�le et Acquisitions </H33> +</Center> +</body> +</html> diff --git a/doc/doc_html/DevCommandsFrame.html b/doc/doc_html/DevCommandsFrame.html new file mode 100644 index 0000000..039ee33 --- /dev/null +++ b/doc/doc_html/DevCommandsFrame.html @@ -0,0 +1,20 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<Title> Tango Device Server User's Guide </Title> + <META NAME="GENERATOR" CONTENT="Mozilla/3.01Gold (X11; I; HP-UX B.10.20 9000/735) [Netscape]"> +</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/DevCommandsList.html b/doc/doc_html/DevCommandsList.html new file mode 100644 index 0000000..c369265 --- /dev/null +++ b/doc/doc_html/DevCommandsList.html @@ -0,0 +1,17 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> +<HTML><HEAD> +<TITLE>Commands +</TITLE></HEAD> +<BODY BGCOLOR="white"> +<FONT size="+1" ID="FrameHeadingFont"> +<B>Commands:</B></FONT> +<Br> +<Br> +<Br> +<A Href="DevCommands.html#Init" TARGET="DevCommands"> Init</a><Br> +<A Href="DevCommands.html#State" TARGET="DevCommands"> State</a><Br> +<A Href="DevCommands.html#Status" TARGET="DevCommands"> Status</a><Br> + + +</BODY> +</HTML> diff --git a/doc/doc_html/DevCommandsTable.html b/doc/doc_html/DevCommandsTable.html new file mode 100644 index 0000000..4ae30a4 --- /dev/null +++ b/doc/doc_html/DevCommandsTable.html @@ -0,0 +1,76 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<Title> Tango Device Server User's Guide </Title> + <META NAME="GENERATOR" CONTENT="Mozilla/3.01Gold (X11; I; HP-UX B.10.20 9000/735) [Netscape]"> +</HEAD> +<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#FF0000" ALINK="#FF0000"> + +<P><!-------TITLE------></P> +<table width="100%" height="20%"><tr> +<td align=LEFT> +<FONT COLOR="#0000FF"><FONT SIZE=+4>Synchrotron </FONT></FONT> +<FONT COLOR="#0000FF"><FONT SIZE=+4>Soleil</FONT></FONT> +<H5>Saint-Aubin - BP 48 91192 GIF-sur-YVETTE CEDEX<BR> +</td><td> +<A href="http://www.synchrotron-soleil.fr/"> +<IMG SRC="http://controle/images/logo-150.gif" + ALT="SOLEIL Logo" ALIGN=RIGHT border="0"></A> +</td></tr></table> + +<HR WIDTH="100%"></H5> + +<Br> +<center> +<h1> +Acquire_Waveform_Lecroy_Prj<Br> +Device Commands Description +</h1> +<Br> +<b> +Revision: - Author: x.elattaoui +</b> +</center> + + +<Center> +<Br><Br> +<A Href="DevCommandsFrame.html"> More Details on commands.... </a><Br> +<Br> <Br> +<Table Border=2 Cellpadding=3 CELLSPACING=0 WIDTH="100%"> +<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> +<Td COLSPAN=3> <Font Size=+2><Center><b>Device Commands for Operator Level</b></td></Font></Center> +<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> +<Td><Center><b>Command name</b></td></Center> +<Td><Center><b>Argument In</b></td></Center> +<Td><Center><b>Argument Out</b></td></Center> +<Tr><Td>Init</Td> +<Td>DEV_VOID</Td> +<Td>DEV_VOID</Td> +<Tr><Td>State</Td> +<Td>DEV_VOID</Td> +<Td>DEV_STATE</Td> +<Tr><Td>Status</Td> +<Td>DEV_VOID</Td> +<Td>CONST_DEV_STRING</Td> + + + +</Table></Center> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<Title> Tango Device Server User's Guide </Title> + <META NAME="GENERATOR" CONTENT="Mozilla/3.01Gold (X11; I; HP-UX B.10.20 9000/735) [Netscape]"> +</HEAD> +<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#FF0000" ALINK="#FF0000"> + +<P><!-------TITLE------></P> + +<Center> +<Br> +<HR WIDTH="100%"></H5> +<H3>(c) SOLEIL : Groupe ICA Contr�le et Acquisitions </H33> +</Center> +</body> +</html> diff --git a/doc/doc_html/Properties.html b/doc/doc_html/Properties.html new file mode 100644 index 0000000..d345f44 --- /dev/null +++ b/doc/doc_html/Properties.html @@ -0,0 +1,83 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<Title> Tango Device Server User's Guide </Title> + <META NAME="GENERATOR" CONTENT="Mozilla/3.01Gold (X11; I; HP-UX B.10.20 9000/735) [Netscape]"> +</HEAD> +<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#FF0000" ALINK="#FF0000"> + +<P><!-------TITLE------></P> +<table width="100%" height="20%"><tr> +<td align=LEFT> +<FONT COLOR="#0000FF"><FONT SIZE=+4>Synchrotron </FONT></FONT> +<FONT COLOR="#0000FF"><FONT SIZE=+4>Soleil</FONT></FONT> +<H5>Saint-Aubin - BP 48 91192 GIF-sur-YVETTE CEDEX<BR> +</td><td> +<A href="http://www.synchrotron-soleil.fr/"> +<IMG SRC="http://controle/images/logo-150.gif" + ALT="SOLEIL Logo" ALIGN=RIGHT border="0"></A> +</td></tr></table> + +<HR WIDTH="100%"></H5> + +<Br> +<center> +<h1> +Acquire_Waveform_Lecroy_Prj<Br> +Properties Description +</h1> +<Br> +<b> +Revision: - Author: x.elattaoui +</b> +</center> + + +<Br> <Br> <Br> +<Center> +<Br> <Br> <Br> +<Table Border=2 Cellpadding=3 CELLSPACING=0 WIDTH="100%"> +<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> +<Td COLSPAN=3> <Font Size=+2><Center><b>Device Properties</b></td></Font></Center> +<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> +<Td><Center><b>Property name</b></td></Center> +<Td><Center><b>Property type</b></td></Center> +<Td><Center><b>Description</b></td></Center> +<Tr><Td>IPaddress</Td> +<Td>Tango::DEV_STRING</Td> +<Td>The IP address of the Lecroy scope to build a connection with.</Td></Tr> + +<Tr><Td>ChannelName</Td> +<Td>Tango::DEV_STRING</Td> +<Td>The name of channel on which the acquisition will be done. +This name must be composed with two caracters : (a letter followed by a number) +C for a physical channel +F for a calculated waveform +M for a memorised waveform +... +Example : C2 (is the channel 2) +Default : C1 (channel 1</Td></Tr> + +</Table> + +<Br><Br><Br> +<Center><b> +There is no Class properties.<Br><Br> +</Center></b> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<Title> Tango Device Server User's Guide </Title> + <META NAME="GENERATOR" CONTENT="Mozilla/3.01Gold (X11; I; HP-UX B.10.20 9000/735) [Netscape]"> +</HEAD> +<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#FF0000" ALINK="#FF0000"> + +<P><!-------TITLE------></P> + +<Center> +<Br> +<HR WIDTH="100%"></H5> +<H3>(c) SOLEIL : Groupe ICA Contr�le et Acquisitions </H33> +</Center> +</body> +</html> diff --git a/doc/doc_html/TangoDevStates.html b/doc/doc_html/TangoDevStates.html new file mode 100644 index 0000000..f6c7b51 --- /dev/null +++ b/doc/doc_html/TangoDevStates.html @@ -0,0 +1,78 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<Title> Tango Device Server User's Guide </Title> + <META NAME="GENERATOR" CONTENT="Mozilla/3.01Gold (X11; I; HP-UX B.10.20 9000/735) [Netscape]"> +</HEAD> +<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#FF0000" ALINK="#FF0000"> + +<P><!-------TITLE------></P> +<table width="100%" height="20%"><tr> +<td align=LEFT> +<FONT COLOR="#0000FF"><FONT SIZE=+4>Synchrotron </FONT></FONT> +<FONT COLOR="#0000FF"><FONT SIZE=+4>Soleil</FONT></FONT> +<H5>Saint-Aubin - BP 48 91192 GIF-sur-YVETTE CEDEX<BR> +</td><td> +<A href="http://www.synchrotron-soleil.fr/"> +<IMG SRC="http://controle/images/logo-150.gif" + ALT="SOLEIL Logo" ALIGN=RIGHT border="0"></A> +</td></tr></table> + +<HR WIDTH="100%"></H5> + +<Br> +<center> +<h1> +Acquire_Waveform_Lecroy_Prj<Br> +Device States Description +</h1> +<Br> +<b> +Revision: - Author: x.elattaoui +</b> +</center> + + +<Center> +<Br> <Br> <Br> +<Table Border=2 Cellpadding=3 CELLSPACING=0 WIDTH="100%"> +<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> +<Td COLSPAN=2> <Font Size=+2><Center><b>States</b></td></Font></Center> +<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> +<Td><Center><b>Names</b></td></Center> +<Td><Center><b>Descriptions</b></td></Center> +<Tr><Td>OPEN</Td> +<Td>The socket TCP IP is successfully opened between the Lecroy scope and +this DServer.</Td></Tr> + +<Tr><Td>CLOSE</Td> +<Td>The communication between the Lecroy scope and the DServer is closed.</Td></Tr> + +<Tr><Td>FAULT</Td> +<Td>The communication between the Lecroy scope and the DServer is not done.</Td></Tr> + +<Tr><Td>ALARM</Td> +<Td>An error occured during a Write or Read command.</Td></Tr> + + + + +</Table> +</Center> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<Title> Tango Device Server User's Guide </Title> + <META NAME="GENERATOR" CONTENT="Mozilla/3.01Gold (X11; I; HP-UX B.10.20 9000/735) [Netscape]"> +</HEAD> +<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#FF0000" ALINK="#FF0000"> + +<P><!-------TITLE------></P> + +<Center> +<Br> +<HR WIDTH="100%"></H5> +<H3>(c) SOLEIL : Groupe ICA Contr�le et Acquisitions </H33> +</Center> +</body> +</html> diff --git a/doc/doc_html/index.html b/doc/doc_html/index.html new file mode 100644 index 0000000..4030452 --- /dev/null +++ b/doc/doc_html/index.html @@ -0,0 +1,93 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<Title> Tango Device Server User's Guide </Title> + <META NAME="GENERATOR" CONTENT="Mozilla/3.01Gold (X11; I; HP-UX B.10.20 9000/735) [Netscape]"> +</HEAD> +<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#FF0000" ALINK="#FF0000"> + +<P><!-------TITLE------></P> +<table width="100%" height="20%"><tr> +<td align=LEFT> +<FONT COLOR="#0000FF"><FONT SIZE=+4>Synchrotron </FONT></FONT> +<FONT COLOR="#0000FF"><FONT SIZE=+4>Soleil</FONT></FONT> +<H5>Saint-Aubin - BP 48 91192 GIF-sur-YVETTE CEDEX<BR> +</td><td> +<A href="http://www.synchrotron-soleil.fr/"> +<IMG SRC="http://controle/images/logo-150.gif" + ALT="SOLEIL Logo" ALIGN=RIGHT border="0"></A> +</td></tr></table> + +<HR WIDTH="100%"></H5> + +<Br> +<center> +<h1> +Acquire_Waveform_Lecroy_Prj<Br> +Device Server User's Guide +</h1> +<Br> +<b> +Revision: - Author: x.elattaoui +</b> +</center> +<Br> +<Br> +<Br> +<Br> +<Br> +<Br> +<h2>Introduction:</h2> +This class allows the acquisition of a waveform (the description and the data), +from a specific channel and from any Lecroy scope series. +The description is a structure which contains in particular : +the length of the array 1 (the raw data) +the length of the array 2 (2nd part of the calculated waveform data, if any) +the timebase +the total length of the acquired data (lgth array1 + lgth array2) +.... its represents the context of the acquisition. + +NOTE : +for all Lecroy scope, the port number is the same : 1861<Br> +<Br> +<Br> +<h2>Description:</h2> +<ul> + <li> <a href=Description.html> Device description.</a> + <li> <a href=Properties.html> Properties description</a> + <li> <a href=TangoDevStates.html> States description</a> + <li> <a href=DevCommandsFrame.html> Commands description</a> + <li> <a href=Attributes.html> Attributes description</a> +</ul> +<Br> +<Br> +<Br> +<h2>Programmer's guide:</h2> +<ul> + <li> <a href="html/index.html"> Software description.</a> +</ul> +<Br> +<Br> +<Br> +<h2>Conclusion:</h2> +The device server is ready for distribution application programmers.<Br> +The author will be interested inany feedback which arise from their usage of this device server. +<Br> + +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<Title> Tango Device Server User's Guide </Title> + <META NAME="GENERATOR" CONTENT="Mozilla/3.01Gold (X11; I; HP-UX B.10.20 9000/735) [Netscape]"> +</HEAD> +<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#FF0000" ALINK="#FF0000"> + +<P><!-------TITLE------></P> + +<Center> +<Br> +<HR WIDTH="100%"></H5> +<H3>(c) SOLEIL : Groupe ICA Contr�le et Acquisitions </H33> +</Center> +</body> +</html> diff --git a/include/LecroyException.h b/include/LecroyException.h new file mode 100644 index 0000000..4a4c1ee --- /dev/null +++ b/include/LecroyException.h @@ -0,0 +1,179 @@ +#ifndef _LECROYEXCEPTION +#define _LECROYEXCEPTION + +#include <string> +#include <vector> + +namespace lecroy{ + +// ============================================================================ +// lecroy Errors severities +// ============================================================================ +typedef enum { + WARN, + ERR, + PANIC +} ErrorSeverity; + +// ============================================================================ +//! The lecroy exception abstraction base class. +// ============================================================================ +//! +//! detailed description to be written +//! +// ============================================================================ +class Error +{ +public: + + /** + * Initialization. + */ + Error (void); + + /** + * Initialization. + */ + Error (const char *reason, + const char *desc, + const char *origin, + int severity = lecroy::ERR); + + + /** + * Initialization. + */ + Error (const std::string& reason, + const std::string& desc, + const std::string& origin, + int severity = lecroy::ERR); + + /** + * Copy constructor. + */ + Error (const Error& src); + + /** + * Error details: code + */ + virtual ~Error (void); + + /** + * operator= + */ + Error& operator= (const Error& _src); + + /** + * Error details: reason + */ + std::string reason; + + /** + * Error details: description + */ + std::string desc; + + /** + * Error details: origin + */ + std::string origin; + + /** + * Error details: severity + */ + int severity; + +}; + +// ============================================================================ +// The lecroy error list. +// ============================================================================ +typedef std::vector<Error> ErrorList; + + +// ============================================================================ +//! The lecroy exception abstraction base class. +// ============================================================================ +//! +//! detailed description to be written +//! +// ============================================================================ +class LecroyException +{ +public: + + /** + * Initialization. + */ + LecroyException (void); + + /** + * Initialization. + */ + LecroyException (const char *reason, + const char *desc, + const char *origin, + int severity = lecroy::ERR); + + /** + * Initialization. + */ + LecroyException (const std::string& reason, + const std::string& desc, + const std::string& origin, + int severity = lecroy::ERR); + + /** + * Initialization. + */ + LecroyException (const Error& error); + + + /** + * Copy constructor. + */ + LecroyException (const LecroyException& src); + + /** + * operator= + */ + LecroyException& operator= (const LecroyException& _src); + + /** + * Release resources. + */ + virtual ~LecroyException (void); + + /** + * Push the specified error into the errors list. + */ + void push_error (const char *reason, + const char *desc, + const char *origin, + int severity = lecroy::ERR); + + /** + * Push the specified error into the errors list. + */ + void push_error (const std::string& reason, + const std::string& desc, + const std::string& origin, + int severity = lecroy::ERR); + + /** + * Push the specified error into the errors list. + */ + void push_error (const Error& error); + + /** + * The errors list + */ + ErrorList errors; + + +}; + +} // end namspace lecroy +#endif //__LECROYEXCEPTION + + diff --git a/include/SocketException.h b/include/SocketException.h new file mode 100644 index 0000000..c450232 --- /dev/null +++ b/include/SocketException.h @@ -0,0 +1,76 @@ +//****************************************************************************************** +// +// +// september 13, 2004 : Header file for the sockets exceptions in socket mode +// +// with a Lecroy scope (avaiable for all models) +// +// +// author : X.Elattaoui +// +// SocketException.h: interface for the socket exception class. +// +//****************************************************************************************** + +#ifndef _SOCKET_EXCEPTION_H_ +#define _SOCKET_EXCEPTION_H_ + +// ============================================================================ +// DEPENDENCIES +// ============================================================================ +#include "..\include\LecroyException.h" + +namespace lecroy { + +// ============================================================================ +//! Socket exception class. +// ============================================================================ +//! +//! detailed description to be written +//! +// ============================================================================ +class SocketException : public lecroy::LecroyException +{ +public: + + /** + * TODO: remove this constructor + */ + SocketException (void); + + /** + * TODO: remove this constructor + */ + SocketException (const char *reason, + const char *desc, + const char *origin, + int severity = lecroy::ERR); + + /** + * Initialization. + */ + SocketException (const std::string& reason, + const std::string& desc, + const std::string& origin, + int severity = lecroy::ERR); + + /** + * Copy constructor + */ + SocketException(const SocketException& src); + + /** + * Release resources. + */ + virtual ~SocketException (void); + + /** + * operator= + */ + SocketException& operator= (const SocketException& _src); +}; + +} // end namespace + +#endif // _SOCKET_EXCEPTION_H_ + diff --git a/include/SocketLecroy.h b/include/SocketLecroy.h new file mode 100644 index 0000000..0cdab92 --- /dev/null +++ b/include/SocketLecroy.h @@ -0,0 +1,86 @@ +//****************************************************************************************** +// +// +// september 13, 2004 : Header file for the communication in socket mode +// +// with a Lecroy scope (avaiable for all models) +// +// +// author : X.Elattaoui +// +// SocketLecroy.h: interface for the socket class. +// +//****************************************************************************************** + +#ifndef _SocketLecroy_H +#define _SocketLecroy_H + +//- necessary includes +#include <winsock2.h> +#include "..\include\SocketException.h" + + +//////////////////////////////////////////////////////////////////// +// +// SocketLecroy :: DEFINITION +// +//////////////////////////////////////////////////////////////////// + +static int hSocket; +static int sTimeout = 15; +static int sWinsockInitFlag = FALSE; +static char sCurrentAddress[256]; +static int sConnectedFlag = FALSE; + +const int CMD_BUF_LEN = 8192; +static char sCommandBuffer[CMD_BUF_LEN]; + +//- Structure of the command Header +typedef struct +{ + unsigned char bEOI_Flag; + unsigned char reserved[3]; + int iLength; +} TCP_HEADER; + + + + + //- Constants definitions + //----------------------------------------------- +const int SERVER_PORT = 1861; //- It's the same port number for all Lecroy scope's. + +const int EOI_FLAG = 0x01; +const int SRQ_FLAG = 0x08; +const int CLEAR_FLAG = 0x10; +const int LOCKOUT_FLAG = 0x20; +const int REMOTE_FLAG = 0x40; +const int DATA_FLAG = 0x80; + +const int TCP_MINIMUM_PACKET_SIZE = 64; + +class SocketLecroy +{ +private: + + SocketLecroy(); //- just one instance of SocketLecroy must be done for all waveforms of a same Lecroy device + ~SocketLecroy(); + + static SocketLecroy* SL_instance; //- ptr on the SocketLecroy instance + +public: + + + static SocketLecroy* get_instance(void); + static void delete_instance(SocketLecroy*); + + void TCP_WriteDevice (char *buf, int length,BOOL eoi_flag) throw (lecroy::LecroyException); //- send a cmd to the device + void TCP_ReadDevice (char *buf, int length, int* nb_byte_received) throw (lecroy::LecroyException); //- read the device replie + void TCP_Connect (char *ip_address) throw (lecroy::LecroyException); //- build TCP/IP connection + void TCP_Disconnect (void) throw (lecroy::LecroyException); //- disconnect the device + void TCP_ClearDevice (void) throw (lecroy::LecroyException); //- disconnect and reconnect the device + +}; + +#endif // _SocketLecroy_H + diff --git a/include/Waveform.h b/include/Waveform.h new file mode 100644 index 0000000..252290a --- /dev/null +++ b/include/Waveform.h @@ -0,0 +1,120 @@ +//****************************************************************************************** +// +// +// september 16, 2004 : Header file of the WaveForm Class +// +// it contains the waveform raw data, at least there will be scaled +// +// author : X.Elattaoui +// +//****************************************************************************************** + + + +#ifndef _WaveForm_data_H +#define _WaveForm_data_H + +#include <string> +#include "..\include\WaveformException.h" +#include "..\include\Xstring.h" + +const long MAX_WAVEFORM_DATA_LENGTH = 150000; +//- the struct begins at this offset (it can also be 21) +//- NOTE: cannot determinate in what case it's 15 or 21 !!! +const int OFFSET_STRUCT = 15; +//- alignement in memory in bytes ( by default : alignement on 32 bits +#pragma pack(1) + +//- Structure to store the acquired data +typedef struct +{ + char descriptor_name [16]; //- descriptor name (always begin with WAVEDESC string) + char template_name [16]; + short comm_type; //- 0 = BYTE ; 1 = WORD format + short comm_order; //- 0 = HIFIRST ; 1 = LOFIRST +//- Blocks : + long wave_descriptor; //- length (in bytes) of block WAVEDESC + long user_text; //- length (in bytes) of block USERTEXT + long reserved_res_desc1; //- RESERVED +//- Arrays : + long trigtime_array; //- length (in bytes) of TRIGTIME + long ris_time_array; //- length (in bytes) of RIS_TIME + long res_array1; //- RESERVED + long wave_array_1; //- length (in bytes) of 1st simple data array + long wave_array_2; //- length (in bytes) of 2nd simple data array +//- Instrument identification : NOT USED + char reserved_1[48]; //- RESERVED +//- Waveform description and time at which the waveform was generated + long wave_array_count; //- nb of data points in the data array + long points_per_screen; //- nominal number of data points on the screen + long res_first_pnt_val; //- RESERVED + long res_last_pnt_val; //- RESERVED + long first_point; //- indicates the offset relative to the beginning of the trace buffer + char reserved_2[20]; //- RESERVED + float vertical_gain; //- + float vertical_offset; //- to get floating value from raw data : V_gain * data - V_offset + char reserved_3[8]; //- RESERVED + short nominal_bits; //- intrinsic presision + char reserved_4[2]; //-RESERVED + float horizontal_interval; //- sampling interval for time domain waveforms + double horizontal_offset; //- trigger offset for the first sweep of the trigger, seconds between + //- the trigger and the first data point + double pixel_offset; //- needed to know how to display the waveform + char vertical_unit[48]; //- units of the vertical axis + char horizontal_unit[48]; //- units of the horizontal axis + float reserved_5; +//- Trigger infos + double trigger_time_seconds; //- time (in sec) of the trigger + char trigger_time_minutes; //- time (in min) of the trigger + char trigger_time_hours; //- time (in hours) of the trigger + char trigger_time_days; //- day of the trigger + char trigger_time_months; //- month of the trigger + short trigger_time_year; //- year of the trigger + short trigger_time_unused; //- RESERVED + float acq_duration; //- duration of the acquisition (in sec) in multi-trigger waveforms + char reserved_6[30]; //- RESERVED for the moment + //- TODO : timebase, ... till wavesource (from the lecroy doc). + + +} WAVEDESC_BLOCK; + +//- RESTORE DEFAULT ALIGNEMENT +#pragma pack() + +class WaveForm_data +{ +private: + + char *ptrRawData; //- ptr used to receive the waveform data + std::string channel_name; + + //- Waveform data : + short *sh_raw_waveform_data; + double *vertical_scaled_waveform_data; + std::string trigger_time_value; //- time of the trigger in format "Date = month, day, year ; Time = hours:minutes:seconds" + + //- Waveform description : + WAVEDESC_BLOCK *waveBlockData; //- ptr on the struct WAVEDESC_BLOCK + //- the trigger and the first data point +public: + + //- CTOR + WaveForm_data(std::string channel_name); + //- DTOR + ~WaveForm_data(); + + std::string get_channel_name (void) throw (lecroy::LecroyException); + void set_channel_name (std::string); +WAVEDESC_BLOCK *get_wavedesc_descriptor (void) throw (lecroy::LecroyException); + void get_raw_waveform_data (void) throw (lecroy::LecroyException); + short* get_sh_raw_waveform_data (void) throw (lecroy::LecroyException); //- return the ptr on sh_raw_waveform_data + double* get_vertical_scaled_waveform_data (void) throw (lecroy::LecroyException); + std::string get_trigger_time_value (void) throw (lecroy::LecroyException); + + + +}; + + + +#endif //- _WaveForm_data_H diff --git a/include/WaveformException.h b/include/WaveformException.h new file mode 100644 index 0000000..e9d2056 --- /dev/null +++ b/include/WaveformException.h @@ -0,0 +1,75 @@ +//****************************************************************************************** +// +// +// september 13, 2004 : Header file for the waveform exceptions in socket mode +// +// with a Lecroy scope (avaiable for all models) +// +// +// author : X.Elattaoui +// +// WaveformException.h: interface for the socket exception class. +// +//****************************************************************************************** + +#ifndef _WAVEFORM_EXCEPTION_H_ +#define _WAVEFORM_EXCEPTION_H_ + +// ============================================================================ +// DEPENDENCIES +// ============================================================================ +#include "..\include\LecroyException.h" + +namespace lecroy { + +// ============================================================================ +//! Waveform exception class. +// ============================================================================ +//! +//! detailed description to be written +//! +// ============================================================================ +class WaveformException : public lecroy::LecroyException +{ +public: + + /** + * TODO: remove this constructor + */ + WaveformException (void); + + /** + * TODO: remove this constructor + */ + WaveformException (const char *reason, + const char *desc, + const char *origin, + int severity = lecroy::ERR); + + /** + * Initialization. + */ + WaveformException (const std::string& reason, + const std::string& desc, + const std::string& origin, + int severity = lecroy::ERR); + + /** + * Copy constructor + */ + WaveformException(const WaveformException& src); + /** + * Release resources. + */ + virtual ~WaveformException (void); + + /** + * operator= + */ + WaveformException& operator= (const WaveformException& _src); +}; + +} // end namespace + +#endif // _WAVEFORM_EXCEPTION_H_ + diff --git a/include/Xstring.h b/include/Xstring.h new file mode 100644 index 0000000..48f96b8 --- /dev/null +++ b/include/Xstring.h @@ -0,0 +1,31 @@ +#ifndef XSTRING_H +#define XSTRING_H + +#include <sstream> +#include <string> + +template<class T> class XString{ + +public: + + inline static T convertFromString(const std::string& s) + { + std::istringstream in(s); + T x; + if (in >> x) + return x; + // some sort of error handling goes here... + return 0; + } +// + inline static std::string convertToString(const T & t) + { + std::ostringstream out ; + if (out << t ) + return out.str(); + // some sort of error handling goes here... + return 0; + } + +}; +#endif diff --git a/src/AcquireWaveformLecroy.cpp b/src/AcquireWaveformLecroy.cpp new file mode 100644 index 0000000..b83dbfc --- /dev/null +++ b/src/AcquireWaveformLecroy.cpp @@ -0,0 +1,566 @@ +static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentation/AcquireWaveformLecroy/src/AcquireWaveformLecroy.cpp,v 1.1.1.1 2004-09-29 15:42:14 syldup Exp $"; +//+============================================================================= +// +// file : AcquireWaveformLecroy.cpp +// +// description : C++ source for the AcquireWaveformLecroy 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 +// AcquireWaveformLecroy are implemented in this file. +// +// project : TANGO Device Server +// +// $Author: syldup $ +// +// $Revision: 1.1.1.1 $ +// +// $Log: not supported by cvs2svn $ +// +// copyleft : Synchrotron SOLEIL +// L'Orme des Merisiers +// Saint-Aubin - BP 48 + +// +//-============================================================================= +// +// This file is generated by POGO +// (Program Obviously used to Generate tango Object) +// +// (c) - Software Engineering Group - ESRF +//============================================================================= + + +//=================================================================== +// +// The folowing table gives the correspondance +// between commands and method's name. +// +// Command's name | Method's name +// ---------------------------------------- +// State | dev_state() +// Status | dev_status() +// +//=================================================================== + +#include <tango.h> +#include <AcquireWaveformLecroy.h> + +namespace AcquireWaveformLecroy +{ + +//+---------------------------------------------------------------------------- +// +// method : AcquireWaveformLecroy::AcquireWaveformLecroy(string &s) +// +// description : constructor for simulated AcquireWaveformLecroy +// +// in : - cl : Pointer to the DeviceClass object +// - s : Device name +// +//----------------------------------------------------------------------------- +AcquireWaveformLecroy::AcquireWaveformLecroy(Tango::DeviceClass *cl,string &s):Tango::Device_2Impl(cl,s.c_str()) +{ + init_device(); +} + +AcquireWaveformLecroy::AcquireWaveformLecroy(Tango::DeviceClass *cl,const char *s):Tango::Device_2Impl(cl,s) +{ + init_device(); +} + +AcquireWaveformLecroy::AcquireWaveformLecroy(Tango::DeviceClass *cl,const char *s,const char *d) +:Tango::Device_2Impl(cl,s,d) +{ + init_device(); +} +//+---------------------------------------------------------------------------- +// +// method : AcquireWaveformLecroy::delete_device() +// +// description : will be called at device destruction or at init command. +// +//----------------------------------------------------------------------------- +void AcquireWaveformLecroy::delete_device() +{ + //- Delete device's allocated object + if (attr_rawWaveformData_read) { + delete [] attr_rawWaveformData_read; + attr_rawWaveformData_read = 0; + } + if (attr_verticalScaledData_read) { + delete [] attr_verticalScaledData_read; + attr_verticalScaledData_read = 0; + } + if (attr_waveArray1_read) { + delete attr_waveArray1_read; + attr_waveArray1_read = 0; + } + if (attr_waveArrayCount_read) { + delete attr_waveArrayCount_read; + attr_waveArrayCount_read = 0; + } + if (attr_nominalBits_read) { + delete attr_nominalBits_read; + attr_nominalBits_read = 0; + } + if (attr_horizontalInterval_read) { + delete attr_horizontalInterval_read; + attr_horizontalInterval_read = 0; + } + if (attr_horizontalOffset_read) { + delete attr_horizontalOffset_read; + attr_horizontalOffset_read = 0; + } + if (attr_verticalGain_read) { + delete attr_verticalGain_read; + attr_verticalGain_read = 0; + } + if (attr_verticalOffset_read) { + delete attr_verticalOffset_read; + attr_verticalOffset_read = 0; + } + if (attr_triggerTime_read) { + delete attr_triggerTime_read; + attr_triggerTime_read = 0; + } + + //- close the socket + ptr_com->TCP_Disconnect(); + + //- delete the SocketLecroy obj + SocketLecroy::delete_instance(ptr_com); + + //- delete the Waveform_Data obj + delete waveform_ptr; +} + +//+---------------------------------------------------------------------------- +// +// method : AcquireWaveformLecroy::init_device() +// +// description : will be called at device initialization. +// +//----------------------------------------------------------------------------- +void AcquireWaveformLecroy::init_device() +{ + INFO_STREAM << "AcquireWaveformLecroy::AcquireWaveformLecroy() create device " << device_name << endl; + + //- create read attributes + //-------------------------------------------- + attr_rawWaveformData_read = new Tango::DevShort[MAX_SIZE]; + *attr_rawWaveformData_read = 0; + + attr_verticalScaledData_read = new Tango::DevDouble[MAX_SIZE]; + *attr_verticalScaledData_read = 0; + + attr_waveArray1_read = new Tango::DevLong; + *attr_waveArray1_read = 0; + + attr_waveArrayCount_read = new Tango::DevLong; + *attr_waveArrayCount_read = 0; + + attr_nominalBits_read = new Tango::DevShort; + *attr_nominalBits_read = 0; + + attr_horizontalInterval_read = new Tango::DevDouble; + *attr_horizontalInterval_read = 0; + + attr_horizontalOffset_read = new Tango::DevDouble; + *attr_horizontalOffset_read = 0; + + attr_verticalGain_read = new Tango::DevDouble; + *attr_verticalGain_read = 0; + + attr_verticalOffset_read = new Tango::DevDouble; + *attr_verticalOffset_read = 0; + + attr_triggerTime_read = new Tango::DevString; + *attr_triggerTime_read = new char[MAX_STRING_LENGTH]; + ::memset(*attr_triggerTime_read, 0, MAX_STRING_LENGTH * sizeof(char)); + + //- Initialise variables to default values + //-------------------------------------------- + data_value=0; + ptr_com = 0; + + get_device_property(); + + //- create the com obj + ptr_com = SocketLecroy::get_instance(); + + //- init communication + try + { + ptr_com->TCP_Connect( (char*)iPaddress.c_str() ); + set_state(Tango::OPEN); + set_status("The communication is OK."); + } + catch(const lecroy::SocketException & se) + { + set_state(Tango::FAULT); + set_status("The communication is not well opened."); + Tango::DevFailed df = lecroy_to_tango_exception(se); + + Tango::Except::re_throw_exception(df, + (const char*) "TCP_CONNECTION_FAILED", + (const char*) "Cannot built a socket connection.", + (const char*) "AcquireWaveformLecroy::init_device()", + Tango::PANIC + ); + } + + //- create the waveform obj + try + { + waveform_ptr = new WaveForm_data(channelName); + set_state(Tango::ON); + set_status("Ready to acquire waveform."); + } + catch(const lecroy::WaveformException &we) + { + set_state(Tango::ALARM); + set_status("Not ready to acquire waveform."); + Tango::DevFailed df = lecroy_to_tango_exception(we); + + Tango::Except::re_throw_exception(df, + (const char*) "OUT_OF_MEMORY", + (const char*) "Cannot built a waveform objet.", + (const char*) "AcquireWaveformLecroy::init_device()", + Tango::PANIC + ); + } +} + + +//+---------------------------------------------------------------------------- +// +// method : AcquireWaveformLecroy::readDeviceProperies() +// +// description : Read the device properties from database. +// +//----------------------------------------------------------------------------- +void AcquireWaveformLecroy::get_device_property() +{ + //- Initialize your default values here. + //------------------------------------------ + iPaddress = "172.16.35.1"; + channelName = "C2"; + + //- Read device properties from database.(Automatic code generation) + //------------------------------------------------------------- + Tango::DbData data; + data.push_back(Tango::DbDatum("IPaddress")); + data.push_back(Tango::DbDatum("ChannelName")); + + // Call database and extract values + //-------------------------------------------- + get_db_device()->get_property(data); + if (data[0].is_empty()==false) data[0] >> iPaddress; + if (data[1].is_empty()==false) data[1] >> channelName; + + + //- End of Automatic code generation + //------------------------------------------------------------- + + Tango::DbData data_put; + if (data[0].is_empty()==true) + { + Tango::DbDatum property("IPaddress"); + property << iPaddress; + data_put.push_back(property); + } + if (data[1].is_empty()==true) + { + Tango::DbDatum property("ChannelName"); + property << channelName; + data_put.push_back(property); + } + + get_db_device()->put_property(data_put); + +} +//+---------------------------------------------------------------------------- +// +// method : AcquireWaveformLecroy::always_executed_hook() +// +// description : method always executed before any command is executed +// +//----------------------------------------------------------------------------- +void AcquireWaveformLecroy::always_executed_hook() +{ + + //- Get the waveform data and description( ADC resolution, horizontal and vertical infos, data length ...) + try + { + waveform_ptr->get_raw_waveform_data(); + set_state(Tango::ON); + set_status("Waveform data acquired."); + } + catch(const lecroy::WaveformException &we) + { + set_state(Tango::ALARM); + set_status("Failed to acquire waveform."); + Tango::DevFailed df = lecroy_to_tango_exception(we); + + Tango::Except::re_throw_exception(df, + (const char*) "GET_DATA_FAILED", + (const char*) "Cannot call get_raw_waveform_data.", + (const char*) "AcquireWaveformLecroy::always_executed_hook()", + Tango::ERR + ); + } + +} + +//+---------------------------------------------------------------------------- +// +// method : AcquireWaveformLecroy::read_attr_hardware() +// +// description : Hardware acquisition for attributes. +// +//----------------------------------------------------------------------------- +void AcquireWaveformLecroy::read_attr_hardware(vector<long> &attr_list) +{ + DEBUG_STREAM << "In read_attr_hardware for " << attr_list.size(); + DEBUG_STREAM << " attribute(s)" << endl; + + long data_length = 0; + + + //- get the waveform length + try + { + data_length = waveform_ptr->get_wavedesc_descriptor()->wave_array_count; + data_value = waveform_ptr->get_sh_raw_waveform_data(); + data_scaled_value = waveform_ptr->get_vertical_scaled_waveform_data(); + } + catch(const lecroy::WaveformException &we) + { + set_state(Tango::ALARM); + set_status("Cannot acquire the waveform data."); + Tango::DevFailed df = lecroy_to_tango_exception(we); + + Tango::Except::re_throw_exception(df, + (const char*) "GET_FAILED", + (const char*) "Cannot acquire the total length of the waveform data.", + (const char*) "AcquireWaveformLecroy::read_attr_hardware()", + Tango::ERR + ); + } + //- Add your own code here + //--------------------------------- + for (int i=0; i< attr_list.size(); i++) + { + string attr_name = dev_attr->get_attr_by_ind(attr_list[i]).get_name(); + + if (attr_name == "rawWaveformData") + { + for( long j = 0 ; j < data_length ; j++) + { + attr_rawWaveformData_read[j] = data_value[j]; + } + // TODO delete data_value; + } + if (attr_name == "verticalScaledData") + { + for( long j = 0 ; j < data_length ; j++) + { + attr_verticalScaledData_read[j] = data_scaled_value[j]; + } + // TODO delete data_value; + } + if (attr_name == "waveArray1") + { + *attr_waveArray1_read = waveform_ptr->get_wavedesc_descriptor()->wave_array_1; + } + if (attr_name == "waveArrayCount") + { + *attr_waveArrayCount_read = data_length; + } + if (attr_name == "nominalBits") + { + *attr_nominalBits_read = waveform_ptr->get_wavedesc_descriptor()->nominal_bits; + } + if (attr_name == "horizontalInterval") + { + *attr_horizontalInterval_read = (double) (waveform_ptr->get_wavedesc_descriptor()->horizontal_interval); + } + if (attr_name == "horizontalOffset") + { + *attr_horizontalOffset_read = waveform_ptr->get_wavedesc_descriptor()->horizontal_offset; + } + if (attr_name == "verticalGain") + { + *attr_verticalGain_read = (double) (waveform_ptr->get_wavedesc_descriptor()->vertical_gain); + } + if (attr_name == "verticalOffset") + { + *attr_verticalOffset_read = waveform_ptr->get_wavedesc_descriptor()->vertical_offset; + } + if (attr_name == "triggerTime") + { + std::string response = waveform_ptr->get_trigger_time_value(); + strcpy(*attr_triggerTime_read, response.c_str()); + } + + } +} + +//+---------------------------------------------------------------------------- +// +// method : AcquireWaveformLecroy::read_attr() +// +// description : Extract real attribute values from +// hardware acquisition result. +// +//----------------------------------------------------------------------------- +void AcquireWaveformLecroy::read_attr(Tango::Attribute &attr) +{ + string &attr_name = attr.get_name(); + + DEBUG_STREAM << "In read_attr for attribute " << attr_name << endl; + + // Switch on attribute name + //--------------------------------- + if (attr_name == "rawWaveformData") + { + try + { + //- Add your own code here + long data_length = waveform_ptr->get_wavedesc_descriptor()->wave_array_count; + attr.set_value(attr_rawWaveformData_read, data_length); + } + catch(const lecroy::WaveformException &we) + { + set_state(Tango::ALARM); + set_status("Cannot acquire the descriptor on the WAVEDESC_BLOC structure."); + Tango::DevFailed df = lecroy_to_tango_exception(we); + + Tango::Except::re_throw_exception(df, + (const char*) "GET_FAILED", + (const char*) "Failed to get the raw data.", + (const char*) "AcquireWaveformLecroy::read_attr_hardware()", + Tango::ERR + ); + } + } + else + if (attr_name == "waveArray1") + { + //- Add your own code here + attr.set_value(attr_waveArray1_read); + } + else + if (attr_name == "waveArrayCount") + { + //- Add your own code here + attr.set_value(attr_waveArrayCount_read); + } + else + if (attr_name == "nominalBits") + { + //- Add your own code here + attr.set_value(attr_nominalBits_read); + } + else + if (attr_name == "horizontalInterval") + { + //- Add your own code here + attr.set_value(attr_horizontalInterval_read); + } + else + if (attr_name == "horizontalOffset") + { + //- Add your own code here + attr.set_value(attr_horizontalOffset_read); + } + else + if (attr_name == "verticalGain") + { + //- Add your own code here + attr.set_value(attr_verticalGain_read); + } + else + if (attr_name == "verticalOffset") + { + //- Add your own code here + attr.set_value(attr_verticalOffset_read); + } + else + if (attr_name == "triggerTime") + { + // Add your own code here + attr.set_value(attr_triggerTime_read); + } + else + if (attr_name == "verticalScaledData") + { + // Add your own code here + try + { + //- Add your own code here + long data_length = waveform_ptr->get_wavedesc_descriptor()->wave_array_count; + attr.set_value(attr_verticalScaledData_read, data_length); + } + catch(const lecroy::WaveformException &we) + { + set_state(Tango::ALARM); + set_status("Cannot acquire the descriptor on the WAVEDESC_BLOC structure."); + Tango::DevFailed df = lecroy_to_tango_exception(we); + + Tango::Except::re_throw_exception(df, + (const char*) "GET_FAILED", + (const char*) "Failed to get the scaled data.", + (const char*) "AcquireWaveformLecroy::read_attr_hardware()", + Tango::ERR + ); + } + } + +} + +//+---------------------------------------------------------------------------- +// +// method : AcquireWaveformLecroy::lecroy_to_tango_exception() +// +// description : Extract real attribute values from +// hardware acquisition result. +// +//----------------------------------------------------------------------------- +Tango::DevFailed AcquireWaveformLecroy::lecroy_to_tango_exception(const lecroy::LecroyException& de) +{ + + Tango::DevErrorList error_list(de.errors.size()); + error_list.length(de.errors.size()); + + for(int i = 0; i < de.errors.size(); i++) + { + error_list[i].reason = CORBA::string_dup(de.errors[i].reason.c_str()); + error_list[i].desc = CORBA::string_dup(de.errors[i].desc.c_str()); + error_list[i].origin = CORBA::string_dup(de.errors[i].origin.c_str()); + + switch(de.errors[i].severity) + { + case lecroy::WARN: + error_list[i].severity = Tango::WARN; + break; + + case lecroy::PANIC: + error_list[i].severity = Tango::PANIC; + break; + + case lecroy::ERR: + + default: + error_list[i].severity = Tango::ERR; + break; + } + + } + + return Tango::DevFailed(error_list); + +} + +} // namespace diff --git a/src/AcquireWaveformLecroy.h b/src/AcquireWaveformLecroy.h new file mode 100644 index 0000000..6daa00a --- /dev/null +++ b/src/AcquireWaveformLecroy.h @@ -0,0 +1,217 @@ +//============================================================================= +// +// file : AcquireWaveformLecroy.h +// +// description : Include for the AcquireWaveformLecroy class. +// +// project : Acquire_Waveform_Lecroy_Prj +// +// $Author: syldup $ +// +// $Revision: 1.1.1.1 $ +// +// $Log: not supported by cvs2svn $ +// +// copyleft : Synchrotron SOLEIL +// L'Orme des Merisiers +// Saint-Aubin - BP 48 + +// +//============================================================================= +// +// This file is generated by POGO +// (Program Obviously used to Generate tango Object) +// +// (c) - Software Engineering Group - ESRF +//============================================================================= +#ifndef _ACQUIREWAVEFORMLECROY_H +#define _ACQUIREWAVEFORMLECROY_H + +#include <tango.h> +//using namespace Tango; +#include "..\include\SocketLecroy.h" +#include "..\include\SocketException.h" +#include "..\include\Waveform.h" +#include "..\include\WaveformException.h" + +/** + * @author $Author: syldup $ + * @version $Revision: 1.1.1.1 $ $ + */ + + // Add your own constants definitions here. + //----------------------------------------------- +const int MAX_STRING_LENGTH = 256; +const int MAX_SIZE = 150000; + + +namespace AcquireWaveformLecroy +{ + +/** + * Class Description: + * This class allows the acquisition of a waveform (the description and the data), + * from a specific channel and from any Lecroy scope series. + * The description is a structure which contains in particular : + * the length of the array 1 (the raw data) + * the length of the array 2 (2nd part of the calculated waveform data, if any) + * the timebase + * the total length of the acquired data (lgth array1 + lgth array2) + * .... its represents the context of the acquisition. + * + * NOTE : + * for all Lecroy scope, the port number is the same : 1861 + */ + +/* + * Device States Description: + * Tango::OPEN : The socket TCP IP is successfully opened between the Lecroy scope and + * this DServer. + * Tango::CLOSE : The communication between the Lecroy scope and the DServer is closed. + * Tango::FAULT : The communication between the Lecroy scope and the DServer is not done. + * Tango::ALARM : An error occured during a Write or Read command. + */ + + +class AcquireWaveformLecroy: public Tango::Device_2Impl +{ +public : + // Add your own data members here + //----------------------------------------- + + + // Here is the Start of the automatic code generation part + //------------------------------------------------------------- +/** + * @name attributes + * Attributs member data. + */ +//@{ + Tango::DevShort *attr_rawWaveformData_read; + Tango::DevDouble *attr_verticalScaledData_read; + Tango::DevLong *attr_waveArray1_read; + Tango::DevLong *attr_waveArrayCount_read; + Tango::DevShort *attr_nominalBits_read; + Tango::DevDouble *attr_horizontalInterval_read; + Tango::DevDouble *attr_horizontalOffset_read; + Tango::DevDouble *attr_verticalGain_read; + Tango::DevDouble *attr_verticalOffset_read; + Tango::DevString *attr_triggerTime_read; +//@} + +/** + * @name Device properties + * Device properties member data. + */ +//@{ +/** + * The IP address of the Lecroy scope to build a connection with. + */ + string iPaddress; +/** + * The name of channel on which the acquisition will be done. + * This name must be composed with two caracters : (a letter followed by a number) + * C for a physical channel + * F for a calculated waveform + * M for a memorised waveform + * ... + * Example : C2 (is the channel 2) + * Default : C1 (channel 1 + */ + string channelName; +//@} + +/**@name Constructors + * Miscellaneous constructors */ +//@{ +/** + * Constructs a newly allocated Command object. + * + * @param cl Class. + * @param s Device Name + */ + AcquireWaveformLecroy(Tango::DeviceClass *,string &); +/** + * Constructs a newly allocated Command object. + * + * @param cl Class. + * @param s Device Name + */ + AcquireWaveformLecroy(Tango::DeviceClass *,const char *); +/** + * Constructs a newly allocated Command object. + * + * @param cl Class. + * @param s Device name + * @param d Device description. + */ + AcquireWaveformLecroy(Tango::DeviceClass *,const char *,const char *); +//@} + +/**@name Destructor + * Only one desctructor is defined for this class */ +//@{ +/** + * The object desctructor. + */ + ~AcquireWaveformLecroy() { delete_device(); }; +/** + * will be called at device destruction or at init command. + */ + void delete_device(); +//@} + + +/**@name Miscellaneous methods */ +//@{ +/** + * Initialize the device + */ + virtual void init_device(); +/** + * Always executed method befor execution command method. + */ + virtual void always_executed_hook(); + +//@} + +/** + * @name AcquireWaveformLecroy methods prototypes + */ + +//@{ +/** + * Hardware acquisition for attributes. + */ + virtual void read_attr_hardware(vector<long> &attr_list); +/** + * Extract real attribute values from hardware acquisition result. + */ + virtual void read_attr(Tango::Attribute &attr); + +/** + * Read the device properties from database + */ + void get_device_property(); +//@} + + // Here is the end of the automatic code generation part + //------------------------------------------------------------- + + + +protected : + // Add your own data members here + //----------------------------------------- + SocketLecroy *ptr_com; + WaveForm_data *waveform_ptr; + short* data_value; + double* data_scaled_value; + + //- Method to convert all lecroy exceptions (type Waveform or Socket exceptions) on Tango exception + Tango::DevFailed lecroy_to_tango_exception(const lecroy::LecroyException& de); +}; + +} // namespace + +#endif // _ACQUIREWAVEFORMLECROY_H diff --git a/src/AcquireWaveformLecroyClass.cpp b/src/AcquireWaveformLecroyClass.cpp new file mode 100644 index 0000000..7d72e07 --- /dev/null +++ b/src/AcquireWaveformLecroyClass.cpp @@ -0,0 +1,298 @@ +static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentation/AcquireWaveformLecroy/src/AcquireWaveformLecroyClass.cpp,v 1.1.1.1 2004-09-29 15:42:14 syldup Exp $"; +//+============================================================================= +// +// file : AcquireWaveformLecroyClass.cpp +// +// description : C++ source for the AcquireWaveformLecroyClass. A singleton +// class derived from DeviceClass. It implements the +// command list and all properties and methods required +// by the AcquireWaveformLecroy once per process. +// +// project : TANGO Device Server +// +// $Author: syldup $ +// +// $Revision: 1.1.1.1 $ +// +// $Log: not supported by cvs2svn $ +// +// copyleft : Synchrotron SOLEIL +// L'Orme des Merisiers +// Saint-Aubin - BP 48/ +//-============================================================================= +// +// This file is generated by POGO +// (Program Obviously used to Generate tango Object) +// +// (c) - Software Engineering Group - ESRF +//============================================================================= + + +#include <tango.h> + +#include <AcquireWaveformLecroy.h> +#include <AcquireWaveformLecroyClass.h> + + +namespace AcquireWaveformLecroy +{ + + + +// +//---------------------------------------------------------------- +// Initialize pointer for singleton pattern +//---------------------------------------------------------------- +// +AcquireWaveformLecroyClass *AcquireWaveformLecroyClass::_instance = NULL; + +//+---------------------------------------------------------------------------- +// +// method : AcquireWaveformLecroyClass::AcquireWaveformLecroyClass(string &s) +// +// description : constructor for the AcquireWaveformLecroyClass +// +// in : - s : The class name +// +//----------------------------------------------------------------------------- +AcquireWaveformLecroyClass::AcquireWaveformLecroyClass(string &s):DeviceClass(s) +{ + + cout2 << "Entering AcquireWaveformLecroyClass constructor" << endl; + write_class_property(); + + cout2 << "Leaving AcquireWaveformLecroyClass constructor" << endl; + +} +//+---------------------------------------------------------------------------- +// +// method : AcquireWaveformLecroyClass::~AcquireWaveformLecroyClass() +// +// description : destructor for the AcquireWaveformLecroyClass +// +//----------------------------------------------------------------------------- +AcquireWaveformLecroyClass::~AcquireWaveformLecroyClass() +{ + _instance = NULL; +} + +//+---------------------------------------------------------------------------- +// +// method : AcquireWaveformLecroyClass::instance +// +// description : Create the object if not already done. Otherwise, just +// return a pointer to the object +// +// in : - name : The class name +// +//----------------------------------------------------------------------------- +AcquireWaveformLecroyClass *AcquireWaveformLecroyClass::init(const char *name) +{ + if (_instance == NULL) + { + try + { + string s(name); + _instance = new AcquireWaveformLecroyClass(s); + } + catch (bad_alloc) + { + throw; + } + } + return _instance; +} + +AcquireWaveformLecroyClass *AcquireWaveformLecroyClass::instance() +{ + if (_instance == NULL) + { + cerr << "Class is not initialised !!" << endl; + exit(-1); + } + return _instance; +} + +//+---------------------------------------------------------------------------- +// +// method : AcquireWaveformLecroyClass::command_factory +// +// description : Create the command object(s) and store them in the +// command list +// +//----------------------------------------------------------------------------- +void AcquireWaveformLecroyClass::command_factory() +{ + + // add polling if any + for (unsigned int i=0 ; i<command_list.size(); i++) + { + } +} + +//+---------------------------------------------------------------------------- +// +// method : AcquireWaveformLecroyClass::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 AcquireWaveformLecroyClass::device_factory(const Tango::DevVarStringArray *devlist_ptr) +{ + + for (long i=0 ; i < devlist_ptr->length() ; i++) + { + cout4 << "Device name : " << (*devlist_ptr)[i].in() << endl; + + // Create device and add it into the device list + //---------------------------------------------------- + device_list.push_back(new AcquireWaveformLecroy(this, (*devlist_ptr)[i])); + + // Export device to the outside world + // Check before id database used. + //--------------------------------------------- + if (Tango::Util::_UseDb == true) + export_device(device_list.back()); + else + export_device(device_list.back(), (*devlist_ptr)[i]); + } +} +//+---------------------------------------------------------------------------- +// Method: AcquireWaveformLecroyClass::attribute_factory(vector<Tango::Attr *> &att_list) +//----------------------------------------------------------------------------- +void AcquireWaveformLecroyClass::attribute_factory(vector<Tango::Attr *> &att_list) +{ + // Attribute : rawWaveformData + Tango::SpectrumAttr *raw_waveform_data = + new Tango::SpectrumAttr("rawWaveformData", Tango::DEV_SHORT, 150000); + Tango::UserDefaultAttrProp raw_waveform_data_prop; + raw_waveform_data_prop.set_label("Raw Waveform Data"); + raw_waveform_data_prop.set_unit("data"); + raw_waveform_data_prop.set_description("Gets the raw waveform data.\nMaximum size : 150000 data"); + raw_waveform_data->set_default_properties(raw_waveform_data_prop); + att_list.push_back(raw_waveform_data); + + // Attribute : verticalScaledData + Tango::SpectrumAttr *vertical_scaled_data = + new Tango::SpectrumAttr("verticalScaledData", Tango::DEV_DOUBLE, 150000); + Tango::UserDefaultAttrProp vertical_scaled_data_prop; + vertical_scaled_data_prop.set_label("Vertical Scaled Data"); + vertical_scaled_data_prop.set_description("Gets the scaled waveform data.\nMaximum size : 150000 data"); + vertical_scaled_data->set_default_properties(vertical_scaled_data_prop); + att_list.push_back(vertical_scaled_data); + + // Attribute : waveArray1 + Tango::Attr *wave_array1 = + new Tango::Attr("waveArray1", Tango::DEV_LONG, Tango::READ); + Tango::UserDefaultAttrProp wave_array1_prop; + wave_array1_prop.set_label("Wave Array 1"); + wave_array1_prop.set_unit("data"); + wave_array1_prop.set_description("Length of the first array.\nThis first array contains data of simples\nwaveforms."); + wave_array1->set_default_properties(wave_array1_prop); + att_list.push_back(wave_array1); + + // Attribute : waveArrayCount + Tango::Attr *wave_array_count = + new Tango::Attr("waveArrayCount", Tango::DEV_LONG, Tango::READ); + Tango::UserDefaultAttrProp wave_array_count_prop; + wave_array_count_prop.set_label("Wave Array Count"); + wave_array_count_prop.set_unit("data"); + wave_array_count_prop.set_description("Length of the two arrays.\nIf the length of wavearray1 is different of this\nlength that's means data are present in the\narray wavearray2. Which is used for complex\ndata as math operations on a waveform."); + wave_array_count->set_default_properties(wave_array_count_prop); + att_list.push_back(wave_array_count); + + // Attribute : nominalBits + Tango::Attr *nominal_bits = + new Tango::Attr("nominalBits", Tango::DEV_SHORT, Tango::READ); + Tango::UserDefaultAttrProp nominal_bits_prop; + nominal_bits_prop.set_label("Nominal Bits"); + nominal_bits_prop.set_description("ADC resolution.\nFor simple data this ADC is an 8 bits resolution\nelse it's can be 10 up to 12 bits"); + nominal_bits->set_default_properties(nominal_bits_prop); + att_list.push_back(nominal_bits); + + // Attribute : horizontalInterval + Tango::Attr *horizontal_interval = + new Tango::Attr("horizontalInterval", Tango::DEV_DOUBLE, Tango::READ); + Tango::UserDefaultAttrProp horizontal_interval_prop; + horizontal_interval_prop.set_label("Horizontal Interval"); + horizontal_interval_prop.set_description("Sampling interval for time domain waveforms\nNeeded to scale the waveform data stored\nin the rawWaveformData attribute."); + horizontal_interval->set_default_properties(horizontal_interval_prop); + att_list.push_back(horizontal_interval); + + // Attribute : horizontalOffset + Tango::Attr *horizontal_offset = + new Tango::Attr("horizontalOffset", Tango::DEV_DOUBLE, Tango::READ); + Tango::UserDefaultAttrProp horizontal_offset_prop; + horizontal_offset_prop.set_label("Horizontal Offset"); + horizontal_offset_prop.set_description("Trigger offset for the first sweep of the trigger,\nseconds between the trigger and the first \ndata point.\nNeeded to scale the waveform data stored\nin the rawWaveformData attribute."); + horizontal_offset->set_default_properties(horizontal_offset_prop); + att_list.push_back(horizontal_offset); + + // Attribute : verticalGain + Tango::Attr *vertical_gain = + new Tango::Attr("verticalGain", Tango::DEV_DOUBLE, Tango::READ); + Tango::UserDefaultAttrProp vertical_gain_prop; + vertical_gain_prop.set_label("Vertical Gain"); + vertical_gain_prop.set_description("The vertical gain.\nUsed to scale the waveform data stored in\n the rawWaveformData attribute."); + vertical_gain->set_default_properties(vertical_gain_prop); + att_list.push_back(vertical_gain); + + // Attribute : verticalOffset + Tango::Attr *vertical_offset = + new Tango::Attr("verticalOffset", Tango::DEV_DOUBLE, Tango::READ); + Tango::UserDefaultAttrProp vertical_offset_prop; + vertical_offset_prop.set_label("Vertical Offset"); + vertical_offset_prop.set_description("Needed to scale the waveform data stored\nin the rawWaveformData attribute."); + vertical_offset->set_default_properties(vertical_offset_prop); + att_list.push_back(vertical_offset); + + // Attribute : triggerTime + Tango::Attr *trigger_time = + new Tango::Attr("triggerTime", Tango::DEV_STRING, Tango::READ); + Tango::UserDefaultAttrProp trigger_time_prop; + trigger_time_prop.set_label("Trigger Time"); + trigger_time->set_default_properties(trigger_time_prop); + att_list.push_back(trigger_time); + +} +//+---------------------------------------------------------------------------- +// +// method : AcquireWaveformLecroyClass::write_class_property +// +// description : Set class description as property in database +// +//----------------------------------------------------------------------------- +void AcquireWaveformLecroyClass::write_class_property() +{ + // First time, check if database used + //-------------------------------------------- + if (Tango::Util::_UseDb == false) + return; + + // Prepeare DbDatum + //-------------------------------------------- + Tango::DbDatum title("ProjectTitle"); + string str_title("Acquire_Waveform_Lecroy_Prj"); + title << str_title; + + Tango::DbDatum description("Description"); + string str_desc("This class allows the acquisition of a waveform (the description and the data),\n\ +from a specific channel and from any Lecroy scope series.\n\ +The description is a structure which contains in particular :\n\ +the length of the array 1 (the raw data)\n\ +th"); + description << str_desc; + + Tango::DbData data; + data.push_back(title); + data.push_back(description); + + // Call database and and values + //-------------------------------------------- + get_db_class()->put_property(data); +} + +} // namespace diff --git a/src/AcquireWaveformLecroyClass.h b/src/AcquireWaveformLecroyClass.h new file mode 100644 index 0000000..cf18a07 --- /dev/null +++ b/src/AcquireWaveformLecroyClass.h @@ -0,0 +1,74 @@ +//============================================================================= +// +// file : AcquireWaveformLecroyClass.h +// +// description : Include for the AcquireWaveformLecroyClass root class. +// This class is represents the singleton class for +// the AcquireWaveformLecroy device class. +// It contains all properties and methods which the +// AcquireWaveformLecroy requires only once e.g. the commands. +// +// project : TANGO Device Server +// +// $Author: syldup $ +// +// $Revision: 1.1.1.1 $ +// +// $Log: not supported by cvs2svn $ +// +// copyleft : Synchrotron SOLEIL +// L'Orme des Merisiers +// Saint-Aubin - BP 48 +//============================================================================= +// +// This file is generated by POGO +// (Program Obviously used to Generate tango Object) +// +// (c) - Software Engineering Group - ESRF +//============================================================================= + +#ifndef _ACQUIREWAVEFORMLECROYCLASS_H +#define _ACQUIREWAVEFORMLECROYCLASS_H + +#include <tango.h> + + +namespace AcquireWaveformLecroy +{ +// +// Define classes for commands +// + +// +// The AcquireWaveformLecroyClass singleton definition +// + +class AcquireWaveformLecroyClass : public Tango::DeviceClass +{ +public: + +// add your own data members here +//------------------------------------ + +public: + +// Method prototypes + static AcquireWaveformLecroyClass *init(const char *); + static AcquireWaveformLecroyClass *instance(); + ~AcquireWaveformLecroyClass(); + +protected: + AcquireWaveformLecroyClass(string &); + static AcquireWaveformLecroyClass *_instance; + void command_factory(); + void attribute_factory(vector<Tango::Attr *> &); + void write_class_property(); + +private: + void device_factory(const Tango::DevVarStringArray *); +}; + + +} // namespace AcquireWaveformLecroy + +#endif // _ACQUIREWAVEFORMLECROYCLASS_H diff --git a/src/ClassFactory.cpp b/src/ClassFactory.cpp new file mode 100644 index 0000000..d53002c --- /dev/null +++ b/src/ClassFactory.cpp @@ -0,0 +1,47 @@ +static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentation/AcquireWaveformLecroy/src/ClassFactory.cpp,v 1.1.1.1 2004-09-29 15:42:14 syldup Exp $"; +//+============================================================================= +// +// file : ClassFactory.cpp +// +// description : C++ source for the class_factory method of the DServer +// device class. This method is responsible to create +// all class singletin for a device server. It is called +// at device server startup +// +// project : TANGO Device Server +// +// $Author: syldup $ +// +// $Revision: 1.1.1.1 $ +// +// $Log: not supported by cvs2svn $ +// +// copyleft : Synchrotron SOLEIL +// L'Orme des Merisiers +// Saint-Aubin - BP 48 +// +//-============================================================================= +// +// This file is generated by POGO +// (Program Obviously used to Generate tango Object) +// +// (c) - Software Engineering Group - ESRF +//============================================================================= + + +#include <tango.h> +#include <AcquireWaveformLecroyClass.h> + +/** + * Create AcquireWaveformLecroyClass singleton and store it in DServer object. + * + * @author $Author: syldup $ + * @version $Revision: 1.1.1.1 $ $ + */ + +void Tango::DServer::class_factory() +{ + + add_class(AcquireWaveformLecroy::AcquireWaveformLecroyClass::init("AcquireWaveformLecroy")); + +} diff --git a/src/Doxyfile b/src/Doxyfile new file mode 100644 index 0000000..f35150b --- /dev/null +++ b/src/Doxyfile @@ -0,0 +1,831 @@ +# Doxyfile 1.2.10 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# General configuration options +#--------------------------------------------------------------------------- + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = "Acquire_Waveform_Lecroy_Prj" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = D:\MyDeviceServer\Lecroy_DServer\src/doc_html + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Brazilian, Chinese, Croatian, Czech, Danish, Dutch, Finnish, French, +# German, Hungarian, Italian, Japanese, Korean, Norwegian, Polish, +# Portuguese, Romanian, Russian, Slovak, Slovene, Spanish and Swedish. + +OUTPUT_LANGUAGE = English + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = YES + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these class will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = NO + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. It is allowed to use relative paths in the argument list. + +STRIP_FROM_PATH = + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a class diagram (in Html and LaTeX) for classes with base or +# super classes. Setting the tag to NO turns the diagrams off. + +CLASS_DIAGRAMS = YES + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower case letters. If set to YES upper case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# users are adviced to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like the Qt-style comments (thus requiring an +# explict @brief command for a brief description. + +JAVADOC_AUTOBRIEF = YES + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# reimplements. + +INHERIT_DOCS = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consist of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. +# For instance some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. + +WARN_FORMAT = + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = D:\MyDeviceServer\Lecroy_DServer\src + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +FILE_PATTERNS = *.h *.cpp + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. + +EXCLUDE_PATTERNS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command <filter> <input-file>, where <filter> +# is the value of the INPUT_FILTER tag, and <input-file> is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. + +INPUT_FILTER = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse. + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = /segfs/tango/templates/pogo/html/header.html + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = /segfs/tango/templates/pogo/html/footer.html + +# The HTML_STYLESHEET tag can be used to specify a user defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the Html help documentation and to the tree view. + +TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript and frames is required (for instance Netscape 4.0+ +# or Internet explorer 4.0+). + +GENERATE_TREEVIEW = YES + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = YES + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimised for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = YES + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assigments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_XML = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_PREDEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES tag can be used to specify one or more tagfiles. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_WIDTH = 1024 + +# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_HEIGHT = 1024 + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermedate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO + +# The CGI_NAME tag should be the name of the CGI script that +# starts the search engine (doxysearch) with the correct parameters. +# A script with this name will be generated by doxygen. + +CGI_NAME = + +# The CGI_URL tag should be the absolute URL to the directory where the +# cgi binaries are located. See the documentation of your http daemon for +# details. + +CGI_URL = + +# The DOC_URL tag should be the absolute URL to the directory where the +# documentation is located. If left blank the absolute path to the +# documentation, with file:// prepended to it, will be used. + +DOC_URL = + +# The DOC_ABSPATH tag should be the absolute path to the directory where the +# documentation is located. If left blank the directory on the local machine +# will be used. + +DOC_ABSPATH = + +# The BIN_ABSPATH tag must point to the directory where the doxysearch binary +# is installed. + +BIN_ABSPATH = + +# The EXT_DOC_PATHS tag can be used to specify one or more paths to +# documentation generated for other projects. This allows doxysearch to search +# the documentation for these projects as well. + +EXT_DOC_PATHS = diff --git a/src/LecroyException.cpp b/src/LecroyException.cpp new file mode 100644 index 0000000..577e8d2 --- /dev/null +++ b/src/LecroyException.cpp @@ -0,0 +1,207 @@ +//****************************************************************************************** +// +// +// september 13, 2004 : Source file for the communication exceptions in socket mode +// +// with a Lecroy scope (avaiable for all models) +// +// +// author : X.Elattaoui +// +// LecroyException.cpp: interface for the socket & waveform exceptions class. +// +//****************************************************************************************** + +// ============================================================================ +// DEPENDENCIES +#include "..\include\LecroyException.h" + +namespace lecroy { + +// ============================================================================ +// Error::Error +// ============================================================================ +Error::Error (void) + : reason ("unknown"), + desc ("unknown error"), + origin ("unknown"), + severity (lecroy::ERR) +{ + +} + +// ============================================================================ +// Error::Error +// ============================================================================ +Error::Error (const char *_reason, + const char *_desc, + const char *_origin, + int _severity) + : reason (_reason), + desc (_desc), + origin (_origin), + severity (_severity) +{ + +} + +// ============================================================================ +// Error::Error +// ============================================================================ +Error::Error (const std::string& _reason, + const std::string& _desc, + const std::string& _origin, + int _severity) + : reason (_reason), + desc (_desc), + origin (_origin), + severity (_severity) +{ + +} + +// ============================================================================ +// Error::Error +// ============================================================================ +Error::Error (const Error& _src) + : reason (_src.reason), + desc (_src.desc), + origin (_src.origin), + severity (_src.severity) +{ + +} + +// ============================================================================ +// Error::~Error +// ============================================================================ +Error::~Error (void) +{ + +} + +// ============================================================================ +// Error::operator= +// ============================================================================ +Error& Error::operator= (const Error& _src) +{ + //- no self assign + if (this == &_src) { + return *this; + } + + this->reason = _src.reason; + this->desc = _src.desc; + this->origin = _src.origin; + this->severity = _src.severity; + + return *this; +} + +// ============================================================================ +// LecroyException::LecroyException +// ============================================================================ +LecroyException::LecroyException (void) + : errors(0) +{ + this->push_error(Error()); +} + +// ============================================================================ +// LecroyException::LecroyException +// ============================================================================ +LecroyException::LecroyException (const char *_reason, + const char *_desc, + const char *_origin, + int _severity) + : errors(0) +{ + + this->push_error(Error(_reason, _desc, _origin, _severity)); +} + +// ============================================================================ +// LecroyException::LecroyException +// ============================================================================ +LecroyException::LecroyException (const std::string& _reason, + const std::string& _desc, + const std::string& _origin, + int _severity) + : errors(0) +{ + this->push_error(_reason, _desc, _origin,_severity); +} + +// ============================================================================ +// LecroyException::LecroyException +// ============================================================================ +LecroyException::LecroyException (const LecroyException& _src) + : errors(0) +{ + for (unsigned int i = 0; i < _src.errors.size(); i++) { + this->push_error(_src.errors[i]); + } +} + +// ============================================================================ +// LecroyException::LecroyException +// ============================================================================ +LecroyException& LecroyException::operator= (const LecroyException& _src) +{ + //- no self assign + if (this == &_src) { + return *this; + } + + this->errors.clear(); + + for (unsigned int i = 0; i < _src.errors.size(); i++) { + this->push_error(_src.errors[i]); + } + + return *this; +} + +// ============================================================================ +// LecroyException::~LecroyException +// ============================================================================ +LecroyException::~LecroyException (void) +{ + this->errors.clear(); +} + + +// ============================================================================ +// LecroyException::push_error +// ============================================================================ +void LecroyException::push_error (const char *_reason, + const char *_desc, + const char *_origin, + int _severity) +{ + this->errors.push_back(Error(_reason, _desc, _origin, _severity)); +} + +// ============================================================================ +// LecroyException::push_error +// ============================================================================ +void LecroyException::push_error (const std::string& _reason, + const std::string& _desc, + const std::string& _origin, + int _severity) +{ + this->errors.push_back(Error(_reason, _desc, _origin, _severity)); +} + +// ============================================================================ +// LecroyException::push_error +// ============================================================================ +void LecroyException::push_error (const Error& _error) +{ + this->errors.push_back(_error); +} + + +} // namespace lecroy + + diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..0a3a35c --- /dev/null +++ b/src/Makefile @@ -0,0 +1,91 @@ +#============================================================================= +# +# file : Makefile.h +# +# description : Include for the AcquireWaveformLecroy class. +# +# project : Makefile to generate a Tango server +# +# $Author: syldup $ +# +# $Revision: 1.1.1.1 $ +# +# $Log: not supported by cvs2svn $ +# +# 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 +#============================================================================= +# + +ifdef _solaris +CC = CC +BIN_DIR = solaris7_CC +endif + +ifdef linux +CC = c++ +AR = ar +BIN_DIR = suse72 +endif + +TANGO_HOME = /segfs/tango +INCLUDE_DIRS = -I$(TANGO_HOME)/include/$(BIN_DIR) -I. +LIB_DIRS = -L $(TANGO_HOME)/lib/$(BIN_DIR) + +ifdef _solaris +CXXFLAGS = -mt -D_PTHREADS $(INCLUDE_DIRS) +LFLAGS = -g $(LIB_DIRS) \ + -ltango \ + -llog4tango \ + -lomniORB4 \ + -lomniDynamic4 \ + -lomnithread \ + -lpthread \ + -lposix4 -lsocket -lnsl +endif + +ifdef linux +CXXFLAGS = -g -D_REENTRANT $(INCLUDE_DIRS) +LFLAGS = -g $(LIB_DIRS) \ + -ltango \ + -llog4tango \ + -lomniORB4 \ + -lomniDynamic4 \ + -lomnithread \ + -ldl -lpthread +endif + + + + +CLASS = AcquireWaveformLecroy + +SVC_OBJS = main.o \ + ClassFactory.o \ + $(CLASS)Class.o \ + $(CLASS).o + +SVC_INC = $(CLASS)Class.h \ + $(CLASS).h + + +%.o: %.cpp $(SVC_INC) + $(CC) $(CXXFLAGS) -c $< + +all: $(CLASS) + +$(CLASS): $(SVC_OBJS) + $(CC) $(SVC_OBJS) -o $(CLASS) $(LFLAGS) + +clean: + rm -f *.o $(CLASS) core + +install: + cp $(CLASS) $(TANGO_HOME)/bin/$(BIN_DIR) diff --git a/src/Makefile.VC b/src/Makefile.VC new file mode 100644 index 0000000..5a9b0f9 --- /dev/null +++ b/src/Makefile.VC @@ -0,0 +1,55 @@ +# +device_server= AcquireWaveformLecroy +# +# Des includes particuliers +# Mettre /Ic:\monchemininclude /:\monautrechemininclude +INCUSER= /I..include\SocketLecroy.h/I..include\Waveform.h/I..include\LecroyException.h/I..include\SocketException.h/I..include\WaveformException.h/I..include\Xstring.h +# +# et vos Librairies +# style +# +# LIBUSER = "x:\moncheminlibrairie\malibrairie.lib" +LIBUSER= + +# +# ------------------Fin des modifications pour le end user ------------------------------------- +# +make_dir=$(SOLEIL_ROOT)\env\ + + +# Les d�finitions communes � tous les DeviceServeurs +!include $(make_dir)\tango.opt + +exe_device_server= $(EXEDIR)\ds_$(device_server).exe +pdb_name= $(TEMPLIBDIR)\$(device_server).pdb + +# -------------------------------------- +# Partie sp�cifique Device Server +# -------------------------------------- + +LISTEOBJ = \ + $(OBJDIR)\LecroyException.OBJ\ + $(OBJDIR)\SocketLecroy.OBJ\ + $(OBJDIR)\Waveform.OBJ\ + $(OBJDIR)\SocketException.OBJ\ + $(OBJDIR)\WaveformException.OBJ\ + $(OBJDIR)\$(device_server).OBJ\ + $(OBJDIR)\ClassFactory.OBJ\ + $(OBJDIR)\main.OBJ\ + $(OBJDIR)\$(device_server)Class.OBJ + +SRCS = \ + $(device_server).CPP\ + LecroyException.CPP\ + SocketLecroy.CPP\ + SocketException.CPP\ + Waveform.CPP\ + WaveformException.CPP\ + ClassFactory.CPP\ + main.CPP \ + $(device_server)Class.CPP + + +# -------------------------------------- +!include $(make_dir)\common_target.opt + diff --git a/src/README b/src/README new file mode 100644 index 0000000..4be1188 --- /dev/null +++ b/src/README @@ -0,0 +1,40 @@ +//-============================================================ +// +// This class has been generated by POGO +// (Program Obviously used to Generate tango Object) +// +// (c) - Software Engineering Group - ESRF +//============================================================= + + +Files generated: +=============== +AcquireWaveformLecroy.cpp: Source code for the AcquireWaveformLecroy class and its commands. + This class is derived from DeviceImpl_2 class. + It represents the CORBA servant obbject which + will be accessed from the network. + All commands which can be executed on the + AcquireWaveformLecroy are implemented in this file. + +AcquireWaveformLecroy.h: Include for the AcquireWaveformLecroy class. + Server class prototypes and descriptions. + +AcquireWaveformLecroyClass.cpp: A singleton class derived fromAcquireWaveformLecroy. + It implements the command list and all properties + and methods required by the AcquireWaveformLecroy once per process + +AcquireWaveformLecroyClass.h: Include for the AcquireWaveformLecroyClass root class. + This class is represents the singleton class for + the AcquireWaveformLecroy device class. + It contains all properties and methods which the + AcquireWaveformLecroy requires only once e.g. the commands. + +main.cpp: 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. + +ClassFactory.cpp: C++ source for the class_factory method of the DServer + device class. This method is responsible to create + all class singletin for a device server. It is called + at device server startup diff --git a/src/SocketException.cpp b/src/SocketException.cpp new file mode 100644 index 0000000..7abb279 --- /dev/null +++ b/src/SocketException.cpp @@ -0,0 +1,85 @@ +//****************************************************************************************** +// +// +// september 13, 2004 : Source file for the socket exceptions in socket mode +// +// with a Lecroy scope (avaiable for all models) +// +// +// author : X.Elattaoui +// +// SocketException.cpp: interface for the socket exception class. +// +//****************************************************************************************** + +// ============================================================================ +// DEPENDENCIES +// ============================================================================ +#include "..\include\SocketException.h" + + +namespace lecroy { + +// ============================================================================ +// SocketException::SocketException +// ============================================================================ +SocketException::SocketException (void) + : LecroyException() +{ + +} + +// ============================================================================ +// SocketException::SocketException +// ============================================================================ +SocketException::SocketException (const char *_reason, + const char *_desc, + const char *_origin, + int _severity) + : LecroyException(_reason, _desc, _origin, _severity) +{ + +} + +// ============================================================================ +// SocketException::SocketException +// ============================================================================ +SocketException::SocketException (const std::string& _reason, + const std::string& _desc, + const std::string& _origin, + int _severity) + : LecroyException(_reason, _desc, _origin, _severity) +{ + +} + +// ============================================================================ +// SocketException::SocketException +// ============================================================================ +SocketException::SocketException (const SocketException& _src) + : LecroyException(_src) +{ + +} + +// ============================================================================ +// SocketException::~SocketException +// ============================================================================ +SocketException::~SocketException (void) +{ + +} + +// ============================================================================ +// SocketException::SocketException +// ============================================================================ +SocketException& SocketException::operator= (const SocketException& _src) +{ + LecroyException::operator=(_src); + return *this; +} + + +} // namespace lecroy + + diff --git a/src/SocketLecroy.cpp b/src/SocketLecroy.cpp new file mode 100644 index 0000000..ffd9ab5 --- /dev/null +++ b/src/SocketLecroy.cpp @@ -0,0 +1,329 @@ +//****************************************************************************************** +// +// +// september 13, 2004 : Source file for the communication in socket mode +// +// with a Lecroy scope (avaiable for all models) +// +// author : X.Elattaoui +// +// SocketLecroy.cpp: implementation of the SocketLecroy class. +// +//****************************************************************************************** + + +//- INCLUDE +#include "..\include\SocketLecroy.h" + +//- init of the static instance +SocketLecroy* SocketLecroy::SL_instance = 0; //- ptr on the SocketLecroy instance + +SocketLecroy* SocketLecroy::get_instance() +{ + if(SL_instance==0) + SL_instance = new SocketLecroy(); + + return SL_instance; + +} + +void SocketLecroy::delete_instance(SocketLecroy* SL_instance) +{ + if(SL_instance!=0) + { + delete SL_instance ; + SL_instance = 0; + } + +} + +//- CTOR +SocketLecroy::SocketLecroy() +{ +sConnectedFlag=false; + +} +//- DTOR +SocketLecroy::~SocketLecroy() +{ + TCP_Disconnect(); + +} + + + +//- Build the connection +void SocketLecroy::TCP_Connect(char *ip_address) throw (lecroy::LecroyException) +{ + +SOCKADDR_IN serverAddr; +int sockAddrSize = sizeof (SOCKADDR), result; +WORD wVersionRequested; +WSADATA wsaData; +const int resp = 1; +fd_set wr_set = {1, {0}}; +TIMEVAL tval; +unsigned long argp; +char* tmpStr = 0; + + + //- connection test + if (sConnectedFlag==TRUE) + return; + + strcpy(sCurrentAddress, ip_address); + + tval.tv_sec = sTimeout; + tval.tv_usec = 0; + + //- build server socket address + serverAddr.sin_family = AF_INET; + serverAddr.sin_port = htons (SERVER_PORT); + + if ((serverAddr.sin_addr.s_addr = inet_addr(ip_address)) == -1) + { + throw lecroy::SocketException("COMMUNICATION_BROKEN ", + "Bad server address.", + "SocketLecroy::TCP_Connect( )."); + } + + //- create client's socket + if ((hSocket = socket(AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) + { + throw lecroy::SocketException("COMMUNICATION_BROKEN ", + "Unable to create client's socket.", + "SocketLecroy::TCP_Connect( )."); + } + + if (setsockopt(hSocket, IPPROTO_TCP, TCP_NODELAY, (char*)&resp, sizeof(resp)) != 0) + { + throw lecroy::SocketException("COMMUNICATION_BROKEN ", + "Unable to set socket option to TCP_NODELAY.", + "SocketLecroy::TCP_Connect( )."); + } + + wr_set.fd_array[0] = hSocket; + + argp = 1;//-non blocking mode + ioctlsocket(hSocket, FIONBIO, &argp); + + connect(hSocket, (SOCKADDR FAR *) &serverAddr, sockAddrSize); + + result = select(hSocket, NULL, &wr_set, NULL, &tval); + + argp = 0;//-blocking mode + ioctlsocket(hSocket, FIONBIO, &argp); + + //- connect to server (scope) + if (result < 1) + { + sprintf(tmpStr, "Unable to make connection to IP:%s", ip_address); + throw lecroy::SocketException("COMMUNICATION_BROKEN ", + tmpStr, + "SocketLecroy::TCP_Connect( )."); + } + + sConnectedFlag = TRUE; +} + + +//- DisconnectFromScope: disconnect from a network device +void SocketLecroy::TCP_Disconnect(void) +{ + + if (sConnectedFlag == TRUE) + { + + closesocket(hSocket); + sConnectedFlag = FALSE; + } + +} + +//- Clear a connection +void SocketLecroy::TCP_ClearDevice(void) throw (lecroy::LecroyException) +{ + + if (sConnectedFlag != TRUE) + throw lecroy::SocketException("COMMUNICATION_BROKEN", + "Disconnection already done.", + "SocketLecroy::TCP_ClearDevice( )."); + + TCP_Disconnect(); + TCP_Connect(sCurrentAddress); + +} + +//- Send commands to the remote device +void SocketLecroy::TCP_WriteDevice(char *buf, int len, BOOL eoi_flag) throw (lecroy::LecroyException) +{ + +TCP_HEADER header; +int result, bytes_more, bytes_xferd; +char *idxPtr; + + //- test connection + if (sConnectedFlag != TRUE) + throw lecroy::SocketException("COMMUNICATION_BROKEN ", + "Device not connected.", + "SocketLecroy::TCP_WriteDevice( )."); + + if (len < CMD_BUF_LEN) + strcpy(sCommandBuffer, buf); + + //- set the header info + header.bEOI_Flag = DATA_FLAG; + header.bEOI_Flag |= (eoi_flag)? EOI_FLAG:0; + header.reserved[0] = 1; + header.reserved[1] = 0; + header.reserved[2] = 0; + header.iLength = htonl(len); + + + //- write the header first + if (send(hSocket, (char *) &header, sizeof(TCP_HEADER), 0) != sizeof(TCP_HEADER)) + { + throw lecroy::SocketException("COMMUNICATION_BROKEN ", + "Unable to send header info to the server.", + "SocketLecroy::TCP_WriteDevice( )."); + } + + bytes_more = len; + idxPtr = buf; + bytes_xferd = 0; + while (1) + { + //- then write the rest of the block + idxPtr = buf + bytes_xferd; + + if ((result = send(hSocket, (char *) idxPtr, bytes_more, 0)) < 0) + { + throw lecroy::SocketException("COMMUNICATION_BROKEN ", + "Unable to send data to the server.", + "SocketLecroy::TCP_WriteDevice( )."); + } + + bytes_xferd += result; + bytes_more -= result; + if (bytes_more <= 0) + break; + } + +} + +//- Read the device answer +void SocketLecroy::TCP_ReadDevice(char *buf, int len, int *recv_count) throw (lecroy::LecroyException) +{ + +TCP_HEADER header; +int result, accum, space_left, bytes_more, buf_count; +char tmpStr[256]; +char *idxPtr; +fd_set rd_set = {1, {0}}; +TIMEVAL tval; + + //- test connection + if (sConnectedFlag != TRUE) + throw lecroy::SocketException("COMMUNICATION_BROKEN ", + "Device not connected.", + "SocketLecroy::TCP_ReadDevice( )."); + + *recv_count = 0; + + if (buf==NULL) + throw lecroy::SocketException("COMMUNICATION_BROKEN ", + "Buffer memory not allocated.", + "SocketLecroy::TCP_ReadDevice( )."); + + rd_set.fd_array[0] = hSocket; + tval.tv_sec = sTimeout; + tval.tv_usec = 0; + + memset(buf, 0, len); + buf_count = 0; + space_left = len; + + while (1) + { + result = select(hSocket, &rd_set, NULL, NULL, &tval); + if (result < 1) + { + TCP_ClearDevice(); + throw lecroy::SocketException("COMMUNICATION_BROKEN ", + "Read Timeout.", + "SocketLecroy::TCP_ReadDevice( )."); + } + //- get the header info first + accum = 0; + while (1) + { + memset(&header, 0, sizeof(TCP_HEADER)); + + if ((result = recv(hSocket, (char *) &header + accum, sizeof(header) - accum, 0)) < 0) + { + TCP_ClearDevice(); + throw lecroy::SocketException("COMMUNICATION_BROKEN ", + "Unable to receive header info from the server.", + "SocketLecroy::TCP_ReadDevice( )."); + } + + accum += result; + if (accum>=sizeof(header)) + break; + } + + header.iLength = ntohl(header.iLength); +// if (header.iLength < 1) +// return 0; + + //- only read to len amount + if (header.iLength > space_left) + { + header.iLength = space_left; + throw lecroy::SocketException("COMMUNICATION_BROKEN ", + "Read buffer size is too small.", + "SocketLecroy::TCP_ReadDevice( )."); + } + + //- read the rest of the block + accum = 0; + while (1) + { + idxPtr = buf + (buf_count + accum); + bytes_more = header.iLength - accum; + if ((space_left-accum) < TCP_MINIMUM_PACKET_SIZE) + { + TCP_ClearDevice(); + sprintf(tmpStr, "Read buffer needs to be adjusted, must be minimum of %d bytes", TCP_MINIMUM_PACKET_SIZE); + throw lecroy::SocketException("COMMUNICATION_BROKEN ", + tmpStr, + "SocketLecroy::TCP_ReadDevice( )."); + } + + if ((result = recv(hSocket, (char *) idxPtr, (bytes_more>2048)?2048:bytes_more, 0)) < 0) + { + TCP_ClearDevice(); + //-MessageBox(0, "Unable to receive data from the server.", "ERROR", MB_OK); + throw lecroy::SocketException("COMMUNICATION_BROKEN ", + "Unable to receive data from the server", + "SocketLecroy::TCP_ReadDevice( )."); + } + + accum += result; + if (accum >= header.iLength) + break; + if ((accum + buf_count) >= len) + break; + } + buf_count += accum; + space_left -= accum; + + if (header.bEOI_Flag & EOI_FLAG) + break; + if (space_left <= 0) + break; + } + + *recv_count = buf_count; +} + diff --git a/src/Waveform.cpp b/src/Waveform.cpp new file mode 100644 index 0000000..b136c32 --- /dev/null +++ b/src/Waveform.cpp @@ -0,0 +1,265 @@ +//****************************************************************************************** +// +// +// september 16, 2004 : Source file of the WaveForm Class +// +// it contains the waveform raw data, at least there will be scaled +// +// author : X.Elattaoui +// +//****************************************************************************************** + + + +//- INCLUDE +#include "..\include\Waveform.h" +#include "..\include\SocketLecroy.h" +#include <iostream> + +using namespace std; + +//- CTOR +WaveForm_data::WaveForm_data(std::string ch_name) +{ + //- initialisation of all Waveform attributes + channel_name = ch_name; + sh_raw_waveform_data = NULL; + vertical_scaled_waveform_data = NULL; + trigger_time_value = "Not avaiable"; + ptrRawData = new char[MAX_WAVEFORM_DATA_LENGTH]; + ptrRawData = 0; +} +//- DTOR +WaveForm_data::~WaveForm_data() +{ + if(ptrRawData) + + { + delete [] ptrRawData; + ptrRawData = 0; + } + if(sh_raw_waveform_data) + { + delete [] sh_raw_waveform_data; + sh_raw_waveform_data = 0; + } + if(vertical_scaled_waveform_data) + { + delete [] vertical_scaled_waveform_data; + vertical_scaled_waveform_data = 0; + } + +} + +//- Method to return the channel name +std::string WaveForm_data::get_channel_name( ) throw (lecroy::LecroyException) +{ + std::string error = " channel_name is not initialized !"; + + if(channel_name != "") + return channel_name; + else + throw lecroy::WaveformException("DESCRIPTOR_MEMORY_ ", + "get_channel_name( ) failed : channel_name is not initialized.", + "WaveForm_data::get_channel_name( )."); +} +//- Method to set the channel name +void WaveForm_data::set_channel_name (std::string name) +{ + if(name != "") + channel_name = name; +} + +//- Method to return the ptr on the WAVEDESC struct +WAVEDESC_BLOCK* WaveForm_data::get_wavedesc_descriptor( ) throw (lecroy::WaveformException) +{ + if(waveBlockData) + return waveBlockData; + else + throw lecroy::WaveformException("DESCRIPTOR_MEMORY_ ", + "get_raw_waveform_data( ) method must be called before.", + "WaveForm_data::get_wavedesc_descriptor( )."); + +} + +//- Method to return the raw data of the acquired waveform +void WaveForm_data::get_raw_waveform_data( ) throw (lecroy::LecroyException) +{ +short error = -1; +char* cmdStr; +int ulTrace_Size = 0; +string cmd = ""; +int response_length=0; + + //- init ptr WaveBlocData which point on WAVEDESC_BLOCS structure + waveBlockData = 0; + + //- get channel name + string ch_name ; + + ch_name = get_channel_name(); + //- prepare the cmd to get the waveform data + cmd = ch_name + ":WF? ALL"; + cmdStr = new char[cmd.size()+1]; + strcpy(cmdStr, cmd.c_str()); + int length = strlen(cmdStr); + + //- send the request + SocketLecroy::get_instance( )->TCP_WriteDevice(cmdStr,length,true); + + //- first desallocate previous data + if (ptrRawData) + { + try + { + delete [] ptrRawData; + ptrRawData = 0; + } + catch(const lecroy::WaveformException &) + { + throw lecroy::WaveformException("MEMORY_DESALLOCATION", + "The pointer (ptrRawData) for the receive data can't be desallocated before the read operation.", + "WaveForm_data::get_raw_waveform_data( )."); + } + } + + //- delete previous raw data + if(sh_raw_waveform_data) + { + try + { + delete [] sh_raw_waveform_data; + sh_raw_waveform_data = 0; + } + catch(const lecroy::WaveformException &) + { + throw lecroy::WaveformException("MEMORY_DESALLOCATION", + "The pointer (sh_raw_waveform_data) for the receive data can't be desallocated before the read operation.", + "WaveForm_data::get_raw_waveform_data( )."); + } + } + + //- delete previous scaled data + if(vertical_scaled_waveform_data) + { + try + { + delete [] vertical_scaled_waveform_data; + vertical_scaled_waveform_data = 0; + } + catch(const lecroy::WaveformException &) + { + throw lecroy::WaveformException("MEMORY_DESALLOCATION", + "The pointer (vertical_scaled_waveform_data) for the receive data can't be desallocated before the read operation.", + "WaveForm_data::get_raw_waveform_data( )."); + } + } + + //- allocate memory for the receive data (WaveDesc + data) + ptrRawData = new char[MAX_WAVEFORM_DATA_LENGTH]; + length = MAX_WAVEFORM_DATA_LENGTH; + if(!ptrRawData) + throw lecroy::WaveformException("OUT_OF_MEMORY", + "The pointer (ptrRawData) for the receive data can't be allocated before the read operation.", + "WaveForm_data::get_raw_waveform_data( )."); + //- read the response + try + { + SocketLecroy::get_instance( )->TCP_ReadDevice(ptrRawData,length,&response_length); + } + catch(const lecroy::SocketException &) + { + throw; + } + + //- update the struct WAVEDESC_BLOC + waveBlockData = (WAVEDESC_BLOCK*) (ptrRawData+OFFSET_STRUCT); + if(!waveBlockData) + throw lecroy::WaveformException("OUT_OF_MEMORY", + "The pointer for the receive data can't be allocated before the read operation.", + "WaveForm_data::get_raw_waveform_data( )."); + + //- allocate memory for the raw data + sh_raw_waveform_data = new short[waveBlockData->wave_array_count]; + if(!sh_raw_waveform_data) + throw lecroy::WaveformException("OUT_OF_MEMORY", + "The pointer for the receive data can't be allocated before the read operation.", + "WaveForm_data::get_raw_waveform_data( )."); + + //- allocate memory for the vertical scaled data + vertical_scaled_waveform_data = new double[waveBlockData->wave_array_count]; + if(!vertical_scaled_waveform_data) + throw lecroy::WaveformException("OUT_OF_MEMORY", + "The pointer for the scaled data can't be allocated before the read operation.", + "WaveForm_data::get_raw_waveform_data( )."); + + //- copy the data before sending them + for(long i=0; i<waveBlockData->wave_array_count ; i++) + { + sh_raw_waveform_data[i] = (ptrRawData + OFFSET_STRUCT + waveBlockData->wave_descriptor)[i]; + //- Found in the "Remote Control Manual" + vertical_scaled_waveform_data[i] = (waveBlockData->vertical_gain * sh_raw_waveform_data[i]) - waveBlockData->vertical_offset; + } + +} + +//- return the ptr on sh_raw_waveform_data ( = the waveform data acquired) +short* WaveForm_data::get_sh_raw_waveform_data () throw (lecroy::LecroyException) +{ + if(sh_raw_waveform_data) + return sh_raw_waveform_data; + else + throw lecroy::WaveformException("DESCRIPTOR_MEMORY_ ", + "get_raw_waveform_data( ) method must be called before.", + "WaveForm_data::get_sh_raw_waveform_data( )."); + +} + + +//- Method to return the scaled data of the acquired waveform +double* WaveForm_data::get_vertical_scaled_waveform_data( ) throw (lecroy::LecroyException) +{ + + if(vertical_scaled_waveform_data) + return vertical_scaled_waveform_data; + else + throw lecroy::WaveformException("DESCRIPTOR_MEMORY_ ", + "get_raw_waveform_data( ) method must be called before.", + "WaveForm_data::get_vertical_scaled_waveform_data( )."); +} + +//- Method to return the trigger time of the acquired waveform +std::string WaveForm_data::get_trigger_time_value ( ) throw (lecroy::LecroyException) +{ + + //- The format is : "Date = month, day, year ; Time = hours:minutes:seconds" + std::string str_seconds; + std::string str_minutes; + std::string str_hours; + std::string str_days; + std::string str_months; + std::string str_years; + + //- hours, min, sec with 2 digits + str_seconds = XString<double>::convertToString(waveBlockData->trigger_time_seconds); + if(waveBlockData->trigger_time_seconds<10) + str_seconds = "0" + str_seconds; + + str_minutes = XString<int>::convertToString((int)waveBlockData->trigger_time_minutes); + if(waveBlockData->trigger_time_minutes<10) + str_minutes = "0" + str_minutes; + + str_hours = XString<int>::convertToString(waveBlockData->trigger_time_hours); + if(waveBlockData->trigger_time_hours<10) + str_hours = "0" + str_hours; + + str_days = XString<int>::convertToString(waveBlockData->trigger_time_days); + str_months = XString<int>::convertToString(waveBlockData->trigger_time_months); + str_years = XString<short>::convertToString(waveBlockData->trigger_time_year); + + //- Construct the string Trigger Time: + trigger_time_value = "Date = " + str_months + "/" + str_days + "/" + str_years + " ; Time = " + str_hours + ":" + str_minutes + ":" + str_seconds; + + return trigger_time_value; +} + diff --git a/src/WaveformException.cpp b/src/WaveformException.cpp new file mode 100644 index 0000000..2bae498 --- /dev/null +++ b/src/WaveformException.cpp @@ -0,0 +1,85 @@ +//****************************************************************************************** +// +// +// september 13, 2004 : Source file for the waveforms exceptions in socket mode +// +// with a Lecroy scope (avaiable for all models) +// +// +// author : X.Elattaoui +// +// WaveformException.cpp: interface for the waveform exception class. +// +//****************************************************************************************** + +// ============================================================================ +// DEPENDENCIES +// ============================================================================ +#include "..\include\WaveformException.h" + + +namespace lecroy { + +// ============================================================================ +// WaveformException::WaveformException +// ============================================================================ +WaveformException::WaveformException (void) + : LecroyException() +{ + +} + +// ============================================================================ +// WaveformException::WaveformException +// ============================================================================ +WaveformException::WaveformException (const char *_reason, + const char *_desc, + const char *_origin, + int _severity) + : LecroyException(_reason, _desc, _origin, _severity) +{ + +} + +// ============================================================================ +// WaveformException::WaveformException +// ============================================================================ +WaveformException::WaveformException (const std::string& _reason, + const std::string& _desc, + const std::string& _origin, + int _severity) + : LecroyException(_reason, _desc, _origin, _severity) +{ + +} + +// ============================================================================ +// WaveformException::WaveformException +// ============================================================================ +WaveformException::WaveformException (const WaveformException& _src) + : LecroyException(_src) +{ + +} + +// ============================================================================ +// WaveformException::~WaveformException +// ============================================================================ +WaveformException::~WaveformException (void) +{ + +} + +// ============================================================================ +// WaveformException::WaveformException +// ============================================================================ +WaveformException& WaveformException::operator= (const WaveformException& _src) +{ + LecroyException::operator=(_src); + return *this; +} + + +} // namespace lecroy + + diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..cc6a47e --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,74 @@ +static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentation/AcquireWaveformLecroy/src/main.cpp,v 1.1.1.1 2004-09-29 15:42:14 syldup Exp $"; +//+============================================================================= +// +// 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: syldup $ +// +// $Revision: 1.1.1.1 $ $ +// +// $Log: not supported by cvs2svn $ +// +// copyleft : Synchrotron SOLEIL +// L'Orme des Merisiers +// Saint-Aubin - BP 48 +// +//-============================================================================= +// +// This file is generated by POGO +// (Program Obviously used to Generate tango Object) +// +// (c) - Software Engineering Group - ESRF +//============================================================================= + +#include <tango.h> + + +int main(int argc,char *argv[]) +{ + + Tango::Util *tg; + try + { + // Initialise the device server + //---------------------------------------- + tg = Tango::Util::init(argc,argv); + + tg->set_serial_model(Tango::BY_CLASS); + + // 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; + } + + // clean ORB, threads..... + //-------------------------- + tg->server_cleanup(); + + return(0); +} -- GitLab