RocketLogger  1.0
rl_util.c File Reference
#include "rl_version.h"
#include "rl_util.h"
+ Include dependency graph for rl_util.c:

Go to the source code of this file.

Functions

void rl_print_config (struct rl_conf *conf)
 
void rl_print_status (struct rl_status *status)
 
void rl_print_version (void)
 
char * rl_get_version (void)
 
rl_mode get_mode (char *mode)
 
rl_option get_option (char *option)
 
int parse_channels (int channels[], char *value)
 
int parse_args (int argc, char *argv[], struct rl_conf *conf, int *set_as_default)
 
void print_usage (void)
 
void print_config (struct rl_conf *conf)
 
void reset_config (struct rl_conf *conf)
 
int read_default_config (struct rl_conf *conf)
 
int write_default_config (struct rl_conf *conf)
 

Function Documentation

rl_mode get_mode ( char *  mode)

Get RocketLogger mode of provided command line argument

Parameters
modePointer to argument string to parse
Returns
provided mode

Definition at line 93 of file rl_util.c.

References CONTINUOUS, HELP, LIMIT, METER, NO_MODE, PRINT_DEFAULT, PRINT_VERSION, SET_DEFAULT, STATUS, and STOPPED.

Referenced by parse_args().

rl_option get_option ( char *  option)

Get RocketLogger option of provided command line argument

Parameters
optionPointer to argument string to parse
Returns
provided option

Definition at line 122 of file rl_util.c.

References CALIBRATION, CHANNEL, DEF_CONF, DIGITAL_INPUTS, FHR, FILE_FORMAT, FILE_NAME, FILE_SIZE, NO_OPTION, SAMPLE_RATE, UPDATE_RATE, and WEB.

Referenced by parse_args().

int parse_args ( int  argc,
char *  argv[],
struct rl_conf conf,
int *  set_as_default 
)

Parse input arguments of RocketLogger CLI

Parameters
argcNumber of input arguments
argvInput argument string
confPointer to rl_conf configuration to write
set_as_defaultIs set to 1, if configuration should be set as default
Returns
SUCCESS on success, FAILURE otherwise

Definition at line 201 of file rl_util.c.

References BIN, CAL_IGNORE, CAL_USE, CALIBRATION, rl_conf::calibration, CHANNEL, CHANNEL_ENABLED, rl_conf::channels, check_sample_rate(), check_update_rate(), CSV, DEF_CONF, DIGITAL_INPUTS, rl_conf::digital_inputs, DIGITAL_INPUTS_DISABLED, DIGITAL_INPUTS_ENABLED, rl_conf::enable_web_server, ERROR, FAILURE, FHR, FILE_FORMAT, rl_conf::file_format, FILE_NAME, rl_conf::file_name, FILE_SIZE, rl_conf::force_high_channels, get_mode(), get_option(), HELP, INFO, KSPS, LIMIT, rl_conf::max_file_size, rl_conf::mode, NO_FILE, NO_MODE, NO_OPTION, parse_channels(), PRINT_DEFAULT, reset_config(), rl_log(), rl_conf::sample_limit, SAMPLE_RATE, rl_conf::sample_rate, SET_DEFAULT, STATUS, STOPPED, SUCCESS, UPDATE_RATE, rl_conf::update_rate, and WEB.

Referenced by main().

+ Here is the call graph for this function:

int parse_channels ( int  channels[],
char *  value 
)

Parse command line argument to selected channels

Parameters
channelsChannel array to write
valuePointer to argument string to parse
Returns
SUCCESS on success, FAILURE otherwise

Definition at line 156 of file rl_util.c.

References CHANNEL_ENABLED, ERROR, FAILURE, NUM_CHANNELS, rl_log(), and SUCCESS.

Referenced by parse_args().

+ Here is the call graph for this function:

void print_config ( struct rl_conf conf)

Print provided configuration to command line

Parameters
confPointer to rl_conf configuration

Definition at line 499 of file rl_util.c.

References rl_print_config().

Referenced by main().

+ Here is the call graph for this function:

void print_usage ( void  )

Print help for RocketLogger CLI on command line

Definition at line 447 of file rl_util.c.

Referenced by main().

int read_default_config ( struct rl_conf conf)

Read default configuration from file

Parameters
confPointer to rl_conf configuration
Returns
SUCCESS on success, FAILURE otherwise

Definition at line 536 of file rl_util.c.

References CONTINUOUS, DEFAULT_CONFIG, ERROR, FAILURE, rl_conf::mode, reset_config(), rl_log(), SUCCESS, and UNDEFINED.

Referenced by main(), and print_status().

+ Here is the call graph for this function:

char* rl_get_version ( void  )

Get the the RocketLogger software version number string.

Returns
The RocketLogger Sofware Stack's version number string.

Definition at line 83 of file rl_util.c.

References RL_VERSION.

void rl_print_config ( struct rl_conf conf)

Copyright (c) 2016-2017, ETH Zurich, Computer Engineering Group Print RocketLogger configuration on command line

Parameters
confPointer to rl_conf configuration

Definition at line 13 of file rl_util.c.

References CAL_IGNORE, rl_conf::calibration, CHANNEL_ENABLED, rl_conf::channels, rl_conf::digital_inputs, rl_conf::enable_web_server, rl_conf::file_format, rl_conf::file_name, rl_conf::force_high_channels, KSPS, rl_conf::max_file_size, NO_FILE, NUM_CHANNELS, NUM_I_CHANNELS, rl_conf::sample_limit, rl_conf::sample_rate, and rl_conf::update_rate.

Referenced by print_config(), and rl_print_status().

void rl_print_status ( struct rl_status status)

Print RocketLogger status on command line

Parameters
statusPointer to rl_status status

Definition at line 53 of file rl_util.c.

References rl_status::calibration_time, rl_status::conf, RL_OFF, rl_print_config(), rl_status::samples_taken, rl_status::state, and rl_calibration::time.

Referenced by main().

+ Here is the call graph for this function:

void rl_print_version ( void  )

Print the RocketLogger software version on the command line.

Definition at line 74 of file rl_util.c.

References RL_VERSION.

Referenced by main().

int write_default_config ( struct rl_conf conf)

Write provided configuration as default to file

Parameters
confPointer to rl_conf configuration to write
Returns
SUCCESS on success, FAILURE otherwise

Definition at line 566 of file rl_util.c.

References DEFAULT_CONFIG, ERROR, FAILURE, rl_log(), and SUCCESS.

Referenced by main().

+ Here is the call graph for this function: