diff options
9 files changed, 134 insertions, 114 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_request.h index fc131020a8..0c62b248b4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_request.h @@ -5,24 +5,27 @@ namespace sdl_rpc_plugin { namespace app_mngr = application_manager; - -namespace commands{ -class SetCloudAppPropertiesRequest : public app_mngr::commands::CommandRequestImpl{ -public: - SetCloudAppPropertiesRequest(const app_mngr::commands::MessageSharedPtr& message, - app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handler); - virtual ~SetCloudAppPropertiesRequest(); - virtual void Run(); - virtual void on_event(const app_mngr::event_engine::Event& event); +namespace commands { + +class SetCloudAppPropertiesRequest + : public app_mngr::commands::CommandRequestImpl { + public: + SetCloudAppPropertiesRequest( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler); + virtual ~SetCloudAppPropertiesRequest(); + virtual void Run(); + virtual void on_event(const app_mngr::event_engine::Event& event); + private: - DISALLOW_COPY_AND_ASSIGN(SetCloudAppPropertiesRequest); -}; // SetCloudAppPropertiesRequest + DISALLOW_COPY_AND_ASSIGN(SetCloudAppPropertiesRequest); +}; // SetCloudAppPropertiesRequest -} // namespace commands -} // namespace sdl_rpc_plugin +} // namespace commands +} // namespace sdl_rpc_plugin -#endif //SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUDAPP_PROPERTIES_REQUEST_H_
\ No newline at end of file +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUDAPP_PROPERTIES_REQUEST_H_
\ No newline at end of file diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_response.h index aae45c52ce..9037cb3b73 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_response.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_response.h @@ -8,21 +8,24 @@ namespace app_mngr = application_manager; namespace commands { -class SetCloudAppPropertiesResponse : public app_mngr::commands::CommandResponseImpl{ -public: - SetCloudAppPropertiesResponse(const app_mngr::commands::MessageSharedPtr& message, - app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handler); - virtual ~SetCloudAppPropertiesResponse(); - virtual void Run(); +class SetCloudAppPropertiesResponse + : public app_mngr::commands::CommandResponseImpl { + public: + SetCloudAppPropertiesResponse( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler); + virtual ~SetCloudAppPropertiesResponse(); + virtual void Run(); + private: DISALLOW_COPY_AND_ASSIGN(SetCloudAppPropertiesResponse); - -}; //SetCloudAppPropertiesResponse -} // namespace commands -} // namespace sdl_rpc_plugin +}; // SetCloudAppPropertiesResponse + +} // namespace commands +} // namespace sdl_rpc_plugin -#endif //SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUDAPP_PROPERTIES_RESPONSE_H_
\ No newline at end of file +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUDAPP_PROPERTIES_RESPONSE_H_
\ No newline at end of file diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_request.cc index b5c66e4400..49cb7029c7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_request.cc @@ -5,67 +5,77 @@ using namespace application_manager; namespace commands { - SetCloudAppPropertiesRequest::SetCloudAppPropertiesRequest(const app_mngr::commands::MessageSharedPtr& message, - app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler){} +SetCloudAppPropertiesRequest::SetCloudAppPropertiesRequest( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : CommandRequestImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} - SetCloudAppPropertiesRequest::~SetCloudAppPropertiesRequest(){} - void SetCloudAppPropertiesRequest::Run(){ - LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = application_manager_.application(connection_key()); +SetCloudAppPropertiesRequest::~SetCloudAppPropertiesRequest() {} +void SetCloudAppPropertiesRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + ApplicationSharedPtr app = application_manager_.application(connection_key()); - if (!app) { - LOG4CXX_ERROR(logger_, "Application is not registered"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } + if (!app) { + LOG4CXX_ERROR(logger_, "Application is not registered"); + SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); + return; + } - if ((*message_)[strings::msg_params].empty()) { - LOG4CXX_ERROR(logger_, strings::msg_params << " is empty."); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } + if ((*message_)[strings::msg_params].empty()) { + LOG4CXX_ERROR(logger_, strings::msg_params << " is empty."); + SendResponse(false, mobile_apis::Result::INVALID_DATA); + return; + } - smart_objects::SmartObject cloudapp_properties(smart_objects::SmartType_Map); + smart_objects::SmartObject cloudapp_properties(smart_objects::SmartType_Map); - cloudapp_properties[strings::msg_params][strings::app_name] = (*message_)[strings::msg_params][strings::app_name]; - cloudapp_properties[strings::msg_params][strings::app_id] = (*message_)[strings::msg_params][strings::app_id]; - - if ((*message_)[strings::msg_params].keyExists(strings::enabled)) { - smart_objects::SmartObject enabled = (*message_)[strings::msg_params][strings::enabled]; - cloudapp_properties[strings::msg_params][strings::enabled] = enabled; - } - if ((*message_)[strings::msg_params].keyExists(strings::cloud_app_auth_token)) { - smart_objects::SmartObject auth_token = (*message_)[strings::msg_params][strings::cloud_app_auth_token]; - cloudapp_properties[strings::msg_params][strings::cloud_app_auth_token] = auth_token; - } - if ((*message_)[strings::msg_params].keyExists(strings::cloud_transport_type)) { - smart_objects::SmartObject transport_type = (*message_)[strings::msg_params][strings::cloud_transport_type]; - cloudapp_properties[strings::msg_params][strings::cloud_transport_type] = transport_type; - } - if ((*message_)[strings::msg_params].keyExists(strings::hybrid_app_preference)) { - smart_objects::SmartObject hybrid_app_preference = (*message_)[strings::msg_params][strings::hybrid_app_preference]; - cloudapp_properties[strings::msg_params][strings::hybrid_app_preference] = hybrid_app_preference; - } - - policy_handler_.OnSetCloudAppProperties(cloudapp_properties); - SendResponse(true, mobile_apis::Result::SUCCESS); + cloudapp_properties[strings::msg_params][strings::app_name] = + (*message_)[strings::msg_params][strings::app_name]; + cloudapp_properties[strings::msg_params][strings::app_id] = + (*message_)[strings::msg_params][strings::app_id]; + if ((*message_)[strings::msg_params].keyExists(strings::enabled)) { + smart_objects::SmartObject enabled = + (*message_)[strings::msg_params][strings::enabled]; + cloudapp_properties[strings::msg_params][strings::enabled] = enabled; + } + if ((*message_)[strings::msg_params].keyExists( + strings::cloud_app_auth_token)) { + smart_objects::SmartObject auth_token = + (*message_)[strings::msg_params][strings::cloud_app_auth_token]; + cloudapp_properties[strings::msg_params][strings::cloud_app_auth_token] = + auth_token; + } + if ((*message_)[strings::msg_params].keyExists( + strings::cloud_transport_type)) { + smart_objects::SmartObject transport_type = + (*message_)[strings::msg_params][strings::cloud_transport_type]; + cloudapp_properties[strings::msg_params][strings::cloud_transport_type] = + transport_type; + } + if ((*message_)[strings::msg_params].keyExists( + strings::hybrid_app_preference)) { + smart_objects::SmartObject hybrid_app_preference = + (*message_)[strings::msg_params][strings::hybrid_app_preference]; + cloudapp_properties[strings::msg_params][strings::hybrid_app_preference] = + hybrid_app_preference; + } - } + policy_handler_.OnSetCloudAppProperties(cloudapp_properties); + SendResponse(true, mobile_apis::Result::SUCCESS); +} +void SetCloudAppPropertiesRequest::on_event( + const app_mngr::event_engine::Event& event) { + LOG4CXX_INFO(logger_, "SetCloudAppPropertiesRequest on_event"); +} - void SetCloudAppPropertiesRequest::on_event(const app_mngr::event_engine::Event& event){ - LOG4CXX_INFO(logger_, "SetCloudAppPropertiesRequest on_event"); - } - - -} // namespace commands -} // namespace sdl_rpc_plugin
\ No newline at end of file +} // namespace commands +} // namespace sdl_rpc_plugin
\ No newline at end of file diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_response.cc index b113f84131..6acfb2423d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_response.cc @@ -2,31 +2,30 @@ #include "application_manager/rpc_service.h" #include "sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_response.h" - namespace sdl_rpc_plugin { using namespace application_manager; namespace commands { - SetCloudAppPropertiesResponse::SetCloudAppPropertiesResponse(const app_mngr::commands::MessageSharedPtr& message, - app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handler) - : CommandResponseImpl(message, +SetCloudAppPropertiesResponse::SetCloudAppPropertiesResponse( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : CommandResponseImpl(message, application_manager, rpc_service, hmi_capabilities, - policy_handler){} + policy_handler) {} +SetCloudAppPropertiesResponse::~SetCloudAppPropertiesResponse() {} - SetCloudAppPropertiesResponse::~SetCloudAppPropertiesResponse(){} +void SetCloudAppPropertiesResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); - void SetCloudAppPropertiesResponse::Run(){ - LOG4CXX_AUTO_TRACE(logger_); - - rpc_service_.SendMessageToMobile(message_); - } + rpc_service_.SendMessageToMobile(message_); +} -} // namespace commands -} //namespace sdl_rpc_plugins +} // namespace commands +} // namespace sdl_rpc_plugins diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc index a5b3bf71fe..dc5298813b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc @@ -341,8 +341,9 @@ CommandCreator& MobileCommandFactory::get_creator_factory( } case mobile_apis::FunctionID::SetCloudAppPropertiesID: { return mobile_api::messageType::request == message_type - ? factory.GetCreator<commands::SetCloudAppPropertiesRequest>() - : factory.GetCreator<commands::SetCloudAppPropertiesResponse>(); + ? factory.GetCreator<commands::SetCloudAppPropertiesRequest>() + : factory + .GetCreator<commands::SetCloudAppPropertiesResponse>(); } case mobile_apis::FunctionID::OnButtonEventID: { return factory.GetCreator<commands::mobile::OnButtonEventNotification>(); diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc index 8e74ae99b9..8c026c8c75 100644 --- a/src/components/application_manager/src/policies/policy_handler.cc +++ b/src/components/application_manager/src/policies/policy_handler.cc @@ -1920,11 +1920,15 @@ void PolicyHandler::OnSetCloudAppProperties( } if (msg_params.keyExists(strings::hybrid_app_preference)) { std::string hybrid_app_preference; - - mobile_apis::HybridAppPreference::eType value = static_cast<mobile_apis::HybridAppPreference::eType> - (msg_params[strings::hybrid_app_preference].asUInt()); - smart_objects::EnumConversionHelper<mobile_apis::HybridAppPreference::eType>::EnumToString(value, &hybrid_app_preference); - policy_manager_->SetHybridAppPreference(policy_app_id, hybrid_app_preference); + + mobile_apis::HybridAppPreference::eType value = + static_cast<mobile_apis::HybridAppPreference::eType>( + msg_params[strings::hybrid_app_preference].asUInt()); + smart_objects::EnumConversionHelper< + mobile_apis::HybridAppPreference::eType>:: + EnumToString(value, &hybrid_app_preference); + policy_manager_->SetHybridAppPreference(policy_app_id, + hybrid_app_preference); } } diff --git a/src/components/policy/policy_external/include/policy/policy_table/enums.h b/src/components/policy/policy_external/include/policy/policy_table/enums.h index 982118a43a..5b494629bb 100644 --- a/src/components/policy/policy_external/include/policy/policy_table/enums.h +++ b/src/components/policy/policy_external/include/policy/policy_table/enums.h @@ -444,7 +444,7 @@ enum FunctionID { * @brief SetCloudAppPropertiesID. */ SetCloudAppPropertiesID = 50, - + /** * @brief OnHMIStatusID. */ diff --git a/src/components/policy/policy_external/src/policy_table/enums.cc b/src/components/policy/policy_external/src/policy_table/enums.cc index fac3cb86a1..d7d5a241de 100644 --- a/src/components/policy/policy_external/src/policy_table/enums.cc +++ b/src/components/policy/policy_external/src/policy_table/enums.cc @@ -1120,8 +1120,8 @@ bool EnumFromJsonString(const std::string& literal, FunctionID* result) { *result = SendHapticDataID; return true; } - - if("SetCloudAppProperties" == literal){ + + if ("SetCloudAppProperties" == literal) { *result = SetCloudAppPropertiesID; return true; } diff --git a/src/components/policy/policy_regular/src/policy_table/enums.cc b/src/components/policy/policy_regular/src/policy_table/enums.cc index 0bc0bee954..91d0a6990f 100644 --- a/src/components/policy/policy_regular/src/policy_table/enums.cc +++ b/src/components/policy/policy_regular/src/policy_table/enums.cc @@ -848,7 +848,7 @@ bool IsValidEnum(FunctionID val) { case SendHapticDataID: return true; case SetCloudAppPropertiesID: - return true; + return true; case OnHMIStatusID: return true; case OnAppInterfaceUnregisteredID: @@ -1287,7 +1287,7 @@ bool EnumFromJsonString(const std::string& literal, FunctionID* result) { *result = SendHapticDataID; return true; } - if("SetCloudAppProperties" == literal){ + if ("SetCloudAppProperties" == literal) { *result = SetCloudAppPropertiesID; return true; } |