From f3a609ec64b164cedac0aebd8c3512bae7ce66be Mon Sep 17 00:00:00 2001 From: Xavier Elattaoui <xavier.elattaoui@synchrotron-soleil.fr> Date: Thu, 28 Jan 2016 15:52:57 +0000 Subject: [PATCH] - Spectrum attributes size increased to 1 500 000 ! - length check when updating spectrum Attributes - minor change in waveform.cpp file. --- doc/doc_html/Attributes.html | 147 ++++-- doc/doc_html/Description.html | 61 ++- doc/doc_html/DevCommands.html | 119 +++-- doc/doc_html/DevCommandsFrame.html | 1 - doc/doc_html/DevCommandsList.html | 1 + doc/doc_html/DevCommandsTable.html | 137 +++-- doc/doc_html/Properties.html | 140 +++-- doc/doc_html/TangoDevStates.html | 121 +++-- doc/doc_html/index.html | 154 ++++-- doc/doc_html/user_guide.html | 444 ++++++++++++++++ include/Waveform.h | 40 +- pom.xml | 16 +- src/AcquireWaveformLecroy.cpp | 809 +++++++++++++++-------------- src/AcquireWaveformLecroyClass.cpp | 72 ++- src/AcquireWaveformLecroyClass.h | 12 +- src/LinuxSocketLecroy.cpp | 771 ++++++++++++++------------- src/Makefile | 17 +- src/TangoClassID.txt | 11 + src/Waveform.cpp | 62 ++- src/Win32SocketLecroy.cpp | 705 +++++++++++++------------ 20 files changed, 2384 insertions(+), 1456 deletions(-) create mode 100644 doc/doc_html/user_guide.html create mode 100644 src/TangoClassID.txt diff --git a/doc/doc_html/Attributes.html b/doc/doc_html/Attributes.html index 23413f2..75e05dc 100644 --- a/doc/doc_html/Attributes.html +++ b/doc/doc_html/Attributes.html @@ -2,33 +2,53 @@ <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"> +<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#7F00FF" 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> +<TABLE BORDER="0" WIDTH="100%"> + <TR> + <TD ALIGN="left"> + <A HREF="http://www.esrf.fr/" TARGET=new> + <IMG SRC="http://www.esrf.fr/gifs/logo/80.gif" BORDER=0 Height="60"></A> + </Td> + <TD ALIGN="center"> + <A HREF="http://www.elettra.trieste.it/" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/elettra_logo.gif" BORDER=0 Height="60"></A> + + </Td> + <TD ALIGN="center"> + <A HREF="http://www.synchrotron-soleil.fr/" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/soleil_logo.gif" BORDER=0 Height="60"></A> + </Td> + <TD ALIGN="right"> + <A HREF="http://www.cells.es/" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/alba.jpg" BORDER=0 Height="54"></A> + </Td> + <TD ALIGN="right"> + <A HREF="http://www.desy.de/html/home/index_eng.html" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/desy.gif" BORDER=0 Height="60"></A> + </Td> + <Td> + <H2><FONT COLOR="#7F00FF"> + <Center><A HREF="http://www.tango-controls.org/" TARGET="_top"> + TANGO </a> <Br> Device Server + </Center></FONT> + </Td> + </TR> +</TABLE> +<HR WIDTH="100%"></H5> <Br> <center> <h1> -Acquire_Waveform_Lecroy_Prj<Br> -Device Attributes Description +Acquire_Waveform_Lecroy_Prj <Br> +Device Attributes Description <Br> <Br> +AcquireWaveformLecroy Class <Br> </h1> -<Br> <b> -Revision: 1.4 - Author: xavela +Revision: - Author: xavela </b> </center> @@ -42,32 +62,32 @@ Revision: 1.4 - Author: xavela <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 second array contains data of simples waveforms. )</Center></Td> -<Td><Center>DEV_LONG</Center></Td><Td><Center>READ</Center></Td><Td><Center>Yes</Center></Td></Tr> +<Tr><Td><b>triggerTime</b></Td> +<Td><Center><Font Size=-1>DEV_STRING</Font></Center></Td><Td><Center><Font Size=-1>READ</Font></Center></Td><Td><Center><Font Size=-1>No</Font></Center></Td></Tr> -<Tr><Td><b><Center>waveArray2</b><Br>( Length of the second array. This second array contains data of complex waveforms (as FFT, Extrema ....). )</Center></Td> -<Td><Center>DEV_LONG</Center></Td><Td><Center>READ</Center></Td><Td><Center>Yes</Center></Td></Tr> +<Tr><Td><b>verticalOffset</b></Td> +<Td><Center><Font Size=-1>DEV_DOUBLE</Font></Center></Td><Td><Center><Font Size=-1>READ</Font></Center></Td><Td><Center><Font Size=-1>No</Font></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>verticalGain</b></Td> +<Td><Center><Font Size=-1>DEV_DOUBLE</Font></Center></Td><Td><Center><Font Size=-1>READ</Font></Center></Td><Td><Center><Font Size=-1>No</Font></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>Yes</Center></Td></Tr> +<Tr><Td><b>horizontalOffset</b></Td> +<Td><Center><Font Size=-1>DEV_DOUBLE</Font></Center></Td><Td><Center><Font Size=-1>READ</Font></Center></Td><Td><Center><Font Size=-1>No</Font></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>Yes</Center></Td></Tr> +<Tr><Td><b>horizontalInterval</b></Td> +<Td><Center><Font Size=-1>DEV_DOUBLE</Font></Center></Td><Td><Center><Font Size=-1>READ</Font></Center></Td><Td><Center><Font Size=-1>No</Font></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>Yes</Center></Td></Tr> +<Tr><Td><b>nominalBits</b></Td> +<Td><Center><Font Size=-1>DEV_SHORT</Font></Center></Td><Td><Center><Font Size=-1>READ</Font></Center></Td><Td><Center><Font Size=-1>No</Font></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>Yes</Center></Td></Tr> +<Tr><Td><b>waveArrayCount</b></Td> +<Td><Center><Font Size=-1>DEV_LONG</Font></Center></Td><Td><Center><Font Size=-1>READ</Font></Center></Td><Td><Center><Font Size=-1>No</Font></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>Yes</Center></Td></Tr> +<Tr><Td><b>waveArray2</b></Td> +<Td><Center><Font Size=-1>DEV_LONG</Font></Center></Td><Td><Center><Font Size=-1>READ</Font></Center></Td><Td><Center><Font Size=-1>No</Font></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> +<Tr><Td><b>waveArray1</b></Td> +<Td><Center><Font Size=-1>DEV_LONG</Font></Center></Td><Td><Center><Font Size=-1>READ</Font></Center></Td><Td><Center><Font Size=-1>No</Font></Center></Td></Tr> </Table> </Center> @@ -80,29 +100,56 @@ Revision: 1.4 - Author: xavela <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 set to 150000 data by default. )</Center></Td> -<Td><Center>DEV_SHORT</Center></Td><Td><Center>150000</Center></Td><Td><Center>No</Center></Td></Tr> +<Tr><Td><b>verticalScaledData</b></Td> +<Td><Center><Font Size=-1>DEV_DOUBLE</Font></Center></Td><Td><Center><Font Size=-1>1500000</Font></Center></Td><Td><Center><Font Size=-1>No</Font></Center></Td></Tr> -<Tr><Td><b><Center>verticalScaledData</b><Br>( Gets the scaled waveform data. Maximum size set to 150000 data by default. )</Center></Td> -<Td><Center>DEV_DOUBLE</Center></Td><Td><Center>150000</Center></Td><Td><Center>No</Center></Td></Tr> +<Tr><Td><b>rawWaveformData</b></Td> +<Td><Center><Font Size=-1>DEV_SHORT</Font></Center></Td><Td><Center><Font Size=-1>1500000</Font></Center></Td><Td><Center><Font Size=-1>No</Font></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> +<!--- html Footer ---> <Center> -<Br> -<HR WIDTH="100%"></H5> -<H3>(c) SOLEIL : Groupe ICA Contrôle et Acquisitions </H33> +<Font size=-1> +<br> +<br> +<TABLE BORDER="1" WIDTH="100%"> + <Tr> + <!--- Hosted by Sourceforge ---> + <Td Align="Center"> + <Font size=-1> + <b>TANGO</b> is an open source project hosted by :<br> + <A href="http://sourceforge.net" Target="new"> + <IMG title="Sourceforge logo" + alt="Sourceforge logo small" + src="http://www.esrf.fr/computing/cs/tango/sourceforge.gif" + border=0> </a> + </Font> + </Td> + <!--- 2 Sourceforge Repositories ---> + <Td Align="Center"> + <Font size=-1> + Core and Tools : + <a href="http://tango-cs.cvs.sourceforge.net/tango-cs/" Target="new"> + CVS repository</a> on + <a href="https://sourceforge.net/projects/tango-cs" Target=new> + tango-cs project</a> + + <br> + + Device Servers : + <a href="http://tango-ds.cvs.sourceforge.net/tango-ds/" Target="new"> + CVS repository</a> on + <a href="https://sourceforge.net/projects/tango-ds" Target=new> + tango-ds project</a> + </Font> + </Td> + </Tr> +</Table> +</Font> </Center> </body> </html> diff --git a/doc/doc_html/Description.html b/doc/doc_html/Description.html index 10e8c5a..b51a613 100644 --- a/doc/doc_html/Description.html +++ b/doc/doc_html/Description.html @@ -2,21 +2,43 @@ <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"> +<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#7F00FF" 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> +<TABLE BORDER="0" WIDTH="100%"> + <TR> + <TD ALIGN="left"> + <A HREF="http://www.esrf.fr/" TARGET=new> + <IMG SRC="http://www.esrf.fr/gifs/logo/80.gif" BORDER=0 Height="60"></A> + </Td> + <TD ALIGN="center"> + <A HREF="http://www.elettra.trieste.it/" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/elettra_logo.gif" BORDER=0 Height="60"></A> + + </Td> + <TD ALIGN="center"> + <A HREF="http://www.synchrotron-soleil.fr/" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/soleil_logo.gif" BORDER=0 Height="60"></A> + </Td> + <TD ALIGN="right"> + <A HREF="http://www.cells.es/" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/alba.jpg" BORDER=0 Height="54"></A> + </Td> + <TD ALIGN="right"> + <A HREF="http://www.desy.de/html/home/index_eng.html" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/desy.gif" BORDER=0 Height="60"></A> + </Td> + <Td> + <H2><FONT COLOR="#7F00FF"> + <Center><A HREF="http://www.tango-controls.org/" TARGET="_top"> + TANGO </a> <Br> Device Server + </Center></FONT> + </Td> + </TR> +</TABLE> +<Br> + <HR WIDTH="100%"></H5> @@ -40,8 +62,17 @@ Revision: - Author: x.elattaoui <Br> <Br> <Br> -This Page Must Be Filled by <Br> -The Programmer +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 </Center> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> @@ -56,7 +87,7 @@ The Programmer <Center> <Br> <HR WIDTH="100%"></H5> -<H3>(c) SOLEIL : Groupe ICA Contrôle et Acquisitions </H33> +<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 index f8eb7ae..399278f 100644 --- a/doc/doc_html/DevCommands.html +++ b/doc/doc_html/DevCommands.html @@ -2,33 +2,53 @@ <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"> +<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#7F00FF" 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> +<TABLE BORDER="0" WIDTH="100%"> + <TR> + <TD ALIGN="left"> + <A HREF="http://www.esrf.fr/" TARGET=new> + <IMG SRC="http://www.esrf.fr/gifs/logo/80.gif" BORDER=0 Height="60"></A> + </Td> + <TD ALIGN="center"> + <A HREF="http://www.elettra.trieste.it/" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/elettra_logo.gif" BORDER=0 Height="60"></A> + + </Td> + <TD ALIGN="center"> + <A HREF="http://www.synchrotron-soleil.fr/" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/soleil_logo.gif" BORDER=0 Height="60"></A> + </Td> + <TD ALIGN="right"> + <A HREF="http://www.cells.es/" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/alba.jpg" BORDER=0 Height="54"></A> + </Td> + <TD ALIGN="right"> + <A HREF="http://www.desy.de/html/home/index_eng.html" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/desy.gif" BORDER=0 Height="60"></A> + </Td> + <Td> + <H2><FONT COLOR="#7F00FF"> + <Center><A HREF="http://www.tango-controls.org/" TARGET="_top"> + TANGO </a> <Br> Device Server + </Center></FONT> + </Td> + </TR> +</TABLE> +<HR WIDTH="100%"></H5> <Br> <center> <h1> -Acquire_Waveform_Lecroy_Prj<Br> -Device Commands Description +Acquire_Waveform_Lecroy_Prj <Br> +Device Commands Description <Br> <Br> +AcquireWaveformLecroy Class <Br> </h1> -<Br> <b> -Revision: 1.4 - Author: xavela +Revision: - Author: xavela </b> </center> @@ -76,26 +96,67 @@ The language device desctructor automatically calls the <i> delete_device() </i> <Li><Strong>Argin:<Br>DEV_VOID</Strong> : none.<Br>  <Li><Strong>Argout:<Br>CONST_DEV_STRING</Strong> - : Status descrition<Br>  + : Status description<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="WriteRead"><!-- --></A> +<A NAME="WriteRead"><!-- --></A> +<h2>4 - WriteRead (for expert only)</h2> +<ul> +<Li><Strong>Description: </Strong> Command to send a specific command to the Lecroy device<Br>  +<Li><Strong>Argin:<Br>DEV_STRING</Strong> + : command to send<Br>  +<Li><Strong>Argout:<Br>DEV_STRING</Strong> + : device response (if any)<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> +<!--- html Footer ---> <Center> -<Br> -<HR WIDTH="100%"></H5> -<H3>(c) SOLEIL : Groupe ICA Contrôle et Acquisitions </H33> +<Font size=-1> +<br> +<br> +<TABLE BORDER="1" WIDTH="100%"> + <Tr> + <!--- Hosted by Sourceforge ---> + <Td Align="Center"> + <Font size=-1> + <b>TANGO</b> is an open source project hosted by :<br> + <A href="http://sourceforge.net" Target="new"> + <IMG title="Sourceforge logo" + alt="Sourceforge logo small" + src="http://www.esrf.fr/computing/cs/tango/sourceforge.gif" + border=0> </a> + </Font> + </Td> + <!--- 2 Sourceforge Repositories ---> + <Td Align="Center"> + <Font size=-1> + Core and Tools : + <a href="http://tango-cs.cvs.sourceforge.net/tango-cs/" Target="new"> + CVS repository</a> on + <a href="https://sourceforge.net/projects/tango-cs" Target=new> + tango-cs project</a> + + <br> + + Device Servers : + <a href="http://tango-ds.cvs.sourceforge.net/tango-ds/" Target="new"> + CVS repository</a> on + <a href="https://sourceforge.net/projects/tango-ds" Target=new> + tango-ds project</a> + </Font> + </Td> + </Tr> +</Table> +</Font> </Center> </body> </html> diff --git a/doc/doc_html/DevCommandsFrame.html b/doc/doc_html/DevCommandsFrame.html index 039ee33..a696d50 100644 --- a/doc/doc_html/DevCommandsFrame.html +++ b/doc/doc_html/DevCommandsFrame.html @@ -2,7 +2,6 @@ <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%"> diff --git a/doc/doc_html/DevCommandsList.html b/doc/doc_html/DevCommandsList.html index c369265..fcba54a 100644 --- a/doc/doc_html/DevCommandsList.html +++ b/doc/doc_html/DevCommandsList.html @@ -11,6 +11,7 @@ <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> +<A Href="DevCommands.html#WriteRead" TARGET="DevCommands"> WriteRead</a><Br> </BODY> diff --git a/doc/doc_html/DevCommandsTable.html b/doc/doc_html/DevCommandsTable.html index 193a01c..60ea8a4 100644 --- a/doc/doc_html/DevCommandsTable.html +++ b/doc/doc_html/DevCommandsTable.html @@ -2,33 +2,53 @@ <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"> +<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#7F00FF" 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> +<TABLE BORDER="0" WIDTH="100%"> + <TR> + <TD ALIGN="left"> + <A HREF="http://www.esrf.fr/" TARGET=new> + <IMG SRC="http://www.esrf.fr/gifs/logo/80.gif" BORDER=0 Height="60"></A> + </Td> + <TD ALIGN="center"> + <A HREF="http://www.elettra.trieste.it/" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/elettra_logo.gif" BORDER=0 Height="60"></A> + + </Td> + <TD ALIGN="center"> + <A HREF="http://www.synchrotron-soleil.fr/" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/soleil_logo.gif" BORDER=0 Height="60"></A> + </Td> + <TD ALIGN="right"> + <A HREF="http://www.cells.es/" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/alba.jpg" BORDER=0 Height="54"></A> + </Td> + <TD ALIGN="right"> + <A HREF="http://www.desy.de/html/home/index_eng.html" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/desy.gif" BORDER=0 Height="60"></A> + </Td> + <Td> + <H2><FONT COLOR="#7F00FF"> + <Center><A HREF="http://www.tango-controls.org/" TARGET="_top"> + TANGO </a> <Br> Device Server + </Center></FONT> + </Td> + </TR> +</TABLE> +<HR WIDTH="100%"></H5> <Br> <center> <h1> -Acquire_Waveform_Lecroy_Prj<Br> -Device Commands Description +Acquire_Waveform_Lecroy_Prj <Br> +Device Commands Description <Br> <Br> +AcquireWaveformLecroy Class <Br> </h1> -<Br> <b> -Revision: 1.4 - Author: xavela +Revision: - Author: xavela </b> </center> @@ -44,33 +64,76 @@ Revision: 1.4 - Author: xavela <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> +<Tr><Td><b>Init</b></Td> +<Td><Font Size=-1>DEV_VOID</Font></Td> +<Td><Font Size=-1>DEV_VOID</Font></Td> +<Tr><Td><b>State</b></Td> +<Td><Font Size=-1>DEV_VOID</Font></Td> +<Td><Font Size=-1>DEV_STATE</Font></Td> +<Tr><Td><b>Status</b></Td> +<Td><Font Size=-1>DEV_VOID</Font></Td> +<Td><Font Size=-1>CONST_DEV_STRING</Font></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"> +<Br> <Br> <Br> +<Center> +<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 Expert Level Only</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><b>WriteRead</b></Td> +<Td><Font Size=-1>DEV_STRING</Font></Td> +<Td><Font Size=-1>DEV_STRING</Font></Td> -<P><!-------TITLE------></P> + + +</Table></Center> + +<!--- html Footer ---> <Center> -<Br> -<HR WIDTH="100%"></H5> -<H3>(c) SOLEIL : Groupe ICA Contrôle et Acquisitions </H33> +<Font size=-1> +<br> +<br> +<TABLE BORDER="1" WIDTH="100%"> + <Tr> + <!--- Hosted by Sourceforge ---> + <Td Align="Center"> + <Font size=-1> + <b>TANGO</b> is an open source project hosted by :<br> + <A href="http://sourceforge.net" Target="new"> + <IMG title="Sourceforge logo" + alt="Sourceforge logo small" + src="http://www.esrf.fr/computing/cs/tango/sourceforge.gif" + border=0> </a> + </Font> + </Td> + <!--- 2 Sourceforge Repositories ---> + <Td Align="Center"> + <Font size=-1> + Core and Tools : + <a href="http://tango-cs.cvs.sourceforge.net/tango-cs/" Target="new"> + CVS repository</a> on + <a href="https://sourceforge.net/projects/tango-cs" Target=new> + tango-cs project</a> + + <br> + + Device Servers : + <a href="http://tango-ds.cvs.sourceforge.net/tango-ds/" Target="new"> + CVS repository</a> on + <a href="https://sourceforge.net/projects/tango-ds" Target=new> + tango-ds project</a> + </Font> + </Td> + </Tr> +</Table> +</Font> </Center> </body> </html> diff --git a/doc/doc_html/Properties.html b/doc/doc_html/Properties.html index 95f9dd6..dc8e369 100644 --- a/doc/doc_html/Properties.html +++ b/doc/doc_html/Properties.html @@ -2,38 +2,57 @@ <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"> +<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#7F00FF" 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> +<TABLE BORDER="0" WIDTH="100%"> + <TR> + <TD ALIGN="left"> + <A HREF="http://www.esrf.fr/" TARGET=new> + <IMG SRC="http://www.esrf.fr/gifs/logo/80.gif" BORDER=0 Height="60"></A> + </Td> + <TD ALIGN="center"> + <A HREF="http://www.elettra.trieste.it/" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/elettra_logo.gif" BORDER=0 Height="60"></A> + + </Td> + <TD ALIGN="center"> + <A HREF="http://www.synchrotron-soleil.fr/" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/soleil_logo.gif" BORDER=0 Height="60"></A> + </Td> + <TD ALIGN="right"> + <A HREF="http://www.cells.es/" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/alba.jpg" BORDER=0 Height="54"></A> + </Td> + <TD ALIGN="right"> + <A HREF="http://www.desy.de/html/home/index_eng.html" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/desy.gif" BORDER=0 Height="60"></A> + </Td> + <Td> + <H2><FONT COLOR="#7F00FF"> + <Center><A HREF="http://www.tango-controls.org/" TARGET="_top"> + TANGO </a> <Br> Device Server + </Center></FONT> + </Td> + </TR> +</TABLE> +<HR WIDTH="100%"></H5> <Br> <center> <h1> -Acquire_Waveform_Lecroy_Prj<Br> -Properties Description +Acquire_Waveform_Lecroy_Prj <Br> +Properties Description <Br> <Br> +AcquireWaveformLecroy Class <Br> </h1> -<Br> <b> -Revision: 1.4 - Author: xavela +Revision: - Author: xavela </b> </center> -<Br> <Br> <Br> <Center> <Br> <Br> <Br> <Table Border=2 Cellpadding=3 CELLSPACING=0 WIDTH="100%"> @@ -43,41 +62,90 @@ Revision: 1.4 - Author: xavela <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><b><a href=#Dev_DefaultValues>IPaddress </a></b></Td> +<Td><Font Size=-1>Tango::DEV_STRING</Font></Td> +<Td><Font Size=-1>The IP address of the Lecroy scope to build a connection with.</Font></Td></Tr> -<Tr><Td>ChannelName</Td> -<Td>Tango::DEV_STRING</Td> -<Td>The name of channel on which the acquisition will be done. +<Tr><Td><b><a href=#Dev_DefaultValues>ChannelName </a></b></Td> +<Td><Font Size=-1>Tango::DEV_STRING</Font></Td> +<Td><Font Size=-1>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> +Default : C1 (channel 1</Font></Td></Tr> + +</Table> + +</Center> +<Br><Br><Br> +<Br><Br><Br> +<A name=Dev_DefaultValues><!--- ---></a> +<Font Size=+1>Device Properties Default Values:</Font><Br> +<Table Border=2 Cellpadding=2 CELLSPACING=2> + <tr BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> + <Td><b>Property Name</b></td> + <td><b>Default Values</b></td> + </Tr> + <Tr> + <Td>IPaddress</Td> + <td>No default value</td> + </Tr> + <Tr> + <Td>ChannelName</Td> + <td>No default value</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"> +<Br> <Br> <Br> -<P><!-------TITLE------></P> +<!--- html Footer ---> <Center> -<Br> -<HR WIDTH="100%"></H5> -<H3>(c) SOLEIL : Groupe ICA Contrôle et Acquisitions </H33> +<Font size=-1> +<br> +<br> +<TABLE BORDER="1" WIDTH="100%"> + <Tr> + <!--- Hosted by Sourceforge ---> + <Td Align="Center"> + <Font size=-1> + <b>TANGO</b> is an open source project hosted by :<br> + <A href="http://sourceforge.net" Target="new"> + <IMG title="Sourceforge logo" + alt="Sourceforge logo small" + src="http://www.esrf.fr/computing/cs/tango/sourceforge.gif" + border=0> </a> + </Font> + </Td> + <!--- 2 Sourceforge Repositories ---> + <Td Align="Center"> + <Font size=-1> + Core and Tools : + <a href="http://tango-cs.cvs.sourceforge.net/tango-cs/" Target="new"> + CVS repository</a> on + <a href="https://sourceforge.net/projects/tango-cs" Target=new> + tango-cs project</a> + + <br> + + Device Servers : + <a href="http://tango-ds.cvs.sourceforge.net/tango-ds/" Target="new"> + CVS repository</a> on + <a href="https://sourceforge.net/projects/tango-ds" Target=new> + tango-ds project</a> + </Font> + </Td> + </Tr> +</Table> +</Font> </Center> </body> </html> diff --git a/doc/doc_html/TangoDevStates.html b/doc/doc_html/TangoDevStates.html index e3efdaf..be9bd60 100644 --- a/doc/doc_html/TangoDevStates.html +++ b/doc/doc_html/TangoDevStates.html @@ -2,33 +2,53 @@ <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"> +<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#7F00FF" 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> +<TABLE BORDER="0" WIDTH="100%"> + <TR> + <TD ALIGN="left"> + <A HREF="http://www.esrf.fr/" TARGET=new> + <IMG SRC="http://www.esrf.fr/gifs/logo/80.gif" BORDER=0 Height="60"></A> + </Td> + <TD ALIGN="center"> + <A HREF="http://www.elettra.trieste.it/" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/elettra_logo.gif" BORDER=0 Height="60"></A> + + </Td> + <TD ALIGN="center"> + <A HREF="http://www.synchrotron-soleil.fr/" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/soleil_logo.gif" BORDER=0 Height="60"></A> + </Td> + <TD ALIGN="right"> + <A HREF="http://www.cells.es/" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/alba.jpg" BORDER=0 Height="54"></A> + </Td> + <TD ALIGN="right"> + <A HREF="http://www.desy.de/html/home/index_eng.html" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/desy.gif" BORDER=0 Height="60"></A> + </Td> + <Td> + <H2><FONT COLOR="#7F00FF"> + <Center><A HREF="http://www.tango-controls.org/" TARGET="_top"> + TANGO </a> <Br> Device Server + </Center></FONT> + </Td> + </TR> +</TABLE> +<HR WIDTH="100%"></H5> <Br> <center> <h1> -Acquire_Waveform_Lecroy_Prj<Br> -Device States Description +Acquire_Waveform_Lecroy_Prj <Br> +Device States Description <Br> <Br> +AcquireWaveformLecroy Class <Br> </h1> -<Br> <b> -Revision: 1.4 - Author: xavela +Revision: - Author: xavela </b> </center> @@ -41,38 +61,65 @@ Revision: 1.4 - Author: xavela <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><b>OPEN</b></Td> +<Td><Font Size=-1>The socket TCP IP is successfully opened between the Lecroy scope and +this DServer.</Font></Td></Tr> -<Tr><Td>CLOSE</Td> -<Td>The communication between the Lecroy scope and the DServer is closed.</Td></Tr> +<Tr><Td><b>CLOSE</b></Td> +<Td><Font Size=-1>The communication between the Lecroy scope and the DServer is closed.</Font></Td></Tr> -<Tr><Td>FAULT</Td> -<Td>The communication between the Lecroy scope and the DServer is not done.</Td></Tr> +<Tr><Td><b>FAULT</b></Td> +<Td><Font Size=-1>The communication between the Lecroy scope and the DServer is not done.</Font></Td></Tr> -<Tr><Td>ALARM</Td> -<Td>An error occured during a Write or Read command.</Td></Tr> +<Tr><Td><b>ALARM</b></Td> +<Td><Font Size=-1>An error occured during a Write or Read command.</Font></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> +<!--- html Footer ---> <Center> -<Br> -<HR WIDTH="100%"></H5> -<H3>(c) SOLEIL : Groupe ICA Contrôle et Acquisitions </H33> +<Font size=-1> +<br> +<br> +<TABLE BORDER="1" WIDTH="100%"> + <Tr> + <!--- Hosted by Sourceforge ---> + <Td Align="Center"> + <Font size=-1> + <b>TANGO</b> is an open source project hosted by :<br> + <A href="http://sourceforge.net" Target="new"> + <IMG title="Sourceforge logo" + alt="Sourceforge logo small" + src="http://www.esrf.fr/computing/cs/tango/sourceforge.gif" + border=0> </a> + </Font> + </Td> + <!--- 2 Sourceforge Repositories ---> + <Td Align="Center"> + <Font size=-1> + Core and Tools : + <a href="http://tango-cs.cvs.sourceforge.net/tango-cs/" Target="new"> + CVS repository</a> on + <a href="https://sourceforge.net/projects/tango-cs" Target=new> + tango-cs project</a> + + <br> + + Device Servers : + <a href="http://tango-ds.cvs.sourceforge.net/tango-ds/" Target="new"> + CVS repository</a> on + <a href="https://sourceforge.net/projects/tango-ds" Target=new> + tango-ds project</a> + </Font> + </Td> + </Tr> +</Table> +</Font> </Center> </body> </html> diff --git a/doc/doc_html/index.html b/doc/doc_html/index.html index b75e063..742b8dc 100644 --- a/doc/doc_html/index.html +++ b/doc/doc_html/index.html @@ -2,43 +2,63 @@ <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"> +<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#7F00FF" 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> +<TABLE BORDER="0" WIDTH="100%"> + <TR> + <TD ALIGN="left"> + <A HREF="http://www.esrf.fr/" TARGET=new> + <IMG SRC="http://www.esrf.fr/gifs/logo/80.gif" BORDER=0 Height="60"></A> + </Td> + <TD ALIGN="center"> + <A HREF="http://www.elettra.trieste.it/" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/elettra_logo.gif" BORDER=0 Height="60"></A> + + </Td> + <TD ALIGN="center"> + <A HREF="http://www.synchrotron-soleil.fr/" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/soleil_logo.gif" BORDER=0 Height="60"></A> + </Td> + <TD ALIGN="right"> + <A HREF="http://www.cells.es/" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/alba.jpg" BORDER=0 Height="54"></A> + </Td> + <TD ALIGN="right"> + <A HREF="http://www.desy.de/html/home/index_eng.html" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/desy.gif" BORDER=0 Height="60"></A> + </Td> + <Td> + <H2><FONT COLOR="#7F00FF"> + <Center><A HREF="http://www.tango-controls.org/" TARGET="_top"> + TANGO </a> <Br> Device Server + </Center></FONT> + </Td> + </TR> +</TABLE> <HR WIDTH="100%"></H5> -<Br> <center> <h1> -Acquire_Waveform_Lecroy_Prj<Br> -Device Server User's Guide +Acquire_Waveform_Lecroy_Prj <Br> +User's Guide <Br><Br> +AcquireWaveformLecroy Class<Br> + </h1> -<Br> <b> -Revision: 1.4 - Author: xavela +Revision: - Author: xavela <Br> + Implemented in C++ </b> </center> <Br> <Br> <Br> <Br> -<Br> -<Br> <h2>Introduction:</h2> -This class allows the acquisition of a waveform (the description and the data), +<ul> + 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) @@ -49,48 +69,94 @@ the total length of the acquired data (lgth array1 + lgth array2) NOTE : for all Lecroy scope, the port number is the same : 1861<Br> +</ul> +<Br><h2>Class Identification:</h2> +<ul> + <li><b>Contact :</b> at synchrotron-soleil.fr - xavier.elattaoui + <li><b>Class Family :</b> Acquisition + <li><b>Platform :</b> All Platforms + <li><b>Bus :</b> Ethernet + <li><b>Manufacturer :</b> Lecroy + <li><b>Reference :</b> WaveForm +</ul><Br> +<h2>Class Inheritance:</h2> + <ul> + <li> <a href="http://www.esrf.fr/computing/cs/tango/tango_doc/kernel_doc/cpp_doc/"> Tango::Device_4Impl</a></li> + <ul> + <li> AcquireWaveformLecroy</li> + </ul> + </ul> + </ul> +</ul> <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> + <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=DevCommandsTable.html> Commands description</a> + <li> <a href=Attributes.html> Attributes description</a> </ul> <Br> <Br> <Br> -<h2>Extented User's guide (available only for complex DeviceServers):</h2> +<!--------------h2>Programmer's guide:</h2> <ul> - <li> <a href="DeviceServerUsersGuide.doc"> In French word format.</a> - <li> <a href="DeviceServerUsersGuide.pdf"> In French PDF format.</a> - <li> <a href="DeviceServerUsersGuide_en.doc"> In English word format.</a> - <li> <a href="DeviceServerUsersGuide_en.pdf"> In English PDF format.</a> + <li> <a href="html/index.html"> Software description.</a> </ul> -<Br> +<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. +<ul> + The device server is ready for distribution application programmers.<Br> + The author will be interested in any feedback which arise from their + usage of this device server. +</ul> <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> +<!--- html Footer ---> <Center> -<Br> -<HR WIDTH="100%"></H5> -<H3>(c) SOLEIL : Groupe ICA Contrôle et Acquisitions </H33> +<Font size=-1> +<br> +<br> +<TABLE BORDER="1" WIDTH="100%"> + <Tr> + <!--- Hosted by Sourceforge ---> + <Td Align="Center"> + <Font size=-1> + <b>TANGO</b> is an open source project hosted by :<br> + <A href="http://sourceforge.net" Target="new"> + <IMG title="Sourceforge logo" + alt="Sourceforge logo small" + src="http://www.esrf.fr/computing/cs/tango/sourceforge.gif" + border=0> </a> + </Font> + </Td> + <!--- 2 Sourceforge Repositories ---> + <Td Align="Center"> + <Font size=-1> + Core and Tools : + <a href="http://tango-cs.cvs.sourceforge.net/tango-cs/" Target="new"> + CVS repository</a> on + <a href="https://sourceforge.net/projects/tango-cs" Target=new> + tango-cs project</a> + + <br> + + Device Servers : + <a href="http://tango-ds.cvs.sourceforge.net/tango-ds/" Target="new"> + CVS repository</a> on + <a href="https://sourceforge.net/projects/tango-ds" Target=new> + tango-ds project</a> + </Font> + </Td> + </Tr> +</Table> +</Font> </Center> </body> </html> diff --git a/doc/doc_html/user_guide.html b/doc/doc_html/user_guide.html new file mode 100644 index 0000000..bf63549 --- /dev/null +++ b/doc/doc_html/user_guide.html @@ -0,0 +1,444 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<Title> Tango Device Server User's Guide </Title> +</HEAD> +<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#7F00FF" ALINK="#FF0000"> + +<P><!-------TITLE------></P> +<TABLE BORDER="0" WIDTH="100%"> + <TR> + <TD ALIGN="left"> + <A HREF="http://www.esrf.fr/" TARGET=new> + <IMG SRC="http://www.esrf.fr/gifs/logo/80.gif" BORDER=0 Height="60"></A> + </Td> + <TD ALIGN="center"> + <A HREF="http://www.elettra.trieste.it/" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/elettra_logo.gif" BORDER=0 Height="60"></A> + + </Td> + <TD ALIGN="center"> + <A HREF="http://www.synchrotron-soleil.fr/" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/soleil_logo.gif" BORDER=0 Height="60"></A> + </Td> + <TD ALIGN="right"> + <A HREF="http://www.cells.es/" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/alba.jpg" BORDER=0 Height="54"></A> + </Td> + <TD ALIGN="right"> + <A HREF="http://www.desy.de/html/home/index_eng.html" TARGET=new> + <IMG SRC="http://www.esrf.fr/computing/cs/tango/desy.gif" BORDER=0 Height="60"></A> + </Td> + <Td> + <H2><FONT COLOR="#7F00FF"> + <Center><A HREF="http://www.tango-controls.org/" TARGET="_top"> + TANGO </a> <Br> Device Server + </Center></FONT> + </Td> + </TR> +</TABLE> + +<HR WIDTH="100%"></H5> + +<Br> <Br><Br> <Br><Br> <Br><center><Table Border=2 Cellpadding=3 CELLSPACING=0 WIDTH="100%"> +<Tr><Td><Br> <Br> +<center> +<h1> +Acquire_Waveform_Lecroy_Prj <Br> +User's Guide<Br> <Br> <Br><Br> +AcquireWaveformLecroy Class<Br> <Br></Td></Tr> +</h1> +<Tr><Td> +<b><Center>Revision: - Author: xavela <Br> + Implemented in C++ +</Center></b> +</Td></Tr> +</center> +</Table> +</center> +<Br> +<Br> +<Br> +<Br> +<Br> <Br><Br> <Br> +<h2>Introduction:</h2> +<ul> + 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> +</ul> +<Br> +<Br> +<Br><h2>Class Identification:</h2> +<ul> + <li><b>Contact :</b> at synchrotron-soleil.fr - xavier.elattaoui + <li><b>Class Family :</b> Acquisition + <li><b>Platform :</b> All Platforms + <li><b>Bus :</b> Ethernet + <li><b>Manufacturer :</b> Lecroy + <li><b>Reference :</b> WaveForm +</ul><Br> <Br><Br> +<h2>Class Inheritance:</h2> + <ul> + <li> <a href="http://www.esrf.fr/computing/cs/tango/tango_doc/kernel_doc/cpp_doc/"> Tango::Device_4Impl</a></li> + <ul> + <li> AcquireWaveformLecroy</li> + </ul> + </ul> + </ul> +</ul> +<Br> <Br> +<h2>Description:</h2> + +</b> +</center> + + +<Center> +<Br> +<Br> +<Br> +<Br> +<Br> +<Br> +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 +</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> <Br><Br> <Br><h2>Properties:</h2> + + +<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><b><a href=#Dev_DefaultValues>IPaddress </a></b></Td> +<Td><Font Size=-1>Tango::DEV_STRING</Font></Td> +<Td><Font Size=-1>The IP address of the Lecroy scope to build a connection with.</Font></Td></Tr> + +<Tr><Td><b><a href=#Dev_DefaultValues>ChannelName </a></b></Td> +<Td><Font Size=-1>Tango::DEV_STRING</Font></Td> +<Td><Font Size=-1>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</Font></Td></Tr> + +</Table> + +</Center> +<Br><Br><Br> +<Br><Br><Br> + +<A name=Dev_DefaultValues><!--- ---></a> +<Font Size=+1>Device Properties Default Values:</Font><Br> +<Table Border=2 Cellpadding=2 CELLSPACING=2> + <tr BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> + <Td><b>Property Name</b></td> + <td><b>Default Values</b></td> + </Tr> + <Tr> + <Td>IPaddress</Td> + <td>No default value</td> + </Tr> + <Tr> + <Td>ChannelName</Td> + <td>No default value</td> + </Tr> +</Table> + +<Br><Br><Br> +<Center><b> +There is no Class properties.<Br><Br> +</Center></b> +<Br> <Br> <Br> + + +</center> +<Br> <Br><Br> <Br><h2>States:</h2> + + +<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><b>OPEN</b></Td> +<Td><Font Size=-1>The socket TCP IP is successfully opened between the Lecroy scope and +this DServer.</Font></Td></Tr> + +<Tr><Td><b>CLOSE</b></Td> +<Td><Font Size=-1>The communication between the Lecroy scope and the DServer is closed.</Font></Td></Tr> + +<Tr><Td><b>FAULT</b></Td> +<Td><Font Size=-1>The communication between the Lecroy scope and the DServer is not done.</Font></Td></Tr> + +<Tr><Td><b>ALARM</b></Td> +<Td><Font Size=-1>An error occured during a Write or Read command.</Font></Td></Tr> + + + + +</Table> +</Center> + + +</center> +<Br> <Br><Br> <Br><h2>Attributes:</h2> + + +<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>triggerTime</b></Td> +<Td><Center><Font Size=-1>DEV_STRING</Font></Center></Td><Td><Center><Font Size=-1>READ</Font></Center></Td><Td><Center><Font Size=-1>No</Font></Center></Td></Tr> + +<Tr><Td><b>verticalOffset</b></Td> +<Td><Center><Font Size=-1>DEV_DOUBLE</Font></Center></Td><Td><Center><Font Size=-1>READ</Font></Center></Td><Td><Center><Font Size=-1>No</Font></Center></Td></Tr> + +<Tr><Td><b>verticalGain</b></Td> +<Td><Center><Font Size=-1>DEV_DOUBLE</Font></Center></Td><Td><Center><Font Size=-1>READ</Font></Center></Td><Td><Center><Font Size=-1>No</Font></Center></Td></Tr> + +<Tr><Td><b>horizontalOffset</b></Td> +<Td><Center><Font Size=-1>DEV_DOUBLE</Font></Center></Td><Td><Center><Font Size=-1>READ</Font></Center></Td><Td><Center><Font Size=-1>No</Font></Center></Td></Tr> + +<Tr><Td><b>horizontalInterval</b></Td> +<Td><Center><Font Size=-1>DEV_DOUBLE</Font></Center></Td><Td><Center><Font Size=-1>READ</Font></Center></Td><Td><Center><Font Size=-1>No</Font></Center></Td></Tr> + +<Tr><Td><b>nominalBits</b></Td> +<Td><Center><Font Size=-1>DEV_SHORT</Font></Center></Td><Td><Center><Font Size=-1>READ</Font></Center></Td><Td><Center><Font Size=-1>No</Font></Center></Td></Tr> + +<Tr><Td><b>waveArrayCount</b></Td> +<Td><Center><Font Size=-1>DEV_LONG</Font></Center></Td><Td><Center><Font Size=-1>READ</Font></Center></Td><Td><Center><Font Size=-1>No</Font></Center></Td></Tr> + +<Tr><Td><b>waveArray2</b></Td> +<Td><Center><Font Size=-1>DEV_LONG</Font></Center></Td><Td><Center><Font Size=-1>READ</Font></Center></Td><Td><Center><Font Size=-1>No</Font></Center></Td></Tr> + +<Tr><Td><b>waveArray1</b></Td> +<Td><Center><Font Size=-1>DEV_LONG</Font></Center></Td><Td><Center><Font Size=-1>READ</Font></Center></Td><Td><Center><Font Size=-1>No</Font></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>verticalScaledData</b></Td> +<Td><Center><Font Size=-1>DEV_DOUBLE</Font></Center></Td><Td><Center><Font Size=-1>1500000</Font></Center></Td><Td><Center><Font Size=-1>No</Font></Center></Td></Tr> + +<Tr><Td><b>rawWaveformData</b></Td> +<Td><Center><Font Size=-1>DEV_SHORT</Font></Center></Td><Td><Center><Font Size=-1>1500000</Font></Center></Td><Td><Center><Font Size=-1>No</Font></Center></Td></Tr> + +</Table> +</Center> +<Br><Br><Br><Br><Br> + + +</center> +<Br> <Br><Br> <Br><h2>Commands:</h2> + + +<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><b>Init</b></Td> +<Td><Font Size=-1>DEV_VOID</Font></Td> +<Td><Font Size=-1>DEV_VOID</Font></Td> +<Tr><Td><b>State</b></Td> +<Td><Font Size=-1>DEV_VOID</Font></Td> +<Td><Font Size=-1>DEV_STATE</Font></Td> +<Tr><Td><b>Status</b></Td> +<Td><Font Size=-1>DEV_VOID</Font></Td> +<Td><Font Size=-1>CONST_DEV_STRING</Font></Td> + + + +</Table></Center> +<Br> <Br> <Br> +<Center> +<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 Expert Level Only</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><b>WriteRead</b></Td> +<Td><Font Size=-1>DEV_STRING</Font></Td> +<Td><Font Size=-1>DEV_STRING</Font></Td> + + + +</Table></Center> + +</center> +<Br> <Br> + +<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 description<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="WriteRead"><!-- --></A> +<A NAME="WriteRead"><!-- --></A> +<h2>4 - WriteRead (for expert only)</h2> +<ul> +<Li><Strong>Description: </Strong> Command to send a specific command to the Lecroy device<Br>  +<Li><Strong>Argin:<Br>DEV_STRING</Strong> + : command to send<Br>  +<Li><Strong>Argout:<Br>DEV_STRING</Strong> + : device response (if any)<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> + +</center> +<Br> <Br><Br> <Br> + +<!--- html Footer ---> + +<Center> +<Font size=-1> +<br> +<br> +<TABLE BORDER="1" WIDTH="100%"> + <Tr> + <!--- Hosted by Sourceforge ---> + <Td Align="Center"> + <Font size=-1> + <b>TANGO</b> is an open source project hosted by :<br> + <A href="http://sourceforge.net" Target="new"> + <IMG title="Sourceforge logo" + alt="Sourceforge logo small" + src="http://www.esrf.fr/computing/cs/tango/sourceforge.gif" + border=0> </a> + </Font> + </Td> + <!--- 2 Sourceforge Repositories ---> + <Td Align="Center"> + <Font size=-1> + Core and Tools : + <a href="http://tango-cs.cvs.sourceforge.net/tango-cs/" Target="new"> + CVS repository</a> on + <a href="https://sourceforge.net/projects/tango-cs" Target=new> + tango-cs project</a> + + <br> + + Device Servers : + <a href="http://tango-ds.cvs.sourceforge.net/tango-ds/" Target="new"> + CVS repository</a> on + <a href="https://sourceforge.net/projects/tango-ds" Target=new> + tango-ds project</a> + </Font> + </Td> + </Tr> +</Table> +</Font> +</Center> +</body> +</html> diff --git a/include/Waveform.h b/include/Waveform.h index 2734cdd..5082c54 100644 --- a/include/Waveform.h +++ b/include/Waveform.h @@ -11,7 +11,7 @@ // september 16, 2004 : Header file of the WaveForm Class // // it contains the waveform raw data, at least there will be scaled -// +// // author : X.Elattaoui // //****************************************************************************************** @@ -22,15 +22,15 @@ #include <string> #include "WaveformException.h" -const long MAX_WAVEFORM_DATA_LENGTH = 150000; +const long MAX_WAVEFORM_DATA_LENGTH = 1500000; /*************************************************************************************************************************************************/ /*************************************************************************************************************************************************/ //- IMPORTANT NOTE: -//- In the Lecroy documentation "Remote Control Manual", its explain that the structure begins at the offset 21 of the received block. -//- But the tests done with two Lecroy scopes (a WR6100 and WP7100) have shown that this offset can be 21 or 15. -//- For the moment, this offset is 15. +//- In the Lecroy documentation "Remote Control Manual", its explain that the structure begins at the offset 21 of the received block. +//- But the tests done with two Lecroy scopes (a WR6100 and WP7100) have shown that this offset can be 21 or 15. +//- For the moment, this offset is 15. //- Now this offset is dynamically calculated. /*************************************************************************************************************************************************/ @@ -65,13 +65,13 @@ typedef struct 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_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 + 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 @@ -93,18 +93,18 @@ typedef struct //- RESTORE DEFAULT ALIGNEMENT #pragma pack() -class WaveForm_data +class WaveForm_data { private: char ptrRawData[MAX_WAVEFORM_DATA_LENGTH]; //- ptr on the received waveform data - + std::string channel_name; //- Waveform data : short* sh_raw_waveform_data; double* vertical_scaled_waveform_data; - + //- time of the trigger in format "Date = month, day, year ; Time = hours:minutes:seconds" std::string trigger_time_value; @@ -119,23 +119,23 @@ public: ~WaveForm_data(); //- Getters & Setters - std::string get_channel_name () + std::string get_channel_name () throw (lecroy::WaveformException); void set_channel_name (std::string); - - WAVEDESC_BLOCK *get_wavedesc_descriptor () + + WAVEDESC_BLOCK *get_wavedesc_descriptor () throw (lecroy::WaveformException); - - void get_waveform_data () + + void get_waveform_data () throw (lecroy::WaveformException); //- acquire the waveform data from the scope - - short* get_raw_waveform_data () + + short* get_raw_waveform_data () throw (lecroy::WaveformException); //- return the ptr on sh_raw_waveform_data - - double* get_vertical_scaled_waveform_data () + + double* get_vertical_scaled_waveform_data () throw (lecroy::WaveformException); - + std::string get_trigger_time_value (); }; diff --git a/pom.xml b/pom.xml index b7f050b..6ff5096 100644 --- a/pom.xml +++ b/pom.xml @@ -6,12 +6,14 @@ <artifactId>super-pom-C-CPP-device</artifactId> <version>RELEASE</version> </parent> + <groupId>fr.soleil.device</groupId> <artifactId>AcquireWaveformLecroy-${aol}-${mode}</artifactId> - <version>1.1.14-SNAPSHOT</version> + <version>1.1.14</version> <packaging>nar</packaging> <name>AcquireWaveformLecroy</name> <description>AcquireWaveformLecroy device</description> + <build> <plugins> <plugin> @@ -46,12 +48,20 @@ </plugin> </plugins> </build> - <dependencies/> + + <dependencies> + <dependency> + <groupId>fr.soleil.lib</groupId> + <artifactId>YAT-${aol}-${library}-${mode}</artifactId> + </dependency> + </dependencies> + <scm> <connection>${scm.connection.svn.tango-ds}/DeviceClasses/MeasureInstruments/Lecroy/AcquireWaveformLecroy/trunk</connection> <developerConnection>${scm.connection.svn.tango-ds}/DeviceClasses/MeasureInstruments/Lecroy/AcquireWaveformLecroy/trunk</developerConnection> <url>${scm.connection.svn.tango-ds}/DeviceClasses/MeasureInstruments/Lecroy/AcquireWaveformLecroy/trunk</url> </scm> + <developers> <developer> <id>elattaoui</id> @@ -65,4 +75,4 @@ <timezone>1</timezone> </developer> </developers> -</project> \ No newline at end of file +</project> diff --git a/src/AcquireWaveformLecroy.cpp b/src/AcquireWaveformLecroy.cpp index 12a82b1..422c93f 100644 --- a/src/AcquireWaveformLecroy.cpp +++ b/src/AcquireWaveformLecroy.cpp @@ -10,7 +10,7 @@ static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentatio // // file : AcquireWaveformLecroy.cpp // -// description : C++ source for the AcquireWaveformLecroy and its commands. +// 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 @@ -70,15 +70,15 @@ static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentatio // Initial import. // // -// copyleft : Synchrotron SOLEIL -// L'Orme des Merisiers -// Saint-Aubin - BP 48 +// copyleft : Synchrotron SOLEIL +// L'Orme des Merisiers +// Saint-Aubin - BP 48 // //-============================================================================= // -// This file is generated by POGO -// (Program Obviously used to Generate tango Object) +// This file is generated by POGO +// (Program Obviously used to Generate tango Object) // // (c) - Software Engineering Group - ESRF //============================================================================= @@ -87,10 +87,10 @@ static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentatio //=================================================================== // -// The following table gives the correspondance -// between commands and method's name. +// The following table gives the correspondence +// between commands and method name. // -// Command's name| Method's name +// Command name| Method name // ---------------------------------------- // State | dev_state() // Status | dev_status() @@ -102,6 +102,7 @@ static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentatio #include <tango.h> #include <AcquireWaveformLecroy.h> #include <AcquireWaveformLecroyClass.h> +#include <yat/time/Timer.h> static const int MAX_RESPONSE_LENGTH = 150000; @@ -110,208 +111,208 @@ namespace AcquireWaveformLecroy_ns //+---------------------------------------------------------------------------- // -// method : AcquireWaveformLecroy::AcquireWaveformLecroy(string &s) -// -// description : constructor for simulated AcquireWaveformLecroy +// method : AcquireWaveformLecroy::AcquireWaveformLecroy(string &s) +// +// description : constructor for simulated AcquireWaveformLecroy // // in : - cl : Pointer to the DeviceClass object -// - s : Device name +// - s : Device name // //----------------------------------------------------------------------------- AcquireWaveformLecroy::AcquireWaveformLecroy(Tango::DeviceClass *cl,string &s) -:Tango::Device_4Impl(cl,s.c_str()) + :Tango::Device_4Impl(cl,s.c_str()) { - init_device(); + init_device(); } AcquireWaveformLecroy::AcquireWaveformLecroy(Tango::DeviceClass *cl,const char *s) -:Tango::Device_4Impl(cl,s) + :Tango::Device_4Impl(cl,s) { - init_device(); + init_device(); } AcquireWaveformLecroy::AcquireWaveformLecroy(Tango::DeviceClass *cl,const char *s,const char *d) -:Tango::Device_4Impl(cl,s,d) + :Tango::Device_4Impl(cl,s,d) { - init_device(); + init_device(); } //+---------------------------------------------------------------------------- // -// method : AcquireWaveformLecroy::delete_device() -// -// description : will be called at device destruction or at init command. +// 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_waveArray2_read) { - delete attr_waveArray2_read; - attr_waveArray2_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 - if(waveform_ptr) - { - delete waveform_ptr; - waveform_ptr = 0; - } - if(_deviceResponse) - { - delete [] _deviceResponse; - _deviceResponse = 0; - } + //- 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_waveArray2_read) { + delete attr_waveArray2_read; + attr_waveArray2_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 + if(waveform_ptr) + { + delete waveform_ptr; + waveform_ptr = 0; + } + if(_deviceResponse) + { + delete [] _deviceResponse; + _deviceResponse = 0; + } } //+---------------------------------------------------------------------------- // -// method : AcquireWaveformLecroy::init_device() -// -// description : will be called at device initialization. +// method : AcquireWaveformLecroy::init_device() +// +// description : will be called at device initialization. // //----------------------------------------------------------------------------- void AcquireWaveformLecroy::init_device() { - INFO_STREAM << "AcquireWaveformLecroy::AcquireWaveformLecroy() create device " << device_name << endl; + INFO_STREAM << "AcquireWaveformLecroy::AcquireWaveformLecroy() create device " << device_name << endl; - //- create read attributes - //-------------------------------------------- + //- create read attributes + //-------------------------------------------- - //- The memory allocation is done in read_attr_hardware( ) method, - //- because the length of the received data block is not known here - attr_rawWaveformData_read = 0; + //- The memory allocation is done in read_attr_hardware( ) method, + //- because the length of the received data block is not known here + attr_rawWaveformData_read = 0; - //- The memory allocation is done in read_attr_hardware( ) method, - //- because the length of the received data block is not known here - attr_verticalScaledData_read = 0; + //- The memory allocation is done in read_attr_hardware( ) method, + //- because the length of the received data block is not known here + attr_verticalScaledData_read = 0; - attr_waveArray1_read = new Tango::DevLong; - *attr_waveArray1_read = 0; + attr_waveArray1_read = new Tango::DevLong; + *attr_waveArray1_read = 0; - attr_waveArray2_read = new Tango::DevLong; - *attr_waveArray2_read = 0; + attr_waveArray2_read = new Tango::DevLong; + *attr_waveArray2_read = 0; - attr_waveArrayCount_read = new Tango::DevLong; - *attr_waveArrayCount_read = 0; + attr_waveArrayCount_read = new Tango::DevLong; + *attr_waveArrayCount_read = 0; - attr_nominalBits_read = new Tango::DevShort; - *attr_nominalBits_read = 0; + attr_nominalBits_read = new Tango::DevShort; + *attr_nominalBits_read = 0; - attr_horizontalInterval_read = new Tango::DevDouble; - *attr_horizontalInterval_read = 0.; + attr_horizontalInterval_read = new Tango::DevDouble; + *attr_horizontalInterval_read = 0.; - attr_horizontalOffset_read = new Tango::DevDouble; - *attr_horizontalOffset_read = 0.; + attr_horizontalOffset_read = new Tango::DevDouble; + *attr_horizontalOffset_read = 0.; - attr_verticalGain_read = new Tango::DevDouble; - *attr_verticalGain_read = 0.; + attr_verticalGain_read = new Tango::DevDouble; + *attr_verticalGain_read = 0.; - attr_verticalOffset_read = new Tango::DevDouble; - *attr_verticalOffset_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)); + attr_triggerTime_read = new Tango::DevString; + *attr_triggerTime_read = new char[MAX_STRING_LENGTH]; + ::memset(*attr_triggerTime_read, 0, MAX_STRING_LENGTH * sizeof(char)); - _deviceResponse = new char[MAX_RESPONSE_LENGTH]; + _deviceResponse = new char[MAX_RESPONSE_LENGTH]; - //- Initialise variables to default values - //-------------------------------------------- - data_value = 0; - data_length = 0; - ptr_com = 0; - waveform_ptr= 0; + //- Initialise variables to default values + //-------------------------------------------- + data_value = 0; + data_length = 0; + ptr_com = 0; + waveform_ptr= 0; - get_device_property(); + get_device_property(); - //- create the com obj - ptr_com = SocketLecroy::get_instance(); + //- create the com obj + ptr_com = SocketLecroy::get_instance(); - if ( !ptr_com ) - { - set_state(Tango::FAULT); - set_status("OUT OF MEMORY : communication link cannot be created !"); - } + if ( !ptr_com ) + { + set_state(Tango::FAULT); + set_status("OUT OF MEMORY : communication link cannot be created !"); + } - _is_communication_opened = false; - - //- create the waveform obj - waveform_ptr = new WaveForm_data(channelName); - if ( !waveform_ptr ) - { - set_state(Tango::FAULT); - set_status("OUT OF MEMORY : objects cannot be created !"); - } - else - { - set_state(Tango::ALARM); - set_status("Communication is not yet opened."); - } + _is_communication_opened = false; + + //- create the waveform obj + waveform_ptr = new WaveForm_data(channelName); + if ( !waveform_ptr ) + { + set_state(Tango::FAULT); + set_status("OUT OF MEMORY : objects cannot be created !"); + } + else + { + set_state(Tango::ALARM); + set_status("Communication is not yet opened."); + } } //+---------------------------------------------------------------------------- // -// method : AcquireWaveformLecroy::get_device_property() -// -// description : Read the device properties from database. +// method : AcquireWaveformLecroy::get_device_property() +// +// description : Read the device properties from database. // //----------------------------------------------------------------------------- void AcquireWaveformLecroy::get_device_property() { - //- Initialize your default values here. - //------------------------------------------ - iPaddress = "172.16.35.1"; - channelName = "C2"; + //- Initialize your default values here. + //------------------------------------------ + iPaddress = "172.16.35.1"; + channelName = "C2"; - //- Read device properties from database.(Automatic code generation) - //------------------------------------------------------------- + //- Read device properties from database.(Automatic code generation) + //------------------------------------------------------------- Tango::DbData dev_prop; dev_prop.push_back(Tango::DbDatum("IPaddress")); dev_prop.push_back(Tango::DbDatum("ChannelName")); @@ -328,356 +329,365 @@ void AcquireWaveformLecroy::get_device_property() // Try to initialize IPaddress from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> iPaddress; - // Try to initialize IPaddress from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> iPaddress; + else { + // Try to initialize IPaddress from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> iPaddress; + } // And try to extract IPaddress value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> iPaddress; // Try to initialize ChannelName from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> channelName; - // Try to initialize ChannelName from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> channelName; + else { + // Try to initialize ChannelName from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> channelName; + } // And try to extract ChannelName value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> channelName; - //- End of Automatic code generation - //------------------------------------------------------------- + //- End of Automatic code generation + //------------------------------------------------------------- - Tango::DbData data_put; - if (dev_prop[0].is_empty()) - { - Tango::DbDatum propert("IPaddress"); - propert << iPaddress; - data_put.push_back(propert); - } - if (dev_prop[1].is_empty()) - { - Tango::DbDatum propert("ChannelName"); - propert << channelName; - data_put.push_back(propert); - } + Tango::DbData data_put; + if (dev_prop[0].is_empty()) + { + Tango::DbDatum propert("IPaddress"); + propert << iPaddress; + data_put.push_back(propert); + } + if (dev_prop[1].is_empty()) + { + Tango::DbDatum propert("ChannelName"); + propert << channelName; + data_put.push_back(propert); + } - // End of Automatic code generation - //------------------------------------------------------------------ - if( !data_put.empty() ) - get_db_device()->put_property(data_put); + // End of Automatic code generation + //------------------------------------------------------------------ + if( !data_put.empty() ) + get_db_device()->put_property(data_put); } //+---------------------------------------------------------------------------- // -// method : AcquireWaveformLecroy::always_executed_hook() -// -// description : method always executed before any command is executed +// method : AcquireWaveformLecroy::always_executed_hook() +// +// description : method always executed before any command is executed // //----------------------------------------------------------------------------- void AcquireWaveformLecroy::always_executed_hook() { - //- init communication - if ( !_is_communication_opened ) - { - std::cout << "always!" << std::endl; - try - { - ptr_com->TCP_Connect( (char*)iPaddress.c_str() ); - _is_communication_opened = true; - set_state(Tango::OPEN); - set_status("The communication is OK."); - } - catch(const lecroy::SocketException & se) - { - _is_communication_opened = false; - set_state(Tango::FAULT); - set_status("The communication is not well opened."); - Tango::DevFailed df = lecroy_to_tango_exception(se); - FATAL_STREAM << df << std::endl; - 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 - ); - } - } - - std::cout << "always end!" << std::endl; + //- init communication + if ( !_is_communication_opened ) + { + std::cout << "always!" << std::endl; + try + { + ptr_com->TCP_Connect( (char*)iPaddress.c_str() ); + _is_communication_opened = true; + set_state(Tango::OPEN); + set_status("The communication is OK."); + } + catch(const lecroy::SocketException & se) + { + _is_communication_opened = false; + set_state(Tango::FAULT); + set_status("The communication is not well opened."); + Tango::DevFailed df = lecroy_to_tango_exception(se); + FATAL_STREAM << df << std::endl; + Tango::Except::re_throw_exception(df, + "TCP_CONNECTION_FAILED", + "Cannot built a socket connection.", + "AcquireWaveformLecroy::init_device()", + Tango::PANIC + ); + } + } } //+---------------------------------------------------------------------------- // -// method : AcquireWaveformLecroy::read_attr_hardware() -// -// description : Hardware acquisition for attributes. +// 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; - - //- Get the waveform data and description( ADC resolution, horizontal and vertical infos, data length ...) - try - { - // First do a real read on the hardware - // - waveform_ptr->get_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); - FATAL_STREAM << df << std::endl; - Tango::Except::re_throw_exception(df, - (const char*) "COMMUNICATION_BROKEN", - (const char*) "Cannot call get_waveform_data.", - (const char*) "AcquireWaveformLecroy::always_executed_hook()", - Tango::ERR - ); - } - - //- get the waveform length - try - { - //- TODO : retirer les copies dans les attr !!!! - data_length = waveform_ptr->get_wavedesc_descriptor()->wave_array_count; - attr_rawWaveformData_read = waveform_ptr->get_raw_waveform_data(); - attr_verticalScaledData_read = 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 - ); - } - - *attr_waveArray1_read = waveform_ptr->get_wavedesc_descriptor()->wave_array_1; - - *attr_waveArray2_read = waveform_ptr->get_wavedesc_descriptor()->wave_array_2; - - *attr_waveArrayCount_read = data_length; - - *attr_nominalBits_read = waveform_ptr->get_wavedesc_descriptor()->nominal_bits; - - *attr_horizontalInterval_read = (double) (waveform_ptr->get_wavedesc_descriptor()->horizontal_interval); - - *attr_horizontalOffset_read = waveform_ptr->get_wavedesc_descriptor()->horizontal_offset; - - *attr_verticalGain_read = (double) (waveform_ptr->get_wavedesc_descriptor()->vertical_gain); - - *attr_verticalOffset_read = waveform_ptr->get_wavedesc_descriptor()->vertical_offset; - - std::string response = waveform_ptr->get_trigger_time_value(); - strcpy(*attr_triggerTime_read, response.c_str()); + //- DEBUG_STREAM << "In read_attr_hardware for " << attr_list.size(); + //- DEBUG_STREAM << " attribute(s)" << endl; +yat::Timer t; + DEBUG_STREAM << "\nREAD attr HW ENTERING ..." << std::endl; + + //- Get the waveform data and description( ADC resolution, horizontal and vertical infos, data length ...) + try + { + // First do a real read on the hardware + // + waveform_ptr->get_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); + FATAL_STREAM << df << std::endl; + Tango::Except::re_throw_exception(df, + "COMMUNICATION_BROKEN", + "Cannot call get_waveform_data.", + "AcquireWaveformLecroy::always_executed_hook()", + Tango::ERR + ); + } + + //- get the waveform length + try + { + //- TODO : retirer les copies dans les attr !!!! + data_length = waveform_ptr->get_wavedesc_descriptor()->wave_array_count; + //- check data does not exceed the MAX defined : + if ( data_length > MAX_WAVEFORM_DATA_LENGTH ) + data_length = MAX_WAVEFORM_DATA_LENGTH; + //- get waveform data + attr_rawWaveformData_read = waveform_ptr->get_raw_waveform_data(); + attr_verticalScaledData_read = 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, + "GET_FAILED", + "Cannot acquire the total length of the waveform data.", + "AcquireWaveformLecroy::read_attr_hardware()", + Tango::ERR + ); + } + + *attr_waveArray1_read = waveform_ptr->get_wavedesc_descriptor()->wave_array_1; + + *attr_waveArray2_read = waveform_ptr->get_wavedesc_descriptor()->wave_array_2; + + *attr_waveArrayCount_read = data_length; + + *attr_nominalBits_read = waveform_ptr->get_wavedesc_descriptor()->nominal_bits; + + *attr_horizontalInterval_read = (double) (waveform_ptr->get_wavedesc_descriptor()->horizontal_interval); + + *attr_horizontalOffset_read = waveform_ptr->get_wavedesc_descriptor()->horizontal_offset; + + *attr_verticalGain_read = (double) (waveform_ptr->get_wavedesc_descriptor()->vertical_gain); + + *attr_verticalOffset_read = waveform_ptr->get_wavedesc_descriptor()->vertical_offset; + + std::string response = waveform_ptr->get_trigger_time_value(); + strcpy(*attr_triggerTime_read, response.c_str()); + DEBUG_STREAM << "READ_HW : all data ar now updated. DONE in " << t.elapsed_msec() << " milliseconds.\n" << std::endl; } //+---------------------------------------------------------------------------- // -// method : AcquireWaveformLecroy::read_verticalScaledData -// -// description : Extract real attribute values for verticalScaledData acquisition result. +// method : AcquireWaveformLecroy::read_verticalScaledData +// +// description : Extract real attribute values for verticalScaledData acquisition result. // //----------------------------------------------------------------------------- void AcquireWaveformLecroy::read_verticalScaledData(Tango::Attribute &attr) { - //- DEBUG_STREAM << "AcquireWaveformLecroy::read_verticalScaledData(Tango::Attribute &attr) entering... "<< endl; - // Add your own code here - attr.set_value(attr_verticalScaledData_read, data_length); + //- DEBUG_STREAM << "AcquireWaveformLecroy::read_verticalScaledData(Tango::Attribute &attr) entering... "<< endl; + // Add your own code here + attr.set_value(attr_verticalScaledData_read, data_length); } //+---------------------------------------------------------------------------- // -// method : AcquireWaveformLecroy::read_triggerTime -// -// description : Extract real attribute values for triggerTime acquisition result. +// method : AcquireWaveformLecroy::read_triggerTime +// +// description : Extract real attribute values for triggerTime acquisition result. // //----------------------------------------------------------------------------- void AcquireWaveformLecroy::read_triggerTime(Tango::Attribute &attr) { - //- DEBUG_STREAM << "AcquireWaveformLecroy::read_triggerTime(Tango::Attribute &attr) entering... "<< endl; - // Add your own code here - attr.set_value(attr_triggerTime_read); + //- DEBUG_STREAM << "AcquireWaveformLecroy::read_triggerTime(Tango::Attribute &attr) entering... "<< endl; + // Add your own code here + attr.set_value(attr_triggerTime_read); } //+---------------------------------------------------------------------------- // -// method : AcquireWaveformLecroy::read_verticalOffset -// -// description : Extract real attribute values for verticalOffset acquisition result. +// method : AcquireWaveformLecroy::read_verticalOffset +// +// description : Extract real attribute values for verticalOffset acquisition result. // //----------------------------------------------------------------------------- void AcquireWaveformLecroy::read_verticalOffset(Tango::Attribute &attr) { - //- DEBUG_STREAM << "AcquireWaveformLecroy::read_verticalOffset(Tango::Attribute &attr) entering... "<< endl; - //- Add your own code here - attr.set_value(attr_verticalOffset_read); + //- DEBUG_STREAM << "AcquireWaveformLecroy::read_verticalOffset(Tango::Attribute &attr) entering... "<< endl; + //- Add your own code here + attr.set_value(attr_verticalOffset_read); } //+---------------------------------------------------------------------------- // -// method : AcquireWaveformLecroy::read_verticalGain -// -// description : Extract real attribute values for verticalGain acquisition result. +// method : AcquireWaveformLecroy::read_verticalGain +// +// description : Extract real attribute values for verticalGain acquisition result. // //----------------------------------------------------------------------------- void AcquireWaveformLecroy::read_verticalGain(Tango::Attribute &attr) { - //- DEBUG_STREAM << "AcquireWaveformLecroy::read_verticalGain(Tango::Attribute &attr) entering... "<< endl; - //- Add your own code here - attr.set_value(attr_verticalGain_read); + //- DEBUG_STREAM << "AcquireWaveformLecroy::read_verticalGain(Tango::Attribute &attr) entering... "<< endl; + //- Add your own code here + attr.set_value(attr_verticalGain_read); } //+---------------------------------------------------------------------------- // -// method : AcquireWaveformLecroy::read_horizontalOffset -// -// description : Extract real attribute values for horizontalOffset acquisition result. +// method : AcquireWaveformLecroy::read_horizontalOffset +// +// description : Extract real attribute values for horizontalOffset acquisition result. // //----------------------------------------------------------------------------- void AcquireWaveformLecroy::read_horizontalOffset(Tango::Attribute &attr) { - //- DEBUG_STREAM << "AcquireWaveformLecroy::read_horizontalOffset(Tango::Attribute &attr) entering... "<< endl; - //- Add your own code here - attr.set_value(attr_horizontalOffset_read); + //- DEBUG_STREAM << "AcquireWaveformLecroy::read_horizontalOffset(Tango::Attribute &attr) entering... "<< endl; + //- Add your own code here + attr.set_value(attr_horizontalOffset_read); } //+---------------------------------------------------------------------------- // -// method : AcquireWaveformLecroy::read_horizontalInterval -// -// description : Extract real attribute values for horizontalInterval acquisition result. +// method : AcquireWaveformLecroy::read_horizontalInterval +// +// description : Extract real attribute values for horizontalInterval acquisition result. // //----------------------------------------------------------------------------- void AcquireWaveformLecroy::read_horizontalInterval(Tango::Attribute &attr) { - //- DEBUG_STREAM << "AcquireWaveformLecroy::read_horizontalInterval(Tango::Attribute &attr) entering... "<< endl; - //- Add your own code here - attr.set_value(attr_horizontalInterval_read); + //- DEBUG_STREAM << "AcquireWaveformLecroy::read_horizontalInterval(Tango::Attribute &attr) entering... "<< endl; + //- Add your own code here + attr.set_value(attr_horizontalInterval_read); } //+---------------------------------------------------------------------------- // -// method : AcquireWaveformLecroy::read_nominalBits -// -// description : Extract real attribute values for nominalBits acquisition result. +// method : AcquireWaveformLecroy::read_nominalBits +// +// description : Extract real attribute values for nominalBits acquisition result. // //----------------------------------------------------------------------------- void AcquireWaveformLecroy::read_nominalBits(Tango::Attribute &attr) { - //- DEBUG_STREAM << "AcquireWaveformLecroy::read_nominalBits(Tango::Attribute &attr) entering... "<< endl; - //- Add your own code here - attr.set_value(attr_nominalBits_read); + //- DEBUG_STREAM << "AcquireWaveformLecroy::read_nominalBits(Tango::Attribute &attr) entering... "<< endl; + //- Add your own code here + attr.set_value(attr_nominalBits_read); } //+---------------------------------------------------------------------------- // -// method : AcquireWaveformLecroy::read_waveArrayCount -// -// description : Extract real attribute values for waveArrayCount acquisition result. +// method : AcquireWaveformLecroy::read_waveArrayCount +// +// description : Extract real attribute values for waveArrayCount acquisition result. // //----------------------------------------------------------------------------- void AcquireWaveformLecroy::read_waveArrayCount(Tango::Attribute &attr) { - //- DEBUG_STREAM << "AcquireWaveformLecroy::read_waveArrayCount(Tango::Attribute &attr) entering... "<< endl; - //- Add your own code here - attr.set_value(attr_waveArrayCount_read); + //- DEBUG_STREAM << "AcquireWaveformLecroy::read_waveArrayCount(Tango::Attribute &attr) entering... "<< endl; + //- Add your own code here + attr.set_value(attr_waveArrayCount_read); } //+---------------------------------------------------------------------------- // -// method : AcquireWaveformLecroy::read_waveArray2 -// -// description : Extract real attribute values for waveArray2 acquisition result. +// method : AcquireWaveformLecroy::read_waveArray2 +// +// description : Extract real attribute values for waveArray2 acquisition result. // //----------------------------------------------------------------------------- void AcquireWaveformLecroy::read_waveArray2(Tango::Attribute &attr) { - //- DEBUG_STREAM << "AcquireWaveformLecroy::read_waveArray2(Tango::Attribute &attr) entering... "<< endl; - // Add your own code here - attr.set_value(attr_waveArray2_read); + //- DEBUG_STREAM << "AcquireWaveformLecroy::read_waveArray2(Tango::Attribute &attr) entering... "<< endl; + // Add your own code here + attr.set_value(attr_waveArray2_read); } //+---------------------------------------------------------------------------- // -// method : AcquireWaveformLecroy::read_waveArray1 -// -// description : Extract real attribute values for waveArray1 acquisition result. +// method : AcquireWaveformLecroy::read_waveArray1 +// +// description : Extract real attribute values for waveArray1 acquisition result. // //----------------------------------------------------------------------------- void AcquireWaveformLecroy::read_waveArray1(Tango::Attribute &attr) { - //- DEBUG_STREAM << "AcquireWaveformLecroy::read_waveArray1(Tango::Attribute &attr) entering... "<< endl; - //- Add your own code here - attr.set_value(attr_waveArray1_read); + //- DEBUG_STREAM << "AcquireWaveformLecroy::read_waveArray1(Tango::Attribute &attr) entering... "<< endl; + //- Add your own code here + attr.set_value(attr_waveArray1_read); } //+---------------------------------------------------------------------------- // -// method : AcquireWaveformLecroy::read_rawWaveformData -// -// description : Extract real attribute values for rawWaveformData acquisition result. +// method : AcquireWaveformLecroy::read_rawWaveformData +// +// description : Extract real attribute values for rawWaveformData acquisition result. // //----------------------------------------------------------------------------- void AcquireWaveformLecroy::read_rawWaveformData(Tango::Attribute &attr) { - //- DEBUG_STREAM << "AcquireWaveformLecroy::read_rawWaveformData(Tango::Attribute &attr) entering... "<< endl; - //- Add your own code here - attr.set_value(attr_rawWaveformData_read, data_length); + //- DEBUG_STREAM << "AcquireWaveformLecroy::read_rawWaveformData(Tango::Attribute &attr) entering... "<< endl; + //- Add your own code here + attr.set_value(attr_rawWaveformData_read, data_length); } //+---------------------------------------------------------------------------- // // method : AcquireWaveformLecroy::lecroy_to_tango_exception() -// +// // description : Extract real attribute values from -// hardware acquisition result. +// 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(size_t 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); - + Tango::DevErrorList error_list(de.errors.size()); + error_list.length(de.errors.size()); + + for(size_t 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); + } //+------------------------------------------------------------------ @@ -694,32 +704,33 @@ Tango::DevFailed AcquireWaveformLecroy::lecroy_to_tango_exception(const lecroy:: //+------------------------------------------------------------------ Tango::DevString AcquireWaveformLecroy::write_read(Tango::DevString argin) { - // POGO has generated a method core with argout allocation. - // If you would like to use a static reference without copying, - // See "TANGO Device Server Programmer's Manual" - // (chapter : Writing a TANGO DS / Exchanging data) - //------------------------------------------------------------ - //- DEBUG_STREAM << "AcquireWaveformLecroy::write_read(): entering... !" << endl; - - // Add your own code to control device here - std::string cmd_to_send(argin); - int bytes_received = -1; - - ptr_com->TCP_WriteDevice(argin, cmd_to_send.size(), true); - - //- check if a response is expected (must found ? character) - strcpy(_deviceResponse, "No response"); - if( cmd_to_send.find('?') != std::string::npos ) - { + // POGO has generated a method core with argout allocation. + // If you would like to use a static reference without copying, + // See "TANGO Device Server Programmer's Manual" + // (chapter : Writing a TANGO DS / Exchanging data) + //------------------------------------------------------------ + //- DEBUG_STREAM << "AcquireWaveformLecroy::write_read(): entering... !" << endl; + + // Add your own code to control device here + std::string cmd_to_send(argin); + int bytes_received = -1; + + ptr_com->TCP_WriteDevice(argin, cmd_to_send.size(), true); + + //- check if a response is expected (must found ? character) + strcpy(_deviceResponse, "No response"); + if( cmd_to_send.find('?') != std::string::npos ) + { #ifdef WIN32 - Sleep(100); + Sleep(100); #else - usleep(100000); + usleep(100000); #endif - ptr_com->TCP_ReadDevice(_deviceResponse, MAX_RESPONSE_LENGTH, &bytes_received); - } + ptr_com->TCP_ReadDevice(_deviceResponse, MAX_RESPONSE_LENGTH, &bytes_received); + } - return _deviceResponse; + return _deviceResponse; } + } // namespace diff --git a/src/AcquireWaveformLecroyClass.cpp b/src/AcquireWaveformLecroyClass.cpp index 7b8beed..87ff1f7 100644 --- a/src/AcquireWaveformLecroyClass.cpp +++ b/src/AcquireWaveformLecroyClass.cpp @@ -1,3 +1,6 @@ +static const char *ClassId = "$Id: $"; +static const char *CvsPath = "$Source: $"; +static const char *SvnPath = "$HeadURL: $"; //******************************************************************************* //* Copyright (c) 2008-2014 Synchrotron SOLEIL //* All rights reserved. This program and the accompanying materials @@ -401,6 +404,7 @@ void AcquireWaveformLecroyClass::set_default_property() prop_name = "IPaddress"; prop_desc = "The IP address of the Lecroy scope to build a connection with."; prop_def = ""; + vect_data.clear(); if (prop_def.length()>0) { Tango::DbDatum data(prop_name); @@ -414,6 +418,7 @@ void AcquireWaveformLecroyClass::set_default_property() prop_name = "ChannelName"; prop_desc = "The name of channel on which the acquisition will be done.\nThis name must be composed with two caracters : (a letter followed by a number)\nC for a physical channel\nF for a calculated waveform\nM for a memorised waveform\n...\nExample : C2 (is the channel 2)\nDefault : C1 (channel 1"; prop_def = ""; + vect_data.clear(); if (prop_def.length()>0) { Tango::DbDatum data(prop_name); @@ -467,17 +472,23 @@ void AcquireWaveformLecroyClass::write_class_property() description << str_desc; data.push_back(description); - // put cvs location - string rcsId(RcsId); + // put cvs or svn location string filename(classname); - start = rcsId.find("/"); + filename += "Class.cpp"; + + // Create a string with the class ID to + // get the string into the binary + string class_id(ClassId); + + // check for cvs information + string src_path(CvsPath); + start = src_path.find("/"); if (start!=string::npos) { - filename += "Class.cpp"; - end = rcsId.find(filename); + end = src_path.find(filename); if (end>start) { - string strloc = rcsId.substr(start, end-start); + string strloc = src_path.substr(start, end-start); // Check if specific repository start = strloc.find("/cvsroot/"); if (start!=string::npos && start>0) @@ -491,12 +502,35 @@ void AcquireWaveformLecroyClass::write_class_property() data.push_back(cvs_loc); } } + // check for svn information + else + { + string src_path(SvnPath); + start = src_path.find("://"); + if (start!=string::npos) + { + end = src_path.find(filename); + if (end>start) + { + header = "$HeadURL: "; + start = header.length(); + string strloc = src_path.substr(start, (end-start)); + + Tango::DbDatum svn_loc("svn_location"); + svn_loc << strloc; + data.push_back(svn_loc); + } + } + } - // Get CVS tag revision + // Get CVS or SVN revision tag + + // CVS tag string tagname(TagName); header = "$Name: "; start = header.length(); string endstr(" $"); + end = tagname.find(endstr); if (end!=string::npos && end>start) { @@ -505,6 +539,30 @@ void AcquireWaveformLecroyClass::write_class_property() cvs_tag << strtag; data.push_back(cvs_tag); } + + // SVN tag + string svnpath(SvnPath); + header = "$HeadURL: "; + start = header.length(); + + end = svnpath.find(endstr); + if (end!=string::npos && end>start) + { + string strloc = svnpath.substr(start, end-start); + + string tagstr ("/tags/"); + start = strloc.find(tagstr); + if ( start!=string::npos ) + { + start = start + tagstr.length(); + end = strloc.find(filename); + string strtag = strloc.substr(start, end-start-1); + + Tango::DbDatum svn_tag("svn_tag"); + svn_tag << strtag; + data.push_back(svn_tag); + } + } // Get URL location string httpServ(HttpServer); diff --git a/src/AcquireWaveformLecroyClass.h b/src/AcquireWaveformLecroyClass.h index 60e9218..11b483e 100644 --- a/src/AcquireWaveformLecroyClass.h +++ b/src/AcquireWaveformLecroyClass.h @@ -68,7 +68,7 @@ namespace AcquireWaveformLecroy_ns class rawWaveformDataAttrib: public Tango::SpectrumAttr { public: - rawWaveformDataAttrib():SpectrumAttr("rawWaveformData", Tango::DEV_SHORT, Tango::READ, 150000) {}; + rawWaveformDataAttrib():SpectrumAttr("rawWaveformData", Tango::DEV_SHORT, Tango::READ, 1500000) {}; ~rawWaveformDataAttrib() {}; virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) @@ -80,7 +80,7 @@ public: class verticalScaledDataAttrib: public Tango::SpectrumAttr { public: - verticalScaledDataAttrib():SpectrumAttr("verticalScaledData", Tango::DEV_DOUBLE, Tango::READ, 150000) {}; + verticalScaledDataAttrib():SpectrumAttr("verticalScaledData", Tango::DEV_DOUBLE, Tango::READ, 1500000) {}; ~verticalScaledDataAttrib() {}; virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) @@ -228,7 +228,11 @@ public: // The AcquireWaveformLecroyClass singleton definition // -class AcquireWaveformLecroyClass : public Tango::DeviceClass +class +#ifdef WIN32 + __declspec(dllexport) +#endif + AcquireWaveformLecroyClass : public Tango::DeviceClass { public: // properties member data @@ -257,6 +261,8 @@ protected: void attribute_factory(vector<Tango::Attr *> &); void write_class_property(); void set_default_property(); + string get_cvstag(); + string get_cvsroot(); private: void device_factory(const Tango::DevVarStringArray *); diff --git a/src/LinuxSocketLecroy.cpp b/src/LinuxSocketLecroy.cpp index 9b9f3de..2a6e05c 100644 --- a/src/LinuxSocketLecroy.cpp +++ b/src/LinuxSocketLecroy.cpp @@ -1,394 +1,377 @@ -//******************************************************************************* -//* Copyright (c) 2008-2014 Synchrotron SOLEIL -//* All rights reserved. This program and the accompanying materials -//* are made available under the terms of the GNU Lesser Public License v3 -//* which accompanies this distribution, and is available at -//* http://www.gnu.org/licenses/lgpl.html -//****************************************************************************** -//****************************************************************************************** -// -// -// 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 <iostream> -#include "SocketLecroy.h" -#include <sys/time.h> -#include <time.h> -#include <stdlib.h> -#include <errno.h> -#include <string.h> -#include <sys/socket.h> -#include <sys/ioctl.h> -#include <netinet/in.h> -#include <netinet/tcp.h> -#include <arpa/inet.h> -#include <netdb.h> -#include <stdio.h> - -#include <sys/select.h> -#include <sys/types.h> -#include <unistd.h> -#include <fcntl.h> -#include <cstdio> - -static int hSocket; -static int sTimeout = 1; //- second(s) -//static int sWinsockInitFlag = false; //- not used -static char sCurrentAddress[256]; -static int sConnectedFlag = false; - -const int CMD_BUF_LEN = 8192; -static char sCommandBuffer[CMD_BUF_LEN]; - -//- init of the static instance -SocketLecroy* SocketLecroy::SL_instance = 0; //- ptr on the SocketLecroy instance - -SocketLecroy* SocketLecroy::get_instance() -{ - if( !SL_instance ) - SL_instance = new SocketLecroy(); - - return SL_instance; - -} - -void SocketLecroy::delete_instance(SocketLecroy* SL_instance) -{ - if(SL_instance) - { - 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::SocketException) -{ -struct sockaddr_in serverAddr; -int result; -const int resp = 1; -fd_set wr_set; -FD_ZERO(&wr_set); - -struct timeval tval; -unsigned long argp; -char tmpStr[256]; - - //- connection test - if (sConnectedFlag) - 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)) == -1) //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( )."); - } - - FD_SET(hSocket, &wr_set); - argp = 1;//-non blocking mode - ioctl(hSocket, FIONBIO, &argp); - - int opts; - opts = fcntl (hSocket, F_GETFL); - if (opts >= 0) - opts = (opts | O_NONBLOCK); - fcntl (hSocket, F_SETFL, opts); - //connect(hSocket, (SOCKADDR FAR *) &serverAddr, sockAddrSize); - int status = ::connect(hSocket, ( sockaddr *)&serverAddr, sizeof(serverAddr)); - - if(status < 0) // We are not connected : so retry - { - if(errno == EINPROGRESS) // But the connection is in progress - { - int nb = 0; - struct timespec time_to_sleep, time_remaining; - - while(nb++ < 5) // We will attempt to connect every 100 ms for 5 times max. - { - status = ::connect (hSocket, ( sockaddr *)&serverAddr, sizeof(serverAddr)); - - if(status != 0) // Still not connected - { - if(errno == EALREADY) // This is the right error ! - { - time_to_sleep.tv_sec = 0; - time_to_sleep.tv_nsec = 15000000L; - nanosleep(&time_to_sleep, &time_remaining); // Sleep for 150 ms - } - }// Connection is OK. - else - break; - }//TODO : throw ; // Too much attempts, so failure ! - }// TODO : throw ; // Not the right error, so failure ! - }// Connected at first attempt ! - - - result = select(hSocket, NULL, &wr_set, NULL, &tval); - argp = 0;//-blocking mode - ioctl(hSocket, FIONBIO, &argp); - //- connect to server (scope) - if (result < 0) - { - 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) throw (lecroy::SocketException) -{ - - if (sConnectedFlag) - { - close(hSocket); - sConnectedFlag = false; - } - -} - -//- Clear a connection -void SocketLecroy::TCP_ClearDevice(void) throw (lecroy::SocketException) -{ - - if ( !sConnectedFlag ) - 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::SocketException) -{ - -TCP_HEADER header; -int result, bytes_more, bytes_xferd; -char *idxPtr; - - //- test connection - if ( !sConnectedFlag ) - 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::SocketException) -{ - -TCP_HEADER header; -int result; -unsigned int accum, space_left, bytes_more, buf_count; -char tmpStr[256]; -char *idxPtr; -//fd_set rd_set = {1, {0}}; -//TIMEVAL tval; -fd_set rd_set; -FD_ZERO(&rd_set); -struct timeval tval; - - //- test connection - if ( !sConnectedFlag ) - throw lecroy::SocketException("COMMUNICATION_BROKEN ", - "Device not connected.", - "SocketLecroy::TCP_ReadDevice( )."); - - *recv_count = 0; - - if (!buf) - throw lecroy::SocketException("COMMUNICATION_BROKEN ", - "Buffer memory not allocated.", - "SocketLecroy::TCP_ReadDevice( )."); - - FD_SET(hSocket, &rd_set); - 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 < 0) - { - 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; -} - +//******************************************************************************* +//* Copyright (c) 2008-2014 Synchrotron SOLEIL +//* All rights reserved. This program and the accompanying materials +//* are made available under the terms of the GNU Lesser Public License v3 +//* which accompanies this distribution, and is available at +//* http://www.gnu.org/licenses/lgpl.html +//****************************************************************************** +//****************************************************************************************** +// +// +// 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 <iostream> +#include "SocketLecroy.h" +#include <sys/time.h> +#include <time.h> +#include <stdlib.h> +#include <errno.h> +#include <string.h> +#include <sys/socket.h> +#include <sys/ioctl.h> +#include <netinet/in.h> +#include <netinet/tcp.h> +#include <arpa/inet.h> +#include <netdb.h> +#include <stdio.h> + +#include <sys/select.h> +#include <sys/types.h> +#include <unistd.h> +#include <fcntl.h> +#include <cstdio> + +static int hSocket; +static int sTimeout = 1; //- second(s) +static char sCurrentAddress[256]; +static int sConnectedFlag = false; + +const int CMD_BUF_LEN = 8192; +static char sCommandBuffer[CMD_BUF_LEN]; + +//- init of the static instance +SocketLecroy* SocketLecroy::SL_instance = 0; //- ptr on the SocketLecroy instance + +SocketLecroy* SocketLecroy::get_instance() +{ + if( !SL_instance ) + SL_instance = new SocketLecroy(); + + return SL_instance; + +} + +void SocketLecroy::delete_instance(SocketLecroy* SL_instance) +{ + if(SL_instance) + { + 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::SocketException) +{ + struct sockaddr_in serverAddr; + int result; + const int resp = 1; + fd_set wr_set; + FD_ZERO(&wr_set); + + struct timeval tval; + unsigned long argp; + char tmpStr[256]; + + //- connection test + if (sConnectedFlag) + 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)) == -1) //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( )."); + } + + FD_SET(hSocket, &wr_set); + argp = 1;//-non blocking mode + ioctl(hSocket, FIONBIO, &argp); + + int opts; + opts = fcntl (hSocket, F_GETFL); + if (opts >= 0) + opts = (opts | O_NONBLOCK); + fcntl (hSocket, F_SETFL, opts); + //connect(hSocket, (SOCKADDR FAR *) &serverAddr, sockAddrSize); + int status = ::connect(hSocket, ( sockaddr *)&serverAddr, sizeof(serverAddr)); + + if(status < 0) // We are not connected : so retry + { + if(errno == EINPROGRESS) // But the connection is in progress + { + int nb = 0; + struct timespec time_to_sleep, time_remaining; + + while(nb++ < 5) // We will attempt to connect every 100 ms for 5 times max. + { + status = ::connect (hSocket, ( sockaddr *)&serverAddr, sizeof(serverAddr)); + + if(status != 0) // Still not connected + { + if(errno == EALREADY) // This is the right error ! + { + time_to_sleep.tv_sec = 0; + time_to_sleep.tv_nsec = 15000000L; + nanosleep(&time_to_sleep, &time_remaining); // Sleep for 150 ms + } + }// Connection is OK. + else + break; + }//TODO : throw ; // Too much attempts, so failure ! + }// TODO : throw ; // Not the right error, so failure ! + }// Connected at first attempt ! + + + result = select(hSocket, NULL, &wr_set, NULL, &tval); + argp = 0;//-blocking mode + ioctl(hSocket, FIONBIO, &argp); + //- connect to server (scope) + if (result < 0) + { + 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) throw (lecroy::SocketException) +{ + if (sConnectedFlag) + { + close(hSocket); + sConnectedFlag = false; + } +} + +//- Clear a connection +void SocketLecroy::TCP_ClearDevice(void) throw (lecroy::SocketException) +{ + if ( !sConnectedFlag ) + 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::SocketException) +{ + TCP_HEADER header; + int result, bytes_more, bytes_xferd; + char *idxPtr; + + //- test connection + if ( !sConnectedFlag ) + 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::SocketException) +{ + TCP_HEADER header; + int result; + unsigned int accum, space_left, bytes_more, buf_count; + char tmpStr[256]; + char *idxPtr; + fd_set rd_set; + FD_ZERO(&rd_set); + struct timeval tval; + + //- test connection + if ( !sConnectedFlag ) + throw lecroy::SocketException("COMMUNICATION_BROKEN ", + "Device not connected.", + "SocketLecroy::TCP_ReadDevice( )."); + + *recv_count = 0; + + if (!buf) + throw lecroy::SocketException("COMMUNICATION_BROKEN ", + "Buffer memory not allocated.", + "SocketLecroy::TCP_ReadDevice( )."); + + FD_SET(hSocket, &rd_set); + 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 < 0) + { + 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); + + //- 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/Makefile b/src/Makefile index a58f3ca..007e98e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,5 +1,8 @@ #============================================================================= +CLASS = AcquireWaveformLecroy +RELEASE = Release_$(MAJOR_VERS)_$(MINOR_VERS) + # # file : Makefile.h @@ -146,7 +149,7 @@ endif -CLASS = AcquireWaveformLecroy + @@ -156,6 +159,7 @@ SVC_OBJS = main.o \ $(CLASS)Class.o \ + $(CLASS)StateMachine.o \ $(CLASS).o @@ -194,3 +198,14 @@ install: cp $(CLASS) $(TANGO_HOME)/bin/$(BIN_DIR) + +#---------------------------------------------------- +# Tag the CVS module corresponding to this class +#---------------------------------------------------- +tag: + @cvstag "$(CLASS)-$(RELEASE)" + @make $(CLASS) + @make show_tag + +show_tag: + @cvstag -d diff --git a/src/TangoClassID.txt b/src/TangoClassID.txt new file mode 100644 index 0000000..2360029 --- /dev/null +++ b/src/TangoClassID.txt @@ -0,0 +1,11 @@ +/** + * Device Class Identification: + * + * Class Name : AcquireWaveformLecroy + * Contact : xavier.elattaoui@synchrotron-soleil.fr + * Class Family : Acquisition + * Platform : All Platforms + * Bus : Ethernet + * Manufacturer : Lecroy + * Reference : WaveForm + */ diff --git a/src/Waveform.cpp b/src/Waveform.cpp index cf6ae8c..bee1346 100644 --- a/src/Waveform.cpp +++ b/src/Waveform.cpp @@ -11,7 +11,7 @@ // september 16, 2004 : Source file of the WaveForm Class // // it contains the waveform raw data, at least there will be scaled -// +// // author : X.Elattaoui // //****************************************************************************************** @@ -22,6 +22,7 @@ #include <string.h> #include "Waveform.h" #include "SocketLecroy.h" +#include <yat/time/Timer.h> //- CTOR WaveForm_data::WaveForm_data(std::string ch_name) @@ -54,7 +55,7 @@ WaveForm_data::~WaveForm_data() std::string WaveForm_data::get_channel_name( ) throw (lecroy::WaveformException) { if( channel_name.empty() ) - throw lecroy::WaveformException("DATA_OUT_OF_RANGE ", + throw lecroy::WaveformException("DATA_OUT_OF_RANGE ", "get_channel_name( ) failed : channel_name is not initialized.", "WaveForm_data::get_channel_name( )."); @@ -72,7 +73,7 @@ void WaveForm_data::set_channel_name (std::string name) WAVEDESC_BLOCK* WaveForm_data::get_wavedesc_descriptor( ) throw (lecroy::WaveformException) { if(!waveBlockData) - throw lecroy::WaveformException("DESCRIPTOR_MEMORY_ ", + throw lecroy::WaveformException("DESCRIPTOR_MEMORY_ ", "get_waveform_data( ) method must be called before.", "WaveForm_data::get_wavedesc_descriptor( )."); @@ -87,8 +88,10 @@ char* cmdStr = 0; //int ulTrace_Size = 0; int response_length=0; unsigned short OFFSET_STRUCT = 0; - -std::cout << "\t WaveForm_data::get_waveform_data( ) -> ENTERING ..." << std::endl; + +//- FOR DEBUG : comment out Timer and STD::COUT !! +//yat::Timer t; +//std::cout << "\t WaveForm_data::get_waveform_data( ) -> ENTERING ..." << std::endl; //- init ptr WaveBlocData which point on WAVEDESC_BLOCS structure waveBlockData = 0; @@ -112,17 +115,17 @@ std::cout << "\t WaveForm_data::get_waveform_data( ) -> ENTERING ..." << std::en delete [] cmdStr; cmdStr = 0; } - + //- erase previsous data ::memset (ptrRawData, 0, MAX_WAVEFORM_DATA_LENGTH); - + //- delete previous raw data if(sh_raw_waveform_data) { delete [] sh_raw_waveform_data; sh_raw_waveform_data = 0; } - + //- delete previous scaled data if(vertical_scaled_waveform_data) { @@ -131,21 +134,22 @@ std::cout << "\t WaveForm_data::get_waveform_data( ) -> ENTERING ..." << std::en } if(!ptrRawData) - throw lecroy::WaveformException("OUT_OF_MEMORY", + throw lecroy::WaveformException("OUT_OF_MEMORY", "The pointer (ptrRawData) for the receive data can't be allocated before the read operation.", "WaveForm_data::get_waveform_data( )."); - + length = MAX_WAVEFORM_DATA_LENGTH; - + //- read the response try { SocketLecroy::get_instance( )->TCP_ReadDevice(ptrRawData,length,&response_length); +//std::cout << "\t WaveForm_data::get_waveform_data( ) -> READ DONE, respLgth = " << response_length << std::endl; } catch(const lecroy::WaveformException &) { - //- XE : - throw lecroy::WaveformException("OPERATION_FAILED", + //- XE : + throw lecroy::WaveformException("OPERATION_FAILED", "The TCP_ReadDevice() method failed.", "WaveForm_data::get_waveform_data( )."); } @@ -158,12 +162,14 @@ std::cout << "\t WaveForm_data::get_waveform_data( ) -> ENTERING ..." << std::en { //- the offset of the structure which contains the context of the waveform acquisition OFFSET_STRUCT = i; +//std::cout << "\t WaveForm_data::get_waveform_data( ) -> OFFSET AT = " << OFFSET_STRUCT << std::endl; + break; } } //- test if the OFFSET_STRUCT is found if(!OFFSET_STRUCT) - throw lecroy::WaveformException("DATA_OUT_OF_RANGE", + throw lecroy::WaveformException("DATA_OUT_OF_RANGE", "The offset of the structure is not found.", "WaveForm_data::get_waveform_data( )."); @@ -171,40 +177,44 @@ std::cout << "\t WaveForm_data::get_waveform_data( ) -> ENTERING ..." << std::en //- update the struct WAVEDESC_BLOC waveBlockData = (WAVEDESC_BLOCK*) (ptrRawData+OFFSET_STRUCT); if(!waveBlockData) - throw lecroy::WaveformException("OUT_OF_MEMORY", + throw lecroy::WaveformException("OUT_OF_MEMORY", "The pointer for the receive data can't be allocated before the read operation.", "WaveForm_data::get_waveform_data( )."); //- allocate memory for the raw data sh_raw_waveform_data = new(std::nothrow) short[waveBlockData->wave_array_count]; if(!sh_raw_waveform_data) - throw lecroy::WaveformException("OUT_OF_MEMORY", + throw lecroy::WaveformException("OUT_OF_MEMORY", "The pointer for the receive data can't be allocated before the read operation.", "WaveForm_data::get_waveform_data( )."); //- allocate memory for the vertical scaled data vertical_scaled_waveform_data = new(std::nothrow) double[waveBlockData->wave_array_count]; if(!vertical_scaled_waveform_data) - throw lecroy::WaveformException("OUT_OF_MEMORY", + throw lecroy::WaveformException("OUT_OF_MEMORY", "The pointer for the scaled data can't be allocated before the read operation.", "WaveForm_data::get_waveform_data( )."); //- copy the data before sending them - for( i=0; i<waveBlockData->wave_array_count ; i++) +//std::cout << "\t WaveForm_data::get_waveform_data( ) -> DATA Lgth = " << waveBlockData->wave_array_count << std::endl; +//std::cout << "\t WaveForm_data::get_waveform_data( ) -> descriptor idx = " << waveBlockData->wave_descriptor << std::endl; + + for(size_t idx=0; idx<waveBlockData->wave_array_count ; idx++) { - sh_raw_waveform_data[i] = (ptrRawData + OFFSET_STRUCT + waveBlockData->wave_descriptor)[i]; + sh_raw_waveform_data[idx] = (ptrRawData + OFFSET_STRUCT + waveBlockData->wave_descriptor)[idx]; //- Found in the "Remote Control Manual" : calculation of the vertical scaled data - vertical_scaled_waveform_data[i] = (waveBlockData->vertical_gain * sh_raw_waveform_data[i]) - waveBlockData->vertical_offset; + vertical_scaled_waveform_data[idx] = (waveBlockData->vertical_gain * sh_raw_waveform_data[idx]) - waveBlockData->vertical_offset; +//std::cout << "\t WaveForm_data::get_waveform_data( ) -> LOOP idx = " << idx << std::endl; } -std::cout << "\t WaveForm_data::get_waveform_data( ) -> DONE." << std::endl; +//std::cout << "\t WaveForm_data::get_waveform_data( ) -> DONE in " << t.elapsed_msec() << " milliseconds." << std::endl; } //- return the ptr on sh_raw_waveform_data ( = the waveform data acquired) short* WaveForm_data::get_raw_waveform_data () throw (lecroy::WaveformException) { if ( !sh_raw_waveform_data ) - throw lecroy::WaveformException("DESCRIPTOR_MEMORY_ ", + throw lecroy::WaveformException("DESCRIPTOR_MEMORY_ ", "get_waveform_data( ) method must be called before.", "WaveForm_data::get_raw_waveform_data( )."); @@ -216,7 +226,7 @@ short* WaveForm_data::get_raw_waveform_data () throw (lecroy::WaveformException) double* WaveForm_data::get_vertical_scaled_waveform_data( ) throw (lecroy::WaveformException) { if ( !vertical_scaled_waveform_data ) - throw lecroy::WaveformException("DESCRIPTOR_MEMORY_ ", + throw lecroy::WaveformException("DESCRIPTOR_MEMORY_ ", "get_waveform_data( ) method must be called before.", "WaveForm_data::get_vertical_scaled_waveform_data( )."); @@ -234,7 +244,7 @@ std::string WaveForm_data::get_trigger_time_value ( ) 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) @@ -243,7 +253,7 @@ std::string WaveForm_data::get_trigger_time_value ( ) 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; @@ -254,6 +264,6 @@ std::string WaveForm_data::get_trigger_time_value ( ) //- 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/Win32SocketLecroy.cpp b/src/Win32SocketLecroy.cpp index cd23217..1ef6904 100644 --- a/src/Win32SocketLecroy.cpp +++ b/src/Win32SocketLecroy.cpp @@ -1,354 +1,351 @@ -//******************************************************************************* -//* Copyright (c) 2008-2014 Synchrotron SOLEIL -//* All rights reserved. This program and the accompanying materials -//* are made available under the terms of the GNU Lesser Public License v3 -//* which accompanies this distribution, and is available at -//* http://www.gnu.org/licenses/lgpl.html -//****************************************************************************** -//****************************************************************************************** -// -// -// 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. -// -//****************************************************************************************** - -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]; - -//- 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 ) - SL_instance = new SocketLecroy(); - - return SL_instance; -} - -void SocketLecroy::delete_instance(SocketLecroy* SL_instance) -{ - if(SL_instance) - { - 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::SocketException) -{ -SOCKADDR_IN serverAddr; -int sockAddrSize = sizeof (SOCKADDR), result; -const int resp = 1; -fd_set wr_set = {1, {0}}; -TIMEVAL tval; -unsigned long argp; -char tmpStr[256]; - - //- connection test - if (sConnectedFlag) - 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); - - int status = connect(hSocket, (SOCKADDR FAR *) &serverAddr, sockAddrSize); - int error_code = WSAGetLastError(); - - //- already connected ! - if ( status && error_code == WSAEISCONN ) - return; - if( status != 0 ) // We are not connected : so retry - { - if ( error_code == WSAEINPROGRESS || error_code == WSAEWOULDBLOCK ) // But the connection is in progress - { - int nb = 0; - while ( nb++ < 5 ) // We will attempt to connect every 150 ms for 5 times max. - { - status = ::connect(hSocket, ( sockaddr *)&serverAddr, sizeof(serverAddr)); - error_code = WSAGetLastError(); - if ( status != 0 ) // Still not connected - { - if ( errno == WSAEISCONN ) // This is the right error ! - { - Sleep(150); // Sleep for 150 ms - } - }// Connection is OK. - else - break; - } //- end while // Too much attempts, so failure ! - if ( nb >= 5 ) - { - throw lecroy::SocketException("COMMUNICATION_BROKEN ", - "Too much attempt to (re)build socket connection.", - "SocketLecroy::TCP_Connect( )."); - } - }// TODO : throw ; // Not the right error, so failure ! - }// Connected at first attempt ! - - result = select(hSocket, NULL, &wr_set, NULL, &tval); - - argp = 0;//-blocking mode - ioctlsocket(hSocket, FIONBIO, &argp); - - //- connect to server (scope) - if (result == SOCKET_ERROR) - { - 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) - { - closesocket(hSocket); - sConnectedFlag = FALSE; - } -} - -//- Clear a connection -void SocketLecroy::TCP_ClearDevice(void) throw (lecroy::SocketException) -{ - if ( !sConnectedFlag ) - 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::SocketException) -{ -TCP_HEADER header; -int result, bytes_more, bytes_xferd; -char *idxPtr; - - //- test connection - if ( !sConnectedFlag ) - 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::SocketException) -{ -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 ) - throw lecroy::SocketException("COMMUNICATION_BROKEN ", - "Device not connected.", - "SocketLecroy::TCP_ReadDevice( )."); - - *recv_count = 0; - - if (!buf) - 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 || result == SOCKET_ERROR) - { - 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; -} +//******************************************************************************* +//* Copyright (c) 2008-2014 Synchrotron SOLEIL +//* All rights reserved. This program and the accompanying materials +//* are made available under the terms of the GNU Lesser Public License v3 +//* which accompanies this distribution, and is available at +//* http://www.gnu.org/licenses/lgpl.html +//****************************************************************************** +//****************************************************************************************** +// +// +// 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. +// +//****************************************************************************************** + +static int hSocket; +static int sTimeout = 15; +static char sCurrentAddress[256]; +static int sConnectedFlag = false; +const int CMD_BUF_LEN = 8192; +static char sCommandBuffer[CMD_BUF_LEN]; + +//- 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 ) + SL_instance = new SocketLecroy(); + + return SL_instance; +} + +void SocketLecroy::delete_instance(SocketLecroy* SL_instance) +{ + if(SL_instance) + { + 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::SocketException) +{ + SOCKADDR_IN serverAddr; + int sockAddrSize = sizeof (SOCKADDR), result; + const int resp = 1; + fd_set wr_set = {1, {0}}; + TIMEVAL tval; + unsigned long argp; + char tmpStr[256]; + + //- connection test + if (sConnectedFlag) + 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); + + int status = connect(hSocket, (SOCKADDR FAR *) &serverAddr, sockAddrSize); + int error_code = WSAGetLastError(); + + //- already connected ! + if ( status && error_code == WSAEISCONN ) + return; + if( status != 0 ) // We are not connected : so retry + { + if ( error_code == WSAEINPROGRESS || error_code == WSAEWOULDBLOCK ) // But the connection is in progress + { + int nb = 0; + while ( nb++ < 5 ) // We will attempt to connect every 150 ms for 5 times max. + { + status = ::connect(hSocket, ( sockaddr *)&serverAddr, sizeof(serverAddr)); + error_code = WSAGetLastError(); + if ( status != 0 ) // Still not connected + { + if ( errno == WSAEISCONN ) // This is the right error ! + { + Sleep(150); // Sleep for 150 ms + } + }// Connection is OK. + else + break; + } //- end while // Too much attempts, so failure ! + if ( nb >= 5 ) + { + throw lecroy::SocketException("COMMUNICATION_BROKEN ", + "Too much attempt to (re)build socket connection.", + "SocketLecroy::TCP_Connect( )."); + } + }// TODO : throw ; // Not the right error, so failure ! + }// Connected at first attempt ! + + result = select(hSocket, NULL, &wr_set, NULL, &tval); + + argp = 0;//-blocking mode + ioctlsocket(hSocket, FIONBIO, &argp); + + //- connect to server (scope) + if (result == SOCKET_ERROR) + { + 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) + { + closesocket(hSocket); + sConnectedFlag = FALSE; + } +} + +//- Clear a connection +void SocketLecroy::TCP_ClearDevice(void) throw (lecroy::SocketException) +{ + if ( !sConnectedFlag ) + 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::SocketException) +{ + TCP_HEADER header; + int result, bytes_more, bytes_xferd; + char *idxPtr; + + //- test connection + if ( !sConnectedFlag ) + 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::SocketException) +{ + 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 ) + throw lecroy::SocketException("COMMUNICATION_BROKEN ", + "Device not connected.", + "SocketLecroy::TCP_ReadDevice( )."); + + *recv_count = 0; + + if (!buf) + 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 || result == SOCKET_ERROR) + { + 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); + + //- 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; +} -- GitLab