Mercurial > hg > fxanalyse
view data-provider.c @ 271:4a2fa10b8421 default tip
Publish DDS and measured frequencies through ZMQ
author | Daniele Nicolodi <daniele.nicolodi@nist.gov> |
---|---|
date | Sat, 15 Aug 2020 18:22:42 -0600 |
parents | ec81395bf08d |
children |
line wrap: on
line source
#include <ansi_c.h> #include <userint.h> #include "logging.h" /* 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; /* message callback */ static void CVICALLBACK send_message_callback(void *msg) { if (msg != NULL) logmessage(INFO, msg); } void send_message(int thread, const char *frmt, ...) { /* message buffer */ char *message = messages[messageid++ % DATA_PROVIDER_MSGNUM]; /* format message */ va_list args; va_start(args, frmt); vsnprintf(message, DATA_PROVIDER_MSGLEN - 1, frmt, args); va_end(args); /* signal main thread */ PostDeferredCallToThread(send_message_callback, message, thread); }