17 namespace conversation_manager {
22 : uds_transport_mgr_{uds_transport_mgr} {
24 StoreConversationConfig(config);
32 std::string_view conversation_name) noexcept {
34 auto it = conversation_map_.find(std::string{conversation_name});
35 if (it != conversation_map_.end()) {
36 std::string
const conversation_name_in_map{it->first};
37 it->second.conversation = std::visit(
41 std::unique_ptr<diag::client::conversation::Conversation> conversation{
42 std::make_unique<diag::client::conversation::DmConversation>(conversation_name_in_map,
45 conversation->RegisterConnection(uds_transport_mgr_.GetTransportProtocolHandler().CreateTcpConnection(
46 conversation->GetConversationHandler(), conversation_type.tcp_address, conversation_type.port_num));
51 std::unique_ptr<diag::client::conversation::Conversation> conversation{
52 std::make_unique<diag::client::conversation::VdConversation>(conversation_name_in_map,
55 conversation->RegisterConnection(uds_transport_mgr_.GetTransportProtocolHandler().CreateUdpConnection(
56 conversation->GetConversationHandler(), conversation_type.udp_address, conversation_type.port_num));
59 it->second.conversation_type);
62 __FILE__, __LINE__, __func__, [conversation_name](std::stringstream &msg) {
63 msg <<
"Invalid conversation name: '" << conversation_name <<
"', provide correct name as per config file";
66 return *(it->second.conversation);
72 conversion_identifier.
udp_address = config.udp_ip_address;
73 conversion_identifier.udp_broadcast_address = config.udp_broadcast_address;
74 conversion_identifier.port_num = 0U;
75 (void) conversation_map_.emplace(
"VehicleDiscovery",
ConversationStorage{conversion_identifier,
nullptr});
79 for (std::uint8_t conv_count{0U}; conv_count < config.num_of_conversation; conv_count++) {
81 conversion_identifier.
rx_buffer_size = config.conversations[conv_count].rx_buffer_size;
82 conversion_identifier.p2_client_max = config.conversations[conv_count].p2_client_max;
83 conversion_identifier.p2_star_client_max = config.conversations[conv_count].p2_star_client_max;
84 conversion_identifier.source_address = config.conversations[conv_count].source_address;
85 conversion_identifier.tcp_address = config.conversations[conv_count].network.tcp_ip_address;
86 conversion_identifier.port_num = 0U;
88 (void) conversation_map_.emplace(config.conversations[conv_count].conversation_name,
89 ConversationStorage{conversion_identifier,
nullptr});
Interface for diag client conversation.
void StoreConversationConfig(diag::client::config_parser::DcmClientConfig &config) noexcept
Function to store the dcm client configuration internally.
diag::client::conversation::Conversation & GetDiagnosticClientConversation(std::string_view conversation_name) noexcept
Function to get DM conversation object based on conversation name.
void Shutdown() noexcept
Function to shutdown the ConversationManager.
ConversationManager(diag::client::config_parser::DcmClientConfig config, diag::client::uds_transport::UdsTransportProtocolManager &uds_transport_mgr) noexcept
Constructs an instance of ConversationManager.
void Startup() noexcept
Function to start the ConversationManager.
static auto GetDiagClientLogger() noexcept -> DiagClientLogger &
Get the diag client logger instance.
Structure containing DM conversation type.
std::uint32_t rx_buffer_size
The reception buffer size type.
Structure containing VD conversation type.
std::string udp_address
The Udp IP address of conversation.