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

#include <FecSwitchSocket.hpp>

Collaboration diagram for srs::connection::FecCommandSocket:

Public Types

using SmallConnection = CommandBase
using ConnectionType = SmallConnection
using US = std::chrono::microseconds
using USCount = decltype(US{}.count())
using StartEndTime = std::pair<USCount, USCount>

Public Member Functions

auto get_strand () -> auto &
auto get_time_us () const -> USCount
void launch_send_actions ()
void log_time_stamps (std::string remote_port, AppReport::FecSwitchStat stat)
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 Types

using SmallConnections = std::vector<std::shared_ptr<SmallConnection>>
using ActionType = decltype(asio::co_spawn(strand_, asio::awaitable<void>(), asio::deferred))

Private Member Functions

 FecCommandSocket (int port_number, io_context_type &io_context)
void register_send_action_imp (asio::awaitable< void > action, const std::shared_ptr< SmallConnection > &connection)
auto get_response_msg_buffer () -> std::span< char >
auto is_finished () -> bool
void print_error () const
void response_handler (const UDPEndpoint &endpoint, std::size_t read_size)
void deregister_connection (const UDPEndpoint &endpoint, std::span< char > response, SmallConnections &connections)
void print_available_responses () const
void register_report ()

Private Attributes

friend SpecialSocket
asio::strand< io_context_type::executor_type > strand_
std::mutex mut_
std::map< UDPEndpoint, SmallConnections > all_connections_
std::vector< char > read_msg_buffer_
std::chrono::time_point< std::chrono::steady_clock > start_time_ = std::chrono::steady_clock::now()
std::vector< std::pair< std::string, AppReport::FecSwitchStat > > time_stamps_
std::vector< ActionType > action_queue_

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

Definition at line 28 of file FecSwitchSocket.hpp.

Member Typedef Documentation

◆ ActionType

using srs::connection::FecCommandSocket::ActionType = decltype(asio::co_spawn(strand_, asio::awaitable<void>(), asio::deferred))
private

Definition at line 62 of file FecSwitchSocket.hpp.

◆ ConnectionType

◆ SmallConnection

◆ SmallConnections

using srs::connection::FecCommandSocket::SmallConnections = std::vector<std::shared_ptr<SmallConnection>>
private

Definition at line 54 of file FecSwitchSocket.hpp.

◆ StartEndTime

◆ US

using srs::connection::FecCommandSocket::US = std::chrono::microseconds

Definition at line 33 of file FecSwitchSocket.hpp.

◆ USCount

using srs::connection::FecCommandSocket::USCount = decltype(US{}.count())

Definition at line 34 of file FecSwitchSocket.hpp.

Constructor & Destructor Documentation

◆ FecCommandSocket()

srs::connection::FecCommandSocket::FecCommandSocket ( int port_number,
io_context_type & io_context )
explicitprivate

Definition at line 55 of file FecSwitchSocket.cpp.

Member Function Documentation

◆ before_socket_close()

void srs::connection::FecCommandSocket::before_socket_close ( )
inline

Definition at line 50 of file FecSwitchSocket.hpp.

◆ deregister_connection()

void srs::connection::FecCommandSocket::deregister_connection ( const UDPEndpoint & endpoint,
std::span< char > response,
SmallConnections & connections )
private

Definition at line 95 of file FecSwitchSocket.cpp.

◆ get_response_msg_buffer()

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

Definition at line 69 of file FecSwitchSocket.hpp.

◆ get_strand()

auto srs::connection::FecCommandSocket::get_strand ( ) -> auto &
inline

Definition at line 38 of file FecSwitchSocket.hpp.

◆ get_time_us()

auto srs::connection::FecCommandSocket::get_time_us ( ) const -> USCount
inline

Definition at line 39 of file FecSwitchSocket.hpp.

◆ is_finished()

auto srs::connection::FecCommandSocket::is_finished ( ) -> bool
private

Definition at line 175 of file FecSwitchSocket.cpp.

◆ launch_send_actions()

void srs::connection::FecCommandSocket::launch_send_actions ( )

Definition at line 75 of file FecSwitchSocket.cpp.

◆ log_time_stamps()

void srs::connection::FecCommandSocket::log_time_stamps ( std::string remote_port,
AppReport::FecSwitchStat stat )
inline

Definition at line 45 of file FecSwitchSocket.hpp.

◆ print_available_responses()

void srs::connection::FecCommandSocket::print_available_responses ( ) const
private

Definition at line 130 of file FecSwitchSocket.cpp.

◆ print_error()

void srs::connection::FecCommandSocket::print_error ( ) const
private

Definition at line 140 of file FecSwitchSocket.cpp.

◆ register_report()

void srs::connection::FecCommandSocket::register_report ( )
private

Definition at line 182 of file FecSwitchSocket.cpp.

◆ register_send_action_imp()

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

Definition at line 63 of file FecSwitchSocket.cpp.

◆ response_handler()

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

Definition at line 158 of file FecSwitchSocket.cpp.

Member Data Documentation

◆ action_queue_

std::vector<ActionType> srs::connection::FecCommandSocket::action_queue_
private

Definition at line 63 of file FecSwitchSocket.hpp.

◆ all_connections_

std::map<UDPEndpoint, SmallConnections> srs::connection::FecCommandSocket::all_connections_
private

Definition at line 57 of file FecSwitchSocket.hpp.

◆ mut_

std::mutex srs::connection::FecCommandSocket::mut_
private

Definition at line 56 of file FecSwitchSocket.hpp.

◆ read_msg_buffer_

std::vector<char> srs::connection::FecCommandSocket::read_msg_buffer_
private

Definition at line 58 of file FecSwitchSocket.hpp.

◆ SpecialSocket

friend srs::connection::FecCommandSocket::SpecialSocket
private

Definition at line 53 of file FecSwitchSocket.hpp.

◆ start_time_

std::chrono::time_point<std::chrono::steady_clock> srs::connection::FecCommandSocket::start_time_ = std::chrono::steady_clock::now()
private

Definition at line 59 of file FecSwitchSocket.hpp.

◆ strand_

asio::strand<io_context_type::executor_type> srs::connection::FecCommandSocket::strand_
private

Definition at line 55 of file FecSwitchSocket.hpp.

◆ time_stamps_

std::vector<std::pair<std::string, AppReport::FecSwitchStat> > srs::connection::FecCommandSocket::time_stamps_
private

Definition at line 60 of file FecSwitchSocket.hpp.


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