srs-control 0.2.2
Loading...
Searching...
No Matches
srs::connection::DataSocket Class Reference

Socket class for reading main data stream. More...

#include <DataSocket.hpp>

Collaboration diagram for srs::connection::DataSocket:

Public Types

using ConnectionType = CommandBase

Public Member Functions

void cancel ()
 Cancel reading the data from the UDP socket.
void before_socket_close ()
Public Member Functions inherited from srs::connection::SpecialSocket
void register_send_action (this auto &&self, asio::awaitable< void > action, const std::shared_ptr< typename std::remove_cvref_t< decltype(self)>::ConnectionType > &connection)
 Registering the send action.
void listen (this auto &self, io_context_type &io_context)
 Listen to any UDP data.
auto cancel_listen_after (this auto &&self, io_context_type &io_context, std::chrono::seconds waiting_time=std::chrono::seconds(2)) -> std::future< void >
 Cancelling the listening action after a certain time.
auto wait_for_listen_finish (std::chrono::seconds time) -> std::optional< std::future_status >
 Blocking the current thread by waiting the listen action to finish until a certain time duration.
void set_report (AppReport *report)
void before_socket_close ()
auto get_socket () const -> udp::socket &
 Getter for the asio udp socket object.
auto get_port () const -> int
 Getter for the port number.
auto get_future () -> auto &
 Getter for the status of the listen action.
auto get_n_records () const -> std::size_t
 Getter for the number of frames read.
auto get_n_bytes () const -> std::size_t
 Getter for the number of bytes read.
auto get_total_time_ns () const -> std::uint64_t
 Getter for the total listening time in nano seconds.
auto get_report () -> auto *

Private Member Functions

void register_send_action_imp (asio::awaitable< void > action, const std::shared_ptr< ConnectionType > &connection)
auto get_response_msg_buffer () -> std::span< char >
void response_handler (const UDPEndpoint &endpoint, std::size_t read_size)
 DataSocket (int port_number, io_context_type &io_context, std::size_t buffer_size, workflow::AnalysisHandle &workflow)

Static Private Member Functions

static auto is_finished () -> bool
static void print_error ()

Private Attributes

friend SpecialSocket
std::size_t buffer_size_ = common::LARGE_READ_MSG_BUFFER_SIZE
LargeBuffer read_msg_buffer_
gsl::not_null< io_context_type * > io_context_
gsl::not_null< workflow::AnalysisHandle * > workflow_handler_
BufferQueue::Token token_

Additional Inherited Members

Static Public Member Functions inherited from srs::connection::SpecialSocket
template<SpecialSocketDerived SocketType, typename... Args>
static auto create (int port_number, io_context_type &io_context, Args &&... args) -> std::expected< std::shared_ptr< SocketType >, std::error_code >
Protected Member Functions inherited from srs::connection::SpecialSocket
 SpecialSocket (int port_number, io_context_type &io_context)
 Projected constructor, which can only be called from the derived classes.
auto get_cancel_timer () -> auto &

Detailed Description

Socket class for reading main data stream.

Definition at line 22 of file DataSocket.hpp.

Member Typedef Documentation

◆ ConnectionType

Constructor & Destructor Documentation

◆ DataSocket()

srs::connection::DataSocket::DataSocket ( int port_number,
io_context_type & io_context,
std::size_t buffer_size,
workflow::AnalysisHandle & workflow )
private

Definition at line 17 of file DataSocket.cpp.

Member Function Documentation

◆ before_socket_close()

void srs::connection::DataSocket::before_socket_close ( )

Definition at line 51 of file DataSocket.cpp.

◆ cancel()

void srs::connection::DataSocket::cancel ( )

Cancel reading the data from the UDP socket.

Definition at line 44 of file DataSocket.cpp.

◆ get_response_msg_buffer()

auto srs::connection::DataSocket::get_response_msg_buffer ( ) -> std::span< char >
inlineprivate

Definition at line 42 of file DataSocket.hpp.

◆ is_finished()

auto srs::connection::DataSocket::is_finished ( ) -> bool
inlinestaticprivate

Definition at line 44 of file DataSocket.hpp.

◆ print_error()

void srs::connection::DataSocket::print_error ( )
inlinestaticprivate

Definition at line 45 of file DataSocket.hpp.

◆ register_send_action_imp()

void srs::connection::DataSocket::register_send_action_imp ( asio::awaitable< void > action,
const std::shared_ptr< ConnectionType > & connection )
private

Definition at line 31 of file DataSocket.cpp.

◆ response_handler()

void srs::connection::DataSocket::response_handler ( const UDPEndpoint & endpoint,
std::size_t read_size )
private

Definition at line 37 of file DataSocket.cpp.

Member Data Documentation

◆ buffer_size_

std::size_t srs::connection::DataSocket::buffer_size_ = common::LARGE_READ_MSG_BUFFER_SIZE
private

Definition at line 35 of file DataSocket.hpp.

◆ io_context_

gsl::not_null<io_context_type*> srs::connection::DataSocket::io_context_
private

Definition at line 37 of file DataSocket.hpp.

◆ read_msg_buffer_

LargeBuffer srs::connection::DataSocket::read_msg_buffer_
private

Definition at line 36 of file DataSocket.hpp.

◆ SpecialSocket

friend srs::connection::DataSocket::SpecialSocket
private

Definition at line 34 of file DataSocket.hpp.

◆ token_

BufferQueue::Token srs::connection::DataSocket::token_
private

Definition at line 39 of file DataSocket.hpp.

◆ workflow_handler_

gsl::not_null<workflow::AnalysisHandle*> srs::connection::DataSocket::workflow_handler_
private

Definition at line 38 of file DataSocket.hpp.


The documentation for this class was generated from the following files: