Subversion Repositories f9daq

Compare Revisions

Ignore whitespace Rev 64 → Rev 65

/wavejet/trunk/wavejet.prj
0,0 → 1,459
[Project Header]
Version = 1301
Pathname = "/c/SAMO/Programi/NI/cvi/wavejet/wavejet.prj"
CVI Dir = "/c/program files (x86)/national instruments/cvi2013"
CVI Shared Dir = "/C/Program Files (x86)/National Instruments/Shared/CVI"
CVI Pub Local Dir = "/C/ProgramData/National Instruments/CVI2013"
CVI Pub Global Dir = "/C/ProgramData/National Instruments/CVI"
IVI Standard Root Dir = "/C/Program Files (x86)/IVI Foundation/IVI"
VXIplug&play Framework Dir = "/C/Program Files (x86)/IVI Foundation/VISA/winnt"
IVI Standard Root 64-bit Dir = "/C/Program Files/IVI Foundation/IVI"
VXIplug&play Framework 64-bit Dir = "/C/Program Files/IVI Foundation/VISA/win64"
Number of Files = 5
Target Type = "Executable"
Flags = 16
Copied From Locked InstrDrv Directory = False
Copied from VXIPNP Directory = False
Locked InstrDrv Name = ""
Don't Display Deploy InstrDrv Dialog = False
 
[Folders]
Instrument Files Folder Not Added Yet = True
Folder 0 = "Source Files"
FolderEx 0 = "Source Files"
Folder 1 = "Include Files"
FolderEx 1 = "Include Files"
Folder 2 = "User Interface Files"
FolderEx 2 = "User Interface Files"
Folder 3 = "Library Files"
FolderEx 3 = "Library Files"
 
[File 0001]
File Type = "CSource"
Res Id = 1
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "lecroy_tcp.c"
Path = "/c/SAMO/Programi/NI/cvi/wavejet/lecroy_tcp.c"
Exclude = False
Compile Into Object File = False
Project Flags = 0
Folder = "Source Files"
Folder Id = 0
 
[File 0002]
File Type = "CSource"
Res Id = 2
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "wavejet.c"
Path = "/c/SAMO/Programi/NI/cvi/wavejet/wavejet.c"
Exclude = False
Compile Into Object File = False
Project Flags = 0
Folder = "Source Files"
Folder Id = 0
 
[File 0003]
File Type = "Include"
Res Id = 3
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "lecroy_tcp.h"
Path = "/c/SAMO/Programi/NI/cvi/wavejet/lecroy_tcp.h"
Exclude = False
Project Flags = 0
Folder = "Include Files"
Folder Id = 1
 
[File 0004]
File Type = "User Interface Resource"
Res Id = 4
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "wavejet_ui.uir"
Path = "/c/SAMO/Programi/NI/cvi/wavejet/wavejet_ui.uir"
Exclude = False
Project Flags = 0
Folder = "User Interface Files"
Folder Id = 2
 
[File 0005]
File Type = "Library"
Res Id = 5
Path Is Rel = True
Path Rel To = "CVI"
Path Rel To Override = "CVI"
Path Rel Path = "sdk/lib/msvc/WS2_32.Lib"
Path = "/c/Program Files (x86)/National Instruments/CVI2013/sdk/lib/msvc/WS2_32.Lib"
Exclude = False
Project Flags = 0
Folder = "Library Files"
Folder Id = 3
 
[Custom Build Configs]
Num Custom Build Configs = 0
 
[Default Build Config Debug]
Config Name = "Debug"
Is 64-Bit = False
Is Release = False
Default Calling Convention = "cdecl"
Optimization Level = "No optimizations"
Require Prototypes = True
Show Warning IDs in Build Output = False
Selected Warning Level = "None"
Warning List None = "4,9,84,105,106,107,108,109,110"
Warning List Common = ""
Warning List Extended = ""
Warning List All = ""
Warning Mode = 0
Enable Unreferenced Identifiers Warning = False
Enable Pointer Mismatch Warning = False
Enable Unreachable Code Warning = False
Enable Assignment In Conditional Warning = False
Uninitialized Locals Compile Warning = "Aggressive"
Require Return Values = True
Enable C99 Extensions = False
Enable OpenMP Extensions = False
Stack Size = 250000
Stack Reserve = 1048576
Stack Commit = 4096
Image Base Address = 4194304
Image Base Address x64 = 4194304
Compiler Defines = "/DWIN32_LEAN_AND_MEAN"
Sign = False
Sign Store = ""
Sign Certificate = ""
Sign Timestamp URL = ""
Sign URL = ""
Manifest Embed = False
Icon File Is Rel = False
Icon File = ""
Application Title = ""
Use IVI Subdirectories for Import Libraries = False
Use VXIPNP Subdirectories for Import Libraries = False
Use Dflt Import Lib Base Name = True
Where to Copy DLL = "Do not copy"
Custom Directory to Copy DLL Is Rel = False
Custom Directory to Copy DLL = ""
Generate Source Documentation = "None"
Runtime Support = "Full Runtime Support"
Runtime Binding = "Shared"
Embed Project .UIRs = False
Generate Map File = False
Embed Timestamp = True
Create Console Application = False
Using LoadExternalModule = True
DLL Exports = "Include File Symbols"
Register ActiveX Server = False
Numeric File Version = "1,0,0,0"
Numeric Prod Version = "1,0,0,0"
Comments = ""
Comments Ex = ""
Company Name = ""
Company Name Ex = "%company"
File Description = "wavejet_dbg (Debug x86)"
File Description Ex = "%application (%rel_dbg %arch)"
File Version = "1.0"
File Version Ex = "%f1.%f2"
Internal Name = "wavejet_dbg"
Internal Name Ex = "%basename"
Legal Copyright = "Copyright © 2014"
Legal Copyright Ex = "Copyright © %company %Y"
Legal Trademarks = ""
Legal Trademarks Ex = ""
Original Filename = "wavejet_dbg.exe"
Original Filename Ex = "%filename"
Private Build = ""
Private Build Ex = ""
Product Name = " wavejet_dbg"
Product Name Ex = "%company %application"
Product Version = "1.0"
Product Version Ex = "%p1.%p2"
Special Build = ""
Special Build Ex = ""
Add Type Lib To DLL = False
Include Type Lib Help Links = False
TLB Help Style = "HLP"
Type Lib FP File Is Rel = False
Type Lib FP File = ""
 
