view fake-data-provider.c @ 137:792ac7151f0f

Fix Allan deviation linear drift contribution removal
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Wed, 22 Jan 2014 13:41:07 +0100
parents 5bba1d1c3b46
children 931ebae87964
line wrap: on
line source

/* FXAnalise fake data provider */

#include <userint.h>
#include <utility.h>
#include <future.h>

#include "data-provider.h"

int CVICALLBACK FakeDataProvider (void *functionData)
{
	int mainThreadId;
	double mark;
	struct event event = {
		.time = { 0, }, 
		.data = { 55000000.0, 2.0, 3.0, 4.0 }
	};
	
	/* get main thread id to post messages to it */
	mainThreadId = CmtGetMainThreadID();
	
	while (acquiring) {
   		mark = Timer();
		
		/* update data */
		gettimeofday(&event.time, NULL);
		event.data[0] += 0.1;
		
		/* push data into the data queue */
		CmtWriteTSQData(dataQueue, &event, 1, TSQ_INFINITE_TIMEOUT, 0);
		
		/* wait till next second */
   		SyncWait(mark, 1.00);
	}
	
	return 0;
}