Mercurial > hg > fxanalyse
diff 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 |
line wrap: on
line diff
--- a/data-provider.h Wed Jan 22 14:45:23 2014 +0100 +++ b/data-provider.h Wed Jan 22 14:45:24 2014 +0100 @@ -12,23 +12,21 @@ /* callback receiving messages in the main thread */ void CVICALLBACK MessageCB (void *callbackData); +/* number of data channels */ +#define NCHAN 4 + /* data acquisition event */ struct event { struct timeval time; - double data[4]; + double data[NCHAN]; }; -/* message buffer */ -#define DATA_PROVIDER_MSGLEN 256 -#define DATA_PROVIDER_MSGNUM 16 -static char messages[DATA_PROVIDER_MSGLEN][DATA_PROVIDER_MSGNUM]; -static unsigned int messageid = 0; +/* send messages to the main thread */ +void SendMessage(int threadId, const char *frmt, ...); -#define SendMessage(threadId, ...) \ - do { \ - char *message = messages[messageid++ % DATA_PROVIDER_MSGNUM]; \ - snprintf(message, DATA_PROVIDER_MSGLEN - 1, ##__VA_ARGS__); \ - PostDeferredCallToThread(MessageCB, message, threadId); \ - } while (0) +/* data providers */ +int CVICALLBACK FakeDataProvider (void *functionData); +int CVICALLBACK FileDataProvider (void *functionData); +int CVICALLBACK KKDataProvider (void *functionData); #endif