15 char file_format_names[3][10] = {
"no file",
"csv",
"binary"};
18 }
else { printf(
" Sampling rate: %dSps\n", conf->
sample_rate);}
21 else printf(
" Webserver: disabled\n");
22 if(conf->
digital_inputs == 1) printf(
" Digital inputs: enabled\n");
23 else printf(
" Digital inputs: disabled\n");
24 printf(
" File format: %s\n", file_format_names[conf->
file_format]);
28 printf(
" Channels: ");
37 printf(
" Forced channels: ");
45 if (conf->
sample_limit == 0) { printf(
" Sample limit: no limit\n");
46 }
else { printf(
" Sample limit: %d\n", conf->
sample_limit);}
56 printf(
"\nRocketLogger IDLE\n\n");
58 printf(
"\nRocketLogger Status: RUNNING\n");
63 printf(
" Calibration time: %s\n", ctime(&time));
65 printf(
" Calibration time: No calibration file found\n");
75 printf(
"RocketLogger Software Stack version " RL_VERSION "\n");
94 if (strcmp(mode,
"sample") == 0) {
96 }
else if(strcmp(mode,
"cont") == 0) {
98 }
else if(strcmp(mode,
"meter") == 0) {
100 }
else if(strcmp(mode,
"status") == 0) {
102 }
else if(strcmp(mode,
"stop") == 0) {
104 }
else if(strcmp(mode,
"set") == 0) {
106 }
else if(strcmp(mode,
"conf") == 0) {
108 }
else if(strcmp(mode,
"version") == 0 || strcmp(mode,
"--version") == 0) {
110 }
else if(strcmp(mode,
"help") == 0 || strcmp(mode,
"h") == 0 || strcmp(mode,
"-h") == 0 || strcmp(mode,
"--help") == 0) {
123 if (strcmp(option,
"f") == 0) {
125 }
else if(strcmp(option,
"r") == 0) {
127 }
else if(strcmp(option,
"u") == 0) {
129 }
else if(strcmp(option,
"ch") == 0) {
131 }
else if(strcmp(option,
"fhr") == 0) {
133 }
else if(strcmp(option,
"w") == 0) {
135 }
else if(strcmp(option,
"d") == 0) {
137 }
else if(strcmp(option,
"s") == 0) {
139 }
else if(strcmp(option,
"c") == 0) {
141 }
else if(strcmp(option,
"format") == 0) {
143 }
else if(strcmp(option,
"size") == 0) {
159 if(isdigit(value[0]) && atoi(value) >= 0 && atoi(value) <= 9) {
163 channels[atoi(value)] = 1;
165 }
else if(strcmp(value,
"all") == 0) {
178 for (j=1; j < 2*(
NUM_CHANNELS-1) && value[j] ==
','; j=j+2){
181 char* c = &value[j+1];
182 if (isdigit(c[0]) && atoi(c) >= 0 && atoi(c) <
NUM_CHANNELS) {
183 channels[atoi(c)] = 1;
222 if (argc > 2 && isdigit(argv[2][0]) && atoi(argv[2]) > 0) {
244 if (conf->
mode ==
SET_DEFAULT && isdigit(argv[i][0]) && atoi(argv[i]) == 0) {
252 for (; i<argc; i++) {
253 if (argv[i][0] ==
'-') {
258 if (isdigit(argv[i][0]) && atoi(argv[i]) == 0) {
271 if (argc > ++i && isdigit(argv[i][0])) {
272 if(argv[i][strlen(argv[i])-1] ==
'k') {
288 if (argc > ++i && isdigit(argv[i][0])) {
316 if(isdigit(c[0]) && atoi(c) < 3 && atoi(c) >= 0) {
328 if (argv[i][1] ==
',') {
330 char* c = &argv[i][2];
331 if (atoi(c) < 3 && atoi(c) > 0) {
345 if(argc > i+1 && isdigit(argv[i+1][0]) && atoi(argv[i+1]) == 0) {
354 if(argc > i+1 && isdigit(argv[i+1][0]) && atoi(argv[i+1]) == 0) {
367 if(argc > i+1 && isdigit(argv[i+1][0]) && atoi(argv[i+1]) == 0) {
378 if(strcmp(argv[i],
"csv") == 0) {
380 }
else if(strcmp(argv[i],
"bin") == 0) {
396 if (argc > ++i && isdigit(argv[i][0])) {
398 switch(argv[i][strlen(argv[i])-1]) {
450 printf(
" rocketlogger mode -[option value]\n");
453 printf(
" sample number Acquires number of samples.\n");
454 printf(
" cont Continuously acquires samples.\n");
455 printf(
" meter Starts RocketLogger Meter.\n");
456 printf(
" status Get status of RocketLogger.\n");
457 printf(
" stop Stops RocketLogger.\n");
458 printf(
" set Set default configuration of RocketLogger (use normal options).\n");
459 printf(
" Use 'set 0' to reset the default configuration.\n");
460 printf(
" conf Print default configuration of RocketLogger.\n");
462 printf(
" Options:\n");
463 printf(
" -r rate Acquisition rate selection.\n");
464 printf(
" Possible rates: 1, 10, 100, 1k, 2k, 4k, 8k, 16k, 32k, 64k\n");
465 printf(
" -u update_rate Data update rate selection.\n");
466 printf(
" Possible update rates: 1, 2, 5, 10 (in Hz)\n");
467 printf(
" -ch ch1,ch2,... Channel selection.\n");
468 printf(
" Possible channels ('-ch all' to enable all):\n");
469 printf(
" 0: I1H\t\t4: I2H\n");
470 printf(
" 1: I1L\t\t5: I2L\n");
471 printf(
" 2: V1 \t\t6: V3\n");
472 printf(
" 3: V2 \t\t7: V4\n");
473 printf(
" -fhr ch1,ch2 Force high-range.\n");
474 printf(
" 0: no channel, 1: I1, 2: I2\n");
475 printf(
" -c Use calibration, if existing.\n");
476 printf(
" '-c 0' to ignore calibration.\n");
477 printf(
" -f file Stores data to specified file.\n");
478 printf(
" '-f 0' will disable file storing.\n");
479 printf(
" -d Log digital inputs.\n");
480 printf(
" Use '-d 0' to disable digital input logging.\n");
481 printf(
" -format format Select file format: csv, bin.\n");
482 printf(
" -size file_size Select max file size (k, m, g can be used).\n");
483 printf(
" -w Enable webserver plotting.\n");
484 printf(
" Use '-w 0' to disable webserver plotting.\n");
485 printf(
" -s Set configuration as default.\n");
487 printf(
" Help/Info:\n");
488 printf(
" help, --help Display this help message.\n");
489 printf(
" version, --version Display the RocketLogger software version.\n");
500 printf(
"\nRocketLogger Configuration:\n");
521 strcpy(conf->
file_name,
"/var/www/data/data.rld");
547 rl_log(
ERROR,
"failed to open configuration file");
551 fread(conf,
sizeof(
struct rl_conf), 1, file);
571 rl_log(
ERROR,
"failed to create configuration file");
575 fwrite(conf,
sizeof(
struct rl_conf), 1, file);
int force_high_channels[NUM_I_CHANNELS]
Current channels to force to high range.
void rl_print_status(struct rl_status *status)
Limited sampling mode (limited by number of samples to take)
Print default configuration.
Get current status of RocketLogger.
rl_mode mode
Sampling mode.
Stop continuous sampling.
Continuous sampling mode (in background)
void rl_print_version(void)
#define RL_VERSION
The RocketLogger software version string.
int check_sample_rate(int sample_rate)
rl_mode get_mode(char *mode)
void rl_print_config(struct rl_conf *conf)
struct rl_status status
Current status of RocketLogger.
Set configuration as default.
int write_default_config(struct rl_conf *conf)
En-/disable data averaging for web server.
void rl_log(rl_log_type type, const char *format,...)
void reset_config(struct rl_conf *conf)
int parse_args(int argc, char *argv[], struct rl_conf *conf, int *set_as_default)
int digital_inputs
En-/disable digital inputs.
int enable_web_server
En-/disable plots on web interface.
rl_use_cal calibration
Use/ignore existing calibration.
#define DEFAULT_CONFIG
Default configuration file.
uint64_t samples_taken
Number of samples taken.
int read_default_config(struct rl_conf *conf)
#define NUM_I_CHANNELS
Maximum number of RocketLogger current channels.
int check_update_rate(int update_rate)
int sample_limit
Sample limit (0 for continuous)
#define NUM_CHANNELS
Maximum number of RocketLogger channels.
#define CHANNEL_ENABLED
Channel sampling enabled.
#define KSPS
KSPS <-> SPS conversion factor.
char file_name[MAX_PATH_LENGTH]
Data file name.
Set default configuration.
int channels[NUM_CHANNELS]
Channels to sample.
uint64_t time
Time stamp of calibration run.
Print the RocketLogger Software Stack version.
#define DIGITAL_INPUTS_DISABLED
Digital input sampling disabled.
uint64_t calibration_time
Time stamp of last calibration run.
rl_file_format file_format
File format.
int update_rate
Data update rate.
rl_option get_option(char *option)
Name of data file to write.
struct rl_conf conf
Current configuration.
int sample_rate
Sampling rate.
int parse_channels(int channels[], char *value)
Channels to force to high range.
Use calibration (if existing)
uint64_t max_file_size
Maximum data file size.
void print_config(struct rl_conf *conf)
char * rl_get_version(void)
Use/ignore existing calibration values.
Meter mode (display current values in terminal)
#define DIGITAL_INPUTS_ENABLED
Digital input sampling ensabled.