Diag-Client-Lib
Public Types | Public Member Functions | Private Attributes | List of all members
doip_client::connection::DoipTcpConnection Class Referencefinal

Doip Tcp Connection handle connection between two layers. More...

Inheritance diagram for doip_client::connection::DoipTcpConnection:
Inheritance graph
[legend]
Collaboration diagram for doip_client::connection::DoipTcpConnection:
Collaboration graph
[legend]

Public Types

using InitializationResult = uds_transport::Connection::InitializationResult
 Type alias for Initialization result. More...
 
- Public Types inherited from uds_transport::Connection
using ConnectionId = std::uint8_t
 Type alias for connection id. More...
 
using InitializationResult = uds_transport::UdsTransportProtocolHandler::InitializationResult
 Type alias for Initialization result. More...
 

Public Member Functions

 DoipTcpConnection (uds_transport::ConversionHandler const &conversation_handler, std::string_view tcp_ip_address, std::uint16_t port_num)
 Constructor to create a new tcp connection. More...
 
 ~DoipTcpConnection () final=default
 Destruct an instance of DoipTcpConnection. More...
 
InitializationResult Initialize () override
 Function to initialize the connection. More...
 
void Start () override
 Function to start the connection. More...
 
void Stop () override
 Function to stop the connection. More...
 
bool IsConnectToHost () override
 Function to check if connected to host remote server. More...
 
uds_transport::UdsTransportProtocolMgr::ConnectionResult ConnectToHost (uds_transport::UdsMessageConstPtr message) override
 Function to establish connection to remote host server. More...
 
uds_transport::UdsTransportProtocolMgr::DisconnectionResult DisconnectFromHost () override
 Function to disconnect from remote host server. More...
 
std::pair< uds_transport::UdsTransportProtocolMgr::IndicationResult, uds_transport::UdsMessagePtrIndicateMessage (uds_transport::UdsMessage::Address source_addr, uds_transport::UdsMessage::Address target_addr, uds_transport::UdsMessage::TargetAddressType type, uds_transport::ChannelID channel_id, std::size_t size, uds_transport::Priority priority, uds_transport::ProtocolKind protocol_kind, core_type::Span< std::uint8_t > payload_info) override
 Function to indicate a start of reception of message. More...
 
uds_transport::UdsTransportProtocolMgr::TransmissionResult Transmit (uds_transport::UdsMessageConstPtr message) override
 Function to transmit a valid Uds message. More...
 
void HandleMessage (uds_transport::UdsMessagePtr message) override
 Function to Hands over a valid received Uds message. More...
 
- Public Member Functions inherited from uds_transport::Connection
 Connection (ConnectionId connection_id, uds_transport::ConversionHandler const &conversation_handler) noexcept
 Constructor to create a new connection. More...
 
virtual ~Connection ()=default
 Destruct an instance of Connection. More...
 
ConnectionId GetConnectionId () noexcept
 Function to get the connection id. More...
 
ConnectionId GetConnectionId () const
 Function to get the connection id. More...
 

Private Attributes

channel::tcp_channel::DoipTcpChannel doip_tcp_channel_
 Store the reference to doip tcp channel. More...
 

Additional Inherited Members

- Protected Attributes inherited from uds_transport::Connection
uds_transport::ConversionHandler const & conversation_handler_
 Store the conversation handler. More...
 

Detailed Description

Doip Tcp Connection handle connection between two layers.

Definition at line 21 of file connection_manager.cpp.

Member Typedef Documentation

◆ InitializationResult

Type alias for Initialization result.

Definition at line 26 of file connection_manager.cpp.

Constructor & Destructor Documentation

◆ DoipTcpConnection()

doip_client::connection::DoipTcpConnection::DoipTcpConnection ( uds_transport::ConversionHandler const &  conversation_handler,
std::string_view  tcp_ip_address,
std::uint16_t  port_num 
)
inline

Constructor to create a new tcp connection.

Parameters
[in]conversation_handlerThe reference to conversation handler
[in]tcp_ip_addressThe local tcp ip address
[in]port_numThe local port number

Definition at line 37 of file connection_manager.cpp.

39  : uds_transport::Connection{1, conversation_handler},
40  doip_tcp_channel_{tcp_ip_address, port_num, *this} {}
channel::tcp_channel::DoipTcpChannel doip_tcp_channel_
Store the reference to doip tcp channel.
Interface class to handle connection between two layers.
Definition: connection.h:23

◆ ~DoipTcpConnection()

doip_client::connection::DoipTcpConnection::~DoipTcpConnection ( )
finaldefault

Destruct an instance of DoipTcpConnection.

Member Function Documentation

◆ ConnectToHost()

uds_transport::UdsTransportProtocolMgr::ConnectionResult doip_client::connection::DoipTcpConnection::ConnectToHost ( uds_transport::UdsMessageConstPtr  message)
inlineoverridevirtual

Function to establish connection to remote host server.

Parameters
[in]messageThe connection message
Returns
Connection result

Implements uds_transport::Connection.

Definition at line 75 of file connection_manager.cpp.

76  {
77  return (doip_tcp_channel_.ConnectToHost(std::move(message)));
78  }
uds_transport::UdsTransportProtocolMgr::ConnectionResult ConnectToHost(uds_transport::UdsMessageConstPtr message)
Function to establish connection to remote host server.

References doip_client::channel::tcp_channel::DoipTcpChannel::ConnectToHost(), and doip_tcp_channel_.

Here is the call graph for this function:

◆ DisconnectFromHost()

uds_transport::UdsTransportProtocolMgr::DisconnectionResult doip_client::connection::DoipTcpConnection::DisconnectFromHost ( )
inlineoverridevirtual

Function to disconnect from remote host server.

Returns
Disconnection result

Implements uds_transport::Connection.

Definition at line 84 of file connection_manager.cpp.

84  {
86  }
uds_transport::UdsTransportProtocolMgr::DisconnectionResult DisconnectFromHost()
Function to disconnect from remote host server.

References doip_client::channel::tcp_channel::DoipTcpChannel::DisconnectFromHost(), and doip_tcp_channel_.

Here is the call graph for this function:

◆ HandleMessage()

void doip_client::connection::DoipTcpConnection::HandleMessage ( uds_transport::UdsMessagePtr  message)
inlineoverridevirtual

Function to Hands over a valid received Uds message.

Parameters
[in]messageThe Uds message ptr (unique_ptr semantics) with the request. Ownership of the UdsMessage is given back to the conversation here

Implements uds_transport::Connection.

Definition at line 139 of file connection_manager.cpp.

139  {
140  // send full message to conversion
141  conversation_handler_.HandleMessage(std::move(message));
142  }
uds_transport::ConversionHandler const & conversation_handler_
Store the conversation handler.
Definition: connection.h:148
virtual void HandleMessage(UdsMessagePtr message) const noexcept=0
Function to Hands over a valid received Uds message.

References uds_transport::Connection::conversation_handler_, and uds_transport::ConversionHandler::HandleMessage().

Here is the call graph for this function:

◆ IndicateMessage()

std::pair<uds_transport::UdsTransportProtocolMgr::IndicationResult, uds_transport::UdsMessagePtr> doip_client::connection::DoipTcpConnection::IndicateMessage ( uds_transport::UdsMessage::Address  source_addr,
uds_transport::UdsMessage::Address  target_addr,
uds_transport::UdsMessage::TargetAddressType  type,
uds_transport::ChannelID  channel_id,
std::size_t  size,
uds_transport::Priority  priority,
uds_transport::ProtocolKind  protocol_kind,
core_type::Span< std::uint8_t >  payload_info 
)
inlineoverridevirtual

Function to indicate a start of reception of message.

This is called to indicate the reception of new message by underlying transport protocol handler

Parameters
[in]source_addrThe UDS source address of message
[in]target_addrThe UDS target address of message
[in]typeThe indication whether its is phys/func request
[in]channel_idThe transport protocol channel on which message start happened
[in]sizeThe size in bytes of the UdsMessage starting from SID
[in]priorityThe priority of the given message, used for prioritization of conversations
[in]protocol_kindThe identifier of protocol kind associated to message
[in]payload_infoThe view onto the first received payload bytes, if any. This view shall be used only within this function call. It is recommended that the TP provides at least the first two bytes of the request message, so the DM can identify a functional TesterPresent
Returns
std::pair< IndicationResult, UdsMessagePtr > The pair of IndicationResult and a pointer to UdsMessage owned/created by DM core and returned to the handler to get filled

