Diag-Client-Lib
Public Member Functions | Private Attributes | List of all members
diag::client::common::DiagnosticManager Class Referenceabstract

Parent class to create Diagnostic Manager. More...

#include <diagnostic_manager.h>

Inheritance diagram for diag::client::common::DiagnosticManager:
Inheritance graph
[legend]

Public Member Functions

 DiagnosticManager () noexcept
 Constructs an instance of DiagnosticManager. More...
 
 DiagnosticManager (const DiagnosticManager &other) noexcept=delete
 Deleted copy assignment and copy constructor. More...
 
DiagnosticManageroperator= (const DiagnosticManager &other) noexcept=delete
 
 DiagnosticManager (DiagnosticManager &&other) noexcept=delete
 Deleted move assignment and move constructor. More...
 
DiagnosticManageroperator= (DiagnosticManager &&other) noexcept=delete
 
virtual ~DiagnosticManager () noexcept
 Destructs an instance of DiagnosticManager. More...
 
virtual void Main () noexcept
 Function to manage the whole lifecycle of DiagnosticManager. More...
 
virtual Result< void > SignalShutdown () noexcept
 Function to initiate shutdown of DiagnosticManager. More...
 
virtual void Initialize () noexcept=0
 Function to initialize the DiagnosticManager. More...
 
virtual void Run () noexcept=0
 Function to run DiagnosticManager. More...
 
virtual void Shutdown () noexcept=0
 Function to shutdown the DiagnosticManager. More...
 
virtual conversation::DiagClientConversation GetDiagnosticClientConversation (std::string_view conversation_name) noexcept=0
 Function to get required diag client conversation object based on conversation name. More...
 
virtual core_type::Result< diag::client::vehicle_info::VehicleInfoMessageResponseUniquePtr, DiagClient::VehicleInfoResponseErrorSendVehicleIdentificationRequest (diag::client::vehicle_info::VehicleInfoListRequestType vehicle_info_request) noexcept=0
 Function to send vehicle identification request and get the Diagnostic Server list. More...
 

Private Attributes

bool exit_requested_
 Flag to terminate the main thread. More...
 
std::condition_variable cond_var_
 Conditional variable to block the thread. More...
 
std::mutex mutex_
 For locking critical section of code. More...
 

Detailed Description

Parent class to create Diagnostic Manager.

Definition at line 31 of file diagnostic_manager.h.

Constructor & Destructor Documentation

◆ DiagnosticManager() [1/3]

diag::client::common::DiagnosticManager::DiagnosticManager ( )
noexcept

Constructs an instance of DiagnosticManager.

Definition at line 14 of file diagnostic_manager.cpp.

14 : exit_requested_{false}, cond_var_{}, mutex_{} {}
bool exit_requested_
Flag to terminate the main thread.
std::condition_variable cond_var_
Conditional variable to block the thread.
std::mutex mutex_
For locking critical section of code.

◆ DiagnosticManager() [2/3]

diag::client::common::DiagnosticManager::DiagnosticManager ( const DiagnosticManager other)
deletenoexcept

Deleted copy assignment and copy constructor.

◆ DiagnosticManager() [3/3]

diag::client::common::DiagnosticManager::DiagnosticManager ( DiagnosticManager &&  other)
deletenoexcept

Deleted move assignment and move constructor.

◆ ~DiagnosticManager()

diag::client::common::DiagnosticManager::~DiagnosticManager ( )
virtualnoexcept

Destructs an instance of DiagnosticManager.

Definition at line 16 of file diagnostic_manager.cpp.

16  {
17  {
18  std::lock_guard<std::mutex> const lock{mutex_};
19  exit_requested_ = true;
20  }
21  cond_var_.notify_all();
22 }

References cond_var_, exit_requested_, and mutex_.

Member Function Documentation

◆ GetDiagnosticClientConversation()

virtual conversation::DiagClientConversation diag::client::common::DiagnosticManager::GetDiagnosticClientConversation ( std::string_view  conversation_name)
pure virtualnoexcept

Function to get required diag client conversation object based on conversation name.

Parameters
[in]conversation_nameName of conversation configured as json parameter "ConversationName"
Returns
Diag client conversation object as per passed conversation name -MultipleTester-Connection, DiagClientLib-Conversation-Construction

