comparison fake-data-provider.c @ 88:9b7588cd4013

Move data acquisition into separate thread The data acquisition thread transfers data to the main thread trough a Thread Safe Queue. This separation allows for making the data acquisition system pluggable. The old file based communication to the KK counter is implemented along with a very simple fake data provider.
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Thu, 21 Mar 2013 18:24:45 +0100
parents
children 4102fe614df2
comparison
equal deleted inserted replaced
87:0950d4b3a45c 88:9b7588cd4013
1 /* FXAnalise fake data provider */
2
3 #include <userint.h>
4 #include <utility.h>
5
6 /* data acquisition flag */
7 extern int acquiring;
8 /* data queue */
9 extern CmtTSQHandle dataQueue;
10
11 int CVICALLBACK FakeDataProvider (void *functionData)
12 {
13 int mainThreadId;
14 double mark;
15 double data[5] = {0.0, 10000.0, 2.0, 3.0, 4.0};
16
17 /* get main thread id to post messages to it */
18 mainThreadId = CmtGetMainThreadID();
19
20 while (acquiring) {
21 mark = Timer();
22
23 /* update data */
24 GetCurrentDateTime(&data[0]);
25 data[1] = data[1] + 0.1;
26
27 /* push data into the data queue */
28 CmtWriteTSQData(dataQueue, data, 5, TSQ_INFINITE_TIMEOUT, 0);
29
30 /* wait till next second */
31 SyncWait(mark, 1.00);
32 }
33
34 return 0;
35 }