|
RocketLogger 2.1.3
|
#include <errno.h>#include <stdint.h>#include <stdlib.h>#include <string.h>#include <zmq.h>#include "log.h"#include "rl.h"#include "rl_file.h"#include "sensor/sensor.h"#include "util.h"#include "rl_socket.h"
Include dependency graph for rl_socket.c:Go to the source code of this file.
Macros | |
| #define | RL_SOCKET_METADATA_SIZE 1000 |
Functions | |
| int | rl_socket_init (void) |
| int | rl_socket_deinit (void) |
| int | rl_socket_metadata (rl_config_t const *const config) |
| int | rl_socket_handle_data (int32_t const *analog_buffer, uint32_t const *digital_buffer, int32_t const *ambient_buffer, size_t buffer_size, size_t ambient_buffer_size, rl_timestamp_t const *const timestamp_realtime, rl_timestamp_t const *const timestamp_monotonic, rl_config_t const *const config) |
Variables | |
| char | metadata_json [RL_SOCKET_METADATA_SIZE] |
| data socket metadata in JSON format | |
| void * | zmq_data_context = NULL |
| the ZeroMQ context for data publishing | |
| void * | zmq_data_socket = NULL |
| the ZeroMQ data socket | |
| #define RL_SOCKET_METADATA_SIZE 1000 |
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 47 of file rl_socket.c.
Referenced by rl_socket_metadata().
| int rl_socket_deinit | ( | void | ) |
Deinitialize the data streaming socket.
Definition at line 71 of file rl_socket.c.
References SUCCESS, zmq_data_context, and zmq_data_socket.
Referenced by rl_run().
| int rl_socket_handle_data | ( | int32_t const * | analog_buffer, |
| uint32_t const * | digital_buffer, | ||
| int32_t const * | ambient_buffer, | ||
| size_t | buffer_size, | ||
| size_t | ambient_buffer_size, | ||
| rl_timestamp_t const *const | timestamp_realtime, | ||
| rl_timestamp_t const *const | timestamp_monotonic, | ||
| rl_config_t const *const | config ) |
Process the data buffer for publishing to data socket.
| analog_buffer | Analog data buffer to process |
| digital_buffer | Digital data buffer to process |
| ambient_buffer | Ambient sensor data buffer to process |
| buffer_size | Number of data samples in the buffer |
| ambient_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 157 of file rl_socket.c.
References rl_config::ambient_enable, rl_config::channel_enable, rl_config::digital_enable, ERROR, metadata_json, RL_CHANNEL_COUNT, RL_CONFIG_CHANNEL_I1L, RL_CONFIG_CHANNEL_I2L, rl_log(), RL_LOG_ERROR, rl_status::sensor_count, SUCCESS, and zmq_data_socket.
Referenced by pru_sample().
Here is the call graph for this function:| int rl_socket_init | ( | void | ) |
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. Initialize socket for data streaming.
Definition at line 56 of file rl_socket.c.
References ERROR, rl_log(), RL_LOG_ERROR, RL_ZMQ_DATA_SOCKET, SUCCESS, zmq_data_context, and zmq_data_socket.
Referenced by rl_run().
Here is the call graph for this function:| int rl_socket_metadata | ( | rl_config_t const *const | config | ) |
Initialize metadata for data socket.
| config | Current measurement configuration |
Definition at line 82 of file rl_socket.c.
References rl_config::ambient_enable, rl_config::channel_enable, rl_config::digital_enable, is_current(), is_low_current(), is_voltage(), metadata_json, RL_CHANNEL_COUNT, RL_CHANNEL_DIGITAL_COUNT, RL_CHANNEL_NAMES, RL_CONFIG_CHANNEL_I1L, RL_CONFIG_CHANNEL_I2L, RL_SOCKET_METADATA_SIZE, rl_unit_to_string(), rl_config::sample_rate, rl_status::sensor_available, SENSOR_REGISTRY, SENSOR_REGISTRY_SIZE, snprintfcat(), and SUCCESS.
Referenced by rl_run().
Here is the call graph for this function:| char metadata_json[RL_SOCKET_METADATA_SIZE] |
data socket metadata in JSON format
Definition at line 50 of file rl_socket.c.
Referenced by rl_socket_handle_data(), and rl_socket_metadata().
| void* zmq_data_context = NULL |
the ZeroMQ context for data publishing
Definition at line 52 of file rl_socket.c.
Referenced by rl_socket_deinit(), and rl_socket_init().
| void* zmq_data_socket = NULL |
the ZeroMQ data socket
Definition at line 54 of file rl_socket.c.
Referenced by rl_socket_deinit(), rl_socket_handle_data(), and rl_socket_init().