1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
#include "vxi11.h"
#define VXI11_DEFAULT_TIMEOUT 1000
static CLIENT* clnt = NULL;
static Device_Link link;
void vxi11_open(char* address, char* device) {
clnt = clnt_create(address, DEVICE_CORE, DEVICE_CORE_VERSION, "tcp");
if (clnt == NULL) {
printf("error creating client\n");
}
else {
Create_LinkParms link_parms;
link_parms.clientId = (long) clnt;
link_parms.lockDevice = 0;
link_parms.lock_timeout = VXI11_DEFAULT_TIMEOUT;
link_parms.device = device;
Create_LinkResp* linkresp = create_link_1(&link_parms, clnt);
link = linkresp->lid;
}
}
void vxi11_readstatusbyte() {
if (clnt == NULL)
return;
Device_GenericParms params = { .lid = link, .flags = 0x0, .lock_timeout = VXI11_DEFAULT_TIMEOUT, .io_timeout =
VXI11_DEFAULT_TIMEOUT };
Device_ReadStbResp* resp = device_readstb_1(¶ms, clnt);
}
void vxi11_write() {
if (clnt == NULL) {
return;
}
char* IDENTIFY = "*IDN?";
Device_WriteParms params = { .lid = link, .io_timeout = VXI11_DEFAULT_TIMEOUT,
.lock_timeout = VXI11_DEFAULT_TIMEOUT, .flags = 0x0 };
params.data.data_len = sizeof(IDENTIFY);
params.data.data_val = IDENTIFY;
Device_WriteResp* resp = device_write_1(¶ms, clnt);
}
void vxi11_read() {
if (clnt == NULL) {
return;
}
Device_ReadParms params = { .lid = link, .requestSize = 256, .io_timeout = VXI11_DEFAULT_TIMEOUT, .lock_timeout =
VXI11_DEFAULT_TIMEOUT, .flags = 0x0, .termChar = 0x0 };
Device_ReadResp* resp = device_read_1(¶ms, clnt);
}
void vxi11_docmd() {
if (clnt == NULL)
return;
Device_DocmdParms params = { .lid = link, .flags = 0x0, .io_timeout = VXI11_DEFAULT_TIMEOUT, .lock_timeout =
VXI11_DEFAULT_TIMEOUT, .cmd = 0, .network_order = 0, .datasize = 0 };
params.data_in.data_in_len = 0;
params.data_in.data_in_val = NULL;
Device_DocmdResp* resp = device_docmd_1(¶ms, clnt);
}
void vxi11_trigger() {
if (clnt == NULL)
return;
Device_GenericParms params = { .lid = link, .flags = 0x0, .lock_timeout = VXI11_DEFAULT_TIMEOUT, .io_timeout =
VXI11_DEFAULT_TIMEOUT };
device_trigger_1(¶ms, clnt);
}
void vxi11_clear() {
if (clnt == NULL)
return;
Device_GenericParms params = { .lid = link, .flags = 0x0, .lock_timeout = VXI11_DEFAULT_TIMEOUT, .io_timeout =
VXI11_DEFAULT_TIMEOUT };
device_clear_1(¶ms, clnt);
}
void vxi11_remote() {
if (clnt == NULL)
return;
Device_GenericParms params = { .lid = link, .flags = 0x0, .lock_timeout = VXI11_DEFAULT_TIMEOUT, .io_timeout =
VXI11_DEFAULT_TIMEOUT };
device_remote_1(¶ms, clnt);
}
void vxi11_local() {
if (clnt == NULL)
return;
Device_GenericParms params = { .lid = link, .flags = 0x0, .lock_timeout = VXI11_DEFAULT_TIMEOUT, .io_timeout =
VXI11_DEFAULT_TIMEOUT };
device_local_1(¶ms, clnt);
}
void vxi11_lock() {
if (clnt == NULL)
return;
Device_LockParms params = { .lid = link, .flags = 0x0, .lock_timeout = VXI11_DEFAULT_TIMEOUT };
device_lock_1(¶ms, clnt);
}
void vxi11_unlock() {
if (clnt == NULL)
return;
device_unlock_1(&link, clnt);
}
void vxi11_create_intr_chan() {
if (clnt == NULL)
return;
Device_RemoteFunc remotefunc = { .hostAddr = 0x0, .hostPort = 0x0, .progNum = 0x0, .progVers = 0x0, .progFamily =
DEVICE_TCP };
create_intr_chan_1(&remotefunc, clnt);
}
void vxi11_destroy_intr_chan() {
if (clnt == NULL)
return;
destroy_intr_chan_1(NULL, clnt);
}
void vxi11_abort() {
if (clnt == NULL)
return;
device_abort_1(&link, clnt);
}
void vxi11_close() {
destroy_link_1(&link, clnt);
clnt_destroy(clnt);
clnt = NULL;
}
|