|
RocketLogger 2.1.3
|
Include dependency graph for rl_file.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Data Structures | |
| struct | rl_file_lead_in |
| struct | rl_file_channel |
| struct | rl_file_header |
Macros | |
| #define | RL_FILE_MAGIC 0x444C5225 |
| File header magic number (ascii RLD) | |
| #define | RL_FILE_VERSION 0x04 |
| File format version of current implementation. | |
| #define | RL_FILE_CHANNEL_NAME_LENGTH 16 |
| Maximum channel description length. | |
| #define | RL_FILE_CHANNEL_NO_LINK (UINT16_MAX) |
| No additional range valid information available. | |
| #define | RL_FILE_COMMENT_ALIGNMENT_BYTES sizeof(uint32_t) |
| Comment alignment in bytes. | |
| #define | RL_FILE_CSV_DELIMITER "," |
| CSV value delimiter character. | |
| #define | RL_FILE_AMBIENT_SUFFIX "-ambient" |
| Ambient sensor data file name suffix. | |
| #define | RL_FILE_AMBIENT_DATA_BLOCK_SIZE 1 |
| Ambient sensor data file block size in measurements. | |
| #define | RL_SCALE_PICO -12 |
| #define | RL_SCALE_TEN_PICO -11 |
| #define | RL_SCALE_NANO -9 |
| #define | RL_SCALE_TEN_NANO -8 |
| #define | RL_SCALE_MICRO -6 |
| #define | RL_SCALE_MILLI -3 |
| #define | RL_SCALE_UNIT 0 |
| #define | RL_SCALE_KILO 3 |
| #define | RL_SCALE_MEGA 6 |
| #define | RL_SCALE_GIGA 9 |
| #define | RL_SCALE_TERA 12 |
Typedefs | |
| typedef enum rl_unit | rl_unit_t |
| typedef struct rl_file_lead_in | rl_file_lead_in_t |
| typedef struct rl_file_channel | rl_file_channel_t |
| typedef struct rl_file_header | rl_file_header_t |
Enumerations | |
| enum | rl_unit { RL_UNIT_UNITLESS = 0 , RL_UNIT_VOLT = 1 , RL_UNIT_AMPERE = 2 , RL_UNIT_BINARY = 3 , RL_UNIT_RANGE_VALID = 4 , RL_UNIT_LUX = 5 , RL_UNIT_DEG_C = 6 , RL_UNIT_INTEGER = 7 , RL_UNIT_PERCENT = 8 , RL_UNIT_PASCAL = 9 , RL_UNIT_SECOND = 10 , RL_UNIT_UNDEFINED = (int)0xffffffff } |
Functions | |
| char * | rl_unit_to_string (rl_unit_t unit) |
| char * | rl_file_get_ambient_file_name (char const *const data_file_name) |
| void | rl_file_setup_data_lead_in (rl_file_lead_in_t *const lead_in, rl_config_t const *const config) |
| void | rl_file_setup_ambient_lead_in (rl_file_lead_in_t *const lead_in, rl_config_t const *const config) |
| void | rl_file_setup_data_header (rl_file_header_t *const file_header, rl_config_t const *const config) |
| void | rl_file_setup_ambient_header (rl_file_header_t *const file_header, rl_config_t const *const config) |
| void | rl_file_store_header_bin (FILE *file_handle, rl_file_header_t *const file_header) |
| void | rl_file_store_header_csv (FILE *file_handle, rl_file_header_t const *const file_header) |
| void | rl_file_update_header_bin (FILE *file_handle, rl_file_header_t const *const file_header) |
| void | rl_file_update_header_csv (FILE *file_handle, rl_file_header_t const *const file_header) |
| int | rl_file_add_data_block (FILE *data_file, int32_t const *analog_buffer, uint32_t const *digital_buffer, size_t buffer_size, rl_timestamp_t const *const timestamp_realtime, rl_timestamp_t const *const timestamp_monotonic, rl_config_t const *const config) |
| int | rl_file_add_ambient_block (FILE *ambient_file, int32_t const *ambient_buffer, size_t buffer_size, rl_timestamp_t const *const timestamp_realtime, rl_timestamp_t const *const timestamp_monotonic, rl_config_t const *const config) |
| #define RL_FILE_AMBIENT_DATA_BLOCK_SIZE 1 |
Ambient sensor data file block size in measurements.
Definition at line 64 of file rl_file.h.
Referenced by pru_sample(), and rl_file_setup_ambient_lead_in().
| #define RL_FILE_AMBIENT_SUFFIX "-ambient" |
Ambient sensor data file name suffix.
Definition at line 61 of file rl_file.h.
Referenced by rl_file_get_ambient_file_name().
| #define RL_FILE_CHANNEL_NAME_LENGTH 16 |
Maximum channel description length.
Definition at line 49 of file rl_file.h.
Referenced by rl_file_setup_data_channels().
| #define RL_FILE_CHANNEL_NO_LINK (UINT16_MAX) |
No additional range valid information available.
Definition at line 52 of file rl_file.h.
Referenced by rl_file_setup_ambient_channels(), and rl_file_setup_data_channels().
| #define RL_FILE_COMMENT_ALIGNMENT_BYTES sizeof(uint32_t) |
Comment alignment in bytes.
Definition at line 55 of file rl_file.h.
Referenced by rl_file_setup_ambient_lead_in(), rl_file_setup_data_lead_in(), and rl_file_store_header_bin().
| #define RL_FILE_CSV_DELIMITER "," |
CSV value delimiter character.
Definition at line 58 of file rl_file.h.
Referenced by rl_file_add_data_block().
| #define RL_FILE_MAGIC 0x444C5225 |
File header magic number (ascii RLD)
Copyright (c) 2016-2020, ETH Zurich, Computer Engineering Group 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_file.h.
Referenced by rl_file_setup_ambient_lead_in(), and rl_file_setup_data_lead_in().
| #define RL_FILE_VERSION 0x04 |
File format version of current implementation.
Definition at line 46 of file rl_file.h.
Referenced by rl_file_setup_ambient_lead_in(), and rl_file_setup_data_lead_in().
| #define RL_SCALE_MICRO -6 |
Definition at line 73 of file rl_file.h.
Referenced by rl_file_store_header_csv().
| #define RL_SCALE_MILLI -3 |
Definition at line 74 of file rl_file.h.
Referenced by rl_file_store_header_csv().
| #define RL_SCALE_NANO -9 |
Definition at line 71 of file rl_file.h.
Referenced by rl_file_setup_data_channels(), and rl_file_store_header_csv().
| #define RL_SCALE_TEN_NANO -8 |
Definition at line 72 of file rl_file.h.
Referenced by rl_file_setup_data_channels(), and rl_file_store_header_csv().
| #define RL_SCALE_TEN_PICO -11 |
Definition at line 70 of file rl_file.h.
Referenced by rl_file_setup_data_channels(), and rl_file_store_header_csv().
| #define RL_SCALE_UNIT 0 |
Definition at line 75 of file rl_file.h.
Referenced by rl_file_setup_data_channels().
| typedef struct rl_file_channel rl_file_channel_t |
| typedef struct rl_file_header rl_file_header_t |
| typedef struct rl_file_lead_in rl_file_lead_in_t |
| enum rl_unit |
Data unit definition
| int rl_file_add_ambient_block | ( | FILE * | ambient_file, |
| int32_t const * | ambient_buffer, | ||
| size_t | buffer_size, | ||
| rl_timestamp_t const *const | timestamp_realtime, | ||
| rl_timestamp_t const *const | timestamp_monotonic, | ||
| rl_config_t const *const | config ) |
Handle the sensor data buffer to add a new block to the ambient file.
| ambient_file | Ambient file to write to |
| ambient_buffer | Ambient sensor data buffer to process |
| buffer_size | Number of sensor samples in the buffer |
| timestamp_realtime | Timestamp sampled from realtime clock |
| timestamp_monotonic | Timestamp sampled from monotonic clock |
| config | Current measurement configuration |
Definition at line 520 of file rl_file.c.
Referenced by pru_sample().
| int rl_file_add_data_block | ( | FILE * | data_file, |
| int32_t const * | analog_buffer, | ||
| uint32_t const * | digital_buffer, | ||
| size_t | buffer_size, | ||
| rl_timestamp_t const *const | timestamp_realtime, | ||
| rl_timestamp_t const *const | timestamp_monotonic, | ||
| rl_config_t const *const | config ) |
Handle the sampling data buffer to add a new block to the data file.
| data_file | Data file to write to |
| analog_buffer | Analog data buffer to process |
| digital_buffer | Digital data buffer to process |
| buffer_size | Number of data samples in the buffer |
| timestamp_realtime | Timestamp sampled from realtime clock |
| timestamp_monotonic | Timestamp sampled from monotonic clock |
| config | Current measurement configuration |
Definition at line 350 of file rl_file.c.
References rl_config::aggregation_mode, rl_config::channel_enable, data, rl_config::digital_enable, ERROR, rl_config::file_enable, rl_config::file_format, rl_timestamp::nsec, PRU_DIGITAL_I1L_VALID_MASK, PRU_DIGITAL_I2L_VALID_MASK, PRU_DIGITAL_INPUT1_MASK, PRU_DIGITAL_INPUT_MASK, RL_AGGREGATION_MODE_AVERAGE, RL_AGGREGATION_MODE_DOWNSAMPLE, RL_CHANNEL_COUNT, RL_CHANNEL_DIGITAL_COUNT, RL_CONFIG_CHANNEL_I1L, RL_CONFIG_CHANNEL_I2L, RL_FILE_CSV_DELIMITER, RL_FILE_FORMAT_CSV, RL_FILE_FORMAT_RLD, rl_log(), RL_LOG_ERROR, RL_LOG_WARNING, RL_SAMPLE_RATE_MIN, rl_config::sample_rate, and rl_timestamp::sec.
Referenced by pru_sample().
Here is the call graph for this function:| char * rl_file_get_ambient_file_name | ( | char const *const | data_file_name | ) |
Derive the ambient file name from the data file name.
| data_file_name | The data file name |
Definition at line 94 of file rl_file.c.
References RL_FILE_AMBIENT_SUFFIX.
Referenced by hw_sample(), and pru_sample().
| void rl_file_setup_ambient_header | ( | rl_file_header_t *const | file_header, |
| rl_config_t const *const | config ) |
Set up ambient file header with current configuration.
| file_header | The file header data structure to set up |
| config | Current measurement configuration |
Definition at line 206 of file rl_file.c.
References rl_file_header::comment, rl_config::file_comment, and rl_file_setup_ambient_channels().
Referenced by pru_sample().
Here is the call graph for this function:| void rl_file_setup_ambient_lead_in | ( | rl_file_lead_in_t *const | lead_in, |
| rl_config_t const *const | config ) |
Set up ambient file header lead-in with current configuration.
| lead_in | The file lead-in data structure to set up |
| config | Current measurement configuration |
Definition at line 160 of file rl_file.c.
References rl_file_lead_in::channel_bin_count, rl_file_lead_in::channel_count, rl_file_lead_in::comment_length, create_time_stamp(), rl_file_lead_in::data_block_count, rl_file_lead_in::data_block_size, rl_file_lead_in::file_magic, rl_file_lead_in::file_version, get_mac_addr(), rl_file_lead_in::header_length, rl_file_lead_in::mac_address, RL_FILE_AMBIENT_DATA_BLOCK_SIZE, RL_FILE_COMMENT_ALIGNMENT_BYTES, RL_FILE_MAGIC, RL_FILE_VERSION, RL_SENSOR_SAMPLE_RATE, rl_file_lead_in::sample_count, rl_file_lead_in::sample_rate, rl_status::sensor_count, rl_file_lead_in::start_time, and rl_config::update_rate.
Referenced by pru_sample().
Here is the call graph for this function:| void rl_file_setup_data_header | ( | rl_file_header_t *const | file_header, |
| rl_config_t const *const | config ) |
Set up data file header with current configuration.
| file_header | The file header data structure to set up |
| config | Current measurement configuration |
Definition at line 195 of file rl_file.c.
References rl_file_header::comment, rl_config::file_comment, and rl_file_setup_data_channels().
Referenced by pru_sample().
Here is the call graph for this function:| void rl_file_setup_data_lead_in | ( | rl_file_lead_in_t *const | lead_in, |
| rl_config_t const *const | config ) |
Set up data file header lead-in with current configuration.
| lead_in | The file lead-in data structure to set up |
| config | Current measurement configuration |
Definition at line 118 of file rl_file.c.
References rl_file_lead_in::channel_bin_count, rl_file_lead_in::channel_count, rl_config::channel_enable, rl_file_lead_in::comment_length, count_channels(), create_time_stamp(), rl_file_lead_in::data_block_count, rl_file_lead_in::data_block_size, rl_config::digital_enable, rl_file_lead_in::file_magic, rl_file_lead_in::file_version, get_mac_addr(), rl_file_lead_in::header_length, i1l_valid_channel, i2l_valid_channel, rl_file_lead_in::mac_address, RL_CHANNEL_DIGITAL_COUNT, RL_CONFIG_CHANNEL_I1L, RL_CONFIG_CHANNEL_I2L, RL_FILE_COMMENT_ALIGNMENT_BYTES, RL_FILE_MAGIC, RL_FILE_VERSION, rl_file_lead_in::sample_count, rl_config::sample_rate, rl_file_lead_in::sample_rate, rl_file_lead_in::start_time, and rl_config::update_rate.
Referenced by pru_sample().
Here is the call graph for this function:| void rl_file_store_header_bin | ( | FILE * | file_handle, |
| rl_file_header_t *const | file_header ) |
Store file header to file (in binary format).
| file_handle | Data file to write to |
| file_header | The file header data structure to store to the file |
Definition at line 217 of file rl_file.c.
References rl_file_header::channel, rl_file_lead_in::channel_bin_count, rl_file_lead_in::channel_count, rl_file_header::comment, rl_file_lead_in::comment_length, rl_file_lead_in::header_length, rl_file_header::lead_in, and RL_FILE_COMMENT_ALIGNMENT_BYTES.
Referenced by pru_sample().
| void rl_file_store_header_csv | ( | FILE * | file_handle, |
| rl_file_header_t const *const | file_header ) |
Store file header to file (in CSV format).
| file_handle | Data file to write to |
| file_header | The file header data structure to store to the file |
Definition at line 254 of file rl_file.c.
References rl_file_header::channel, rl_file_lead_in::channel_bin_count, rl_file_lead_in::channel_count, rl_file_channel::channel_scale, rl_file_header::comment, rl_file_lead_in::data_block_count, rl_file_lead_in::data_block_size, rl_file_lead_in::file_version, rl_file_header::lead_in, rl_file_lead_in::mac_address, MAC_ADDRESS_LENGTH, rl_file_channel::name, RL_SCALE_MICRO, RL_SCALE_MILLI, RL_SCALE_NANO, RL_SCALE_TEN_NANO, RL_SCALE_TEN_PICO, RL_UNIT_AMPERE, RL_UNIT_SECOND, RL_UNIT_VOLT, rl_file_lead_in::sample_count, rl_file_lead_in::sample_rate, rl_timestamp::sec, rl_file_lead_in::start_time, and rl_file_channel::unit.
Referenced by pru_sample().
| void rl_file_update_header_bin | ( | FILE * | file_handle, |
| rl_file_header_t const *const | file_header ) |
Update file with new header lead-in (to write current sample count) in binary format.
| file_handle | Data file to write to |
| file_header | The file header data structure to store to the file |
Definition at line 324 of file rl_file.c.
References rl_file_header::lead_in.
Referenced by pru_sample().
| void rl_file_update_header_csv | ( | FILE * | file_handle, |
| rl_file_header_t const *const | file_header ) |
Update file with new header lead-in (to write current sample count) in CSV format.
| file_handle | Data file to write to |
| file_header | The file header data structure to store to the file |
Definition at line 334 of file rl_file.c.
References rl_file_lead_in::data_block_count, rl_file_lead_in::data_block_size, rl_file_lead_in::file_version, rl_file_header::lead_in, and rl_file_lead_in::sample_count.
Referenced by pru_sample().
| char * rl_unit_to_string | ( | rl_unit_t | unit | ) |
Get the string representing the unit.
| unit | The unit to convert into a string |
Definition at line 85 of file rl_file.c.
References RL_UNIT_NAMES.
Referenced by rl_socket_metadata().