[Default Build Config Release]
Config Name = "Release"
Is 64-Bit = False
Is Release = True
Default Calling Convention = "cdecl"
Optimization Level = "No optimizations"
Require Prototypes = True
Show Warning IDs in Build Output = False
Selected Warning Level = "None"
Warning List None = "4,9,84,105,106,107,108,109,110"
Warning List Common = ""
Warning List Extended = ""
Warning List All = ""
Warning Mode = 0
Enable Unreferenced Identifiers Warning = False
Enable Pointer Mismatch Warning = False
Enable Unreachable Code Warning = False
Enable Assignment In Conditional Warning = False
Uninitialized Locals Compile Warning = "Aggressive"
Require Return Values = True
Enable C99 Extensions = False
Enable OpenMP Extensions = False
Stack Size = 250000
Stack Reserve = 1048576
Stack Commit = 4096
Image Base Address = 4194304
Image Base Address x64 = 4194304
Compiler Defines = "/DWIN32_LEAN_AND_MEAN"
Sign = False
Sign Store = ""
Sign Certificate = ""
Sign Timestamp URL = ""
Sign URL = ""
Manifest Embed = False
Icon File Is Rel = False
Icon File = ""
Application Title = ""
Use IVI Subdirectories for Import Libraries = False
Use VXIPNP Subdirectories for Import Libraries = False
Use Dflt Import Lib Base Name = True
Where to Copy DLL = "Do not copy"
Custom Directory to Copy DLL Is Rel = False
Custom Directory to Copy DLL = ""
Generate Source Documentation = "None"
Runtime Support = "Full Runtime Support"
Runtime Binding = "Shared"
Embed Project .UIRs = False
Generate Map File = False
Embed Timestamp = True
Create Console Application = False
Using LoadExternalModule = True
DLL Exports = "Include File Symbols"
Register ActiveX Server = False
Add Type Lib To DLL = False
Include Type Lib Help Links = False
TLB Help Style = "HLP"
Type Lib FP File Is Rel = False
Type Lib FP File = ""
 
[Default Build Config Debug64]
Config Name = "Debug64"
Is 64-Bit = True
Is Release = False
Default Calling Convention = "cdecl"
Optimization Level = "No optimizations"
Require Prototypes = True
Show Warning IDs in Build Output = False
Selected Warning Level = "None"
Warning List None = "4,9,84,105,106,107,108,109,110"
Warning List Common = ""
Warning List Extended = ""
Warning List All = ""
Warning Mode = 0
Enable Unreferenced Identifiers Warning = False
Enable Pointer Mismatch Warning = False
Enable Unreachable Code Warning = False
Enable Assignment In Conditional Warning = False
Uninitialized Locals Compile Warning = "Aggressive"
Require Return Values = True
Enable C99 Extensions = False
Enable OpenMP Extensions = False
Stack Size = 250000
Stack Reserve = 1048576
Stack Commit = 4096
Image Base Address = 4194304
Image Base Address x64 = 4194304
Compiler Defines = "/DWIN32_LEAN_AND_MEAN"
Sign = False
Sign Store = ""
Sign Certificate = ""
Sign Timestamp URL = ""
Sign URL = ""
Manifest Embed = False
Icon File Is Rel = False
Icon File = ""
Application Title = ""
Use IVI Subdirectories for Import Libraries = False
Use VXIPNP Subdirectories for Import Libraries = False
Use Dflt Import Lib Base Name = True
Where to Copy DLL = "Do not copy"
Custom Directory to Copy DLL Is Rel = False
Custom Directory to Copy DLL = ""
Generate Source Documentation = "None"
Runtime Support = "Full Runtime Support"
Runtime Binding = "Shared"
Embed Project .UIRs = False
Generate Map File = False
Embed Timestamp = True
Create Console Application = False
Using LoadExternalModule = True
DLL Exports = "Include File Symbols"
Register ActiveX Server = False
Add Type Lib To DLL = False
Include Type Lib Help Links = False
TLB Help Style = "HLP"
Type Lib FP File Is Rel = False
Type Lib FP File = ""
 
[Default Build Config Release64]
Config Name = "Release64"
Is 64-Bit = True
Is Release = True
Default Calling Convention = "cdecl"
Optimization Level = "No optimizations"
Require Prototypes = True
Show Warning IDs in Build Output = False
Selected Warning Level = "None"
Warning List None = "4,9,84,105,106,107,108,109,110"
Warning List Common = ""
Warning List Extended = ""
Warning List All = ""
Warning Mode = 0
Enable Unreferenced Identifiers Warning = False
Enable Pointer Mismatch Warning = False
Enable Unreachable Code Warning = False
Enable Assignment In Conditional Warning = False
Uninitialized Locals Compile Warning = "Aggressive"
Require Return Values = True
Enable C99 Extensions = False
Enable OpenMP Extensions = False
Stack Size = 250000
Stack Reserve = 1048576
Stack Commit = 4096
Image Base Address = 4194304
Image Base Address x64 = 4194304
Compiler Defines = "/DWIN32_LEAN_AND_MEAN"
Sign = False
Sign Store = ""
Sign Certificate = ""
Sign Timestamp URL = ""
Sign URL = ""
Manifest Embed = False
Icon File Is Rel = False
Icon File = ""
Application Title = ""
Use IVI Subdirectories for Import Libraries = False
Use VXIPNP Subdirectories for Import Libraries = False
Use Dflt Import Lib Base Name = True
Where to Copy DLL = "Do not copy"
Custom Directory to Copy DLL Is Rel = False
Custom Directory to Copy DLL = ""
Generate Source Documentation = "None"
Runtime Support = "Full Runtime Support"
Runtime Binding = "Shared"
Embed Project .UIRs = False
Generate Map File = False
Embed Timestamp = True
Create Console Application = False
Using LoadExternalModule = True
DLL Exports = "Include File Symbols"
Register ActiveX Server = False
Add Type Lib To DLL = False
Include Type Lib Help Links = False
TLB Help Style = "HLP"
Type Lib FP File Is Rel = False
Type Lib FP File = ""
 
[Compiler Options]
Default Calling Convention = "cdecl"
Require Prototypes = True
Require Return Values = True
Enable Pointer Mismatch Warning = False
Enable Unreachable Code Warning = False
Enable Unreferenced Identifiers Warning = False
Enable Assignment In Conditional Warning = False
O Option Compatible With 5.0 = False
Enable C99 Extensions = False
Uninitialized Locals Compile Warning = "Conservative"
Precompile Prefix Header = False
Prefix Header File = ""
 
[Run Options]
Stack Size = 250000
Stack Commit = 4096
Image Base Address = 4194304
Image Base Address x64 = 4194304
 
[Compiler Defines]
Compiler Defines = "/DWIN32_LEAN_AND_MEAN"
 
