VTI Instruments EX1000A User Manual page 118

Hide thumbs Also See for EX1000A:
Table of Contents

Advertisement

VTI Instruments Corp.
Host PC
Basic Streaming Data Usage
When using the streaming data interface, via the vtex10xxA_enable_streaming_data function, the
user application provides a callback function. Internally, the instrument driver creates a thread and
then opens a socket for streaming data between the host PC and the instrument. The newly
constructed thread does a "blocking" read on the socket, which causes it to "sleep" (become idle)
until data arrives. When acquisition data arrives, the thread begins executing, receives the
acquisition data from the instrument, executes the user-provided callback function, passing in the
newly arrived data, and then returns to the "sleep" state. The callback function can do whatever is
necessary for the application: write the acquisition values to a file on disk, perform limit checking
on the acquisition values, update an application-specific data structure (e.g., FIFO) post the
acquisition data to a database or spreadsheet, etc. This behavior is illustrated in Figure 6-4, with the
reception of streaming data causing the user-provided callback function to be executed.
NOTE
Since the callback function executes asynchronously in the same process as the main application
thread, it is important that any data or data structures used by both threads are suitably protected to
guarantee consistency. As with any multi-thread application, care must be taken when using inter-
thread communication primitives (e.g., mutexes) to prevent deadlocks and livelocks. Similarly,
performing GUI operations (e.g., updating an on-screen graph) within the callback function needs
to be implemented carefully.
118
`
time
F
6-3: S
IGURE
TREAMING
EX1016A
time
D
N
E
ATA
ETWORK
XAMPLE
EX10xxA Programming

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the EX1000A and is the answer not in the manual?

Questions and answers

Table of Contents