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

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

Inheritance diagram for doip_client::connection::DoipUdpConnection:
Inheritance graph
[legend]
Collaboration diagram for doip_client::connection::DoipUdpConnection:
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

 DoipUdpConnection (uds_transport::ConversionHandler const &conversation_handler, std::string_view udp_ip_address, std::uint16_t port_num)
 Constructor to create a new udp connection. More...
 
 ~DoipUdpConnection () final=default
 Destruct an instance of DoipUdpConnection. 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) 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::udp_channel::DoipUdpChannel doip_udp_channel_
 Store the reference to doip udp 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 Udp Connection handle connection between two layers.

Definition at line 154 of file connection_manager.cpp.

Member Typedef Documentation

◆ InitializationResult

Type alias for Initialization result.

Definition at line 159 of file connection_manager.cpp.

Constructor & Destructor Documentation

◆ DoipUdpConnection()

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

Constructor to create a new udp connection.

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

Definition at line 170 of file connection_manager.cpp.

172  : uds_transport::Connection(1, conversation_handler),
173  doip_udp_channel_{udp_ip_address, port_num, *this} {}
channel::udp_channel::DoipUdpChannel doip_udp_channel_
Store the reference to doip udp channel.
Interface class to handle connection between two layers.
Definition: connection.h:23

◆ ~DoipUdpConnection()

doip_client::connection::DoipUdpConnection::~DoipUdpConnection ( )
finaldefault

Destruct an instance of DoipUdpConnection.

Member Function Documentation

◆ ConnectToHost()

uds_transport::UdsTransportProtocolMgr::ConnectionResult doip_client::connection::DoipUdpConnection::ConnectToHost ( uds_transport::UdsMessageConstPtr  )
inlineoverridevirtual

Function to establish connection to remote host server.

Parameters
[in]messageThe connection message
Returns
Connection result

Implements uds_transport::Connection.

Definition at line 208 of file connection_manager.cpp.

References uds_transport::UdsTransportProtocolMgr::kConnectionFailed.

◆ DisconnectFromHost()

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

Function to disconnect from remote host server.

Returns
Disconnection result

Implements uds_transport::Connection.

Definition at line 216 of file connection_manager.cpp.

References uds_transport::UdsTransportProtocolMgr::kDisconnectionFailed.

◆ HandleMessage()

void doip_client::connection::DoipUdpConnection::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 271 of file connection_manager.cpp.

271  {
272  // send full message to conversion
273  conversation_handler_.HandleMessage(std::move(message));
274  }
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::DoipUdpConnection::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 245 of file connection_manager.cpp.

249  {
250  // Send Indication to conversion
251  return (conversation_handler_.IndicateMessage(source_addr, target_addr, type, channel_id, size, priority,
252  protocol_kind, payload_info));
253  }
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::DoipUdpConnection::Initialize ( )
inlineoverridevirtual

Function to initialize the connection.

Returns
The initialization result

Implements uds_transport::Connection.

Definition at line 184 of file connection_manager.cpp.

References uds_transport::UdsTransportProtocolHandler::kInitializeOk.

◆ IsConnectToHost()

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

Function to check if connected to host remote server.

Returns
True if connection, False otherwise

Implements uds_transport::Connection.

Definition at line 200 of file connection_manager.cpp.

200 { return false; }

◆ Start()

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

Function to start the connection.

Implements uds_transport::Connection.

Definition at line 189 of file connection_manager.cpp.

void Start()
Function to start the channel.

References doip_udp_channel_, and doip_client::channel::udp_channel::DoipUdpChannel::Start().

Here is the call graph for this function:

◆ Stop()

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

Function to stop the connection.

Implements uds_transport::Connection.

Definition at line 194 of file connection_manager.cpp.

194 { doip_udp_channel_.Stop(); }
void Stop()
Function to stop the channel.

References doip_udp_channel_, and doip_client::channel::udp_channel::DoipUdpChannel::Stop().

Here is the call graph for this function:

◆ Transmit()

uds_transport::UdsTransportProtocolMgr::TransmissionResult doip_client::connection::DoipUdpConnection::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 260 of file connection_manager.cpp.

261  {
262  return (doip_udp_channel_.Transmit(std::move(message)));
263  }
uds_transport::UdsTransportProtocolMgr::TransmissionResult Transmit(uds_transport::UdsMessageConstPtr message)
Function to transmit a Vehicle Identification request.

References doip_udp_channel_, and doip_client::channel::udp_channel::DoipUdpChannel::Transmit().

Here is the call graph for this function:

Member Data Documentation

◆ doip_udp_channel_

channel::udp_channel::DoipUdpChannel doip_client::connection::DoipUdpConnection::doip_udp_channel_
private

Store the reference to doip udp channel.

Definition at line 280 of file connection_manager.cpp.

Referenced by Start(), Stop(), and Transmit().


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