|
RocketLogger
1.1.6
|
#include <libgen.h>#include <stdint.h>#include <stdio.h>#include <sys/statvfs.h>#include "rl_lib.h"#include "rl_util.h"#include "sem.h"#include "web.h"
Include dependency graph for rl_server.c:Go to the source code of this file.
Macros | |
| #define | ARG_COUNT 4 |
| Number of input arguments required. More... | |
| #define | MAX_STRING_LENGTH 150 |
| Maximum string line length. More... | |
| #define | MAX_STRING_VALUE 20 |
| Maximum string value length. More... | |
| #define | TIME_MARGIN 10 |
| Time margin for buffer number (in ms) More... | |
Functions | |
| int64_t | get_free_space (char *path) |
| void | print_json_32 (int32_t data[], int length) |
| void | print_json_64 (int64_t data[], int length) |
| void | print_status (void) |
| void | print_data (void) |
| int | main (int argc, char *argv[]) |
Variables | |
| int | sem_id |
| ID of semaphore set. More... | |
| struct web_shm * | web_data |
| Pointer to shared memory data. More... | |
| uint32_t | id |
| Client request id. More... | |
| uint8_t | get_data |
| 1: data requested, 0: no data requested More... | |
| uint32_t | t_scale |
| Requested time scale. More... | |
| int64_t | last_time |
| Last client time stamp. More... | |
| int64_t | curr_time |
| Time stamp of last buffer stored to shared memory. More... | |
| int8_t | num_channels |
| Number of channels sampled. More... | |
| struct rl_status | status |
| Current status of RocketLogger. More... | |
| int | buffer_sizes [WEB_RING_BUFFER_COUNT] |
| Buffer sizes for different time scales. More... | |
| #define ARG_COUNT 4 |
Number of input arguments required.
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:
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.
Definition at line 43 of file rl_server.c.
Referenced by main().
| #define MAX_STRING_LENGTH 150 |
Maximum string line length.
Definition at line 45 of file rl_server.c.
Referenced by print_json_32(), and print_json_64().
| #define MAX_STRING_VALUE 20 |
Maximum string value length.
Definition at line 47 of file rl_server.c.
Referenced by print_json_32(), and print_json_64().
| #define TIME_MARGIN 10 |
Time margin for buffer number (in ms)
Definition at line 49 of file rl_server.c.
Referenced by print_data().
| int64_t get_free_space | ( | char * | path | ) |
Get free disk space in a directory
| path | Path to selected directory |
Definition at line 83 of file rl_server.c.
Referenced by print_status().
| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
RocketLogger server program. Returns status and current sampling data (if available) when running and default configuration otherwise
| argc | Number of input arguments |
| argv | Input argument string, consists of:
|
Definition at line 242 of file rl_server.c.
References ARG_COUNT, rl_status::conf, curr_time, DATA_SEM, rl_conf::enable_web_server, ERROR, FAILURE, get_data, last_time, num_channels, web_shm::num_channels, NUM_SEMS, open_sem(), print_data(), print_status(), rl_log(), rl_read_status(), RL_RUNNING, S1, S10, S100, rl_status::sampling, SAMPLING_OFF, sem_id, SEM_KEY, SEM_TIME_OUT, set_sem(), rl_status::state, status, SUCCESS, t_scale, web_shm::time, wait_sem(), WAIT_SEM, WARNING, and web_open_shm().
Here is the call graph for this function:| void print_data | ( | void | ) |
Print requested data in JSON format
Definition at line 164 of file rl_server.c.
References web_shm::buffer, buffer_sizes, curr_time, DATA_SEM, ringbuffer::element_size, ERROR, ringbuffer::filled, last_time, num_channels, print_json_64(), print_status(), rl_log(), sem_id, SEM_TIME_OUT, set_sem(), SUCCESS, t_scale, TIME_MARGIN, wait_sem(), and web_buffer_get().
Referenced by main().
Here is the call graph for this function:| void print_json_32 | ( | int32_t | data[], |
| int | length | ||
| ) |
Print a 32-bit integer array in JSON format
| data | Data array to print |
| length | Length of array |
Definition at line 96 of file rl_server.c.
References MAX_STRING_LENGTH, and MAX_STRING_VALUE.
Referenced by print_status().
| void print_json_64 | ( | int64_t | data[], |
| int | length | ||
| ) |
Print a 64-bit integer array in JSON format
| data | Data array to print |
| length | Length of array |
Definition at line 114 of file rl_server.c.
References MAX_STRING_LENGTH, and MAX_STRING_VALUE.
Referenced by print_data().
| void print_status | ( | void | ) |
Print current status in JSON format
Definition at line 130 of file rl_server.c.
References rl_conf::calibration, rl_status::calibration_time, rl_conf::channels, rl_status::conf, rl_conf::digital_inputs, rl_conf::enable_web_server, rl_conf::file_format, rl_conf::file_name, rl_conf::force_high_channels, get_free_space(), rl_conf::max_file_size, MAX_PATH_LENGTH, NUM_CHANNELS, NUM_I_CHANNELS, print_json_32(), read_default_config(), rl_read_calibration(), RL_RUNNING, rl_conf::sample_rate, rl_status::samples_taken, rl_status::state, status, rl_calibration::time, and rl_conf::update_rate.
Referenced by main(), and print_data().
Here is the call graph for this function:| int buffer_sizes[WEB_RING_BUFFER_COUNT] |
Buffer sizes for different time scales.
Definition at line 74 of file rl_server.c.
Referenced by print_data(), and pru_sample().
| int64_t curr_time |
Time stamp of last buffer stored to shared memory.
Definition at line 66 of file rl_server.c.
Referenced by main(), and print_data().
| uint8_t get_data |
1: data requested, 0: no data requested
Definition at line 60 of file rl_server.c.
Referenced by main().
| uint32_t id |
Client request id.
Definition at line 58 of file rl_server.c.
| int64_t last_time |
Last client time stamp.
Definition at line 64 of file rl_server.c.
Referenced by main(), and print_data().
| int8_t num_channels |
Number of channels sampled.
Definition at line 68 of file rl_server.c.
Referenced by file_handle_data(), main(), meter_print_buffer(), print_data(), and web_handle_data().
| int sem_id |
ID of semaphore set.
Definition at line 53 of file rl_server.c.
Referenced by create_sem(), main(), open_sem(), print_data(), and pru_sample().
| struct rl_status status |
Current status of RocketLogger.
Definition at line 71 of file rl_server.c.
Referenced by hw_close(), hw_init(), interrupt_handler(), main(), print_status(), pru_sample(), pru_stop(), read_calibration(), rl_log(), sig_handler(), web_handle_data(), and write_status().
| uint32_t t_scale |
Requested time scale.
Definition at line 62 of file rl_server.c.
Referenced by main(), and print_data().
| struct web_shm* web_data |
Pointer to shared memory data.
Definition at line 55 of file rl_server.c.
Referenced by pru_sample(), web_create_shm(), web_handle_data(), and web_open_shm().