Jan Breuer
2015-08-06 ef1b8d06a9f5e87d6abb217e9b056257ecdd508a
Add LabWindows/CVI example by lhoerl
7个文件已添加
1576 ■■■■■ 已修改文件
examples/test-CVI_w_GUI/.gitignore 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/test-CVI_w_GUI/TestLibSCPI_GUI.prj 686 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/test-CVI_w_GUI/TestLibscpi.h 96 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/test-CVI_w_GUI/TestLibscpi.uir 补丁 | 查看 | 原始文档 | blame | 历史
examples/test-CVI_w_GUI/libscpi.cws 380 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/test-CVI_w_GUI/main.c 353 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/test-CVI_w_GUI/scpi_user_config.h 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/test-CVI_w_GUI/.gitignore
New file
@@ -0,0 +1,2 @@
cvibuild.TestLibSCPI_GUI
TestLibSCPI_GUI.cdb
examples/test-CVI_w_GUI/TestLibSCPI_GUI.prj
New file
@@ -0,0 +1,686 @@
[Project Header]
Version = 1201
Pathname = "/c/git/Lutzscpi-parser/examples/test-CVI_w_GUI/TestLibSCPI_GUI.prj"
CVI Dir = "/c/program files (x86)/national instruments/cvi2012"
CVI Shared Dir = "/C/Program Files (x86)/National Instruments/Shared/CVI"
CVI Pub Local Dir = "/C/ProgramData/National Instruments/CVI2012"
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 = 29
Target Type = "Executable"
Flags = 2064
Copied From Locked InstrDrv Directory = False
Copied from VXIPNP Directory = False
Locked InstrDrv Name = ""
Don't Display Deploy InstrDrv Dialog = False
[File 0001]
File Type = "Include"
Res Id = 1
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../../libscpi/inc/scpi/config.h"
Path = "/c/git/Lutzscpi-parser/libscpi/inc/scpi/config.h"
Exclude = False
Project Flags = 0
Folder = "Include Files"
[File 0002]
File Type = "Include"
Res Id = 2
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../../libscpi/inc/scpi/constants.h"
Path = "/c/git/Lutzscpi-parser/libscpi/inc/scpi/constants.h"
Exclude = False
Project Flags = 0
Folder = "Include Files"
[File 0003]
File Type = "CSource"
Res Id = 3
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "debug.c"
Path = "/c/git/Lutzscpi-parser/examples/test-CVI_w_GUI/debug.c"
Exclude = False
Compile Into Object File = False
Project Flags = 0
Folder = "Source Files"
[File 0004]
File Type = "Include"
Res Id = 4
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "debug.h"
Path = "/c/git/Lutzscpi-parser/examples/test-CVI_w_GUI/debug.h"
Exclude = False
Project Flags = 0
Folder = "Include Files"
[File 0005]
File Type = "CSource"
Res Id = 5
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../../libscpi/src/error.c"
Path = "/c/git/Lutzscpi-parser/libscpi/src/error.c"
Exclude = False
Compile Into Object File = False
Project Flags = 0
Folder = "libscpi"
[File 0006]
File Type = "Include"
Res Id = 6
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../../libscpi/inc/scpi/error.h"
Path = "/c/git/Lutzscpi-parser/libscpi/inc/scpi/error.h"
Exclude = False
Project Flags = 0
Folder = "Include Files"
[File 0007]
File Type = "CSource"
Res Id = 7
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../../libscpi/src/fifo.c"
Path = "/c/git/Lutzscpi-parser/libscpi/src/fifo.c"
Exclude = False
Compile Into Object File = False
Project Flags = 0
Folder = "libscpi"
[File 0008]
File Type = "Include"
Res Id = 8
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../../libscpi/src/fifo_private.h"
Path = "/c/git/Lutzscpi-parser/libscpi/src/fifo_private.h"
Exclude = False
Project Flags = 0
Folder = "libscpi"
[File 0009]
File Type = "CSource"
Res Id = 9
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../../libscpi/src/ieee488.c"
Path = "/c/git/Lutzscpi-parser/libscpi/src/ieee488.c"
Exclude = False
Compile Into Object File = False
Project Flags = 0
Folder = "libscpi"
[File 0010]
File Type = "Include"
Res Id = 10
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../../libscpi/inc/scpi/ieee488.h"
Path = "/c/git/Lutzscpi-parser/libscpi/inc/scpi/ieee488.h"
Exclude = False
Project Flags = 0
Folder = "Include Files"
[File 0011]
File Type = "CSource"
Res Id = 11
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../../libscpi/src/lexer.c"
Path = "/c/git/Lutzscpi-parser/libscpi/src/lexer.c"
Exclude = False
Compile Into Object File = False
Project Flags = 0
Folder = "libscpi"
[File 0012]
File Type = "Include"
Res Id = 12
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../../libscpi/src/lexer_private.h"
Path = "/c/git/Lutzscpi-parser/libscpi/src/lexer_private.h"
Exclude = False
Project Flags = 0
Folder = "libscpi"
[File 0013]
File Type = "CSource"
Res Id = 13
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "main.c"
Path = "/c/git/Lutzscpi-parser/examples/test-CVI_w_GUI/main.c"
Exclude = False
Compile Into Object File = False
Project Flags = 0
Folder = "Source Files"
[File 0014]
File Type = "CSource"
Res Id = 14
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../../libscpi/src/minimal.c"
Path = "/c/git/Lutzscpi-parser/libscpi/src/minimal.c"
Exclude = False
Compile Into Object File = False
Project Flags = 0
Folder = "libscpi"
[File 0015]
File Type = "Include"
Res Id = 15
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../../libscpi/inc/scpi/minimal.h"
Path = "/c/git/Lutzscpi-parser/libscpi/inc/scpi/minimal.h"
Exclude = False
Project Flags = 0
Folder = "Include Files"
[File 0016]
File Type = "CSource"
Res Id = 16
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../../libscpi/src/parser.c"
Path = "/c/git/Lutzscpi-parser/libscpi/src/parser.c"
Exclude = False
Compile Into Object File = False
Project Flags = 0
Folder = "libscpi"
[File 0017]
File Type = "Include"
Res Id = 17
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../../libscpi/inc/scpi/parser.h"
Path = "/c/git/Lutzscpi-parser/libscpi/inc/scpi/parser.h"
Exclude = False
Project Flags = 0
Folder = "Include Files"
[File 0018]
File Type = "Include"
Res Id = 18
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../../libscpi/src/parser_private.h"
Path = "/c/git/Lutzscpi-parser/libscpi/src/parser_private.h"
Exclude = False
Project Flags = 0
Folder = "libscpi"
[File 0019]
File Type = "CSource"
Res Id = 19
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../common/scpi-def.c"
Path = "/c/git/Lutzscpi-parser/examples/common/scpi-def.c"
Exclude = False
Compile Into Object File = False
Project Flags = 0
Folder = "Source Files"
[File 0020]
File Type = "Include"
Res Id = 20
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../../libscpi/inc/scpi/scpi.h"
Path = "/c/git/Lutzscpi-parser/libscpi/inc/scpi/scpi.h"
Exclude = False
Project Flags = 0
Folder = "Include Files"
[File 0021]
File Type = "CSource"
Res Id = 21
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../../libscpi/src/scpi_debug.c"
Path = "/c/git/Lutzscpi-parser/libscpi/src/scpi_debug.c"
Exclude = False
Compile Into Object File = False
Project Flags = 0
Folder = "libscpi"
[File 0022]
File Type = "Include"
Res Id = 22
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../../libscpi/inc/scpi/scpi_user_config.h"
Path = "/c/git/Lutzscpi-parser/libscpi/inc/scpi/scpi_user_config.h"
Exclude = False
Project Flags = 0
Folder = "Include Files"
[File 0023]
File Type = "Include"
Res Id = 23
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "TestLibscpi.h"
Path = "/c/git/Lutzscpi-parser/examples/test-CVI_w_GUI/TestLibscpi.h"
Exclude = False
Project Flags = 0
Folder = "Include Files"
[File 0024]
File Type = "User Interface Resource"
Res Id = 24
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "TestLibscpi.uir"
Path = "/c/git/Lutzscpi-parser/examples/test-CVI_w_GUI/TestLibscpi.uir"
Exclude = False
Project Flags = 0
Folder = "User Interface Files"
[File 0025]
File Type = "CSource"
Res Id = 25
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../../libscpi/src/units.c"
Path = "/c/git/Lutzscpi-parser/libscpi/src/units.c"
Exclude = False
Compile Into Object File = False
Project Flags = 0
Folder = "libscpi"
[File 0026]
File Type = "Include"
Res Id = 26
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../../libscpi/inc/scpi/units.h"
Path = "/c/git/Lutzscpi-parser/libscpi/inc/scpi/units.h"
Exclude = False
Project Flags = 0
Folder = "Include Files"
[File 0027]
File Type = "CSource"
Res Id = 27
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../../libscpi/src/utils.c"
Path = "/c/git/Lutzscpi-parser/libscpi/src/utils.c"
Exclude = False
Compile Into Object File = False
Project Flags = 0
Folder = "libscpi"
[File 0028]
File Type = "Include"
Res Id = 28
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../../libscpi/inc/scpi/utils.h"
Path = "/c/git/Lutzscpi-parser/libscpi/inc/scpi/utils.h"
Exclude = False
Project Flags = 0
Folder = "Include Files"
[File 0029]
File Type = "Include"
Res Id = 29
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../../libscpi/src/utils_private.h"
Path = "/c/git/Lutzscpi-parser/libscpi/src/utils_private.h"
Exclude = False
Project Flags = 0
Folder = "libscpi"
[Folders]
Instrument Files Folder Not Added Yet = True
Library Files Folder Not Added Yet = True
Folder 0 = "Source Files"
Folder 1 = "Include Files"
Folder 2 = "User Interface Files"
Folder 3 = "libscpi"
[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"
Uninitialized Locals Compile Warning = "Conservative"
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
Enable C99 Extensions = True
Stack Size = 250000
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 = ""
DLL Import Library Choice = "Gen Lib For Current Mode"
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
Create Console Application = False
Using LoadExternalModule = False
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 = "Microsoft"
Company Name Ex = "%company"
File Description = "TestLibSCPI_GUI (Debug x86)"
File Description Ex = "%application (%rel_dbg %arch)"
File Version = "1.0"
File Version Ex = "%f1.%f2"
Internal Name = "TestLibSCPI_GUI"
Internal Name Ex = "%basename"
Legal Copyright = "Copyright © Microsoft 2015"
Legal Copyright Ex = "Copyright © %company %Y"
Legal Trademarks = ""
Legal Trademarks Ex = ""
Original Filename = "TestLibSCPI_GUI.exe"
Original Filename Ex = "%filename"
Private Build = ""
Private Build Ex = ""
Product Name = "Microsoft TestLibSCPI_GUI"
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"
Uninitialized Locals Compile Warning = "Conservative"
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
Enable C99 Extensions = True
Stack Size = 250000
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 = ""
DLL Import Library Choice = "Gen Lib For Current Mode"
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
Create Console Application = False
Using LoadExternalModule = False
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"
Uninitialized Locals Compile Warning = "Conservative"
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
Enable C99 Extensions = True
Stack Size = 250000
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 = ""
DLL Import Library Choice = "Gen Lib For Current Mode"
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
Create Console Application = False
Using LoadExternalModule = False
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"
Uninitialized Locals Compile Warning = "Conservative"
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
Enable C99 Extensions = True
Stack Size = 250000
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 = ""
DLL Import Library Choice = "Gen Lib For Current Mode"
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
Create Console Application = False
Using LoadExternalModule = False
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 = True
Uninitialized Locals Compile Warning = "Conservative"
Precompile Prefix Header = False
Prefix Header File = ""
[Run Options]
Stack Size = 250000
Image Base Address = 4194304
Image Base Address x64 = 4194304
[Compiler Defines]
Compiler Defines = "/DWIN32_LEAN_AND_MEAN"
[Include Paths]
Include Path 1 Is Rel = True
Include Path 1 Rel To = "Project"
Include Path 1 Rel Path = "../../libscpi/inc"
Include Path 1 = "/c/git/Lutzscpi-parser/libscpi/inc"
[Create Executable]
Executable File_Debug Is Rel = True
Executable File_Debug Rel To = "Project"
Executable File_Debug Rel Path = "TestLibSCPI_GUI.exe"
Executable File_Debug = "/c/git/Lutzscpi-parser/examples/test-CVI_w_GUI/TestLibSCPI_GUI.exe"
Executable File_Release Is Rel = True
Executable File_Release Rel To = "Project"
Executable File_Release Rel Path = "TestLibSCPI_GUI.exe"
Executable File_Release = "/c/git/Lutzscpi-parser/examples/test-CVI_w_GUI/TestLibSCPI_GUI.exe"
Executable File_Debug64 Is Rel = True
Executable File_Debug64 Rel To = "Project"
Executable File_Debug64 Rel Path = "TestLibSCPI_GUI.exe"
Executable File_Debug64 = "/c/git/Lutzscpi-parser/examples/test-CVI_w_GUI/TestLibSCPI_GUI.exe"
Executable File_Release64 Is Rel = True
Executable File_Release64 Rel To = "Project"
Executable File_Release64 Rel Path = "TestLibSCPI_GUI.exe"
Executable File_Release64 = "/c/git/Lutzscpi-parser/examples/test-CVI_w_GUI/TestLibSCPI_GUI.exe"
Icon File Is Rel = False
Icon File = ""
Application Title = ""
DLL Exports = "Include File Symbols"
DLL Import Library Choice = "Gen Lib For Current Mode"
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
examples/test-CVI_w_GUI/TestLibscpi.h
New file
@@ -0,0 +1,96 @@
/**************************************************************************/
/* LabWindows/CVI User Interface Resource (UIR) Include File              */
/* Copyright (c) National Instruments 2015. 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  PANEL                            1
#define  PANEL_OUTPUTDEBUG                2       /* control type: textBox, callback function: (none) */
#define  PANEL_OUTPUTERR                  3       /* control type: textBox, callback function: (none) */
#define  PANEL_OUTPUT                     4       /* control type: textBox, callback function: (none) */
#define  PANEL_INPUT                      5       /* control type: string, callback function: cb_scpi_input */
#define  PANEL_SREHEX                     6       /* control type: string, callback function: (none) */
#define  PANEL_SRE0                       7       /* control type: radioButton, callback function: (none) */
#define  PANEL_STBHEX                     8       /* control type: string, callback function: (none) */
#define  PANEL_SRE1                       9       /* control type: radioButton, callback function: (none) */
#define  PANEL_STB0                       10      /* control type: radioButton, callback function: (none) */
#define  PANEL_SRE2                       11      /* control type: radioButton, callback function: (none) */
#define  PANEL_STBTEXT0                   12      /* control type: textMsg, callback function: (none) */
#define  PANEL_SRE3                       13      /* control type: radioButton, callback function: (none) */
#define  PANEL_STB1                       14      /* control type: radioButton, callback function: (none) */
#define  PANEL_SRE4                       15      /* control type: radioButton, callback function: (none) */
#define  PANEL_STBTEXT1                   16      /* control type: textMsg, callback function: (none) */
#define  PANEL_SRE5                       17      /* control type: radioButton, callback function: (none) */
#define  PANEL_STB2                       18      /* control type: radioButton, callback function: (none) */
#define  PANEL_SRE6                       19      /* control type: radioButton, callback function: (none) */
#define  PANEL_STBTEXT2                   20      /* control type: textMsg, callback function: (none) */
#define  PANEL_SRE7                       21      /* control type: radioButton, callback function: (none) */
#define  PANEL_STB3                       22      /* control type: radioButton, callback function: (none) */
#define  PANEL_STBTEXT3                   23      /* control type: textMsg, callback function: (none) */
#define  PANEL_STB4                       24      /* control type: radioButton, callback function: (none) */
#define  PANEL_STBTEXT4                   25      /* control type: textMsg, callback function: (none) */
#define  PANEL_STB5                       26      /* control type: radioButton, callback function: (none) */
#define  PANEL_STBTEXT5                   27      /* control type: textMsg, callback function: (none) */
#define  PANEL_STB6                       28      /* control type: radioButton, callback function: (none) */
#define  PANEL_STBTEXT6                   29      /* control type: textMsg, callback function: (none) */
#define  PANEL_STB7                       30      /* control type: radioButton, callback function: (none) */
#define  PANEL_STBTEXT7                   31      /* control type: textMsg, callback function: (none) */
#define  PANEL_ESEHEX                     32      /* control type: string, callback function: (none) */
#define  PANEL_ESRHEX                     33      /* control type: string, callback function: (none) */
#define  PANEL_ESE0                       34      /* control type: radioButton, callback function: (none) */
#define  PANEL_ESR0                       35      /* control type: radioButton, callback function: (none) */
#define  PANEL_ESE1                       36      /* control type: radioButton, callback function: (none) */
#define  PANEL_ESRTEXT0                   37      /* control type: textMsg, callback function: (none) */
#define  PANEL_ESE2                       38      /* control type: radioButton, callback function: (none) */
#define  PANEL_ESR1                       39      /* control type: radioButton, callback function: (none) */
#define  PANEL_ESE3                       40      /* control type: radioButton, callback function: (none) */
#define  PANEL_ESRTEXT1                   41      /* control type: textMsg, callback function: (none) */
#define  PANEL_ESE4                       42      /* control type: radioButton, callback function: (none) */
#define  PANEL_ESR2                       43      /* control type: radioButton, callback function: (none) */
#define  PANEL_ESE5                       44      /* control type: radioButton, callback function: (none) */
#define  PANEL_ESRTEXT2                   45      /* control type: textMsg, callback function: (none) */
#define  PANEL_ESE6                       46      /* control type: radioButton, callback function: (none) */
#define  PANEL_ESR3                       47      /* control type: radioButton, callback function: (none) */
#define  PANEL_ESE7                       48      /* control type: radioButton, callback function: (none) */
#define  PANEL_ESRTEXT3                   49      /* control type: textMsg, callback function: (none) */
#define  PANEL_ESR4                       50      /* control type: radioButton, callback function: (none) */
#define  PANEL_ESRTEXT4                   51      /* control type: textMsg, callback function: (none) */
#define  PANEL_ESR5                       52      /* control type: radioButton, callback function: (none) */
#define  PANEL_ESRTEXT5                   53      /* control type: textMsg, callback function: (none) */
#define  PANEL_ESR6                       54      /* control type: radioButton, callback function: (none) */
#define  PANEL_ESRTEXT6                   55      /* control type: textMsg, callback function: (none) */
#define  PANEL_ESR7                       56      /* control type: radioButton, callback function: (none) */
#define  PANEL_ESRTEXT7                   57      /* control type: textMsg, callback function: (none) */
#define  PANEL_QUIT                       58      /* control type: command, callback function: cb_quit */
#define  PANEL_LEDSRQ                     59      /* control type: LED, 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_quit(int panel, int control, int event, void *callbackData, int eventData1, int eventData2);
int  CVICALLBACK cb_scpi_input(int panel, int control, int event, void *callbackData, int eventData1, int eventData2);
#ifdef __cplusplus
    }
