comparison data-provider.c @ 169:97112b45b838

Get Sr data logger parameters from configuration file. Code reorganization.
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Fri, 14 Feb 2014 16:58:19 +0100
parents be87c8e78266
children ec81395bf08d
comparison
equal deleted inserted replaced
168:4de7f2c9f328 169:97112b45b838
1 #include <ansi_c.h> 1 #include <ansi_c.h>
2 #include <userint.h> 2 #include <userint.h>
3
4 #include "logging.h"
3 5
4 /* message buffer */ 6 /* message buffer */
5 #define DATA_PROVIDER_MSGLEN 256 7 #define DATA_PROVIDER_MSGLEN 256
6 #define DATA_PROVIDER_MSGNUM 16 8 #define DATA_PROVIDER_MSGNUM 16
7 static char messages[DATA_PROVIDER_MSGLEN][DATA_PROVIDER_MSGNUM]; 9 static char messages[DATA_PROVIDER_MSGLEN][DATA_PROVIDER_MSGNUM];
8 static unsigned int messageid = 0; 10 static unsigned int messageid = 0;
9 11
10 /* logging function defined in main program */
11 extern void logmsg(const char *frmt, ...);
12 12
13 /* message callback */ 13 /* message callback */
14 void CVICALLBACK MessageCB (void *msg) 14 void CVICALLBACK MessageCB (void *msg)
15 { 15 {
16 if (msg != NULL) 16 if (msg != NULL)
17 logmsg(msg); 17 logmessage(INFO, msg);
18 } 18 }
19
19 20
20 void SendMessage(int threadId, const char *frmt, ...) 21 void SendMessage(int threadId, const char *frmt, ...)
21 { 22 {
22 /* message buffer */ 23 /* message buffer */
23 char *message = messages[messageid++ % DATA_PROVIDER_MSGNUM]; 24 char *message = messages[messageid++ % DATA_PROVIDER_MSGNUM];