Mercurial > hg > fxanalyse
comparison data-provider.h @ 144:be87c8e78266
Code cleanup
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Wed, 22 Jan 2014 14:45:24 +0100 |
parents | 8b90fbba59ef |
children | 8a94f1913b4e |
comparison
equal
deleted
inserted
replaced
143:09a4548e1436 | 144:be87c8e78266 |
---|---|
10 extern CmtTSQHandle dataQueue; | 10 extern CmtTSQHandle dataQueue; |
11 | 11 |
12 /* callback receiving messages in the main thread */ | 12 /* callback receiving messages in the main thread */ |
13 void CVICALLBACK MessageCB (void *callbackData); | 13 void CVICALLBACK MessageCB (void *callbackData); |
14 | 14 |
15 /* number of data channels */ | |
16 #define NCHAN 4 | |
17 | |
15 /* data acquisition event */ | 18 /* data acquisition event */ |
16 struct event { | 19 struct event { |
17 struct timeval time; | 20 struct timeval time; |
18 double data[4]; | 21 double data[NCHAN]; |
19 }; | 22 }; |
20 | 23 |
21 /* message buffer */ | 24 /* send messages to the main thread */ |
22 #define DATA_PROVIDER_MSGLEN 256 | 25 void SendMessage(int threadId, const char *frmt, ...); |
23 #define DATA_PROVIDER_MSGNUM 16 | |
24 static char messages[DATA_PROVIDER_MSGLEN][DATA_PROVIDER_MSGNUM]; | |
25 static unsigned int messageid = 0; | |
26 | 26 |
27 #define SendMessage(threadId, ...) \ | 27 /* data providers */ |
28 do { \ | 28 int CVICALLBACK FakeDataProvider (void *functionData); |
29 char *message = messages[messageid++ % DATA_PROVIDER_MSGNUM]; \ | 29 int CVICALLBACK FileDataProvider (void *functionData); |
30 snprintf(message, DATA_PROVIDER_MSGLEN - 1, ##__VA_ARGS__); \ | 30 int CVICALLBACK KKDataProvider (void *functionData); |
31 PostDeferredCallToThread(MessageCB, message, threadId); \ | |
32 } while (0) | |
33 | 31 |
34 #endif | 32 #endif |