Diag-Client-Lib
|
Class to establish connection with Diagnostic Server. More...
#include <dm_conversation.h>
Public Types | |
using | ConversationState = conversation_state_impl::ConversationState |
Type alias for conversation internal state. More... | |
using | SyncTimer = utility::sync_timer::SyncTimer< std::chrono::steady_clock > |
Type alias for synchronous timer. More... | |
Public Types inherited from diag::client::conversation::Conversation | |
using | IpAddress = DiagClientConversation::IpAddress |
Type alias for Ip address. More... | |
using | ConnectResult = DiagClientConversation::ConnectResult |
Type alias for Connection results. More... | |
using | DisconnectResult = DiagClientConversation::DisconnectResult |
Type alias for Disconnection results. More... | |
using | DiagError = DiagClientConversation::DiagError |
Type alias for Diagnostic results. More... | |
Public Member Functions | |
DmConversation (std::string_view conversion_name, DMConversationType &conversion_identifier) | |
Constructs an instance of DmConversation. More... | |
DmConversation (const DmConversation &other) noexcept=delete | |
Deleted copy assignment and copy constructor. More... | |
DmConversation & | operator= (const DmConversation &other) noexcept=delete |
DmConversation (DmConversation &&other) noexcept=delete | |
Deleted move assignment and move constructor. More... | |
DmConversation & | operator= (DmConversation &&other) noexcept=delete |
~DmConversation () override | |
Destructs an instance of DmConversation. More... | |
void | Startup () noexcept override |
Function to start the DmConversation. More... | |
void | Shutdown () noexcept override |
Function to shutdown the DmConversation. More... | |
void | RegisterConnection (std::unique_ptr<::uds_transport::Connection > connection) noexcept override |
Function to register the conversation to underlying transport protocol handler. More... | |
::uds_transport::ConversionHandler & | GetConversationHandler () noexcept override |
Function to get the conversation handler from conversation object. More... | |
ConnectResult | ConnectToDiagServer (std::uint16_t target_address, IpAddress host_ip_addr) noexcept override |
Function to connect to Diagnostic Server. More... | |
DisconnectResult | DisconnectFromDiagServer () noexcept override |
Function to disconnect from Diagnostic Server. More... | |
std::pair<::uds_transport::UdsTransportProtocolMgr::IndicationResult, ::uds_transport::UdsMessagePtr > | 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) noexcept override |
Function to indicate a start of reception of message. More... | |
void | HandleMessage (::uds_transport::UdsMessagePtr message) noexcept override |
Function to Hands over a valid received Uds message. More... | |
Result< uds_message::UdsResponseMessagePtr, DiagError > | SendDiagnosticRequest (uds_message::UdsRequestMessageConstPtr message) noexcept override |
Function to send Diagnostic Request and get Diagnostic Response. More... | |
Public Member Functions inherited from diag::client::conversation::Conversation | |
Conversation () noexcept=default | |
Constructs an instance of Conversation. More... | |
Conversation (const Conversation &other) noexcept=delete | |
Deleted copy assignment and copy constructor. More... | |
Conversation & | operator= (const Conversation &other) noexcept=delete |
Conversation (Conversation &&other) noexcept=delete | |
Deleted move assignment and move constructor. More... | |
Conversation & | operator= (Conversation &&other) noexcept=delete |
virtual | ~Conversation () noexcept=default |
Destructs an instance of Conversation. More... | |
virtual core_type::Result< diag::client::vehicle_info::VehicleInfoMessageResponseUniquePtr, DiagClient::VehicleInfoResponseError > | SendVehicleIdentificationRequest (vehicle_info::VehicleInfoListRequestType) noexcept |
Function to send vehicle identification request and get the Diagnostic Server list. More... | |
Private Types | |
enum class | SessionControlType : std::uint8_t { kDefaultSession = 0x01 , kProgrammingSession = 0x02 , kExtendedSession = 0x03 , kSystemSafetySession = 0x04 } |
Definitions of active diagnostic session. More... | |
enum class | SecurityLevelType : std::uint8_t { kLocked = 0x00 , kUnLocked = 0x01 } |
Definitions of active security level. More... | |
enum class | ActivityStatusType : uint8_t { kActive = 0x00 , kInactive = 0x01 } |
Definitions of current activity status. More... | |
Static Private Member Functions | |
static DiagClientConversation::DiagError | ConvertResponseType (::uds_transport::UdsTransportProtocolMgr::TransmissionResult result_type) |
Helper function to convert response type. More... | |
Private Attributes | |
ActivityStatusType | activity_status_ |
Store the conversation activity status. More... | |
SessionControlType | active_session_ |
Store the active diagnostic session. More... | |
SecurityLevelType | active_security_level_ |
Store the active diagnostic security level. More... | |
std::uint32_t | rx_buffer_size_ |
Store the size of reception buffer size setting. More... | |
std::uint16_t | p2_client_max_ |
Store the maximum p2 client time. More... | |
std::uint16_t | p2_star_client_max_ |
Store the maximum p2 star client time. More... | |
std::uint16_t | source_address_ |
Store the logical source address of conversation. More... | |
std::uint16_t | target_address_ |
Store the logical target address of remote server. More... | |
std::string | remote_address_ |
Store the remote IP address of remote server. More... | |
std::string | conversation_name_ |
Store the conversation name. More... | |
std::unique_ptr<::uds_transport::ConversionHandler > | dm_conversion_handler_ |
Store the dm conversation handler. More... | |
std::unique_ptr<::uds_transport::Connection > | connection_ptr_ |
Store the underlying transport protocol connection object. More... | |
SyncTimer | sync_timer_ |
Store the synchronous timer. More... | |
::uds_transport::ByteVector | payload_rx_buffer_ |
Store the received uds response. More... | |
conversation_state_impl::ConversationStateImpl | conversation_state_ |
Store the conversation state. More... | |
Class to establish connection with Diagnostic Server.
Definition at line 28 of file dm_conversation.h.
using diag::client::conversation::DmConversation::ConversationState = conversation_state_impl::ConversationState |
Type alias for conversation internal state.
Definition at line 33 of file dm_conversation.h.
using diag::client::conversation::DmConversation::SyncTimer = utility::sync_timer::SyncTimer<std::chrono::steady_clock> |
Type alias for synchronous timer.
Definition at line 37 of file dm_conversation.h.
|
strongprivate |
Definitions of current activity status.
Enumerator | |
---|---|
kActive | |
kInactive |
Definition at line 180 of file dm_conversation.h.
|
strongprivate |
Definitions of active security level.
Enumerator | |
---|---|
kLocked | |
kUnLocked |
Definition at line 172 of file dm_conversation.h.
|
strongprivate |
Definitions of active diagnostic session.
Enumerator | |
---|---|
kDefaultSession | |
kProgrammingSession | |
kExtendedSession | |
kSystemSafetySession |
Definition at line 162 of file dm_conversation.h.
diag::client::conversation::DmConversation::DmConversation | ( | std::string_view | conversion_name, |
DMConversationType & | conversion_identifier | ||
) |
Constructs an instance of DmConversation.
[in] | conversion_name | The name of conversation |
[in] | conversion_identifier | The identifier consisting of conversation settings |
Definition at line 105 of file dm_conversation.cpp.
References active_security_level_, and active_session_.
|
deletenoexcept |
Deleted copy assignment and copy constructor.
|
deletenoexcept |
Deleted move assignment and move constructor.
|
overridedefault |
Destructs an instance of DmConversation.
|
overridevirtualnoexcept |
Function to connect to Diagnostic Server.
[in] | target_address | Logical address of the Remote server |
[in] | host_ip_addr | IP address of the Remote server |
Reimplemented from diag::client::conversation::Conversation.
Definition at line 151 of file dm_conversation.cpp.
References diag::client::logger::DiagClientLogger::GetDiagClientLogger(), and diag::client::conversation::DiagClientConversation::kConnectSuccess.
|
staticprivate |
Helper function to convert response type.
[in] | result_type | The transmission result type |
Definition at line 394 of file dm_conversation.cpp.
References uds_transport::UdsTransportProtocolMgr::kBusyProcessing, diag::client::conversation::DiagClientConversation::kDiagAckTimeout, diag::client::conversation::DiagClientConversation::kDiagBusyProcessing, diag::client::conversation::DiagClientConversation::kDiagGenericFailure, diag::client::conversation::DiagClientConversation::kDiagNegAckReceived, diag::client::conversation::DiagClientConversation::kDiagRequestSendFailed, uds_transport::UdsTransportProtocolMgr::kNegTransmitAckReceived, uds_transport::UdsTransportProtocolMgr::kNoTransmitAckReceived, and uds_transport::UdsTransportProtocolMgr::kTransmitFailed.
|
overridevirtualnoexcept |
Function to disconnect from Diagnostic Server.
Reimplemented from diag::client::conversation::Conversation.
Definition at line 182 of file dm_conversation.cpp.
References connection_ptr_, conversation_name_, diag::client::logger::DiagClientLogger::GetDiagClientLogger(), diag::client::conversation::DiagClientConversation::kAlreadyDisconnected, diag::client::conversation::DiagClientConversation::kDisconnectFailed, diag::client::conversation::DiagClientConversation::kDisconnectSuccess, remote_address_, and target_address_.
|
overridevirtualnoexcept |
Function to get the conversation handler from conversation object.
Implements diag::client::conversation::Conversation.
Definition at line 326 of file dm_conversation.cpp.
References dm_conversion_handler_.
|
overridevirtualnoexcept |
Function to Hands over a valid received Uds message.
[in] | message | The The Uds message ptr (unique_ptr semantics) with the request. Ownership of the UdsMessage is given back to the conversation here |
Implements diag::client::conversation::Conversation.
Definition at line 388 of file dm_conversation.cpp.
Referenced by diag::client::conversation::DmConversationHandler::HandleMessage().
|
overridevirtualnoexcept |
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 |
Implements diag::client::conversation::Conversation.
Definition at line 331 of file dm_conversation.cpp.
References diag::client::logger::DiagClientLogger::GetDiagClientLogger(), uds_transport::UdsTransportProtocolMgr::kIndicationNOk, uds_transport::UdsTransportProtocolMgr::kIndicationOk, uds_transport::UdsTransportProtocolMgr::kIndicationOverflow, and uds_transport::UdsTransportProtocolMgr::kIndicationPending.
Referenced by diag::client::conversation::DmConversationHandler::IndicateMessage().
|
deletenoexcept |
|
deletenoexcept |
|
overridevirtualnoexcept |
Function to register the conversation to underlying transport protocol handler.
[in] | connection | The conversation connection object |
Implements diag::client::conversation::Conversation.
Definition at line 322 of file dm_conversation.cpp.
|
overridevirtualnoexcept |
Function to send Diagnostic Request and get Diagnostic Response.
[in] | message | The diagnostic request message wrapped in a unique pointer |
Reimplemented from diag::client::conversation::Conversation.
Definition at line 210 of file dm_conversation.cpp.
References core_type::Result< T, E >::FromError(), diag::client::logger::DiagClientLogger::GetDiagClientLogger(), diag::client::conversation::DiagClientConversation::kDiagInvalidParameter, diag::client::conversation::DiagClientConversation::kDiagRequestSendFailed, diag::client::conversation::DiagClientConversation::kDiagResponseTimeout, and uds_transport::UdsTransportProtocolMgr::kTransmitOk.
|
overridevirtualnoexcept |
Function to shutdown the DmConversation.
Implements diag::client::conversation::Conversation.
Definition at line 138 of file dm_conversation.cpp.
References activity_status_, connection_ptr_, conversation_name_, diag::client::logger::DiagClientLogger::GetDiagClientLogger(), and kInactive.
|
overridevirtualnoexcept |
Function to start the DmConversation.
Implements diag::client::conversation::Conversation.
Definition at line 123 of file dm_conversation.cpp.
References activity_status_, connection_ptr_, conversation_name_, diag::client::logger::DiagClientLogger::GetDiagClientLogger(), and kActive.
|
private |
Store the active diagnostic security level.
Definition at line 206 of file dm_conversation.h.
Referenced by DmConversation().
|
private |
Store the active diagnostic session.
Definition at line 201 of file dm_conversation.h.
Referenced by DmConversation().
|
private |
Store the conversation activity status.
Definition at line 196 of file dm_conversation.h.
Referenced by Shutdown(), and Startup().
|
private |
Store the underlying transport protocol connection object.
Definition at line 251 of file dm_conversation.h.
Referenced by DisconnectFromDiagServer(), Shutdown(), and Startup().
|
private |
Store the conversation name.
Definition at line 241 of file dm_conversation.h.
Referenced by DisconnectFromDiagServer(), Shutdown(), and Startup().
|
private |
Store the conversation state.
Definition at line 266 of file dm_conversation.h.
|
private |
Store the dm conversation handler.
Definition at line 246 of file dm_conversation.h.
Referenced by GetConversationHandler().
|
private |
Store the maximum p2 client time.
Definition at line 216 of file dm_conversation.h.
|
private |
Store the maximum p2 star client time.
Definition at line 221 of file dm_conversation.h.
|
private |
Store the received uds response.
Definition at line 261 of file dm_conversation.h.
|
private |
Store the remote IP address of remote server.
Definition at line 236 of file dm_conversation.h.
Referenced by DisconnectFromDiagServer().
|
private |
Store the size of reception buffer size setting.
Definition at line 211 of file dm_conversation.h.
|
private |
Store the logical source address of conversation.
Definition at line 226 of file dm_conversation.h.
|
private |
Store the synchronous timer.
Definition at line 256 of file dm_conversation.h.
|
private |
Store the logical target address of remote server.
Definition at line 231 of file dm_conversation.h.
Referenced by DisconnectFromDiagServer().