|
RocketLogger
1.0
|
#include <sys/statvfs.h>#include <stdio.h>#include <stdint.h>#include <libgen.h>#include "rl_lib.h"#include "rl_util.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] = {BUFFER1_SIZE, BUFFER10_SIZE, BUFFER100_SIZE} |
| Buffer sizes for different time scales. More... | |
| #define ARG_COUNT 4 |
Number of input arguments required.
Copyright (c) 2016-2017, ETH Zurich, Computer Engineering Group
Definition at line 14 of file rl_server.c.
Referenced by main().
| #define MAX_STRING_LENGTH 150 |
Maximum string line length.
Definition at line 16 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 18 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 20 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 54 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 212 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, open_sem(), open_web_shm(), print_data(), print_status(), rl_log(), rl_read_status(), RL_RUNNING, S1, S10, S100, rl_status::sampling, SAMPLING_OFF, sem_id, SEM_TIME_OUT, set_sem(), rl_status::state, status, SUCCESS, t_scale, web_shm::time, wait_sem(), WAIT_SEM, and WARNING.
Here is the call graph for this function:| void print_data | ( | void | ) |
Print requested data in JSON format
Definition at line 137 of file rl_server.c.
References web_shm::buffer, buffer_get(), 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, and wait_sem().
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 68 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 86 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 102 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] = {BUFFER1_SIZE, BUFFER10_SIZE, BUFFER100_SIZE} |
Buffer sizes for different time scales.
Definition at line 45 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 37 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 31 of file rl_server.c.
Referenced by main().
| uint32_t id |
Client request id.
Definition at line 29 of file rl_server.c.
| int64_t last_time |
Last client time stamp.
Definition at line 35 of file rl_server.c.
Referenced by main(), and print_data().
| int8_t num_channels |
Number of channels sampled.
Definition at line 39 of file rl_server.c.
Referenced by handle_data_buffer(), main(), meter_print_buffer(), and print_data().
| int sem_id |
ID of semaphore set.
Definition at line 24 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 42 of file rl_server.c.
Referenced by handle_data_buffer(), hw_close(), hw_init(), interrupt_handler(), main(), print_status(), pru_sample(), pru_stop(), read_calibration(), rl_log(), sig_handler(), and write_status().
| uint32_t t_scale |
Requested time scale.
Definition at line 33 of file rl_server.c.
Referenced by main(), and print_data().
| struct web_shm* web_data |
Pointer to shared memory data.
Definition at line 26 of file rl_server.c.
Referenced by create_web_shm(), handle_data_buffer(), open_web_shm(), and pru_sample().