Implemented in diag::client::dcm::DCMClient.

◆ Initialize()

virtual void diag::client::common::DiagnosticManager::Initialize ( )
pure virtualnoexcept

Function to initialize the DiagnosticManager.

Implemented in diag::client::dcm::DCMClient.

Referenced by Main().

Here is the caller graph for this function:

◆ Main()

void diag::client::common::DiagnosticManager::Main ( )
virtualnoexcept

Function to manage the whole lifecycle of DiagnosticManager.

Definition at line 24 of file diagnostic_manager.cpp.

24  {
25  // Initialize the module
26  Initialize();
27  // Run the module
28  Run();
29  // Entering infinite loop
30  while (!exit_requested_) {
31  std::unique_lock<std::mutex> lck(mutex_);
32  cond_var_.wait(lck, [this]() { return exit_requested_; });
33  // Thread exited
34  }
35  // Shutdown module
36  Shutdown();
37 }
virtual void Initialize() noexcept=0
Function to initialize the DiagnosticManager.
virtual void Run() noexcept=0
Function to run DiagnosticManager.
virtual void Shutdown() noexcept=0
Function to shutdown the DiagnosticManager.

References cond_var_, exit_requested_, Initialize(), mutex_, Run(), and Shutdown().

Here is the call graph for this function:

◆ operator=() [1/2]

DiagnosticManager& diag::client::common::DiagnosticManager::operator= ( const DiagnosticManager other)
deletenoexcept

◆ operator=() [2/2]

DiagnosticManager& diag::client::common::DiagnosticManager::operator= ( DiagnosticManager &&  other)
deletenoexcept

◆ Run()

virtual void diag::client::common::DiagnosticManager::Run ( )
pure virtualnoexcept

Function to run DiagnosticManager.

Implemented in diag::client::dcm::DCMClient.

Referenced by Main().

Here is the caller graph for this function:

◆ SendVehicleIdentificationRequest()

virtual core_type::Result<diag::client::vehicle_info::VehicleInfoMessageResponseUniquePtr, DiagClient::VehicleInfoResponseError> diag::client::common::DiagnosticManager::SendVehicleIdentificationRequest ( diag::client::vehicle_info::VehicleInfoListRequestType  vehicle_info_request)
pure virtualnoexcept

Function to send vehicle identification request and get the Diagnostic Server list.

Parameters
[in]vehicle_info_requestVehicle information sent along with request
Returns
Result containing available vehicle information response on success, VehicleResponseErrorCode on error -VehicleDiscovery

Implemented in diag::client::dcm::DCMClient.

◆ Shutdown()

virtual void diag::client::common::DiagnosticManager::Shutdown ( )
pure virtualnoexcept

Function to shutdown the DiagnosticManager.

Implemented in diag::client::dcm::DCMClient.

Referenced by Main().

Here is the caller graph for this function:

◆ SignalShutdown()

Result< void > diag::client::common::DiagnosticManager::SignalShutdown ( )
virtualnoexcept

Function to initiate shutdown of DiagnosticManager.

Definition at line 39 of file diagnostic_manager.cpp.

39  {
40  Result<void> result{};
41  {
42  std::lock_guard<std::mutex> lock{mutex_};
43  exit_requested_ = true;
44  }
45  cond_var_.notify_all();
46  return result;
47 }

References cond_var_, exit_requested_, and mutex_.

Member Data Documentation

◆ cond_var_

std::condition_variable diag::client::common::DiagnosticManager::cond_var_
private

Conditional variable to block the thread.

Definition at line 111 of file diagnostic_manager.h.

Referenced by Main(), SignalShutdown(), and ~DiagnosticManager().

◆ exit_requested_

bool diag::client::common::DiagnosticManager::exit_requested_
private

Flag to terminate the main thread.

Definition at line 106 of file diagnostic_manager.h.

Referenced by Main(), SignalShutdown(), and ~DiagnosticManager().

◆ mutex_

std::mutex diag::client::common::DiagnosticManager::mutex_
private

For locking critical section of code.

Definition at line 116 of file diagnostic_manager.h.

Referenced by Main(), SignalShutdown(), and ~DiagnosticManager().


The documentation for this class was generated from the following files: