summaryrefslogtreecommitdiff
path: root/src/components/application_manager
diff options
context:
space:
mode:
authorAKalinich-Luxoft <AKalinich@luxoft.com>2017-06-27 12:02:09 +0300
committerAKalinich-Luxoft <AKalinich@luxoft.com>2017-12-12 14:11:47 +0200
commit7ab0ffe3fad16f019c644ee4caecc95e295b2ef2 (patch)
treed97a2ace1cbe0dbf65fb315a58f1843b6a4c21d4 /src/components/application_manager
parent13c5685d110e2a0c6623e0217a54b4466792657f (diff)
downloadsdl_core-7ab0ffe3fad16f019c644ee4caecc95e295b2ef2.tar.gz
Renamed methods, updated briefs, removed deep nesting
Diffstat (limited to 'src/components/application_manager')
-rw-r--r--src/components/application_manager/include/application_manager/application.h11
-rw-r--r--src/components/application_manager/include/application_manager/application_impl.h13
-rw-r--r--src/components/application_manager/src/application_impl.cc12
-rw-r--r--src/components/application_manager/src/commands/hmi/basic_communication_on_awake_sdl.cc32
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_application.h4
5 files changed, 37 insertions, 35 deletions
diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h
index f4f2f9779d..a09f16080e 100644
--- a/src/components/application_manager/include/application_manager/application.h
+++ b/src/components/application_manager/include/application_manager/application.h
@@ -409,18 +409,19 @@ class Application : public virtual InitialApplicationData,
virtual void UpdateHash() = 0;
/**
- * @brief Retrieves flag_sending_hash_change_after_awake_
+ * @brief checks is hashID was changed during suspended state
* @return Returns TRUE if hashID was changed during suspended state
* otherwise returns FALSE.
*/
- virtual bool flag_sending_hash_change_after_awake() const = 0;
+ virtual bool IsHashChangedAfterAwake() const = 0;
/**
- * @brief Method is used when core receives OnAwakeSDL notification
+ * @brief notifies is hashID was changed during suspended state
+ * Method is used when core receives OnAwakeSDL notification
* in order to change value of flag_sending_hash_change_after_awake_
- * @param Contains FALSE
+ * @param state new state value
*/
- virtual void set_flag_sending_hash_change_after_awake(bool flag) = 0;
+ virtual void SetHashChangedAfterAwake(const bool state) = 0;
/**
* @brief method is called when SDL is saving application data for resumption
diff --git a/src/components/application_manager/include/application_manager/application_impl.h b/src/components/application_manager/include/application_manager/application_impl.h
index 3bca84e8bf..1c747172ec 100644
--- a/src/components/application_manager/include/application_manager/application_impl.h
+++ b/src/components/application_manager/include/application_manager/application_impl.h
@@ -200,18 +200,19 @@ class ApplicationImpl : public virtual Application,
virtual const std::string& curHash() const;
/**
- * @brief Retrieves flag_sending_hash_change_after_awake_
+ * @brief checks is hashID was changed during suspended state
* @return Returns TRUE if hashID was changed during suspended state
* otherwise returns FALSE.
*/
- bool flag_sending_hash_change_after_awake() const OVERRIDE;
+ bool IsHashChangedAfterAwake() const OVERRIDE;
/**
- * @brief Method is used when core receives OnAwakeSDL notification
+ * @brief notifies is hashID was changed during suspended state
+ * Method is used when core receives OnAwakeSDL notification
* in order to change value of flag_sending_hash_change_after_awake_
- * @param Contains FALSE
+ * @param state new state value
*/
- void set_flag_sending_hash_change_after_awake(bool flag) OVERRIDE;
+ void SetHashChangedAfterAwake(const bool state) OVERRIDE;
/**
* @brief Change Hash for current application
@@ -443,7 +444,7 @@ class ApplicationImpl : public virtual Application,
protocol_handler::MajorProtocolVersion protocol_version_;
bool is_voice_communication_application_;
sync_primitives::atomic_bool is_resuming_;
- bool flag_sending_hash_change_after_awake_;
+ bool is_hash_changed_during_suspend_;
uint32_t video_stream_retry_number_;
uint32_t audio_stream_retry_number_;
diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc
index f9cbc72d50..ed730a8c84 100644
--- a/src/components/application_manager/src/application_impl.cc
+++ b/src/components/application_manager/src/application_impl.cc
@@ -112,7 +112,7 @@ ApplicationImpl::ApplicationImpl(
protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_3)
, is_voice_communication_application_(false)
, is_resuming_(false)
- , flag_sending_hash_change_after_awake_(false)
+ , is_hash_changed_during_suspend_(false)
, video_stream_retry_number_(0)
, audio_stream_retry_number_(0)
, video_stream_suspend_timer_(
@@ -877,16 +877,16 @@ void ApplicationImpl::UpdateHash() {
if (!application_manager_.resume_controller().is_suspended()) {
MessageHelper::SendHashUpdateNotification(app_id(), application_manager_);
} else {
- flag_sending_hash_change_after_awake_ = true;
+ is_hash_changed_during_suspend_ = true;
}
}
-bool ApplicationImpl::flag_sending_hash_change_after_awake() const {
- return flag_sending_hash_change_after_awake_;
+bool ApplicationImpl::IsHashChangedAfterAwake() const {
+ return is_hash_changed_during_suspend_;
}
-void ApplicationImpl::set_flag_sending_hash_change_after_awake(bool flag) {
- flag_sending_hash_change_after_awake_ = flag;
+void ApplicationImpl::SetHashChangedAfterAwake(const bool state) {
+ is_hash_changed_during_suspend_ = state;
}
void ApplicationImpl::CleanupFiles() {
diff --git a/src/components/application_manager/src/commands/hmi/basic_communication_on_awake_sdl.cc b/src/components/application_manager/src/commands/hmi/basic_communication_on_awake_sdl.cc
index 3db61cf177..7454451cbd 100644
--- a/src/components/application_manager/src/commands/hmi/basic_communication_on_awake_sdl.cc
+++ b/src/components/application_manager/src/commands/hmi/basic_communication_on_awake_sdl.cc
@@ -47,25 +47,25 @@ OnAwakeSDLNotification::~OnAwakeSDLNotification() {}
void OnAwakeSDLNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- if (application_manager_.resume_controller().is_suspended()) {
- {
- application_manager_.resume_controller().set_is_suspended(false);
- DataAccessor<ApplicationSet> accessor =
- application_manager_.applications();
- ApplicationSetIt it = accessor.GetData().begin();
- ApplicationSetIt itEnd = accessor.GetData().end();
- for (; it != itEnd; ++it) {
- if ((*it).get()) {
- if ((*it)->flag_sending_hash_change_after_awake()) {
- MessageHelper::SendHashUpdateNotification((*it)->app_id(),
- application_manager_);
- (*it)->set_flag_sending_hash_change_after_awake(false);
- }
- }
+ if (!application_manager_.resume_controller().is_suspended()) {
+ return;
+ }
+
+ {
+ DataAccessor<ApplicationSet> accessor = application_manager_.applications();
+ ApplicationSetIt itBegin = accessor.GetData().begin();
+ ApplicationSetIt itEnd = accessor.GetData().end();
+ for (; itBegin != itEnd; ++itBegin) {
+ const ApplicationSharedPtr app = *itBegin;
+ if (app && app->IsHashChangedAfterAwake()) {
+ MessageHelper::SendHashUpdateNotification(app->app_id(),
+ application_manager_);
+ app->SetHashChangedAfterAwake(false);
}
}
- application_manager_.resume_controller().OnAwake();
}
+
+ application_manager_.resume_controller().OnAwake();
}
} // namespace commands
diff --git a/src/components/application_manager/test/include/application_manager/mock_application.h b/src/components/application_manager/test/include/application_manager/mock_application.h
index 9bdfe65cb7..8de35aad33 100644
--- a/src/components/application_manager/test/include/application_manager/mock_application.h
+++ b/src/components/application_manager/test/include/application_manager/mock_application.h
@@ -50,8 +50,8 @@ class MockApplication : public ::application_manager::Application {
MOCK_CONST_METHOD0(active_message, const smart_objects::SmartObject*());
MOCK_CONST_METHOD0(curHash, const std::string&());
MOCK_METHOD0(UpdateHash, void());
- MOCK_CONST_METHOD0(flag_sending_hash_change_after_awake, bool());
- MOCK_METHOD1(set_flag_sending_hash_change_after_awake, void(bool flag));
+ MOCK_CONST_METHOD0(IsHashChangedAfterAwake, bool());
+ MOCK_METHOD1(SetHashChangedAfterAwake, void(const bool flag));
MOCK_CONST_METHOD0(is_application_data_changed, bool());
MOCK_METHOD1(set_is_application_data_changed,
void(bool state_application_data));