Mercurial > hg > fxanalyse
annotate data-provider.c @ 197:79db2c87d1b0
New build. Do not install configuration file.
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Mon, 31 Mar 2014 17:03:37 +0200 |
parents | 97112b45b838 |
children | ec81395bf08d |
rev | line source |
---|---|
144 | 1 #include <ansi_c.h> |
2 #include <userint.h> | |
3 | |
169
97112b45b838
Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
144
diff
changeset
|
4 #include "logging.h" |
97112b45b838
Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
144
diff
changeset
|
5 |
144 | 6 /* message buffer */ |
7 #define DATA_PROVIDER_MSGLEN 256 | |
8 #define DATA_PROVIDER_MSGNUM 16 | |
9 static char messages[DATA_PROVIDER_MSGLEN][DATA_PROVIDER_MSGNUM]; | |
10 static unsigned int messageid = 0; | |
11 | |
12 | |
13 /* message callback */ | |
14 void CVICALLBACK MessageCB (void *msg) | |
15 { | |
16 if (msg != NULL) | |
169
97112b45b838
Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
144
diff
changeset
|
17 logmessage(INFO, msg); |
144 | 18 } |
19 | |
169
97112b45b838
Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
144
diff
changeset
|
20 |
144 | 21 void SendMessage(int threadId, const char *frmt, ...) |
22 { | |
23 /* message buffer */ | |
24 char *message = messages[messageid++ % DATA_PROVIDER_MSGNUM]; | |
25 | |
26 /* format message */ | |
27 va_list args; | |
28 va_start(args, frmt); | |
29 vsnprintf(message, DATA_PROVIDER_MSGLEN - 1, frmt, args); | |
30 va_end(args); | |
31 | |
32 /* signal main thread */ | |
33 PostDeferredCallToThread(MessageCB, message, threadId); | |
34 } | |
35 |