[Create Executable]
Executable File_Debug Is Rel = True
Executable File_Debug Rel To = "Project"
Executable File_Debug Rel Path = "wavejet_dbg.exe"
Executable File_Debug = "/c/SAMO/Programi/NI/cvi/wavejet/wavejet_dbg.exe"
Executable File_Release Is Rel = True
Executable File_Release Rel To = "Project"
Executable File_Release Rel Path = "wavejet.exe"
Executable File_Release = "/c/SAMO/Programi/NI/cvi/wavejet/wavejet.exe"
Executable File_Debug64 Is Rel = True
Executable File_Debug64 Rel To = "Project"
Executable File_Debug64 Rel Path = "wavejet.exe"
Executable File_Debug64 = "/c/SAMO/Programi/NI/cvi/wavejet/wavejet.exe"
Executable File_Release64 Is Rel = True
Executable File_Release64 Rel To = "Project"
Executable File_Release64 Rel Path = "wavejet.exe"
Executable File_Release64 = "/c/SAMO/Programi/NI/cvi/wavejet/wavejet.exe"
Icon File Is Rel = False
Icon File = ""
Application Title = ""
DLL Exports = "Include File Symbols"
Use IVI Subdirectories for Import Libraries = False
Use VXIPNP Subdirectories for Import Libraries = False
Use Dflt Import Lib Base Name = True
Where to Copy DLL = "Do not copy"
Custom Directory to Copy DLL Is Rel = False
Custom Directory to Copy DLL = ""
Generate Source Documentation = "None"
Add Type Lib To DLL = False
Include Type Lib Help Links = False
TLB Help Style = "HLP"
Type Lib FP File Is Rel = False
Type Lib FP File = ""
Type Lib Guid = ""
Runtime Support = "Full Runtime Support"
Instrument Driver Support Only = False
Embed Project .UIRs = False
Generate Map File = False
 
[External Compiler Support]
UIR Callbacks File Option = 0
Using LoadExternalModule = False
Create Project Symbols File = True
UIR Callbacks Obj File Is Rel = False
UIR Callbacks Obj File = ""
Project Symbols H File Is Rel = False
Project Symbols H File = ""
Project Symbols Obj File Is Rel = False
Project Symbols Obj File = ""
 
[ActiveX Server Options]
Specification File Is Rel = False
Specification File = ""
Source File Is Rel = False
Source File = ""
Include File Is Rel = False
Include File = ""
IDL File Is Rel = False
IDL File = ""
Register ActiveX Server = False
 
[Signing Info]
Sign = False
Sign Debug Build = False
Store = ""
Certificate = ""
Timestamp URL = ""
URL = ""
 
[Manifest Info]
Embed = False
 
[tpcSection]
tpcEnabled = 0
tpcOverrideEnvironment = 0
tpcEnabled x64 = 0
tpcOverrideEnvironment x64 = 0
 
/wavejet/trunk/wavejet.cws
0,0 → 1,183
[Workspace Header]
Version = 1301
Pathname = "/c/SAMO/Programi/NI/cvi/wavejet/wavejet.cws"
CVI Dir = "/c/program files (x86)/national instruments/cvi2013"
CVI Shared Dir = "/C/Program Files (x86)/National Instruments/Shared/CVI"
CVI Pub Local Dir = "/C/ProgramData/National Instruments/CVI2013"
CVI Pub Global Dir = "/C/ProgramData/National Instruments/CVI"
IVI Standard Root Dir = "/C/Program Files (x86)/IVI Foundation/IVI"
IVI Standard Root 64-bit Dir = "/C/Program Files/IVI Foundation/IVI"
VXIplug&play Framework Dir = "/C/Program Files (x86)/IVI Foundation/VISA/winnt"
VXIplug&play Framework 64-bit Dir = "/C/Program Files/IVI Foundation/VISA/win64"
Number of Projects = 1
Active Project = 1
Project 0001 = "wavejet.prj"
Project 0001 Folder Library Files Collapsed = True
Project 0001 FolderId 3 Collapsed = True
Drag Bar Left = 198
Window Top = 23
Window Left = 7
Window Bottom = 761
Window Right = 1359
Maximized = False
Maximized Children = True
Max32 Number Of Errors = 20
Track Include File Dependencies = True
Prompt For Missing Includes = True
Stop On First Error File = False
Bring Up Err Win At Start = True
Bring Up Err Win For Errors = False
Save Changes Before Running = "Always"
Save Changes Before Compiling = "Always"
Hide Windows = False
Break At First Statement = False
Sort Type = "File Name"
Number of Opened Files = 3
Window Confinement Region Enabled = True
MainColumnWidth = 181
FileDateColumnWidth = 70
FileSizeColumnWidth = 70
 
[Project Header 0001]
Version = 1301
Don't Update DistKit = False
Platform Code = 4
Build Configuration = "Debug"
Warn User If Debugging Release = 1
Batch Build Release = False
Batch Build Debug = False
 
[File 0001]
Path = "/c/SAMO/Programi/NI/cvi/wavejet/wavejet.c"
File Type = "CSource"
Disk Date = 3489996894
In Projects = "1,"
Window Top = 24
Window Left = 8
Window Height = -16281
Window Z-Order = 2
Source Window State = "1,126,127,127,0,0,0,0,3,80,0,0,0,0,0,25,117,0,126,25,349,683,1,0,"
 
[File 0002]
Path = "/c/SAMO/Programi/NI/cvi/wavejet/lecroy_tcp.c"
File Type = "CSource"
Disk Date = 3452418921
In Projects = "1,"
Window Top = 112
Window Left = 56
Window Height = -16281
Window Z-Order = 3
Source Window State = "1,0,0,0,0,0,0,0,0,80,0,0,0,0,0,25,0,0,233,28,349,683,1,0,"
 
[File 0003]
Path = "/c/SAMO/Programi/NI/cvi/wavejet/wavejet_ui.uir"
File Type = "User Interface Resource"
Disk Date = 3489996985
In Projects = "1,"
Window Top = 46
Window Left = 20
Window Height = 349
Window Width = 683
Window Z-Order = 1
 
[File 0004]
Path = "/c/SAMO/Programi/NI/cvi/wavejet/lecroy_tcp.h"
File Type = "Include"
Disk Date = 3452279829
In Projects = "1,"
Source Window State = "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"
 
[File 0005]
Path = "/c/program files (x86)/national instruments/cvi2013/sdk/lib/msvc/WS2_32.Lib"
File Type = "Library"
Disk Date = 3472621200
In Projects = "1,"
 
[Default Build Config 0001 Debug]
Generate Browse Info = True
Enable Uninitialized Locals Runtime Warning = True
Batch Build = False
Profile = "Disabled"
Debugging Level = "Standard"
Execution Trace = "Disabled"
Command Line Args = ""
Working Directory = ""
Environment Options = ""
External Process Path = ""
 
[Default Build Config 0001 Release]
Generate Browse Info = True
Enable Uninitialized Locals Runtime Warning = True
Batch Build = False
Profile = "Disabled"
Debugging Level = "Standard"
Execution Trace = "Disabled"
Command Line Args = ""
Working Directory = ""
Environment Options = ""
External Process Path = ""
 
