Diag-Client-Lib
diagnostic_client.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 DIAG_CLIENT_LIB_APPL_INCLUDE_DIAGNOSTIC_CLIENT_H_
9 #define DIAG_CLIENT_LIB_APPL_INCLUDE_DIAGNOSTIC_CLIENT_H_
10 
11 #include <functional>
12 #include <memory>
13 #include <string_view>
14 
18 
19 namespace diag {
20 namespace client {
21 
25 class DiagClient final {
26  public:
30  enum class VehicleInfoResponseError : std::uint8_t {
31  kTransmitFailed = 0U,
32  kInvalidParameters = 1U,
33  kNoResponseReceived = 2U,
34  };
35 
36  public:
43  explicit DiagClient(std::string_view diag_client_config_path) noexcept;
44 
48  DiagClient(const DiagClient &other) noexcept = delete;
49  DiagClient &operator=(const DiagClient &other) noexcept = delete;
50 
54  DiagClient(DiagClient &&other) noexcept = delete;
55  DiagClient &operator=(DiagClient &&other) noexcept = delete;
56 
61  ~DiagClient() noexcept;
62 
69  Result<void> Initialize() noexcept;
70 
78  Result<void> DeInitialize() noexcept;
79 
88  diag::client::vehicle_info::VehicleInfoListRequestType vehicle_info_request) noexcept;
89 
97  conversation::DiagClientConversation GetDiagnosticClientConversation(std::string_view conversation_name) noexcept;
98 
99  private:
103  class DiagClientImpl;
104 
109 };
110 
111 } // namespace client
112 } // namespace diag
113 #endif // DIAG_CLIENT_LIB_APPL_INCLUDE_DIAGNOSTIC_CLIENT_H_
Class type to contains a value (of type ValueType), or an error (of type ErrorType)
Definition: result.h:29
Class to provide implementation of diag client.
Class to manage Diagnostic Client.
Result< void > Initialize() noexcept
Function to initialize the already created instance of DiagClient.
VehicleInfoResponseError
Definitions of Vehicle Identification response error code.
Result< vehicle_info::VehicleInfoMessageResponseUniquePtr, VehicleInfoResponseError > SendVehicleIdentificationRequest(diag::client::vehicle_info::VehicleInfoListRequestType vehicle_info_request) noexcept
Function to send vehicle identification request and get the Diagnostic Server list.
std::unique_ptr< DiagClientImpl > diag_client_impl_
Unique pointer to diag client implementation.
DiagClient(std::string_view diag_client_config_path) noexcept
Constructs an instance of DiagClient.
DiagClient(DiagClient &&other) noexcept=delete
Deleted move assignment and move constructor.
conversation::DiagClientConversation GetDiagnosticClientConversation(std::string_view conversation_name) noexcept
Function to get required diag client conversation object based on conversation name.
DiagClient & operator=(const DiagClient &other) noexcept=delete
DiagClient & operator=(DiagClient &&other) noexcept=delete
~DiagClient() noexcept
Destruct an instance of DiagClient -Destruction.
Result< void > DeInitialize() noexcept
Function to de-initialize the already initialized instance of DiagClient.
DiagClient(const DiagClient &other) noexcept=delete
Deleted copy assignment and copy constructor.
VehicleAddrInfoRequest VehicleInfoListRequestType
Type alias of request storage type used while sending vehicle identification request.
std::unique_ptr< VehicleInfoMessage > VehicleInfoMessageResponseUniquePtr
The unique_ptr for Vehicle Identification Response Message.