summaryrefslogtreecommitdiff
path: root/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc')
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc49
1 files changed, 32 insertions, 17 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 860e18a105..580937bc8a 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
@@ -93,35 +93,50 @@ void RCOnRemoteControlSettingsNotification::Run() {
return;
}
- hmi_apis::Common_RCAccessMode::eType access_mode =
- hmi_apis::Common_RCAccessMode::INVALID_ENUM;
- if ((*message_)[app_mngr::strings::msg_params].keyExists(
+ ProcessAccessModeParam();
+ ProcessAllowedParam();
+}
+
+void RCOnRemoteControlSettingsNotification::ProcessAccessModeParam() {
+ 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));
+ "No access mode received. Using last known: "
+ << AccessModeToString(resource_allocation_manager_.GetAccessMode()));
+ return;
}
+
+ const auto 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));
resource_allocation_manager_.SetAccessMode(access_mode);
+}
+
+void RCOnRemoteControlSettingsNotification::ProcessAllowedParam() {
+ if (!(*message_)[app_mngr::strings::msg_params].keyExists(
+ message_params::kAllowed)) {
+ SDL_LOG_DEBUG("No allowed param received. Using last known: "
+ << std::boolalpha
+ << resource_allocation_manager_.is_rc_enabled());
+ return;
+ }
const bool is_allowed =
(*message_)[app_mngr::strings::msg_params][message_params::kAllowed]
.asBool();
+
if (is_allowed) {
SDL_LOG_DEBUG("Allowing RC Functionality");
resource_allocation_manager_.set_rc_enabled(true);
- } else {
- SDL_LOG_DEBUG("Disallowing RC Functionality");
- DisallowRCFunctionality();
- resource_allocation_manager_.ResetAllAllocations();
- resource_allocation_manager_.set_rc_enabled(false);
- rc_consent_manager_.RemoveAllConsents();
+ return;
}
+
+ SDL_LOG_DEBUG("Disallowing RC Functionality");
+ DisallowRCFunctionality();
+ resource_allocation_manager_.ResetAllAllocations();
+ resource_allocation_manager_.set_rc_enabled(false);
+ rc_consent_manager_.RemoveAllConsents();
}
} // namespace commands