comparison FXAnalyse.c @ 170:a4fcebb5941b

Make data folder configurable in configuration file
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Fri, 14 Feb 2014 16:58:19 +0100
parents 97112b45b838
children d96f0b04f7fe
comparison
equal deleted inserted replaced
169:97112b45b838 170:a4fcebb5941b
20 #include "sr-data-logger.h" 20 #include "sr-data-logger.h"
21 #include "config.h" 21 #include "config.h"
22 #include "logging.h" 22 #include "logging.h"
23 23
24 24
25 #define DATAFOLDER "Z:\\Measures-2014"
26
27 #define FREP_STEP_SIZE 50000.0 25 #define FREP_STEP_SIZE 50000.0
28
29 #define SPEED_OF_LIGHT 299792458.0 // m/s 26 #define SPEED_OF_LIGHT 299792458.0 // m/s
30 #define SR_WAVELENGTH 698.4460 // nm 27 #define SR_WAVELENGTH 698.4460 // nm
31 #define HG_WAVELENGTH 1062.4000 // nm 28 #define HG_WAVELENGTH 1062.4000 // nm
29
30 // select which data provider to use
31 #ifdef NDEBUG
32 #define DataProvider KKDataProvider
33 #else
34 #define DataProvider FakeDataProvider
35 #endif
32 36
33 37
34 // data acquisition status 38 // data acquisition status
35 int acquiring; 39 int acquiring;
36 // data queue 40 // data queue
37 CmtTSQHandle dataQueue; 41 CmtTSQHandle dataQueue;
38 // data provider thread 42 // data provider thread
39 CmtThreadFunctionID dataProviderThread; 43 CmtThreadFunctionID dataProviderThread;
40 44
41 // select which data provider to use
42 #ifdef NDEBUG
43 #define DataProvider KKDataProvider
44 #else
45 #define DataProvider FakeDataProvider
46 #endif
47 45
48 struct event event; 46 struct event event;
49 double utc; 47 double utc;
50 double Ch1, Ch2, Ch3, Ch4; 48 double Ch1, Ch2, Ch3, Ch4;
51 double Math1, Math2, Math3, Math4, Math5; 49 double Math1, Math2, Math3, Math4, Math5;
267 .t0 = 0.0 265 .t0 = 0.0
268 }; 266 };
269 267
270 268
271 // data loggging 269 // data loggging
270 static char *datafolder;
271
272 struct datafile { 272 struct datafile {
273 char *name; 273 char *name;
274 double *data; 274 double *data;
275 int nchan; 275 int nchan;
276 int control; 276 int control;
326 326
327 327
328 static inline void datafile_append(struct datafile *d, char *id, char *timestr) 328 static inline void datafile_append(struct datafile *d, char *id, char *timestr)
329 { 329 {
330 if (d->write) 330 if (d->write)
331 write_data(DATAFOLDER, d->name, id, timestr, utc, d->data, d->nchan); 331 write_data(datafolder, d->name, id, timestr, utc, d->data, d->nchan);
332 } 332 }
333 333
334 334
335 static struct datalogger datalogger; 335 static struct datalogger datalogger;
336 336
398 char path[MAX_PATHNAME_LEN]; 398 char path[MAX_PATHNAME_LEN];
399 GetIniFilePath(path); 399 GetIniFilePath(path);
400 IniText configuration = Ini_New(TRUE); 400 IniText configuration = Ini_New(TRUE);
401 Ini_ReadFromFile(configuration, path); 401 Ini_ReadFromFile(configuration, path);
402 402
403 // data folder
404 rv = Ini_GetStringCopy(configuration, "data", "folder", &datafolder);
405 if (rv <= 0) {
406 logmessage(ERROR, "data folder not configured in %s", path);
407 // do not allow to start the acquisition
408 SetCtrlAttribute(MainPanel, PANEL_STARTBUTTON, ATTR_DIMMED, TRUE);
409 }
410
403 // get AD9956 configuration parameters 411 // get AD9956 configuration parameters
404 char host[256]; 412 char host[256];
405 int port; 413 int port;
406 double clock; 414 double clock;
407 rv = Ini_GetStringIntoBuffer(configuration, "AD9956", "host", host, sizeof(host)); 415 rv = Ini_GetStringIntoBuffer(configuration, "AD9956", "host", host, sizeof(host));