RocketLogger  1.1.6
rl_util.c
Go to the documentation of this file.
1 
32 #include "version.h"
33 
34 #include "rl_util.h"
35 
40 void rl_print_config(struct rl_conf* conf) {
41 
42  char file_format_names[3][8] = {"no file", "csv", "binary"};
43  char data_aggregation_names[3][10] = {"none", "downsample", "average"};
44 
45  if (conf->sample_rate >= KSPS) {
46  printf(" Sampling rate: %dkSps\n", conf->sample_rate / KSPS);
47  } else {
48  printf(" Sampling rate: %dSps\n", conf->sample_rate);
49  }
50  printf(" Data aggregation: %s\n",
51  data_aggregation_names[conf->aggregation]);
52 
53  printf(" Update rate: %dHz\n", conf->update_rate);
54  if (conf->enable_web_server == 1) {
55  printf(" Webserver: enabled\n");
56  } else {
57  printf(" Webserver: disabled\n");
58  }
59  if (conf->digital_inputs == 1) {
60  printf(" Digital inputs: enabled\n");
61  } else {
62  printf(" Digital inputs: disabled\n");
63  }
64  printf(" File format: %s\n", file_format_names[conf->file_format]);
65  if (conf->file_format != NO_FILE) {
66  printf(" File name: %s\n", conf->file_name);
67  }
68  if (conf->max_file_size != 0) {
69  printf(" Max file size: %lluMB\n",
70  conf->max_file_size / (uint64_t)1e6);
71  }
72  if (conf->calibration == CAL_IGNORE) {
73  printf(" Calibration: ignored\n");
74  }
75  printf(" Channels: ");
76  for (int i = 0; i < NUM_CHANNELS; i++) {
77  if (conf->channels[i] == CHANNEL_ENABLED) {
78  printf("%d,", i);
79  }
80  }
81  printf("\n");
82  if (conf->force_high_channels[0] == CHANNEL_ENABLED ||
84  printf(" Forced channels: ");
85  for (int i = 0; i < NUM_I_CHANNELS; i++) {
86  if (conf->force_high_channels[i] == CHANNEL_ENABLED) {
87  printf("%d,", i + 1);
88  }
89  }
90  printf("\n");
91  }
92  if (conf->sample_limit == 0) {
93  printf(" Sample limit: no limit\n");
94  } else {
95  printf(" Sample limit: %d\n", conf->sample_limit);
96  }
97 }
98 
104 
105  if (status->state == RL_OFF) {
106  printf("\nRocketLogger IDLE\n\n");
107  } else {
108  printf("\nRocketLogger Status: RUNNING\n");
109  rl_print_config(&(status->conf));
110  printf(" Samples taken: %llu\n", status->samples_taken);
111  time_t time = (time_t)status->calibration_time;
112  if (time > 0) {
113  printf(" Calibration time: %s\n", ctime(&time));
114  } else {
115  printf(" Calibration time: No calibration file found\n");
116  }
117  printf("\n");
118  }
119 }
120 
124 void rl_print_version(void) {
125  printf("RocketLogger Software Stack version %s\n", PROJECT_VERSION);
126  printf(" git@%s (%s)\n", GIT_DESCRIPTION, GIT_DATE);
127  printf(" compiled at %s\n", COMPILE_DATE);
128 }
129 
130 // argument parsing
137  if (strcmp(mode, "sample") == 0) {
138  return LIMIT;
139  } else if (strcmp(mode, "cont") == 0) {
140  return CONTINUOUS;
141  } else if (strcmp(mode, "meter") == 0) {
142  return METER;
143  } else if (strcmp(mode, "status") == 0) {
144  return STATUS;
145  } else if (strcmp(mode, "stop") == 0) {
146  return STOPPED;
147  } else if (strcmp(mode, "set") == 0) {
148  return SET_DEFAULT;
149  } else if (strcmp(mode, "conf") == 0) {
150  return PRINT_DEFAULT;
151  } else if (strcmp(mode, "version") == 0 || strcmp(mode, "--version") == 0) {
152  return PRINT_VERSION;
153  } else if (strcmp(mode, "help") == 0 || strcmp(mode, "h") == 0 ||
154  strcmp(mode, "-h") == 0 || strcmp(mode, "--help") == 0) {
155  return HELP;
156  }
157 
158  return NO_MODE;
159 }
160 
167  if (strcmp(option, "f") == 0) {
168  return FILE_NAME;
169  } else if (strcmp(option, "r") == 0) {
170  return SAMPLE_RATE;
171  } else if (strcmp(option, "u") == 0) {
172  return UPDATE_RATE;
173  } else if (strcmp(option, "ch") == 0) {
174  return CHANNEL;
175  } else if (strcmp(option, "fhr") == 0) {
176  return FHR;
177  } else if (strcmp(option, "w") == 0) {
178  return WEB;
179  } else if (strcmp(option, "d") == 0) {
180  return DIGITAL_INPUTS;
181  } else if (strcmp(option, "a") == 0) {
182  return AMBIENT;
183  } else if (strcmp(option, "g") == 0) {
184  return AGGREGATION;
185  } else if (strcmp(option, "s") == 0) {
186  return DEF_CONF;
187  } else if (strcmp(option, "c") == 0) {
188  return CALIBRATION;
189  } else if (strcmp(option, "C") == 0) {
190  return COMMENT;
191  } else if (strcmp(option, "format") == 0) {
192  return FILE_FORMAT;
193  } else if (strcmp(option, "size") == 0) {
194  return FILE_SIZE;
195  }
196 
197  return NO_OPTION;
198 }
199 
206 int parse_channels(int channels[], char* value) {
207 
208  // check first channel number
209  if (isdigit(value[0]) && atoi(value) >= 0 && atoi(value) <= 9) {
210 
211  // reset default channel selection
212  memset(channels, 0, sizeof(int) * NUM_CHANNELS);
213  channels[atoi(value)] = 1;
214 
215  } else if (strcmp(value, "all") == 0) {
216  // all channels
217  int i;
218  for (i = 0; i < NUM_CHANNELS; i++) {
219  channels[i] = CHANNEL_ENABLED;
220  }
221  } else {
222  rl_log(ERROR, "wrong channel number");
223  return FAILURE;
224  }
225 
226  // loop
227  int j;
228  for (j = 1; j < 2 * (NUM_CHANNELS - 1) && value[j] == ','; j = j + 2) {
229 
230  // check channel number
231  char* c = &value[j + 1];
232  if (isdigit(c[0]) && atoi(c) >= 0 && atoi(c) < NUM_CHANNELS) {
233  channels[atoi(c)] = 1;
234  } else {
235  rl_log(ERROR, "wrong channel number");
236  return FAILURE;
237  }
238  }
239 
240  return SUCCESS;
241 }
242 
252 int parse_args(int argc, char* argv[], struct rl_conf* conf,
253  int* set_as_default, char** file_comment) {
254 
255  int i; // argument count variable
256  int no_file = 0;
257  *set_as_default = 0;
258  *file_comment = NULL;
259 
260  // need at least 2 arguments
261  if (argc < 2) {
262  rl_log(ERROR, "no mode");
263  return FAILURE;
264  }
265 
266  // MODE
267  conf->mode = get_mode(argv[1]);
268  if (conf->mode == NO_MODE) {
269  rl_log(ERROR, "wrong mode");
270  return FAILURE;
271  }
272 
273  if (conf->mode == LIMIT) {
274  // parse sample limit
275  if (argc > 2 && isdigit(argv[2][0]) && atoi(argv[2]) > 0) {
276  conf->sample_limit = atoi(argv[2]);
277  i = 3;
278  } else {
279  rl_log(ERROR, "no possible sample limit");
280  return FAILURE;
281  }
282  } else {
283  i = 2;
284  }
285 
286  // disable webserver as default for non-continuous mode
287  if (conf->mode == STATUS || conf->mode == LIMIT) {
288  conf->enable_web_server = 0;
289  }
290 
291  // stop parsing for some modes
292  if (conf->mode == STOPPED || conf->mode == PRINT_DEFAULT ||
293  conf->mode == HELP) {
294  return SUCCESS;
295  }
296 
297  // reset default configuration
298  if (conf->mode == SET_DEFAULT && isdigit(argv[i][0]) &&
299  atoi(argv[i]) == 0) {
300  reset_config(conf);
301  conf->mode = SET_DEFAULT;
302  return SUCCESS;
303  }
304 
305  // OPTIONS
306  for (; i < argc; i++) {
307  if (argv[i][0] == '-') {
308  switch (get_option(&argv[i][1])) {
309 
310  case FILE_NAME:
311  if (argc > ++i) {
312  if (isdigit(argv[i][0]) &&
313  atoi(argv[i]) == 0) { // no file write
314  no_file = 1;
315  conf->file_format = NO_FILE;
316  } else if (strlen(argv[i]) >= MAX_PATH_LENGTH) {
317  rl_log(ERROR, "file name too long");
318  return FAILURE;
319  } else {
320  strcpy(conf->file_name, argv[i]);
321  }
322  } else {
323  rl_log(ERROR, "no file name given");
324  return FAILURE;
325  }
326  break;
327 
328  case SAMPLE_RATE:
329  if (argc > ++i && isdigit(argv[i][0])) {
330  if (argv[i][strlen(argv[i]) - 1] == 'k') {
331  conf->sample_rate = atoi(argv[i]) * KSPS;
332  } else {
333  conf->sample_rate = atoi(argv[i]);
334  }
335  if (check_sample_rate(conf->sample_rate) ==
336  FAILURE) { // check if rate allowed
337  rl_log(ERROR, "wrong sampling rate");
338  return FAILURE;
339  }
340  } else {
341  rl_log(ERROR, "no sampling rate");
342  return FAILURE;
343  }
344  break;
345 
346  case UPDATE_RATE:
347  if (argc > ++i && isdigit(argv[i][0])) {
348  conf->update_rate = atoi(argv[i]);
349  if (check_update_rate(conf->update_rate) ==
350  FAILURE) { // check if rate allowed
351  rl_log(ERROR, "wrong update rate");
352  return FAILURE;
353  }
354  } else {
355  rl_log(ERROR, "no update rate");
356  return FAILURE;
357  }
358  break;
359 
360  case CHANNEL:
361  if (argc > ++i) {
362  if (parse_channels(conf->channels, argv[i]) == FAILURE) {
363  return FAILURE;
364  }
365  } else {
366  rl_log(ERROR, "no channel number");
367  return FAILURE;
368  }
369  break;
370 
371  case FHR:
372  if (argc > ++i) {
373 
374  // check first number
375  char* c = argv[i];
376  if (isdigit(c[0]) && atoi(c) < 3 && atoi(c) >= 0) {
377 
378  // reset default forced channel selection
379  memset(conf->force_high_channels, 0,
380  sizeof(conf->force_high_channels));
381  if (atoi(c) > 0) {
382  conf->force_high_channels[atoi(c) - 1] =
384  }
385  } else {
386  rl_log(ERROR, "wrong force-channel number");
387  return FAILURE;
388  }
389  // check second number
390  if (argv[i][1] == ',') {
391 
392  char* c = &argv[i][2];
393  if (atoi(c) < 3 && atoi(c) > 0) {
394  conf->force_high_channels[atoi(c) - 1] =
396  } else {
397  rl_log(ERROR, "wrong force-channel number");
398  return FAILURE;
399  }
400  }
401  } else {
402  rl_log(ERROR, "no force channel number");
403  return FAILURE;
404  }
405  break;
406 
407  case WEB:
408  if (argc > i + 1 && isdigit(argv[i + 1][0]) &&
409  atoi(argv[i + 1]) == 0) {
410  i++;
411  conf->enable_web_server = 0;
412  } else {
413  conf->enable_web_server = 1;
414  }
415  break;
416 
417  case DIGITAL_INPUTS:
418  if (argc > i + 1 && isdigit(argv[i + 1][0]) &&
419  atoi(argv[i + 1]) == 0) {
420  i++;
422  } else {
424  }
425  break;
426 
427  case AMBIENT:
428  if (argc > i + 1 && isdigit(argv[i + 1][0]) &&
429  atoi(argv[i + 1]) == 0) {
430  i++;
432  } else {
434  }
435  break;
436 
437  case AGGREGATION:
438  if (argc > ++i) {
439  if (isdigit(argv[i][0]) && atoi(argv[i]) == 0) {
440  conf->aggregation = AGGREGATE_NONE;
441  } else if (no_file == 0) {
442  // ignore format, when no file is written
443  if (strcmp(argv[i], "none") == 0) {
444  conf->aggregation = AGGREGATE_NONE;
445  } else if (strcmp(argv[i], "average") == 0) {
447  } else if (strcmp(argv[i], "downsample") == 0) {
449  } else {
450  rl_log(ERROR, "wrong file format");
451  return FAILURE;
452  }
453  } else {
454  rl_log(INFO, "aggregation type ignored");
455  }
456  } else {
457  rl_log(ERROR, "no aggregation type");
458  return FAILURE;
459  }
460  break;
461 
462  case DEF_CONF:
463  *set_as_default = 1;
464  break;
465 
466  case CALIBRATION:
467  if (argc > i + 1 && isdigit(argv[i + 1][0]) &&
468  atoi(argv[i + 1]) == 0) {
469  i++;
470  conf->calibration = CAL_IGNORE;
471  } else {
472  conf->calibration = CAL_USE;
473  }
474  break;
475 
476  case COMMENT:
477  if (argc > ++i) {
478  if (no_file == 0) {
479  *file_comment = argv[i];
480  } else {
481  rl_log(INFO, "comment ignored");
482  }
483  } else {
484  rl_log(ERROR, "no comment given");
485  return FAILURE;
486  }
487  break;
488 
489  case FILE_FORMAT:
490  if (argc > ++i) {
491  // ignore format, when no file is written
492  if (no_file == 0) {
493  if (strcmp(argv[i], "csv") == 0) {
494  conf->file_format = CSV;
495  } else if (strcmp(argv[i], "bin") == 0) {
496  conf->file_format = BIN;
497  } else {
498  rl_log(ERROR, "wrong file format");
499  return FAILURE;
500  }
501  } else {
502  rl_log(INFO, "file format ignored");
503  }
504  } else {
505  rl_log(ERROR, "no file format");
506  return FAILURE;
507  }
508  break;
509 
510  case FILE_SIZE:
511  if (argc > ++i && isdigit(argv[i][0])) {
512  conf->max_file_size = atoll(argv[i]);
513  switch (argv[i][strlen(argv[i]) - 1]) {
514  case 'k':
515  case 'K':
516  conf->max_file_size *= 1000;
517  break;
518  case 'm':
519  case 'M':
520  conf->max_file_size *= 1000000;
521  break;
522  case 'g':
523  case 'G':
524  conf->max_file_size *= 1000000000;
525  break;
526  default:
527  break;
528  }
529  // check file size
530  if (conf->max_file_size != 0 &&
531  conf->max_file_size < 5000000) {
532  rl_log(ERROR, "too small file size (min: 5m)");
533  return FAILURE;
534  }
535  } else {
536  rl_log(ERROR, "no file size");
537  return FAILURE;
538  }
539  break;
540 
541  case NO_OPTION:
542  rl_log(ERROR, "wrong option");
543  return FAILURE;
544 
545  default:
546  rl_log(ERROR, "wrong option");
547  return FAILURE;
548  }
549  } else {
550  rl_log(ERROR, "use -[option] [value]");
551  return FAILURE;
552  }
553  }
554 
555  // ambient file name
556  if (conf->file_format != NO_FILE &&
557  conf->ambient.enabled == AMBIENT_ENABLED) {
558  ambient_set_file_name(conf);
559  }
560 
561  return SUCCESS;
562 }
563 
564 // help
568 void print_usage(void) {
569  printf("\n");
570  printf("Usage:\n");
571  printf(" rocketlogger mode -[option value]\n");
572  printf("\n");
573  printf(" Modes:\n");
574  printf(" sample number Acquires number of samples.\n");
575  printf(" cont Continuously acquires samples.\n");
576  printf(" meter Starts RocketLogger Meter.\n");
577  printf(" status Get status of RocketLogger.\n");
578  printf(" stop Stops RocketLogger.\n");
579  printf(" set Set default configuration of RocketLogger "
580  "(use normal options).\n");
581  printf(" Use 'set 0' to reset the default "
582  "configuration.\n");
583  printf(" conf Print default configuration of "
584  "RocketLogger.\n");
585  printf("\n");
586  printf(" Options:\n");
587  printf(" -r rate Acquisition rate selection. Supported "
588  "rates:\n");
589  printf(
590  " 1, 10, 100, 1k, 2k, 4k, 8k, 16k, 32k, 64k\n");
591  printf(" -u update_rate Data update rate selection. Supported "
592  "rates:\n");
593  printf(" 1, 2, 5, 10 (in Hz)\n");
594  printf(" -ch ch1,ch2,... Channel selection.\n");
595  printf(" Possible channels ('-ch all' to enable "
596  "all):\n");
597  printf(" 0: I1H\t\t4: I2H\n");
598  printf(" 1: I1L\t\t5: I2L\n");
599  printf(" 2: V1 \t\t6: V3\n");
600  printf(" 3: V2 \t\t7: V4\n");
601  printf(" -fhr ch1,ch2 Force high-range.\n");
602  printf(" 0: no channel, 1: I1, 2: I2\n");
603  printf(" -c Use calibration, if existing.\n");
604  printf(" '-c 0' to ignore calibration.\n");
605  printf(" -f file Stores data to specified file.\n");
606  printf(" '-f 0' will disable file storing.\n");
607  printf(" -d Log digital inputs.\n");
608  printf(" '-d 0' to disable digital input "
609  "logging.\n");
610  printf(" -a Log ambient sensors, if available.\n");
611  printf(" '-a 0' to disable ambient sensor "
612  "logging.\n");
613  printf(" -g Data aggregation mode for low sample "
614  "rates.\n");
615  printf(" Existing modes: 'average', "
616  "'downsample'.\n");
617  printf(" '-g 0' to disable aggregation/low sample "
618  "rates.\n");
619  printf(" -format format Select file format: csv, bin.\n");
620  printf(" -size file_size Select max file size (k, m, g can be "
621  "used).\n");
622  printf(" -C comment Comment stored in file header. Comment is "
623  "ignored\n");
624  printf(" if file saving is disabled.\n");
625  printf(" -w Enable webserver plotting.\n");
626  printf(" Use '-w 0' to disable webserver "
627  "plotting.\n");
628  printf(" -s Set configuration as default (all except "
629  "comment).\n");
630  printf("\n");
631  printf(" Help/Info:\n");
632  printf(" help, --help Display this help message.\n");
633  printf(" version, --version Display the RocketLogger software "
634  "version.\n");
635  printf("\n");
636 }
637 
638 // configuration handling
643 void print_config(struct rl_conf* conf) {
644  printf("\nRocketLogger Configuration:\n");
645  rl_print_config(conf);
646  printf("\n");
647 }
648 
653 void reset_config(struct rl_conf* conf) {
654  conf->version = RL_CONF_VERSION;
655  conf->mode = CONTINUOUS;
656  conf->sample_rate = 1000;
658  conf->update_rate = 1;
659  conf->sample_limit = 0;
661  conf->enable_web_server = 1;
662  conf->calibration = CAL_USE;
663  conf->file_format = BIN;
664  conf->max_file_size = 1000000000;
665 
666  strcpy(conf->file_name, "/var/www/data/data.rld");
667 
668  int i;
669  for (i = 0; i < NUM_CHANNELS; i++) {
670  conf->channels[i] = CHANNEL_ENABLED;
671  }
672  memset(conf->force_high_channels, 0, sizeof(conf->force_high_channels));
673 
675  strcpy(conf->ambient.file_name, "/var/www/data/data-ambient.rld");
676 }
677 
683 int read_default_config(struct rl_conf* conf) {
684 
685  // check if config file existing
686  if (open(DEFAULT_CONFIG, O_RDWR) <= 0) {
687  reset_config(conf);
688  return UNDEFINED;
689  }
690 
691  // open config file
692  FILE* file = fopen(DEFAULT_CONFIG, "r");
693  if (file == NULL) {
694  rl_log(ERROR, "failed to open configuration file");
695  return FAILURE;
696  }
697  // read values
698  fread(conf, sizeof(struct rl_conf), 1, file);
699 
700  // close file
701  fclose(file);
702 
703  // check version
704  if (conf->version != RL_CONF_VERSION) {
705  rl_log(WARNING, "Old or invalid configration file. Using default "
706  "config as fallback.");
707  reset_config(conf);
708  return UNDEFINED;
709  }
710 
711  // reset mode
712  conf->mode = CONTINUOUS;
713 
714  return SUCCESS;
715 }
716 
722 int write_default_config(struct rl_conf* conf) {
723 
724  // open config file
725  FILE* file = fopen(DEFAULT_CONFIG, "w");
726  if (file == NULL) {
727  rl_log(ERROR, "failed to create configuration file");
728  return FAILURE;
729  }
730  // write values
731  fwrite(conf, sizeof(struct rl_conf), 1, file);
732 
733  // close file
734  fclose(file);
735  return SUCCESS;
736 }
int force_high_channels[NUM_I_CHANNELS]
Current channels to force to high range.
Definition: types.h:263
void rl_print_status(struct rl_status *status)
Definition: rl_util.c:103
Limited sampling mode (limited by number of samples to take)
Definition: types.h:158
Print default configuration.
Definition: types.h:164
Get current status of RocketLogger.
Definition: types.h:161
rl_mode mode
Sampling mode.
Definition: types.h:251
Stop continuous sampling.
Definition: types.h:162
Continuous sampling mode (in background)
Definition: types.h:159
void rl_print_version(void)
Definition: rl_util.c:124
enum option rl_option
Sample digital inputs.
Definition: rl_util.h:60
#define UNDEFINED
Definition: types.h:76
#define FAILURE
Definition: types.h:78
#define SUCCESS
Definition: types.h:75
int check_sample_rate(int sample_rate)
Definition: lib_util.c:50
rl_mode get_mode(char *mode)
Definition: rl_util.c:136
CSV format.
Definition: types.h:184
void rl_print_config(struct rl_conf *conf)
Definition: rl_util.c:40
struct rl_status status
Current status of RocketLogger.
Definition: rl_server.c:71
int parse_args(int argc, char *argv[], struct rl_conf *conf, int *set_as_default, char **file_comment)
Definition: rl_util.c:252
Set configuration as default.
Definition: rl_util.h:63
void ambient_set_file_name(struct rl_conf *conf)
Definition: ambient.c:78
int write_default_config(struct rl_conf *conf)
Definition: rl_util.c:722
mode
Definition: types.h:157
enum mode rl_mode
En-/disable data averaging for web server.
Definition: rl_util.h:59
const char * GIT_DATE
Date of the of last git commit.
#define RL_CONF_VERSION
RocketLogger configuration structure version number.
Definition: types.h:206
void rl_log(rl_log_type type, const char *format,...)
Definition: log.c:39
void reset_config(struct rl_conf *conf)
Definition: rl_util.c:653
int digital_inputs
En-/disable digital inputs.
Definition: types.h:265
#define MAX_PATH_LENGTH
Maximum path length in characters.
Definition: types.h:102
struct rl_ambient ambient
Ambient conf.
Definition: types.h:277
int enable_web_server
En-/disable plots on web interface.
Definition: types.h:267
File format.
Definition: rl_util.h:65
rl_use_cal calibration
Use/ignore existing calibration.
Definition: types.h:269
#define DEFAULT_CONFIG
Default configuration file.
Definition: rl_util.h:48
Binary format.
Definition: types.h:185
Show help.
Definition: types.h:166
int enabled
Definition: types.h:213
rl_state state
State.
Definition: types.h:285
Sample aggregation.
Definition: rl_util.h:62
uint64_t samples_taken
Number of samples taken.
Definition: types.h:289
Aggregate by averaging data.
Definition: types.h:176
int read_default_config(struct rl_conf *conf)
Definition: rl_util.c:683
int version
Configuration structure version.
Definition: types.h:249
#define NUM_I_CHANNELS
Maximum number of RocketLogger current channels.
Definition: types.h:106
Aggregate using downsampling.
Definition: types.h:175
int check_update_rate(int update_rate)
Definition: lib_util.c:64
int sample_limit
Sample limit (0 for continuous)
Definition: types.h:259
Definition: types.h:247
#define NUM_CHANNELS
Maximum number of RocketLogger channels.
Definition: types.h:104
#define CHANNEL_ENABLED
Channel sampling enabled.
Definition: types.h:223
#define KSPS
KSPS <-> SPS conversion factor.
Definition: types.h:119
Warning.
Definition: types.h:201
char file_name[MAX_PATH_LENGTH]
Data file name.
Definition: types.h:275
void print_usage(void)
Definition: rl_util.c:568
Maximum data file size.
Definition: rl_util.h:66
File comment.
Definition: rl_util.h:67
Set default configuration.
Definition: types.h:163
int channels[NUM_CHANNELS]
Channels to sample.
Definition: types.h:261
uint64_t time
Time stamp of calibration run.
Definition: types.h:303
Print the RocketLogger Software Stack version.
Definition: types.h:165
#define DIGITAL_INPUTS_DISABLED
Digital input sampling disabled.
Definition: types.h:240
uint64_t calibration_time
Time stamp of last calibration run.
Definition: types.h:295
rl_file_format file_format
File format.
Definition: types.h:271
int update_rate
Data update rate.
Definition: types.h:257
rl_option get_option(char *option)
Definition: rl_util.c:166
Ambient sensor logging.
Definition: rl_util.h:61
No option.
Definition: rl_util.h:68
Name of data file to write.
Definition: rl_util.h:54
char file_name[MAX_PATH_LENGTH]
Definition: types.h:216
Error.
Definition: types.h:200
Data file update rate.
Definition: rl_util.h:56
struct rl_conf conf
Current configuration.
Definition: types.h:293
int sample_rate
Sampling rate.
Definition: types.h:253
No file.
Definition: types.h:183
int parse_channels(int channels[], char *value)
Definition: rl_util.c:206
No aggregation.
Definition: types.h:174
Sampling rate.
Definition: rl_util.h:55
Channels to force to high range.
Definition: rl_util.h:58
Use calibration (if existing)
Definition: types.h:193
const char * GIT_DESCRIPTION
Git code revision description of the code base.
uint64_t max_file_size
Maximum data file size.
Definition: types.h:273
option
Definition: rl_util.h:53
void print_config(struct rl_conf *conf)
Definition: rl_util.c:643
const char * COMPILE_DATE
Compilation date of the program.
#define AMBIENT_ENABLED
Definition: types.h:211
Ignore calibration.
Definition: types.h:192
Information.
Definition: types.h:202
const char * PROJECT_VERSION
The RocketLogger software version string.
Use/ignore existing calibration values.
Definition: rl_util.h:64
#define AMBIENT_DISABLED
Definition: types.h:210
Meter mode (display current values in terminal)
Definition: types.h:160
rl_aggregation aggregation
Aggregation mode (for sampling rates below lowest native one)
Definition: types.h:255
Channels to sample.
Definition: rl_util.h:57
#define DIGITAL_INPUTS_ENABLED
Digital input sampling ensabled.
Definition: types.h:242
No mode.
Definition: types.h:167
Idle.
Definition: types.h:141