annotate data-provider.c @ 253:10bf2bcdbbd4

Fix Allan deviation normalization for Ch1
author Daniele Nicolodi <daniele@grinta.net>
date Fri, 05 Jun 2015 18:01:57 +0200
parents ec81395bf08d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
144
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1 #include <ansi_c.h>
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
2 #include <userint.h>
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
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
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
6 /* message buffer */
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
7 #define DATA_PROVIDER_MSGLEN 256
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
8 #define DATA_PROVIDER_MSGNUM 16
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
9 static char messages[DATA_PROVIDER_MSGLEN][DATA_PROVIDER_MSGNUM];
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
10 static unsigned int messageid = 0;
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
11
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
12
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
13 /* message callback */
239
ec81395bf08d Solve name collisions and other problems caused by including Windows headers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 169
diff changeset
14 static void CVICALLBACK send_message_callback(void *msg)
144
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
15 {
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
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
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
18 }
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
19
169
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 144
diff changeset
20
239
ec81395bf08d Solve name collisions and other problems caused by including Windows headers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 169
diff changeset
21 void send_message(int thread, const char *frmt, ...)
144
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
22 {
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
23 /* message buffer */
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
24 char *message = messages[messageid++ % DATA_PROVIDER_MSGNUM];
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
25
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
26 /* format message */
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
27 va_list args;
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
28 va_start(args, frmt);
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
29 vsnprintf(message, DATA_PROVIDER_MSGLEN - 1, frmt, args);
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
30 va_end(args);
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
31
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
32 /* signal main thread */
239
ec81395bf08d Solve name collisions and other problems caused by including Windows headers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 169
diff changeset
33 PostDeferredCallToThread(send_message_callback, message, thread);
144
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
34 }
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
35