[Default Build Config 0001 Debug64]
Generate Browse Info = True
Enable Uninitialized Locals Runtime Warning = True
Batch Build = False
Profile = "Disabled"
Debugging Level = "Standard"
Execution Trace = "Disabled"
Command Line Args = ""
Working Directory = ""
Environment Options = ""
External Process Path = ""
 
[Default Build Config 0001 Release64]
Generate Browse Info = True
Enable Uninitialized Locals Runtime Warning = True
Batch Build = False
Profile = "Disabled"
Debugging Level = "Standard"
Execution Trace = "Disabled"
Command Line Args = ""
Working Directory = ""
Environment Options = ""
External Process Path = ""
 
[Build Dependencies 0001]
Number of Dependencies = 0
 
[Build Options 0001]
Generate Browse Info = True
Enable Uninitialized Locals Runtime Warning = True
Execution Trace = "Disabled"
Profile = "Disabled"
Debugging Level = "Standard"
Break On Library Errors = True
Break On First Chance Exceptions = False
 
[Execution Target 0001]
Execution Target Address = "Local desktop computer"
Execution Target Port = 0
Execution Target Type = 0
 
[SCC Options 0001]
Use global settings = True
SCC Provider = ""
SCC Project = ""
Local Path = ""
Auxiliary Path = ""
Perform Same Action For .h File As For .uir File = "Ask"
Perform Same Action For .cds File As For .prj File = "Ask"
Username = ""
Comment = ""
Use Default Username = False
Use Default Comment = False
Suppress CVI Error Messages = False
Always show confirmation dialog = True
 
[DLL Debugging Support 0001]
External Process Path = ""
 
[Command Line Args 0001]
Command Line Args = ""
Working Directory = ""
Environment Options = ""
 
