RocketLogger  1.1.6
rl_util.c File Reference
#include "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)
 
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, char **file_comment)
 
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 136 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 166 of file rl_util.c.

References AGGREGATION, AMBIENT, CALIBRATION, CHANNEL, COMMENT, 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,
char **  file_comment 
)
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 206 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 643 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 568 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 683 of file rl_util.c.

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

Referenced by main(), and print_status().

+ Here is the call graph for this function:

void rl_print_config ( struct rl_conf conf)

Copyright (c) 2016-2019, Swiss Federal Institute of Technology (ETH Zurich) All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Print RocketLogger configuration on command line

Parameters
confPointer to rl_conf configuration

Definition at line 40 of file rl_util.c.

References rl_conf::aggregation, 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 103 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 124 of file rl_util.c.

References COMPILE_DATE, GIT_DATE, GIT_DESCRIPTION, and PROJECT_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 722 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: