summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAGaliuzov <AGaliuzov@luxoft.com>2015-08-28 16:11:42 +0300
committerAGaliuzov <AGaliuzov@luxoft.com>2015-08-28 16:11:42 +0300
commitfeb79e262c6355a6a7d5b44e301a18bedf2d4160 (patch)
treeea9be6d80873583a09dfd3e87c9dde1c1032567b
parent1c1adb1c8a0087dcd682e7447077cd2be1893451 (diff)
parent9994e7431284ce9a21f088b40cb7531023e1164d (diff)
downloadsdl_core-feb79e262c6355a6a7d5b44e301a18bedf2d4160.tar.gz
Merge pull request #202 from LuxoftSDL/hotfix/Fixed_OnHashChanged_sending
Fixes sending of OnHashChange notification
-rw-r--r--src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc4
-rw-r--r--src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc7
-rw-r--r--src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_request.cc9
-rw-r--r--src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc70
-rw-r--r--src/components/application_manager/src/commands/mobile/set_global_properties_request.cc15
-rw-r--r--src/components/application_manager/src/commands/mobile/subscribe_button_request.cc8
-rw-r--r--src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc17
-rw-r--r--src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc7
8 files changed, 90 insertions, 47 deletions
diff --git a/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc b/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc
index 7e0e6aeca4..f01645079c 100644
--- a/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc
+++ b/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc
@@ -120,7 +120,9 @@ void AddSubMenuRequest::on_event(const event_engine::Event& event) {
(*message_)[strings::msg_params]);
}
SendResponse(result, result_code, NULL, &(message[strings::msg_params]));
- application->UpdateHash();
+ if (result) {
+ application->UpdateHash();
+ }
break;
}
default: {
diff --git a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc b/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc
index 9908756cfc..813f550919 100644
--- a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc
+++ b/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc
@@ -423,6 +423,7 @@ void CreateInteractionChoiceSetRequest::DeleteChoices() {
ApplicationSharedPtr application =
ApplicationManagerImpl::instance()->application(connection_key());
if (!application) {
+ LOG4CXX_ERROR(logger_, "NULL pointer");
return;
}
application->RemoveChoiceSet(choice_set_id_);
@@ -454,9 +455,11 @@ void CreateInteractionChoiceSetRequest::OnAllHMIResponsesReceived() {
ApplicationSharedPtr application =
ApplicationManagerImpl::instance()->application(connection_key());
- if (application) {
- application->UpdateHash();
+ if (!application) {
+ LOG4CXX_ERROR(logger_, "NULL pointer");
+ return;
}
+ application->UpdateHash();
} else {
DeleteChoices();
}
diff --git a/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_request.cc b/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_request.cc
index 35c8b96d2d..18c6b3b084 100644
--- a/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_request.cc
+++ b/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_request.cc
@@ -86,9 +86,12 @@ void DeleteInteractionChoiceSetRequest::Run() {
app->RemoveChoiceSet(choise_set_id);
- SendResponse(true, mobile_apis::Result::SUCCESS);
- /*CreateHMIRequest(hmi_apis::FunctionID::UI_DeleteInteractionChoiceSet,
- msg_params, true);*/
+ // Checking of HMI responses will be implemented with APPLINK-14600
+ const bool result = true;
+ SendResponse(result, mobile_apis::Result::SUCCESS);
+ if (result) {
+ app->UpdateHash();
+ }
}
bool DeleteInteractionChoiceSetRequest::ChoiceSetInUse(ApplicationConstSharedPtr app) {
diff --git a/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc b/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc
index f6dc53f592..7472324ed9 100644
--- a/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc
+++ b/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc
@@ -240,34 +240,34 @@ void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) {
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
- case hmi_apis::FunctionID::UI_SetGlobalProperties: {
- LOG4CXX_INFO(logger_, "Received UI_SetGlobalProperties event");
- is_ui_received_ = true;
- ui_result_ = static_cast<hmi_apis::Common_Result::eType>(
- message[strings::params][hmi_response::code].asInt());
- break;
- }
- case hmi_apis::FunctionID::TTS_SetGlobalProperties: {
- LOG4CXX_INFO(logger_, "Received TTS_SetGlobalProperties event");
- is_tts_received_ = true;
- tts_result_ = static_cast<hmi_apis::Common_Result::eType>(
- message[strings::params][hmi_response::code].asInt());
- break;
- }
- default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
- return;
- }
+ case hmi_apis::FunctionID::UI_SetGlobalProperties: {
+ LOG4CXX_INFO(logger_, "Received UI_SetGlobalProperties event");
+ is_ui_received_ = true;
+ ui_result_ = static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
+ break;
+ }
+ case hmi_apis::FunctionID::TTS_SetGlobalProperties: {
+ LOG4CXX_INFO(logger_, "Received TTS_SetGlobalProperties event");
+ is_tts_received_ = true;
+ tts_result_ = static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
+ break;
+ }
+ default: {
+ LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ return;
+ }
}
if (!IsPendingResponseExist()) {
bool result = ((hmi_apis::Common_Result::SUCCESS == ui_result_)
- && (hmi_apis::Common_Result::SUCCESS == tts_result_ ||
- hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == tts_result_))
- || ((hmi_apis::Common_Result::SUCCESS == ui_result_)
- && (hmi_apis::Common_Result::INVALID_ENUM == tts_result_))
- || ((hmi_apis::Common_Result::INVALID_ENUM == ui_result_)
- && (hmi_apis::Common_Result::SUCCESS == tts_result_));
+ && (hmi_apis::Common_Result::SUCCESS == tts_result_ ||
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == tts_result_))
+ || ((hmi_apis::Common_Result::SUCCESS == ui_result_)
+ && (hmi_apis::Common_Result::INVALID_ENUM == tts_result_))
+ || ((hmi_apis::Common_Result::INVALID_ENUM == ui_result_)
+ && (hmi_apis::Common_Result::SUCCESS == tts_result_));
mobile_apis::Result::eType result_code;
const char* return_info = NULL;
@@ -278,25 +278,33 @@ void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) {
return_info = std::string("Unsupported phoneme type sent in a prompt").c_str();
} else {
result_code = static_cast<mobile_apis::Result::eType>(
- std::max(ui_result_, tts_result_));
+ std::max(ui_result_, tts_result_));
}
} else {
result_code = static_cast<mobile_apis::Result::eType>(
- std::max(ui_result_, tts_result_));
+ std::max(ui_result_, tts_result_));
}
+ SendResponse(result, static_cast<mobile_apis::Result::eType>(result_code),
+ return_info, &(message[strings::msg_params]));
+
ApplicationSharedPtr application =
ApplicationManagerImpl::instance()->application(connection_key());
- if (application) {
- SendResponse(result, static_cast<mobile_apis::Result::eType>(result_code),
- return_info, &(message[strings::msg_params]));
+
+ if (!application) {
+ LOG4CXX_DEBUG(logger_, "NULL pointer");
+ return;
+ }
+
+ if (result) {
application->UpdateHash();
- } else {
- LOG4CXX_WARN(logger_, "unable to find application: " << connection_key());
}
+ } else {
+ LOG4CXX_WARN(logger_, "unable to find application: " << connection_key());
}
}
+
bool ResetGlobalPropertiesRequest::IsPendingResponseExist() {
return is_ui_send_ != is_ui_received_ || is_tts_send_ != is_tts_received_;
}
diff --git a/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc b/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc
index ff46e041ff..784fa1cbf6 100644
--- a/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc
+++ b/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc
@@ -359,11 +359,20 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) {
std::max(ui_result_, tts_result_));
}
+
+ SendResponse(result, result_code, return_info,
+ &(message[strings::msg_params]));
+
ApplicationSharedPtr application =
ApplicationManagerImpl::instance()->application(connection_key());
- SendResponse(result, static_cast<mobile_apis::Result::eType>(result_code),
- return_info, &(message[strings::msg_params]));
- application->UpdateHash();
+ if (!application) {
+ LOG4CXX_DEBUG(logger_, "NULL pointer.");
+ return;
+ }
+
+ if (result) {
+ application->UpdateHash();
+ }
}
}
diff --git a/src/components/application_manager/src/commands/mobile/subscribe_button_request.cc b/src/components/application_manager/src/commands/mobile/subscribe_button_request.cc
index ece7c8332e..22bc57620a 100644
--- a/src/components/application_manager/src/commands/mobile/subscribe_button_request.cc
+++ b/src/components/application_manager/src/commands/mobile/subscribe_button_request.cc
@@ -85,9 +85,13 @@ void SubscribeButtonRequest::Run() {
app->SubscribeToButton(static_cast<mobile_apis::ButtonName::eType>(btn_id));
SendSubscribeButtonNotification();
- SendResponse(true, mobile_apis::Result::SUCCESS);
- app->UpdateHash();
+ const bool is_succedeed = true;
+ SendResponse(is_succedeed, mobile_apis::Result::SUCCESS);
+
+ if (is_succedeed) {
+ app->UpdateHash();
+ }
}
bool SubscribeButtonRequest::IsSubscriptionAllowed(
diff --git a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc
index 1640f0b497..f00527037e 100644
--- a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc
+++ b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc
@@ -179,6 +179,11 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
CommandRequestImpl::connection_key());
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "NULL pointer.");
+ return;
+ }
+
#ifdef HMI_DBUS_API
for (HmiRequests::iterator it = hmi_requests_.begin();
it != hmi_requests_.end(); ++it) {
@@ -224,9 +229,12 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
response_params[it->str] = it->value;
}
}
- LOG4CXX_INFO(logger_, "All HMI requests are complete");
+ LOG4CXX_DEBUG(logger_, "All HMI requests are complete");
+ const bool result = any_arg_success;
SendResponse(any_arg_success, status, NULL, &response_params);
- app->UpdateHash();
+ if (result) {
+ app->UpdateHash();
+ }
}
#else
hmi_apis::Common_Result::eType hmi_result =
@@ -255,7 +263,10 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
result_code,
return_info,
&(message[strings::msg_params]));
- app->UpdateHash();
+
+ if (result) {
+ app->UpdateHash();
+ }
#endif // #ifdef HMI_DBUS_API
}
diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc
index af1faa9e6c..a2958342ea 100644
--- a/src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc
+++ b/src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc
@@ -73,8 +73,11 @@ void UnsubscribeButtonRequest::Run() {
app->UnsubscribeFromButton(static_cast<mobile_apis::ButtonName::eType>(btn_id));
SendUnsubscribeButtonNotification();
- SendResponse(true, mobile_apis::Result::SUCCESS);
- app->UpdateHash();
+ const bool is_succedeed = true;
+ SendResponse(is_succedeed, mobile_apis::Result::SUCCESS);
+ if (is_succedeed) {
+ app->UpdateHash();
+ }
}
void UnsubscribeButtonRequest::SendUnsubscribeButtonNotification() {