/wavejet/trunk/wavejet_ui.uir
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/lecroy_tcp.c
===================================================================
--- trunk/lecroy_tcp.c (nonexistent)
+++ trunk/lecroy_tcp.c (revision 65)
@@ -0,0 +1,300 @@
+/**************************************************************************
+lecroy_tcp.c
+Version 1.00
+Copyright (C) 2003 Steve D. Sharples
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+The author's email address is steve.sharples@nottingham.ac.uk
+
+***************************************************************************
+
+Libraries for communicating with a LeCroy scope (and perhaps other things)
+via TCP/IP. Based on "net_con.cpp" by LeCroy, also using bits of code from
+an ariticle in October 2001 issue of "Linux Magazine" see:
+http://www.linux-mag.com/2001-10/compile_01.html
+
+The original "net_con.cpp" code was Copyright 1998 LeCroy Corporation, and
+written by Ricardo Palacio. This code was passed on to me (Steve
+Sharples) by LeCroy so that I could write drivers to communicate with my
+new LT584L DSO from my Linux machine. LeCroy corporation have agreed to
+allow the release of the UNIX/Linux code (since it is based on their code)
+under the GNU General Public License in the hope that it will be useful
+to others. THEY (LECROY) OBVIOUSLY CANNOT SUPPORT THIS CODE, although if
+I were them I'd be starting to think seriously about supporting the Linux/
+UNIX architectures.
+
+See "lecroy_tcp.h" for additional comments and usage
+
+**************************************************************************/
+// modified for LabWindows CVI by Samo 23. 5. 2013
+
+#include <ansi_c.h>
+#include <stdlib.h>
+#include <winsock2.h>
+#include "lecroy_tcp.h"
+
+//#define DEBUG
+
+static WSADATA WSA_data;
+static BOOL LECROY_TCP_connected_flag = FALSE;
+
+typedef struct { /* defines LeCroy VICP protocol (TCP header) */
+ unsigned char bEOI_Flag;
+ unsigned char reserved[3];
+ int iLength;
+} LECROY_TCP_HEADER;
+
+int LECROY_TCP_write(int sockfd, char *buf) {
+
+ LECROY_TCP_HEADER header;
+ int result, bytes_more, bytes_xferd,tmp;
+ char *idxPtr;
+
+ BOOL eoi_flag = TRUE;
+ int len = strlen(buf);
+
+ if (LECROY_TCP_connected_flag != TRUE) return -1;
+#ifdef DEBUG
+ printf("Sending %s\n",buf);
+#endif
+ /* set the header info */
+ header.bEOI_Flag = LECROY_DATA_FLAG;
+ /* following line retained because the original "write" function
+ contained an extra argument of eoi_flag, which I've set to
+ be always TRUE */
+ header.bEOI_Flag |= (eoi_flag)? LECROY_EOI_FLAG:0;
+ header.reserved[0] = 1; /* see LeCroy documentation about these */
+ header.reserved[1] = 0;
+ header.reserved[2] = 0;
+ header.iLength = htonl(len);
+
+
+ /* write the header first */
+ //tmp=write(sockfd, (char *) &header, sizeof(LECROY_TCP_HEADER));
+ tmp=send(sockfd, (char *) &header, sizeof(LECROY_TCP_HEADER),0);
+ if (tmp!=sizeof(LECROY_TCP_HEADER)) {
+ printf("Could not write the header successfully, returned: %d\n",tmp);
+ return -1;
+ }
+
+ bytes_more = len;
+ idxPtr = buf;
+ bytes_xferd = 0;
+ while (1) {
+ /* then write the rest of the block */
+ idxPtr = buf + bytes_xferd;
+ //result=write (sockfd, (char *) idxPtr, bytes_more);
+ result=send (sockfd, (char *) idxPtr, bytes_more,0);
+ if (result<0) {
+ printf("Could not write the rest of the block successfully, returned: %d\n",tmp);
+ return -1;
+ }
+ bytes_xferd += result;
+ bytes_more -= result;
+ if (bytes_more <= 0) break;
+ }
+ return 0;
+}
+
+int LECROY_TCP_read(int sockfd, char *buf, int len, int allowable_time) {
+
+ LECROY_TCP_HEADER header;
+ char tmpStr[512];
+ int result, accum, space_left, bytes_more, buf_count;
+ char *idxPtr;
+
+ fd_set rfds;
+ struct timeval tval;
+
+ tval.tv_sec = allowable_time;
+ tval.tv_usec = 0;
+
+ if (LECROY_TCP_connected_flag != TRUE) return -1;
+ FD_ZERO(&rfds);
+ FD_SET(sockfd, &rfds);
+
+ if (buf==NULL) return -1;
+
+ memset(buf, 0, len);
+ buf_count = 0;
+ space_left = len;
+
+ while (1) {
+ /* block here until data is received of timeout expires */
+ result = select((sockfd+1), &rfds, NULL, NULL, &tval);
+ if (result < 0) {
+ LECROY_TCP_disconnect(sockfd);
+ printf("Read timeout\n");
+ return -1;
+ }
+ /* get the header info first */
+ accum = 0;
+ while (1) {
+ memset(&header, 0, sizeof(LECROY_TCP_HEADER));
+
+ if ((result = recv(sockfd, (char *) &header + accum, sizeof(header) - accum, 0)) < 0) {
+ LECROY_TCP_disconnect(sockfd);
+ printf("Unable to receive header info from the server.\n");
+ return -1;
+ }
+ 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;
+ sprintf(tmpStr, "Read buffer size (%d bytes) is too small\n", len);
+ printf(tmpStr);
+ }
+
+ /* read the rest of the block */
+ accum = 0;
+ while (1) {
+ idxPtr = buf + (buf_count + accum);
+ bytes_more = header.iLength - accum;
+ if ((space_left-accum) < LECROY_TCP_MINIMUM_PACKET_SIZE) {
+ LECROY_TCP_disconnect(sockfd);
+ printf("Read buffer needs to be adjusted, must be minimum of %d bytes\n",
+ LECROY_TCP_MINIMUM_PACKET_SIZE);
+ return -1;
+ }
+
+ if ((result = recv(sockfd, (char *) idxPtr, (bytes_more>2048)?2048:bytes_more,0)) < 0) {
+ LECROY_TCP_disconnect(sockfd);
+ printf("Unable to receive data from the server.\n");
+ return -1;
+ }
+
+
+ accum += result;
+ if (accum >= header.iLength) break;
+ if ((accum + buf_count) >= len) break;
+ }
+ buf_count += accum;
+ space_left -= accum;
+
+ if (header.bEOI_Flag & LECROY_EOI_FLAG) break;
+ if (space_left <= 0) break;
+ }
+#ifdef DEBUG
+ printf("Received %s\n",buf);
+#endif
+ return 0;
+}
+
+int LECROY_TCP_connect(char *ip_address, int allowable_delay) {
+
+ int sockfd;
+ int tmp;
+ const int disable=1;
+
+ struct sockaddr_in addr;
+
+ /* bomb out if we've already connected. At time of coding, many LeCroy
+ instruments (including my own scope) can support only one client at
+ a time */
+ if (LECROY_TCP_connected_flag==TRUE) {
+ printf("ERROR! lecroy_tcp: LECROY_TCP_connected_flag==TRUE!\n");
+ return -2;
+ }
+
+ tmp=WSAStartup(2,&WSA_data);
+ if (tmp!=0) {
+ printf("ERROR! Socket library ...!\n");
+ return -1;
+ }
+ //printf("Socket library ...\n");
+
+ sockfd = socket (PF_INET, SOCK_STREAM, 0);
+ /* Clear out the address struct. */
+ /* not sure this is entirely necessary.... */
+ // samo bzero (&addr, sizeof (addr));
+
+ /* Initialize the values of the address struct including
+ port number and IP address. */
+ addr.sin_family = AF_INET;
+ addr.sin_port = htons (LECROY_SERVER_PORT);
+ addr.sin_addr.s_addr = inet_addr(ip_address);
+
+ /* The following two lines are necessary so that the program doesn't
+ hang around waiting forever if the scope is turned off. You'd
+ think there would be something you could set in the socket options,
+ wouldn't you? Well, there is, but to quote the socket(7) man pages:
+
+------------------------------------------------------------------------------
+ SOCKET OPTIONS
+ SO_RCVTIMEO and SO_SNDTIMEO
+ Specify the sending or receiving timeouts until reporting an
+ error. They are fixed to a protocol specific setting in Linux
+ and cannot be read or written. Their functionality can be emu-
+ lated using alarm(2) or setitimer(2).
+------------------------------------------------------------------------------
+
+ So, a timer is set with alarm(), and SIGALRM is caught by the
+ "LECROY_TCP_bored_now(int sig)" function. Upon successful
+ connection, however, the alarm is cancelled with "alarm(0)" */
+
+ // samo signal(SIGALRM,LECROY_TCP_bored_now);
+ // samo alarm(allowable_delay);
+
+ /* Connect to the server. */
+ tmp=connect(sockfd, (struct sockaddr *)&addr, sizeof (addr));
+ // samo alarm(0);
+ if (tmp<0){
+ tmp=WSACleanup();
+ printf("ERROR! lecroy_tcp: could not connect to the scope!\n");
+ return -1;
+ }
+ LECROY_TCP_connected_flag=TRUE;
+
+ /* Ok, now we're all connected */
+
+ /* THE FOLLOWING LINE IS ARCHITECTURE DEPENDENT
+ and is not at all necessary to make a connection and may be
+ safely removed */
+
+ LECROY_TCP_write(sockfd,"CORD LO\n");
+
+ /* It sets the 16-bit word transfer byte order to LSB,MSB (ie native
+ Intel format). This makes things easier to interpret, so it's a
+ sufficiently-useful thing to add in the connect function. Can be
+ commented out obviously. For motorola-based systems, use:
+ LECROY_TCP_write(sockfd,"CORD HI\n");
+ Obviously there'll be some way of working out at compile-time, but
+ I don't know how! --- sds, 6/5/03 */
+
+ return sockfd;
+}
+/*
+void LECROY_TCP_bored_now(int sig) {
+
+ printf("Well, I got bored waiting to connect, so I'm going to quit. Bye!\n");
+ exit(1);
+ }
+*/
+int LECROY_TCP_disconnect(int sockfd) {
+
+ if (LECROY_TCP_connected_flag !=TRUE) return -1;
+ closesocket(sockfd);
+ WSACleanup();
+ LECROY_TCP_connected_flag=FALSE;
+ return 0;
+}
+
Index: trunk/wavejet.c
===================================================================
--- trunk/wavejet.c (nonexistent)
+++ trunk/wavejet.c (revision 65)
@@ -0,0 +1,303 @@
+#include <formatio.h>
+#include <userint.h>
+#include <ansi_c.h>
+#include <utility.h>
+#include <tcpsupp.h>
+#include <cvirte.h>
+
+#include "lecroy_tcp.h"
+#include "wavejet_ui.h"
+
+//#define SCOPE_IP "192.168.1.11"
+#define MAX_TCP_CONNECT 5 /* time in secs to get a connection */
+#define MAX_TCP_READ 3 /* time in secs to wait for the DSO
+ to respond to a read request */
+#define MAX_ST 512 /* maximum message string. no picked from thin air */
+
+#define MAX_THREADS 10
+
+static int sockfd;
+static int p1h, pID, rID, tfID;
+static int poolHandle = 0;
+
+
+
+int CVICALLBACK cb_timer (int panel, int control, int event, void *callbackData,
+ int eventData1, int eventData2)
+{
+ QueueUserEvent (9000, p1h, P1_TIMER);
+ return (0);
+}
+/*
+int CVICALLBACK daq_run(void *functionData)
+{
+ return (0);
+}
+*/
+
+int __stdcall WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
+ LPSTR lpszCmdLine, int nCmdShow)
+{
+ int i;
+ int status,connected,displen;
+ int refon;
+ int tmpindex,tmpint;
+ int p1_tra[5]={P1_TRA_1,P1_TRA_2,P1_TRA_3,P1_TRA_4,0};
+ int p1_vdiv[5]={P1_VDIV_1,P1_VDIV_2,P1_VDIV_3,P1_VDIV_4,0};
+ int p1_bwl[5]={P1_BWL_1,P1_BWL_2,P1_BWL_3,P1_BWL_4,0};
+ float tmpfloat;
+ char ip_address[50],tmpstr[100];
+ char outbuf[MAX_ST],inbuf[MAX_ST];
+ char display[500000],imgfn[300],ftyp[10];
+
+ FILE *imgfp;
+
+ connected=0;
+
+ if (InitCVIRTE (hInstance, 0, 0) == 0)
+ return -1; /* out of memory */
+
+ SetSleepPolicy(VAL_SLEEP_MORE);
+ CmtNewThreadPool (MAX_THREADS, &poolHandle);
+
+ SetStdioWindowOptions (1000, 0, 0);
+ SetStdioWindowSize (150, 600);
+ SetStdioWindowPosition (100, 20);
+
+ if ((p1h = LoadPanel (0, "wavejet_ui.uir", P1)) < 0) return -1;
+ DisplayPanel (p1h);
+
+
+// SetCtrlAttribute (p1h, P1_PLCH, ATTR_MAX_VALUE, NCH-1);
+ QueueUserEvent (1000, p1h, P1_IPF);
+
+ do {
+ GetUserEvent (1, &pID, &rID);
+ switch (rID) {
+ case P1_UPDATE:
+ if (!connected) break;
+ sprintf(outbuf,"TSCRN? BMP\n");
+ LECROY_TCP_write(sockfd, outbuf);
+ LECROY_TCP_read(sockfd, display, sizeof(display), MAX_TCP_READ);
+ sscanf(display,"# %1d %8d",&status,&displen);
+ imgfp = fopen ("tmp.bmp", "wb");
+ status = fwrite (&display[10], 1, displen, imgfp);
+ status = fclose (imgfp);
+ status = DisplayImageFile (p1h, P1_DISPLAY, "tmp.bmp");
+ break;
+ case P1_DSAV:
+ if (!connected) break;
+ status = GetCtrlVal (p1h, P1_DSAV, tmpstr);
+ sprintf(ftyp,"*.%s",tmpstr);
+ StringLowerCase (ftyp);
+ status = FileSelectPopup ("", ftyp, ftyp,"Hard copy", VAL_SAVE_BUTTON,
+ 0, 1, 1, 1, imgfn);
+ if (status<1) break;
+ sprintf(outbuf,"TSCRN? %s\n",tmpstr);
+ LECROY_TCP_write(sockfd, outbuf);
+ LECROY_TCP_read(sockfd, display, sizeof(display), MAX_TCP_READ);
+ sscanf(display,"# %1d %8d",&status,&displen);
+ imgfp = fopen (imgfn, "wb");
+ status = fwrite (&display[10], 1, displen, imgfp);
+ status = fclose (imgfp);
+ break;
+ case P1_GET_SETUP:
+ if (!connected) break;
+ break;
+ case P1_TIMER:
+ //ntics+=1;
+ GetCtrlVal (p1h, P1_REFRESH, &refon);
+ if (refon) QueueUserEvent (9000, p1h, P1_UPDATE);
+ break;
+ case P1_REFRESH:
+ break;
+ /*
+ case P1_DAQ:
+ GetCtrlVal (p1h, P1_DAQ, &daq_on);
+ if (daq_on) {
+ CmtScheduleThreadPoolFunction (poolHandle, daq_run, (void *)&dummy, &tfID);
+ } else {
+ CmtWaitForThreadPoolFunctionCompletion (poolHandle, tfID,
+ OPT_TP_PROCESS_EVENTS_WHILE_WAITING);
+ CmtReleaseThreadPoolFunctionID (poolHandle, tfID);
+ }
+ break;
+ */
+ case P1_IPF:
+ status = GetCtrlVal (p1h, P1_IPF, ip_address);
+ status = SetCtrlVal (p1h, P1_IP, ip_address);
+ break;
+ case P1_CONNECT:
+ if (connected) {
+ strcpy(outbuf,"GTL\n");
+ LECROY_TCP_write(sockfd, outbuf);
+ LECROY_TCP_disconnect(sockfd);
+ status = SetCtrlVal (p1h, P1_ID, "");
+ connected=0;
+ }else{
+ status = GetCtrlVal (p1h, P1_IP, ip_address);
+ sockfd=LECROY_TCP_connect(ip_address, MAX_TCP_CONNECT);
+ if (sockfd<0) {
+ //printf("\nCould not connect to the scope on IP: %s\n",ip_address);
+ status = SetCtrlVal (p1h, P1_ID, "Could not connect!");
+ status = SetCtrlVal (p1h, P1_CONNECT, 0);
+ break;
+ }else{
+ connected=1;
+ strcpy(outbuf,"*idn?\n");
+ LECROY_TCP_write(sockfd, outbuf);
+ LECROY_TCP_read(sockfd, inbuf, sizeof(inbuf), MAX_TCP_READ);
+ status = SetCtrlVal (p1h, P1_ID, inbuf);
+
+ for (i=0;i<4;i++) {
+ sprintf(outbuf,"C%1d:TRA?\n",i+1);
+ LECROY_TCP_write(sockfd, outbuf);
+ LECROY_TCP_read(sockfd, inbuf, sizeof(inbuf), MAX_TCP_READ);
+ if (FindPattern (inbuf, 0, 2, "ON", 1, 0)) {
+ status = SetCtrlVal (p1h, p1_tra[i], 0);
+ }else{
+ status = SetCtrlVal (p1h, p1_tra[i], 1);
+ }
+
+ sprintf(outbuf,"C%1d:VDIV?\n",i+1);
+ LECROY_TCP_write(sockfd, outbuf);
+ LECROY_TCP_read(sockfd, inbuf, sizeof(inbuf), MAX_TCP_READ);
+ sscanf(inbuf,"%g",&tmpfloat);
+ status = SetCtrlVal (p1h, p1_vdiv[i], tmpfloat);
+
+ sprintf(outbuf,"C%1d:BWL?\n",i+1);
+ LECROY_TCP_write(sockfd, outbuf);
+ LECROY_TCP_read(sockfd, inbuf, sizeof(inbuf), MAX_TCP_READ);
+ sscanf(inbuf,"%s",tmpstr);
+ status = SetCtrlVal (p1h, p1_bwl[i], tmpstr);
+ }
+
+ sprintf(outbuf,"PERS?\n");
+ LECROY_TCP_write(sockfd, outbuf);
+ LECROY_TCP_read(sockfd, inbuf, sizeof(inbuf), MAX_TCP_READ);
+ sscanf(inbuf,"%s",tmpstr);
+ status = SetCtrlVal (p1h, P1_PERS, tmpstr);
+
+ sprintf(outbuf,"TSRC?\n");
+ LECROY_TCP_write(sockfd, outbuf);
+ LECROY_TCP_read(sockfd, inbuf, sizeof(inbuf), MAX_TCP_READ);
+ sscanf(inbuf,"%s",tmpstr);
+ status = SetCtrlVal (p1h, P1_TSRC, tmpstr);
+
+ sprintf(outbuf,"TSLP?\n");
+ LECROY_TCP_write(sockfd, outbuf);
+ LECROY_TCP_read(sockfd, inbuf, sizeof(inbuf), MAX_TCP_READ);
+ sscanf(inbuf,"%s",tmpstr);
+ status = SetCtrlVal (p1h, P1_TSLP, tmpstr);
+ }
+ }
+ break;
+ // vertical
+ case P1_TRA_1:
+ case P1_TRA_2:
+ case P1_TRA_3:
+ case P1_TRA_4:
+ for (i=0;i<4;i++) {
+ if (rID==p1_tra[i]) {
+ status = GetCtrlVal (p1h, p1_tra[i], &tmpint);
+ if (tmpint) {
+ sprintf(outbuf,"C%1d:TRA ON\n",i+1);
+ }else{
+ sprintf(outbuf,"C%1d:TRA OFF\n",i+1);
+ }
+ LECROY_TCP_write(sockfd, outbuf);
+ }
+ }
+ break;
+ case P1_VDIV_1:
+ case P1_VDIV_2:
+ case P1_VDIV_3:
+ case P1_VDIV_4:
+ for (i=0;i<4;i++) {
+ if (rID==p1_vdiv[i]) {
+ status = GetCtrlVal (p1h, p1_vdiv[i], &tmpfloat);
+ sprintf(outbuf,"C%1d:VDIV %.3f\n",i+1,tmpfloat);
+ LECROY_TCP_write(sockfd, outbuf);
+ }
+ }
+ break;
+ case P1_BWL_1:
+ case P1_BWL_2:
+ case P1_BWL_3:
+ case P1_BWL_4:
+ for (i=0;i<4;i++) {
+ if (rID==p1_bwl[i]) {
+ status = GetCtrlVal (p1h, p1_bwl[i], tmpstr);
+ sprintf(outbuf,"C%1d:BWL %s\n",i+1,tmpstr);
+ LECROY_TCP_write(sockfd, outbuf);
+ }
+ }
+ break;
+ // horizontal
+ case P1_TDIV:
+ if (!connected) break;
+ status = GetCtrlVal (p1h, P1_TDIV, tmpstr);
+ sprintf(outbuf,"TDIV %s\n",tmpstr);
+ LECROY_TCP_write(sockfd, outbuf);
+ break;
+ case P1_PERS:
+ if (!connected) break;
+ status = GetCtrlVal (p1h, P1_PERS, tmpstr);
+ sprintf(outbuf,"PERS %s\n",tmpstr);
+ LECROY_TCP_write(sockfd, outbuf);
+ break;
+ // trigger
+ case P1_TLVL:
+ if (!connected) break;
+ status = GetCtrlVal (p1h, P1_TLVL, &tmpfloat);
+ sprintf(outbuf,"TLVL %f\n",tmpfloat);
+ LECROY_TCP_write(sockfd, outbuf);
+ break;
+ case P1_TRDL:
+ if (!connected) break;
+ status = GetCtrlVal (p1h, P1_TRDL, &tmpfloat);
+ sprintf(outbuf,"TRDL %.2E\n",tmpfloat);
+ LECROY_TCP_write(sockfd, outbuf);
+ break;
+ case P1_TSLP:
+ if (!connected) break;
+ status = GetCtrlVal (p1h, P1_TSLP, tmpstr);
+ sprintf(outbuf,"TSLP %s\n",tmpstr);
+ LECROY_TCP_write(sockfd, outbuf);
+ break;
+ case P1_TSRC:
+ if (!connected) break;
+ status = GetCtrlVal (p1h, P1_TSRC, tmpstr);
+ sprintf(outbuf,"TSRC %s\n",tmpstr);
+ LECROY_TCP_write(sockfd, outbuf);
+ break;
+ case P1_TRMD:
+ if (!connected) break;
+ status = GetCtrlVal (p1h, P1_TRMD, tmpstr);
+ sprintf(outbuf,"TRMD %s\n",tmpstr);
+ LECROY_TCP_write(sockfd, outbuf);
+ break;
+ case P1_TEST:
+ if (!connected) break;
+ strcpy(outbuf,"GTL\n");
+ LECROY_TCP_write(sockfd, outbuf);
+ break;
+ //case P1_GET_SETUP:
+ // break;
+ default:
+ break;
+ }
+
+ } while ((rID != P1_EXIT));
+
+ if (connected) {
+ strcpy(outbuf,"GTL\n");
+ LECROY_TCP_write(sockfd, outbuf);
+ LECROY_TCP_disconnect(sockfd);
+ }
+
+ DiscardPanel (p1h);
+ CmtDiscardThreadPool (poolHandle);
+
+ return 0;
+}
Index: trunk/wavejet_ui.h
===================================================================
--- trunk/wavejet_ui.h (nonexistent)
+++ trunk/wavejet_ui.h (revision 65)
@@ -0,0 +1,75 @@
+/**************************************************************************/
+/* LabWindows/CVI User Interface Resource (UIR) Include File */
+/* Copyright (c) National Instruments 2014. All Rights Reserved. */
+/* */
+/* WARNING: Do not add to, delete from, or otherwise modify the contents */
+/* of this include file. */
+/**************************************************************************/
+
+#include <userint.h>
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+ /* Panels and Controls: */
+
+#define P1 1
+#define P1_EXIT 2 /* control type: command, callback function: (none) */
+#define P1_UPDATE 3 /* control type: command, callback function: (none) */
+#define P1_IP 4 /* control type: string, callback function: (none) */
+#define P1_ID 5 /* control type: string, callback function: (none) */
+#define P1_GET_SETUP 6 /* control type: command, callback function: (none) */
+#define P1_REFRESH 7 /* control type: radioButton, callback function: (none) */
+#define P1_CONNECT 8 /* control type: textButton, callback function: (none) */
+#define P1_TEST 9 /* control type: command, callback function: (none) */
+#define P1_TSRC 10 /* control type: ring, callback function: (none) */
+#define P1_TDIVx 11 /* control type: numeric, callback function: (none) */
+#define P1_TRDL 12 /* control type: numeric, callback function: (none) */
+#define P1_OFST_1 13 /* control type: numeric, callback function: (none) */
+#define P1_TLVL 14 /* control type: numeric, callback function: (none) */
+#define P1_TDIV 15 /* control type: ring, callback function: (none) */
+#define P1_TSLP 16 /* control type: slide, callback function: (none) */
+#define P1_TEXT1 17 /* control type: textBox, callback function: (none) */
+#define P1_TRMD 18 /* control type: ring, callback function: (none) */
+#define P1_DSAV 19 /* control type: ring, callback function: (none) */
+#define P1_PERS 20 /* control type: ring, callback function: (none) */
+#define P1_TRA_4 21 /* control type: radioButton, callback function: (none) */
+#define P1_TRA_3 22 /* control type: radioButton, callback function: (none) */
+#define P1_TRA_2 23 /* control type: radioButton, callback function: (none) */
+#define P1_TRA_1 24 /* control type: radioButton, callback function: (none) */
+#define P1_BWL_4 25 /* control type: ring, callback function: (none) */
+#define P1_BWL_3 26 /* control type: ring, callback function: (none) */
+#define P1_BWL_2 27 /* control type: ring, callback function: (none) */
+#define P1_VDIV_4 28 /* control type: ring, callback function: (none) */
+#define P1_VDIV_3 29 /* control type: ring, callback function: (none) */
+#define P1_VDIV_2 30 /* control type: ring, callback function: (none) */
+#define P1_VDIV_1 31 /* control type: ring, callback function: (none) */
+#define P1_BWL_1 32 /* control type: ring, callback function: (none) */
+#define P1_IPF 33 /* control type: ring, callback function: (none) */
+#define P1_DISPLAY 34 /* control type: picture, callback function: (none) */
+#define P1_DEC1 35 /* control type: deco, callback function: (none) */
+#define P1_TIMER 36 /* control type: timer, callback function: cb_timer */
+#define P1_DECO_VERT 37 /* control type: deco, callback function: (none) */
+#define P1_DECO_TRIG 38 /* control type: deco, callback function: (none) */
+#define P1_DECO_HOR 39 /* control type: deco, callback function: (none) */
+
+
+ /* Control Arrays: */
+
+ /* (no control arrays in the resource file) */
+
+
+ /* Menu Bars, Menus, and Menu Items: */
+
+ /* (no menu bars in the resource file) */
+
+
+ /* Callback Prototypes: */
+
+int CVICALLBACK cb_timer(int panel, int control, int event, void *callbackData, int eventData1, int eventData2);
+
+
+#ifdef __cplusplus
+ }
+#endif
Index: trunk/lecroy_example.c
===================================================================
--- trunk/lecroy_example.c (nonexistent)
+++ trunk/lecroy_example.c (revision 65)
@@ -0,0 +1,76 @@
+/**************************************************************************
+lecroy_example.c
+Version 1.00
+Copyright (C) 2003 Steve D. Sharples
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+The author's email address is steve.sharples@nottingham.ac.uk
+
+***************************************************************************
+
+Example program that demonstrates communication via TCP/IP with an ethernet-
+enabled LeCroy DSO. Based on the main() function of "net_con.cpp" written
+by LeCroy.
+
+See "lecroy_tcp.c" and "lecroy_tcp.h" for additional comments and usage
+
+**************************************************************************/
+
+
+#include "lecroy_tcp.h"
+#include <stdio.h>
+#include <string.h>
+using namespace std;
+
+#define MAX_ST 512 /* maximum message string. no picked from thin air */
+
+int main ()
+{
+ char ip_address[50];
+ int sockfd;
+ char outbuf[MAX_ST];
+ char inbuf[MAX_ST];
+ float fvalue;
+ int ivalue;
+
+
+ /* OUR_SCOPE_IP is #define'd in lecroy_tcp.h, so is MAX_TCP_CONNECT */
+ sprintf(ip_address, OUR_SCOPE_IP);
+
+ printf("\nlecroy_example: about to connect to DSO...\n");
+
+ /* how to "set up the scope for ethernet communication" */
+ sockfd=LECROY_TCP_connect(ip_address, MAX_TCP_CONNECT);
+ if (sockfd<0) {
+ printf("\nCould not connect to the scope on IP: %s\n",ip_address);
+ return 1;
+ }
+
+ printf("....connected.\n");
+
+ /* example of writing to the scope) */
+ strcpy(outbuf,"*idn?\n");
+ LECROY_TCP_write(sockfd, outbuf);
+ printf ("Request to scope:\n%s\n", outbuf);
+
+ /* example of getting the raw data back from the scope */
+ LECROY_TCP_read(sockfd, inbuf, sizeof(inbuf), MAX_TCP_READ);
+ printf ("Scope returned:\n%s\n", inbuf);
+
+ LECROY_TCP_disconnect(sockfd);
+ printf("Successfully disconnected... bye!\n");
+ return 0;
+}
Index: trunk/lecroy_tcp.h
===================================================================
--- trunk/lecroy_tcp.h (nonexistent)
+++ trunk/lecroy_tcp.h (revision 65)
@@ -0,0 +1,52 @@
+/**************************************************************************
+lecroy_tcp.h
+Version 1.00
+Copyright (C) 2003 Steve D. Sharples
+Based on "net_con.h" by LeCroy
+See "lecroy_tcp.c" for additional comments and usage
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+The author's email address is steve.sharples@nottingham.ac.uk
+**************************************************************************/
+
+
+
+/* stick your own I.P. address here. Of course, you don't have to use
+ this constant, it's just handy */
+ //#define OUR_SCOPE_IP "172.25.1.2"
+
+#define LECROY_SERVER_PORT 1861 /* as defined by LeCroy */
+
+#define CMD_BUF_LEN 8192
+#define BOOL int
+#define TRUE 1
+#define FALSE 0
+
+//void LECROY_TCP_bored_now(int); /* catch signal routine */
+int LECROY_TCP_write(int, char *);
+int LECROY_TCP_read(int, char *, int, int);
+int LECROY_TCP_connect(char *, int);
+int LECROY_TCP_disconnect(int);
+
+#define LECROY_EOI_FLAG 0x01
+#define LECROY_SRQ_FLAG 0x08
+#define LECROY_CLEAR_FLAG 0x10
+#define LECROY_LOCKOUT_FLAG 0x20
+#define LECROY_REMOTE_FLAG 0x40
+#define LECROY_DATA_FLAG 0x80
+
+#define LECROY_READ_TIME_OUT 10
+#define LECROY_TCP_MINIMUM_PACKET_SIZE 64
Index: trunk/wj300a-rcm-e.pdf
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/wj300a-rcm-e.pdf
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property