diff options
19 files changed, 724 insertions, 0 deletions
@@ -97,6 +97,7 @@ There are several RPCs that are "required" to be implemented in order for SDL to * DeleteCommand * AddSubMenu * DeleteSubMenu + * ShowAppMenu * CreateInteractionChoiceSet * PerformInteraction * DeleteInteractionChoiceSet diff --git a/src/appMain/sdl_preloaded_pt.json b/src/appMain/sdl_preloaded_pt.json index 75dda3f5d5..9e6722c8cf 100644 --- a/src/appMain/sdl_preloaded_pt.json +++ b/src/appMain/sdl_preloaded_pt.json @@ -49,6 +49,9 @@ "FULL",
"LIMITED"]
},
+ "ShowAppMenu": {
+ "hmi_levels": ["FULL"]
+ },
"Alert": {
"hmi_levels": ["FULL",
"LIMITED"]
@@ -784,6 +787,9 @@ "FULL",
"LIMITED"]
},
+ "ShowAppMenu": {
+ "hmi_levels": ["FULL"]
+ },
"Alert": {
"hmi_levels": ["FULL",
"LIMITED"]
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_show_app_menu_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_show_app_menu_request.h new file mode 100644 index 0000000000..c47d73b858 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_show_app_menu_request.h @@ -0,0 +1,74 @@ +/* + * 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_SHOW_APP_MENU_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SHOW_APP_MENU_REQUEST_H_ + +#include "application_manager/commands/request_to_hmi.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief UIShowAppMenuRequest command class + **/ +class UIShowAppMenuRequest : public app_mngr::commands::RequestToHMI { + public: + /** + * @brief UIShowAppMenuRequest class constructor + **/ + 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); + + /** + * @brief UIShowAppMenuRequest class destructor + **/ + ~UIShowAppMenuRequest() OVERRIDE; + + /** + * @brief Execute command + **/ + void Run() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(UIShowAppMenuRequest); +}; + +} // namespace commands +} // namespace sdl_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SHOW_APP_MENU_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_show_app_menu_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_show_app_menu_response.h new file mode 100644 index 0000000000..c03a043e12 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_show_app_menu_response.h @@ -0,0 +1,74 @@ +/* + * 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_SHOW_APP_MENU_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SHOW_APP_MENU_RESPONSE_H_ + +#include "application_manager/commands/response_from_hmi.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief UIShowAppMenuResponse command class + **/ +class UIShowAppMenuResponse : public app_mngr::commands::ResponseFromHMI { + public: + /** + * @brief UIShowAppMenuResponse class constructor + **/ + 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); + + /** + * @brief UIShowAppMenuResponse class destructor + **/ + ~UIShowAppMenuResponse() OVERRIDE; + + /** + * @brief Execute command + **/ + void Run() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(UIShowAppMenuResponse); +}; + +} // namespace commands +} // namespace sdl_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SHOW_APP_MENU_RESPONSE_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_request.h new file mode 100644 index 0000000000..c9691a808f --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_request.h @@ -0,0 +1,81 @@ +/* + * 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_MOBILE_SHOW_APP_MENU_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_APP_MENU_REQUEST_H_ + +#include "application_manager/commands/command_request_impl.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ShowAppMenuRequest command class + **/ +class ShowAppMenuRequest : public app_mngr::commands::CommandRequestImpl { + public: + /** + * @brief ShowAppMenuRequest class constructor + **/ + 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); + + /** + * @brief ShowAppMenuRequest class destructor + **/ + ~ShowAppMenuRequest() OVERRIDE; + + /** + * @brief Execute command + **/ + void Run() OVERRIDE; + + /** + * @brief Interface method that is called whenever new event received + * + * @param event The received event + **/ + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(ShowAppMenuRequest); +}; + +} // namespace commands +} // namespace sdl_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_APP_MENU_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_response.h new file mode 100644 index 0000000000..1e357e8a11 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_response.h @@ -0,0 +1,74 @@ +/* + * 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_MOBILE_SHOW_APP_MENU_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_APP_MENU_RESPONSE_H_ + +#include "application_manager/commands/command_response_impl.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ShowAppMenuResponse command class + **/ +class ShowAppMenuResponse : public app_mngr::commands::CommandResponseImpl { + public: + /** + * @brief ShowAppMenuResponse class constructor + **/ + ShowAppMenuResponse(const app_mngr::commands::MessageSharedPtr& messasge, + app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler); + + /** + * @brief ShowAppMenuResponse class destructor + **/ + ~ShowAppMenuResponse() OVERRIDE; + + /** + * @brief Execute command + **/ + void Run() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(ShowAppMenuResponse); +}; + +} // namespace commands +} // namespace sdl_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_APP_MENU_RESPONSE_H_ 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/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..2a8dc6cb70 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc @@ -0,0 +1,142 @@ +/* + * 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() || + helpers::Compare<mobile_apis::SystemContext::eType, + helpers::NEQ, + helpers::ALL>( + app->system_context(), + 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/hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc index 0434eb05ec..fa41e51980 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 @@ -236,6 +236,8 @@ #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" #include "sdl_rpc_plugin/commands/hmi/bc_get_file_path_request.h" #include "sdl_rpc_plugin/commands/hmi/bc_get_file_path_response.h" @@ -409,6 +411,11 @@ CommandCreator& HMICommandFactory::get_creator_factory( ? factory.GetCreator<commands::UIDeleteSubmenuRequest>() : factory.GetCreator<commands::UIDeleteSubmenuResponse>(); } + case hmi_apis::FunctionID::UI_ShowAppMenu: { + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::UIShowAppMenuRequest>() + : factory.GetCreator<commands::UIShowAppMenuResponse>(); + } case hmi_apis::FunctionID::UI_SetMediaClockTimer: { return hmi_apis::messageType::request == message_type ? factory.GetCreator<commands::UISetMediaClockTimerRequest>() diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc index 11f3d78026..0b91febe1b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc @@ -112,6 +112,8 @@ #include "sdl_rpc_plugin/commands/mobile/set_global_properties_response.h" #include "sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h" #include "sdl_rpc_plugin/commands/mobile/set_media_clock_timer_response.h" +#include "sdl_rpc_plugin/commands/mobile/show_app_menu_request.h" +#include "sdl_rpc_plugin/commands/mobile/show_app_menu_response.h" #include "sdl_rpc_plugin/commands/mobile/show_constant_tbt_request.h" #include "sdl_rpc_plugin/commands/mobile/show_constant_tbt_response.h" #include "sdl_rpc_plugin/commands/mobile/show_request.h" @@ -187,6 +189,11 @@ CommandCreator& MobileCommandFactory::get_command_creator( ? factory.GetCreator<commands::DeleteSubMenuRequest>() : factory.GetCreator<commands::DeleteSubMenuResponse>(); } + case mobile_apis::FunctionID::ShowAppMenuID: { + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::ShowAppMenuRequest>() + : factory.GetCreator<commands::ShowAppMenuResponse>(); + } case mobile_apis::FunctionID::DeleteInteractionChoiceSetID: { return mobile_api::messageType::request == message_type ? factory.GetCreator< diff --git a/src/components/application_manager/src/hmi_interfaces_impl.cc b/src/components/application_manager/src/hmi_interfaces_impl.cc index 04e2067916..59ae8e88d8 100644 --- a/src/components/application_manager/src/hmi_interfaces_impl.cc +++ b/src/components/application_manager/src/hmi_interfaces_impl.cc @@ -137,6 +137,7 @@ generate_function_to_interface_convert_map() { convert_map[UI_DeleteCommand] = HmiInterfaces::HMI_INTERFACE_UI; convert_map[UI_AddSubMenu] = HmiInterfaces::HMI_INTERFACE_UI; convert_map[UI_DeleteSubMenu] = HmiInterfaces::HMI_INTERFACE_UI; + convert_map[UI_ShowAppMenu] = HmiInterfaces::HMI_INTERFACE_UI; convert_map[UI_PerformInteraction] = HmiInterfaces::HMI_INTERFACE_UI; convert_map[UI_SetMediaClockTimer] = HmiInterfaces::HMI_INTERFACE_UI; convert_map[UI_SetGlobalProperties] = HmiInterfaces::HMI_INTERFACE_UI; diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml index d21718e66d..8080e239a1 100644 --- a/src/components/interfaces/HMI_API.xml +++ b/src/components/interfaces/HMI_API.xml @@ -4755,6 +4755,20 @@ </function> <function name="DeleteSubMenu" messagetype="response"> </function> + <function name="ShowAppMenu" messagetype="request"> + <description>Request from SDL to show an app's menu or a corresponding sub-menu.</description> + <param name="menuID" type="Integer" minvalue="1" maxvalue="2000000000" mandatory="false"> + <description> + If ommited the HMI opens the app's menu. + If set to a sub-menu ID the HMI opens the corresponding sub-menu previously added using `AddSubMenu`. + </description> + </param> + <param name="appID" type="Integer" mandatory="true"> + <description>ID of application that concerns this RPC.</description> + </param> + </function> + <function name="ShowAppMenu" messagetype="response"> + </function> <function name="PerformInteraction" messagetype="request"> <description>Request from SDL for triggering an interaction (e.g. "Permit GPS?" - Yes, no, Always Allow).</description> <param name="initialText" type="Common.TextFieldStruct" mandatory="false"> diff --git a/src/components/interfaces/MOBILE_API.xml b/src/components/interfaces/MOBILE_API.xml index 0166f10f52..a4e5da9035 100644 --- a/src/components/interfaces/MOBILE_API.xml +++ b/src/components/interfaces/MOBILE_API.xml @@ -2691,6 +2691,7 @@ <element name="PerformAppServiceInteractionID" value="55" hexvalue="37" since="5.1" /> <element name="UnpublishAppServiceID" value="56" hexvalue="38" since="6.0" /> <element name="CloseApplicationID" value="58" hexvalue="3A" since="6.0" /> + <element name="ShowAppMenuID" value="59" hexvalue="3B" since="6.0" /> <!-- Base Notifications @@ -4744,6 +4745,37 @@ </function> + <function name="ShowAppMenu" functionID="ShowAppMenuID" messagetype="request" since="6.0"> + <description>Shows the built in menu view</description> + <param name="menuID" type="Integer" minvalue="1" maxvalue="2000000000" mandatory="false"> + <description> + If omitted the HMI opens the app's menu. + If set to a sub-menu ID the HMI opens the corresponding sub-menu previously added using `AddSubMenu`. + </description> + </param> + </function> + + <function name="ShowAppMenu" functionID="ShowAppMenuID" messagetype="response" since="6.0"> + <param name="success" type="Boolean" platform="documentation" mandatory="true"> + <description> true if successful; false, if failed </description> + </param> + <param name="resultCode" type="Result" platform="documentation" mandatory="true"> + <description>See Result</description> + <element name="SUCCESS"/> + <element name="INVALID_DATA"/> + <element name="OUT_OF_MEMORY"/> + <element name="TOO_MANY_PENDING_REQUESTS"/> + <element name="APPLICATION_NOT_REGISTERED"/> + <element name="GENERIC_ERROR"/> + <element name="REJECTED"/> + <element name="INVALID_ID"/> + <element name="IN_USE"/> + </param> + <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation"> + <description>Provides additional human readable info regarding the result.</description> + </param> + </function> + <function name="CreateInteractionChoiceSet" functionID="CreateInteractionChoiceSetID" messagetype="request" since="1.0"> <description>creates interaction choice set to be used later by performInteraction</description> diff --git a/src/components/policy/policy_external/include/policy/policy_table/enums.h b/src/components/policy/policy_external/include/policy/policy_table/enums.h index ad16d6e59d..5a21539b17 100644 --- a/src/components/policy/policy_external/include/policy/policy_table/enums.h +++ b/src/components/policy/policy_external/include/policy/policy_table/enums.h @@ -482,6 +482,11 @@ enum FunctionID { CloseApplicationID = 58, /** + * @brief ShowAppMenuID. + */ + ShowAppMenuID = 59, + + /** * @brief OnHMIStatusID. */ OnHMIStatusID = 32768, diff --git a/src/components/policy/policy_external/src/policy_table/enums.cc b/src/components/policy/policy_external/src/policy_table/enums.cc index 6dc4d53aa1..4c95f62eca 100644 --- a/src/components/policy/policy_external/src/policy_table/enums.cc +++ b/src/components/policy/policy_external/src/policy_table/enums.cc @@ -1169,6 +1169,11 @@ bool EnumFromJsonString(const std::string& literal, FunctionID* result) { return true; } + if ("ShowAppMenu" == literal) { + *result = ShowAppMenuID; + return true; + } + if ("OnHMIStatus" == literal) { *result = OnHMIStatusID; return true; diff --git a/src/components/policy/policy_regular/include/policy/policy_table/enums.h b/src/components/policy/policy_regular/include/policy/policy_table/enums.h index ad1d05f59b..ecb44943aa 100644 --- a/src/components/policy/policy_regular/include/policy/policy_table/enums.h +++ b/src/components/policy/policy_regular/include/policy/policy_table/enums.h @@ -467,6 +467,11 @@ enum FunctionID { CloseApplicationID = 58, /** + * @brief ShowAppMenuID. + */ + ShowAppMenuID = 59, + + /** * @brief OnHMIStatusID. */ OnHMIStatusID = 32768, diff --git a/src/components/policy/policy_regular/src/policy_table/enums.cc b/src/components/policy/policy_regular/src/policy_table/enums.cc index 8fc5b0b369..50746b31a0 100644 --- a/src/components/policy/policy_regular/src/policy_table/enums.cc +++ b/src/components/policy/policy_regular/src/policy_table/enums.cc @@ -863,6 +863,8 @@ bool IsValidEnum(FunctionID val) { return true; case CloseApplicationID: return true; + case ShowAppMenuID: + return true; case OnHMIStatusID: return true; case OnAppInterfaceUnregisteredID: @@ -1030,6 +1032,8 @@ const char* EnumToJsonString(FunctionID val) { return "UnpublishAppService"; case CloseApplicationID: return "CloseApplication"; + case ShowAppMenuID: + return "ShowAppMenu"; case OnHMIStatusID: return "OnHMIStatus"; case OnAppInterfaceUnregisteredID: @@ -1364,6 +1368,11 @@ bool EnumFromJsonString(const std::string& literal, FunctionID* result) { return true; } + if ("ShowAppMenu" == literal) { + *result = ShowAppMenuID; + return true; + } + if ("OnHMIStatus" == literal) { *result = OnHMIStatusID; return true; |