8 #ifndef DIAG_CLIENT_LIB_LIB_DOIP_CLIENT_SOCKETS_SOCKET_HANDLER_H_ 
    9 #define DIAG_CLIENT_LIB_LIB_DOIP_CLIENT_SOCKETS_SOCKET_HANDLER_H_ 
   11 #include <string_view> 
   23 template<
typename ClientType>
 
  102                                         std::uint16_t host_port_num) {
 
  103     return client_.ConnectToHost(host_ip_address, host_port_num);
 
  125     return client_.Transmit(std::move(message));
 
Class type to contains a value (of type ValueType), or an error (of type ErrorType)
 
Handler class to manage different socket of various client (Udp / Tcp)
 
std::function< void(MessagePtr)> HandlerRead
Tcp function template used for reception.
 
typename Client::MessagePtr MessagePtr
Type alias for message pointer.
 
SocketHandler(Client client) noexcept
Constructs an instance of TcpSocketHandler.
 
Client client_
Store the client object.
 
void SetReadHandler(HandlerRead read_handler)
Function to set the read handler that is invoked when message is received.
 
SocketHandler(const SocketHandler &other) noexcept=delete
Deleted copy assignment and copy constructor.
 
SocketHandler & operator=(SocketHandler &&other) noexcept=default
 
~SocketHandler()=default
Destruct an instance of TcpSocketHandler.
 
core_type::Result< void > Transmit(MessageConstPtr message)
Function to transmit the provided message.
 
SocketHandler(SocketHandler &&other) noexcept=default
Move assignment and Move constructor.
 
typename Client::MessageConstPtr MessageConstPtr
Type alias for message const pointer.
 
core_type::Result< void > ConnectToHost(std::string_view host_ip_address, std::uint16_t host_port_num)
Function to connect to remote ip address and port number.
 
core_type::Result< void > DisconnectFromHost()
Function to disconnect from remote host if already connected.
 
void DeInitialize() noexcept
Function to stop the socket handler.
 
SocketHandler & operator=(const SocketHandler &other) noexcept=delete
 
typename Client::Message Message
Type alias for message.
 
ClientType Client
Type alias for client.
 
void Initialize() noexcept
Function to start the socket handler.
 
auto IsConnectedToHost() const noexcept -> bool
Function to get the connection status.