VTI Instruments Corp.
118
EX10xxA Programming
`
Host PC
time
time
Rece
ive s
tream
ing d
ata
Rece
ive s
tream
ing d
ata
Rece
ive s
tream
ing d
ata
Rece
ive s
tream
ing d
ata
Rece
ive:
vtex
10xx
a_tr
ig_i
nit(
)
resp
onse
Send:
vtex10
xxa_en
able_s
treami
ng_dat
a()
reques
t
Rece
ive:
vtex
10xx
a_en
able
_str
eami
ng_d
ata(
)
resp
onse
Send:
vtex10
xxa_tr
ig_ini
t()
reques
t
EX1016A
F
IGURE
6-3:
S
TREAMING
D
ATA
N
ETWORK
E
XAMPLE
Basic Streaming Data Usage
When using the streaming data interface, via the
vtex10xxA_enable_streaming_data
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.
Содержание EX1000A
Страница 25: ...www vtiinstruments com EX10xxA Introduction 25 FIGURE 1 2 RACKMOUNT HARDWARE INSTALLATION DIAGRAM ...
Страница 27: ...www vtiinstruments com EX10xxA Introduction 27 FIGURE 1 4 ISOMETRIC AND INTERNAL CJC PLATE DIAGRAM ...
Страница 28: ...VTI Instruments Corp 28 EX10xxA Introduction EX1044 DIAGRAM ...
Страница 29: ...www vtiinstruments com EX10xxA Introduction 29 FIGURE 1 5 EX1044 TABLE TOP USAGE ...
Страница 34: ......
Страница 56: ......
Страница 74: ......
Страница 130: ......
Страница 282: ......