diff options
author | jacobkeeler <jacob.keeler@livioradio.com> | 2017-08-04 14:13:56 -0400 |
---|---|---|
committer | jacobkeeler <jacob.keeler@livioradio.com> | 2017-08-04 15:01:20 -0400 |
commit | d0cc7c448626b03b333a6634a5ee31ea16433b09 (patch) | |
tree | fb55207f2ade7aa8ec69a5dc2796aea780787675 /src/components/config_profile | |
parent | 83c9502e5ccb3e78ff40b9ef2f110ced17e914cd (diff) | |
download | sdl_core-d0cc7c448626b03b333a6634a5ee31ea16433b09.tar.gz |
Use `MaxSupportedProtocolVersion` instead of `EnableProtocolX` to determine protocol versionfeature/max_supported_protocol_version
An ini configuration was already implemented for `MaxSupportedProtocolVersion`
This commit removes the `EnableProtocolX` options and instead uses the `MaxSupportedProtcolVersion` parameter to determine what features are supported
Diffstat (limited to 'src/components/config_profile')
-rw-r--r-- | src/components/config_profile/include/config_profile/profile.h | 8 | ||||
-rw-r--r-- | src/components/config_profile/src/profile.cc | 43 |
2 files changed, 8 insertions, 43 deletions
diff --git a/src/components/config_profile/include/config_profile/profile.h b/src/components/config_profile/include/config_profile/profile.h index 5c4618903f..8a25bcf648 100644 --- a/src/components/config_profile/include/config_profile/profile.h +++ b/src/components/config_profile/include/config_profile/profile.h @@ -111,6 +111,7 @@ class Profile : public protocol_handler::ProtocolHandlerSettings, /** * @brief Returns true, if SDL 4.0 is enabled */ + // DEPRECATED, use max_supported_protocol_version instead bool enable_protocol_4() const OVERRIDE; /** @@ -130,11 +131,6 @@ class Profile : public protocol_handler::ProtocolHandlerSettings, const uint32_t& app_icons_amount_to_remove() const OVERRIDE; /** - * @brief Returns true if SDL protocol v5 is enabled - */ - bool enable_protocol_5() const OVERRIDE; - - /** * @brief Returns the maximum payload size for control services */ size_t maximum_control_payload_size() const OVERRIDE; @@ -784,11 +780,9 @@ class Profile : public protocol_handler::ProtocolHandlerSettings, std::string app_config_folder_; std::string app_storage_folder_; std::string app_resource_folder_; - bool enable_protocol_4_; std::string app_icons_folder_; uint32_t app_icons_folder_max_size_; uint32_t app_icons_amount_to_remove_; - bool enable_protocol_5_; size_t maximum_control_payload_size_; size_t maximum_rpc_payload_size_; size_t maximum_audio_payload_size_; diff --git a/src/components/config_profile/src/profile.cc b/src/components/config_profile/src/profile.cc index 9ea2672448..58709b876c 100644 --- a/src/components/config_profile/src/profile.cc +++ b/src/components/config_profile/src/profile.cc @@ -101,11 +101,9 @@ const char* kAppStorageFolderKey = "AppStorageFolder"; const char* kAppResourseFolderKey = "AppResourceFolder"; const char* kLogsEnabledKey = "LogsEnabled"; const char* kAppConfigFolderKey = "AppConfigFolder"; -const char* kEnableProtocol4Key = "EnableProtocol4"; const char* kAppIconsFolderKey = "AppIconsFolder"; const char* kAppIconsFolderMaxSizeKey = "AppIconsFolderMaxSize"; const char* kAppIconsAmountToRemoveKey = "AppIconsAmountToRemove"; -const char* kEnableProtocol5Key = "EnableProtocol5"; const char* kMaximumControlPayloadSizeKey = "MaximumControlPayloadSize"; const char* kMaximumRpcPayloadSizeKey = "MaximumRpcPayloadSize"; const char* kMaximumAudioPayloadSizeKey = "MaximumAudioPayloadSize"; @@ -244,7 +242,7 @@ const uint32_t kDefaultBeforeUpdateHours = 24; const uint32_t kDefaultHubProtocolIndex = 0; const uint32_t kDefaultHeartBeatTimeout = 0; -const uint16_t kDefaultMaxSupportedProtocolVersion = 3; +const uint16_t kDefaultMaxSupportedProtocolVersion = 5; const uint16_t kDefautTransportManagerTCPPort = 12345; const uint16_t kDefaultServerPort = 8087; const uint16_t kDefaultVideoStreamingPort = 5050; @@ -323,11 +321,9 @@ Profile::Profile() app_config_folder_() , app_storage_folder_() , app_resource_folder_() - , enable_protocol_4_(false) , app_icons_folder_() , app_icons_folder_max_size_(kDefaultAppIconsFolderMaxSize) , app_icons_amount_to_remove_(kDefaultAppIconsAmountToRemove) - , enable_protocol_5_(false) , maximum_control_payload_size_(kDefaultMaximumControlPayloadSize) , maximum_rpc_payload_size_(kDefaultMaximumRpcPayloadSize) , maximum_audio_payload_size_(kDefaultMaximumAudioPayloadSize) @@ -454,7 +450,7 @@ const std::string& Profile::app_resource_folder() const { } bool Profile::enable_protocol_4() const { - return enable_protocol_4_; + return max_supported_protocol_version_ >= 4; } const std::string& Profile::app_icons_folder() const { @@ -469,10 +465,6 @@ const uint32_t& Profile::app_icons_amount_to_remove() const { return app_icons_amount_to_remove_; } -bool Profile::enable_protocol_5() const { - return enable_protocol_5_; -} - size_t Profile::maximum_control_payload_size() const { return maximum_control_payload_size_; } @@ -1043,17 +1035,6 @@ void Profile::UpdateValues() { LOG_UPDATED_VALUE(app_resource_folder_, kAppResourseFolderKey, kMainSection); - // Enable protocol ver.4 parameter - std::string enable_protocol_4_value; - if (ReadValue(&enable_protocol_4_value, kSDL4Section, kEnableProtocol4Key) && - 0 == strcmp("true", enable_protocol_4_value.c_str())) { - enable_protocol_4_ = true; - } else { - enable_protocol_4_ = false; - } - - LOG_UPDATED_BOOL_VALUE(enable_protocol_4_, kEnableProtocol4Key, kSDL4Section); - // Application icon folder ReadStringValue(&app_icons_folder_, file_system::CurrentWorkingDirectory().c_str(), @@ -1088,17 +1069,6 @@ void Profile::UpdateValues() { LOG_UPDATED_VALUE( app_icons_amount_to_remove_, kAppIconsAmountToRemoveKey, kSDL4Section); - // Enable protocol ver.5 parameter - std::string enable_protocol_5_value; - if (ReadValue(&enable_protocol_5_value, kSDL5Section, kEnableProtocol5Key) && - 0 == strcmp("true", enable_protocol_5_value.c_str())) { - enable_protocol_5_ = true; - } else { - enable_protocol_5_ = false; - } - - LOG_UPDATED_BOOL_VALUE(enable_protocol_5_, kEnableProtocol5Key, kSDL5Section); - ReadUIntValue(&maximum_control_payload_size_, kDefaultMaximumControlPayloadSize, kSDL5Section, @@ -1712,10 +1682,11 @@ void Profile::UpdateValues() { kProtocolHandlerSection, kMaxSupportedProtocolVersionKey); - // if .ini file contains protocol version less than 2 or more than 3 - // max_supported_protocol_version_ = 3 - if (max_supported_protocol_version_ < 2) { - max_supported_protocol_version_ = 3; + if (max_supported_protocol_version_ < 1) { + max_supported_protocol_version_ = 1; + } else if (max_supported_protocol_version_ > + kDefaultMaxSupportedProtocolVersion) { + max_supported_protocol_version_ = kDefaultMaxSupportedProtocolVersion; } LOG_UPDATED_BOOL_VALUE(enable_policy_, kEnablePolicy, kPolicySection); |