#endif
examples/test-CVI_w_GUI/TestLibscpi.uir
Binary files differ
examples/test-CVI_w_GUI/libscpi.cws
New file
@@ -0,0 +1,380 @@
[Workspace Header]
Version = 1201
Pathname = "/c/git/Lutzscpi-parser/examples/test-CVI_w_GUI/libscpi.cws"
CVI Dir = "/c/program files (x86)/national instruments/cvi2012"
CVI Shared Dir = "/C/Program Files (x86)/National Instruments/Shared/CVI"
CVI Pub Local Dir = "/C/ProgramData/National Instruments/CVI2012"
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 = "TestLibSCPI_GUI.prj"
Drag Bar Left = 274
Window Top = 30
Window Left = 2184
Window Bottom = 701
Window Right = 3709
Maximized = True
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 For Warnings = True
Show Build Dialog = 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 = 6
Window Confinement Region Enabled = True
MainColumnWidth = 257
FileDateColumnWidth = 70
FileSizeColumnWidth = 70
StatusColumnWidth = 70
[Project Header 0001]
Version = 1201
Don't Update DistKit = False
Platform Code = 4
Build Configuration = "Debug"
Warn User If Debugging Release = 1
Batch Build Release = False
Batch Build Debug = True
Force Rebuild = False
[File 0001]
Path = "/c/git/Lutzscpi-parser/examples/test-CVI_w_GUI/debug.c"
File Type = "CSource"
Disk Date = 3521543789
In Projects = "1,"
Window Top = 92
Window Left = 42
Source Window State = "1,0,0,0,0,0,0,0,0,80,0,0,0,0,0,25,73,0,100,0,453,769,1,0,"
[File 0002]
Path = "/c/git/Lutzscpi-parser/examples/test-CVI_w_GUI/debug.h"
File Type = "Include"
Disk Date = 3521535203
In Projects = "1,"
Window Top = 212
Window Left = 106
Source Window State = "1,60,60,60,11,21,21,0,3,80,0,0,0,0,0,25,33,0,60,11,453,769,1,0,"
[File 0003]
Path = "/c/git/Lutzscpi-parser/examples/test-CVI_w_GUI/main.c"
File Type = "CSource"
Disk Date = 3521635866
In Projects = "1,"
Window Top = 122
Window Left = 58
Window Z-Order = 1
Source Window State = "1,299,299,299,33,44,33,0,0,178,0,0,0,0,0,44,271,0,299,72,453,769,1,0,"
[File 0004]
Path = "/c/git/Lutzscpi-parser/libscpi/src/parser.c"
File Type = "CSource"
Disk Date = 3521605088
In Projects = "1,"
Window Top = 272
Window Left = 138
Source Window State = "1,0,0,0,0,0,0,0,0,80,0,0,0,0,0,25,269,0,302,0,453,769,1,0,"
[File 0005]
Path = "/c/git/Lutzscpi-parser/libscpi/src/scpi_debug.c"
File Type = "CSource"
Disk Date = 3521635053
In Projects = "1,"
Window Top = 242
Window Left = 122
Source Window State = "1,0,0,0,0,0,0,0,0,80,0,0,0,0,0,25,29,0,58,24,453,769,1,0,"
[File 0006]
Path = "/c/git/Lutzscpi-parser/libscpi/src/error.c"
File Type = "CSource"
Disk Date = 3521605290
In Projects = "1,"
Window Top = 272
Window Left = 138
Source Window State = "1,117,117,117,12,33,33,0,0,0,0,0,0,0,0,0,144,0,156,4,453,769,1,0,"
[File 0007]
Path = "/c/git/Lutzscpi-parser/libscpi/src/fifo.c"
File Type = "CSource"
Disk Date = 3521192343
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 0008]
Path = "/c/git/Lutzscpi-parser/libscpi/src/fifo_private.h"
File Type = "Include"
Disk Date = 3521192343
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 0009]
Path = "/c/git/Lutzscpi-parser/libscpi/src/ieee488.c"
File Type = "CSource"
Disk Date = 3521192343
In Projects = "1,"
Window Top = 62
Window Left = 26
Source Window State = "1,116,116,116,13,25,25,0,0,80,0,0,0,0,0,25,140,0,158,35,453,769,1,0,"
[File 0010]
Path = "/c/git/Lutzscpi-parser/libscpi/src/lexer.c"
File Type = "CSource"
Disk Date = 3521447009
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 0011]
Path = "/c/git/Lutzscpi-parser/libscpi/src/lexer_private.h"
File Type = "Include"
Disk Date = 3521192343
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 0012]
Path = "/c/git/Lutzscpi-parser/libscpi/src/minimal.c"
File Type = "CSource"
Disk Date = 3521192343
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 0013]
Path = "/c/git/Lutzscpi-parser/libscpi/src/parser_private.h"
File Type = "Include"
Disk Date = 3521192343
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 0014]
Path = "/c/git/Lutzscpi-parser/examples/common/scpi-def.c"
File Type = "CSource"
Disk Date = 3521608303
In Projects = "1,"
Window Top = 272
Window Left = 138
Window Z-Order = 5
Source Window State = "1,274,274,274,32,46,46,0,3,80,0,0,0,0,0,25,183,0,274,32,453,769,1,0,"
[File 0015]
Path = "/c/git/Lutzscpi-parser/examples/test-CVI_w_GUI/TestLibscpi.h"
File Type = "Include"
Disk Date = 3521635769
In Projects = "1,"
Window Top = 242
Window Left = 122
Window Z-Order = 3
Source Window State = "1,74,74,74,9,21,21,0,3,80,0,0,0,0,0,25,48,0,74,9,453,769,1,0,"
[File 0016]
Path = "/c/git/Lutzscpi-parser/examples/test-CVI_w_GUI/TestLibscpi.uir"
File Type = "User Interface Resource"
Disk Date = 3521635769
In Projects = "1,"
Window Top = 32
Window Left = 10
Window Height = 453
Window Width = 769
Window Z-Order = 2
[File 0017]
Path = "/c/git/Lutzscpi-parser/libscpi/src/units.c"
File Type = "CSource"
Disk Date = 3521192343
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 0018]
Path = "/c/git/Lutzscpi-parser/libscpi/src/utils.c"
File Type = "CSource"
Disk Date = 3521605401
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 0019]
Path = "/c/git/Lutzscpi-parser/libscpi/src/utils_private.h"
File Type = "Include"
Disk Date = 3521192343
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 0020]
Path = "/c/git/Lutzscpi-parser/libscpi/inc/scpi/parser.h"
File Type = "Include"
Disk Date = 3521603631
In Projects = "1,"
Window Top = 62
Window Left = 26
Source Window State = "1,0,0,0,0,0,0,0,0,80,0,0,0,0,0,25,42,0,0,0,453,769,1,0,"
[File 0021]
Path = "/c/git/Lutzscpi-parser/libscpi/inc/scpi/types.h"
File Type = "Include"
Disk Date = 3521605117
In Projects = ""
Window Top = 122
Window Left = 58
Window Z-Order = 4
Source Window State = "1,71,71,71,8,20,20,0,3,80,0,0,0,0,0,25,68,0,71,8,453,769,1,0,"
[File 0022]
Path = "/c/git/Lutzscpi-parser/libscpi/inc/scpi/ieee488.h"
File Type = "Include"
Disk Date = 3521192343
In Projects = "1,"
Window Top = 92
Window Left = 42
Window Z-Order = 6
Source Window State = "1,80,81,80,0,0,0,0,0,80,0,0,0,0,0,25,32,0,39,17,453,769,1,0,"
[File 0023]
Path = "/c/git/Lutzscpi-parser/libscpi/inc/scpi/constants.h"
File Type = "Include"
Disk Date = 3521192343
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 0024]
Path = "/c/git/Lutzscpi-parser/libscpi/inc/scpi/scpi.h"
File Type = "Include"
Disk Date = 3521192343
In Projects = "1,"
Window Top = 302
Window Left = 154
Source Window State = "1,0,0,0,0,0,0,0,0,80,0,0,0,0,0,25,8,0,0,0,453,769,1,0,"
[File 0025]
Path = "/c/git/Lutzscpi-parser/libscpi/inc/scpi/minimal.h"
File Type = "Include"
Disk Date = 3521192343
In Projects = "1,"
Window Top = 92
Window Left = 42
Source Window State = "1,0,0,0,0,0,0,0,0,80,0,0,0,0,0,25,0,0,0,0,453,769,1,0,"
[File 0026]
Path = "/c/git/Lutzscpi-parser/libscpi/inc/scpi/units.h"
File Type = "Include"
Disk Date = 3521192343
In Projects = "1,"
Window Top = 32
Window Left = 10
Source Window State = "1,0,0,0,0,0,0,0,0,80,0,0,0,0,0,25,16,0,0,0,453,769,1,0,"
[File 0027]
Path = "/c/git/Lutzscpi-parser/libscpi/inc/scpi/utils.h"
File Type = "Include"
Disk Date = 3521192343
In Projects = "1,"
Window Top = 332
Window Left = 170
Source Window State = "1,0,0,0,0,0,0,0,0,80,0,0,0,0,0,25,11,0,0,0,453,769,1,0,"
[File 0028]
Path = "/c/git/Lutzscpi-parser/libscpi/inc/scpi/error.h"
File Type = "Include"
Disk Date = 3521605201
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 0029]
Path = "/c/git/Lutzscpi-parser/libscpi/inc/scpi/config.h"
File Type = "Include"
Disk Date = 3521605154
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 0030]
Path = "/c/git/Lutzscpi-parser/libscpi/inc/scpi/scpi_user_config.h"
File Type = "Include"
Disk Date = 3521606339
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,"
[Default Build Config 0001 Debug]
Generate Browse Info = True
Enable Uninitialized Locals Runtime Warning = True
Batch Build = True
Profile = "Disabled"
Debugging Level = "Standard"
Execution Trace = "Disabled"
Command Line Args = ""
Working Directory = ""
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 = ""
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 = ""
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 = ""
External Process Path = ""
[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 = ""
examples/test-CVI_w_GUI/main.c
New file
@@ -0,0 +1,353 @@
/*-
 * Copyright (c) 2015 Lutz Hoerl, Thorlabs GmbH
 *
 * All Rights Reserved
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
/**
 * @file   main.c
 * @date   Thu Nov 15 10:58:45 UTC 2012
 *
 * @brief  SCPI parser test with a little GUI built with NI-CVI (Lutz Hoerl, Thorlabs)
 *
 *
 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "scpi/scpi.h"
#include "../common/scpi-def.h"
/* NI-CVI specific stuff */
#include <cvirte.h>
#include <userint.h>
#include "TestLibscpi.h"      /* this is the include for the GUI constants */
/* GLOBAL VARIABLES */
static int panelHandle;
/* PROTOTYPES */
void gui_updateSTB(uint8_t newSTB);
void gui_updateSRE(uint8_t newSTB);
void gui_updateESR(uint8_t newSTB);
void gui_updateESE(uint8_t newSTB);
void updateSSCPIRegister(void);
void updateSTB(void);
void updateSRE(void);
void updateESR(void);
void updateESE(void);
/* a global output buffer to collect output data until it will be 'flushed' */
#define SCPI_OUPUT_BUFFER_SIZE      (256)
char SCPI_outputBuffer[SCPI_OUPUT_BUFFER_SIZE];
unsigned int SCPI_outputBuffer_idx = 0;
/* helper function to remove <LF> and <CR> from the end of a string */
/* this is needed only here for the GUI, there is a 'insert line to a text box' function */
/* that automatically adds a new line, so this prohibits double line feeds for the GUI */
void removeTrailingEndcodes(char *buf)
{
   int len;
   len = strlen(buf);
   while(len > 0)
   {
      len--;
      switch(buf[len])
      {
         case '\n'   :
         case '\r'   :
                        buf[len] = '\0';
                        break;
         default     :
                        len = 0;    // stop loop
                        break;
      }
   }
}
/* wrapper for debugging output, collects debug output until a <LF> */
/* is received, then removes the <LF> and outputs the line on the GUI */
void debug_output(char *buf)
{
   static char pbuf[512];
   static int pos = 0;
   int len;
   len = strlen(buf);
   if(buf[len-1] == '\n')
   {
      buf[len-1] == '\0';
      len--;
      memcpy(&pbuf[pos], buf, len);
      pos = 0;
      InsertTextBoxLine (panelHandle, PANEL_OUTPUTDEBUG, -1, pbuf);
   }
   else
   {
      memcpy(&pbuf[pos], buf, len);
      pos += len;
   }
}
size_t SCPI_Write(scpi_t * context, const char * data, size_t len)
{
   if((SCPI_outputBuffer_idx + len) > (SCPI_OUPUT_BUFFER_SIZE-1))
   {
      len = (SCPI_OUPUT_BUFFER_SIZE-1) - SCPI_outputBuffer_idx;    // limit length to left over space
      // apparently there is no mechanism to cope with buffers that are too small
   }
   memcpy(&SCPI_outputBuffer[SCPI_outputBuffer_idx], data, len);
   SCPI_outputBuffer_idx += len;
   SCPI_outputBuffer[SCPI_outputBuffer_idx] = '\0';
   // return fwrite(data, 1, len, stdout);
   return len;
}
scpi_result_t SCPI_Flush(scpi_t * context)
{
// fwrite(SCPI_outputBuffer, 1, SCPI_outputBuffer_idx, stdout);
   removeTrailingEndcodes(SCPI_outputBuffer);
   InsertTextBoxLine (panelHandle, PANEL_OUTPUT, -1, SCPI_outputBuffer);
   SCPI_outputBuffer_idx = 0;
   return SCPI_RES_OK;
}
int SCPI_Error(scpi_t * context, int_fast16_t err)
{
   char buf[512];
//  fprintf(stderr, "**ERROR: %d, \"%s\"\r\n", (int16_t) err, SCPI_ErrorTranslate(err));
   sprintf(buf, "**ERROR: %d, \"%s\"", (int16_t) err, SCPI_ErrorTranslate(err));
   InsertTextBoxLine (panelHandle, PANEL_OUTPUTERR, -1, buf);
   return 0;
}
scpi_result_t SCPI_Control(scpi_t * context, scpi_ctrl_name_t ctrl, scpi_reg_val_t val) {
    if (SCPI_CTRL_SRQ == ctrl) {
        //  fprintf(stderr, "**SRQ: 0x%X (%d)\r\n", val, val);
        SetCtrlVal(panelHandle, PANEL_LEDSRQ, 1);
    } else {
        fprintf(stderr, "**CTRL %02x: 0x%X (%d)\r\n", ctrl, val, val);
    }
    return SCPI_RES_OK;
}
scpi_result_t SCPI_Reset(scpi_t * context) {
   char buf[256];
//  fprintf(stderr, "**Reset\r\n");
   sprintf(buf, "**Reset\r\n");
   debug_output(buf);
    return SCPI_RES_OK;
}
scpi_result_t SCPI_SystemCommTcpipControlQ(scpi_t * context) {
    return SCPI_RES_ERR;
}
/*
 *
 */
int main(int argc, char** argv)
{
   int result;
   SCPI_Init(&scpi_context);
   if (InitCVIRTE (0, argv, 0) == 0)
      return -1;  /* out of memory */
   if ((panelHandle = LoadPanel (0, "TestLibscpi.uir", PANEL)) < 0)
      return -1;
   DisplayPanel (panelHandle);
   updateSSCPIRegister();
   RunUserInterface ();
   DiscardPanel (panelHandle);
   return (EXIT_SUCCESS);
}
void updateSSCPIRegister(void)
{
   updateSTB();
   updateSRE();
   updateESR();
   updateESE();
}
void updateSTB(void)
{
   scpi_reg_val_t regVal;
   regVal = SCPI_RegGet(&scpi_context, SCPI_REG_STB);
   gui_updateSTB((uint8_t)(0x00FF & regVal));
}
void updateESR(void)
{
   scpi_reg_val_t regVal;
   regVal = SCPI_RegGet(&scpi_context, SCPI_REG_ESR);
   gui_updateESR((uint8_t)(0x00FF & regVal));
}
void updateESE(void)
{
   scpi_reg_val_t regVal;
   regVal = SCPI_RegGet(&scpi_context, SCPI_REG_ESE);
   gui_updateESE((uint8_t)(0x00FF & regVal));
}
void updateSRE(void)
{
   scpi_reg_val_t regVal;
   regVal = SCPI_RegGet(&scpi_context, SCPI_REG_SRE);
   gui_updateSRE((uint8_t)(0x00FF & regVal));
}
/*
 *  The CALLBACK functions below are called from the CVI runtime engine when
 *  user clicks on buttons, inputs data on the GUI etc.
 */
int CVICALLBACK cb_scpi_input (int panel, int control, int event,
      void *callbackData, int eventData1, int eventData2)
{
   char buf[256];
   int len;
   switch (event)
   {
      case EVENT_COMMIT:
         GetCtrlVal(panel, control, buf);
         /* we have to add a endcode to make SCPI accept the string, here a <LF> is added */
         len = strlen(buf);
         buf[len] = '\n';
         len++;
         SCPI_Input(&scpi_context, buf, len);
         updateSSCPIRegister();
         break;
   }
   return 0;
}
int CVICALLBACK cb_quit (int panel, int control, int event,
      void *callbackData, int eventData1, int eventData2)
{
   switch (event)
   {
      case EVENT_COMMIT:
         QuitUserInterface (0);
         break;
   }
   return 0;
}
/*
 * Helper functions for GUI
 */
void gui_updateSTB(uint8_t newSTB)
{
   char buf[5];
   sprintf(buf, "0x%02X", newSTB);
   SetCtrlVal(panelHandle, PANEL_STBHEX, buf);
   SetCtrlVal(panelHandle, PANEL_STB0, (newSTB & 0x01));
   SetCtrlVal(panelHandle, PANEL_STB1, (newSTB & 0x02));
   SetCtrlVal(panelHandle, PANEL_STB2, (newSTB & 0x04));
   SetCtrlVal(panelHandle, PANEL_STB3, (newSTB & 0x08));
   SetCtrlVal(panelHandle, PANEL_STB4, (newSTB & 0x10));
   SetCtrlVal(panelHandle, PANEL_STB5, (newSTB & 0x20));
   SetCtrlVal(panelHandle, PANEL_STB6, (newSTB & 0x40));
   SetCtrlVal(panelHandle, PANEL_STB7, (newSTB & 0x80));
   if(0x00 == (newSTB & 0x40))   SetCtrlVal(panelHandle, PANEL_LEDSRQ, 0);
}
void gui_updateESR(uint8_t newESR)
{
   char buf[5];
   sprintf(buf, "0x%02X", newESR);
   SetCtrlVal(panelHandle, PANEL_ESRHEX, buf);
   SetCtrlVal(panelHandle, PANEL_ESR0, (newESR & 0x01));
   SetCtrlVal(panelHandle, PANEL_ESR1, (newESR & 0x02));
   SetCtrlVal(panelHandle, PANEL_ESR2, (newESR & 0x04));
   SetCtrlVal(panelHandle, PANEL_ESR3, (newESR & 0x08));
   SetCtrlVal(panelHandle, PANEL_ESR4, (newESR & 0x10));
   SetCtrlVal(panelHandle, PANEL_ESR5, (newESR & 0x20));
   SetCtrlVal(panelHandle, PANEL_ESR6, (newESR & 0x40));
   SetCtrlVal(panelHandle, PANEL_ESR7, (newESR & 0x80));
}
void gui_updateESE(uint8_t newESE)
{
   char buf[5];
   sprintf(buf, "0x%02X", newESE);
   SetCtrlVal(panelHandle, PANEL_ESEHEX, buf);
   SetCtrlVal(panelHandle, PANEL_ESE0, (newESE & 0x01));
   SetCtrlVal(panelHandle, PANEL_ESE1, (newESE & 0x02));
   SetCtrlVal(panelHandle, PANEL_ESE2, (newESE & 0x04));
   SetCtrlVal(panelHandle, PANEL_ESE3, (newESE & 0x08));
   SetCtrlVal(panelHandle, PANEL_ESE4, (newESE & 0x10));
   SetCtrlVal(panelHandle, PANEL_ESE5, (newESE & 0x20));
   SetCtrlVal(panelHandle, PANEL_ESE6, (newESE & 0x40));
   SetCtrlVal(panelHandle, PANEL_ESE7, (newESE & 0x80));
}
void gui_updateSRE(uint8_t newSRE)
{
   char buf[5];
   sprintf(buf, "0x%02X", newSRE);
   SetCtrlVal(panelHandle, PANEL_SREHEX, buf);
   SetCtrlVal(panelHandle, PANEL_SRE0, (newSRE & 0x01));
   SetCtrlVal(panelHandle, PANEL_SRE1, (newSRE & 0x02));
   SetCtrlVal(panelHandle, PANEL_SRE2, (newSRE & 0x04));
   SetCtrlVal(panelHandle, PANEL_SRE3, (newSRE & 0x08));
   SetCtrlVal(panelHandle, PANEL_SRE4, (newSRE & 0x10));
   SetCtrlVal(panelHandle, PANEL_SRE5, (newSRE & 0x20));
   SetCtrlVal(panelHandle, PANEL_SRE6, (newSRE & 0x40));
   SetCtrlVal(panelHandle, PANEL_SRE7, (newSRE & 0x80));
}
examples/test-CVI_w_GUI/scpi_user_config.h
New file
@@ -0,0 +1,59 @@
/*-
 * Copyright (c) 2012-2013 Lutz Hoerl, Thorlabs GmbH
 *
 * All Rights Reserved
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
/**
 * @file   scpi_user_config.h
 * @date   Wed Aug 05 10:00:00 UTC 2015
 *
 * @brief  User resp. device dependent SCPI Configuration
 *
 *
 */
#ifndef __SCPI_USER_CONFIG_H_
#define __SCPI_USER_CONFIG_H_
#ifdef   __cplusplus
extern "C" {
#endif
#define SCPI_LINE_ENDING    "\r\n"    /*   use <CR><LF> carriage return + line feed as termination charcters */
#define USE_FULL_ERROR_LIST 1
#define USE_USER_ERROR_LIST 1
#define LIST_OF_USER_ERRORS \
    X(SCPI_USER_ERROR_WARMUP_NOT_FINISHED,      101,  "The device has not finished the warm up process yet")            \
    X(SCPI_USER_ERROR_INTERLOCK_OPEN,           102,  "Switching output to on is not allowed when interlock is open")   \
#ifdef   __cplusplus
}
#endif
#endif   /* #define __SCPI_USER_CONFIG_H_ */