Host Computer
The following sample code segment illustrates a very basic use of the streaming data interface.
The callback function, stream_callback, just prints the timestamps and data values to a FILE
handle. The FILE handle, as well as a sample count total variable, are stored in a user-defined data
structure. A pointer to this structure is passed to the vtex1629_enable_streaming_data function,
along with a function pointer to the streaming callback function. Later, when streaming data pages
(scans) are received, a pointer to the acquisition data, along with the pointer to the user-defined
data structure, are passed to the callback function. The user-defined data structure pointer is passed
as a void* and should be cast to the appropriate type within the callback function.
#define INSTR_LANGUAGE_SPECIFIC
#include<vtex1629.h>
typedef struct {
FILE
ViInt32
} user_struct;
user_struct my_struct = {0};
ViInt32 stream_callback( void *priv, EX1629_rpc_datapage *data )
{
user_struct
ViInt32
ViInt32
priv_struct = (user_struct *)priv;
/* Loop through all of the datasets in the datapage. */
for( ds_idx = 0; ds_idx < data->dataset.dataset_len && ds_idx <
EX1629 Programming
`
User callback
User callback
User callback
User callback
User callback
time
F
6-3: S
IGURE
TREAMING
*fout;
sample_count;
*priv_struct; // pointer to user structure
ds_idx;
smp_idx;
MAX_NUM_DATASETS; ds_idx++ ) {
EX1629
1
3
5
7
9
11
13
SHUNT
CAL
RES
PWR
HD
LAN
0
2
4
6
8
10
12
time
D
W
U
C
ATA
ITH
SER
ALLBACK
// dataset index
// sample index
www.vtiinstruments.com
15
17
19
21
23
25
27
29
31
33
35
37
39
41
43
45
SHUNT
SHUNT
CAL
CAL
RES
RES
14
16
18
20
22
24
26
28
30
32
34
36
38
40
42
44
EX1629
47
46
89
Need help?
Do you have a question about the EX1629 and is the answer not in the manual?