diff options
author | Herasym Oleh <oolleehh@gmail.com> | 2016-01-12 11:36:46 +0200 |
---|---|---|
committer | Herasym Oleh <oolleehh@gmail.com> | 2016-01-12 11:36:46 +0200 |
commit | 18a37d91a8271e179910fc301bfcec6adc0b1c67 (patch) | |
tree | 99618bfcc65fc9dbf772478cb86c7c2a3d5cfa08 | |
parent | c9a0018fac8d3e52272afa04ec2e6db41e061c64 (diff) | |
download | sdl_core-18a37d91a8271e179910fc301bfcec6adc0b1c67.tar.gz |
Add ListFilesResponseSize in profile.
Add log debug level in if statement.
Releted:
APPLINK-14369
3 files changed, 32 insertions, 7 deletions
diff --git a/src/components/application_manager/src/commands/mobile/list_files_request.cc b/src/components/application_manager/src/commands/mobile/list_files_request.cc index 92f91e8889..49cb936d3a 100644 --- a/src/components/application_manager/src/commands/mobile/list_files_request.cc +++ b/src/components/application_manager/src/commands/mobile/list_files_request.cc @@ -31,6 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. */ +#include <string> #include "application_manager/commands/mobile/list_files_request.h" #include "application_manager/application_manager_impl.h" #include "application_manager/application_impl.h" @@ -76,16 +77,20 @@ void ListFilesRequest::Run() { (*message_)[strings::msg_params][strings::space_available] = static_cast<int32_t>(ApplicationManagerImpl::instance()-> GetAvailableSpaceForApp(application->folder_name())); - int32_t i = 0; + uint32_t i = 0; const AppFilesMap& app_files = application->getAppFiles(); for (AppFilesMap::const_iterator it = app_files.begin(); it != app_files.end(); ++it) { - //In AppFile to application stored full path to file. In message required - //to write only name file. - //Plus one required for move to next letter after '/'. - if (i < 1000) - (*message_)[strings::msg_params][strings::filenames][i++] = - it->first.substr(it->first.find_last_of('/') + 1); + std::string filename = it->first.substr(it->first.find_last_of('/') + 1); + // In AppFile to application stored full path to file. In message required + // to write only name file. + // Plus one required for move to next letter after '/'. + if (i < ::profile::Profile::instance()->list_files_response_size()) { + LOG4CXX_DEBUG(logger_, "File " + filename + " added to ListFiles response"); + (*message_)[strings::msg_params][strings::filenames][i++] = filename; + } else { + LOG4CXX_DEBUG(logger_, "File " + filename + " not added to ListFiles response"); + } } (*message_)[strings::params][strings::message_type] = application_manager::MessageType::kResponse; diff --git a/src/components/config_profile/include/config_profile/profile.h b/src/components/config_profile/include/config_profile/profile.h index 7c8f3c3958..28d2b4fa5e 100644 --- a/src/components/config_profile/include/config_profile/profile.h +++ b/src/components/config_profile/include/config_profile/profile.h @@ -300,6 +300,11 @@ class Profile : public utils::Singleton<Profile> { */ const uint32_t& list_files_in_none() const; + /** + * @brief Return List Files request array size + */ + const uint32_t& list_files_response_size() const; + /* * @brief Returns file name for storing applications data */ @@ -729,6 +734,7 @@ private: uint32_t put_file_in_none_; uint32_t delete_file_in_none_; uint32_t list_files_in_none_; + uint32_t list_files_response_size_; std::string app_info_storage_; uint32_t heart_beat_timeout_; std::string preloaded_pt_file_; diff --git a/src/components/config_profile/src/profile.cc b/src/components/config_profile/src/profile.cc index e75752e135..e214ad2726 100644 --- a/src/components/config_profile/src/profile.cc +++ b/src/components/config_profile/src/profile.cc @@ -157,6 +157,7 @@ const char* kMaxCmdIdKey = "MaxCmdID"; const char* kPutFileRequestKey = "PutFileRequest"; const char* kDeleteFileRequestKey = "DeleteFileRequest"; const char* kListFilesRequestKey = "ListFilesRequest"; +const char* kListFilesResponseSizeKey = "ListFilesResponseSize"; const char* kDefaultTimeoutKey = "DefaultTimeout"; const char* kAppResumingTimeoutKey = "ApplicationResumingTimeout"; const char* kAppSavePersistentDataTimeoutKey = "AppSavePersistentDataTimeout"; @@ -250,6 +251,7 @@ const uint32_t kDefaultAppSavePersistentDataTimeout = 10000; const uint32_t kDefaultResumptionDelayBeforeIgn = 30; const uint32_t kDefaultResumptionDelayAfterIgn = 30; const uint32_t kDefaultHashStringSize = 32; +const uint32_t kDefaultListFilesResponseSize = 1000; const uint32_t kDefaultDirQuota = 104857600; const uint32_t kDefaultAppTimeScaleMaxRequests = 0; @@ -326,6 +328,7 @@ Profile::Profile() put_file_in_none_(kDefaultPutFileRequestInNone), delete_file_in_none_(kDefaultDeleteFileRequestInNone), list_files_in_none_(kDefaultListFilesRequestInNone), + list_files_response_size_(kDefaultListFilesResponseSize), app_info_storage_(kDefaultAppInfoFileName), heart_beat_timeout_(kDefaultHeartBeatTimeout), policy_snapshot_file_name_(kDefaultPoliciesSnapshotFileName), @@ -558,6 +561,10 @@ const uint32_t& Profile::list_files_in_none() const { return list_files_in_none_; } +const uint32_t& Profile::list_files_response_size() const { + return list_files_response_size_; +} + const std::string& Profile::app_info_storage() const { return app_info_storage_; } @@ -1110,6 +1117,13 @@ void Profile::UpdateValues() { LOG_UPDATED_VALUE(list_files_in_none_, kListFilesRequestKey, kFilesystemRestrictionsSection); + // ListFiles request size + ReadUIntValue(&list_files_response_size_, kDefaultListFilesResponseSize, + kFilesystemRestrictionsSection, kListFilesResponseSizeKey); + + LOG_UPDATED_VALUE(list_files_response_size_, kListFilesResponseSizeKey, + kFilesystemRestrictionsSection); + // Default timeout ReadUIntValue(&default_timeout_, kDefaultTimeout, kMainSection, kDefaultTimeoutKey); |