Diag-Client-Lib
dcm_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 DIAGNOSTIC_CLIENT_LIB_APPL_SRC_DIAGNOSTIC_COMMUNICATION_MANAGER_H
9 #define DIAGNOSTIC_CLIENT_LIB_APPL_SRC_DIAGNOSTIC_COMMUNICATION_MANAGER_H
10 /* includes */
11 #include <string_view>
12 
13 #include "core/include/result.h"
18 
19 namespace diag {
20 namespace client {
21 namespace dcm {
22 
27  public:
33  explicit DCMClient(config_parser::DcmClientConfig dcm_client_config);
34 
38  DCMClient(const DCMClient &other) noexcept = delete;
39  DCMClient &operator=(const DCMClient &other) noexcept = delete;
40 
44  DCMClient(DCMClient &&other) noexcept = delete;
45  DCMClient &operator=(DCMClient &&other) noexcept = delete;
46 
50  ~DCMClient() noexcept override;
51 
55  void Initialize() noexcept override;
56 
60  void Run() noexcept override;
61 
65  void Shutdown() noexcept override;
66 
73  conversation::DiagClientConversation GetDiagnosticClientConversation(
74  std::string_view conversation_name) noexcept override;
75 
83  DiagClient::VehicleInfoResponseError>
85  diag::client::vehicle_info::VehicleInfoListRequestType vehicle_info_request) noexcept override;
86 
87  private:
91  std::unique_ptr<uds_transport::UdsTransportProtocolManager> uds_transport_protocol_mgr_;
92 
96  conversation_manager::ConversationManager conversation_mgr_;
97 
101  conversation::Conversation &vehicle_discovery_conversation_;
102 };
103 
108 auto GetConversationManager() noexcept -> conversation_manager::ConversationManager &;
109 
110 } // namespace dcm
111 } // namespace client
112 } // namespace diag
113 #endif // DIAGNOSTIC_CLIENT_LIB_APPL_SRC_DIAGNOSTIC_COMMUNICATION_MANAGER_H
Class type to contains a value (of type ValueType), or an error (of type ErrorType)
Definition: result.h:29
Class to manage Diagnostic Client.
Parent class to create Diagnostic Manager.
Class to create Diagnostic Manager Client functionality.
Definition: dcm_client.h:26
std::unique_ptr< uds_transport::UdsTransportProtocolManager > uds_transport_protocol_mgr_
Stores the uds transport protocol manager.
Definition: dcm_client.h:91
DCMClient(DCMClient &&other) noexcept=delete
Deleted move assignment and move constructor.
DCMClient(config_parser::DcmClientConfig dcm_client_config)
Constructs an instance of DCMClient.
Definition: dcm_client.cpp:30
void Shutdown() noexcept override
Function to shutdown the DCMClient.
Definition: dcm_client.cpp:60
conversation_manager::ConversationManager conversation_mgr_
Stores the conversation manager instance.
Definition: dcm_client.h:96
void Run() noexcept override
Function to run DCMClient.
Definition: dcm_client.cpp:53
~DCMClient() noexcept override
Destructs an instance of DCMClient.
DCMClient & operator=(DCMClient &&other) noexcept=delete
conversation::DiagClientConversation GetDiagnosticClientConversation(std::string_view conversation_name) noexcept override
Function to get required diag client conversation object based on conversation name.
Definition: dcm_client.cpp:72
DCMClient & operator=(const DCMClient &other) noexcept=delete
void Initialize() noexcept override
Function to initialize the DCMClient.
Definition: dcm_client.cpp:41
conversation::Conversation & vehicle_discovery_conversation_
Store the conversation for vehicle discovery.
Definition: dcm_client.h:101
core_type::Result< diag::client::vehicle_info::VehicleInfoMessageResponseUniquePtr, DiagClient::VehicleInfoResponseError > SendVehicleIdentificationRequest(diag::client::vehicle_info::VehicleInfoListRequestType vehicle_info_request) noexcept override
Function to send vehicle identification request and get the Diagnostic Server list.
Definition: dcm_client.cpp:78
DCMClient(const DCMClient &other) noexcept=delete
Deleted copy assignment and copy constructor.
auto GetConversationManager() noexcept -> conversation_manager::ConversationManager &
Function to get the reference to conversation manager.
Definition: dcm_client.cpp:83
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.