summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc37
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc5
2 files changed, 21 insertions, 21 deletions
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc
index 217258b086..860e18a105 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc
@@ -87,35 +87,34 @@ void RCOnRemoteControlSettingsNotification::DisallowRCFunctionality() {
void RCOnRemoteControlSettingsNotification::Run() {
SDL_LOG_AUTO_TRACE();
- if (!(*message_)[app_mngr::strings::msg_params].keyExists(
- message_params::kAllowed)) {
- SDL_LOG_DEBUG("Notification is ignored due to \"allow\" parameter absense");
+ if ((*message_)[app_mngr::strings::msg_params].empty()) {
+ SDL_LOG_DEBUG("Notification is ignored due to absence of any parameters");
SDL_LOG_DEBUG("RC Functionality remains unchanged");
return;
}
+ hmi_apis::Common_RCAccessMode::eType access_mode =
+ hmi_apis::Common_RCAccessMode::INVALID_ENUM;
+ if ((*message_)[app_mngr::strings::msg_params].keyExists(
+ message_params::kAccessMode)) {
+ access_mode = static_cast<hmi_apis::Common_RCAccessMode::eType>(
+ (*message_)[app_mngr::strings::msg_params][message_params::kAccessMode]
+ .asUInt());
+ SDL_LOG_DEBUG(
+ "Setting up access mode : " << AccessModeToString(access_mode));
+ } else {
+ access_mode = resource_allocation_manager_.GetAccessMode();
+ SDL_LOG_DEBUG("No access mode received. Using last known: "
+ << AccessModeToString(access_mode));
+ }
+ resource_allocation_manager_.SetAccessMode(access_mode);
+
const bool is_allowed =
(*message_)[app_mngr::strings::msg_params][message_params::kAllowed]
.asBool();
if (is_allowed) {
- hmi_apis::Common_RCAccessMode::eType access_mode =
- hmi_apis::Common_RCAccessMode::INVALID_ENUM;
SDL_LOG_DEBUG("Allowing RC Functionality");
resource_allocation_manager_.set_rc_enabled(true);
- if ((*message_)[app_mngr::strings::msg_params].keyExists(
- message_params::kAccessMode)) {
- access_mode = static_cast<hmi_apis::Common_RCAccessMode::eType>(
- (*message_)[app_mngr::strings::msg_params]
- [message_params::kAccessMode]
- .asUInt());
- SDL_LOG_DEBUG(
- "Setting up access mode : " << AccessModeToString(access_mode));
- } else {
- access_mode = resource_allocation_manager_.GetAccessMode();
- SDL_LOG_DEBUG("No access mode received. Using last known: "
- << AccessModeToString(access_mode));
- }
- resource_allocation_manager_.SetAccessMode(access_mode);
} else {
SDL_LOG_DEBUG("Disallowing RC Functionality");
DisallowRCFunctionality();
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc
index 62b726ac60..7907013fa3 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc
@@ -145,9 +145,10 @@ TEST_F(RCOnRemoteControlSettingsNotificationTest,
MessageSharedPtr mobile_message = CreateBasicMessage();
(*mobile_message)[application_manager::strings::msg_params]
[message_params::kAllowed] = false;
-
- EXPECT_CALL(mock_allocation_manager_, ResetAllAllocations());
+ ON_CALL(mock_allocation_manager_, GetAccessMode())
+ .WillByDefault(Return(hmi_apis::Common_RCAccessMode::ASK_DRIVER));
EXPECT_CALL(mock_interior_data_manager_, OnDisablingRC());
+ EXPECT_CALL(mock_allocation_manager_, ResetAllAllocations());
EXPECT_CALL(mock_rc_consent_manger_, RemoveAllConsents());
// Act