Diag-Client-Lib
config_parser_type.cpp
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 /* includes */
10 
11 namespace diag {
12 namespace client {
13 namespace config_parser {
14 
17  // get the udp info for vehicle discovery
18  config.udp_ip_address = config_tree.get<std::string>("UdpIpAddress");
19  config.udp_broadcast_address = config_tree.get<std::string>("UdpBroadcastAddress");
20  // get total number of conversation
21  config.num_of_conversation = config_tree.get<std::uint8_t>("Conversation.NumberOfConversation");
22  // loop through all the conversation
23  for (boost_support::parser::boost_tree::value_type &conversation_ptr:
24  config_tree.get_child("Conversation.ConversationProperty")) {
26  conversation.conversation_name = conversation_ptr.second.get<std::string>("ConversationName");
27  conversation.p2_client_max = conversation_ptr.second.get<std::uint16_t>("P2ClientMax");
28  conversation.p2_star_client_max = conversation_ptr.second.get<std::uint16_t>("P2StarClientMax");
29  conversation.rx_buffer_size = conversation_ptr.second.get<std::uint16_t>("RxBufferSize");
30  conversation.source_address = conversation_ptr.second.get<std::uint16_t>("SourceAddress");
31  conversation.network.tcp_ip_address = conversation_ptr.second.get<std::string>("Network.TcpIpAddress");
32  config.conversations.emplace_back(conversation);
33  }
34  return config;
35 }
36 
37 } // namespace config_parser
38 } // namespace client
39 } // namespace diag
boost::property_tree::ptree boost_tree
Type alias for boost property tree.
Definition: json_parser.h:23
diag::client::config_parser::DcmClientConfig ReadDcmClientConfig(boost_support::parser::boost_tree &config_tree)
Function to read from config tree and get the DcmClient configuration.