From 0dac769e35f40bfc0de0d4676ecba0bcd74afca3 Mon Sep 17 00:00:00 2001 From: Shobhit Adlakha Date: Wed, 2 Feb 2022 12:15:02 -0500 Subject: [SDL 0334] Feature/Transform SetDisplayLayout to UI.Show (#3849) * Add changes to transform SetDisplayLayout into UI.Show * Remove deprecated RPC UI.SetDisplayLayout from the HMI API * Style fix * Add HMI capabilities to SetDisplayLayout response * Fix failed unit tests * Address review comments --- .../commands/hmi/ui_set_display_layout_request.h | 76 -------------------- .../commands/hmi/ui_set_display_layout_response.h | 78 --------------------- .../commands/hmi/ui_set_display_layout_request.cc | 63 ----------------- .../commands/hmi/ui_set_display_layout_response.cc | 68 ------------------ .../commands/mobile/set_display_layout_request.cc | 50 ++++++++------ .../sdl_rpc_plugin/src/hmi_command_factory.cc | 7 -- .../test/commands/hmi/dummy_hmi_commands_test.cc | 4 -- .../commands/hmi/simple_requests_to_hmi_test.cc | 2 - .../commands/hmi/simple_response_from_hmi_test.cc | 3 - .../commands/mobile/set_display_layout_test.cc | 80 +++++++++++++++++----- .../application_manager/src/hmi_interfaces_impl.cc | 1 - src/components/interfaces/HMI_API.xml | 31 --------- 12 files changed, 91 insertions(+), 372 deletions(-) delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_display_layout_request.h delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_display_layout_response.h delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_request.cc delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_response.cc (limited to 'src') diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_display_layout_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_display_layout_request.h deleted file mode 100644 index 446b77b997..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_display_layout_request.h +++ /dev/null @@ -1,76 +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. - */ - -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SET_DISPLAY_LAYOUT_REQUEST_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SET_DISPLAY_LAYOUT_REQUEST_H_ - -#include "application_manager/commands/request_to_hmi.h" - -namespace sdl_rpc_plugin { -namespace app_mngr = application_manager; - -namespace commands { - -/** - * @brief UiSetDisplayLayoutRequest command class - **/ -class UiSetDisplayLayoutRequest : public app_mngr::commands::RequestToHMI { - public: - /** - * @brief UiSetDisplayLayoutRequest class constructor - * - * @param message Incoming SmartObject message - **/ - UiSetDisplayLayoutRequest(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); - - /** - * @brief UiSetDisplayLayoutRequest class destructor - **/ - virtual ~UiSetDisplayLayoutRequest(); - - /** - * @brief Execute command - **/ - virtual void Run(); - - private: - DISALLOW_COPY_AND_ASSIGN(UiSetDisplayLayoutRequest); -}; - -} // namespace commands - -} // namespace sdl_rpc_plugin - -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SET_DISPLAY_LAYOUT_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_display_layout_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_display_layout_response.h deleted file mode 100644 index ade6aa1c13..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_display_layout_response.h +++ /dev/null @@ -1,78 +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. - */ - -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SET_DISPLAY_LAYOUT_RESPONSE_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SET_DISPLAY_LAYOUT_RESPONSE_H_ - -#include "application_manager/commands/response_from_hmi.h" - -namespace sdl_rpc_plugin { -namespace app_mngr = application_manager; - -namespace commands { - -/** - * @brief UiSetDisplayLayoutResponse command class - **/ -class UiSetDisplayLayoutResponse : public app_mngr::commands::ResponseFromHMI { - public: - /** - * @brief UiSetDisplayLayoutResponse class constructor - * - * @param message Incoming SmartObject message - **/ - UiSetDisplayLayoutResponse( - 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); - - /** - * @brief UiSetDisplayLayoutResponse class destructor - **/ - virtual ~UiSetDisplayLayoutResponse(); - - /** - * @brief Execute command - **/ - virtual void Run(); - - private: - DISALLOW_COPY_AND_ASSIGN(UiSetDisplayLayoutResponse); -}; - -} // namespace commands - -} // namespace sdl_rpc_plugin - -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SET_DISPLAY_LAYOUT_RESPONSE_H_ 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 deleted file mode 100644 index df0f2a9f98..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_request.cc +++ /dev/null @@ -1,63 +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/ui_set_display_layout_request.h" - -namespace sdl_rpc_plugin { -using namespace application_manager; - -namespace commands { - -SDL_CREATE_LOG_VARIABLE("Commands") - -UiSetDisplayLayoutRequest::UiSetDisplayLayoutRequest( - 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) {} - -UiSetDisplayLayoutRequest::~UiSetDisplayLayoutRequest() {} - -void UiSetDisplayLayoutRequest::Run() { - SDL_LOG_AUTO_TRACE(); - SendRequest(); -} - -} // namespace commands - -} // 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 deleted file mode 100644 index 35fe55ec4d..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_response.cc +++ /dev/null @@ -1,68 +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/ui_set_display_layout_response.h" -#include "application_manager/event_engine/event.h" -#include "interfaces/HMI_API.h" - -namespace sdl_rpc_plugin { -using namespace application_manager; - -namespace commands { - -SDL_CREATE_LOG_VARIABLE("Commands") - -UiSetDisplayLayoutResponse::UiSetDisplayLayoutResponse( - 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) {} - -UiSetDisplayLayoutResponse::~UiSetDisplayLayoutResponse() {} - -void UiSetDisplayLayoutResponse::Run() { - SDL_LOG_AUTO_TRACE(); - - event_engine::Event event(hmi_apis::FunctionID::UI_SetDisplayLayout); - 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/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 ba0a20b459..98f2a2a247 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 @@ -53,7 +53,9 @@ SetDisplayLayoutRequest::SetDisplayLayoutRequest( application_manager, rpc_service, hmi_capabilities, - policy_handler) {} + policy_handler) { + subscribe_on_event(hmi_apis::FunctionID::UI_Show); +} SetDisplayLayoutRequest::~SetDisplayLayoutRequest() {} @@ -73,8 +75,14 @@ void SetDisplayLayoutRequest::Run() { std::string old_layout = app->display_layout(); std::string new_layout = ""; + smart_objects::SmartObject show_msg_params(smart_objects::SmartType_Map); + show_msg_params[hmi_request::show_strings] = + smart_objects::SmartObject(smart_objects::SmartType_Array); + if (msg_params.keyExists(strings::display_layout)) { new_layout = msg_params[strings::display_layout].asString(); + show_msg_params[strings::template_configuration][strings::template_layout] = + new_layout; } if (new_layout != old_layout && !new_layout.empty()) { @@ -109,18 +117,22 @@ void SetDisplayLayoutRequest::Run() { if (msg_params.keyExists(strings::day_color_scheme)) { SDL_LOG_DEBUG("Allow Day Color Scheme Change"); app->set_day_color_scheme(msg_params[strings::day_color_scheme]); + show_msg_params[strings::template_configuration] + [strings::day_color_scheme] = + msg_params[strings::day_color_scheme]; } if (msg_params.keyExists(strings::night_color_scheme)) { SDL_LOG_DEBUG("Allow Night Color Scheme Change"); app->set_night_color_scheme(msg_params[strings::night_color_scheme]); + show_msg_params[strings::template_configuration] + [strings::night_color_scheme] = + msg_params[strings::night_color_scheme]; } - (*message_)[strings::msg_params][strings::app_id] = app->app_id(); + show_msg_params[strings::app_id] = app->app_id(); StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - SendHMIRequest(hmi_apis::FunctionID::UI_SetDisplayLayout, - &((*message_)[strings::msg_params]), - true); + SendHMIRequest(hmi_apis::FunctionID::UI_Show, &show_msg_params, true); } void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) { @@ -136,8 +148,8 @@ void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) { const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { - case hmi_apis::FunctionID::UI_SetDisplayLayout: { - SDL_LOG_INFO("Received UI_SetDisplayLayout event"); + case hmi_apis::FunctionID::UI_Show: { + SDL_LOG_INFO("Received UI_Show event (in set display layout)"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); hmi_apis::Common_Result::eType result_code = static_cast( @@ -150,20 +162,16 @@ 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 - if (msg_params.keyExists(hmi_response::display_capabilities)) { - if (0 == msg_params[hmi_response::display_capabilities] - [hmi_response::templates_available] - .length()) { - auto display_capabilities = hmi_capabilities.display_capabilities(); - if (display_capabilities) { - msg_params[hmi_response::display_capabilities] - [hmi_response::templates_available] = - display_capabilities->getElement( - hmi_response::templates_available); - } - } - } + // Add HMI capabilities to response + msg_params[hmi_response::display_capabilities] = + *hmi_capabilities.display_capabilities(); + msg_params[hmi_response::button_capabilities] = + *hmi_capabilities.button_capabilities(); + msg_params[hmi_response::soft_button_capabilities] = + *hmi_capabilities.soft_button_capabilities(); + msg_params[hmi_response::preset_bank_capabilities] = + *hmi_capabilities.preset_bank_capabilities(); + 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 diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc index c66e0b6950..f60a475e3e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc @@ -248,8 +248,6 @@ #include "sdl_rpc_plugin/commands/hmi/ui_cancel_interaction_response.h" #include "sdl_rpc_plugin/commands/hmi/ui_send_haptic_data_request.h" #include "sdl_rpc_plugin/commands/hmi/ui_send_haptic_data_response.h" -#include "sdl_rpc_plugin/commands/hmi/ui_set_display_layout_request.h" -#include "sdl_rpc_plugin/commands/hmi/ui_set_display_layout_response.h" #include "sdl_rpc_plugin/commands/hmi/ui_show_app_menu_request.h" #include "sdl_rpc_plugin/commands/hmi/ui_show_app_menu_response.h" @@ -834,11 +832,6 @@ CommandCreator& HMICommandFactory::get_creator_factory( case hmi_apis::FunctionID::BasicCommunication_OnResumeAudioSource: { return factory.GetCreator(); } - case hmi_apis::FunctionID::UI_SetDisplayLayout: { - return hmi_apis::messageType::request == message_type - ? factory.GetCreator() - : factory.GetCreator(); - } case hmi_apis::FunctionID::BasicCommunication_OnSDLClose: { return factory.GetCreator(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc index 2a0eda2b10..9b7246b794 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc @@ -195,8 +195,6 @@ #include "hmi/ui_scrollable_message_response.h" #include "hmi/ui_set_app_icon_request.h" #include "hmi/ui_set_app_icon_response.h" -#include "hmi/ui_set_display_layout_request.h" -#include "hmi/ui_set_display_layout_response.h" #include "hmi/ui_set_global_properties_request.h" #include "hmi/ui_set_global_properties_response.h" #include "hmi/ui_set_media_clock_timer_request.h" @@ -466,8 +464,6 @@ typedef Types, CommandData, - CommandData, CommandData, CommandData(SmartType_Map); + SmartObject text_fields(SmartType_Array); + text_fields[0] = SmartObject(SmartType_Map); + text_fields[0][am::hmi_response::button_name] = am::strings::main_field_1; + text_fields[0][am::strings::character_set] = "UTF-8"; + text_fields[0]["rows"] = 1; + text_fields[0]["width"] = 500; + (*display_capabilities)[am::hmi_response::display_type] = "SDL_GENERIC"; + (*display_capabilities)[am::hmi_response::text_fields] = text_fields; + (*display_capabilities)[am::hmi_response::media_clock_formats] = + SmartObject(SmartType_Array); + (*display_capabilities)[am::hmi_response::graphic_supported] = true; + + // Button capabilities + SmartObjectSPtr button_capabilities = + std::make_shared(SmartType_Array); + SmartObject button_capability(SmartType_Map); + button_capability[strings::button_name] = "OK"; + button_capability["shortPressAvailable"] = true; + button_capability["longPressAvailable"] = true; + button_capability["upDownAvailable"] = true; + (*button_capabilities)[0] = button_capability; + + // Soft Button capabilities + SmartObjectSPtr soft_button_capabilities = + std::make_shared(SmartType_Array); + SmartObject soft_button_capability(SmartType_Map); + soft_button_capability[am::hmi_response::image_supported] = true; + soft_button_capability["longPressAvailable"] = true; + soft_button_capability["shortPressAvailable"] = true; + soft_button_capability["upDownAvailable"] = true; + soft_button_capability["imageSupported"] = false; + (*soft_button_capabilities) = soft_button_capability; + + // Preset Bank capabilities + SmartObjectSPtr preset_bank_capabilities = + std::make_shared(SmartType_Map); + (*preset_bank_capabilities)[am::hmi_response::on_screen_presets_available] = + false; + + EXPECT_CALL(mock_hmi_capabilities_, display_capabilities()) + .WillOnce(Return(display_capabilities)); + EXPECT_CALL(mock_hmi_capabilities_, button_capabilities()) + .WillOnce(Return(button_capabilities)); + EXPECT_CALL(mock_hmi_capabilities_, soft_button_capabilities()) + .WillOnce(Return(soft_button_capabilities)); + EXPECT_CALL(mock_hmi_capabilities_, preset_bank_capabilities()) + .WillOnce(Return(preset_bank_capabilities)); + } + typedef TypeIf, application_manager_test::MockHMICapabilities>::Result @@ -147,7 +202,7 @@ TEST_F(SetDisplayLayoutRequestTest, (*msg)[am::strings::msg_params][am::strings::info] = "UI is not supported by system"; - Event event(hmi_apis::FunctionID::UI_SetDisplayLayout); + Event event(hmi_apis::FunctionID::UI_Show); event.set_smart_object(*msg); ON_CALL(mock_hmi_interfaces_, @@ -195,9 +250,8 @@ TEST_F(SetDisplayLayoutRequestTest, Run_SUCCESS) { EXPECT_CALL(app_mngr_, GetNextHMICorrelationID()) .WillOnce(Return(kCorrelationKey)); - EXPECT_CALL( - mock_hmi_interfaces_, - GetInterfaceFromFunction(hmi_apis::FunctionID::UI_SetDisplayLayout)) + EXPECT_CALL(mock_hmi_interfaces_, + GetInterfaceFromFunction(hmi_apis::FunctionID::UI_Show)) .WillRepeatedly(Return(am::HmiInterfaces::HMI_INTERFACE_UI)); EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) @@ -226,7 +280,7 @@ TEST_F(SetDisplayLayoutRequestTest, OnEvent_InvalidEventId_UNSUCCESS) { } TEST_F(SetDisplayLayoutRequestTest, OnEvent_AppVersion_v6_WARNING) { - am::event_engine::Event event(hmi_apis::FunctionID::UI_SetDisplayLayout); + am::event_engine::Event event(hmi_apis::FunctionID::UI_Show); MessageSharedPtr msg = CreateMessage(); (*msg)[am::strings::params][am::hmi_response::code] = @@ -235,12 +289,7 @@ TEST_F(SetDisplayLayoutRequestTest, OnEvent_AppVersion_v6_WARNING) { (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey; event.set_smart_object(*msg); - MessageSharedPtr dispaly_capabilities_msg = CreateMessage(); - (*dispaly_capabilities_msg)[am::hmi_response::templates_available] = - "templates_available"; - - EXPECT_CALL(mock_hmi_capabilities_, display_capabilities()) - .WillOnce(Return(dispaly_capabilities_msg)); + CreateResponseCapabilities(); EXPECT_CALL( mock_rpc_service_, ManageMobileCommand(MobileResultCodeIs(mobile_result::WARNINGS), @@ -260,7 +309,7 @@ TEST_F(SetDisplayLayoutRequestTest, OnEvent_AppVersion_v6_WARNING) { } TEST_F(SetDisplayLayoutRequestTest, OnEvent_AppVersion_v5_SUCCESS) { - am::event_engine::Event event(hmi_apis::FunctionID::UI_SetDisplayLayout); + am::event_engine::Event event(hmi_apis::FunctionID::UI_Show); MessageSharedPtr msg = CreateMessage(); (*msg)[am::strings::params][am::hmi_response::code] = @@ -269,12 +318,7 @@ TEST_F(SetDisplayLayoutRequestTest, OnEvent_AppVersion_v5_SUCCESS) { (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey; event.set_smart_object(*msg); - MessageSharedPtr dispaly_capabilities_msg = CreateMessage(); - (*dispaly_capabilities_msg)[am::hmi_response::templates_available] = - "templates_available"; - - EXPECT_CALL(mock_hmi_capabilities_, display_capabilities()) - .WillOnce(Return(dispaly_capabilities_msg)); + CreateResponseCapabilities(); EXPECT_CALL( mock_rpc_service_, ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), diff --git a/src/components/application_manager/src/hmi_interfaces_impl.cc b/src/components/application_manager/src/hmi_interfaces_impl.cc index 205585959b..eb44ff4cd6 100644 --- a/src/components/application_manager/src/hmi_interfaces_impl.cc +++ b/src/components/application_manager/src/hmi_interfaces_impl.cc @@ -157,7 +157,6 @@ generate_function_to_interface_convert_map() { convert_map[UI_GetLanguage] = HmiInterfaces::HMI_INTERFACE_UI; convert_map[UI_OnDriverDistraction] = HmiInterfaces::HMI_INTERFACE_UI; convert_map[UI_SetAppIcon] = HmiInterfaces::HMI_INTERFACE_UI; - convert_map[UI_SetDisplayLayout] = HmiInterfaces::HMI_INTERFACE_UI; convert_map[UI_OnKeyboardInput] = HmiInterfaces::HMI_INTERFACE_UI; convert_map[UI_OnTouchEvent] = HmiInterfaces::HMI_INTERFACE_UI; convert_map[UI_Slider] = HmiInterfaces::HMI_INTERFACE_UI; diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml index a5fa36a9a0..052f953547 100644 --- a/src/components/interfaces/HMI_API.xml +++ b/src/components/interfaces/HMI_API.xml @@ -5431,37 +5431,6 @@ - - This RPC is deprecated. Use Show RPC to change layout. - - - Predefined or dynamically created screen layout. - Currently only predefined screen layouts are defined. - - - - ID of application related to this RPC. - - - - - - - This RPC is deprecated. Use Show RPC to change layout. - - See DisplayCapabilities - - - See ButtonCapabilities - - - If returned, the platform supports on-screen SoftButtons; see SoftButtonCapabilities. - - - If returned, the platform supports custom on-screen Presets; see PresetBankCapabilities. - - - Array of lines of show text fields. See TextFieldStruct. If some field is not set, the corresponding text should stay unchanged. If field's text is empty "", the field must be cleared. -- cgit v1.2.1