diff options
Diffstat (limited to 'src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands')
344 files changed, 4121 insertions, 1154 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_request.cc index 19d01b594f..c6d181bf57 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_request.cc @@ -75,4 +75,4 @@ void ActivateAppRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_response.cc index d7e38c5d5b..b829ef711e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_response.cc @@ -63,4 +63,4 @@ void ActivateAppResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/add_statistics_info_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/add_statistics_info_notification.cc index 3e46bd353a..93999f704d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/add_statistics_info_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/add_statistics_info_notification.cc @@ -64,4 +64,4 @@ void AddStatisticsInfoNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_request.cc index b227dd79dc..68c7896a7f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_request.cc @@ -59,4 +59,4 @@ void AllowAllAppsRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_response.cc index 2fdf29a7dd..c2182f4853 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_response.cc @@ -59,4 +59,4 @@ void AllowAllAppsResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_request.cc index 0c6e5145c7..6b5af76fb1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_request.cc @@ -59,4 +59,4 @@ void AllowAppRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_response.cc index 4853c3764a..c62645c6c0 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_response.cc @@ -70,4 +70,4 @@ void AllowAppResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_request.cc new file mode 100644 index 0000000000..b021faefd8 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_request.cc @@ -0,0 +1,61 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the the copyright holders nor the names of their + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include "sdl_rpc_plugin/commands/hmi/basic_communication_close_application_request.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; +namespace commands { + +BasicCommunicationCloseApplicationRequest:: + BasicCommunicationCloseApplicationRequest( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : RequestToHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +BasicCommunicationCloseApplicationRequest:: + ~BasicCommunicationCloseApplicationRequest() {} + +void BasicCommunicationCloseApplicationRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + SendRequest(); +} + +} // namespace commands +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_response.cc new file mode 100644 index 0000000000..2e56271cf2 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_response.cc @@ -0,0 +1,65 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the the copyright holders nor the names of their + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include "sdl_rpc_plugin/commands/hmi/basic_communication_close_application_response.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; +namespace commands { + +BasicCommunicationCloseApplicationResponse:: + BasicCommunicationCloseApplicationResponse( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : ResponseFromHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +BasicCommunicationCloseApplicationResponse:: + ~BasicCommunicationCloseApplicationResponse() {} + +void BasicCommunicationCloseApplicationResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + event_engine::Event event( + hmi_apis::FunctionID::BasicCommunication_CloseApplication); + event.set_smart_object(*message_); + event.raise(application_manager_.event_dispatcher()); +} + +} // namespace commands +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc index fb87612e19..19c9fa91d8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc @@ -51,7 +51,7 @@ BasicCommunicationGetSystemTimeRequest::BasicCommunicationGetSystemTimeRequest( void BasicCommunicationGetSystemTimeRequest::onTimeOut() { LOG4CXX_AUTO_TRACE(logger_); - application_manager_.protocol_handler().NotifyOnFailedHandshake(); + application_manager_.protocol_handler().NotifyOnGetSystemTimeFailed(); } } // namespace commands diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_response.cc index c067debf36..e26753b3f2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_response.cc @@ -62,4 +62,4 @@ void BasicCommunicationGetSystemTimeResponse::Run() { } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_on_awake_sdl.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_on_awake_sdl.cc index 0c39389116..361dc5fea6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_on_awake_sdl.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_on_awake_sdl.cc @@ -79,4 +79,4 @@ void OnAwakeSDLNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_request.cc index 04e44a6979..052a40a888 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_request.cc @@ -58,4 +58,4 @@ void BasicCommunicationSystemRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_response.cc index 5f8221fdbe..0b052de88d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_response.cc @@ -63,4 +63,4 @@ void BasicCommunicationSystemResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_response.cc index b86ab6a2b8..58cda68a2b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_response.cc @@ -32,9 +32,9 @@ #include "sdl_rpc_plugin/commands/hmi/bc_get_file_path_response.h" #include "application_manager/application_impl.h" +#include "application_manager/event_engine/event.h" #include "application_manager/rpc_service.h" #include "interfaces/MOBILE_API.h" -#include "application_manager/event_engine/event.h" namespace sdl_rpc_plugin { using namespace application_manager; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc index cf2fbd9761..6696689174 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc @@ -60,4 +60,4 @@ void ButtonGetCapabilitiesRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_response.cc index 628eaa2e58..b6ab822c47 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_response.cc @@ -78,4 +78,4 @@ void ButtonGetCapabilitiesResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_request.cc index 84a47b9deb..988794f668 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_request.cc @@ -58,4 +58,4 @@ void ClosePopupRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_response.cc index 25396af337..072e1960e9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_response.cc @@ -58,4 +58,4 @@ void ClosePopupResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_request.cc index 0e09c14650..71782ef575 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_request.cc @@ -59,4 +59,4 @@ void DecryptCertificateRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_response.cc index 694298ed91..cf2a4d092c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_response.cc @@ -64,5 +64,5 @@ void DecryptCertificateResponse::Run() { } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin #endif // EXTERNAL_PROPRIETARY_MODE diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/dial_number_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/dial_number_request.cc index 63f5c2e815..97b5109642 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/dial_number_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/dial_number_request.cc @@ -61,4 +61,4 @@ void DialNumberRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/dial_number_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/dial_number_response.cc index 6d37ece2bf..4ff6785052 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/dial_number_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/dial_number_response.cc @@ -63,4 +63,4 @@ void DialNumberResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc index c06c90973d..8546252119 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc @@ -61,4 +61,4 @@ void GetSystemInfoRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_response.cc index aef428b39f..baff925a4e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_response.cc @@ -31,6 +31,7 @@ */ #include "sdl_rpc_plugin/commands/hmi/get_system_info_response.h" #include "application_manager/message_helper.h" +#include "application_manager/policies/policy_handler_interface.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -90,4 +91,4 @@ const SystemInfo GetSystemInfoResponse::GetSystemInfo( } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_urls.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_urls.cc deleted file mode 100644 index ae375e4087..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_urls.cc +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "sdl_rpc_plugin/commands/hmi/get_urls.h" -#include "application_manager/message.h" -#include "application_manager/application_manager.h" -#include "application_manager/rpc_service.h" -#include "application_manager/policies/policy_handler.h" -#include "utils/helpers.h" - -namespace sdl_rpc_plugin { -using namespace application_manager; -namespace commands { - -GetUrls::GetUrls(const application_manager::commands::MessageSharedPtr& message, - ApplicationManager& application_manager, - rpc_service::RPCService& rpc_service, - HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle) - : RequestFromHMI(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handle) {} - -GetUrls::~GetUrls() {} - -void GetUrls::Run() { - LOG4CXX_AUTO_TRACE(logger_); - namespace Common_Result = hmi_apis::Common_Result; - using policy::EndpointUrls; - - if (!policy_handler_.PolicyEnabled()) { - SendResponseToHMI(Common_Result::DATA_NOT_AVAILABLE); - return; - } - - const uint32_t service_to_check = - (*message_)[strings::msg_params][hmi_request::service].asUInt(); - - EndpointUrls endpoints; - policy_handler_.GetUpdateUrls(service_to_check, endpoints); - - if (endpoints.empty()) { - LOG4CXX_ERROR(logger_, "No URLs for service " << service_to_check); - SendResponseToHMI(Common_Result::DATA_NOT_AVAILABLE); - return; - } - -#ifdef PROPRIETARY_MODE - const uint32_t policy_service = 7u; - - if (policy_service == service_to_check) { - ProcessPolicyServiceURLs(endpoints); - return; - } -#endif // PROPRIETARY_MODE - - ProcessServiceURLs(endpoints); -} - -void GetUrls::ProcessServiceURLs(const policy::EndpointUrls& endpoints) { - namespace Common_Result = hmi_apis::Common_Result; - using smart_objects::SmartObject; - - (*message_)[strings::msg_params].erase(hmi_request::service); - SmartObject& urls = (*message_)[strings::msg_params][hmi_response::urls]; - - size_t index = 0; - for (size_t e = 0; e < endpoints.size(); ++e) { - ApplicationSharedPtr app = - application_manager_.application_by_policy_id(endpoints[e].app_id); - -#ifndef PROPRIETARY_MODE - bool registered_not_default = false; - if (policy::kDefaultId != endpoints[e].app_id) { - if (!app) { - LOG4CXX_ERROR(logger_, - "Can't find application with policy id " - << endpoints[e].app_id - << " URLs adding for this application is skipped."); - continue; - } - registered_not_default = true; - } -#endif // EXTERNAL_PROPRIETARY_MODE || HTTP - for (size_t u = 0; u < endpoints[e].url.size(); ++u, ++index) { - const std::string& app_url = endpoints[e].url[u]; - SmartObject& service_info = urls[index]; - - service_info[strings::url] = app_url; -#ifndef PROPRIETARY_MODE - if (registered_not_default) { - service_info[strings::app_id] = app->hmi_app_id(); - } -#else // EXTERNAL_PROPRIETARY_MODE || HTTP - service_info[hmi_response::policy_app_id] = endpoints[e].app_id; -#endif - } - } - SendResponseToHMI(Common_Result::SUCCESS); -} - -void GetUrls::SendResponseToHMI(hmi_apis::Common_Result::eType result) { - (*message_)[strings::params][strings::message_type] = MessageType::kResponse; - (*message_)[strings::params][hmi_response::code] = result; - rpc_service_.ManageHMICommand(message_); -} - -#ifdef PROPRIETARY_MODE -struct PolicyAppIdComparator { - PolicyAppIdComparator(const std::string& policy_app_id) - : policy_app_id_(policy_app_id) {} - - bool operator()(const policy::EndpointData& data) { - return data.app_id == policy_app_id_; - } - std::string policy_app_id_; -}; - -void FillSODefaultUrls(smart_objects::SmartObject& urls, - const policy::EndpointUrls& endpoints) { - using smart_objects::SmartObject; - PolicyAppIdComparator comparator(policy::kDefaultId); - policy::EndpointUrls::const_iterator it = - std::find_if(endpoints.begin(), endpoints.end(), comparator); - if (it == endpoints.end()) { - return; - } - SmartObject service_info = SmartObject(smart_objects::SmartType_Map); - for (size_t i = 0; i < (*it).url.size(); ++i) { - service_info[strings::url] = (*it).url[i]; - urls[i] = service_info; - } -} - -void GetUrls::ProcessPolicyServiceURLs(const policy::EndpointUrls& endpoints) { - LOG4CXX_AUTO_TRACE(logger_); - using namespace smart_objects; - using namespace application_manager; - using namespace strings; - using namespace hmi_apis; - - const uint32_t app_id_to_send_to = policy_handler_.GetAppIdForSending(); - - if (!app_id_to_send_to) { - LOG4CXX_ERROR(logger_, - "There are no available applications for processing."); - SmartObject urls(SmartType_Array); - FillSODefaultUrls(urls, endpoints); - if (!urls.empty()) { - (*message_)[msg_params][hmi_response::urls] = urls; - } - (*message_).erase(hmi_request::service); - SendResponseToHMI(Common_Result::SUCCESS); - return; - } - - ApplicationSharedPtr app = - application_manager_.application(app_id_to_send_to); - - if (app.use_count() == 0) { - LOG4CXX_WARN(logger_, - "There is no registered application with " - "connection key '" - << app_id_to_send_to << "'"); - SendResponseToHMI(Common_Result::DATA_NOT_AVAILABLE); - return; - } - - SmartObject& object = *message_; - object[msg_params].erase(hmi_request::service); - object[msg_params][hmi_response::urls] = SmartObject(SmartType_Array); - SmartObject& urls = object[msg_params][hmi_response::urls]; - const std::string mobile_app_id = app->policy_app_id(); - - size_t index = 0; - for (size_t i = 0; i < endpoints.size(); ++i) { - using namespace helpers; - - const bool to_add = Compare<std::string, EQ, ONE>( - endpoints[i].app_id, mobile_app_id, policy::kDefaultId); - const bool is_default = policy::kDefaultId == endpoints[i].app_id; - - if (to_add) { - for (size_t k = 0; k < endpoints[i].url.size(); ++k) { - if (!is_default) { - urls[index][strings::app_id] = app_id_to_send_to; - } - urls[index][strings::url] = endpoints[i].url[k]; - ++index; - } - } - } - SendResponseToHMI(Common_Result::SUCCESS); - return; -} -#endif // PROPRIETARY_MODE - -} // namespace commands -} // namespace application_manager diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_request.cc index 39f7e61c06..b8c61ca902 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_request.cc @@ -59,4 +59,4 @@ void MixingAudioSupportedRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_response.cc index 26fa967844..089e56e598 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_response.cc @@ -60,4 +60,4 @@ void MixingAudioSupportedResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_request.cc index ae3695b68e..8390fea5bc 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_request.cc @@ -59,4 +59,4 @@ void NaviAlertManeuverRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_response.cc index 6a6307038a..a1603f069d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_response.cc @@ -63,4 +63,4 @@ void NaviAlertManeuverResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc index a9698d36ab..371f47a759 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc @@ -79,8 +79,8 @@ void AudioStartStreamRequest::Run() { application_manager_.application_by_hmi_app(application_id()); if (!app) { LOG4CXX_ERROR(logger_, - "Applcation with hmi_app_id " << application_id() - << " does not exist"); + "Application with hmi_app_id " << application_id() + << " does not exist"); return; } SetAllowedToTerminate(false); @@ -189,4 +189,4 @@ void AudioStartStreamRequest::RetryStartSession() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_response.cc index 362a46cc19..61d49577f6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_response.cc @@ -60,4 +60,4 @@ void AudioStartStreamResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_request.cc index ba2b8c8157..a5d436f015 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_request.cc @@ -62,4 +62,4 @@ void AudioStopStreamRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_response.cc index 87ddc81696..98023ab571 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_response.cc @@ -56,4 +56,4 @@ void AudioStopStreamResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_request.cc index 77ef3e3369..edc4afe1e4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_request.cc @@ -59,4 +59,4 @@ void NaviGetWayPointsRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_response.cc index 0aad5e5724..0f0b652d01 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_response.cc @@ -63,4 +63,4 @@ void NaviGetWayPointsResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_request.cc index 781b8d3045..15e5b46b36 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_request.cc @@ -84,4 +84,4 @@ void NaviIsReadyRequest::on_event(const event_engine::Event& event) { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_response.cc index b4e64e2a3e..073513eda9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_response.cc @@ -58,4 +58,4 @@ void NaviIsReadyResponse::Run() { } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_request.cc index a10f61310d..360870e21c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_request.cc @@ -59,4 +59,4 @@ void NaviSendLocationRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_response.cc index f93e2e17c3..dc60f2fbf0 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_response.cc @@ -61,4 +61,4 @@ void NaviSendLocationResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc index 5e4426bd20..764315f37f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc @@ -65,9 +65,9 @@ void NaviSetVideoConfigRequest::Run() { ApplicationSharedPtr app = application_manager_.application_by_hmi_app(application_id()); if (!app) { - LOG4CXX_ERROR(logger_, - "Application with hmi_app_id " << application_id() - << "does not exist"); + LOG4CXX_ERROR( + logger_, + "Application with hmi_app_id " << application_id() << "does not exist"); return; } @@ -100,9 +100,9 @@ void NaviSetVideoConfigRequest::on_event(const event_engine::Event& event) { LOG4CXX_DEBUG(logger_, "Received SetVideoConfig success response"); result = true; } else { - LOG4CXX_DEBUG(logger_, - "Received SetVideoConfig failure response (" << event.id() - << ")"); + LOG4CXX_DEBUG( + logger_, + "Received SetVideoConfig failure response (" << event.id() << ")"); result = false; if (message[strings::msg_params].keyExists(strings::rejected_params)) { const smart_objects::SmartArray* list = @@ -153,4 +153,4 @@ void NaviSetVideoConfigRequest::onTimeOut() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_response.cc index c5f1c5307f..e4a30c9da5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_response.cc @@ -61,4 +61,4 @@ void NaviSetVideoConfigResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_request.cc index 22d604ab0d..95dd4561fc 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_request.cc @@ -59,4 +59,4 @@ void NaviShowConstantTBTRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_response.cc index d2ff26b645..f73099d29a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_response.cc @@ -63,4 +63,4 @@ void NaviShowConstantTBTResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc index f3d971acba..90f7c2d0f1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc @@ -64,8 +64,9 @@ NaviStartStreamRequest::NaviStartStreamRequest( } NaviStartStreamRequest::~NaviStartStreamRequest() { - // unsubscribe_from_all_events() in EventObserver's destructor isn't enough; - // we must unsubscribe before this NaviStartStreamRequest instance is removed + // unsubscribe_from_all_hmi_events() in EventObserver's destructor isn't + // enough; we must unsubscribe before this NaviStartStreamRequest instance is + // removed unsubscribe_from_event(hmi_apis::FunctionID::Navigation_StartStream); } @@ -79,9 +80,9 @@ void NaviStartStreamRequest::Run() { ApplicationSharedPtr app = application_manager_.application_by_hmi_app(application_id()); if (!app) { - LOG4CXX_ERROR(logger_, - "Applcation with hmi_app_id " << application_id() - << "does not exist"); + LOG4CXX_ERROR( + logger_, + "Application with hmi_app_id " << application_id() << "does not exist"); return; } SetAllowedToTerminate(false); @@ -190,4 +191,4 @@ void NaviStartStreamRequest::RetryStartSession() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_response.cc index f09a334f51..eafd81148a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_response.cc @@ -60,4 +60,4 @@ void NaviStartStreamResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_request.cc index 3e27692d62..ad09b0aee1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_request.cc @@ -62,4 +62,4 @@ void NaviStopStreamRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_response.cc index 61b8d5a1e2..ff8c0bddff 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_response.cc @@ -56,4 +56,4 @@ void NaviStopStreamResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_request.cc index a4445ebce8..ba29f552b7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_request.cc @@ -59,4 +59,4 @@ void NaviSubscribeWayPointsRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_response.cc index ae5f236f6f..ddf8f75e58 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_response.cc @@ -64,4 +64,4 @@ void NaviSubscribeWayPointsResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_request.cc index ec22c93d8f..d3c998cfdf 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_request.cc @@ -59,4 +59,4 @@ void NaviUnsubscribeWayPointsRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_response.cc index c084bd52d3..beed29e1e2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_response.cc @@ -32,8 +32,8 @@ #include "sdl_rpc_plugin/commands/hmi/navi_unsubscribe_way_points_response.h" #include "application_manager/event_engine/event.h" -#include "interfaces/MOBILE_API.h" #include "interfaces/HMI_API.h" +#include "interfaces/MOBILE_API.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -65,4 +65,4 @@ void NaviUnsubscribeWayPointsResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_request.cc index 9c507c3637..a8a258b1c0 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_request.cc @@ -59,4 +59,4 @@ void NaviUpdateTurnListRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_response.cc index eb232e6d01..a2f737df38 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_response.cc @@ -63,4 +63,4 @@ void NaviUpdateTurnListResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_allow_sdl_functionality_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_allow_sdl_functionality_notification.cc index 398c2dac30..204cc7d347 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_allow_sdl_functionality_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_allow_sdl_functionality_notification.cc @@ -66,4 +66,4 @@ void OnAllowSDLFunctionalityNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_activated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_activated_notification.cc index 189596c58a..e882020f8b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_activated_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_activated_notification.cc @@ -64,4 +64,4 @@ void OnAppActivatedNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_deactivated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_deactivated_notification.cc index ee45f9bf1e..18b796eaa8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_deactivated_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_deactivated_notification.cc @@ -66,4 +66,4 @@ void OnAppDeactivatedNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_changed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_changed_notification.cc index e13299ece7..a1eb412c66 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_changed_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_changed_notification.cc @@ -58,4 +58,4 @@ void OnAppPermissionChangedNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_consent_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_consent_notification.cc index cf83c48a5a..0033b392d2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_consent_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_consent_notification.cc @@ -32,12 +32,12 @@ */ #include "sdl_rpc_plugin/commands/hmi/on_app_permission_consent_notification.h" -#include "application_manager/application_manager.h" -#include "application_manager/policies/policy_handler.h" -#include "application_manager/message_helper.h" #include <algorithm> #include <functional> #include <string> +#include "application_manager/application_manager.h" +#include "application_manager/message_helper.h" +#include "application_manager/policies/policy_handler.h" #include "policy/policy_types.h" #include "smart_objects/smart_object.h" @@ -178,5 +178,5 @@ void OnAppPermissionConsentNotification::Run() { policy_handler_.OnAppPermissionConsent(connection_key, permission_consent); #endif } -} // commands -} // namespace application_manager +} // namespace commands +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_registered_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_registered_notification.cc index 24c5a94272..51c3125921 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_registered_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_registered_notification.cc @@ -64,4 +64,4 @@ void OnAppRegisteredNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_unregistered_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_unregistered_notification.cc index 001b9fa5e0..07aadada81 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_unregistered_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_unregistered_notification.cc @@ -73,4 +73,4 @@ void OnAppUnregisteredNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_audio_data_streaming_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_audio_data_streaming_notification.cc index e2cd6d2cbf..d9c1120409 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_audio_data_streaming_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_audio_data_streaming_notification.cc @@ -58,4 +58,4 @@ void OnAudioDataStreamingNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc index 0677c97db8..1a104c0fa1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc @@ -69,7 +69,8 @@ void OnBCSystemCapabilityUpdatedNotification::Run() { hmi_apis::Common_SystemCapabilityType::eType system_capability_type = static_cast<hmi_apis::Common_SystemCapabilityType::eType>( msg_params[strings::system_capability] - [strings::system_capability_type].asInt()); + [strings::system_capability_type] + .asInt()); switch (system_capability_type) { case hmi_apis::Common_SystemCapabilityType::NAVIGATION: { smart_objects::SmartObject nav_capability(smart_objects::SmartType_Map); @@ -134,21 +135,24 @@ void OnBCSystemCapabilityUpdatedNotification::Run() { for (size_t i = 0; i < updated_capabilities.length(); i++) { std::string service_id = updated_capabilities[i][strings::updated_app_service_record] - [strings::service_id].asString(); - auto matching_service_predicate = [&service_id]( - const smart_objects::SmartObject& app_service_capability) { - return service_id == - app_service_capability[strings::updated_app_service_record] - [strings::service_id].asString(); - }; + [strings::service_id] + .asString(); + auto matching_service_predicate = + [&service_id]( + const smart_objects::SmartObject& app_service_capability) { + return service_id == + app_service_capability[strings::updated_app_service_record] + [strings::service_id] + .asString(); + }; auto it = std::find_if(app_services->begin(), app_services->end(), matching_service_predicate); if (it != app_services->end()) { - LOG4CXX_DEBUG(logger_, - "Replacing updated record with service_id " - << service_id); + LOG4CXX_DEBUG( + logger_, + "Replacing updated record with service_id " << service_id); app_services->erase(it); } app_services->push_back(updated_capabilities[i]); @@ -157,6 +161,15 @@ void OnBCSystemCapabilityUpdatedNotification::Run() { [strings::app_services_capabilities] = app_service_caps; break; } + case mobile_apis::SystemCapabilityType::DISPLAYS: { + if (!hmi_capabilities_.system_display_capabilities()) { + LOG4CXX_INFO(logger_, "system_display_capabilities are not available"); + return; + } + msg_params[strings::system_capability][strings::display_capabilities] = + *hmi_capabilities_.system_display_capabilities(); + break; + } default: return; } @@ -164,4 +177,4 @@ void OnBCSystemCapabilityUpdatedNotification::Run() { } } // namespace commands -} // namespace app_service_rpc_plugin +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.cc new file mode 100644 index 0000000000..f32aef1102 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.cc @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2019, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.h" + +#include "application_manager/display_capabilities_builder.h" +#include "application_manager/message_helper.h" +#include "interfaces/HMI_API.h" +#include "interfaces/MOBILE_API.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; + +namespace commands { + +OnBCSystemCapabilityUpdatedNotificationFromHMI:: + OnBCSystemCapabilityUpdatedNotificationFromHMI( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handle) + : NotificationFromHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handle) {} + +OnBCSystemCapabilityUpdatedNotificationFromHMI:: + ~OnBCSystemCapabilityUpdatedNotificationFromHMI() {} + +OnBCSystemCapabilityUpdatedNotificationFromHMI:: + ProcessSystemDisplayCapabilitiesResult + OnBCSystemCapabilityUpdatedNotificationFromHMI:: + ProcessSystemDisplayCapabilities( + const smart_objects::SmartObject& display_capabilities) { + LOG4CXX_AUTO_TRACE(logger_); + + if (!(*message_)[strings::msg_params].keyExists(strings::app_id)) { + LOG4CXX_DEBUG(logger_, "Updating general display capabilities"); + hmi_capabilities_.set_system_display_capabilities(display_capabilities); + return ProcessSystemDisplayCapabilitiesResult::SUCCESS; + } + + const auto app_id = + (*message_)[strings::msg_params][strings::app_id].asUInt(); + auto app = application_manager_.application(app_id); + if (!app) { + LOG4CXX_ERROR(logger_, + "Application with app_id " << app_id << " is not registered"); + return ProcessSystemDisplayCapabilitiesResult::FAIL; + } + + LOG4CXX_DEBUG(logger_, "Updating display capabilities for app " << app_id); + app->set_display_capabilities(display_capabilities); + + // Remove app_id from notification to mobile + (*message_)[strings::params][strings::connection_key] = + (*message_)[strings::msg_params][strings::app_id]; + (*message_)[strings::msg_params].erase(strings::app_id); + if (app->is_resuming() && app->is_app_data_resumption_allowed()) { + LOG4CXX_DEBUG(logger_, "Application is resuming"); + app->display_capabilities_builder().UpdateDisplayCapabilities( + display_capabilities); + return ProcessSystemDisplayCapabilitiesResult::CAPABILITIES_CACHED; + } + + return ProcessSystemDisplayCapabilitiesResult::SUCCESS; +} + +void OnBCSystemCapabilityUpdatedNotificationFromHMI::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + // Prepare SmartObject for mobile factory + (*message_)[strings::params][strings::function_id] = static_cast<int32_t>( + mobile_apis::FunctionID::OnSystemCapabilityUpdatedID); + + const auto& system_capability = + (*message_)[strings::msg_params][strings::system_capability]; + + switch (system_capability[strings::system_capability_type].asInt()) { + case mobile_apis::SystemCapabilityType::DISPLAYS: { + if (system_capability.keyExists(strings::display_capabilities)) { + const auto result = ProcessSystemDisplayCapabilities( + system_capability[strings::display_capabilities]); + if (ProcessSystemDisplayCapabilitiesResult::FAIL == result) { + LOG4CXX_ERROR( + logger_, + "Failed to process display capabilities. Notification will " + "be ignored"); + return; + } else if (ProcessSystemDisplayCapabilitiesResult:: + CAPABILITIES_CACHED == result) { + LOG4CXX_TRACE(logger_, + "Capabilities are being cached for resuming app"); + return; + } + } + break; + } + case mobile_apis::SystemCapabilityType::REMOTE_CONTROL: { + if (system_capability.keyExists(strings::rc_capability)) { + LOG4CXX_DEBUG(logger_, "Updating RC Capabilities"); + hmi_capabilities_.set_rc_capability( + system_capability[strings::rc_capability]); + } + break; + } + } + + SendNotificationToMobile(message_); +} + +} // namespace commands + +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_event_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_event_notification.cc index 1f052b865b..f25e6202cd 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_event_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_event_notification.cc @@ -67,4 +67,4 @@ void OnButtonEventNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_press_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_press_notification.cc index 6c5d8f5a43..fee6b1b485 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_press_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_press_notification.cc @@ -33,8 +33,8 @@ #include "sdl_rpc_plugin/commands/hmi/on_button_press_notification.h" #include "application_manager/application_impl.h" -#include "utils/logger.h" #include "application_manager/event_engine/event.h" +#include "utils/logger.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -69,4 +69,4 @@ void OnButtonPressNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_subscription_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_subscription_notification.cc index 70ff1c3fad..4ac752d6c5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_subscription_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_subscription_notification.cc @@ -63,4 +63,4 @@ void OnButtonSubscriptionNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_chosen_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_chosen_notification.cc index 2c4f9a1ccc..f27c1fe5e5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_chosen_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_chosen_notification.cc @@ -63,4 +63,4 @@ void OnDeviceChosenNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_state_changed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_state_changed_notification.cc index 307dccd09b..129ba8c9ba 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_state_changed_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_state_changed_notification.cc @@ -30,12 +30,13 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include <algorithm> #include "sdl_rpc_plugin/commands/hmi/on_device_state_changed_notification.h" +#include <algorithm> #include "application_manager/application_manager.h" #include "application_manager/message_helper.h" -#include "interfaces/HMI_API.h" +#include "application_manager/policies/policy_handler_interface.h" #include "encryption/hashing.h" +#include "interfaces/HMI_API.h" namespace { // TODO(AOleynik) : replace this !!! @@ -72,7 +73,7 @@ std::string convert_to_bt_mac(std::string& deviceInternalId) { return bt_mac; } -} +} // namespace namespace sdl_rpc_plugin { using namespace application_manager; @@ -121,4 +122,4 @@ void OnDeviceStateChangedNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc index a5fb9b206e..a743c58672 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc @@ -30,13 +30,14 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include <set> #include "sdl_rpc_plugin/commands/hmi/on_driver_distraction_notification.h" +#include <set> #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" -#include "interfaces/MOBILE_API.h" +#include "application_manager/policies/policy_handler_interface.h" #include "interfaces/HMI_API.h" +#include "interfaces/MOBILE_API.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -59,12 +60,39 @@ struct OnDriverDistractionProcessor { void operator()(ApplicationSharedPtr application) { if (application) { - (*on_driver_distraction_so_)[strings::params][strings::connection_key] = - application->app_id(); + // Create modifiable copy of base message + smart_objects::SmartObject message = *on_driver_distraction_so_; + message[strings::params][strings::connection_key] = application->app_id(); const RPCParams params; policy::CheckPermissionResult result; application_manager_.GetPolicyHandler().CheckPermissions( - application, stringified_function_id_, params, result); + application, + mobile_apis::PredefinedWindows::DEFAULT_WINDOW, + stringified_function_id_, + params, + result); + auto& msg_params = message[strings::msg_params]; + const bool is_lock_screen_dismissal_exists = msg_params.keyExists( + mobile_notification::lock_screen_dismissal_enabled); + + if (is_lock_screen_dismissal_exists && + msg_params[mobile_notification::lock_screen_dismissal_enabled] + .asBool()) { + const auto language = + MessageHelper::MobileLanguageToString(application->ui_language()); + + const auto warning_message = + application_manager_.GetPolicyHandler() + .LockScreenDismissalWarningMessage(language); + // Only allow lock screen dismissal if a warning message is available + if (warning_message && !warning_message->empty()) { + msg_params[mobile_notification::lock_screen_dismissal_warning] = + *warning_message; + } else { + msg_params[mobile_notification::lock_screen_dismissal_enabled] = + false; + } + } if (result.hmi_level_permitted != policy::kRpcAllowed) { MobileMessageQueue messages; application->SwapMobileMessageQueue(messages); @@ -72,15 +100,19 @@ struct OnDriverDistractionProcessor { std::remove_if( messages.begin(), messages.end(), - [this](smart_objects::SmartObjectSPtr message) { + [](smart_objects::SmartObjectSPtr message) { return (*message)[strings::params][strings::function_id] - .asString() == stringified_function_id_; + .asUInt() == + mobile_api::FunctionID::OnDriverDistractionID; }), messages.end()); - application->PushMobileMessage(on_driver_distraction_so_); + application->SwapMobileMessageQueue(messages); + application->PushMobileMessage( + std::make_shared<smart_objects::SmartObject>(message)); return; } - command_.SendNotificationToMobile(on_driver_distraction_so_); + command_.SendNotificationToMobile( + std::make_shared<smart_objects::SmartObject>(message)); } } @@ -90,7 +122,7 @@ struct OnDriverDistractionProcessor { ApplicationManager& application_manager_; std::string stringified_function_id_; }; -} +} // namespace OnDriverDistractionNotification::OnDriverDistractionNotification( const application_manager::commands::MessageSharedPtr& message, @@ -108,14 +140,12 @@ OnDriverDistractionNotification::~OnDriverDistractionNotification() {} void OnDriverDistractionNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); - const hmi_apis::Common_DriverDistractionState::eType state = + const auto state = static_cast<hmi_apis::Common_DriverDistractionState::eType>( (*message_)[strings::msg_params][hmi_notification::state].asInt()); application_manager_.set_driver_distraction_state(state); - smart_objects::SmartObjectSPtr on_driver_distraction = - std::make_shared<smart_objects::SmartObject>(); - + auto on_driver_distraction = std::make_shared<smart_objects::SmartObject>(); if (!on_driver_distraction) { LOG4CXX_ERROR(logger_, "NULL pointer"); return; @@ -127,6 +157,17 @@ void OnDriverDistractionNotification::Run() { (*on_driver_distraction)[strings::msg_params][mobile_notification::state] = state; + const auto lock_screen_dismissal = + application_manager_.GetPolicyHandler().LockScreenDismissalEnabledState(); + + if (lock_screen_dismissal && + hmi_apis::Common_DriverDistractionState::DD_ON == state) { + (*on_driver_distraction) + [strings::msg_params] + [mobile_notification::lock_screen_dismissal_enabled] = + *lock_screen_dismissal; + } + const ApplicationSet applications = application_manager_.applications().GetData(); @@ -139,4 +180,4 @@ void OnDriverDistractionNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_event_changed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_event_changed_notification.cc index cd3f2c23e6..f6ea22ae34 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_event_changed_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_event_changed_notification.cc @@ -61,4 +61,4 @@ void OnEventChangedNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_all_applications_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_all_applications_notification.cc index 9d250d288e..4c168f9eff 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_all_applications_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_all_applications_notification.cc @@ -32,13 +32,13 @@ #include "sdl_rpc_plugin/commands/hmi/on_exit_all_applications_notification.h" +#include <signal.h> #include <sys/types.h> #include <unistd.h> -#include <signal.h> #include "application_manager/application_manager.h" -#include "application_manager/rpc_service.h" #include "application_manager/resumption/resume_ctrl.h" +#include "application_manager/rpc_service.h" #include "interfaces/HMI_API.h" namespace sdl_rpc_plugin { @@ -122,4 +122,4 @@ void OnExitAllApplicationsNotification::SendOnSDLPersistenceComplete() { } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc index 6658f41005..3eec6c5d1a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc @@ -33,11 +33,11 @@ #include "sdl_rpc_plugin/commands/hmi/on_exit_application_notification.h" #include "application_manager/application_impl.h" -#include "application_manager/state_controller.h" #include "application_manager/message_helper.h" #include "application_manager/rpc_service.h" -#include "interfaces/MOBILE_API.h" +#include "application_manager/state_controller.h" #include "interfaces/HMI_API.h" +#include "interfaces/MOBILE_API.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -119,14 +119,9 @@ void OnExitApplicationNotification::Run() { } } - application_manager_.state_controller().SetRegularState( - app_impl, - HMILevel::HMI_NONE, - AudioStreamingState::NOT_AUDIBLE, - VideoStreamingState::NOT_STREAMABLE, - false); + application_manager_.state_controller().ExitDefaultWindow(app_impl); } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_file_removed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_file_removed_notification.cc index ec680c667d..e1f0e2b104 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_file_removed_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_file_removed_notification.cc @@ -59,4 +59,4 @@ void OnFileRemovedNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_find_applications.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_find_applications.cc index c74dd70c84..2e8f15387f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_find_applications.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_find_applications.cc @@ -59,4 +59,4 @@ void OnFindApplications::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ignition_cycle_over_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ignition_cycle_over_notification.cc index 9ff1851e3f..1e8da19c0a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ignition_cycle_over_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ignition_cycle_over_notification.cc @@ -32,6 +32,7 @@ #include "sdl_rpc_plugin/commands/hmi/on_ignition_cycle_over_notification.h" #include "application_manager/application_manager.h" +#include "application_manager/policies/policy_handler_interface.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -59,4 +60,4 @@ void OnIgnitionCycleOverNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_tbt_client_state_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_tbt_client_state_notification.cc index 20f20ece08..f611b81764 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_tbt_client_state_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_tbt_client_state_notification.cc @@ -64,4 +64,4 @@ void OnNaviTBTClientStateNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_way_point_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_way_point_change_notification.cc index fa8819ca5b..2a1a9c29fb 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_way_point_change_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_way_point_change_notification.cc @@ -60,4 +60,4 @@ void OnNaviWayPointChangeNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_policy_update.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_policy_update.cc index e069bea740..a0e75371b5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_policy_update.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_policy_update.cc @@ -32,6 +32,7 @@ #include "sdl_rpc_plugin/commands/hmi/on_policy_update.h" #include "application_manager/application_manager.h" +#include "application_manager/policies/policy_handler_interface.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -57,4 +58,4 @@ void OnPolicyUpdate::Run() { } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_put_file_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_put_file_notification.cc index 1524aa9ea2..441e36a385 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_put_file_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_put_file_notification.cc @@ -59,4 +59,4 @@ void OnPutFileNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ready_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ready_notification.cc index 76c9115662..da3612b043 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ready_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ready_notification.cc @@ -62,4 +62,4 @@ void OnReadyNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_received_policy_update.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_received_policy_update.cc index 1eaef0b5e1..b2c9151b40 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_received_policy_update.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_received_policy_update.cc @@ -30,9 +30,10 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include <string> #include "sdl_rpc_plugin/commands/hmi/on_received_policy_update.h" +#include <string> #include "application_manager/application_manager.h" +#include "application_manager/policies/policy_handler_interface.h" #include "utils/file_system.h" namespace sdl_rpc_plugin { @@ -74,4 +75,4 @@ void OnReceivedPolicyUpdate::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_record_start_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_record_start_notification.cc index 60699e5b9c..dbef717539 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_record_start_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_record_start_notification.cc @@ -59,4 +59,4 @@ void OnRecordStartdNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_resume_audio_source_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_resume_audio_source_notification.cc index 9f8a713ffe..11d549655e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_resume_audio_source_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_resume_audio_source_notification.cc @@ -59,4 +59,4 @@ void OnResumeAudioSourceNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_close_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_close_notification.cc index 65879edce6..d0c584c66c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_close_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_close_notification.cc @@ -59,4 +59,4 @@ void OnSDLCloseNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_consent_needed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_consent_needed_notification.cc index cf8feb4ca1..314a9e8f71 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_consent_needed_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_consent_needed_notification.cc @@ -59,4 +59,4 @@ void OnSDLConsentNeededNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_persistence_complete_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_persistence_complete_notification.cc index 0ac4afd4d2..5db38d070b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_persistence_complete_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_persistence_complete_notification.cc @@ -58,4 +58,4 @@ void OnSDLPersistenceCompleteNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_service_update_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_service_update_notification.cc new file mode 100644 index 0000000000..de03b75214 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_service_update_notification.cc @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2019, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "sdl_rpc_plugin/commands/hmi/on_service_update_notification.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; + +namespace commands { + +namespace hmi { + +OnServiceUpdateNotification::OnServiceUpdateNotification( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : NotificationToHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +OnServiceUpdateNotification::~OnServiceUpdateNotification() {} + +void OnServiceUpdateNotification::Run() { + LOG4CXX_AUTO_TRACE(logger_); + SendNotification(); +} + +} // namespace hmi +} // namespace commands +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_start_device_discovery.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_start_device_discovery.cc index 2cee7926bd..035def10e0 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_start_device_discovery.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_start_device_discovery.cc @@ -59,4 +59,4 @@ void OnStartDeviceDiscovery::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_status_update_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_status_update_notification.cc index 4cb01e7e90..5ee2ede198 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_status_update_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_status_update_notification.cc @@ -58,4 +58,4 @@ void OnStatusUpdateNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_context_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_context_notification.cc index 242fb1d8cd..bf52492ae1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_context_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_context_notification.cc @@ -33,8 +33,8 @@ #include "sdl_rpc_plugin/commands/hmi/on_system_context_notification.h" #include "application_manager/application_impl.h" -#include "application_manager/state_controller.h" #include "application_manager/message_helper.h" +#include "application_manager/state_controller.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -62,13 +62,27 @@ void OnSystemContextNotification::Run() { (*message_)[strings::msg_params][hmi_notification::system_context] .asInt()); + WindowID window_id = mobile_apis::PredefinedWindows::DEFAULT_WINDOW; + if ((*message_)[strings::msg_params].keyExists(strings::window_id)) { + window_id = (*message_)[strings::msg_params][strings::window_id].asInt(); + } + ApplicationSharedPtr app; - if ((mobile_api::SystemContext::SYSCTXT_VRSESSION == system_context) || - (mobile_api::SystemContext::SYSCTXT_MENU == system_context) || - (mobile_api::SystemContext::SYSCTXT_HMI_OBSCURED == system_context)) { + if (helpers:: + Compare<mobile_api::SystemContext::eType, helpers::EQ, helpers::ONE>( + system_context, + mobile_api::SystemContext::SYSCTXT_VRSESSION, + mobile_api::SystemContext::SYSCTXT_MENU, + mobile_api::SystemContext::SYSCTXT_HMI_OBSCURED)) { app = application_manager_.active_application(); - } else if ((mobile_api::SystemContext::SYSCTXT_ALERT == system_context) || - (mobile_api::SystemContext::SYSCTXT_MAIN == system_context)) { + } + + if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW != window_id || + helpers::Compare<mobile_api::SystemContext::eType, + helpers::EQ, + helpers::ONE>(system_context, + mobile_api::SystemContext::SYSCTXT_ALERT, + mobile_api::SystemContext::SYSCTXT_MAIN)) { if ((*message_)[strings::msg_params].keyExists(strings::app_id)) { app = application_manager_.application( (*message_)[strings::msg_params][strings::app_id].asUInt()); @@ -76,8 +90,8 @@ void OnSystemContextNotification::Run() { } if (app && mobile_api::SystemContext::INVALID_ENUM != system_context) { - application_manager_.state_controller().SetRegularState(app, - system_context); + application_manager_.state_controller().SetRegularState( + app, window_id, system_context); } else { LOG4CXX_ERROR(logger_, "Application does not exist"); } @@ -85,4 +99,4 @@ void OnSystemContextNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_error_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_error_notification.cc index 5591d59355..9b8523e882 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_error_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_error_notification.cc @@ -32,6 +32,7 @@ #include "sdl_rpc_plugin/commands/hmi/on_system_error_notification.h" #include "application_manager/application_manager.h" +#include "application_manager/policies/policy_handler_interface.h" #include "interfaces/HMI_API.h" namespace sdl_rpc_plugin { @@ -64,4 +65,4 @@ void OnSystemErrorNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_info_changed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_info_changed_notification.cc index 11b2471294..171c144055 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_info_changed_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_info_changed_notification.cc @@ -33,6 +33,7 @@ #include "sdl_rpc_plugin/commands/hmi/on_system_info_changed_notification.h" #include "application_manager/application_manager.h" #include "application_manager/message_helper.h" +#include "application_manager/policies/policy_handler_interface.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -66,4 +67,4 @@ void OnSystemInfoChangedNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_request_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_request_notification.cc index d795896764..6d95febe71 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_request_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_request_notification.cc @@ -32,11 +32,15 @@ #include "application_manager/application_impl.h" -#include "sdl_rpc_plugin/commands/hmi/on_system_request_notification.h" #include "application_manager/policies/policy_handler_interface.h" #include "interfaces/MOBILE_API.h" +#include "sdl_rpc_plugin/commands/hmi/on_system_request_notification.h" #include "utils/macro.h" +#ifdef EXTERNAL_PROPRIETARY_MODE +#include "policy/ptu_retry_handler.h" +#endif // EXTERNAL_PROPRIETARY_MODE + using policy::PolicyHandlerInterface; namespace sdl_rpc_plugin { @@ -116,9 +120,20 @@ void OnSystemRequestNotification::Run() { "Sending request with application id " << app->policy_app_id()); params[strings::connection_key] = app->app_id(); + +#ifdef EXTERNAL_PROPRIETARY_MODE + using namespace rpc::policy_table_interface_base; + const auto request_type = + static_cast<rpc::policy_table_interface_base::RequestType>( + (*message_)[strings::msg_params][strings::request_type].asUInt()); + + if (RequestType::RT_PROPRIETARY == request_type) { + policy_handler_.ptu_retry_handler().OnSystemRequestReceived(); + } +#endif SendNotificationToMobile(message_); } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_time_ready_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_time_ready_notification.cc index b5fd1a007e..b068835545 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_time_ready_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_time_ready_notification.cc @@ -59,4 +59,4 @@ void OnSystemTimeReadyNotification::Run() { } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc index 5b5cfeefb1..f89baad737 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc @@ -100,4 +100,4 @@ void OnTTSLanguageChangeNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_reset_timeout_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_reset_timeout_notification.cc index 701dbe0538..8b60762b31 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_reset_timeout_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_reset_timeout_notification.cc @@ -66,4 +66,4 @@ void OnTTSResetTimeoutNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_started_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_started_notification.cc index 34ba82df1d..2d215b2ec9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_started_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_started_notification.cc @@ -60,4 +60,4 @@ void OnTTSStartedNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_stopped_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_stopped_notification.cc index 0935a36848..6910b188f2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_stopped_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_stopped_notification.cc @@ -63,4 +63,4 @@ void OnTTSStoppedNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_command_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_command_notification.cc index 21cf0d9628..6cc9f85d6f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_command_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_command_notification.cc @@ -65,4 +65,4 @@ void OnUICommandNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_keyboard_input_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_keyboard_input_notification.cc index fbdd4fce2b..f069e4ed65 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_keyboard_input_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_keyboard_input_notification.cc @@ -67,4 +67,4 @@ void OnUIKeyBoardInputNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_language_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_language_change_notification.cc index 3bf5a5aed4..697b2036c4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_language_change_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_language_change_notification.cc @@ -99,4 +99,4 @@ void OnUILanguageChangeNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_reset_timeout_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_reset_timeout_notification.cc index 953932cdb6..bd1e1b8ea7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_reset_timeout_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_reset_timeout_notification.cc @@ -67,4 +67,4 @@ void OnUIResetTimeoutNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_touch_event_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_touch_event_notification.cc index e5b321e1ff..193c3666d2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_touch_event_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_touch_event_notification.cc @@ -67,4 +67,4 @@ void OnUITouchEventNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_update_device_list.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_update_device_list.cc index 2a5e6ba797..e6275adab2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_update_device_list.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_update_device_list.cc @@ -56,4 +56,4 @@ void OnUpdateDeviceList::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_acc_pedal_position_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_acc_pedal_position_notification.cc index c8ecba458a..99c6520fee 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_acc_pedal_position_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_acc_pedal_position_notification.cc @@ -64,4 +64,4 @@ void OnVIAccPedalPositionNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_belt_status_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_belt_status_notification.cc index ee909d19dc..dbfd9487e3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_belt_status_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_belt_status_notification.cc @@ -64,4 +64,4 @@ void OnVIBeltStatusNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_body_information_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_body_information_notification.cc index f0386646ce..b8e66b9c0f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_body_information_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_body_information_notification.cc @@ -64,4 +64,4 @@ void OnVIBodyInformationNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_device_status_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_device_status_notification.cc index 549c73065a..418c751d1c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_device_status_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_device_status_notification.cc @@ -64,4 +64,4 @@ void OnVIDeviceStatusNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_driver_braking_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_driver_braking_notification.cc index 23f0d37068..29545fcd87 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_driver_braking_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_driver_braking_notification.cc @@ -64,4 +64,4 @@ void OnVIDriverBrakingNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_engine_torque_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_engine_torque_notification.cc index 735a225225..4c2fb94400 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_engine_torque_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_engine_torque_notification.cc @@ -64,4 +64,4 @@ void OnVIEngineTorqueNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_external_temperature_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_external_temperature_notification.cc index 0b4bfa893f..6ac26a74fc 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_external_temperature_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_external_temperature_notification.cc @@ -64,4 +64,4 @@ void OnVIExternalTemperatureNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_notification.cc index a5e84f1108..1f1cad5b8b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_notification.cc @@ -64,4 +64,4 @@ void OnVIFuelLevelNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_state_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_state_notification.cc index 950b5a36f1..31c80860fd 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_state_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_state_notification.cc @@ -64,4 +64,4 @@ void OnVIFuelLevelStateNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_gps_data_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_gps_data_notification.cc index 0d94194f76..43ae3524ad 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_gps_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_gps_data_notification.cc @@ -64,4 +64,4 @@ void OnVIGpsDataNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_head_lamp_status_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_head_lamp_status_notification.cc index 80edb88e38..282a173b69 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_head_lamp_status_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_head_lamp_status_notification.cc @@ -64,4 +64,4 @@ void OnVIHeadLampStatusNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc index a2b0b1a8fd..f9bb3eca3f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc @@ -65,4 +65,4 @@ void OnVIInstantFuelConsumptionNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_my_key_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_my_key_notification.cc index 5e3555bbc4..8f5e845c02 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_my_key_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_my_key_notification.cc @@ -64,4 +64,4 @@ void OnVIMyKeyNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_odometer_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_odometer_notification.cc index 1dbef77fa3..ea5d8be9ca 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_odometer_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_odometer_notification.cc @@ -64,4 +64,4 @@ void OnVIOdometerNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_prndl_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_prndl_notification.cc index d4ae93b324..73231ff4de 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_prndl_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_prndl_notification.cc @@ -64,4 +64,4 @@ void OnVIPrndlNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_rpm_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_rpm_notification.cc index 77f694c92e..4587939b8f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_rpm_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_rpm_notification.cc @@ -64,4 +64,4 @@ void OnVIRpmNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_speed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_speed_notification.cc index e5860c9eec..df0bfd5cd7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_speed_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_speed_notification.cc @@ -64,4 +64,4 @@ void OnVISpeedNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc index db591d9da3..b7eaad7edf 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc @@ -64,4 +64,4 @@ void OnVISteeringWheelAngleNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_tire_pressure_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_tire_pressure_notification.cc index b5c7e18803..5f438ef8d1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_tire_pressure_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_tire_pressure_notification.cc @@ -64,4 +64,4 @@ void OnVITirePressureNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_vin_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_vin_notification.cc index 323fe5b885..1b40da4c40 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_vin_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_vin_notification.cc @@ -64,4 +64,4 @@ void OnVIVinNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_wiper_status_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_wiper_status_notification.cc index 6a3b863e7c..7221e88ef1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_wiper_status_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_wiper_status_notification.cc @@ -64,4 +64,4 @@ void OnVIWiperStatusNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_video_data_streaming_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_video_data_streaming_notification.cc index 701dee5385..7d5c0165aa 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_video_data_streaming_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_video_data_streaming_notification.cc @@ -59,4 +59,4 @@ void OnVideoDataStreamingNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_command_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_command_notification.cc index 386ef1d1c7..c4678f69e0 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_command_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_command_notification.cc @@ -32,13 +32,13 @@ #include "sdl_rpc_plugin/commands/hmi/on_vr_command_notification.h" -#include "application_manager/policies/policy_handler.h" #include "application_manager/message_helper.h" +#include "application_manager/policies/policy_handler.h" #include "application_manager/state_controller.h" -#include "interfaces/MOBILE_API.h" -#include "interfaces/HMI_API.h" #include "application_manager/event_engine/event.h" +#include "interfaces/HMI_API.h" +#include "interfaces/MOBILE_API.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -65,14 +65,17 @@ void OnVRCommandNotification::Run() { (*message_)[strings::msg_params][strings::cmd_id].asUInt(); uint32_t max_cmd_id = application_manager_.get_settings().max_cmd_id(); - // Check if this is one of standart VR commands (i.e. "Help") + // Check if this is one of standard VR commands (i.e. "Help") if (cmd_id > max_cmd_id + 1) { LOG4CXX_INFO(logger_, "Switched App"); const uint32_t app_id = cmd_id - max_cmd_id; ApplicationSharedPtr app = application_manager_.application(app_id); if (app) { application_manager_.state_controller().SetRegularState( - app, mobile_apis::HMILevel::HMI_FULL, true); + app, + mobile_apis::PredefinedWindows::DEFAULT_WINDOW, + mobile_apis::HMILevel::HMI_FULL, + true); } else { LOG4CXX_ERROR(logger_, "Unable to find appication " << app_id); } @@ -110,4 +113,4 @@ void OnVRCommandNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc index 6a58ab9ffa..c308af9b92 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc @@ -33,9 +33,9 @@ #include "sdl_rpc_plugin/commands/hmi/on_vr_language_change_notification.h" #include "application_manager/application_impl.h" -#include "application_manager/state_controller.h" #include "application_manager/message_helper.h" #include "application_manager/rpc_service.h" +#include "application_manager/state_controller.h" #include "interfaces/MOBILE_API.h" namespace sdl_rpc_plugin { @@ -83,7 +83,10 @@ void OnVRLanguageChangeNotification::Run() { if (static_cast<int32_t>(app->language()) != (*message_)[strings::msg_params][strings::language].asInt()) { application_manager_.state_controller().SetRegularState( - app, mobile_api::HMILevel::HMI_NONE, false); + app, + mobile_apis::PredefinedWindows::DEFAULT_WINDOW, + mobile_apis::HMILevel::HMI_NONE, + false); rpc_service_.ManageMobileCommand( MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( @@ -98,4 +101,4 @@ void OnVRLanguageChangeNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_started_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_started_notification.cc index 04eb9a9ed0..bfc033a865 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_started_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_started_notification.cc @@ -61,4 +61,4 @@ void OnVRStartedNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_stopped_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_stopped_notification.cc index 8fea5ddd1c..ede1efab85 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_stopped_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_stopped_notification.cc @@ -61,4 +61,4 @@ void OnVRStoppedNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc index 5947454517..d8ad6087a6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc @@ -59,4 +59,4 @@ void RCGetCapabilitiesRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_response.cc index b14c28426c..128b111c5e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_response.cc @@ -54,16 +54,26 @@ void RCGetCapabilitiesResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); HMICapabilities& hmi_capabilities = hmi_capabilities_; - bool capability_exists = + bool rc_capability_exists = (*message_)[strings::msg_params].keyExists(strings::rc_capability); - if (capability_exists) { + if (rc_capability_exists) { hmi_capabilities.set_rc_capability( (*message_)[strings::msg_params][strings::rc_capability]); } - hmi_capabilities.set_rc_supported(capability_exists); + + bool seat_location_capability_exists = + (*message_)[strings::msg_params].keyExists( + strings::seat_location_capability); + + if (seat_location_capability_exists) { + hmi_capabilities.set_seat_location_capability( + (*message_)[strings::msg_params][strings::seat_location_capability]); + } + + hmi_capabilities.set_rc_supported(rc_capability_exists); } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc index d538878dc8..5e4af1503a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc @@ -105,4 +105,4 @@ void RCIsReadyRequest::SendMessageToHMI() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_response.cc index 7534567204..71e16a831c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_response.cc @@ -58,4 +58,4 @@ void RCIsReadyResponse::Run() { } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc index 92a7020208..13690809bb 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc @@ -31,8 +31,9 @@ */ #include "sdl_rpc_plugin/commands/hmi/sdl_activate_app_request.h" -#include "application_manager/state_controller.h" #include "application_manager/message_helper.h" +#include "application_manager/policies/policy_handler_interface.h" +#include "application_manager/state_controller.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -45,8 +46,7 @@ struct ProtoV4AppsOnDevice : std::unary_function<ApplicationSharedPtr, bool> { ProtoV4AppsOnDevice(const connection_handler::DeviceHandle handle) : handle_(handle) {} bool operator()(const ApplicationSharedPtr app) const { - return app - ? handle_ == app->device() && + return app ? handle_ == app->device() && Message::is_sufficient_version( protocol_handler::MajorProtocolVersion:: PROTOCOL_VERSION_4, @@ -80,7 +80,7 @@ struct SendLaunchApp return; } }; -} +} // namespace SDLActivateAppRequest::SDLActivateAppRequest( const application_manager::commands::MessageSharedPtr& message, @@ -317,4 +317,4 @@ ApplicationSharedPtr SDLActivateAppRequest::get_foreground_app( } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_response.cc index 3262b12759..560b75213c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_response.cc @@ -61,4 +61,4 @@ void SDLActivateAppResponse::Run() { } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_request.cc index 6b983d566a..c8266e0f39 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_request.cc @@ -32,6 +32,7 @@ #include "sdl_rpc_plugin/commands/hmi/sdl_get_list_of_permissions_request.h" #include "application_manager/application_manager.h" +#include "application_manager/policies/policy_handler_interface.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -64,4 +65,4 @@ void SDLGetListOfPermissionsRequest::Run() { } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_response.cc index 784b4922d4..280d2cb071 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_response.cc @@ -61,4 +61,4 @@ void SDLGetListOfPermissionsResponse::Run() { } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_request.cc new file mode 100644 index 0000000000..2607754228 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_request.cc @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2019, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "sdl_rpc_plugin/commands/hmi/sdl_get_policy_configuration_data_request.h" +#include "application_manager/application_manager.h" +#include "application_manager/policies/policy_handler_interface.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; + +namespace commands { + +SDLGetPolicyConfigurationDataRequest::SDLGetPolicyConfigurationDataRequest( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handle) + : RequestFromHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handle) {} + +SDLGetPolicyConfigurationDataRequest::~SDLGetPolicyConfigurationDataRequest() {} + +void SDLGetPolicyConfigurationDataRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + smart_objects::SmartObject response_value( + smart_objects::SmartType::SmartType_Array); + + hmi_apis::Common_Result::eType result_code = + PrepareResponseParams(response_value); + + if (hmi_apis::Common_Result::SUCCESS != result_code) { + LOG4CXX_ERROR(logger_, "Unable to PrepareResponseParams"); + SendErrorResponse( + correlation_id(), + hmi_apis::FunctionID::SDL_GetPolicyConfigurationData, + result_code, + "", + application_manager::commands::Command::SOURCE_SDL_TO_HMI); + return; + } + + smart_objects::SmartObject response_msg_params( + smart_objects::SmartType::SmartType_Map); + response_msg_params[strings::value] = response_value; + SendResponse(true, + correlation_id(), + hmi_apis::FunctionID::SDL_GetPolicyConfigurationData, + result_code, + &response_msg_params, + application_manager::commands::Command::SOURCE_SDL_TO_HMI); +} + +hmi_apis::Common_Result::eType +SDLGetPolicyConfigurationDataRequest::PrepareResponseParams( + smart_objects::SmartObject& response_out) const { + LOG4CXX_AUTO_TRACE(logger_); + const auto policy_type = + (*message_)[strings::msg_params][strings::policy_type].asString(); + + const auto property = + (*message_)[strings::msg_params][strings::property].asString(); + + auto policy_table_data = policy_handler_.GetPolicyTableData(); + if (!policy_table_data.isMember(policy_type)) { + LOG4CXX_ERROR( + logger_, + "policy_type " << policy_type << " doesn't exist in policy table."); + return hmi_apis::Common_Result::DATA_NOT_AVAILABLE; + } + + auto& policy_section_table_data = policy_table_data[policy_type]; + if (!policy_section_table_data.isMember(property)) { + LOG4CXX_ERROR( + logger_, + "property " << property << " doesn't exist in " << policy_type); + return hmi_apis::Common_Result::DATA_NOT_AVAILABLE; + } + + auto& property_table_data = policy_section_table_data[property]; + response_out = GetValueParam(property_table_data); + + return hmi_apis::Common_Result::SUCCESS; +} + +void clear_new_line_symbol(std::string& str_to_clear) { + str_to_clear.erase( + std::remove_if(str_to_clear.begin(), + str_to_clear.end(), + [](char character) { return '\n' == character; }), + str_to_clear.end()); +} + +smart_objects::SmartObject SDLGetPolicyConfigurationDataRequest::GetValueParam( + const Json::Value& policy_property) const { + LOG4CXX_AUTO_TRACE(logger_); + smart_objects::SmartObject value(smart_objects::SmartType_Array); + + auto put_element_in_value_array = [&value](const Json::Value& element, + const int32_t index) { + Json::FastWriter writer; + std::string str; + if (element.type() == Json::objectValue) { + str = writer.write(element); + clear_new_line_symbol(str); + } else { + str = element.asString(); + } + value[index] = str; + }; + + if (policy_property.type() == Json::arrayValue) { + for (Json::ArrayIndex i = 0; i < policy_property.size(); i++) { + put_element_in_value_array(policy_property[i], i); + } + return value; + } + put_element_in_value_array(policy_property, 0); + return value; +} + +} // namespace commands +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_urls_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_response.cc index 57c925e08f..21b7dea41c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_urls_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_response.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Ford Motor Company + * Copyright (c) 2019, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,14 +30,15 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "sdl_rpc_plugin/commands/hmi/get_urls_response.h" +#include "sdl_rpc_plugin/commands/hmi/sdl_get_policy_configuration_data_response.h" #include "application_manager/rpc_service.h" namespace sdl_rpc_plugin { using namespace application_manager; + namespace commands { -GetUrlsResponse::GetUrlsResponse( +SDLGetPolicyConfigurationDataResponse::SDLGetPolicyConfigurationDataResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, rpc_service::RPCService& rpc_service, @@ -49,15 +50,15 @@ GetUrlsResponse::GetUrlsResponse( hmi_capabilities, policy_handle) {} -GetUrlsResponse::~GetUrlsResponse() {} +SDLGetPolicyConfigurationDataResponse:: + ~SDLGetPolicyConfigurationDataResponse() {} -void GetUrlsResponse::Run() { +void SDLGetPolicyConfigurationDataResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); (*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_; (*message_)[strings::params][strings::protocol_version] = protocol_version_; - rpc_service_.SendMessageToHMI(message_); } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_request.cc index 9a6c0fd520..b494be56e8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_request.cc @@ -32,6 +32,7 @@ #include "sdl_rpc_plugin/commands/hmi/sdl_get_status_update_request.h" #include "application_manager/application_manager.h" +#include "application_manager/policies/policy_handler_interface.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -59,4 +60,4 @@ void SDLGetStatusUpdateRequest::Run() { } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_response.cc index 8fc85da481..4b0f3d0ca8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_response.cc @@ -61,4 +61,4 @@ void SDLGetStatusUpdateResponse::Run() { } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_request.cc index ab8ec4e3d9..38a63611fa 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_request.cc @@ -32,6 +32,7 @@ #include "sdl_rpc_plugin/commands/hmi/sdl_get_user_friendly_message_request.h" #include "application_manager/message_helper.h" +#include "application_manager/policies/policy_handler_interface.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -93,4 +94,4 @@ void SDLGetUserFriendlyMessageRequest::Run() { } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_response.cc index c5b3450723..b95591c4fa 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_response.cc @@ -61,4 +61,4 @@ void SDLGetUserFriendlyMessageResponse::Run() { } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update.cc index aef2e286d7..5f69903548 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update.cc @@ -64,4 +64,4 @@ void SDLPolicyUpdate::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update_response.cc index d16fc578ab..12cdfb4ad9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update_response.cc @@ -56,4 +56,4 @@ void SDLPolicyUpdateResponse::Run() { } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_request.cc index 163d749426..988be68a80 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_request.cc @@ -59,4 +59,4 @@ void TTSChangeRegistrationRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_response.cc index 2c28d615d3..e5e38ef34a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_response.cc @@ -63,4 +63,4 @@ void TTSChangeRegistratioResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc index 49623e01d7..9baaabf401 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc @@ -59,4 +59,4 @@ void TTSGetCapabilitiesRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_response.cc index 1cef3daf15..c0581a6380 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_response.cc @@ -69,4 +69,4 @@ void TTSGetCapabilitiesResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc index 5533537b33..7d2c15a9bf 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc @@ -59,4 +59,4 @@ void TTSGetLanguageRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_response.cc index ac423a2bf3..627056dce1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_response.cc @@ -77,4 +77,4 @@ void TTSGetLanguageResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc index 8b87b9c6ea..2cb47380d5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc @@ -59,4 +59,4 @@ void TTSGetSupportedLanguagesRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_response.cc index a4e97d9d70..a70d1c89a3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_response.cc @@ -69,4 +69,4 @@ void TTSGetSupportedLanguagesResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc index c7e2c0c4cb..89b5961895 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc @@ -31,8 +31,8 @@ */ #include "sdl_rpc_plugin/commands/hmi/tts_is_ready_request.h" -#include "application_manager/rpc_service.h" #include "application_manager/message_helper.h" +#include "application_manager/rpc_service.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -112,4 +112,4 @@ void TTSIsReadyRequest::SendMessageToHMI() { } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_response.cc index c7d634bee2..67e0fb6396 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_response.cc @@ -59,4 +59,4 @@ void TTSIsReadyResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_request.cc index 8c7443d465..0b3d9a77bf 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_request.cc @@ -59,4 +59,4 @@ void TTSSetGlobalPropertiesRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_response.cc index dae06d75f9..0901378c4a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_response.cc @@ -63,4 +63,4 @@ void TTSSetGlobalPropertiesResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_request.cc index 96b93b724f..6dce94f931 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_request.cc @@ -59,4 +59,4 @@ void TTSSpeakRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_response.cc index cb2346083b..69be5ab160 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_response.cc @@ -32,8 +32,8 @@ #include "sdl_rpc_plugin/commands/hmi/tts_speak_response.h" #include "application_manager/event_engine/event.h" -#include "interfaces/MOBILE_API.h" #include "interfaces/HMI_API.h" +#include "interfaces/MOBILE_API.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -64,4 +64,4 @@ void TTSSpeakResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_request.cc index 25a05f085b..43c595040c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_request.cc @@ -59,4 +59,4 @@ void TTSStopSpeakingRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_response.cc index a2620c1340..892b3e6295 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_response.cc @@ -62,4 +62,4 @@ void TTSStopSpeakingResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_request.cc index 749b3ad56b..7c95e8a919 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_request.cc @@ -59,4 +59,4 @@ void UIAddCommandRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_response.cc index 266dffd225..72d841a878 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_response.cc @@ -62,4 +62,4 @@ void UIAddCommandResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_request.cc index de338d4670..15342c6ecb 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_request.cc @@ -59,4 +59,4 @@ void UIAddSubmenuRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_response.cc index 85e600c87d..ae699dc2bd 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_response.cc @@ -63,4 +63,4 @@ void UIAddSubmenuResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_request.cc index ae5f861ba6..793e70d9e1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_request.cc @@ -47,7 +47,11 @@ UIAlertRequest::UIAlertRequest( application_manager, rpc_service, hmi_capabilities, - policy_handle) {} + policy_handle) { + const auto& msg_params = (*message_)[strings::msg_params]; + uint32_t request_timeout = msg_params[strings::duration].asUInt(); + default_timeout_ += request_timeout; +} UIAlertRequest::~UIAlertRequest() {} @@ -59,4 +63,4 @@ void UIAlertRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_response.cc index 3076eabc4c..f53f14e050 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_response.cc @@ -63,4 +63,4 @@ void UIAlertResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_request.cc new file mode 100644 index 0000000000..c186077b1e --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_request.cc @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2019, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "sdl_rpc_plugin/commands/hmi/ui_cancel_interaction_request.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; + +namespace commands { + +UICancelInteractionRequest::UICancelInteractionRequest( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handle) + : RequestToHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handle) {} + +UICancelInteractionRequest::~UICancelInteractionRequest() {} + +void UICancelInteractionRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + SendRequest(); +} + +} // namespace commands + +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_response.cc new file mode 100644 index 0000000000..2d5db4eecb --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_response.cc @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2019, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include "sdl_rpc_plugin/commands/hmi/ui_cancel_interaction_response.h" +#include "application_manager/event_engine/event.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; + +namespace commands { + +UICancelInteractionResponse::UICancelInteractionResponse( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handle) + : ResponseFromHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handle) {} + +UICancelInteractionResponse::~UICancelInteractionResponse() {} + +void UICancelInteractionResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + event_engine::Event event(hmi_apis::FunctionID::UI_CancelInteraction); + event.set_smart_object(*message_); + event.raise(application_manager_.event_dispatcher()); +} + +} // namespace commands + +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_request.cc index d109987009..bb001b37c7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_request.cc @@ -59,4 +59,4 @@ void UIChangeRegistrationRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_response.cc index 6557269e49..8acd654488 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_response.cc @@ -63,4 +63,4 @@ void UIChangeRegistratioResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc new file mode 100644 index 0000000000..b354009e3f --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2019, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "sdl_rpc_plugin/commands/hmi/ui_create_window_request.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; + +namespace commands { + +UICreateWindowRequest::UICreateWindowRequest( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handle) + : RequestToHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handle) {} + +UICreateWindowRequest::~UICreateWindowRequest() {} + +void UICreateWindowRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + SendRequest(); +} + +} // namespace commands + +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_response.cc new file mode 100644 index 0000000000..c3a323818d --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_response.cc @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2019, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include "sdl_rpc_plugin/commands/hmi/ui_create_window_response.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; + +namespace commands { + +UICreateWindowResponse::UICreateWindowResponse( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handle) + : ResponseFromHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handle) {} + +UICreateWindowResponse::~UICreateWindowResponse() {} + +void UICreateWindowResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + event_engine::Event event(hmi_apis::FunctionID::UI_CreateWindow); + event.set_smart_object(*message_); + event.raise(application_manager_.event_dispatcher()); +} + +} // namespace commands + +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_request.cc index 9e52f5fc18..1d741bba74 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_request.cc @@ -59,4 +59,4 @@ void UIDeleteCommandRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_response.cc index a8f5b59d39..40a5ec8a73 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_response.cc @@ -63,4 +63,4 @@ void UIDeleteCommandResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_request.cc index 1b84df8bed..fdca37cee6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_request.cc @@ -59,4 +59,4 @@ void UIDeleteSubmenuRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_response.cc index ec4025bea1..9d522431dc 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_response.cc @@ -63,4 +63,4 @@ void UIDeleteSubmenuResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_request.cc new file mode 100644 index 0000000000..7933574d92 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_request.cc @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2019, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "sdl_rpc_plugin/commands/hmi/ui_delete_window_request.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; + +namespace commands { + +UIDeleteWindowRequest::UIDeleteWindowRequest( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handle) + : RequestToHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handle) {} + +UIDeleteWindowRequest::~UIDeleteWindowRequest() {} + +void UIDeleteWindowRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + SendRequest(); +} + +} // namespace commands + +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_response.cc new file mode 100644 index 0000000000..ba703e18ae --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_response.cc @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2019, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include "sdl_rpc_plugin/commands/hmi/ui_delete_window_response.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; + +namespace commands { + +UIDeleteWindowResponse::UIDeleteWindowResponse( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handle) + : ResponseFromHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handle) {} + +UIDeleteWindowResponse::~UIDeleteWindowResponse() {} + +void UIDeleteWindowResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + event_engine::Event event(hmi_apis::FunctionID::UI_DeleteWindow); + event.set_smart_object(*message_); + event.raise(application_manager_.event_dispatcher()); +} + +} // namespace commands + +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_request.cc index fe11185c62..92f51bc9cf 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_request.cc @@ -59,4 +59,4 @@ void UIEndAudioPassThruRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_response.cc index 3a6d4efbe4..b6639dcbb9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_response.cc @@ -63,4 +63,4 @@ void UIEndAudioPassThruResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc index 3bd56a0682..5f8704b3e5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc @@ -59,4 +59,4 @@ void UIGetCapabilitiesRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc index cd5f3c9a42..a3eb9244bd 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc @@ -73,9 +73,17 @@ void UIGetCapabilitiesResponse::Run() { msg_params[hmi_response::soft_button_capabilities]); } - if (msg_params.keyExists(strings::audio_pass_thru_capabilities)) { + // use newer parameter "audioPassThruCapabilitiesList" when available + if (msg_params.keyExists(strings::audio_pass_thru_capabilities_list)) { hmi_capabilities.set_audio_pass_thru_capabilities( - msg_params[strings::audio_pass_thru_capabilities]); + msg_params[strings::audio_pass_thru_capabilities_list]); + } else if (msg_params.keyExists(strings::audio_pass_thru_capabilities)) { + smart_objects::SmartObject audio_pass_thru_capabilities_list( + smart_objects::SmartType_Array); + audio_pass_thru_capabilities_list[0] = + msg_params[strings::audio_pass_thru_capabilities]; + hmi_capabilities.set_audio_pass_thru_capabilities( + audio_pass_thru_capabilities_list); } if (msg_params.keyExists(strings::hmi_capabilities)) { @@ -113,9 +121,15 @@ void UIGetCapabilitiesResponse::Run() { msg_params[strings::system_capabilities] [strings::video_streaming_capability]); } + if (msg_params[strings::system_capabilities].keyExists( + strings::display_capabilities)) { + hmi_capabilities.set_system_display_capabilities( + msg_params[strings::system_capabilities] + [strings::display_capabilities]); + } } } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc index 8acba42493..d3b44d1168 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc @@ -59,4 +59,4 @@ void UIGetLanguageRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_response.cc index 27e46e52b4..2a5c0ab016 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_response.cc @@ -78,4 +78,4 @@ void UIGetLanguageResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc index 2f8ef12a25..0665612525 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc @@ -59,4 +59,4 @@ void UIGetSupportedLanguagesRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_response.cc index d20dd8545f..19ee62e51d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_response.cc @@ -69,4 +69,4 @@ void UIGetSupportedLanguagesResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc index 2eab211690..2546b704b2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc @@ -112,4 +112,4 @@ void UIIsReadyRequest::SendMessageToHMI() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_response.cc index e25e8ee8ab..96a2d1212c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_response.cc @@ -60,4 +60,4 @@ void UIIsReadyResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_request.cc index cca89e3073..18d5376b25 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_request.cc @@ -59,4 +59,4 @@ void UIPerformAudioPassThruRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_response.cc index 057448ab33..afbd1bbed7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_response.cc @@ -62,4 +62,4 @@ void UIPerformAudioPassThruResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_request.cc index d5696a39e7..a07c72cbf4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_request.cc @@ -47,7 +47,11 @@ UIPerformInteractionRequest::UIPerformInteractionRequest( application_manager, rpc_service, hmi_capabilities, - policy_handle) {} + policy_handle) { + const auto& msg_params = (*message_)[strings::msg_params]; + uint32_t request_timeout = msg_params[strings::timeout].asUInt(); + default_timeout_ += request_timeout; +} UIPerformInteractionRequest::~UIPerformInteractionRequest() {} @@ -59,4 +63,4 @@ void UIPerformInteractionRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_response.cc index 7629faa131..4cbc58d278 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_response.cc @@ -61,4 +61,4 @@ void UIPerformInteractionResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_request.cc index dbe0ceb529..cad68e23aa 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_request.cc @@ -47,7 +47,11 @@ UIScrollableMessageRequest::UIScrollableMessageRequest( application_manager, rpc_service, hmi_capabilities, - policy_handle) {} + policy_handle) { + const auto& msg_params = (*message_)[strings::msg_params]; + uint32_t request_timeout = msg_params[strings::timeout].asUInt(); + default_timeout_ += request_timeout; +} UIScrollableMessageRequest::~UIScrollableMessageRequest() {} @@ -59,4 +63,4 @@ void UIScrollableMessageRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_response.cc index a96b9fa3ee..4e844095b4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_response.cc @@ -62,4 +62,4 @@ void UIScrollableMessageResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_request.cc index f5f8f7bafd..4a538ac992 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_request.cc @@ -58,4 +58,4 @@ void UISendHapticDataRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_response.cc index 4555d81a0a..92afdaaa4a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_response.cc @@ -62,4 +62,4 @@ void UISendHapticDataResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_request.cc index d25bbd1cd9..821f78a046 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_request.cc @@ -59,4 +59,4 @@ void UISetAppIconRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_response.cc index 711b5767f2..68e96725d4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_response.cc @@ -62,4 +62,4 @@ void UISetAppIconResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_request.cc index 73b813d0eb..63166157c8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_request.cc @@ -58,4 +58,4 @@ void UiSetDisplayLayoutRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_response.cc index d5d2e02e33..f35427895e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_response.cc @@ -63,4 +63,4 @@ void UiSetDisplayLayoutResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_request.cc index 0664404361..0aaaae7cc7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_request.cc @@ -59,4 +59,4 @@ void UISetGlobalPropertiesRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_response.cc index 2e5fecf2af..48d73d146c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_response.cc @@ -62,4 +62,4 @@ void UISetGlobalPropertiesResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_request.cc index 4e87b9ccc3..4c8fcefcdf 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_request.cc @@ -59,4 +59,4 @@ void UISetMediaClockTimerRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_response.cc index 39e7e1c232..fb5b25fc2b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_response.cc @@ -62,4 +62,4 @@ void UISetMediaClockTimerResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_request.cc new file mode 100644 index 0000000000..c2c8566e82 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_request.cc @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2018, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "sdl_rpc_plugin/commands/hmi/ui_show_app_menu_request.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +UIShowAppMenuRequest::UIShowAppMenuRequest( + 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_handle) + : RequestToHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handle) {} + +UIShowAppMenuRequest::~UIShowAppMenuRequest() {} + +void UIShowAppMenuRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + SendRequest(); +} + +} // namespace commands +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_response.cc new file mode 100644 index 0000000000..14bbc79e03 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_response.cc @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2018, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "sdl_rpc_plugin/commands/hmi/ui_show_app_menu_response.h" +#include "application_manager/event_engine/event.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { +UIShowAppMenuResponse::UIShowAppMenuResponse( + 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_handle) + : ResponseFromHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handle) {} + +UIShowAppMenuResponse::~UIShowAppMenuResponse() {} + +void UIShowAppMenuResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + app_mngr::event_engine::Event event(hmi_apis::FunctionID::UI_ShowAppMenu); + event.set_smart_object(*message_); + event.raise(application_manager_.event_dispatcher()); +} + +} // namespace commands +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_request.cc index 5b7568abfe..d7160dc70b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_request.cc @@ -59,4 +59,4 @@ void UIShowRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_response.cc index 3e3c0b79d8..768069bf3a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_response.cc @@ -61,4 +61,4 @@ void UIShowResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_request.cc index 4df3adbe14..eae8cc523c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_request.cc @@ -47,7 +47,11 @@ UISliderRequest::UISliderRequest( application_manager, rpc_service, hmi_capabilities, - policy_handle) {} + policy_handle) { + const auto& msg_params = (*message_)[strings::msg_params]; + uint32_t request_timeout = msg_params[strings::timeout].asUInt(); + default_timeout_ += request_timeout; +} UISliderRequest::~UISliderRequest() {} @@ -59,4 +63,4 @@ void UISliderRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_response.cc index 2431c65ddf..9cf7224ddb 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_response.cc @@ -62,4 +62,4 @@ void UISliderResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_request.cc index 05b08cb723..c5966fcb36 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_request.cc @@ -59,4 +59,4 @@ void UpdateAppListRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_response.cc index 3dd03993ef..7fc830b4e6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_response.cc @@ -59,4 +59,4 @@ void UpdateAppListResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_request.cc index 7736f2b1e6..3a014480c1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_request.cc @@ -100,4 +100,4 @@ bool UpdateDeviceListRequest::CleanUp() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_response.cc index 25dc9be5bd..d69e683f2b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_response.cc @@ -58,4 +58,4 @@ void UpdateDeviceListResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_request.cc index cafacea28f..a52f03b998 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_request.cc @@ -32,6 +32,7 @@ */ #include "sdl_rpc_plugin/commands/hmi/update_sdl_request.h" +#include "application_manager/policies/policy_handler_interface.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -61,4 +62,4 @@ void UpdateSDLRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_response.cc index a35571ec26..c02cde4111 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_response.cc @@ -61,4 +61,4 @@ void UpdateSDLResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_request.cc index 72ce387f77..788eda5a87 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_request.cc @@ -59,4 +59,4 @@ void VRAddCommandRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_response.cc index 19d43616ff..37b3e4696d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_response.cc @@ -63,4 +63,4 @@ void VRAddCommandResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_request.cc index 9ba5fa3571..d1be04ad44 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_request.cc @@ -59,4 +59,4 @@ void VRChangeRegistrationRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_response.cc index 42c5b6d65b..27bde2bafa 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_response.cc @@ -62,4 +62,4 @@ void VRChangeRegistrationResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_request.cc index efc09dc157..ebcfe78fa9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_request.cc @@ -59,4 +59,4 @@ void VRDeleteCommandRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_response.cc index f8f7535e68..d1d725b356 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_response.cc @@ -62,4 +62,4 @@ void VRDeleteCommandResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc index 7e9c846857..b06bfa0e77 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc @@ -59,4 +59,4 @@ void VRGetCapabilitiesRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_response.cc index 47ffb3a675..80c308ea40 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_response.cc @@ -61,4 +61,4 @@ void VRGetCapabilitiesResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc index d57faa08fd..84179f6357 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc @@ -59,4 +59,4 @@ void VRGetLanguageRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_response.cc index 469452d108..6b7fec736d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_response.cc @@ -78,4 +78,4 @@ void VRGetLanguageResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc index bb27168a77..351940bf68 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc @@ -59,4 +59,4 @@ void VRGetSupportedLanguagesRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_response.cc index 722040388d..4c725267fa 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_response.cc @@ -31,8 +31,8 @@ */ #include "sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_response.h" -#include "interfaces/MOBILE_API.h" #include "interfaces/HMI_API.h" +#include "interfaces/MOBILE_API.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -69,4 +69,4 @@ void VRGetSupportedLanguagesResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc index 22afb03945..12414eab10 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc @@ -112,4 +112,4 @@ void VRIsReadyRequest::SendMessageToHMI() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_response.cc index 48d9c3e075..373f97bf80 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_response.cc @@ -59,4 +59,4 @@ void VRIsReadyResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_request.cc index 26e308a0bc..4257158f6a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_request.cc @@ -47,7 +47,11 @@ VRPerformInteractionRequest::VRPerformInteractionRequest( application_manager, rpc_service, hmi_capabilities, - policy_handle) {} + policy_handle) { + const auto& msg_params = (*message_)[strings::msg_params]; + uint32_t request_timeout = msg_params[strings::timeout].asUInt(); + default_timeout_ += request_timeout; +} VRPerformInteractionRequest::~VRPerformInteractionRequest() {} @@ -59,4 +63,4 @@ void VRPerformInteractionRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_response.cc index dec371e889..16378ab55a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_response.cc @@ -60,4 +60,4 @@ void VRPerformInteractionResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc index 155f819761..a57d222765 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc @@ -31,14 +31,14 @@ POSSIBILITY OF SUCH DAMAGE. */ -#include <string> #include "sdl_rpc_plugin/commands/mobile/add_command_request.h" +#include <string> #include "application_manager/application.h" #include "application_manager/message_helper.h" +#include "utils/custom_string.h" #include "utils/file_system.h" #include "utils/helpers.h" -#include "utils/custom_string.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -126,9 +126,9 @@ void AddCommandRequest::Run() { } if (((*message_)[strings::msg_params][strings::menu_params].keyExists( hmi_request::parent_id)) && - (0 != - (*message_)[strings::msg_params][strings::menu_params] - [hmi_request::parent_id].asUInt())) { + (0 != (*message_)[strings::msg_params][strings::menu_params] + [hmi_request::parent_id] + .asUInt())) { if (!CheckCommandParentId(app)) { SendResponse( false, mobile_apis::Result::INVALID_ID, "Parent ID doesn't exist"); @@ -224,7 +224,8 @@ bool AddCommandRequest::CheckCommandName(ApplicationConstSharedPtr app) { if ((*message_)[strings::msg_params][strings::menu_params].keyExists( hmi_request::parent_id)) { parent_id = (*message_)[strings::msg_params][strings::menu_params] - [hmi_request::parent_id].asUInt(); + [hmi_request::parent_id] + .asUInt(); } for (; commands.end() != i; ++i) { @@ -239,7 +240,8 @@ bool AddCommandRequest::CheckCommandName(ApplicationConstSharedPtr app) { } if (((*i->second)[strings::menu_params][strings::menu_name].asString() == (*message_)[strings::msg_params][strings::menu_params] - [strings::menu_name].asString()) && + [strings::menu_name] + .asString()) && (saved_parent_id == parent_id)) { LOG4CXX_INFO(logger_, "AddCommandRequest::CheckCommandName received" @@ -293,7 +295,8 @@ bool AddCommandRequest::CheckCommandParentId(ApplicationConstSharedPtr app) { const int32_t parent_id = (*message_)[strings::msg_params][strings::menu_params] - [hmi_request::parent_id].asInt(); + [hmi_request::parent_id] + .asInt(); smart_objects::SmartObject* parent = app->FindSubMenu(parent_id); if (!parent) { @@ -524,7 +527,8 @@ bool AddCommandRequest::IsWhiteSpaceExist() { if ((*message_)[strings::msg_params].keyExists(strings::menu_params)) { str = (*message_)[strings::msg_params][strings::menu_params] - [strings::menu_name].asCharArray(); + [strings::menu_name] + .asCharArray(); if (!CheckSyntax(str)) { LOG4CXX_ERROR(logger_, "Invalid menu name syntax check failed."); return true; @@ -624,4 +628,4 @@ void AddCommandRequest::RemoveCommand() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_response.cc index ccb84cecbb..24ff3b5a28 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_response.cc @@ -61,4 +61,4 @@ void AddCommandResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc index 183b445326..89ccfb8bd7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc @@ -33,8 +33,8 @@ #include "sdl_rpc_plugin/commands/mobile/add_sub_menu_request.h" -#include "application_manager/message_helper.h" #include "application_manager/application.h" +#include "application_manager/message_helper.h" #include "utils/helpers.h" namespace sdl_rpc_plugin { @@ -109,15 +109,28 @@ void AddSubMenuRequest::Run() { smart_objects::SmartObject msg_params = smart_objects::SmartObject(smart_objects::SmartType_Map); + if (received_msg_params.keyExists(strings::menu_layout)) { + auto menu_layout = static_cast<mobile_apis::MenuLayout::eType>( + received_msg_params[strings::menu_layout].asUInt()); + if (app->menu_layout_supported(menu_layout)) { + msg_params[strings::menu_layout] = + received_msg_params[strings::menu_layout]; + } else { + is_menu_layout_available_ = false; + } + } + msg_params[strings::menu_id] = received_msg_params[strings::menu_id]; if (received_msg_params.keyExists(strings::position)) { msg_params[strings::menu_params][strings::position] = received_msg_params[strings::position]; } + if (received_msg_params.keyExists(strings::menu_icon)) { + msg_params[strings::menu_icon] = received_msg_params[strings::menu_icon]; + } msg_params[strings::menu_params][strings::menu_name] = received_msg_params[strings::menu_name]; msg_params[strings::app_id] = app->app_id(); - msg_params[strings::menu_icon] = received_msg_params[strings::menu_icon]; StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); SendHMIRequest(hmi_apis::FunctionID::UI_AddSubMenu, &msg_params, true); @@ -150,11 +163,22 @@ void AddSubMenuRequest::on_event(const event_engine::Event& event) { application->AddSubMenu( (*message_)[strings::msg_params][strings::menu_id].asInt(), (*message_)[strings::msg_params]); + response_info = + "The MenuLayout specified is unsupported, the " + "default MenuLayout will be used." + + response_info; + SendResponse(result, + is_menu_layout_available_ + ? MessageHelper::HMIToMobileResult(result_code) + : mobile_apis::Result::WARNINGS, + is_menu_layout_available_ ? NULL : response_info.c_str(), + &(message[strings::msg_params])); + } else { + SendResponse(result, + MessageHelper::HMIToMobileResult(result_code), + response_info.empty() ? NULL : response_info.c_str(), + &(message[strings::msg_params])); } - SendResponse(result, - MessageHelper::HMIToMobileResult(result_code), - response_info.empty() ? NULL : response_info.c_str(), - &(message[strings::msg_params])); break; } default: { @@ -183,4 +207,4 @@ bool AddSubMenuRequest::CheckSubMenuName() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_response.cc index d0ec635dd0..d91f13f1df 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_response.cc @@ -32,8 +32,8 @@ */ #include "sdl_rpc_plugin/commands/mobile/add_sub_menu_response.h" -#include "application_manager/rpc_service.h" #include "application_manager/application_impl.h" +#include "application_manager/rpc_service.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -62,4 +62,4 @@ void AddSubMenuResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc index 5dda34b743..9f36f260ae 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc @@ -25,12 +25,12 @@ POSSIBILITY OF SUCH DAMAGE. */ +#include "sdl_rpc_plugin/commands/mobile/alert_maneuver_request.h" #include <cstring> #include <string> -#include "sdl_rpc_plugin/commands/mobile/alert_maneuver_request.h" #include "application_manager/application_impl.h" -#include "application_manager/policies/policy_handler.h" #include "application_manager/message_helper.h" +#include "application_manager/policies/policy_handler.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -107,9 +107,9 @@ void AlertManeuverRequest::Run() { MessageHelper::VerifyTtsFiles(tts_chunks, app, application_manager_); if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) { - LOG4CXX_ERROR(logger_, - "MessageHelper::VerifyTtsFiles return " - << verification_result); + LOG4CXX_ERROR( + logger_, + "MessageHelper::VerifyTtsFiles return " << verification_result); SendResponse(false, mobile_apis::Result::FILE_NOT_FOUND, "One or more files needed for tts_chunks are not present"); @@ -288,4 +288,4 @@ bool AlertManeuverRequest::IsWhiteSpaceExist() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_response.cc index d3e527f6ae..97c93d7455 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_response.cc @@ -62,4 +62,4 @@ void AlertManeuverResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc index 2806ac1d93..57912e7087 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc @@ -35,12 +35,12 @@ #include <string.h> -#include "application_manager/message_helper.h" #include "application_manager/application_impl.h" +#include "application_manager/message_helper.h" #include "application_manager/policies/policy_handler.h" -#include "utils/helpers.h" #include "smart_objects/smart_object.h" +#include "utils/helpers.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -73,18 +73,15 @@ AlertRequest::~AlertRequest() {} bool AlertRequest::Init() { /* Timeout in milliseconds. - If omitted a standard value of 10000 milliseconds is used.*/ - if ((*message_)[strings::msg_params].keyExists(strings::duration)) { - default_timeout_ = - (*message_)[strings::msg_params][strings::duration].asUInt(); - } else { - const int32_t def_value = 5000; - default_timeout_ = def_value; - } + If omitted a standard value of 10000 milliseconds is used.*/ + auto& msg_params = (*message_)[strings::msg_params]; + uint32_t duration_timeout = msg_params[strings::duration].asUInt(); + + default_timeout_ += duration_timeout; // If soft buttons are present, SDL will not use initiate timeout tracking for // response. - if ((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) { + if (msg_params.keyExists(strings::soft_buttons)) { LOG4CXX_INFO(logger_, "Request contains soft buttons - request timeout " "will be set to 0."); @@ -251,7 +248,8 @@ bool AlertRequest::Validate(uint32_t app_id) { return false; } - if (mobile_apis::HMILevel::HMI_BACKGROUND == app->hmi_level() && + if (mobile_apis::HMILevel::HMI_BACKGROUND == + app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW) && app->AreCommandLimitsExceeded( static_cast<mobile_apis::FunctionID::eType>(function_id()), application_manager::TLimitSource::POLICY_TABLE)) { @@ -298,9 +296,9 @@ bool AlertRequest::Validate(uint32_t app_id) { MessageHelper::VerifyTtsFiles(tts_chunks, app, application_manager_); if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) { - LOG4CXX_ERROR(logger_, - "MessageHelper::VerifyTtsFiles return " - << verification_result); + LOG4CXX_ERROR( + logger_, + "MessageHelper::VerifyTtsFiles return " << verification_result); SendResponse(false, mobile_apis::Result::FILE_NOT_FOUND, "One or more files needed for tts_chunks are not present"); @@ -321,6 +319,11 @@ void AlertRequest::SendAlertRequest(int32_t app_id) { msg_params[hmi_request::alert_strings] = smart_objects::SmartObject(smart_objects::SmartType_Array); + if ((*message_)[strings::msg_params].keyExists(strings::cancel_id)) { + msg_params[strings::cancel_id] = + (*message_)[strings::msg_params][strings::cancel_id].asInt(); + } + int32_t index = 0; if ((*message_)[strings::msg_params].keyExists(strings::alert_text1)) { msg_params[hmi_request::alert_strings][index][hmi_request::field_name] = @@ -349,10 +352,30 @@ void AlertRequest::SendAlertRequest(int32_t app_id) { (*message_)[strings::msg_params][strings::soft_buttons]; MessageHelper::SubscribeApplicationToSoftButton( (*message_)[strings::msg_params], app, function_id()); + msg_params[strings::duration] = 0; + } else { + msg_params[strings::duration] = + (*message_)[strings::msg_params][strings::duration].asUInt(); + } + + if ((*message_)[strings::msg_params].keyExists(strings::alert_icon)) { + auto verification_result = MessageHelper::VerifyImage( + (*message_)[strings::msg_params][strings::alert_icon], + app, + application_manager_); + + if (mobile_apis::Result::INVALID_DATA == verification_result) { + LOG4CXX_ERROR(logger_, "Image verification failed."); + SendResponse(false, verification_result); + return; + } + + msg_params[strings::alert_icon] = + (*message_)[strings::msg_params][strings::alert_icon]; } + // app_id msg_params[strings::app_id] = app_id; - msg_params[strings::duration] = default_timeout_; // NAVI platform progressIndicator if ((*message_)[strings::msg_params].keyExists(strings::progress_indicator)) { @@ -450,4 +473,4 @@ bool AlertRequest::HasHmiResponsesToWait() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_response.cc index bab5e5a5d8..b709d13958 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_response.cc @@ -32,10 +32,10 @@ */ #include "sdl_rpc_plugin/commands/mobile/alert_response.h" -#include "application_manager/rpc_service.h" #include "application_manager/application_impl.h" -#include "interfaces/MOBILE_API.h" +#include "application_manager/rpc_service.h" #include "interfaces/HMI_API.h" +#include "interfaces/MOBILE_API.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -64,4 +64,4 @@ void AlertResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc new file mode 100644 index 0000000000..82e0703da1 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc @@ -0,0 +1,117 @@ + +/* +Copyright (c) 2019, Ford Motor Company, Livio +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. + +Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following +disclaimer in the documentation and/or other materials provided with the +distribution. + +Neither the name of the the copyright holders nor the names of their +contributors may be used to endorse or promote products derived from this +software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "sdl_rpc_plugin/commands/mobile/cancel_interaction_request.h" +#include "application_manager/application_impl.h" +#include "application_manager/message_helper.h" +#include "interfaces/MOBILE_API.h" +#include "utils/helpers.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; +namespace commands { + +CancelInteractionRequest::CancelInteractionRequest( + const application_manager::commands::MessageSharedPtr& message, + 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) {} + +CancelInteractionRequest::~CancelInteractionRequest() {} + +void CancelInteractionRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + auto function_id = static_cast<mobile_apis::FunctionID::eType>( + (*message_)[strings::msg_params][strings::func_id].asInt()); + + if (helpers:: + Compare<mobile_apis::FunctionID::eType, helpers::NEQ, helpers::ALL>( + function_id, + mobile_apis::FunctionID::PerformInteractionID, + mobile_apis::FunctionID::AlertID, + mobile_apis::FunctionID::ScrollableMessageID, + mobile_apis::FunctionID::SliderID)) { + LOG4CXX_ERROR(logger_, "Bad function ID" << function_id); + SendResponse(false, mobile_apis::Result::INVALID_ID); + return; + } + + smart_objects::SmartObject msg_params; + msg_params[strings::app_id] = connection_key(); + msg_params[strings::func_id] = function_id; + + if ((*message_)[strings::msg_params].keyExists(strings::cancel_id)) { + msg_params[strings::cancel_id] = + (*message_)[strings::msg_params][strings::cancel_id].asInt(); + } + + SendHMIRequest(hmi_apis::FunctionID::UI_CancelInteraction, &msg_params, true); +} + +void CancelInteractionRequest::on_event(const event_engine::Event& event) { + LOG4CXX_AUTO_TRACE(logger_); + + if (event.id() != hmi_apis::FunctionID::UI_CancelInteraction) { + LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + return; + } + + auto message = event.smart_object(); + + hmi_apis::Common_Result::eType hmi_result = + static_cast<hmi_apis::Common_Result::eType>( + message[strings::params][hmi_response::code].asInt()); + + mobile_apis::Result::eType result = + MessageHelper::HMIToMobileResult(hmi_result); + bool success = PrepareResultForMobileResponse( + hmi_result, HmiInterfaces::HMI_INTERFACE_UI); + + auto msg_params = message[strings::msg_params]; + + const char* info = msg_params.keyExists(strings::info) + ? msg_params[strings::info].asCharArray() + : NULL; + + SendResponse(success, result, info, &msg_params); +} + +} // namespace commands +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_response.cc new file mode 100644 index 0000000000..af73e72a6f --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_response.cc @@ -0,0 +1,60 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the the copyright holders nor the names of their + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include "sdl_rpc_plugin/commands/mobile/cancel_interaction_response.h" +#include "application_manager/application_impl.h" +#include "interfaces/MOBILE_API.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; +namespace commands { + +CancelInteractionResponse::CancelInteractionResponse( + const application_manager::commands::MessageSharedPtr& message, + 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) {} + +CancelInteractionResponse::~CancelInteractionResponse() {} + +void CancelInteractionResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + rpc_service_.SendMessageToMobile(message_); +} + +} // 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/change_registration_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc index 6af930ea53..50217a9c8a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc @@ -31,14 +31,15 @@ POSSIBILITY OF SUCH DAMAGE. */ +#include "sdl_rpc_plugin/commands/mobile/change_registration_request.h" #include <string.h> #include <algorithm> -#include "sdl_rpc_plugin/commands/mobile/change_registration_request.h" -#include "application_manager/application_manager.h" #include "application_manager/application_impl.h" -#include "interfaces/MOBILE_API.h" -#include "interfaces/HMI_API.h" +#include "application_manager/application_manager.h" #include "application_manager/message_helper.h" +#include "application_manager/policies/policy_handler_interface.h" +#include "interfaces/HMI_API.h" +#include "interfaces/MOBILE_API.h" namespace { namespace custom_str = utils::custom_string; @@ -49,9 +50,9 @@ struct IsSameNickname { } private: - const custom_str::CustomString& app_id_; + const custom_str::CustomString app_id_; }; -} +} // namespace namespace sdl_rpc_plugin { using namespace application_manager; @@ -160,7 +161,7 @@ void ChangeRegistrationRequest::Run() { return; } - if (mobile_apis::Result::SUCCESS != CheckCoincidence()) { + if (mobile_apis::Result::SUCCESS != CheckCoincidence(app->device())) { SendResponse(false, mobile_apis::Result::DUPLICATE_NAME); return; } @@ -194,9 +195,9 @@ void ChangeRegistrationRequest::Run() { MessageHelper::VerifyTtsFiles(tts_name, app, application_manager_); if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) { - LOG4CXX_ERROR(logger_, - "MessageHelper::VerifyTtsFiles return " - << verification_result); + LOG4CXX_ERROR( + logger_, + "MessageHelper::VerifyTtsFiles return " << verification_result); SendResponse(false, mobile_apis::Result::FILE_NOT_FOUND, "One or more files needed for tts_name are not present"); @@ -216,9 +217,9 @@ void ChangeRegistrationRequest::Run() { hmi_interfaces.GetInterfaceState( HmiInterfaces::InterfaceID::HMI_INTERFACE_TTS); + using helpers::ALL; using helpers::Compare; using helpers::EQ; - using helpers::ALL; if (Compare<HmiInterfaces::InterfaceState, EQ, ALL>( HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE, @@ -578,36 +579,46 @@ bool ChangeRegistrationRequest::IsWhiteSpaceExist() { return false; } -mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence() { +mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence( + const connection_handler::DeviceHandle& device_id) { LOG4CXX_AUTO_TRACE(logger_); const smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; - ApplicationSet accessor = application_manager_.applications().GetData(); + auto compare_tts_name = [](const smart_objects::SmartObject& obj_1, + const smart_objects::SmartObject& obj_2) { + return obj_1[application_manager::strings::text] + .asCustomString() + .CompareIgnoreCase( + obj_2[application_manager::strings::text].asCustomString()); + }; + + const auto& accessor = application_manager_.applications().GetData(); custom_str::CustomString app_name; - uint32_t app_id = connection_key(); + const uint32_t app_id = connection_key(); if (msg_params.keyExists(strings::app_name)) { app_name = msg_params[strings::app_name].asCustomString(); } - ApplicationSetConstIt it = accessor.begin(); - for (; accessor.end() != it; ++it) { - if (app_id == (*it)->app_id()) { + for (const auto& app : accessor) { + if (app->device() != device_id) { + continue; + } + + if (app->app_id() == app_id) { continue; } - const custom_str::CustomString& cur_name = (*it)->name(); + const auto& cur_name = app->name(); if (msg_params.keyExists(strings::app_name)) { if (app_name.CompareIgnoreCase(cur_name)) { LOG4CXX_ERROR(logger_, "Application name is known already."); return mobile_apis::Result::DUPLICATE_NAME; } - - const smart_objects::SmartObject* vr = (*it)->vr_synonyms(); - const std::vector<smart_objects::SmartObject>* curr_vr = NULL; - if (NULL != vr) { - curr_vr = vr->asArray(); + const auto vr = app->vr_synonyms(); + if (vr) { + const auto curr_vr = vr->asArray(); CoincidencePredicateVR v(app_name); if (0 != std::count_if(curr_vr->begin(), curr_vr->end(), v)) { @@ -617,18 +628,37 @@ mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence() { } } - // vr check + // VR check if (msg_params.keyExists(strings::vr_synonyms)) { - const std::vector<smart_objects::SmartObject>* new_vr = - msg_params[strings::vr_synonyms].asArray(); + const auto new_vr = msg_params[strings::vr_synonyms].asArray(); CoincidencePredicateVR v(cur_name); if (0 != std::count_if(new_vr->begin(), new_vr->end(), v)) { LOG4CXX_ERROR(logger_, "vr_synonyms duplicated with app_name ."); return mobile_apis::Result::DUPLICATE_NAME; } - } // end vr check - } // application for end + } // End vr check + + // TTS check + if (msg_params.keyExists(strings::tts_name) && app->tts_name()) { + const auto tts_array = msg_params[strings::tts_name].asArray(); + const auto tts_curr = app->tts_name()->asArray(); + const auto& it_tts = std::find_first_of(tts_array->begin(), + tts_array->end(), + tts_curr->begin(), + tts_curr->end(), + compare_tts_name); + if (it_tts != tts_array->end()) { + LOG4CXX_ERROR( + logger_, + "TTS name: " + << (*it_tts)[strings::text].asCustomString().AsMBString() + << " is known already"); + return mobile_apis::Result::DUPLICATE_NAME; + } + } // End tts check + + } // Application for end return mobile_apis::Result::SUCCESS; } @@ -638,9 +668,9 @@ bool ChangeRegistrationRequest::IsNicknameAllowed( ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, - "Can't find appication with connection key " - << connection_key()); + LOG4CXX_ERROR( + logger_, + "Can't find appication with connection key " << connection_key()); return false; } @@ -681,4 +711,4 @@ bool ChangeRegistrationRequest::IsNicknameAllowed( } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_response.cc index 2dae92cd9b..78c60bc746 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_response.cc @@ -61,4 +61,4 @@ void ChangeRegistrationResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc new file mode 100644 index 0000000000..275f1d82a6 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc @@ -0,0 +1,119 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the the copyright holders nor the names of their + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include "sdl_rpc_plugin/commands/mobile/close_application_request.h" +#include "application_manager/application_impl.h" +#include "application_manager/message_helper.h" +#include "interfaces/MOBILE_API.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; +namespace commands { + +CloseApplicationRequest::CloseApplicationRequest( + const application_manager::commands::MessageSharedPtr& message, + 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) {} + +CloseApplicationRequest::~CloseApplicationRequest() {} + +void CloseApplicationRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + ApplicationSharedPtr app = application_manager_.application(connection_key()); + + if (app.use_count() == 0) { + LOG4CXX_ERROR(logger_, "Application does not exist"); + SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); + return; + } + + smart_objects::SmartObject msg_params; + msg_params[strings::app_id] = connection_key(); + SendHMIRequest(hmi_apis::FunctionID::BasicCommunication_CloseApplication, + &msg_params, + true); +} + +void CloseApplicationRequest::on_event(const event_engine::Event& event) { + LOG4CXX_AUTO_TRACE(logger_); + const smart_objects::SmartObject& message = event.smart_object(); + + auto msg_params = message[strings::msg_params]; + + hmi_apis::Common_Result::eType hmi_result = + static_cast<hmi_apis::Common_Result::eType>( + message[strings::params][hmi_response::code].asInt()); + + mobile_apis::Result::eType result = + MessageHelper::HMIToMobileResult(hmi_result); + bool success = PrepareResultForMobileResponse( + hmi_result, HmiInterfaces::HMI_INTERFACE_BasicCommunication); + if (success) { + ApplicationSharedPtr app = + application_manager_.application(connection_key()); + + if (app.use_count() == 0) { + LOG4CXX_ERROR(logger_, "Application does not exist"); + SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); + return; + } + + auto on_app_exit = [app](plugin_manager::RPCPlugin& plugin) { + plugin.OnApplicationEvent(plugin_manager::kApplicationExit, app); + }; + + application_manager_.GetPluginManager().ForEachPlugin(on_app_exit); + application_manager_.state_controller().SetRegularState( + app, + mobile_apis::PredefinedWindows::DEFAULT_WINDOW, + mobile_apis::HMILevel::HMI_NONE, + mobile_apis::AudioStreamingState::NOT_AUDIBLE, + mobile_apis::VideoStreamingState::NOT_STREAMABLE, + false); + } + + const char* info = msg_params.keyExists(strings::info) + ? msg_params[strings::info].asCharArray() + : NULL; + + SendResponse(success, result, info, &msg_params); +} + +} // namespace commands +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_response.cc new file mode 100644 index 0000000000..934804e1b1 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_response.cc @@ -0,0 +1,61 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the the copyright holders nor the names of their + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include "sdl_rpc_plugin/commands/mobile/close_application_response.h" +#include "application_manager/application_impl.h" +#include "interfaces/MOBILE_API.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; +namespace commands { + +CloseApplicationResponse::CloseApplicationResponse( + const application_manager::commands::MessageSharedPtr& message, + 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) {} + +CloseApplicationResponse::~CloseApplicationResponse() {} + +void CloseApplicationResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + rpc_service_.SendMessageToMobile(message_); +} + +} // namespace commands +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc index 416f4f2085..258aefd63f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc @@ -31,11 +31,11 @@ POSSIBILITY OF SUCH DAMAGE. */ -#include <string> -#include <cstring> +#include "sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h" #include <algorithm> +#include <cstring> +#include <string> #include <vector> -#include "sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h" #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" @@ -218,9 +218,9 @@ bool CreateInteractionChoiceSetRequest::compareSynonyms( CreateInteractionChoiceSetRequest::compareStr); if (it != vr_cmds_1->end()) { - LOG4CXX_INFO(logger_, - "Incoming choice set has duplicated VR synonyms " - << it->asString()); + LOG4CXX_INFO( + logger_, + "Incoming choice set has duplicated VR synonyms " << it->asString()); return true; } @@ -332,9 +332,9 @@ void CreateInteractionChoiceSetRequest::SendVRAddCommandRequests( VRCommandInfo vr_command(vr_cmd_id); sent_commands_map_[vr_corr_id] = vr_command; - LOG4CXX_DEBUG(logger_, - "VR_command sent corr_id " << vr_corr_id << " cmd_id " - << vr_corr_id); + LOG4CXX_DEBUG( + logger_, + "VR_command sent corr_id " << vr_corr_id << " cmd_id " << vr_corr_id); } expected_chs_count_ = chs_num; LOG4CXX_DEBUG(logger_, "expected_chs_count_ = " << expected_chs_count_); @@ -480,4 +480,4 @@ void CreateInteractionChoiceSetRequest::OnAllHMIResponsesReceived() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_response.cc index 807770ed12..43dba2f238 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_response.cc @@ -72,4 +72,4 @@ void CreateInteractionChoiceSetResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc new file mode 100644 index 0000000000..b69b0ee801 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc @@ -0,0 +1,376 @@ +/* + Copyright (c) 2019, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include "sdl_rpc_plugin/commands/mobile/create_window_request.h" + +#include <algorithm> + +#include "application_manager/application_impl.h" +#include "application_manager/application_state.h" +#include "application_manager/message_helper.h" +#include "utils/helpers.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; +using app_mngr::ApplicationSharedPtr; + +namespace commands { + +CreateWindowRequest::CreateWindowRequest( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : CommandRequestImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +CreateWindowRequest::~CreateWindowRequest() {} + +bool CreateWindowRequest::CheckWindowName( + app_mngr::ApplicationSharedPtr app, + const app_mngr::WindowID window_id, + const std::string& window_name) const { + if (mobile_apis::PredefinedWindows::PRIMARY_WIDGET == window_id) { + LOG4CXX_DEBUG(logger_, + "Window name check is ignored for the primary widgets"); + return true; + } + + const bool names_are_equal = window_name == app->name().c_str(); + if (names_are_equal && + mobile_apis::PredefinedWindows::DEFAULT_WINDOW != window_id) { + LOG4CXX_ERROR(logger_, + "Regular widget can't have the same name as application: " + << window_name); + return false; + } + + const WindowNames window_names = app->GetWindowNames(); + return !helpers::in_range(window_names, window_name); +} + +void CreateWindowRequest::ApplyWindowInitialState( + ApplicationSharedPtr app) const { + const mobile_apis::WindowType::eType window_type = + static_cast<mobile_apis::WindowType::eType>( + (*message_)[strings::msg_params][strings::window_type].asInt()); + + // State should be initialized with INVALID_ENUM value to let state controller + // trigger OnHmiStatus notifiation sending + HmiStatePtr initial_state = application_manager_.CreateRegularState( + app, + window_type, + mobile_apis::HMILevel::INVALID_ENUM, + mobile_apis::AudioStreamingState::INVALID_ENUM, + mobile_apis::VideoStreamingState::INVALID_ENUM, + mobile_api::SystemContext::INVALID_ENUM); + + const WindowID window_id = + (*message_)[strings::msg_params][strings::window_id].asInt(); + const std::string window_name = + (*message_)[strings::msg_params][strings::window_name].asString(); + + smart_objects::SmartObject window_info(smart_objects::SmartType_Map); + if ((*message_)[strings::msg_params].keyExists( + strings::associated_service_type)) { + window_info[strings::associated_service_type] = + (*message_)[strings::msg_params][strings::associated_service_type]; + } + if ((*message_)[strings::msg_params].keyExists( + strings::duplicate_updates_from_window_id)) { + window_info[strings::duplicate_updates_from_window_id] = + (*message_)[strings::msg_params] + [strings::duplicate_updates_from_window_id]; + } + + window_info[strings::window_name] = window_name; + + app->SetWindowInfo(window_id, window_info); + + app->SetInitialState(window_id, window_name, initial_state); + + // Default HMI level for all windows except the main one is always NONE + application_manager_.state_controller().OnAppWindowAdded( + app, window_id, window_type, mobile_apis::HMILevel::HMI_NONE); +} + +app_mngr::WindowID CreateWindowRequest::window_id() const { + return mobile_apis::PredefinedWindows::DEFAULT_WINDOW; +} + +void CreateWindowRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + const auto application = application_manager_.application(connection_key()); + + if (!application) { + LOG4CXX_ERROR(logger_, "Application is not registered"); + SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); + return; + } + + const auto window_id = + (*message_)[strings::msg_params][strings::window_id].asInt(); + if (application->WindowIdExists(window_id)) { + LOG4CXX_ERROR(logger_, + "Window with id #" << window_id << " does already exist"); + SendResponse(false, mobile_apis::Result::INVALID_ID); + return; + } + + const auto window_type = + (*message_)[strings::msg_params][strings::window_type].asInt(); + + if (mobile_apis::WindowType::eType::MAIN == window_type) { + LOG4CXX_ERROR(logger_, "MAIN application window already exists"); + SendResponse(false, mobile_apis::Result::INVALID_DATA); + return; + } + + if ((*message_)[strings::msg_params].keyExists( + strings::duplicate_updates_from_window_id)) { + const auto duplicate_updates_from_window_id = + (*message_)[strings::msg_params] + [strings::duplicate_updates_from_window_id] + .asInt(); + if (!application->WindowIdExists(duplicate_updates_from_window_id)) { + LOG4CXX_ERROR(logger_, + "Window with id #" << duplicate_updates_from_window_id + << " does not exist"); + SendResponse(false, mobile_apis::Result::INVALID_DATA); + return; + } + } + + const std::string window_name = + (*message_)[strings::msg_params][strings::window_name].asString(); + if (!CheckWindowName(application, window_id, window_name)) { + LOG4CXX_ERROR(logger_, + "Window name \"" << window_name + << "\" is disallowed for window #" + << window_id); + SendResponse(false, mobile_apis::Result::DUPLICATE_NAME); + return; + } + + if (!ValidateWindowCreation(application, window_id)) { + return; + } + + smart_objects::SmartObject msg_params = (*message_)[strings::msg_params]; + msg_params[strings::app_id] = application->hmi_app_id(); + + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); + SendHMIRequest(hmi_apis::FunctionID::UI_CreateWindow, &msg_params, true); +} + +void CreateWindowRequest::on_event(const event_engine::Event& event) { + LOG4CXX_AUTO_TRACE(logger_); + + if (hmi_apis::FunctionID::UI_CreateWindow != event.id()) { + LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + return; + } + + auto application = application_manager_.application(connection_key()); + + if (!application) { + LOG4CXX_ERROR(logger_, "Application is not registered"); + SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); + return; + } + + LOG4CXX_INFO(logger_, "Received CreateWindow event"); + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); + + const smart_objects::SmartObject& response_message = event.smart_object(); + const auto result_code = CommandRequestImpl::GetMobileResultCode( + static_cast<hmi_apis::Common_Result::eType>( + response_message[strings::params][hmi_response::code].asInt())); + + const bool is_success = IsMobileResultSuccess(result_code); + std::string response_info; + GetInfo(response_message, response_info); + + if (!is_success) { + LOG4CXX_ERROR(logger_, "CreateWindow request has failed on HMI side"); + SendResponse(is_success, + result_code, + response_info.empty() ? nullptr : response_info.c_str()); + return; + } + + ApplyWindowInitialState(application); + + SendResponse(is_success, + result_code, + response_info.empty() ? nullptr : response_info.c_str()); +} + +bool CreateWindowRequest::Init() { + hash_update_mode_ = HashUpdateMode::kDoHashUpdate; + return true; +} + +bool CreateWindowRequest::IsWindowForAssociatedServiceCreated( + app_mngr::ApplicationSharedPtr app) const { + LOG4CXX_AUTO_TRACE(logger_); + + const auto window_optional_params_map = + app->window_optional_params_map().GetData(); + + if (!(*message_)[strings::msg_params].keyExists( + strings::associated_service_type)) { + return false; + } + + const auto associated_service_type = + (*message_)[strings::msg_params][strings::associated_service_type] + .asString(); + + const auto find_res = std::find_if( + window_optional_params_map.begin(), + window_optional_params_map.end(), + [&associated_service_type]( + const std::pair<WindowID, smart_objects::SmartObjectSPtr>& element) { + LOG4CXX_DEBUG(logger_, + "Searching for " << associated_service_type + << " in window info for id " + << element.first); + if (element.second->keyExists(strings::associated_service_type) && + associated_service_type == + (*element.second)[strings::associated_service_type] + .asString()) { + return true; + } + + return false; + }); + + return find_res != window_optional_params_map.end(); +} + +bool CreateWindowRequest::DoesExceedMaxAllowedWindows( + app_mngr::ApplicationSharedPtr app) const { + LOG4CXX_AUTO_TRACE(logger_); + + auto get_current_number_of_windows = + [&app](const mobile_apis::WindowType::eType window_type) -> size_t { + switch (window_type) { + case mobile_apis::WindowType::MAIN: { + return 1u; + } + case mobile_apis::WindowType::WIDGET: { + return app->window_optional_params_map().GetData().size(); + } + + default: { + LOG4CXX_WARN(logger_, "Unknown window type"); + return 0u; + } + } + }; + + const auto window_type = static_cast<mobile_apis::WindowType::eType>( + (*message_)[strings::msg_params][strings::window_type].asInt()); + + auto display_capabilities = hmi_capabilities_.system_display_capabilities(); + if (app->display_capabilities()) { + display_capabilities = app->display_capabilities(); + } + + if (!display_capabilities) { + LOG4CXX_WARN(logger_, "Application has no capabilities"); + return false; + } + + MessageHelper::PrintSmartObject(*display_capabilities); + + const auto windowTypeSupported = + (*display_capabilities)[0][strings::window_type_supported].asArray(); + + DCHECK(windowTypeSupported); + + const auto find_res = std::find_if( + windowTypeSupported->begin(), + windowTypeSupported->end(), + [&window_type](const smart_objects::SmartObject& element) { + if (window_type == static_cast<mobile_apis::WindowType::eType>( + element[strings::window_type].asInt())) { + return true; + } + + return false; + }); + + if (find_res == windowTypeSupported->end()) { + LOG4CXX_WARN(logger_, "Requested Window Type is not supported by the HMI"); + return true; + } + + if (get_current_number_of_windows(window_type) + 1 > + (*find_res)[strings::maximum_number_of_windows].asUInt()) { + return true; + } + + return false; +} + +bool CreateWindowRequest::ValidateWindowCreation( + app_mngr::ApplicationSharedPtr app, const WindowID window_id) { + LOG4CXX_AUTO_TRACE(logger_); + + if (DoesExceedMaxAllowedWindows(app)) { + std::string info("Maximum allowed amount of windows is exceeded"); + LOG4CXX_WARN(logger_, info); + SendResponse(false, mobile_apis::Result::REJECTED, info.c_str()); + return false; + } + + if (IsWindowForAssociatedServiceCreated(app)) { + std::string info( + "Window for this associated service type is already created"); + LOG4CXX_WARN(logger_, info); + SendResponse(false, mobile_apis::Result::REJECTED, info.c_str()); + return false; + } + + return true; +} + +} // namespace commands + +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_response.cc new file mode 100644 index 0000000000..0d9bbc2815 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_response.cc @@ -0,0 +1,64 @@ +/* + + Copyright (c) 2019, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include "sdl_rpc_plugin/commands/mobile/create_window_response.h" +#include "application_manager/rpc_service.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; + +namespace commands { + +CreateWindowResponse::CreateWindowResponse( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : CommandResponseImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +CreateWindowResponse::~CreateWindowResponse() {} + +void CreateWindowResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + rpc_service_.SendMessageToMobile(message_); +} + +} // namespace commands + +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc index 38069c341e..363b14f92f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc @@ -35,8 +35,8 @@ #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" -#include "interfaces/MOBILE_API.h" #include "interfaces/HMI_API.h" +#include "interfaces/MOBILE_API.h" #include "utils/helpers.h" namespace sdl_rpc_plugin { @@ -204,8 +204,9 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) { if (!command) { LOG4CXX_ERROR(logger_, - "Command id " << cmd_id << " not found for " - "application with connection key " + "Command id " << cmd_id + << " not found for " + "application with connection key " << connection_key()); return; } @@ -232,4 +233,4 @@ bool DeleteCommandRequest::IsPendingResponseExist() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_response.cc index 8f85d50e28..919385ee50 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_response.cc @@ -61,4 +61,4 @@ void DeleteCommandResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc index cf8a6d259f..46af8353b7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc @@ -68,7 +68,9 @@ void DeleteFileRequest::Run() { return; } - if ((mobile_api::HMILevel::HMI_NONE == application->hmi_level()) && + if ((mobile_api::HMILevel::HMI_NONE == + application->hmi_level( + mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) && (application_manager_.get_settings().delete_file_in_none() <= application->delete_file_in_none_count())) { // If application is in the HMI_NONE level the quantity of allowed @@ -129,4 +131,4 @@ void DeleteFileRequest::SendFileRemovedNotification( } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_response.cc index 66c61c9e4a..732a1e56b5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_response.cc @@ -72,4 +72,4 @@ void DeleteFileResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc index a9db3975db..7950595b1c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc @@ -34,9 +34,9 @@ #include "sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_request.h" #include "application_manager/application_impl.h" -#include "interfaces/MOBILE_API.h" -#include "interfaces/HMI_API.h" #include "application_manager/message_helper.h" +#include "interfaces/HMI_API.h" +#include "interfaces/MOBILE_API.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -63,9 +63,9 @@ void DeleteInteractionChoiceSetRequest::Run() { ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, - "No application associated with connection key " - << connection_key()); + LOG4CXX_ERROR( + logger_, + "No application associated with connection key " << connection_key()); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -165,4 +165,4 @@ void DeleteInteractionChoiceSetRequest::SendVrDeleteCommand( } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_response.cc index 18ca60f255..cf5ad3a2c2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_response.cc @@ -34,8 +34,8 @@ #include "sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_response.h" #include "application_manager/application_impl.h" -#include "interfaces/MOBILE_API.h" #include "interfaces/HMI_API.h" +#include "interfaces/MOBILE_API.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -81,4 +81,4 @@ void DeleteInteractionChoiceSetResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc index 9a01163702..6aaa2406e8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc @@ -33,8 +33,8 @@ #include "sdl_rpc_plugin/commands/mobile/delete_sub_menu_request.h" -#include "application_manager/message_helper.h" #include "application_manager/application_impl.h" +#include "application_manager/message_helper.h" #include "interfaces/HMI_API.h" #include "utils/helpers.h" @@ -200,4 +200,4 @@ bool DeleteSubMenuRequest::Init() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_response.cc index 6831a66e1e..3cefef5c38 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_response.cc @@ -61,4 +61,4 @@ void DeleteSubMenuResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc new file mode 100644 index 0000000000..7f253e25fd --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc @@ -0,0 +1,162 @@ +/* + Copyright (c) 2019, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include "sdl_rpc_plugin/commands/mobile/delete_window_request.h" + +#include <algorithm> + +namespace sdl_rpc_plugin { +using namespace application_manager; + +namespace commands { + +DeleteWindowRequest::DeleteWindowRequest( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : CommandRequestImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +DeleteWindowRequest::~DeleteWindowRequest() {} + +bool DeleteWindowRequest::CheckWindowId( + app_mngr::ApplicationSharedPtr app) const { + const WindowID window_id = + (*message_)[strings::msg_params][strings::window_id].asInt(); + if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW == window_id) { + LOG4CXX_ERROR(logger_, "Main application window can't be deleted"); + return false; + } + + if (!app->WindowIdExists(window_id)) { + LOG4CXX_ERROR(logger_, + "Window with id #" << window_id << " does not exist"); + return false; + } + + return true; +} + +app_mngr::WindowID DeleteWindowRequest::window_id() const { + return mobile_apis::PredefinedWindows::DEFAULT_WINDOW; +} + +void DeleteWindowRequest::DeleteWindow( + app_mngr::ApplicationSharedPtr app) const { + const WindowID window_id = + (*message_)[strings::msg_params][strings::window_id].asInt(); + app->RemoveWindowInfo(window_id); + app->RemoveHMIState(window_id, HmiState::StateID::STATE_ID_REGULAR); + app->remove_window_capability(window_id); +} + +void DeleteWindowRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + ApplicationSharedPtr application = + application_manager_.application(connection_key()); + + if (!application) { + LOG4CXX_ERROR(logger_, "Application is not registered"); + SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); + return; + } + + if (!CheckWindowId(application)) { + SendResponse(false, mobile_apis::Result::INVALID_ID); + return; + } + + smart_objects::SmartObject msg_params = (*message_)[strings::msg_params]; + msg_params[strings::app_id] = application->hmi_app_id(); + + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); + SendHMIRequest(hmi_apis::FunctionID::UI_DeleteWindow, &msg_params, true); +} + +void DeleteWindowRequest::on_event(const event_engine::Event& event) { + LOG4CXX_AUTO_TRACE(logger_); + + if (hmi_apis::FunctionID::UI_DeleteWindow != event.id()) { + LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + return; + } + + ApplicationSharedPtr application = + application_manager_.application(connection_key()); + + if (!application) { + LOG4CXX_ERROR(logger_, "Application is not registered"); + SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); + return; + } + + LOG4CXX_INFO(logger_, "Received DeleteWindow event"); + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); + + const smart_objects::SmartObject& response_message = event.smart_object(); + const auto result_code = CommandRequestImpl::GetMobileResultCode( + static_cast<hmi_apis::Common_Result::eType>( + response_message[strings::params][hmi_response::code].asInt())); + + const bool is_success = IsMobileResultSuccess(result_code); + std::string response_info; + GetInfo(response_message, response_info); + + if (!is_success) { + LOG4CXX_ERROR(logger_, "DeleteWindow request has failed on HMI side"); + SendResponse(is_success, + result_code, + response_info.empty() ? nullptr : response_info.c_str()); + return; + } + + DeleteWindow(application); + + SendResponse(is_success, + result_code, + response_info.empty() ? nullptr : response_info.c_str()); +} + +bool DeleteWindowRequest::Init() { + hash_update_mode_ = HashUpdateMode::kDoHashUpdate; + return true; +} + +} // namespace commands + +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_response.cc new file mode 100644 index 0000000000..f9ac9a46d6 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_response.cc @@ -0,0 +1,64 @@ +/* + + Copyright (c) 2019, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include "sdl_rpc_plugin/commands/mobile/delete_window_response.h" +#include "application_manager/rpc_service.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; + +namespace commands { + +DeleteWindowResponse::DeleteWindowResponse( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : CommandResponseImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +DeleteWindowResponse::~DeleteWindowResponse() {} + +void DeleteWindowResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + rpc_service_.SendMessageToMobile(message_); +} + +} // namespace commands + +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_request.cc index ee0297ded6..1de7a3ea03 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_request.cc @@ -30,9 +30,9 @@ POSSIBILITY OF SUCH DAMAGE. */ +#include "sdl_rpc_plugin/commands/mobile/dial_number_request.h" #include <algorithm> #include <string> -#include "sdl_rpc_plugin/commands/mobile/dial_number_request.h" #include "application_manager/application_impl.h" @@ -153,4 +153,4 @@ void DialNumberRequest::StripNumberParam(std::string& number) { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_response.cc index a264f96e0d..4385b3fe90 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_response.cc @@ -60,4 +60,4 @@ void DialNumberResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_request.cc index 3650a8226c..66ff7b48d5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_request.cc @@ -97,4 +97,4 @@ void EndAudioPassThruRequest::on_event(const event_engine::Event& event) { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_response.cc index f9f9f89d11..6c9bd05e09 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_response.cc @@ -61,4 +61,4 @@ void EndAudioPassThruResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/generic_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/generic_response.cc index b0715225e4..fda6cc64e5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/generic_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/generic_response.cc @@ -63,4 +63,4 @@ void GenericResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc index 34ed30c243..0b7e611e59 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc @@ -1,4 +1,5 @@ #include "sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h" +#include "application_manager/policies/policy_handler_interface.h" namespace sdl_rpc_plugin { using namespace application_manager; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_response.cc index 813a9e7006..f50897303a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_response.cc @@ -1,6 +1,6 @@ +#include "sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_response.h" #include "application_manager/application_manager.h" #include "application_manager/rpc_service.h" -#include "sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_response.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -28,4 +28,4 @@ void GetCloudAppPropertiesResponse::Run() { } } // namespace commands -} // namespace sdl_rpc_plugins +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc index a582670426..75263494c2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc @@ -32,20 +32,20 @@ #include "sdl_rpc_plugin/commands/mobile/get_file_request.h" +#include <boost/crc.hpp> #include "application_manager/app_service_manager.h" #include "application_manager/application_impl.h" +#include "application_manager/message_helper.h" #include "application_manager/rpc_service.h" #include "interfaces/MOBILE_API.h" -#include "application_manager/message_helper.h" #include "utils/file_system.h" -#include <boost/crc.hpp> namespace { /** -* Calculates CRC32 checksum -* @param binary_data - input data for which CRC32 should be calculated -* @return calculated CRC32 checksum -*/ + * Calculates CRC32 checksum + * @param binary_data - input data for which CRC32 should be calculated + * @return calculated CRC32 checksum + */ uint32_t GetCrc32CheckSum(const std::vector<uint8_t>& binary_data) { const std::size_t file_size = binary_data.size(); boost::crc_32_type result; @@ -195,9 +195,9 @@ void GetFileRequest::Run() { } if (offset_ > file_size) { - LOG4CXX_ERROR(logger_, - "Offset " << offset_ << " greater than file size " - << file_size); + LOG4CXX_ERROR( + logger_, + "Offset " << offset_ << " greater than file size " << file_size); SendResponse(false, mobile_apis::Result::INVALID_DATA, "Offset greater than file size", @@ -309,9 +309,9 @@ void GetFileRequest::on_event(const app_mngr::event_engine::Event& event) { } if (offset_ > file_size) { - LOG4CXX_ERROR(logger_, - "Offset " << offset_ << " greater than file size " - << file_size); + LOG4CXX_ERROR( + logger_, + "Offset " << offset_ << " greater than file size " << file_size); SendResponse(false, mobile_apis::Result::INVALID_DATA, "Offset greater than file size", diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc index 5c6839660f..6121747ccc 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc @@ -32,10 +32,10 @@ #include "sdl_rpc_plugin/commands/mobile/get_system_capability_request.h" -#include "sdl_rpc_plugin/extensions/system_capability_app_extension.h" +#include <set> #include "application_manager/app_service_manager.h" #include "application_manager/message_helper.h" -#include <set> +#include "sdl_rpc_plugin/extensions/system_capability_app_extension.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -133,6 +133,17 @@ void GetSystemCapabilityRequest::Run() { } break; } + case mobile_apis::SystemCapabilityType::SEAT_LOCATION: { + if (hmi_capabilities.seat_location_capability()) { + response_params[strings::system_capability] + [strings::seat_location_capability] = + *hmi_capabilities.seat_location_capability(); + } else { + SendResponse(false, mobile_apis::Result::DATA_NOT_AVAILABLE); + return; + } + break; + } case mobile_apis::SystemCapabilityType::VIDEO_STREAMING: if (hmi_capabilities.video_streaming_capability()) { response_params[strings::system_capability] @@ -146,9 +157,26 @@ void GetSystemCapabilityRequest::Run() { case mobile_apis::SystemCapabilityType::APP_SERVICES: { auto all_services = application_manager_.GetAppServiceManager().GetAllServiceRecords(); - response_params - [strings::system_capability][strings::app_services_capabilities] = - MessageHelper::CreateAppServiceCapabilities(all_services); + response_params[strings::system_capability] + [strings::app_services_capabilities] = + MessageHelper::CreateAppServiceCapabilities( + all_services); + break; + } + case mobile_apis::SystemCapabilityType::DISPLAYS: { + auto capabilities = hmi_capabilities.system_display_capabilities(); + if (app->display_capabilities()) { + capabilities = app->display_capabilities(); + } + + if (!capabilities) { + SendResponse(false, mobile_apis::Result::DATA_NOT_AVAILABLE); + LOG4CXX_INFO(logger_, "system_display_capabilities are not available"); + return; + } + + response_params[strings::system_capability] + [strings::display_capabilities] = *capabilities; break; } default: // Return unsupported resource @@ -156,22 +184,33 @@ void GetSystemCapabilityRequest::Run() { return; } - if ((*message_)[app_mngr::strings::msg_params].keyExists( - strings::subscribe)) { - auto& ext = SystemCapabilityAppExtension::ExtractExtension(*app); - if ((*message_)[app_mngr::strings::msg_params][strings::subscribe] - .asBool() == true) { - LOG4CXX_DEBUG(logger_, - "Subscribe to system capability: " << response_type); - ext.SubscribeTo(response_type); - } else { - LOG4CXX_DEBUG(logger_, - "Unsubscribe from system capability: " << response_type); - ext.UnsubscribeFrom(response_type); + const char* info = nullptr; + // Ignore subscription/unsubscription for DISPLAYS type + if (mobile_apis::SystemCapabilityType::DISPLAYS != response_type) { + if ((*message_)[app_mngr::strings::msg_params].keyExists( + strings::subscribe)) { + auto& ext = SystemCapabilityAppExtension::ExtractExtension(*app); + if ((*message_)[app_mngr::strings::msg_params][strings::subscribe] + .asBool() == true) { + LOG4CXX_DEBUG(logger_, + "Subscribe to system capability: " << response_type); + ext.SubscribeTo(response_type); + } else { + LOG4CXX_DEBUG(logger_, + "Unsubscribe from system capability: " << response_type); + ext.UnsubscribeFrom(response_type); + } + } + } else { + if ((*message_)[app_mngr::strings::msg_params].keyExists( + strings::subscribe)) { + info = + "Subscribe parameter is ignored. Auto Subscription/Unsubscription is " + "used for DISPLAY capability type."; } } - SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &response_params); + SendResponse(true, mobile_apis::Result::SUCCESS, info, &response_params); } void GetSystemCapabilityRequest::on_event(const event_engine::Event& event) { @@ -179,4 +218,4 @@ void GetSystemCapabilityRequest::on_event(const event_engine::Event& event) { } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_response.cc index dd5461081c..5df0c72607 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_response.cc @@ -30,9 +30,9 @@ POSSIBILITY OF SUCH DAMAGE. */ +#include "sdl_rpc_plugin/commands/mobile/get_system_capability_response.h" #include "application_manager/application_manager.h" #include "application_manager/rpc_service.h" -#include "sdl_rpc_plugin/commands/mobile/get_system_capability_response.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -61,4 +61,4 @@ void GetSystemCapabilityResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc index 7dc9eb9ad9..cd7d7a37b7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc @@ -30,8 +30,8 @@ POSSIBILITY OF SUCH DAMAGE. */ -#include "application_manager/application_manager.h" #include "sdl_rpc_plugin/commands/mobile/get_way_points_request.h" +#include "application_manager/application_manager.h" #include "application_manager/message_helper.h" namespace sdl_rpc_plugin { @@ -113,4 +113,4 @@ void GetWayPointsRequest::on_event(const event_engine::Event& event) { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_response.cc index 7581990273..e481c926b8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_response.cc @@ -30,8 +30,8 @@ POSSIBILITY OF SUCH DAMAGE. */ -#include "application_manager/application_manager.h" #include "sdl_rpc_plugin/commands/mobile/get_way_points_response.h" +#include "application_manager/application_manager.h" #include "application_manager/rpc_service.h" namespace sdl_rpc_plugin { @@ -61,4 +61,4 @@ void GetWayPointsResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc index e671dab463..b8714b4784 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc @@ -31,8 +31,8 @@ POSSIBILITY OF SUCH DAMAGE. */ -#include <string> #include "sdl_rpc_plugin/commands/mobile/list_files_request.h" +#include <string> #include "application_manager/application_impl.h" @@ -70,7 +70,9 @@ void ListFilesRequest::Run() { return; } - if ((mobile_api::HMILevel::HMI_NONE == application->hmi_level()) && + if ((mobile_api::HMILevel::HMI_NONE == + application->hmi_level( + mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) && (application_manager_.get_settings().list_files_in_none() <= application->list_files_in_none_count())) { // If application is in the HMI_NONE level the quantity of allowed @@ -112,4 +114,4 @@ void ListFilesRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_response.cc index d025f05358..ffa8a443d5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_response.cc @@ -32,8 +32,8 @@ */ #include "sdl_rpc_plugin/commands/mobile/list_files_response.h" -#include "application_manager/rpc_service.h" #include "application_manager/application_impl.h" +#include "application_manager/rpc_service.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -62,4 +62,4 @@ void ListFilesResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_app_interface_unregistered_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_app_interface_unregistered_notification.cc index 128ce1e3bf..5714043a51 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_app_interface_unregistered_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_app_interface_unregistered_notification.cc @@ -60,4 +60,4 @@ void OnAppInterfaceUnregisteredNotification::Run() { SendNotification(); } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_audio_pass_thru_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_audio_pass_thru_notification.cc index ff88ae96bd..3088c7df33 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_audio_pass_thru_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_audio_pass_thru_notification.cc @@ -57,4 +57,4 @@ void OnAudioPassThruNotification::Run() { SendNotification(); } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc index 79fb1f4272..0bf9b40cb6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc @@ -79,9 +79,8 @@ void OnButtonEventNotification::Run() { (*message_)[strings::msg_params][strings::app_id].asUInt()); // custom_button_id is mandatory for CUSTOM_BUTTON notification - if (false == - (*message_)[strings::msg_params].keyExists( - hmi_response::custom_button_id)) { + if (false == (*message_)[strings::msg_params].keyExists( + hmi_response::custom_button_id)) { LOG4CXX_ERROR(logger_, "CUSTOM_BUTTON OnButtonEvent without custom_button_id."); return; @@ -103,8 +102,11 @@ void OnButtonEventNotification::Run() { return; } - if ((mobile_api::HMILevel::HMI_FULL != app->hmi_level()) && - (mobile_api::HMILevel::HMI_LIMITED != app->hmi_level())) { + const auto window_id = app->GetSoftButtonWindowID(custom_btn_id); + (*message_)[strings::msg_params][strings::window_id] = window_id; + const auto window_hmi_level = app->hmi_level(window_id); + if ((mobile_api::HMILevel::HMI_FULL != window_hmi_level) && + (mobile_api::HMILevel::HMI_LIMITED != window_hmi_level)) { LOG4CXX_WARN(logger_, "CUSTOM_BUTTON OnButtonEvent notification is allowed only " << "in FULL or LIMITED hmi level"); @@ -128,8 +130,11 @@ void OnButtonEventNotification::Run() { } // Send ButtonEvent notification only in HMI_FULL or HMI_LIMITED mode - if ((mobile_api::HMILevel::HMI_FULL != subscribed_app->hmi_level()) && - (mobile_api::HMILevel::HMI_LIMITED != subscribed_app->hmi_level())) { + const mobile_apis::HMILevel::eType app_hmi_level = + subscribed_app->hmi_level( + mobile_apis::PredefinedWindows::DEFAULT_WINDOW); + if ((mobile_api::HMILevel::HMI_FULL != app_hmi_level) && + (mobile_api::HMILevel::HMI_LIMITED != app_hmi_level)) { LOG4CXX_WARN(logger_, "OnButtonEvent notification is allowed only" << "in FULL or LIMITED hmi level"); @@ -180,6 +185,11 @@ void OnButtonEventNotification::SendButtonEvent(ApplicationConstSharedPtr app) { (*message_)[strings::msg_params][strings::custom_button_id]; } + if ((*message_)[strings::msg_params].keyExists(strings::window_id)) { + (*on_btn_event)[strings::msg_params][strings::window_id] = + (*message_)[strings::msg_params][strings::window_id]; + } + message_ = on_btn_event; SendNotification(); } @@ -188,4 +198,4 @@ void OnButtonEventNotification::SendButtonEvent(ApplicationConstSharedPtr app) { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc index c73f2b4b98..8c22844865 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc @@ -80,9 +80,8 @@ void OnButtonPressNotification::Run() { (*message_)[strings::msg_params][strings::app_id].asUInt()); // custom_button_id is mandatory for CUSTOM_BUTTON notification - if (false == - (*message_)[strings::msg_params].keyExists( - hmi_response::custom_button_id)) { + if (false == (*message_)[strings::msg_params].keyExists( + hmi_response::custom_button_id)) { LOG4CXX_ERROR(logger_, "CUSTOM_BUTTON OnButtonPress without custom_button_id."); return; @@ -105,8 +104,12 @@ void OnButtonPressNotification::Run() { } // Send ButtonPress notification only in HMI_FULL or HMI_LIMITED mode - if ((mobile_api::HMILevel::HMI_FULL != app->hmi_level()) && - (mobile_api::HMILevel::HMI_LIMITED != app->hmi_level())) { + const auto window_id = app->GetSoftButtonWindowID(custom_btn_id); + app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW); + (*message_)[strings::msg_params][strings::window_id] = window_id; + const auto window_hmi_level = app->hmi_level(window_id); + if ((mobile_api::HMILevel::HMI_FULL != window_hmi_level) && + (mobile_api::HMILevel::HMI_LIMITED != window_hmi_level)) { LOG4CXX_WARN(logger_, "CUSTOM_BUTTON OnButtonPress notification is allowed only " << "in FULL or LIMITED hmi level"); @@ -130,8 +133,11 @@ void OnButtonPressNotification::Run() { } // Send ButtonPress notification only in HMI_FULL or HMI_LIMITED mode - if ((mobile_api::HMILevel::HMI_FULL != subscribed_app->hmi_level()) && - (mobile_api::HMILevel::HMI_LIMITED != subscribed_app->hmi_level())) { + const mobile_apis::HMILevel::eType app_hmi_level = + subscribed_app->hmi_level( + mobile_apis::PredefinedWindows::DEFAULT_WINDOW); + if ((mobile_api::HMILevel::HMI_FULL != app_hmi_level) && + (mobile_api::HMILevel::HMI_LIMITED != app_hmi_level)) { LOG4CXX_WARN(logger_, "OnButtonPress notification is allowed only" << "in FULL or LIMITED hmi level"); @@ -188,6 +194,11 @@ void OnButtonPressNotification::SendButtonPress(ApplicationConstSharedPtr app) { (*message_)[strings::msg_params][strings::custom_button_id]; } + if ((*message_)[strings::msg_params].keyExists(strings::window_id)) { + (*on_btn_press)[strings::msg_params][strings::window_id] = + (*message_)[strings::msg_params][strings::window_id]; + } + message_ = on_btn_press; SendNotification(); } @@ -196,4 +207,4 @@ void OnButtonPressNotification::SendButtonPress(ApplicationConstSharedPtr app) { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_command_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_command_notification.cc index dff3aa6808..9c7edf74e6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_command_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_command_notification.cc @@ -84,4 +84,4 @@ void OnCommandNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_driver_distraction_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_driver_distraction_notification.cc index ca5d4bfed4..42a1928f2e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_driver_distraction_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_driver_distraction_notification.cc @@ -67,4 +67,4 @@ void OnDriverDistractionNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hash_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hash_change_notification.cc index e252b031e6..c2ce2550b9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hash_change_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hash_change_notification.cc @@ -34,9 +34,9 @@ #include "sdl_rpc_plugin/commands/mobile/on_hash_change_notification.h" +#include <string> #include "application_manager/application_impl.h" #include "interfaces/MOBILE_API.h" -#include <string> namespace sdl_rpc_plugin { using namespace application_manager; @@ -81,4 +81,4 @@ void OnHashChangeNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification.cc index 6b5838e40a..df3bce0154 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification.cc @@ -33,8 +33,8 @@ #include "sdl_rpc_plugin/commands/mobile/on_hmi_status_notification.h" -#include "application_manager/message_helper.h" #include "application_manager/message.h" +#include "application_manager/message_helper.h" #include "interfaces/MOBILE_API.h" namespace sdl_rpc_plugin { @@ -92,4 +92,4 @@ void OnHMIStatusNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification_from_mobile.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification_from_mobile.cc index c4ee22afed..28325a40f5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification_from_mobile.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification_from_mobile.cc @@ -32,8 +32,8 @@ */ #include "sdl_rpc_plugin/commands/mobile/on_hmi_status_notification_from_mobile.h" -#include "application_manager/message_helper.h" #include "application_manager/message.h" +#include "application_manager/message_helper.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -132,4 +132,4 @@ void OnHMIStatusNotificationFromMobile::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_keyboard_input_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_keyboard_input_notification.cc index 04b52f29e1..1c0609e17d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_keyboard_input_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_keyboard_input_notification.cc @@ -76,7 +76,8 @@ void OnKeyBoardInputNotification::Run() { break; } - if (mobile_apis::HMILevel::eType::HMI_FULL == app->hmi_level()) { + if (mobile_apis::HMILevel::eType::HMI_FULL == + app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) { LOG4CXX_INFO(logger_, "There is application in HMI_FULL level"); app_to_notify = app; } @@ -93,4 +94,4 @@ void OnKeyBoardInputNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_language_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_language_change_notification.cc index fdbdd910a0..9605fd6074 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_language_change_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_language_change_notification.cc @@ -60,4 +60,4 @@ void OnLanguageChangeNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_permissions_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_permissions_change_notification.cc index 32d940aca2..f64ca34bf2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_permissions_change_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_permissions_change_notification.cc @@ -62,4 +62,4 @@ void OnPermissionsChangeNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc index a8544ae643..cc6ab7b65b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc @@ -2,6 +2,7 @@ #include "application_manager/app_service_manager.h" #include "application_manager/application_manager.h" +#include "application_manager/display_capabilities_builder.h" #include "application_manager/helpers/application_helper.h" #include "application_manager/message_helper.h" #include "sdl_rpc_plugin/extensions/system_capability_app_extension.h" @@ -31,10 +32,11 @@ void OnSystemCapabilityUpdatedNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; - mobile_apis::SystemCapabilityType::eType system_capability_type = static_cast< - mobile_apis::SystemCapabilityType::eType>( - msg_params[strings::system_capability][strings::system_capability_type] - .asInt()); + const auto system_capability_type = + static_cast<mobile_apis::SystemCapabilityType::eType>( + msg_params[strings::system_capability] + [strings::system_capability_type] + .asInt()); switch (system_capability_type) { case mobile_apis::SystemCapabilityType::NAVIGATION: { @@ -100,21 +102,24 @@ void OnSystemCapabilityUpdatedNotification::Run() { for (size_t i = 0; i < updated_capabilities.length(); i++) { std::string service_id = updated_capabilities[i][strings::updated_app_service_record] - [strings::service_id].asString(); - auto matching_service_predicate = [&service_id]( - const smart_objects::SmartObject& app_service_capability) { - return service_id == - app_service_capability[strings::updated_app_service_record] - [strings::service_id].asString(); - }; + [strings::service_id] + .asString(); + auto matching_service_predicate = + [&service_id]( + const smart_objects::SmartObject& app_service_capability) { + return service_id == + app_service_capability[strings::updated_app_service_record] + [strings::service_id] + .asString(); + }; auto it = std::find_if(app_services->begin(), app_services->end(), matching_service_predicate); if (it != app_services->end()) { - LOG4CXX_DEBUG(logger_, - "Replacing updated record with service_id " - << service_id); + LOG4CXX_DEBUG( + logger_, + "Replacing updated record with service_id " << service_id); app_services->erase(it); } app_services->push_back(updated_capabilities[i]); @@ -123,8 +128,21 @@ void OnSystemCapabilityUpdatedNotification::Run() { [strings::app_services_capabilities] = app_service_caps; break; } - default: + + case mobile_apis::SystemCapabilityType::DISPLAYS: { + // Display capabilities content will be populated in the code after the + // switch so just breaking here + break; + } + + default: { + LOG4CXX_ERROR(logger_, + "Unknown system capability type: " + << msg_params[strings::system_capability] + [strings::system_capability_type] + .asInt()); return; + } } const char* capability_type_string; @@ -132,11 +150,34 @@ void OnSystemCapabilityUpdatedNotification::Run() { mobile_apis::SystemCapabilityType::eType>:: EnumToCString(system_capability_type, &capability_type_string); + const auto initial_connection_key = + (*message_)[strings::params][strings::connection_key].asUInt(); + auto subscribed_to_capability_predicate = - [&system_capability_type](const ApplicationSharedPtr app) { + [&system_capability_type, + &initial_connection_key](const ApplicationSharedPtr app) { DCHECK_OR_RETURN(app, false); auto& ext = SystemCapabilityAppExtension::ExtractExtension(*app); - return ext.IsSubscribedTo(system_capability_type); + if (!ext.IsSubscribedTo(system_capability_type)) { + LOG4CXX_DEBUG(logger_, + "App " << app->app_id() + << " is not subscribed to this capability type"); + return false; + } + + if (mobile_apis::SystemCapabilityType::DISPLAYS == + system_capability_type && + initial_connection_key > 0) { + LOG4CXX_DEBUG(logger_, + "Display capabilities notification for app " + << initial_connection_key << " only"); + return app->app_id() == initial_connection_key; + } + + LOG4CXX_DEBUG(logger_, + "App " << app->app_id() + << " is subscribed to specified capability type"); + return true; }; const std::vector<ApplicationSharedPtr>& applications = FindAllApps( @@ -163,6 +204,40 @@ void OnSystemCapabilityUpdatedNotification::Run() { ext.UnsubscribeFrom(system_capability_type); continue; } + + if (mobile_apis::SystemCapabilityType::DISPLAYS == system_capability_type) { + LOG4CXX_DEBUG(logger_, "Using common display capabilities"); + auto capabilities = hmi_capabilities_.system_display_capabilities(); + if (app->is_resuming() && app->is_app_data_resumption_allowed()) { + LOG4CXX_DEBUG(logger_, + "Application " + << app->app_id() + << " is resuming. Providing cached capabilities"); + auto display_caps = + app->display_capabilities_builder().display_capabilities(); + capabilities = display_caps; + } else if (app->display_capabilities()) { + LOG4CXX_DEBUG(logger_, + "Application " << app->app_id() + << " has specific display capabilities"); + const WindowID window_id = + msg_params[strings::system_capability] + [strings::display_capabilities][0] + [strings::window_capabilities][0][strings::window_id] + .asInt(); + capabilities = app->display_capabilities(window_id); + } + + if (!capabilities) { + LOG4CXX_WARN(logger_, + "No available display capabilities for sending. Skipping"); + continue; + } + + msg_params[strings::system_capability][strings::display_capabilities] = + *capabilities; + } + LOG4CXX_INFO(logger_, "Sending OnSystemCapabilityUpdated " << capability_type_string << " application id " @@ -174,4 +249,4 @@ void OnSystemCapabilityUpdatedNotification::Run() { } // namespace mobile } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc index 10b0b41a58..fc99bb323c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc @@ -30,16 +30,16 @@ POSSIBILITY OF SUCH DAMAGE. */ -#include <cstring> +#include "sdl_rpc_plugin/commands/mobile/on_system_request_notification.h" #include <cstdio> +#include <cstring> #include <string> -#include "sdl_rpc_plugin/commands/mobile/on_system_request_notification.h" +#include "application_manager/application_manager.h" +#include "application_manager/policies/policy_handler_interface.h" #include "interfaces/MOBILE_API.h" +#include "policy/policy_table/enums.h" #include "utils/file_system.h" #include "utils/helpers.h" -#include "policy/policy_table/enums.h" -#include "application_manager/application_manager.h" -#include "application_manager/policies/policy_handler_interface.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -86,8 +86,8 @@ void OnSystemRequestNotification::Run() { static_cast<rpc::policy_table_interface_base::RequestType>( request_type)); - if (!policy_handler.IsRequestTypeAllowed(app->policy_app_id(), - request_type)) { + if (!policy_handler.IsRequestTypeAllowed( + app->device(), app->policy_app_id(), request_type)) { LOG4CXX_WARN(logger_, "Request type " << stringified_request_type << " is not allowed by policies"); @@ -129,11 +129,11 @@ void OnSystemRequestNotification::Run() { } if (mobile_apis::RequestType::PROPRIETARY == request_type) { -/* According to requirements: - "If the requestType = PROPRIETARY, add to mobile API fileType = JSON - If the requestType = HTTP, add to mobile API fileType = BINARY" - Also in Genivi SDL we don't save the PT to file - we put it directly in - binary_data */ + /* According to requirements: + "If the requestType = PROPRIETARY, add to mobile API fileType = JSON + If the requestType = HTTP, add to mobile API fileType = BINARY" + Also in Genivi SDL we don't save the PT to file - we put it directly in + binary_data */ #if defined(PROPRIETARY_MODE) AddHeader(binary_data); @@ -246,4 +246,4 @@ size_t OnSystemRequestNotification::ParsePTString( } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_tbt_client_state_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_tbt_client_state_notification.cc index 503f1b04d5..0a8420b6a3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_tbt_client_state_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_tbt_client_state_notification.cc @@ -67,7 +67,8 @@ void OnTBTClientStateNotification::Run() { std::vector<ApplicationSharedPtr>::const_iterator it = applications.begin(); for (; applications.end() != it; ++it) { ApplicationSharedPtr app = *it; - if (mobile_apis::HMILevel::eType::HMI_NONE != app->hmi_level()) { + if (mobile_apis::HMILevel::eType::HMI_NONE != + app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) { (*message_)[strings::params][strings::connection_key] = app->app_id(); SendNotification(); } @@ -76,4 +77,4 @@ void OnTBTClientStateNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_touch_event_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_touch_event_notification.cc index 502f0ae57d..6ceb381d2e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_touch_event_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_touch_event_notification.cc @@ -93,4 +93,4 @@ void OnTouchEventNotification::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification.cc index 2f666ffc03..e89ede53b9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification.cc @@ -67,4 +67,4 @@ void OnWayPointChangeNotification::Run() { } } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc index c90038a8b7..0481542565 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc @@ -31,8 +31,8 @@ POSSIBILITY OF SUCH DAMAGE. */ -#include <cstring> #include "sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_request.h" +#include <cstring> #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" @@ -87,7 +87,8 @@ void PerformAudioPassThruRequest::Run() { return; } - if (mobile_api::HMILevel::HMI_NONE == app->hmi_level()) { + if (mobile_api::HMILevel::HMI_NONE == + app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) { LOG4CXX_ERROR(logger_, "application isn't activated"); SendResponse(false, mobile_apis::Result::REJECTED); return; @@ -113,9 +114,9 @@ void PerformAudioPassThruRequest::Run() { initial_prompt, app, application_manager_); if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) { - LOG4CXX_ERROR(logger_, - "MessageHelper::VerifyTtsFiles return " - << verification_result); + LOG4CXX_ERROR( + logger_, + "MessageHelper::VerifyTtsFiles return " << verification_result); SendResponse( false, mobile_apis::Result::FILE_NOT_FOUND, @@ -450,4 +451,4 @@ bool PerformAudioPassThruRequest::IsWaitingHMIResponse() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_response.cc index a5eb98f2ba..5dae6327eb 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_response.cc @@ -61,4 +61,4 @@ void PerformAudioPassThruResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc index 42489fd8bd..622f64f792 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc @@ -31,20 +31,20 @@ POSSIBILITY OF SUCH DAMAGE. */ -#include <numeric> +#include "sdl_rpc_plugin/commands/mobile/perform_interaction_request.h" #include <string.h> +#include <numeric> #include <string> -#include "sdl_rpc_plugin/commands/mobile/perform_interaction_request.h" #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" -#include "interfaces/MOBILE_API.h" #include "interfaces/HMI_API.h" -#include "utils/file_system.h" -#include "utils/helpers.h" +#include "interfaces/MOBILE_API.h" #include "utils/custom_string.h" +#include "utils/file_system.h" #include "utils/gen_hash.h" +#include "utils/helpers.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -82,17 +82,18 @@ PerformInteractionRequest::~PerformInteractionRequest() {} bool PerformInteractionRequest::Init() { /* Timeout in milliseconds. If omitted a standard value of 10000 milliseconds is used.*/ - if ((*message_)[strings::msg_params].keyExists(strings::timeout)) { - default_timeout_ = - (*message_)[strings::msg_params][strings::timeout].asUInt(); - } + const auto& msg_params = (*message_)[strings::msg_params]; + uint32_t request_timeout = msg_params[strings::timeout].asUInt(); interaction_mode_ = static_cast<mobile_apis::InteractionMode::eType>( - (*message_)[strings::msg_params][strings::interaction_mode].asInt()); + msg_params[strings::interaction_mode].asInt()); if (mobile_apis::InteractionMode::BOTH == interaction_mode_ || mobile_apis::InteractionMode::MANUAL_ONLY == interaction_mode_) { - default_timeout_ *= 2; + const uint32_t increase_value = 2; + default_timeout_ += request_timeout * increase_value; + } else { + default_timeout_ += request_timeout; } return true; } @@ -284,7 +285,7 @@ void PerformInteractionRequest::onTimeOut() { CommandRequestImpl::onTimeOut(); } else { application_manager_.updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); + connection_key(), correlation_id(), default_timeout_); } break; } @@ -341,7 +342,7 @@ bool PerformInteractionRequest::ProcessVRResponse( } LOG4CXX_DEBUG(logger_, "Update timeout for UI"); application_manager_.updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); + connection_key(), correlation_id(), default_timeout_); return false; } @@ -358,6 +359,13 @@ bool PerformInteractionRequest::ProcessVRResponse( msg_params[strings::choice_id] = choice_id; } + if (mobile_apis::InteractionMode::BOTH == interaction_mode_ || + mobile_apis::InteractionMode::MANUAL_ONLY == interaction_mode_) { + LOG4CXX_DEBUG(logger_, "Update timeout for UI"); + application_manager_.updateRequestTimeout( + connection_key(), correlation_id(), default_timeout_); + } + const bool is_vr_result_success = Compare<Common_Result::eType, EQ, ONE>( vr_result_code_, Common_Result::SUCCESS, Common_Result::WARNINGS); @@ -449,6 +457,11 @@ void PerformInteractionRequest::SendUIPerformInteractionRequest( smart_objects::SmartObject msg_params = smart_objects::SmartObject(smart_objects::SmartType_Map); + if ((*message_)[strings::msg_params].keyExists(strings::cancel_id)) { + msg_params[strings::cancel_id] = + (*message_)[strings::msg_params][strings::cancel_id].asInt(); + } + mobile_apis::InteractionMode::eType mode = static_cast<mobile_apis::InteractionMode::eType>( (*message_)[strings::msg_params][strings::interaction_mode].asInt()); @@ -471,12 +484,8 @@ void PerformInteractionRequest::SendUIPerformInteractionRequest( } } - if (mobile_apis::InteractionMode::BOTH == mode || - mobile_apis::InteractionMode::MANUAL_ONLY == mode) { - msg_params[strings::timeout] = default_timeout_ / 2; - } else { - msg_params[strings::timeout] = default_timeout_; - } + msg_params[strings::timeout] = + (*message_)[strings::msg_params][strings::timeout].asUInt(); msg_params[strings::app_id] = app->app_id(); if (mobile_apis::InteractionMode::VR_ONLY != mode) { msg_params[strings::choice_set] = @@ -532,6 +541,11 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest( smart_objects::SmartObject msg_params = smart_objects::SmartObject(smart_objects::SmartType_Map); + if ((*message_)[strings::msg_params].keyExists(strings::cancel_id)) { + msg_params[strings::cancel_id] = + (*message_)[strings::msg_params][strings::cancel_id].asInt(); + } + smart_objects::SmartObject& choice_list = (*message_)[strings::msg_params][strings::interaction_choice_set_id_list]; @@ -560,9 +574,9 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest( MessageHelper::VerifyTtsFiles(help_prompt, app, application_manager_); if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) { - LOG4CXX_WARN(logger_, - "MessageHelper::VerifyTtsFiles return " - << verification_result); + LOG4CXX_WARN( + logger_, + "MessageHelper::VerifyTtsFiles return " << verification_result); invalid_params.push_back("help_prompt"); } else { msg_params[strings::help_prompt] = help_prompt; @@ -608,9 +622,9 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest( timeout_prompt, app, application_manager_); if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) { - LOG4CXX_WARN(logger_, - "MessageHelper::VerifyTtsFiles return " - << verification_result); + LOG4CXX_WARN( + logger_, + "MessageHelper::VerifyTtsFiles return " << verification_result); invalid_params.push_back("timeout_prompt"); } else { msg_params[strings::timeout_prompt] = timeout_prompt; @@ -629,9 +643,9 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest( initial_prompt, app, application_manager_); if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) { - LOG4CXX_WARN(logger_, - "MessageHelper::VerifyTtsFiles return " - << verification_result); + LOG4CXX_WARN( + logger_, + "MessageHelper::VerifyTtsFiles return " << verification_result); invalid_params.push_back("initial_prompt"); } else { msg_params[strings::initial_prompt] = initial_prompt; @@ -652,16 +666,9 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest( return; } - mobile_apis::InteractionMode::eType mode = - static_cast<mobile_apis::InteractionMode::eType>( - (*message_)[strings::msg_params][strings::interaction_mode].asInt()); - - if (mobile_apis::InteractionMode::BOTH == mode || - mobile_apis::InteractionMode::MANUAL_ONLY == mode) { - msg_params[strings::timeout] = default_timeout_ / 2; - } else { - msg_params[strings::timeout] = default_timeout_; - } + msg_params[strings::timeout] = + (*message_)[strings::msg_params][strings::timeout].asUInt(); + ; msg_params[strings::app_id] = app->app_id(); StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); SendHMIRequest( @@ -1065,4 +1072,4 @@ void PerformInteractionRequest::SendBothModeResponse( } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_response.cc index 85bef9b2ad..fa02641c2b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_response.cc @@ -61,4 +61,4 @@ void PerformInteractionResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc index b418f52fa3..e25215fb48 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc @@ -31,22 +31,22 @@ POSSIBILITY OF SUCH DAMAGE. */ -#include <algorithm> #include "sdl_rpc_plugin/commands/mobile/put_file_request.h" +#include <algorithm> -#include "application_manager/policies/policy_handler.h" #include "application_manager/application_impl.h" +#include "application_manager/policies/policy_handler.h" #include "application_manager/rpc_service.h" -#include "utils/file_system.h" #include <boost/crc.hpp> +#include "utils/file_system.h" namespace { /** -* Calculates CRC32 checksum -* @param binary_data - input data for which CRC32 should be calculated -* @return calculated CRC32 checksum -*/ + * Calculates CRC32 checksum + * @param binary_data - input data for which CRC32 should be calculated + * @return calculated CRC32 checksum + */ uint32_t GetCrc32CheckSum(const std::vector<uint8_t>& binary_data) { const std::size_t file_size = binary_data.size(); boost::crc_32_type result; @@ -94,7 +94,9 @@ void PutFileRequest::Run() { return; } - if (mobile_api::HMILevel::HMI_NONE == application->hmi_level() && + if (mobile_api::HMILevel::HMI_NONE == + application->hmi_level( + mobile_apis::PredefinedWindows::DEFAULT_WINDOW) && application_manager_.get_settings().put_file_in_none() <= application->put_file_in_none_count()) { // If application is in the HMI_NONE level the quantity of allowed @@ -284,9 +286,7 @@ void PutFileRequest::Run() { } SendResponse(true, save_result, "File was downloaded", &response_params); - if (is_system_file) { - SendOnPutFileNotification(); - } + SendOnPutFileNotification(is_system_file); break; } default: @@ -297,7 +297,7 @@ void PutFileRequest::Run() { } } -void PutFileRequest::SendOnPutFileNotification() { +void PutFileRequest::SendOnPutFileNotification(bool is_system_file) { LOG4CXX_INFO(logger_, "SendOnPutFileNotification"); smart_objects::SmartObjectSPtr notification = std::make_shared<smart_objects::SmartObject>( @@ -316,9 +316,10 @@ void PutFileRequest::SendOnPutFileNotification() { message[strings::msg_params][strings::length] = length_; message[strings::msg_params][strings::persistent_file] = is_persistent_file_; message[strings::msg_params][strings::file_type] = file_type_; + message[strings::msg_params][strings::is_system_file] = is_system_file; rpc_service_.ManageHMICommand(notification); } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_response.cc index 8c54970a5c..f9ddbf7717 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_response.cc @@ -32,8 +32,8 @@ */ #include "sdl_rpc_plugin/commands/mobile/put_file_response.h" -#include "utils/file_system.h" #include "application_manager/application_impl.h" +#include "utils/file_system.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -70,4 +70,4 @@ void PutFileResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc index 924705f82b..14a94fd1a2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc @@ -33,19 +33,19 @@ #include "sdl_rpc_plugin/commands/mobile/register_app_interface_request.h" +#include <string.h> #include <unistd.h> #include <algorithm> #include <map> -#include <string.h> -#include "application_manager/application_manager.h" -#include "application_manager/policies/policy_handler_interface.h" -#include "application_manager/application_impl.h" #include "application_manager/app_launch/app_launch_ctrl.h" +#include "application_manager/application_impl.h" +#include "application_manager/application_manager.h" +#include "application_manager/helpers/application_helper.h" #include "application_manager/message_helper.h" -#include "application_manager/resumption/resume_ctrl.h" #include "application_manager/policies/policy_handler.h" -#include "application_manager/helpers/application_helper.h" +#include "application_manager/policies/policy_handler_interface.h" +#include "application_manager/resumption/resume_ctrl.h" #include "application_manager/rpc_service.h" #include "config_profile/profile.h" #include "interfaces/MOBILE_API.h" @@ -158,15 +158,16 @@ class SmartArrayValueExtractor { }; struct IsSameNickname { - IsSameNickname(const custom_str::CustomString& app_id) : app_id_(app_id) {} + IsSameNickname(const custom_str::CustomString app_name) + : app_name_(app_name) {} bool operator()(const policy::StringArray::value_type& nickname) const { - return app_id_.CompareIgnoreCase(nickname.c_str()); + return app_name_.CompareIgnoreCase(nickname.c_str()); } private: - const custom_str::CustomString& app_id_; + const custom_str::CustomString app_name_; }; -} +} // namespace namespace sdl_rpc_plugin { using namespace application_manager; @@ -184,7 +185,8 @@ RegisterAppInterfaceRequest::RegisterAppInterfaceRequest( rpc_service, hmi_capabilities, policy_handler) - , result_code_(mobile_apis::Result::INVALID_ENUM) {} + , result_code_(mobile_apis::Result::INVALID_ENUM) + , device_handle_(0) {} RegisterAppInterfaceRequest::~RegisterAppInterfaceRequest() {} @@ -224,20 +226,38 @@ void RegisterAppInterfaceRequest::Run() { return; } + // Cache the original app ID (for legacy behavior) + const auto policy_app_id = + application_manager_.GetCorrectMobileIDFromMessage(message_); + + if (application_manager_.IsApplicationForbidden(connection_key(), + policy_app_id)) { + SendResponse(false, mobile_apis::Result::TOO_MANY_PENDING_REQUESTS); + return; + } + + if (!GetDataOnSessionKey(connection_key(), &device_handle_, &device_id_)) { + SendResponse(false, + mobile_apis::Result::GENERIC_ERROR, + "Could not find a session for your connection key!"); + return; + } + + LOG4CXX_DEBUG( + logger_, + "device_handle: " << device_handle_ << " device_id: " << device_id_); + if (IsApplicationSwitched()) { return; } ApplicationSharedPtr application = - application_manager_.application(connection_key()); + application_manager_.application(device_id_, policy_app_id); if (application) { SendResponse(false, mobile_apis::Result::APPLICATION_REGISTERED_ALREADY); return; } - // cache the original app ID (for legacy behavior) - const std::string policy_app_id = - application_manager_.GetCorrectMobileIDFromMessage(message_); const smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; @@ -260,11 +280,6 @@ void RegisterAppInterfaceRequest::Run() { ::tolower); (*message_)[strings::msg_params][strings::full_app_id] = new_app_id_full; } - if (application_manager_.IsApplicationForbidden(connection_key(), - policy_app_id)) { - SendResponse(false, mobile_apis::Result::TOO_MANY_PENDING_REQUESTS); - return; - } if (IsApplicationWithSameAppIdRegistered()) { SendResponse(false, mobile_apis::Result::DISALLOWED); @@ -400,9 +415,9 @@ void RegisterAppInterfaceRequest::Run() { tts_name, application, application_manager_); if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) { - LOG4CXX_WARN(logger_, - "MessageHelper::VerifyTtsFiles return " - << verification_result); + LOG4CXX_WARN( + logger_, + "MessageHelper::VerifyTtsFiles return " << verification_result); response_info_ = "One or more files needed for tts_name are not present"; result_code_ = mobile_apis::Result::WARNINGS; } @@ -454,17 +469,16 @@ void RegisterAppInterfaceRequest::Run() { // Add device to policy table and set device info, if any policy::DeviceParams dev_params; - if (-1 == - application_manager_.connection_handler() - .get_session_observer() - .GetDataOnDeviceID(application->device(), - &dev_params.device_name, - NULL, - &dev_params.device_mac_address, - &dev_params.device_connection_type)) { - LOG4CXX_ERROR(logger_, - "Failed to extract information for device " - << application->device()); + if (-1 == application_manager_.connection_handler() + .get_session_observer() + .GetDataOnDeviceID(application->device(), + &dev_params.device_name, + NULL, + &dev_params.device_mac_address, + &dev_params.device_connection_type)) { + LOG4CXX_ERROR( + logger_, + "Failed to extract information for device " << application->device()); } policy::DeviceInfo device_info; device_info.AdoptDeviceType(dev_params.device_connection_type); @@ -614,15 +628,9 @@ void FillUIRelatedFields(smart_objects::SmartObject& response_params, } if (hmi_capabilities.audio_pass_thru_capabilities()) { - if (smart_objects::SmartType_Array == - hmi_capabilities.audio_pass_thru_capabilities()->getType()) { - // hmi_capabilities json contains array and HMI response object - response_params[strings::audio_pass_thru_capabilities] = - *hmi_capabilities.audio_pass_thru_capabilities(); - } else { - response_params[strings::audio_pass_thru_capabilities][0] = - *hmi_capabilities.audio_pass_thru_capabilities(); - } + // hmi_capabilities json contains array and HMI response object + response_params[strings::audio_pass_thru_capabilities] = + *hmi_capabilities.audio_pass_thru_capabilities(); } response_params[strings::hmi_capabilities] = smart_objects::SmartObject(smart_objects::SmartType_Map); @@ -634,6 +642,11 @@ void FillUIRelatedFields(smart_objects::SmartObject& response_params, hmi_capabilities.video_streaming_supported(); response_params[strings::hmi_capabilities][strings::remote_control] = hmi_capabilities.rc_supported(); + response_params[strings::hmi_capabilities][strings::app_services] = true; + // Apps are automatically subscribed to the SystemCapability: DISPLAYS + response_params[strings::hmi_capabilities][strings::displays] = true; + response_params[strings::hmi_capabilities][strings::seat_location] = + hmi_capabilities.seat_location_capability() ? true : false; } void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile( @@ -786,15 +799,16 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile( return; } - bool resumption = + const bool hash_id_present = (*message_)[strings::msg_params].keyExists(strings::hash_id); + const std::string hash_id = + (*message_)[strings::msg_params][strings::hash_id].asString(); + const bool resumption = hash_id_present && !hash_id.empty(); bool need_restore_vr = resumption; - std::string hash_id; std::string add_info; if (resumption) { - hash_id = (*message_)[strings::msg_params][strings::hash_id].asString(); if (!resumer.CheckApplicationHash(application, hash_id)) { LOG4CXX_WARN(logger_, "Hash from RAI does not match to saved resume data."); @@ -808,6 +822,8 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile( need_restore_vr = false; } else { add_info = "Resume succeeded."; + application->set_app_data_resumption_allowance(true); + application->set_is_resuming(true); } } if ((mobile_apis::Result::SUCCESS == result_code) && @@ -816,10 +832,18 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile( result_code = result_code_; } - // in case application exist in resumption we need to send resumeVrgrammars - if (false == resumption) { - resumption = resumer.IsApplicationSaved(application->policy_app_id(), - application->mac_address()); + // In case application exist in resumption we need to send resumeVrgrammars + const bool is_app_saved_in_resumption = resumer.IsApplicationSaved( + application->policy_app_id(), application->mac_address()); + + // If app is in resuming state + // DisplayCapabilitiesBuilder has to collect all the information + // from incoming HMI notifications and send only one notification + // to mobile app, even if hash does not match, which means that app data + // will not be resumed, notification should be sent for default window as + // it will be resumed in any case + if (resumption || is_app_saved_in_resumption) { + resumer.StartWaitingForDisplayCapabilitiesUpdate(application); } AppHmiTypes hmi_types; @@ -836,14 +860,15 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile( } } policy::StatusNotifier notify_upd_manager = GetPolicyHandler().AddApplication( - application->policy_app_id(), hmi_types); + application->mac_address(), application->policy_app_id(), hmi_types); response_params[strings::icon_resumed] = file_system::FileExists(application->app_icon_path()); SendResponse(true, result_code, add_info.c_str(), &response_params); if (msg_params.keyExists(strings::app_hmi_type)) { - GetPolicyHandler().SetDefaultHmiTypes(application->policy_app_id(), + GetPolicyHandler().SetDefaultHmiTypes(application->device(), + application->policy_app_id(), &(msg_params[strings::app_hmi_type])); } @@ -857,11 +882,13 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile( // Start PTU after successfull registration // Sends OnPermissionChange notification to mobile right after RAI response // and HMI level set-up - GetPolicyHandler().OnAppRegisteredOnMobile(application->policy_app_id()); + GetPolicyHandler().OnAppRegisteredOnMobile(application->mac_address(), + application->policy_app_id()); - if (result_code != mobile_apis::Result::RESUME_FAILED) { + if (result_code != mobile_apis::Result::RESUME_FAILED && + application->is_app_data_resumption_allowed()) { resumer.StartResumption(application, hash_id); - } else { + } else if (is_app_saved_in_resumption) { resumer.StartResumptionOnlyHMILevel(application); } @@ -962,48 +989,72 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence( const smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; - ApplicationSet accessor = application_manager_.applications().GetData(); + auto compare_tts_name = [](const smart_objects::SmartObject& obj_1, + const smart_objects::SmartObject& obj_2) { + return obj_1[application_manager::strings::text] + .asCustomString() + .CompareIgnoreCase( + obj_2[application_manager::strings::text].asCustomString()); + }; - ApplicationSetConstIt it = accessor.begin(); - const custom_str::CustomString& app_name = - msg_params[strings::app_name].asCustomString(); + const auto& accessor = application_manager_.applications().GetData(); + const auto& app_name = msg_params[strings::app_name].asCustomString(); - for (; accessor.end() != it; ++it) { - // name check - const custom_str::CustomString& cur_name = (*it)->name(); + for (const auto& app : accessor) { + if (app->device() != device_handle_) { + continue; + } + // Name check + const auto& cur_name = app->name(); if (app_name.CompareIgnoreCase(cur_name)) { LOG4CXX_ERROR(logger_, "Application name is known already."); - out_duplicate_apps.push_back(*it); + out_duplicate_apps.push_back(app); continue; } - - const smart_objects::SmartObject* vr = (*it)->vr_synonyms(); - const std::vector<smart_objects::SmartObject>* curr_vr = NULL; - if (NULL != vr) { - curr_vr = vr->asArray(); + const auto vr = app->vr_synonyms(); + if (vr) { + const auto curr_vr = vr->asArray(); CoincidencePredicateVR v(app_name); if (0 != std::count_if(curr_vr->begin(), curr_vr->end(), v)) { LOG4CXX_ERROR(logger_, "Application name is known already."); - out_duplicate_apps.push_back(*it); + out_duplicate_apps.push_back(app); continue; } } - // vr check + // VR check if (msg_params.keyExists(strings::vr_synonyms)) { - const std::vector<smart_objects::SmartObject>* new_vr = - msg_params[strings::vr_synonyms].asArray(); + const auto new_vr = msg_params[strings::vr_synonyms].asArray(); CoincidencePredicateVR v(cur_name); if (0 != std::count_if(new_vr->begin(), new_vr->end(), v)) { LOG4CXX_ERROR(logger_, "vr_synonyms duplicated with app_name ."); - out_duplicate_apps.push_back(*it); + out_duplicate_apps.push_back(app); continue; } - } // end vr check + } // End vr check + + // TTS check + if (msg_params.keyExists(strings::tts_name) && app->tts_name()) { + const auto tts_array = msg_params[strings::tts_name].asArray(); + const auto tts_curr = app->tts_name()->asArray(); + const auto& it_tts = std::find_first_of(tts_array->begin(), + tts_array->end(), + tts_curr->begin(), + tts_curr->end(), + compare_tts_name); + if (it_tts != tts_array->end()) { + LOG4CXX_ERROR( + logger_, + "TTS name: " + << (*it_tts)[strings::text].asCustomString().AsMBString() + << " is known already"); + return mobile_apis::Result::DUPLICATE_NAME; + } + } // End tts check - } // application for end + } // Application for end if (!out_duplicate_apps.empty()) { return mobile_apis::Result::DUPLICATE_NAME; @@ -1132,14 +1183,19 @@ bool RegisterAppInterfaceRequest::IsApplicationWithSameAppIdRegistered() { const custom_string::CustomString mobile_app_id( application_manager_.GetCorrectMobileIDFromMessage(message_)); - const ApplicationSet& applications = - application_manager_.applications().GetData(); - - ApplicationSetConstIt it = applications.begin(); - ApplicationSetConstIt it_end = applications.end(); - - for (; it != it_end; ++it) { - if (mobile_app_id.CompareIgnoreCase((*it)->policy_app_id().c_str())) { + const auto& applications = application_manager_.applications().GetData(); + + for (const auto& app : applications) { + if (mobile_app_id.CompareIgnoreCase(app->policy_app_id().c_str())) { + if (app->device() != device_handle_) { + LOG4CXX_DEBUG(logger_, + "These policy_app_id equal, but applications have " + "different device id" + << " mobile_app_id: " << mobile_app_id.c_str() + << " device_handle: " << device_handle_ + << " device_handle: " << app->device()); + continue; + } return true; } } @@ -1212,7 +1268,8 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { if ((*message_)[strings::msg_params][strings::device_info].keyExists( strings::hardware)) { str = (*message_)[strings::msg_params][strings::device_info] - [strings::hardware].asCharArray(); + [strings::hardware] + .asCharArray(); if (strlen(str) && !CheckSyntax(str)) { LOG4CXX_ERROR(logger_, "Invalid device_info hardware syntax check failed"); @@ -1223,7 +1280,8 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { if ((*message_)[strings::msg_params][strings::device_info].keyExists( strings::firmware_rev)) { str = (*message_)[strings::msg_params][strings::device_info] - [strings::firmware_rev].asCharArray(); + [strings::firmware_rev] + .asCharArray(); if (strlen(str) && !CheckSyntax(str)) { LOG4CXX_ERROR(logger_, "Invalid device_info firmware_rev syntax check failed"); @@ -1244,7 +1302,8 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { if ((*message_)[strings::msg_params][strings::device_info].keyExists( strings::os_version)) { str = (*message_)[strings::msg_params][strings::device_info] - [strings::os_version].asCharArray(); + [strings::os_version] + .asCharArray(); if (strlen(str) && !CheckSyntax(str)) { LOG4CXX_ERROR(logger_, "Invalid device_info os_version syntax check failed"); @@ -1255,7 +1314,8 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { if ((*message_)[strings::msg_params][strings::device_info].keyExists( strings::carrier)) { str = (*message_)[strings::msg_params][strings::device_info] - [strings::carrier].asCharArray(); + [strings::carrier] + .asCharArray(); if (strlen(str) && !CheckSyntax(str)) { LOG4CXX_ERROR(logger_, "Invalid device_info carrier syntax check failed"); @@ -1305,13 +1365,12 @@ void RegisterAppInterfaceRequest::CheckResponseVehicleTypeParam( void RegisterAppInterfaceRequest::SendSubscribeCustomButtonNotification() { using namespace smart_objects; - using namespace hmi_apis; - SmartObject msg_params = SmartObject(SmartType_Map); msg_params[strings::app_id] = connection_key(); - msg_params[strings::name] = Common_ButtonName::CUSTOM_BUTTON; + msg_params[strings::name] = hmi_apis::Common_ButtonName::CUSTOM_BUTTON; msg_params[strings::is_suscribed] = true; - CreateHMINotification(FunctionID::Buttons_OnButtonSubscription, msg_params); + CreateHMINotification(hmi_apis::FunctionID::Buttons_OnButtonSubscription, + msg_params); } bool RegisterAppInterfaceRequest::IsApplicationSwitched() { @@ -1319,24 +1378,26 @@ bool RegisterAppInterfaceRequest::IsApplicationSwitched() { application_manager_.GetCorrectMobileIDFromMessage(message_); LOG4CXX_DEBUG(logger_, "Looking for application id " << policy_app_id); - - auto app = application_manager_.application_by_policy_id(policy_app_id); + auto app = + application_manager_.reregister_application_by_policy_id(policy_app_id); if (!app) { - LOG4CXX_DEBUG(logger_, - "Application with policy id " << policy_app_id - << " is not found."); + LOG4CXX_DEBUG( + logger_, + "Application with policy id " << policy_app_id << " is not found."); return false; } LOG4CXX_DEBUG(logger_, "Application with policy id " << policy_app_id << " is found."); - if (!application_manager_.IsAppInReconnectMode(policy_app_id)) { + + const auto app_device_handle = app->device(); + if (app_device_handle == device_handle_) { LOG4CXX_DEBUG(logger_, - "Policy id " << policy_app_id - << " is not found in reconnection list."); + "Application " << policy_app_id + << " is already registered from this device."); SendResponse(false, mobile_apis::Result::APPLICATION_REGISTERED_ALREADY); - return false; + return true; } LOG4CXX_DEBUG(logger_, "Application is found in reconnection list."); @@ -1355,13 +1416,61 @@ bool RegisterAppInterfaceRequest::IsApplicationSwitched() { application_manager_.ProcessReconnection(app, connection_key()); SendRegisterAppInterfaceResponseToMobile(app_type); - application_manager_.SendHMIStatusNotification(app); + MessageHelper::SendHMIStatusNotification( + app, + mobile_apis::PredefinedWindows::DEFAULT_WINDOW, + application_manager_); application_manager_.OnApplicationSwitched(app); return true; } +bool RegisterAppInterfaceRequest::GetDataOnSessionKey( + const uint32_t key, + connection_handler::DeviceHandle* device_id, + std::string* mac_address) const { + LOG4CXX_AUTO_TRACE(logger_); + + if ((nullptr == mac_address) && (nullptr == device_id)) { + LOG4CXX_ERROR(logger_, + "Can't get data on session key because device id and mac " + "address are empty."); + return false; + } + + connection_handler::DeviceHandle device_handle = 0; + auto& connect_handler = application_manager_.connection_handler(); + + auto result = connect_handler.GetDataOnSessionKey( + connection_key(), nullptr, nullptr, &device_handle); + + if (result) { + LOG4CXX_DEBUG( + logger_, + "Failed to get device info for connection key: " << connection_key()); + return false; + } + + if (mac_address) { + result = connect_handler.get_session_observer().GetDataOnDeviceID( + device_handle, nullptr, nullptr, mac_address, nullptr); + } + + if (result) { + LOG4CXX_DEBUG(logger_, + "Failed get unique address info for connection key: " + << connection_key()); + return false; + } + + if (device_id) { + *device_id = device_handle; + } + + return true; +} + policy::PolicyHandlerInterface& RegisterAppInterfaceRequest::GetPolicyHandler() { return policy_handler_; @@ -1369,4 +1478,4 @@ RegisterAppInterfaceRequest::GetPolicyHandler() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_response.cc index 584d7db075..b5683c62cb 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_response.cc @@ -32,11 +32,10 @@ */ #include "sdl_rpc_plugin/commands/mobile/register_app_interface_response.h" -#include "interfaces/MOBILE_API.h" #include "application_manager/application_manager.h" #include "application_manager/policies/policy_handler_interface.h" #include "connection_handler/connection_handler.h" -#include "application_manager/policies/policy_handler_interface.h" +#include "interfaces/MOBILE_API.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -128,4 +127,4 @@ void RegisterAppInterfaceResponse::SetHeartBeatTimeout( } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc index ab6e1cc143..ffd8a7dc81 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc @@ -36,8 +36,8 @@ #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" -#include "interfaces/MOBILE_API.h" #include "interfaces/HMI_API.h" +#include "interfaces/MOBILE_API.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -161,7 +161,8 @@ void ResetGlobalPropertiesRequest::Run() { key_board_properties[hmi_request::limited_character_list] = limited_character_list;*/ - key_board_properties[hmi_request::auto_complete_text] = ""; + key_board_properties[hmi_request::auto_complete_list] = + smart_objects::SmartObject(smart_objects::SmartType_Array); msg_params[hmi_request::keyboard_properties] = key_board_properties; } @@ -333,4 +334,4 @@ bool ResetGlobalPropertiesRequest::IsPendingResponseExist() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_response.cc index f5542ab26b..07aa23d9c9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_response.cc @@ -61,4 +61,4 @@ void ResetGlobalPropertiesResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc index 0b28e09210..90dbb91b5f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc @@ -31,14 +31,14 @@ POSSIBILITY OF SUCH DAMAGE. */ -#include <string.h> #include "sdl_rpc_plugin/commands/mobile/scrollable_message_request.h" +#include <string.h> #include "application_manager/application_impl.h" -#include "application_manager/policies/policy_handler.h" #include "application_manager/message_helper.h" -#include "interfaces/MOBILE_API.h" +#include "application_manager/policies/policy_handler.h" #include "interfaces/HMI_API.h" +#include "interfaces/MOBILE_API.h" #include "utils/helpers.h" namespace sdl_rpc_plugin { @@ -65,13 +65,9 @@ ScrollableMessageRequest::~ScrollableMessageRequest() {} bool ScrollableMessageRequest::Init() { /* Timeout in milliseconds. If omitted a standard value of 10000 milliseconds is used.*/ - if ((*message_)[strings::msg_params].keyExists(strings::timeout)) { - default_timeout_ = - (*message_)[strings::msg_params][strings::timeout].asUInt(); - } else { - const int32_t def_value = 30000; - default_timeout_ = def_value; - } + uint32_t request_timeout = + (*message_)[strings::msg_params][strings::timeout].asUInt(); + default_timeout_ += request_timeout; return true; } @@ -110,7 +106,13 @@ void ScrollableMessageRequest::Run() { msg_params[hmi_request::message_text][hmi_request::field_text] = (*message_)[strings::msg_params][strings::scroll_message_body]; msg_params[strings::app_id] = app->app_id(); - msg_params[strings::timeout] = default_timeout_; + msg_params[strings::timeout] = + (*message_)[strings::msg_params][strings::timeout].asUInt(); + + if ((*message_)[strings::msg_params].keyExists(strings::cancel_id)) { + msg_params[strings::cancel_id] = + (*message_)[strings::msg_params][strings::cancel_id].asInt(); + } if ((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) { msg_params[strings::soft_buttons] = @@ -160,4 +162,4 @@ void ScrollableMessageRequest::on_event(const event_engine::Event& event) { } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_response.cc index 4eee819497..6236506c00 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_response.cc @@ -69,4 +69,4 @@ void ScrollableMessageResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_request.cc index a09434ebb6..6e745fe0db 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_request.cc @@ -105,4 +105,4 @@ void SendHapticDataRequest::on_event(const event_engine::Event& event) { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_response.cc index f4515472a4..79a0516928 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_response.cc @@ -60,4 +60,4 @@ void SendHapticDataResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc index 2719d0674d..1df4d788d2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc @@ -30,8 +30,8 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <algorithm> #include "sdl_rpc_plugin/commands/mobile/send_location_request.h" +#include <algorithm> #include "application_manager/message_helper.h" #include "utils/custom_string.h" @@ -281,4 +281,4 @@ bool SendLocationRequest::CheckHMICapabilities( } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_response.cc index 59dab4a9a7..934008b816 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_response.cc @@ -32,8 +32,8 @@ */ #include "sdl_rpc_plugin/commands/mobile/send_location_response.h" -#include "application_manager/rpc_service.h" #include "application_manager/application_impl.h" +#include "application_manager/rpc_service.h" #include "interfaces/HMI_API.h" namespace sdl_rpc_plugin { @@ -63,4 +63,4 @@ void SendLocationResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc index e79fb315ce..b2363e870f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc @@ -34,10 +34,10 @@ #include "sdl_rpc_plugin/commands/mobile/set_app_icon_request.h" #include <algorithm> -#include "application_manager/message_helper.h" #include "application_manager/application_impl.h" -#include "interfaces/MOBILE_API.h" +#include "application_manager/message_helper.h" #include "interfaces/HMI_API.h" +#include "interfaces/MOBILE_API.h" #include "utils/file_system.h" #include "utils/helpers.h" @@ -148,10 +148,12 @@ void SetAppIconRequest::CopyToIconStorage( if (storage_max_size < file_size) { LOG4CXX_ERROR(logger_, - "Icon size (" << file_size << ") is bigger, than " - " icons storage maximum size (" - << storage_max_size << ")." - "Copying skipped."); + "Icon size (" << file_size + << ") is bigger, than " + " icons storage maximum size (" + << storage_max_size + << ")." + "Copying skipped."); return; } @@ -203,12 +205,12 @@ void SetAppIconRequest::CopyToIconStorage( void SetAppIconRequest::RemoveOldestIcons(const std::string& storage, const uint32_t icons_amount) const { const std::vector<std::string> icons_list = file_system::ListFiles(storage); - auto compareTime = [](const time_t t1, const time_t t2) - -> bool { return difftime(t1, t2) > 0; }; - std::map<time_t, - std::string, - std::function<bool(const time_t, const time_t)> > - icon_modification_time(compareTime); + auto compareTime = [](const time_t t1, const time_t t2) -> bool { + return difftime(t1, t2) > 0; + }; + std:: + map<time_t, std::string, std::function<bool(const time_t, const time_t)> > + icon_modification_time(compareTime); std::vector<std::string>::const_iterator it = icons_list.begin(); for (; it != icons_list.end(); ++it) { const std::string file_name = *it; @@ -271,7 +273,8 @@ void SetAppIconRequest::on_event(const event_engine::Event& event) { const std::string& path = (*message_)[strings::msg_params][strings::sync_file_name] - [strings::value].asString(); + [strings::value] + .asString(); if (is_icons_saving_enabled_) { CopyToIconStorage(path); @@ -298,4 +301,4 @@ void SetAppIconRequest::on_event(const event_engine::Event& event) { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_response.cc index aa8731f062..55255920d0 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_response.cc @@ -61,4 +61,4 @@ void SetAppIconResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc index 5173be56d6..3bb1e1c107 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc @@ -1,4 +1,5 @@ #include "sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h" +#include "application_manager/policies/policy_handler_interface.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -40,4 +41,4 @@ void SetCloudAppPropertiesRequest::on_event( } } // namespace commands -} // namespace sdl_rpc_plugin
\ No newline at end of file +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_response.cc index 6d27ce8b3e..39d2ea7f90 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_response.cc @@ -1,6 +1,6 @@ +#include "sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_response.h" #include "application_manager/application_manager.h" #include "application_manager/rpc_service.h" -#include "sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_response.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -28,4 +28,4 @@ void SetCloudAppPropertiesResponse::Run() { } } // namespace commands -} // namespace sdl_rpc_plugins +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc index 32164b8f0e..5ba1076084 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc @@ -33,8 +33,8 @@ #include "sdl_rpc_plugin/commands/mobile/set_display_layout_request.h" -#include "application_manager/message_helper.h" #include "application_manager/application_impl.h" +#include "application_manager/message_helper.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -75,8 +75,8 @@ void SetDisplayLayoutRequest::Run() { new_layout = msg_params[strings::display_layout].asString(); } - if (new_layout != old_layout && - !new_layout.empty()) { // Template switched, allow any color change + if (new_layout != old_layout && !new_layout.empty()) { + // Template switched, hence allow any color change LOG4CXX_DEBUG(logger_, "SetDisplayLayoutRequest New Layout: " << new_layout); app->set_display_layout(new_layout); @@ -85,22 +85,20 @@ void SetDisplayLayoutRequest::Run() { // Template layout is the same as previous layout // Reject message if colors are set if (msg_params.keyExists(strings::day_color_scheme) && - app->day_color_scheme() != NULL && - !(msg_params[strings::day_color_scheme] == - *(app->day_color_scheme()))) { - // Color scheme param exists and has been previously set, do not allow - // color change + app->day_color_scheme().getType() != smart_objects::SmartType_Null && + msg_params[strings::day_color_scheme] != app->day_color_scheme()) { + // Color scheme param exists and has been previously set, + // hence do not allow color change LOG4CXX_DEBUG(logger_, "Reject Day Color Scheme Change"); SendResponse(false, mobile_apis::Result::REJECTED); return; } if (msg_params.keyExists(strings::night_color_scheme) && - app->night_color_scheme() != NULL && - !(msg_params[strings::night_color_scheme] == - *(app->night_color_scheme()))) { - // Color scheme param exists and has been previously set, do not allow - // color change + app->night_color_scheme().getType() != smart_objects::SmartType_Null && + msg_params[strings::night_color_scheme] != app->night_color_scheme()) { + // Color scheme param exists and has been previously set, + // hence do not allow color change LOG4CXX_DEBUG(logger_, "Reject Night Color Scheme Change"); SendResponse(false, mobile_apis::Result::REJECTED); return; @@ -127,6 +125,14 @@ void SetDisplayLayoutRequest::Run() { void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) { 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; + } + const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::UI_SetDisplayLayout: { @@ -143,21 +149,32 @@ void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) { if (response_success) { HMICapabilities& hmi_capabilities = hmi_capabilities_; - // in case templates_available is empty copy from hmi capabilities + // In case templates_available is empty copy from hmi capabilities if (msg_params.keyExists(hmi_response::display_capabilities)) { - if (0 == - msg_params[hmi_response::display_capabilities] - [hmi_response::templates_available].length()) { + if (0 == msg_params[hmi_response::display_capabilities] + [hmi_response::templates_available] + .length()) { msg_params[hmi_response::display_capabilities] [hmi_response::templates_available] = hmi_capabilities.display_capabilities()->getElement( hmi_response::templates_available); } } + const Version& app_version = app->version(); + if (app_version.max_supported_api_version >= APIVersion::kAPIV6) { + // In case of successful response warn user that this RPC is + // deprecated from 6.0 and higher API versions + result_code = hmi_apis::Common_Result::WARNINGS; + info = + "The RPC is deprecated and will be removed in a future version. " + "The requested display layout is set to the main window. Please " + "use `Show.templateConfiguration` instead."; + } } + SendResponse(response_success, MessageHelper::HMIToMobileResult(result_code), - info.empty() ? NULL : info.c_str(), + info.empty() ? nullptr : info.c_str(), &msg_params); break; } @@ -170,4 +187,4 @@ void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_response.cc index 4bab4a3e5b..0999b596b5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_response.cc @@ -62,4 +62,4 @@ void SetDisplayLayoutResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc index 0c217b6b4f..a567d1b32f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc @@ -30,14 +30,15 @@ POSSIBILITY OF SUCH DAMAGE. */ +#include "sdl_rpc_plugin/commands/mobile/set_global_properties_request.h" #include <string.h> -#include <numeric> #include <algorithm> -#include "sdl_rpc_plugin/commands/mobile/set_global_properties_request.h" +#include <numeric> #include "application_manager/message_helper.h" -#include "interfaces/MOBILE_API.h" #include "interfaces/HMI_API.h" +#include "interfaces/MOBILE_API.h" + #include "utils/helpers.h" namespace sdl_rpc_plugin { @@ -45,6 +46,24 @@ using namespace application_manager; namespace commands { +namespace { +bool IsResultCodeWarning(const app_mngr::commands::ResponseInfo& first, + const app_mngr::commands::ResponseInfo& second, + const app_mngr::commands::ResponseInfo& third) { + const bool first_is_ok_second_is_warn = + (first.is_ok || first.is_not_used) && + (hmi_apis::Common_Result::WARNINGS == second.result_code) && + (hmi_apis::Common_Result::WARNINGS == third.result_code); + + const bool final_warnings = + hmi_apis::Common_Result::WARNINGS == first.result_code && + ((hmi_apis::Common_Result::WARNINGS == second.result_code) && + (hmi_apis::Common_Result::WARNINGS == third.result_code)); + + return first_is_ok_second_is_warn || final_warnings; +} +} // namespace + SetGlobalPropertiesRequest::SetGlobalPropertiesRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -58,25 +77,27 @@ SetGlobalPropertiesRequest::SetGlobalPropertiesRequest( policy_handler) , is_ui_send_(false) , is_tts_send_(false) + , is_rc_send_(false) , is_ui_received_(false) , is_tts_received_(false) + , is_rc_received_(false) , ui_result_(hmi_apis::Common_Result::INVALID_ENUM) - , tts_result_(hmi_apis::Common_Result::INVALID_ENUM) {} + , tts_result_(hmi_apis::Common_Result::INVALID_ENUM) + , rc_result_(hmi_apis::Common_Result::INVALID_ENUM) {} SetGlobalPropertiesRequest::~SetGlobalPropertiesRequest() {} void SetGlobalPropertiesRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - const smart_objects::SmartObject& msg_params = - (*message_)[strings::msg_params]; + smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, - "No application associated with connection key " - << connection_key()); + LOG4CXX_ERROR( + logger_, + "No application associated with connection key " << connection_key()); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -90,11 +111,9 @@ void SetGlobalPropertiesRequest::Run() { mobile_apis::Result::eType verification_result = mobile_apis::Result::SUCCESS; - if ((*message_)[strings::msg_params].keyExists(strings::menu_icon)) { + if (msg_params.keyExists(strings::menu_icon)) { verification_result = MessageHelper::VerifyImage( - (*message_)[strings::msg_params][strings::menu_icon], - app, - application_manager_); + msg_params[strings::menu_icon], app, application_manager_); if (mobile_apis::Result::INVALID_DATA == verification_result) { LOG4CXX_ERROR( logger_, "MessageHelper::VerifyImage return " << verification_result); @@ -103,18 +122,29 @@ void SetGlobalPropertiesRequest::Run() { } } // Check for image file(s) in vrHelpItem - if ((*message_)[strings::msg_params].keyExists(strings::vr_help)) { + if (msg_params.keyExists(strings::vr_help)) { if (mobile_apis::Result::INVALID_DATA == MessageHelper::VerifyImageVrHelpItems( - (*message_)[strings::msg_params][strings::vr_help], - app, - application_manager_)) { + msg_params[strings::vr_help], app, application_manager_)) { LOG4CXX_ERROR(logger_, "MessageHelper::VerifyImage return INVALID_DATA!"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } } + if (msg_params.keyExists(strings::keyboard_properties)) { + if (!msg_params[strings::keyboard_properties].keyExists( + strings::auto_complete_list) && + msg_params[strings::keyboard_properties].keyExists( + strings::auto_complete_text)) { + LOG4CXX_ERROR(logger_, "Replacing deprecated autoCompleteText property"); + msg_params[strings::keyboard_properties][strings::auto_complete_list][0] = + msg_params[strings::keyboard_properties][strings::auto_complete_text] + .asString(); + } + msg_params[strings::keyboard_properties].erase(strings::auto_complete_text); + } + if (IsWhiteSpaceExist()) { LOG4CXX_ERROR(logger_, "White spaces found"); SendResponse(false, mobile_apis::Result::INVALID_DATA); @@ -138,6 +168,19 @@ void SetGlobalPropertiesRequest::Run() { return; } + smart_objects::SmartObject params = + smart_objects::SmartObject(smart_objects::SmartType_Map); + + if (msg_params.keyExists(strings::menu_layout)) { + auto menu_layout = static_cast<mobile_apis::MenuLayout::eType>( + msg_params[strings::menu_layout].asUInt()); + if (app->menu_layout_supported(menu_layout)) { + params[strings::menu_layout] = msg_params[strings::menu_layout]; + } else { + is_menu_layout_available_ = false; + } + } + /* Need to set flags before sending request to HMI * for correct processing this flags in method on_event */ if (is_help_prompt_present || is_timeout_prompt_present) { @@ -154,9 +197,6 @@ void SetGlobalPropertiesRequest::Run() { return; } - smart_objects::SmartObject params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - PrepareUIRequestVRHelpData(app, msg_params, params); PrepareUIRequestMenuAndKeyboardData(app, msg_params, params); @@ -169,9 +209,6 @@ void SetGlobalPropertiesRequest::Run() { LOG4CXX_DEBUG(logger_, "VRHelp params does not present"); DCHECK_OR_RETURN_VOID(!is_vr_help_title_present && !is_vr_help_present); - smart_objects::SmartObject params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - PrepareUIRequestMenuAndKeyboardData(app, msg_params, params); // Preparing data @@ -183,45 +220,71 @@ void SetGlobalPropertiesRequest::Run() { } } + // Check RC params + const bool is_user_location_present = + msg_params.keyExists(strings::user_location); + if (is_user_location_present) { + if (msg_params[strings::user_location].empty()) { + SendResponse( + false, mobile_apis::Result::INVALID_DATA, "UserLocation is empty"); + return; + } + LOG4CXX_DEBUG(logger_, "Userlocation params presents"); + const auto& user_location = msg_params[strings::user_location]; + app->set_user_location(user_location); + + auto on_global_properties_updated = [app]( + plugin_manager::RPCPlugin& plugin) { + plugin.OnApplicationEvent(plugin_manager::kGlobalPropertiesUpdated, app); + }; + + application_manager_.GetPluginManager().ForEachPlugin( + on_global_properties_updated); + + smart_objects::SmartObject params = + smart_objects::SmartObject(smart_objects::SmartType_Map); + params[strings::app_id] = app->app_id(); + params[strings::user_location] = user_location; + SendRCRequest(params, true); + } + // check TTS params if (is_help_prompt_present || is_timeout_prompt_present) { LOG4CXX_DEBUG(logger_, "TTS params presents"); - smart_objects::SmartObject params = - smart_objects::SmartObject(smart_objects::SmartType_Map); + auto tts_params = smart_objects::SmartObject(smart_objects::SmartType_Map); std::vector<std::string> invalid_params; if (is_help_prompt_present) { smart_objects::SmartObject& help_prompt = (*message_)[strings::msg_params][strings::help_prompt]; - mobile_apis::Result::eType verification_result = + verification_result = MessageHelper::VerifyTtsFiles(help_prompt, app, application_manager_); if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) { - LOG4CXX_ERROR(logger_, - "MessageHelper::VerifyTtsFiles return " - << verification_result); + LOG4CXX_ERROR( + logger_, + "MessageHelper::VerifyTtsFiles return " << verification_result); invalid_params.push_back("help_prompt"); } else { app->set_help_prompt(help_prompt); - params[strings::help_prompt] = (*app->help_prompt()); + tts_params[strings::help_prompt] = (*app->help_prompt()); } } if (is_timeout_prompt_present) { smart_objects::SmartObject& timeout_prompt = (*message_)[strings::msg_params][strings::timeout_prompt]; - mobile_apis::Result::eType verification_result = - MessageHelper::VerifyTtsFiles( - timeout_prompt, app, application_manager_); + verification_result = MessageHelper::VerifyTtsFiles( + timeout_prompt, app, application_manager_); if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) { - LOG4CXX_ERROR(logger_, - "MessageHelper::VerifyTtsFiles return " - << verification_result); + LOG4CXX_ERROR( + logger_, + "MessageHelper::VerifyTtsFiles return " << verification_result); invalid_params.push_back("timeout_prompt"); } else { app->set_timeout_prompt(timeout_prompt); - params[strings::timeout_prompt] = (*app->timeout_prompt()); + tts_params[strings::timeout_prompt] = (*app->timeout_prompt()); } } @@ -239,11 +302,18 @@ void SetGlobalPropertiesRequest::Run() { return; } - params[strings::app_id] = app->app_id(); - SendTTSRequest(params, true); + tts_params[strings::app_id] = app->app_id(); + SendTTSRequest(tts_params, true); auto& help_prompt_manager = app->help_prompt_manager(); - help_prompt_manager.OnSetGlobalPropertiesReceived(params, false); + help_prompt_manager.OnSetGlobalPropertiesReceived(tts_params, false); + } else if (!is_ui_send_ && !is_rc_send_) { + std::string response_info = "There are no parameters present in request."; + if (!is_menu_layout_available_) { + response_info += " The MenuLayout specified is unsupported."; + } + SendResponse( + false, mobile_apis::Result::INVALID_DATA, response_info.c_str()); } } @@ -278,7 +348,7 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::UI_SetGlobalProperties: { - LOG4CXX_INFO(logger_, "Received UI_SetGlobalProperties event"); + LOG4CXX_DEBUG(logger_, "Received UI_SetGlobalProperties event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); is_ui_received_ = true; ui_result_ = static_cast<hmi_apis::Common_Result::eType>( @@ -291,7 +361,7 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { break; } case hmi_apis::FunctionID::TTS_SetGlobalProperties: { - LOG4CXX_INFO(logger_, "Received TTS_SetGlobalProperties event"); + LOG4CXX_DEBUG(logger_, "Received TTS_SetGlobalProperties event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); is_tts_received_ = true; tts_result_ = static_cast<hmi_apis::Common_Result::eType>( @@ -303,6 +373,15 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { } break; } + case hmi_apis::FunctionID::RC_SetGlobalProperties: { + LOG4CXX_DEBUG(logger_, "Received RC_SetGlobalProperties event"); + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_RC); + is_rc_received_ = true; + rc_result_ = static_cast<hmi_apis::Common_Result::eType>( + message[strings::params][hmi_response::code].asInt()); + GetInfo(message, rc_response_info_); + break; + } default: { LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); return; @@ -317,10 +396,21 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { std::string response_info; const bool result = PrepareResponseParameters(result_code, response_info); - SendResponse(result, - result_code, - response_info.empty() ? NULL : response_info.c_str(), - &(message[strings::msg_params])); + if (result && !is_menu_layout_available_) { + response_info = + "The MenuLayout specified is unsupported, the " + "default MenuLayout will be used." + + response_info; + SendResponse(result, + mobile_apis::Result::WARNINGS, + response_info.c_str(), + &(message[strings::msg_params])); + } else { + SendResponse(result, + result_code, + response_info.empty() ? NULL : response_info.c_str(), + &(message[strings::msg_params])); + } } bool SetGlobalPropertiesRequest::Init() { @@ -338,28 +428,173 @@ bool SetGlobalPropertiesRequest::PrepareResponseParameters( app_mngr::commands::ResponseInfo tts_properties_info( tts_result_, HmiInterfaces::HMI_INTERFACE_TTS, application_manager_); - const bool result = - PrepareResultForMobileResponse(ui_properties_info, tts_properties_info); + + app_mngr::commands::ResponseInfo rc_properties_info( + rc_result_, HmiInterfaces::HMI_INTERFACE_RC, application_manager_); + + bool result = false; + + if (!is_rc_send_) { + result = CommandRequestImpl::PrepareResultForMobileResponse( + ui_properties_info, tts_properties_info); + } else { + result = PrepareResultForMobileResponse( + ui_properties_info, tts_properties_info, rc_properties_info); + } if (result && (HmiInterfaces::STATE_AVAILABLE == tts_properties_info.interface_state) && (tts_properties_info.is_unsupported_resource)) { result_code = mobile_apis::Result::WARNINGS; tts_response_info_ = "Unsupported phoneme type sent in a prompt"; - info = app_mngr::commands::MergeInfos(tts_properties_info, - tts_response_info_, - ui_properties_info, - ui_response_info_); + info = MergeInfos(tts_properties_info, + tts_response_info_, + ui_properties_info, + ui_response_info_, + rc_properties_info, + rc_response_info_); return result; } - result_code = - PrepareResultCodeForResponse(ui_properties_info, tts_properties_info); - info = app_mngr::commands::MergeInfos(tts_properties_info, - tts_response_info_, - ui_properties_info, - ui_response_info_); + + if (!is_rc_send_) { + result_code = CommandRequestImpl::PrepareResultCodeForResponse( + ui_properties_info, tts_properties_info); + } else { + result_code = PrepareResultCodeForResponse( + ui_properties_info, tts_properties_info, rc_properties_info); + } + info = MergeInfos(tts_properties_info, + tts_response_info_, + ui_properties_info, + ui_response_info_, + rc_properties_info, + rc_response_info_); return result; } +bool SetGlobalPropertiesRequest::PrepareResultForMobileResponse( + const app_mngr::commands::ResponseInfo& first, + const app_mngr::commands::ResponseInfo& second, + const app_mngr::commands::ResponseInfo& third) const { + LOG4CXX_AUTO_TRACE(logger_); + + app_mngr::commands::ResponseInfo both_info; + std::vector<hmi_apis::Common_Result::eType> success_result_codes{ + hmi_apis::Common_Result::SUCCESS, + hmi_apis::Common_Result::WARNINGS, + hmi_apis::Common_Result::WRONG_LANGUAGE, + hmi_apis::Common_Result::RETRY, + hmi_apis::Common_Result::SAVED}; + + both_info.is_ok = + helpers::in_range(success_result_codes, first.result_code) && + helpers::in_range(success_result_codes, second.result_code); + + both_info.is_not_used = + (hmi_apis::Common_Result::INVALID_ENUM == first.result_code) || + (hmi_apis::Common_Result::INVALID_ENUM == second.result_code); + + both_info.is_unsupported_resource = + (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == first.result_code) || + (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == second.result_code); + + const bool final_result = CommandRequestImpl::CheckResult(both_info, third) || + CommandRequestImpl::CheckResult(third, both_info); + + return final_result; +} + +mobile_apis::Result::eType +SetGlobalPropertiesRequest::PrepareResultCodeForResponse( + const app_mngr::commands::ResponseInfo& first, + const app_mngr::commands::ResponseInfo& second, + const app_mngr::commands::ResponseInfo& third) { + LOG4CXX_AUTO_TRACE(logger_); + mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM; + if (IsResultCodeUnsupported(first, second, third) || + IsResultCodeUnsupported(second, third, first) || + IsResultCodeUnsupported(third, first, second)) { + return mobile_apis::Result::UNSUPPORTED_RESOURCE; + } + if (IsResultCodeWarning(first, second, third) || + IsResultCodeWarning(second, third, first) || + IsResultCodeWarning(third, first, second)) { + return mobile_apis::Result::WARNINGS; + } + // If response contains erroneous result code SDL need return erroneous + // result code. + auto first_result = hmi_apis::Common_Result::INVALID_ENUM; + auto second_result = hmi_apis::Common_Result::INVALID_ENUM; + auto third_result = hmi_apis::Common_Result::INVALID_ENUM; + + if (!first.is_unsupported_resource) { + first_result = first.result_code; + } + if (!second.is_unsupported_resource) { + second_result = second.result_code; + } + if (!third.is_unsupported_resource) { + third_result = third.result_code; + } + + hmi_apis::Common_Result::eType intermediate_result = + std::max(first_result, second_result); + result_code = MessageHelper::HMIToMobileResult( + std::max(intermediate_result, third_result)); + + return result_code; +} + +bool SetGlobalPropertiesRequest::IsResultCodeUnsupported( + const application_manager::commands::ResponseInfo& first, + const application_manager::commands::ResponseInfo& second, + const application_manager::commands::ResponseInfo& third) const { + const bool first_ok_second_or_third_unsupported = + (first.is_ok || first.is_not_used) && + (second.is_unsupported_resource || third.is_unsupported_resource); + const bool final_unsupported = first.is_unsupported_resource && + second.is_unsupported_resource && + third.is_unsupported_resource; + + return first_ok_second_or_third_unsupported || final_unsupported; +} + +std::string SetGlobalPropertiesRequest::MergeInfos( + const app_mngr::commands::ResponseInfo& first_info, + const std::string& first_str, + const app_mngr::commands::ResponseInfo& second_info, + const std::string& second_str, + const app_mngr::commands::ResponseInfo& third_info, + const std::string& third_str) { + if ((first_info.interface_state == HmiInterfaces::STATE_NOT_AVAILABLE) && + + ((second_info.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE) && + !second_str.empty()) && + ((third_info.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE) && + !third_str.empty())) { + return second_str; + } + + if ((second_info.interface_state == HmiInterfaces::STATE_NOT_AVAILABLE) && + ((first_info.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE) && + !first_str.empty()) && + ((third_info.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE) && + !third_str.empty())) { + return first_str; + } + + if ((third_info.interface_state == HmiInterfaces::STATE_NOT_AVAILABLE) && + ((first_info.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE) && + !first_str.empty()) && + ((second_info.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE) && + !second_str.empty())) { + return third_str; + } + + std::string intermediate_result = + app_mngr::commands::MergeInfos(first_str, second_str); + return app_mngr::commands::MergeInfos(intermediate_result, third_str); +} + void SetGlobalPropertiesRequest::PrepareUIRequestVRHelpData( const ApplicationSharedPtr app, const smart_objects::SmartObject& msg_params, @@ -422,8 +657,19 @@ void SetGlobalPropertiesRequest::SendUIRequest( hmi_apis::FunctionID::UI_SetGlobalProperties, ¶ms, use_events); } +void SetGlobalPropertiesRequest::SendRCRequest( + const ns_smart_device_link::ns_smart_objects::SmartObject& params, + bool use_events) { + LOG4CXX_AUTO_TRACE(logger_); + is_rc_send_ = true; + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_RC); + SendHMIRequest( + hmi_apis::FunctionID::RC_SetGlobalProperties, ¶ms, use_events); +} + bool SetGlobalPropertiesRequest::IsPendingResponseExist() { - return is_ui_send_ != is_ui_received_ || is_tts_send_ != is_tts_received_; + return is_ui_send_ != is_ui_received_ || is_tts_send_ != is_tts_received_ || + is_rc_send_ != is_rc_received_; } bool SetGlobalPropertiesRequest::ValidateConditionalMandatoryParameters( @@ -435,7 +681,9 @@ bool SetGlobalPropertiesRequest::ValidateConditionalMandatoryParameters( params.keyExists(strings::vr_help) || params.keyExists(strings::menu_title) || params.keyExists(strings::menu_icon) || - params.keyExists(strings::keyboard_properties); + params.keyExists(strings::keyboard_properties) || + params.keyExists(strings::menu_layout) || + params.keyExists(strings::user_location); } bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() { @@ -531,7 +779,8 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() { strings::limited_character_list)) { const smart_objects::SmartArray* lcl_array = msg_params[strings::keyboard_properties] - [strings::limited_character_list].asArray(); + [strings::limited_character_list] + .asArray(); smart_objects::SmartArray::const_iterator it_lcl = lcl_array->begin(); smart_objects::SmartArray::const_iterator it_lcl_end = lcl_array->end(); @@ -548,16 +797,21 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() { } if (msg_params[strings::keyboard_properties].keyExists( - strings::auto_complete_text)) { - str = - msg_params[strings::keyboard_properties][strings::auto_complete_text] - .asCharArray(); + strings::auto_complete_list)) { + const smart_objects::SmartArray* acl_array = + msg_params[strings::keyboard_properties][strings::auto_complete_list] + .asArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid keyboard_properties " - "auto_complete_text syntax check failed"); - return true; + smart_objects::SmartArray::const_iterator it = acl_array->begin(); + + for (; it != acl_array->end(); ++it) { + str = it->asCharArray(); + if (!CheckSyntax(str)) { + LOG4CXX_ERROR(logger_, + "Invalid keyboard_properties " + "auto_complete_list syntax check failed"); + return true; + } } } } @@ -565,4 +819,4 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() { } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_response.cc index 567a1a088b..1de2b97d3a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_response.cc @@ -61,4 +61,4 @@ void SetGlobalPropertiesResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc index 55bd164368..d610090aa4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc @@ -33,10 +33,10 @@ #include "sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h" -#include "application_manager/message_helper.h" #include "application_manager/application_impl.h" -#include "interfaces/MOBILE_API.h" +#include "application_manager/message_helper.h" #include "interfaces/HMI_API.h" +#include "interfaces/MOBILE_API.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -163,4 +163,4 @@ bool SetMediaClockRequest::isDataValid() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_response.cc index e777533ce4..948ff84156 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_response.cc @@ -61,4 +61,4 @@ void SetMediaClockTimerResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc new file mode 100644 index 0000000000..36278168dc --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2018, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "sdl_rpc_plugin/commands/mobile/show_app_menu_request.h" + +#include "application_manager/message_helper.h" +#include "utils/helpers.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +ShowAppMenuRequest::ShowAppMenuRequest( + 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) {} + +ShowAppMenuRequest::~ShowAppMenuRequest() {} + +void ShowAppMenuRequest::Run() { + using namespace app_mngr; + LOG4CXX_AUTO_TRACE(logger_); + + ApplicationSharedPtr app = application_manager_.application(connection_key()); + + if (!app) { + LOG4CXX_ERROR( + logger_, + "Application with id " << connection_key() << " is not registered."); + SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); + return; + } + + if (mobile_apis::HMILevel::HMI_FULL != + app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW) || + helpers::Compare<mobile_apis::SystemContext::eType, + helpers::NEQ, + helpers::ALL>( + app->system_context(mobile_apis::PredefinedWindows::DEFAULT_WINDOW), + mobile_apis::SystemContext::SYSCTXT_MAIN, + mobile_apis::SystemContext::SYSCTXT_MENU)) { + LOG4CXX_ERROR( + logger_, + "Application with id " << connection_key() << " is not activated."); + SendResponse(false, mobile_apis::Result::REJECTED); + return; + } + + auto msg_params = smart_objects::SmartObject(smart_objects::SmartType_Map); + msg_params[strings::app_id] = app->app_id(); + + const auto& received_msg_params = (*message_)[strings::msg_params]; + if (received_msg_params.keyExists(strings::menu_id)) { + const int32_t menu_id = received_msg_params[strings::menu_id].asInt(); + if (!app->FindSubMenu(menu_id)) { + LOG4CXX_ERROR(logger_, "Menu with id " << menu_id << " is not found."); + SendResponse(false, mobile_apis::Result::INVALID_ID); + return; + } + msg_params[strings::menu_id] = menu_id; + } + + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); + SendHMIRequest(hmi_apis::FunctionID::UI_ShowAppMenu, &msg_params, true); +} + +void ShowAppMenuRequest::on_event(const app_mngr::event_engine::Event& event) { + using namespace app_mngr; + LOG4CXX_AUTO_TRACE(logger_); + const smart_objects::SmartObject& message = event.smart_object(); + + switch (event.id()) { + case hmi_apis::FunctionID::UI_ShowAppMenu: { + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); + const auto result_code = static_cast<hmi_apis::Common_Result::eType>( + message[strings::params][hmi_response::code].asInt()); + std::string response_info; + GetInfo(message, response_info); + const bool result = PrepareResultForMobileResponse( + result_code, HmiInterfaces::HMI_INTERFACE_UI); + + ApplicationSharedPtr app = + application_manager_.application(connection_key()); + + if (!app) { + LOG4CXX_ERROR(logger_, + "Application with id " << connection_key() + << " is not registered."); + return; + } + + SendResponse(result, + MessageHelper::HMIToMobileResult(result_code), + response_info.empty() ? NULL : response_info.c_str(), + &message[strings::msg_params]); + break; + } + default: { + LOG4CXX_ERROR(logger_, "Received unknown event: " << event.id()); + return; + } + } +} + +} // namespace commands +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_response.cc new file mode 100644 index 0000000000..2b952ea9ac --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_response.cc @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2018, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "sdl_rpc_plugin/commands/mobile/show_app_menu_response.h" + +#include "application_manager/rpc_service.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +ShowAppMenuResponse::ShowAppMenuResponse( + 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) {} + +ShowAppMenuResponse::~ShowAppMenuResponse() {} + +void ShowAppMenuResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + rpc_service_.SendMessageToMobile(message_); +} + +} // namespace commands +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc index 3b2936e6cd..b439c1cb16 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc @@ -31,15 +31,15 @@ POSSIBILITY OF SUCH DAMAGE. */ -#include <cstring> #include "sdl_rpc_plugin/commands/mobile/show_constant_tbt_request.h" +#include <cstring> -#include "application_manager/policies/policy_handler.h" #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" +#include "application_manager/policies/policy_handler.h" #include "application_manager/policies/policy_handler_interface.h" -#include "interfaces/MOBILE_API.h" #include "interfaces/HMI_API.h" +#include "interfaces/MOBILE_API.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -228,7 +228,8 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() { if ((*message_)[strings::msg_params].keyExists(strings::next_turn_icon)) { str = (*message_)[strings::msg_params][strings::next_turn_icon] - [strings::value].asCharArray(); + [strings::value] + .asCharArray(); if (!CheckSyntax(str)) { LOG4CXX_ERROR(logger_, "Invalid next_turn_icon value syntax check failed"); @@ -289,4 +290,4 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_response.cc index 239040a3b3..d027daf77d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_response.cc @@ -63,4 +63,4 @@ void ShowConstantTBTResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc index e0c3e1da9a..84d11f8e09 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc @@ -30,12 +30,12 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <string.h> #include "sdl_rpc_plugin/commands/mobile/show_request.h" +#include <string.h> -#include "application_manager/policies/policy_handler.h" #include "application_manager/application.h" #include "application_manager/message_helper.h" +#include "application_manager/policies/policy_handler.h" #include "utils/file_system.h" #include "utils/helpers.h" @@ -55,7 +55,12 @@ ShowRequest::ShowRequest( rpc_service, hmi_capabilities, policy_handler) - , core_result_code_(mobile_apis::Result::INVALID_ENUM) {} + , core_result_code_(mobile_apis::Result::INVALID_ENUM) + , current_window_id_(mobile_apis::PredefinedWindows::DEFAULT_WINDOW) + , template_config_(smart_objects::SmartType::SmartType_Null) + , layout_change_required_(false) + , dcs_change_required_(false) + , ncs_change_required_(false) {} ShowRequest::~ShowRequest() {} @@ -94,6 +99,137 @@ void ShowRequest::HandleMetadata(const char* field_id, } } +bool ShowRequest::CheckTemplateConfigurationForApp( + application_manager::Application& app) { + LOG4CXX_AUTO_TRACE(logger_); + + if ((*message_)[strings::msg_params].keyExists(strings::window_id)) { + current_window_id_ = + (*message_)[strings::msg_params][strings::window_id].asInt(); + } + + const auto set_window_layout = [&app, this]() -> bool { + const auto new_template_layout = + template_config_[strings::template_layout].asString(); + const auto old_template_layout = app.window_layout(current_window_id_); + LOG4CXX_DEBUG(logger_, "New layout: " << new_template_layout); + LOG4CXX_DEBUG(logger_, "Old layout: " << old_template_layout); + + const bool layouts_equal = (new_template_layout == old_template_layout); + + if (!new_template_layout.empty() && !layouts_equal) { + // Template switched, hence allow any color change + LOG4CXX_DEBUG(logger_, + "Show Request: Setting new Layout: " << new_template_layout + << " for window ID: " + << current_window_id_); + layout_change_required_ = true; + return true; + } + LOG4CXX_DEBUG(logger_, "Show Request: No Layout Change"); + return false; + }; + + const auto set_day_color_scheme = [&app, this]() -> bool { + if (!template_config_.keyExists(strings::day_color_scheme)) { + return false; + } + if (app.day_color_scheme(current_window_id_).getType() != + smart_objects::SmartType_Null && + template_config_[strings::day_color_scheme] != + app.day_color_scheme(current_window_id_)) { + // Color scheme param exists and has been previously set, + // hence do not allow color change + LOG4CXX_DEBUG(logger_, "Day Color Scheme change is rejected"); + return false; + } + LOG4CXX_DEBUG(logger_, "Day Color Scheme change is allowed"); + dcs_change_required_ = true; + + return true; + }; + + const auto set_night_color_scheme = [&app, this]() -> bool { + if (!template_config_.keyExists(strings::night_color_scheme)) { + return false; + } + if (app.night_color_scheme(current_window_id_).getType() != + smart_objects::SmartType_Null && + template_config_[strings::night_color_scheme] != + app.night_color_scheme(current_window_id_)) { + // Color scheme param exists and has been previously set, + // hence do not allow color change + LOG4CXX_DEBUG(logger_, "Night Color Scheme change is rejected"); + return false; + } + LOG4CXX_DEBUG(logger_, "Night Color Scheme Change is allowed"); + ncs_change_required_ = true; + + return true; + }; + + const bool set_layout_result = set_window_layout(); + + if (set_layout_result) { + set_day_color_scheme(); + set_night_color_scheme(); + return true; + } + + if (!template_config_.keyExists(strings::night_color_scheme) && + !template_config_.keyExists(strings::day_color_scheme)) { + // In case current layout was not changed and day and night color + // schemes are absent in mobile message SDL has to forward message + // to HMI with the only layout even it was not changed + return true; + } + + const bool set_schemes_result = + (set_day_color_scheme() && set_night_color_scheme()); + + return set_schemes_result; +} + +void ShowRequest::ApplyTemplateConfigurationForApp( + mobile_apis::Result::eType result, application_manager::Application& app) { + LOG4CXX_AUTO_TRACE(logger_); + if (helpers::Compare<mobile_apis::Result::eType, helpers::EQ, helpers::ONE>( + result, + mobile_apis::Result::SUCCESS, + mobile_apis::Result::WARNINGS)) { + if (layout_change_required_) { + const std::string new_layout = + template_config_[strings::template_layout].asString(); + LOG4CXX_DEBUG(logger_, "New layout : " << new_layout << " is applied"); + app.set_window_layout(current_window_id_, new_layout); + + if (template_config_.keyExists(strings::day_color_scheme)) { + app.set_day_color_scheme(current_window_id_, + template_config_[strings::day_color_scheme]); + } + + if (template_config_.keyExists(strings::night_color_scheme)) { + app.set_night_color_scheme( + current_window_id_, template_config_[strings::night_color_scheme]); + } + + return; + } + + if (dcs_change_required_) { + LOG4CXX_DEBUG(logger_, "New day color scheme is applied"); + app.set_day_color_scheme(current_window_id_, + template_config_[strings::day_color_scheme]); + } + + if (ncs_change_required_) { + LOG4CXX_DEBUG(logger_, "New night color scheme is applied"); + app.set_night_color_scheme(current_window_id_, + template_config_[strings::night_color_scheme]); + } + } +} + void ShowRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); @@ -138,7 +274,8 @@ void ShowRequest::Run() { mobile_apis::Result::eType verification_result = mobile_apis::Result::SUCCESS; if (((*message_)[strings::msg_params].keyExists(strings::graphic)) && ((*message_)[strings::msg_params][strings::graphic][strings::value] - .asString()).length()) { + .asString()) + .length()) { verification_result = MessageHelper::VerifyImage( (*message_)[strings::msg_params][strings::graphic], app, @@ -217,6 +354,14 @@ void ShowRequest::Run() { HandleMetadata(strings::main_field_4, main_field_4_index, msg_params); } + if ((*message_)[strings::msg_params].keyExists(strings::template_title)) { + msg_params[hmi_request::show_strings][index][hmi_request::field_name] = + static_cast<int32_t>(hmi_apis::Common_TextFieldName::templateTitle); + msg_params[hmi_request::show_strings][index][hmi_request::field_text] = + (*message_)[strings::msg_params][strings::template_title]; + ++index; + } + if ((*message_)[strings::msg_params].keyExists(strings::media_clock)) { msg_params[hmi_request::show_strings][index][hmi_request::field_name] = static_cast<int32_t>(hmi_apis::Common_TextFieldName::mediaClock); @@ -263,7 +408,7 @@ void ShowRequest::Run() { app->UnsubscribeFromSoftButtons(function_id()); } else { MessageHelper::SubscribeApplicationToSoftButton( - (*message_)[strings::msg_params], app, function_id()); + (*message_)[strings::msg_params], app, function_id(), window_id()); } } @@ -272,6 +417,33 @@ void ShowRequest::Run() { (*message_)[strings::msg_params][strings::custom_presets]; } + if ((*message_)[strings::msg_params].keyExists(strings::window_id)) { + const auto window_id = + (*message_)[strings::msg_params][strings::window_id].asInt(); + if (!app->WindowIdExists(window_id)) { + LOG4CXX_ERROR(logger_, + "Window with id #" << window_id << " does not exist"); + SendResponse(false, mobile_apis::Result::INVALID_ID); + return; + } + msg_params[strings::window_id] = window_id; + } + + if ((*message_)[strings::msg_params].keyExists( + strings::template_configuration)) { + template_config_ = + (*message_)[strings::msg_params][strings::template_configuration]; + const bool result = CheckTemplateConfigurationForApp(*app); + if (!result) { + const char* info( + "Color schemes can not be changed without a new template set"); + SendResponse(false, mobile_apis::Result::REJECTED, info); + return; + } + msg_params[strings::template_configuration] = + (*message_)[strings::msg_params][strings::template_configuration]; + } + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); SendHMIRequest(hmi_apis::FunctionID::UI_Show, &msg_params, true); @@ -285,6 +457,13 @@ void ShowRequest::on_event(const event_engine::Event& event) { using namespace helpers; const smart_objects::SmartObject& message = event.smart_object(); + 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; + } switch (event.id()) { case hmi_apis::FunctionID::UI_Show: { @@ -304,6 +483,9 @@ void ShowRequest::on_event(const event_engine::Event& event) { } mobile_apis::Result::eType converted_result_code = MessageHelper::HMIToMobileResult(result_code); + + ApplyTemplateConfigurationForApp(converted_result_code, *app); + if (mobile_apis::Result::SUCCESS == converted_result_code && mobile_apis::Result::INVALID_ENUM != core_result_code_) { converted_result_code = core_result_code_; @@ -354,6 +536,14 @@ bool ShowRequest::CheckStringsOfShowRequest() { return false; } } + if ((*message_)[strings::msg_params].keyExists(strings::template_title)) { + str = + (*message_)[strings::msg_params][strings::template_title].asCharArray(); + if (strlen(str) && !CheckSyntax(str)) { + LOG4CXX_ERROR(logger_, "Invalid templateTitle syntax check failed"); + return false; + } + } if ((*message_)[strings::msg_params].keyExists(strings::status_bar)) { str = (*message_)[strings::msg_params][strings::status_bar].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { @@ -398,7 +588,8 @@ bool ShowRequest::CheckStringsOfShowRequest() { if ((*message_)[strings::msg_params].keyExists(strings::secondary_graphic)) { str = (*message_)[strings::msg_params][strings::secondary_graphic] - [strings::value].asCharArray(); + [strings::value] + .asCharArray(); if (!CheckSyntax(str)) { LOG4CXX_ERROR(logger_, "Invalid secondary_graphic value syntax check failed"); @@ -410,4 +601,4 @@ bool ShowRequest::CheckStringsOfShowRequest() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_response.cc index 4e167e7531..f5667189b7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_response.cc @@ -32,8 +32,8 @@ */ #include "sdl_rpc_plugin/commands/mobile/show_response.h" -#include "application_manager/rpc_service.h" #include "application_manager/application_impl.h" +#include "application_manager/rpc_service.h" #include "interfaces/HMI_API.h" namespace sdl_rpc_plugin { @@ -63,4 +63,4 @@ void ShowResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc index 08b4775d3f..dd7b426b40 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc @@ -35,8 +35,8 @@ #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" -#include "utils/helpers.h" #include "config_profile/profile.h" +#include "utils/helpers.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -116,6 +116,11 @@ void SliderRequest::Run() { msg_params[strings::timeout] = default_timeout_; } + if ((*message_)[strings::msg_params].keyExists(strings::cancel_id)) { + msg_params[strings::cancel_id] = + (*message_)[strings::msg_params][strings::cancel_id].asInt(); + } + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); SendHMIRequest(hmi_apis::FunctionID::UI_Slider, &msg_params, true); } @@ -204,4 +209,4 @@ bool SliderRequest::IsWhiteSpaceExist() { } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_response.cc index 4d6e714e88..4ac96a272e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_response.cc @@ -61,4 +61,4 @@ void SliderResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc index e14321c488..0730a8730f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc @@ -31,8 +31,8 @@ POSSIBILITY OF SUCH DAMAGE. */ -#include <string.h> #include "sdl_rpc_plugin/commands/mobile/speak_request.h" +#include <string.h> #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" @@ -84,9 +84,9 @@ void SpeakRequest::Run() { MessageHelper::VerifyTtsFiles(tts_chunks, app, application_manager_); if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) { - LOG4CXX_ERROR(logger_, - "MessageHelper::VerifyTtsFiles return " - << verification_result); + LOG4CXX_ERROR( + logger_, + "MessageHelper::VerifyTtsFiles return " << verification_result); SendResponse(false, mobile_apis::Result::FILE_NOT_FOUND, "One or more files needed for tts_chunks are not present"); @@ -181,4 +181,4 @@ bool SpeakRequest::IsWhiteSpaceExist() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_response.cc index f57bd91cd5..69b04977ef 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_response.cc @@ -32,8 +32,8 @@ */ #include "sdl_rpc_plugin/commands/mobile/speak_response.h" -#include "application_manager/rpc_service.h" #include "application_manager/application_impl.h" +#include "application_manager/rpc_service.h" #include "interfaces/HMI_API.h" namespace sdl_rpc_plugin { @@ -63,4 +63,4 @@ void SpeakResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc index f76b6ab210..1acb2a7438 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc @@ -126,6 +126,26 @@ bool SubscribeButtonRequest::IsSubscriptionAllowed( (mobile_apis::ButtonName::TUNEDOWN == btn_id))) { return false; } + + if (!app->is_navi() && + ((mobile_apis::ButtonName::NAV_CENTER_LOCATION == btn_id) || + (mobile_apis::ButtonName::NAV_ZOOM_IN == btn_id) || + (mobile_apis::ButtonName::NAV_ZOOM_OUT == btn_id) || + (mobile_apis::ButtonName::NAV_PAN_UP == btn_id) || + (mobile_apis::ButtonName::NAV_PAN_UP_RIGHT == btn_id) || + (mobile_apis::ButtonName::NAV_PAN_RIGHT == btn_id) || + (mobile_apis::ButtonName::NAV_PAN_DOWN_RIGHT == btn_id) || + (mobile_apis::ButtonName::NAV_PAN_DOWN == btn_id) || + (mobile_apis::ButtonName::NAV_PAN_DOWN_LEFT == btn_id) || + (mobile_apis::ButtonName::NAV_PAN_LEFT == btn_id) || + (mobile_apis::ButtonName::NAV_PAN_UP_LEFT == btn_id) || + (mobile_apis::ButtonName::NAV_TILT_TOGGLE == btn_id) || + (mobile_apis::ButtonName::NAV_ROTATE_CLOCKWISE == btn_id) || + (mobile_apis::ButtonName::NAV_ROTATE_COUNTERCLOCKWISE == btn_id) || + (mobile_apis::ButtonName::NAV_HEADING_TOGGLE == btn_id))) { + return false; + } + return true; } @@ -144,4 +164,4 @@ void SubscribeButtonRequest::SendSubscribeButtonNotification() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_response.cc index 1350cfb66e..e584f84f4c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_response.cc @@ -70,4 +70,4 @@ void SubscribeButtonResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc index eb4ca42568..2ee7771833 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc @@ -30,8 +30,8 @@ POSSIBILITY OF SUCH DAMAGE. */ -#include "application_manager/application_manager.h" #include "sdl_rpc_plugin/commands/mobile/subscribe_way_points_request.h" +#include "application_manager/application_manager.h" #include "application_manager/message_helper.h" namespace sdl_rpc_plugin { @@ -120,4 +120,4 @@ bool SubscribeWayPointsRequest::Init() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_response.cc index 7d051df7e9..45486792d7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_response.cc @@ -30,9 +30,9 @@ POSSIBILITY OF SUCH DAMAGE. */ +#include "sdl_rpc_plugin/commands/mobile/subscribe_way_points_response.h" #include "application_manager/application_manager.h" #include "application_manager/rpc_service.h" -#include "sdl_rpc_plugin/commands/mobile/subscribe_way_points_response.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -61,4 +61,4 @@ void SubscribeWayPointsResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc index ca9182469a..9be5a270f5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc @@ -33,19 +33,19 @@ Copyright (c) 2018, Ford Motor Company #include "sdl_rpc_plugin/commands/mobile/system_request.h" -#include <vector> -#include <string> #include <stdio.h> #include <algorithm> #include <sstream> +#include <string> +#include <vector> #include "application_manager/policies/policy_handler_interface.h" -#include "interfaces/MOBILE_API.h" -#include "utils/file_system.h" -#include "policy/policy_table/enums.h" #include "formatters/CFormatterJsonBase.h" +#include "interfaces/MOBILE_API.h" #include "json/json.h" -#include "utils/helpers.h" +#include "policy/policy_table/enums.h" #include "utils/custom_string.h" +#include "utils/file_system.h" +#include "utils/helpers.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -170,17 +170,18 @@ class QueryAppsDataValidator { << "Package name length [" << app_data[json::android][json::packageName] .asString() - .length() << "] exceeds max length [" - << kPackageNameLengthMax << "]in json file."); + .length() + << "] exceeds max length [" << kPackageNameLengthMax + << "]in json file."); return false; } } // Languages verification if (!app_data[os_type].keyExists(json::languages)) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "'languages' doesn't exist"); + LOG4CXX_WARN( + logger_, + kQueryAppsValidationFailedPrefix << "'languages' doesn't exist"); return false; } if (!ValidateLanguages(app_data[os_type][json::languages], @@ -217,9 +218,9 @@ class QueryAppsDataValidator { ApplicationSharedPtr registered_app = manager_.application_by_policy_id(app_id); if (registered_app) { - LOG4CXX_INFO(logger_, - "Application with the id: " << app_id - << " is already registered."); + LOG4CXX_INFO( + logger_, + "Application with the id: " << app_id << " is already registered."); } // And app name length const std::string appName(app_data[json::name].asString()); @@ -250,9 +251,9 @@ class QueryAppsDataValidator { for (size_t idx = 0; idx < languages_array_size; ++idx) { const smart_objects::SmartObject& language = languages.getElement(idx); if (smart_objects::SmartType_Map != language.getType()) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "language is not a map."); + LOG4CXX_WARN( + logger_, + kQueryAppsValidationFailedPrefix << "language is not a map."); return false; } if (language.length() != 1) { @@ -263,9 +264,9 @@ class QueryAppsDataValidator { } const std::string language_name = (*language.map_begin()).first; if (!language_name.length()) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "language name is empty"); + LOG4CXX_WARN( + logger_, + kQueryAppsValidationFailedPrefix << "language name is empty"); return false; } // Verify default language defined @@ -329,9 +330,9 @@ class QueryAppsDataValidator { const smart_objects::SmartArray* synonyms_array = language[language_name][json::vrSynonyms].asArray(); if (!synonyms_array) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "vrSynonyms is not array."); + LOG4CXX_WARN( + logger_, + kQueryAppsValidationFailedPrefix << "vrSynonyms is not array."); return false; } const size_t synonyms_array_size = synonyms_array->size(); @@ -421,7 +422,7 @@ class QueryAppsDataValidator { DISALLOW_COPY_AND_ASSIGN(QueryAppsDataValidator); }; -} +} // namespace namespace commands { @@ -469,8 +470,8 @@ void SystemRequest::Run() { static_cast<rpc::policy_table_interface_base::RequestType>( request_type)); - if (!policy_handler.IsRequestTypeAllowed(application->policy_app_id(), - request_type)) { + if (!policy_handler.IsRequestTypeAllowed( + application->device(), application->policy_app_id(), request_type)) { LOG4CXX_ERROR(logger_, "RequestType " << stringified_request_type << " is DISALLOWED by policies"); @@ -699,9 +700,9 @@ void SystemRequest::on_event(const event_engine::Event& event) { bool SystemRequest::ValidateQueryAppData( smart_objects::SmartObject& data) const { if (!data.isValid()) { - LOG4CXX_ERROR(logger_, - kQueryAppsValidationFailedPrefix - << "QueryApps response is not valid."); + LOG4CXX_ERROR( + logger_, + kQueryAppsValidationFailedPrefix << "QueryApps response is not valid."); return false; } if (!data.keyExists(json::response)) { @@ -718,4 +719,4 @@ bool SystemRequest::ValidateQueryAppData( } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_response.cc index dc2e3ea3f5..428901a1c5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_response.cc @@ -61,4 +61,4 @@ void SystemResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_request.cc index 9119fb48da..3ba0513aeb 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_request.cc @@ -32,8 +32,8 @@ */ #include "sdl_rpc_plugin/commands/mobile/unregister_app_interface_request.h" -#include "application_manager/rpc_service.h" #include "application_manager/message_helper.h" +#include "application_manager/rpc_service.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -62,4 +62,4 @@ void UnregisterAppInterfaceRequest::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_response.cc index 4e7c879b58..7c90639968 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_response.cc @@ -45,4 +45,4 @@ void UnregisterAppInterfaceResponse::Run() { } } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc index 0c30f567b4..ec8de68c9e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc @@ -94,7 +94,7 @@ void UnsubscribeButtonRequest::Run() { if (!app->UnsubscribeFromButton( static_cast<mobile_apis::ButtonName::eType>(btn_id))) { - LOG4CXX_ERROR(logger_, "App doesn't subscibe to button " << btn_id); + LOG4CXX_ERROR(logger_, "App doesn't subscribe to button " << btn_id); SendResponse(false, mobile_apis::Result::IGNORED); return; } @@ -123,4 +123,4 @@ void UnsubscribeButtonRequest::SendUnsubscribeButtonNotification() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_response.cc index 592b91851e..c69d49bca1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_response.cc @@ -71,4 +71,4 @@ void UnsubscribeButtonResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc index 4b40b7a9ce..17326a99a0 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc @@ -30,8 +30,8 @@ POSSIBILITY OF SUCH DAMAGE. */ -#include "application_manager/application_manager.h" #include "sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_request.h" +#include "application_manager/application_manager.h" #include "application_manager/message_helper.h" namespace sdl_rpc_plugin { @@ -125,4 +125,4 @@ bool UnsubscribeWayPointsRequest::Init() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_response.cc index 67e3466a44..a7a180fb46 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_response.cc @@ -30,8 +30,8 @@ POSSIBILITY OF SUCH DAMAGE. */ -#include "application_manager/application_manager.h" #include "sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_response.h" +#include "application_manager/application_manager.h" #include "application_manager/rpc_service.h" namespace sdl_rpc_plugin { @@ -61,4 +61,4 @@ void UnsubscribeWayPointsResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc index c04ad34f5f..8c2cce9765 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc @@ -31,14 +31,14 @@ POSSIBILITY OF SUCH DAMAGE. */ -#include <string> #include "sdl_rpc_plugin/commands/mobile/update_turn_list_request.h" +#include <string> -#include "application_manager/policies/policy_handler.h" #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" -#include "interfaces/MOBILE_API.h" +#include "application_manager/policies/policy_handler.h" #include "interfaces/HMI_API.h" +#include "interfaces/MOBILE_API.h" #include "utils/custom_string.h" namespace sdl_rpc_plugin { @@ -240,4 +240,4 @@ bool UpdateTurnListRequest::IsWhiteSpaceExist() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_response.cc index 5ddf355f88..eca9e3703c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_response.cc @@ -62,4 +62,4 @@ void UpdateTurnListResponse::Run() { } // namespace commands -} // namespace application_manager +} // namespace sdl_rpc_plugin |