diff options
Diffstat (limited to 'src/components/config_profile')
4 files changed, 138 insertions, 43 deletions
diff --git a/src/components/config_profile/include/config_profile/ini_file.h b/src/components/config_profile/include/config_profile/ini_file.h index 764ff2f6cf..1b6248246c 100644 --- a/src/components/config_profile/include/config_profile/ini_file.h +++ b/src/components/config_profile/include/config_profile/ini_file.h @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2013, Ford Motor Company * All rights reserved. * diff --git a/src/components/config_profile/include/config_profile/profile.h b/src/components/config_profile/include/config_profile/profile.h index 5be14d4006..174608cd80 100644 --- a/src/components/config_profile/include/config_profile/profile.h +++ b/src/components/config_profile/include/config_profile/profile.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) 2014, Ford Motor Company * All rights reserved. * @@ -147,6 +147,7 @@ class Profile : public utils::Singleton<Profile> { * @brief Default timeout for waiting for resuming */ const uint32_t& app_resuming_timeout() const; + const uint32_t& app_resumption_save_persistent_data_timeout() const; /** * @brief Returns desirable thread stack size @@ -439,6 +440,19 @@ class Profile : public utils::Singleton<Profile> { */ int iap_hub_connection_wait_timeout() const; + /* + * ProtocolHandler section + */ + size_t maximum_payload_size() const; + + size_t message_frequency_count() const; + + size_t message_frequency_time() const; + + uint16_t attempts_to_open_policy_db() const; + + uint16_t open_attempt_timeout_ms() const; + private: /** * Default constructor @@ -553,6 +567,7 @@ class Profile : public utils::Singleton<Profile> { uint32_t max_cmd_id_; uint32_t default_timeout_; uint32_t app_resuming_timeout_; + uint32_t app_resumption_save_persistent_data_timeout_; std::string vr_help_title_; uint32_t app_dir_quota_; std::string video_consumer_type_; @@ -614,6 +629,8 @@ class Profile : public utils::Singleton<Profile> { int iap2_hub_connect_attempts_; int iap_hub_connection_wait_timeout_; uint16_t tts_global_properties_timeout_; + uint16_t attempts_to_open_policy_db_; + uint16_t open_attempt_timeout_ms_; FRIEND_BASE_SINGLETON_CLASS(Profile); DISALLOW_COPY_AND_ASSIGN(Profile); diff --git a/src/components/config_profile/src/ini_file.cc b/src/components/config_profile/src/ini_file.cc index 63c9668bc8..236dd1ae2b 100644 --- a/src/components/config_profile/src/ini_file.cc +++ b/src/components/config_profile/src/ini_file.cc @@ -1,34 +1,34 @@ -/** -* Copyright (c) 2013, Ford Motor Company -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* -* Redistributions of source code must retain the above copyright notice, this -* list of conditions and the following disclaimer. -* -* Redistributions in binary form must reproduce the above copyright notice, -* this list of conditions and the following -* disclaimer in the documentation and/or other materials provided with the -* distribution. -* -* Neither the name of the Ford Motor Company nor the names of its contributors -* may be used to endorse or promote products derived from this software -* without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -* POSSIBILITY OF SUCH DAMAGE. -*/ +/* + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ #include "config_profile/ini_file.h" #include <stdlib.h> @@ -200,8 +200,10 @@ char ini_write_value(const char *fname, } #else // #if USE_MKSTEMP tmpnam(temp_fname); - if (0 == (wr_fp = fopen(temp_fname, "w"))) + if (0 == (wr_fp = fopen(temp_fname, "w"))) { + fclose(rd_fp); return FALSE; + } #endif // #else #if USE_MKSTEMP snprintf(tag, INI_LINE_LEN, "%s", chapter); diff --git a/src/components/config_profile/src/profile.cc b/src/components/config_profile/src/profile.cc index 49b41cf23a..fb283ad0ad 100644 --- a/src/components/config_profile/src/profile.cc +++ b/src/components/config_profile/src/profile.cc @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) 2014, Ford Motor Company * All rights reserved. * @@ -69,10 +69,13 @@ const char* kTransportManagerSection = "TransportManager"; const char* kApplicationManagerSection = "ApplicationManager"; const char* kFilesystemRestrictionsSection = "FILESYSTEM RESTRICTIONS"; const char* kIAPSection = "IAP"; +const char* kProtocolHandlerSection = "ProtocolHandler"; const char* kHmiCapabilitiesKey = "HMICapabilities"; const char* kPathToSnapshotKey = "PathToSnapshot"; const char* kPreloadedPTKey = "PreloadedPT"; +const char* kAttemptsToOpenPolicyDBKey = "AttemptsToOpenPolicyDB"; +const char* kOpenAttemptTimeoutMsKey = "OpenAttemptTimeoutMs"; //const char* kPoliciesTableKey = "PoliciesTable"; const char* kServerAddressKey = "ServerAddress"; const char* kAppInfoStorageKey = "AppInfoStorage"; @@ -110,6 +113,7 @@ const char* kDeleteFileRequestKey = "DeleteFileRequest"; const char* kListFilesRequestKey = "ListFilesRequest"; const char* kDefaultTimeoutKey = "DefaultTimeout"; const char* kAppResumingTimeoutKey = "ApplicationResumingTimeout"; +const char* kAppSavePersistentDataTimeoutKey = "AppSavePersistentDataTimeout"; const char* kAppDirectoryQuotaKey = "AppDirectoryQuota"; const char* kAppTimeScaleMaxRequestsKey = "AppTimeScaleMaxRequests"; const char* kAppRequestsTimeScaleKey = "AppRequestsTimeScale"; @@ -139,6 +143,9 @@ const char* kIAP2HubConnectAttemptskey = "IAP2HubConnectAttempts"; const char* kIAPHubConnectionWaitTimeoutKey = "ConnectionWaitTimeout"; const char* kDefaultHubProtocolIndexKey = "DefaultHubProtocolIndex"; const char* kTTSGlobalPropertiesTimeoutKey = "TTSGlobalPropertiesTimeout"; +const char* kMaximumPayloadSizeKey ="MaximumPayloadSize"; +const char* kFrequencyCount ="FrequencyCount"; +const char* kFrequencyTime ="FrequencyTime"; const char* kDefaultPoliciesSnapshotFileName = "sdl_snapshot.json"; const char* kDefaultHmiCapabilitiesFileName = "hmi_capabilities.json"; @@ -171,13 +178,14 @@ const uint32_t kDefaultPutFileRequestInNone = 5; const uint32_t kDefaultDeleteFileRequestInNone = 5; const uint32_t kDefaultListFilesRequestInNone = 5; const uint32_t kDefaultTimeout = 10; -const uint32_t kDefaultAppResumingTimeout = 5; +const uint32_t kDefaultAppResumingTimeout = 3; +const uint32_t kDefaultAppSavePersistentDataTimeout = 10; const uint32_t kDefaultDirQuota = 104857600; -const uint32_t kDefaultAppTimeScaleMaxRequests = 100; -const uint32_t kDefaultAppRequestsTimeScale = 10; +const uint32_t kDefaultAppTimeScaleMaxRequests = 0; +const uint32_t kDefaultAppRequestsTimeScale = 0; const uint32_t kDefaultAppHmiLevelNoneTimeScaleMaxRequests = 100; const uint32_t kDefaultAppHmiLevelNoneRequestsTimeScale = 10; -const uint32_t kDefaultPendingRequestsAmount = 1000; +const uint32_t kDefaultPendingRequestsAmount = 0; const uint32_t kDefaultTransportManagerDisconnectTimeout = 0; const uint32_t kDefaultApplicationListUpdateTimeout = 1; const std::pair<uint32_t, uint32_t> kReadDIDFrequency = {5 , 1}; @@ -187,6 +195,12 @@ const uint32_t kDefaultMaxThreadPoolSize = 2; const int kDefaultIAP2HubConnectAttempts = 0; const int kDefaultIAPHubConnectionWaitTimeout = 10; const uint16_t kDefaultTTSGlobalPropertiesTimeout = 20; +// TCP MTU - header size = 1500 - 12 +const size_t kDefaultMaximumPayloadSize = 1500 - 12; +const size_t kDefaultFrequencyCount = 1000; +const size_t kDefaultFrequencyTime = 1000; +const uint16_t kDefaultAttemptsToOpenPolicyDB = 5; +const uint16_t kDefaultOpenAttemptTimeoutMsKey = 500; } // namespace @@ -249,14 +263,16 @@ Profile::Profile() iap2_system_config_(kDefaultIAP2SystemConfig), iap2_hub_connect_attempts_(kDefaultIAP2HubConnectAttempts), iap_hub_connection_wait_timeout_(kDefaultIAPHubConnectionWaitTimeout), - tts_global_properties_timeout_(kDefaultTTSGlobalPropertiesTimeout) { + tts_global_properties_timeout_(kDefaultTTSGlobalPropertiesTimeout), + attempts_to_open_policy_db_(kDefaultAttemptsToOpenPolicyDB), + open_attempt_timeout_ms_(kDefaultAttemptsToOpenPolicyDB) { } Profile::~Profile() { } void Profile::config_file_name(const std::string& fileName) { - if (false == fileName.empty()) { + if (false == fileName.empty()) { config_file_name_ = fileName; UpdateValues(); } @@ -314,6 +330,10 @@ const uint32_t& Profile::app_resuming_timeout() const { return app_resuming_timeout_; } +const uint32_t& Profile::app_resumption_save_persistent_data_timeout() const { + return app_resumption_save_persistent_data_timeout_; +} + const std::string& Profile::vr_help_title() const { return vr_help_title_; } @@ -493,7 +513,7 @@ uint32_t Profile::thread_pool_size() const { } uint32_t Profile::default_hub_protocol_index() const{ - return default_hub_protocol_index_; + return default_hub_protocol_index_; } const std::string& Profile::iap_legacy_protocol_mask() const { @@ -524,12 +544,41 @@ int Profile::iap_hub_connection_wait_timeout() const { return iap_hub_connection_wait_timeout_; } +size_t Profile::maximum_payload_size() const { + size_t maximum_payload_size = 0; + ReadUIntValue(&maximum_payload_size, kDefaultMaximumPayloadSize, + kProtocolHandlerSection, kMaximumPayloadSizeKey); + return maximum_payload_size; +} + +size_t Profile::message_frequency_count() const { + size_t message_frequency_count = 0; + ReadUIntValue(&message_frequency_count, kDefaultFrequencyCount, + kProtocolHandlerSection, kFrequencyCount); + return message_frequency_count; +} + +size_t Profile::message_frequency_time() const { + size_t message_frequency_time = 0; + ReadUIntValue(&message_frequency_time, kDefaultFrequencyTime, + kProtocolHandlerSection,kFrequencyTime ); + return message_frequency_time; +} + +uint16_t Profile::attempts_to_open_policy_db() const { + return attempts_to_open_policy_db_; +} + +uint16_t Profile::open_attempt_timeout_ms() const { + return open_attempt_timeout_ms_; +} + uint16_t Profile::tts_global_properties_timeout() const { return tts_global_properties_timeout_; } void Profile::UpdateValues() { - LOG4CXX_INFO(logger_, "Profile::UpdateValues"); + LOG4CXX_AUTO_TRACE(logger_); // Launch HMI parameter std::string launch_value; @@ -769,6 +818,15 @@ ReadStringValue(&app_info_storage_, kDefaultAppInfoFileName, if (app_resuming_timeout_ <= 0) { app_resuming_timeout_ = kDefaultAppResumingTimeout; } + // Save resumption info to File System + LOG_UPDATED_VALUE(app_resuming_timeout_, kAppSavePersistentDataTimeoutKey, + kMainSection); + ReadUIntValue(&app_resumption_save_persistent_data_timeout_, + kDefaultAppSavePersistentDataTimeout, + kMainSection, kAppSavePersistentDataTimeoutKey); + if (app_resuming_timeout_ <= 0) { + app_resuming_timeout_ = kDefaultAppSavePersistentDataTimeout; + } LOG_UPDATED_VALUE(app_resuming_timeout_, kAppResumingTimeoutKey, kMainSection); @@ -1033,6 +1091,24 @@ LOG_UPDATED_VALUE(event_mq_name_, kEventMQKey, kTransportManagerSection); LOG_UPDATED_VALUE(policy_snapshot_file_name_, kPathToSnapshotKey, kPolicySection); + // Attempts number for opening policy DB + ReadUIntValue(&attempts_to_open_policy_db_, + kDefaultAttemptsToOpenPolicyDB, + kPolicySection, + kAttemptsToOpenPolicyDBKey); + + LOG_UPDATED_VALUE(attempts_to_open_policy_db_, + kAttemptsToOpenPolicyDBKey, kPolicySection); + + // Open attempt timeout in ms + ReadUIntValue(&open_attempt_timeout_ms_, + kDefaultOpenAttemptTimeoutMsKey, + kPolicySection, + kOpenAttemptTimeoutMsKey); + + LOG_UPDATED_VALUE(open_attempt_timeout_ms_, + kOpenAttemptTimeoutMsKey, kPolicySection); + // Turn Policy Off? std::string enable_policy_string; if (ReadValue(&enable_policy_string, kPolicySection, kEnablePolicy) && |