Implements uds_transport::Connection.

Definition at line 113 of file connection_manager.cpp.

117  {
118  // Send Indication to conversation
119  return (conversation_handler_.IndicateMessage(source_addr, target_addr, type, channel_id, size, priority,
120  protocol_kind, payload_info));
121  }
virtual std::pair< UdsTransportProtocolMgr::IndicationResult, UdsMessagePtr > IndicateMessage(UdsMessage::Address source_addr, UdsMessage::Address target_addr, UdsMessage::TargetAddressType type, ChannelID channel_id, std::size_t size, Priority priority, ProtocolKind protocol_kind, core_type::Span< std::uint8_t > payload_info) const noexcept=0
Function to indicate a start of reception of message.

References uds_transport::Connection::conversation_handler_, and uds_transport::ConversionHandler::IndicateMessage().

Here is the call graph for this function:

◆ Initialize()

InitializationResult doip_client::connection::DoipTcpConnection::Initialize ( )
inlineoverridevirtual

Function to initialize the connection.

Returns
The initialization result

Implements uds_transport::Connection.

Definition at line 51 of file connection_manager.cpp.

References uds_transport::UdsTransportProtocolHandler::kInitializeOk.

◆ IsConnectToHost()

bool doip_client::connection::DoipTcpConnection::IsConnectToHost ( )
inlineoverridevirtual

Function to check if connected to host remote server.

Returns
True if connection, False otherwise

Implements uds_transport::Connection.

Definition at line 67 of file connection_manager.cpp.

67 { return (doip_tcp_channel_.IsConnectToHost()); }
bool IsConnectToHost()
Function to check if connected to host remote server.

References doip_tcp_channel_, and doip_client::channel::tcp_channel::DoipTcpChannel::IsConnectToHost().

Here is the call graph for this function:

◆ Start()

void doip_client::connection::DoipTcpConnection::Start ( )
inlineoverridevirtual

Function to start the connection.

Implements uds_transport::Connection.

Definition at line 56 of file connection_manager.cpp.

void Start()
Function to start the channel.

References doip_tcp_channel_, and doip_client::channel::tcp_channel::DoipTcpChannel::Start().

Here is the call graph for this function:

◆ Stop()

void doip_client::connection::DoipTcpConnection::Stop ( )
inlineoverridevirtual

Function to stop the connection.

Implements uds_transport::Connection.

Definition at line 61 of file connection_manager.cpp.

void Stop()
Function to stop the channel.

References doip_tcp_channel_, and doip_client::channel::tcp_channel::DoipTcpChannel::Stop().

Here is the call graph for this function:

◆ Transmit()

uds_transport::UdsTransportProtocolMgr::TransmissionResult doip_client::connection::DoipTcpConnection::Transmit ( uds_transport::UdsMessageConstPtr  message)
inlineoverridevirtual

Function to transmit a valid Uds message.

Parameters
[in]messageThe Uds message ptr (unique_ptr semantics) with the request.

Implements uds_transport::Connection.

Definition at line 128 of file connection_manager.cpp.

129  {
130  return doip_tcp_channel_.Transmit(std::move(message));
131  }
uds_transport::UdsTransportProtocolMgr::TransmissionResult Transmit(uds_transport::UdsMessageConstPtr message)
Function to transmit a valid Uds message.

References doip_tcp_channel_, and doip_client::channel::tcp_channel::DoipTcpChannel::Transmit().

Here is the call graph for this function:

Member Data Documentation

◆ doip_tcp_channel_

channel::tcp_channel::DoipTcpChannel doip_client::connection::DoipTcpConnection::doip_tcp_channel_
private

Store the reference to doip tcp channel.

Definition at line 148 of file connection_manager.cpp.

Referenced by ConnectToHost(), DisconnectFromHost(), IsConnectToHost(), Start(), Stop(), and Transmit().


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