Diag-Client-Lib
|
Interface class to handle connection between two layers. More...
#include <connection.h>
Public Types | |
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 | |
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... | |
virtual InitializationResult | Initialize ()=0 |
Function to initialize the connection. More... | |
ConnectionId | GetConnectionId () noexcept |
Function to get the connection id. More... | |
virtual void | Start ()=0 |
Function to start the connection. More... | |
virtual void | Stop ()=0 |
Function to stop the connection. More... | |
virtual bool | IsConnectToHost ()=0 |
Function to check if connected to host remote server. More... | |
virtual UdsTransportProtocolMgr::ConnectionResult | ConnectToHost (UdsMessageConstPtr message)=0 |
Function to establish connection to remote host server. More... | |
virtual UdsTransportProtocolMgr::DisconnectionResult | DisconnectFromHost ()=0 |
Function to disconnect from remote host server. More... | |
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)=0 |
Function to indicate a start of reception of message. More... | |
virtual UdsTransportProtocolMgr::TransmissionResult | Transmit (UdsMessageConstPtr message)=0 |
Function to transmit a valid Uds message. More... | |
virtual void | HandleMessage (UdsMessagePtr message)=0 |
Function to Hands over a valid received Uds message. More... | |
ConnectionId | GetConnectionId () const |
Function to get the connection id. More... | |
Protected Attributes | |
uds_transport::ConversionHandler const & | conversation_handler_ |
Store the conversation handler. More... | |
Private Attributes | |
ConnectionId | connection_id_ |
Store the connection id. More... | |
Interface class to handle connection between two layers.
Definition at line 23 of file connection.h.
using uds_transport::Connection::ConnectionId = std::uint8_t |
Type alias for connection id.
Definition at line 28 of file connection.h.
using uds_transport::Connection::InitializationResult = uds_transport::UdsTransportProtocolHandler::InitializationResult |
Type alias for Initialization result.
Definition at line 33 of file connection.h.
|
inlinenoexcept |
Constructor to create a new connection.
[in] | connection_id | The connection identification |
[in] | conversation_handler | The reference to conversation handler |
Definition at line 42 of file connection.h.
|
virtualdefault |
Destruct an instance of Connection.
|
pure virtual |
Function to establish connection to remote host server.
[in] | message | The connection message |
Implemented in doip_client::connection::DoipUdpConnection, and doip_client::connection::DoipTcpConnection.
|
pure virtual |
Function to disconnect from remote host server.
Implemented in doip_client::connection::DoipUdpConnection, and doip_client::connection::DoipTcpConnection.
|
inline |
Function to get the connection id.
Definition at line 142 of file connection.h.
References connection_id_.
|
inlinenoexcept |
Function to get the connection id.
Definition at line 61 of file connection.h.
References connection_id_.
|
pure virtual |
Function to Hands over a valid received Uds message.
[in] | message | The Uds message ptr (unique_ptr semantics) with the request. Ownership of the UdsMessage is given back to the conversation here |
Implemented in doip_client::connection::DoipUdpConnection, and doip_client::connection::DoipTcpConnection.
Referenced by doip_client::channel::tcp_channel::DoipTcpChannel::HandleMessage(), and doip_client::channel::udp_channel::DoipUdpChannel::HandleMessage().
|
pure virtual |
Function to indicate a start of reception of message.
This is called to indicate the reception of new message by underlying transport protocol handler
[in] | source_addr | The UDS source address of message |
[in] | target_addr | The UDS target address of message |
[in] | type | The indication whether its is phys/func request |
[in] | channel_id | The transport protocol channel on which message start happened |
[in] | size | The size in bytes of the UdsMessage starting from SID |
[in] | priority | The priority of the given message, used for prioritization of conversations |
[in] | protocol_kind | The identifier of protocol kind associated to message |
[in] | payload_info | The 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 |
Implemented in doip_client::connection::DoipUdpConnection, and doip_client::connection::DoipTcpConnection.
Referenced by doip_client::channel::tcp_channel::DoipTcpChannel::IndicateMessage(), and doip_client::channel::udp_channel::DoipUdpChannel::IndicateMessage().
|
pure virtual |
Function to initialize the connection.
Implemented in doip_client::connection::DoipUdpConnection, and doip_client::connection::DoipTcpConnection.
|
pure virtual |
Function to check if connected to host remote server.
Implemented in doip_client::connection::DoipUdpConnection, and doip_client::connection::DoipTcpConnection.
|
pure virtual |
Function to start the connection.
Implemented in doip_client::connection::DoipUdpConnection, and doip_client::connection::DoipTcpConnection.
|
pure virtual |
Function to stop the connection.
Implemented in doip_client::connection::DoipUdpConnection, and doip_client::connection::DoipTcpConnection.
|
pure virtual |
Function to transmit a valid Uds message.
[in] | message | The Uds message ptr (unique_ptr semantics) with the request. |
Implemented in doip_client::connection::DoipUdpConnection, and doip_client::connection::DoipTcpConnection.
|
private |
Store the connection id.
Definition at line 154 of file connection.h.
Referenced by GetConnectionId().
|
protected |
Store the conversation handler.
Definition at line 148 of file connection.h.
Referenced by doip_client::connection::DoipTcpConnection::HandleMessage(), doip_client::connection::DoipUdpConnection::HandleMessage(), doip_client::connection::DoipTcpConnection::IndicateMessage(), and doip_client::connection::DoipUdpConnection::IndicateMessage().