FIGURE 6-4: STREAMING DATA WITH USER CALLBACK
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 vtex10xxA_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.
Streaming Data Example Program
// INCLUDE FILES & DEFINES
#define INSTR_LANGUAGE_SPECIFIC
#include <vtex10xxA.h>
#include <visa.h>
#include <vpptype.h>
#include <visatype.h>
#define RESOURCE_10XX "TCPIP0::192.168.1.103::INSTR"
ViSession ex10XXHandle = 0;
ViStatus error = VI_SUCCESS
ViInt32 streaming_function( void *priv, EX10xxA_SampleData *data );