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