Diag-Client-Lib
diagnostic_client_conversation.h
Go to the documentation of this file.
1 /* Diagnostic Client library
2  * Copyright (C) 2024 Avijit Dey
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
8 #ifndef DIAGNOSTIC_CLIENT_LIB_APPL_INCLUDE_DIAGNOSTIC_CLIENT_CONVERSATION_H
9 #define DIAGNOSTIC_CLIENT_LIB_APPL_INCLUDE_DIAGNOSTIC_CLIENT_CONVERSATION_H
10 
11 #include <cstdint>
12 
15 
16 namespace diag {
17 namespace client {
18 namespace conversation {
19 
25  public:
30 
31  public:
35  enum class ConnectResult : std::uint8_t {
36  kConnectSuccess = 0U,
37  kConnectFailed = 1U,
38  kConnectTimeout = 2U
39  };
40 
44  enum class DisconnectResult : std::uint8_t {
45  kDisconnectSuccess = 0U,
46  kDisconnectFailed = 1U,
48  };
49 
53  enum class DiagError : std::uint8_t {
54  kDiagGenericFailure = 1U,
56  kDiagAckTimeout = 3U,
57  kDiagNegAckReceived = 4U,
61  };
62 
69  explicit DiagClientConversation(std::string_view conversation_name) noexcept;
70 
76 
82  void Startup() noexcept;
83 
90  void Shutdown() noexcept;
91 
103  ConnectResult ConnectToDiagServer(std::uint16_t target_address, IpAddress host_ip_addr) noexcept;
104 
113 
127  uds_message::UdsRequestMessageConstPtr message) noexcept;
128 
129  private:
134 
139 };
140 } // namespace conversation
141 } // namespace client
142 } // namespace diag
143 #endif // DIAGNOSTIC_CLIENT_LIB_APPL_INCLUDE_DIAGNOSTIC_CLIENT_CONVERSATION_H
Class type to contains a value (of type ValueType), or an error (of type ErrorType)
Definition: result.h:29
Conversation class to establish connection with a Diagnostic Server.
Result< uds_message::UdsResponseMessagePtr, DiagError > SendDiagnosticRequest(uds_message::UdsRequestMessageConstPtr message) noexcept
Function to send Diagnostic Request and get Diagnostic Response.
DiagClientConversation(std::string_view conversation_name) noexcept
Constructor an instance of DiagClientConversation.
DiagError
Definitions of Diagnostics Request Response results.
uds_message::UdsMessage::IpAddress IpAddress
Type alias of ip address type.
ConnectResult ConnectToDiagServer(std::uint16_t target_address, IpAddress host_ip_addr) noexcept
Function to connect to Diagnostic Server using Target address and IP address of the server.
void Startup() noexcept
Function to startup the Diagnostic Client Conversation.
~DiagClientConversation() noexcept
Destructor an instance of DiagClientConversation -Conversation-Destruction.
void Shutdown() noexcept
Function to shutdown the Diagnostic Client Conversation.
DisconnectResult DisconnectFromDiagServer() noexcept
Function to disconnect from Diagnostic Server.
std::unique_ptr< DiagClientConversationImpl > diag_client_conversation_impl_
Unique pointer to diag client conversation implementation.
std::string_view IpAddress
Type alias of ip address type.
std::unique_ptr< UdsMessage > UdsResponseMessagePtr
Type alias of unique_ptr for Response Message.
std::unique_ptr< const UdsMessage > UdsRequestMessageConstPtr
Type alias of unique_ptr for constant UdsRequestMessage.