Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open INI file less #3688

Merged
merged 18 commits into from
Apr 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/components/config_profile/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/sources.cmake)
include_directories (
${COMPONENTS_DIR}/config_profile/include
${COMPONENTS_DIR}/utils/include/
${COMPONENTS_DIR}/smart_objects/include
${POLICY_GLOBAL_INCLUDE_PATH}/
${LOG4CXX_INCLUDE_DIRECTORY}
${BOOST_INCLUDE_DIR}
Expand All @@ -44,6 +45,7 @@ set(PATHS
)

set(LIBRARIES
SmartObjects
Utils
)

Expand Down
39 changes: 26 additions & 13 deletions src/components/config_profile/include/config_profile/ini_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#define SRC_COMPONENTS_CONFIG_PROFILE_INCLUDE_CONFIG_PROFILE_INI_FILE_H_

#include <stdint.h>
#include "utils/macro.h"

namespace profile {

Expand Down Expand Up @@ -88,40 +89,52 @@ extern "C" {
* @brief Write usage instructions to the end of the file
* @param
*
* \deprecated This method will be removed in the next major release
* See Profile::ParseConfiguration for the new ini parsing code
*
* @return NULL if file or desired entry not found, otherwise pointer to fname
*/
extern char* ini_write_inst(const char* fname, uint8_t flag);
DEPRECATED extern char* ini_write_inst(const char* fname, uint8_t flag);

/*
* @brief Read a certain item of the specified chapter of a ini-file
*
* \deprecated This method will be removed in the next major release
* See Profile::ParseConfiguration for the new ini parsing code
*
* @return NULL if file or desired entry not found, otherwise pointer to value
*/
extern char* ini_read_value(const char* fname,
const char* chapter,
const char* item,
char* value);
DEPRECATED extern char* ini_read_value(const char* fname,
const char* chapter,
const char* item,
char* value);

/*
* @brief Write a certain item of the specified chapter of a ini-file
*
* \deprecated This method will be removed in the next major release
* See Profile::ParseConfiguration for the new ini parsing code
*
* @return NULL if file not found, otherwise pointer to value
*/
extern char ini_write_value(const char* fname,
const char* chapter,
const char* item,
const char* value,
uint8_t flag);
DEPRECATED extern char ini_write_value(const char* fname,
const char* chapter,
const char* item,
const char* value,
uint8_t flag);

/*
* @brief Parse the given line for the item and returns the value if
* there is one otherwise NULL
*
* \deprecated This method will be removed in the next major release
* See Profile::ParseConfiguration for the new ini parsing code
*
* @return NULL if desired entry not found, otherwise pointer to value
*/
extern Ini_search_id ini_parse_line(const char* line,
const char* tag,
char* value);
DEPRECATED extern Ini_search_id ini_parse_line(const char* line,
const char* tag,
char* value);

#ifdef __cplusplus
}
Expand Down
14 changes: 14 additions & 0 deletions src/components/config_profile/include/config_profile/profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "media_manager/media_manager_settings.h"
#include "policy/policy_settings.h"
#include "protocol_handler/protocol_handler_settings.h"
#include "smart_objects/smart_object.h"
#include "transport_manager/transport_manager_settings.h"
#include "utils/macro.h"

Expand Down Expand Up @@ -824,6 +825,11 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
*/
uint32_t app_transport_change_timer_addition() const OVERRIDE;

/**
* @brief Parses values in config_file_name_ to config_obj_ smart object
*/
void ParseConfiguration();

/**
* @brief Updates all related values from ini file
*/
Expand Down Expand Up @@ -989,6 +995,7 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
size_t maximum_audio_payload_size_;
size_t maximum_video_payload_size_;
std::string config_file_name_;
smart_objects::SmartObject config_obj_;
std::string server_address_;
uint16_t server_port_;
uint16_t video_streaming_port_;
Expand Down Expand Up @@ -1114,6 +1121,13 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
int iap2_hub_connect_attempts_;
int iap_hub_connection_wait_timeout_;
uint16_t tts_global_properties_timeout_;
size_t maximum_payload_size_;
size_t message_frequency_count_;
size_t message_frequency_time_;
bool malformed_message_filtering_;
size_t malformed_frequency_count_;
size_t malformed_frequency_time_;
uint32_t multiframe_waiting_timeout_;
uint16_t attempts_to_open_policy_db_;
uint16_t open_attempt_timeout_ms_;
uint32_t resumption_delay_before_ign_;
Expand Down
6 changes: 6 additions & 0 deletions src/components/config_profile/src/ini_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@

namespace profile {

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"

SDL_CREATE_LOG_VARIABLE("Profile")

char* ini_write_inst(const char* fname, uint8_t flag) {
Expand Down Expand Up @@ -415,4 +418,7 @@ Ini_search_id ini_parse_line(const char* line, const char* tag, char* value) {

return INI_NOTHING;
}

#pragma GCC diagnostic pop

} // namespace profile
Loading