RocketLogger 2.1.1
rl_socket.h File Reference
#include <stdint.h>
#include "rl.h"
#include "util.h"
+ Include dependency graph for rl_socket.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

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)
 

Function Documentation

◆ rl_socket_deinit()

int rl_socket_deinit ( void  )

Deinitialize the data streaming socket.

Returns
Returns 0 on success, negative on failure with errno set accordingly

Definition at line 71 of file rl_socket.c.

References SUCCESS, zmq_data_context, and zmq_data_socket.

Referenced by rl_run().

◆ rl_socket_handle_data()

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.

Parameters
analog_bufferAnalog data buffer to process
digital_bufferDigital data buffer to process
ambient_bufferAmbient sensor data buffer to process
buffer_sizeNumber of data samples in the buffer
ambient_buffer_sizeNumber of sensor samples in the buffer
timestamp_realtimeTimestamp sampled from realtime clock
timestamp_monotonicTimestamp sampled from monotonic clock
configCurrent measurement configuration
Returns
Returns 0 on success, negative on failure with errno set accordingly

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:

◆ rl_socket_init()

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:

  • 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. Initialize socket for data streaming.

Returns
Returns 0 on success, negative on failure with errno set accordingly

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:

◆ rl_socket_metadata()

int rl_socket_metadata ( rl_config_t const *const  config)

Initialize metadata for data socket.

Parameters
configCurrent measurement configuration
Returns
Returns 0 on success, negative on failure with errno set accordingly

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: