view fake-data-provider.c @ 99:dad4414051c4

Add 'KK_FX80E.dll' to the distributed files
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Tue, 26 Mar 2013 18:23:29 +0100
parents 4102fe614df2
children 6fd67aa13d10
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 = { 1000.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);
		//data[0] = time.tv_sec + time.tv_usec * 1e-6;
		event.data[0] = 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;
}