diff options
Diffstat (limited to 'src/components/application_manager/rpc_plugins')
158 files changed, 9211 insertions, 534 deletions
diff --git a/src/components/application_manager/rpc_plugins/CMakeLists.txt b/src/components/application_manager/rpc_plugins/CMakeLists.txt index c9ef282c12..8884b30532 100644 --- a/src/components/application_manager/rpc_plugins/CMakeLists.txt +++ b/src/components/application_manager/rpc_plugins/CMakeLists.txt @@ -32,3 +32,4 @@ add_subdirectory(vehicle_info_plugin) add_subdirectory(sdl_rpc_plugin) add_subdirectory(rc_rpc_plugin) +add_subdirectory(app_service_rpc_plugin) diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt new file mode 100644 index 0000000000..1e23aac8ee --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt @@ -0,0 +1,84 @@ +# 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 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_directories( + include + ${COMPONENTS_DIR}/application_manager/rpc_plugins/sdl_rpc_plugin/include + ) + +set (COMMANDS_SOURCE_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/src/commands +) + +set (MOBILE_COMMANDS_SOURCE_DIR + ${COMMANDS_SOURCE_DIR}/mobile +) + +set (HMI_COMMANDS_SOURCE_DIR + ${COMMANDS_SOURCE_DIR}/hmi +) + +collect_sources(MOBILE_COMMANDS "${MOBILE_COMMANDS_SOURCE_DIR}") +collect_sources(HMI_COMMANDS "${HMI_COMMANDS_SOURCE_DIR}") +collect_sources(PLUGIN_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src") +collect_sources(COMMANDS_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/commands") + +set(LIBRARIES + HMI_API + MOBILE_API + ApplicationManager + v4_protocol_v1_2_no_extra + SmartObjects + Utils + sdl_rpc_plugin +) + +if(ENABLE_LOG) + list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) +endif() + +add_library("app_service_rpc_plugin" SHARED ${PLUGIN_SOURCES} ${MOBILE_COMMANDS} ${HMI_COMMANDS} ${COMMANDS_SOURCES}) +target_link_libraries("app_service_rpc_plugin" ${LIBRARIES}) + +add_library("AppServiceRpcPluginStaticLib" ${PLUGIN_SOURCES} ${MOBILE_COMMANDS} ${HMI_COMMANDS}) +target_link_libraries("AppServiceRpcPluginStaticLib" ${LIBRARIES}) + +set(INSTALL_DESTINATION bin) + +install(TARGETS app_service_rpc_plugin + DESTINATION ${INSTALL_DESTINATION} + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE + GROUP_READ GROUP_EXECUTE + WORLD_READ WORLD_EXECUTE +) + +if(BUILD_TESTS) + add_subdirectory(test) +endif() diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_app_extension.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_app_extension.h new file mode 100644 index 0000000000..9be93f5c9e --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_app_extension.h @@ -0,0 +1,131 @@ +/* + Copyright (c) 2018, 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 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_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_APP_EXTENSION_H +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_APP_EXTENSION_H + +#include <application_manager/application_manager.h> +#include "application_manager/app_extension.h" + +#include <set> +#include <string> + +namespace app_service_rpc_plugin { +class AppServiceRpcPlugin; + +namespace app_mngr = application_manager; + +typedef int AppExtensionUID; +typedef mobile_apis::VehicleDataType::eType VehicleDataType; +/** + * @brief Defines set of app service types + */ +typedef std::set<std::string> AppServiceSubscriptions; + +class AppServiceAppExtension : public app_mngr::AppExtension { + public: + /** + * @brief AppServiceAppExtension constructor + * @param plugin app service plugin + * @param app application that contains this plugin + */ + AppServiceAppExtension(AppServiceRpcPlugin& plugin, + app_mngr::Application& app); + virtual ~AppServiceAppExtension(); + + /** + * @brief subscribeToAppService add vehicle_data to list of subscriptions of + * application extension + * @param vehicle_data data to subscribe + * @return true in case if subscription is successful + */ + bool SubscribeToAppService(const std::string app_service_type); + + /** + * @brief unsubscribeFromAppService remove vehicle_data from list of + * subscriptions of application extension + * @param vehicle_data data to unsubscribe + * @return true in case if unsubscription is successful + */ + bool UnsubscribeFromAppService(const std::string app_service_type); + /** + * @brief unsubscribeFromAppService unsubscribe from all app service types + */ + void UnsubscribeFromAppService(); + + /** + * @brief isSubscribedToAppService checks if extension is subscribed to + * app service type + * @param app_service_type data type to check subscription + * @return true if extension is subscribed this app_service_type, otherwise + * return false + */ + bool IsSubscribedToAppService(const std::string app_service_type) const; + + /** + * @brief Subscriptions get list of subscriptions for application extension + * @return list of subscriptions for application extension + */ + AppServiceSubscriptions Subscriptions(); + + /** + * @brief SaveResumptionData saves vehicle info data + * @param resumption_data plase to store resumption data + */ + void SaveResumptionData(ns_smart_device_link::ns_smart_objects::SmartObject& + resumption_data) OVERRIDE; + + /** + * @brief ProcessResumption load resumtion data back to plugin during + * resumption + * @param resumption_data resumption data + */ + void ProcessResumption( + const smart_objects::SmartObject& resumption_data) OVERRIDE; + + /** + * @brief ExtractVIExtension utility function to extract application extension + * from application + * @param app : applicaiton that contains vehicle info app_extension + * @return application extension extracted from application + */ + static AppServiceAppExtension& ExtractASExtension( + application_manager::Application& app); + + private: + AppServiceSubscriptions subscribed_data_; + AppServiceRpcPlugin& plugin_; + app_mngr::Application& app_; +}; +} + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_PLUGIN_INCLUDE_APP_SERVICE_PLUGIN_APP_SERVICE_APP_EXTENSION_H diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_command_factory.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_command_factory.h new file mode 100644 index 0000000000..193b79e26f --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_command_factory.h @@ -0,0 +1,66 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_SDL_COMMAND_FACTORY_H +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_SDL_COMMAND_FACTORY_H + +#include "app_service_rpc_plugin/app_service_hmi_command_factory.h" +#include "app_service_rpc_plugin/app_service_mobile_command_factory.h" +#include "application_manager/application_manager.h" + +namespace app_service_rpc_plugin { +namespace commands = application_manager::commands; +namespace app_mngr = application_manager; + +class AppServiceCommandFactory : public app_mngr::CommandFactory { + public: + AppServiceCommandFactory(app_mngr::ApplicationManager& app_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler); + virtual ~AppServiceCommandFactory(); + + app_mngr::CommandSharedPtr CreateCommand( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::commands::Command::CommandSource source) OVERRIDE; + + bool IsAbleToProcess( + const int32_t, + const application_manager::commands::Command::CommandSource) + const OVERRIDE; + + private: + std::unique_ptr<AppServiceHmiCommandFactory> hmi_command_factory_; + std::unique_ptr<AppServiceMobileCommandFactory> mobile_command_factory_; +}; +} // namespace app_service_rpc_plugin +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_SDL_COMMAND_FACTORY_H diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_hmi_command_factory.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_hmi_command_factory.h new file mode 100644 index 0000000000..c42b64f559 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_hmi_command_factory.h @@ -0,0 +1,74 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_RPC_HMI_COMMAND_FACTORY_H +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_RPC_HMI_COMMAND_FACTORY_H + +#include "application_manager/application_manager.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +/** + * @brief The vehicle info hmi command factory. + */ +class AppServiceHmiCommandFactory : public app_mngr::CommandFactory { + public: + AppServiceHmiCommandFactory(app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler); + + app_mngr::CommandSharedPtr CreateCommand( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::commands::Command::CommandSource source) OVERRIDE; + + bool IsAbleToProcess( + const int32_t function_id, + const app_mngr::commands::Command::CommandSource source) const OVERRIDE; + + private: + app_mngr::ApplicationManager& application_manager_; + app_mngr::rpc_service::RPCService& rpc_service_; + app_mngr::HMICapabilities& hmi_capabilities_; + policy::PolicyHandlerInterface& policy_handler_; + + app_mngr::CommandCreator& buildCommandCreator( + const int32_t function_id, + const int32_t message_type, + const app_mngr::commands::Command::CommandSource source) const; + + DISALLOW_COPY_AND_ASSIGN(AppServiceHmiCommandFactory); +}; +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_RPC_HMI_COMMAND_FACTORY_H diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_mobile_command_factory.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_mobile_command_factory.h new file mode 100644 index 0000000000..bd1e10f267 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_mobile_command_factory.h @@ -0,0 +1,75 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_RPC_MOBILE_COMMAND_FACTORY_H +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_RPC_MOBILE_COMMAND_FACTORY_H + +#include "application_manager/application_manager.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +/** + * @brief The vehicle info mobile command factory. + */ +class AppServiceMobileCommandFactory : public app_mngr::CommandFactory { + public: + AppServiceMobileCommandFactory( + app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler); + + app_mngr::CommandSharedPtr CreateCommand( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::commands::Command::CommandSource source) OVERRIDE; + + bool IsAbleToProcess( + const int32_t function_id, + const app_mngr::commands::Command::CommandSource source) const OVERRIDE; + + private: + app_mngr::ApplicationManager& application_manager_; + app_mngr::rpc_service::RPCService& rpc_service_; + app_mngr::HMICapabilities& hmi_capabilities_; + policy::PolicyHandlerInterface& policy_handler_; + + app_mngr::CommandCreator& buildCommandCreator( + const int32_t function_id, + const int32_t message_type, + const app_mngr::commands::Command::CommandSource source) const; + + DISALLOW_COPY_AND_ASSIGN(AppServiceMobileCommandFactory); +}; +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_RPC_MOBILE_COMMAND_FACTORY_H diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h new file mode 100644 index 0000000000..c9cb98cdfb --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h @@ -0,0 +1,73 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_PLUGIN_INCLUDE_APP_SERVICE_PLUGIN_APP_SERVICE_RPC_PLUGIN_H +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_PLUGIN_INCLUDE_APP_SERVICE_PLUGIN_APP_SERVICE_RPC_PLUGIN_H + +#include "application_manager/command_factory.h" + +namespace app_service_rpc_plugin { +// class AppServiceAppExtension; +namespace app_mngr = application_manager; +namespace plugins = application_manager::plugin_manager; + +class AppServiceRpcPlugin : public plugins::RPCPlugin { + public: + AppServiceRpcPlugin(); + + bool Init(app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) OVERRIDE; + + bool IsAbleToProcess( + const int32_t function_id, + const app_mngr::commands::Command::CommandSource source) OVERRIDE; + + std::string PluginName() OVERRIDE; + app_mngr::CommandFactory& GetCommandFactory() OVERRIDE; + + void OnPolicyEvent(plugins::PolicyEvent event) OVERRIDE; + void OnApplicationEvent(plugins::ApplicationEvent event, + app_mngr::ApplicationSharedPtr application) OVERRIDE; + + private: + void DeleteSubscriptions(app_mngr::ApplicationSharedPtr app); + + std::unique_ptr<app_mngr::CommandFactory> command_factory_; + app_mngr::ApplicationManager* application_manager_; +}; +} // namespace app_service_rpc_plugin + +extern "C" application_manager::plugin_manager::RPCPlugin* Create(); + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_PLUGIN_INCLUDE_APP_SERVICE_PLUGIN_APP_SERVICE_PLUGIN_H diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_app_service_activation_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_app_service_activation_request.h new file mode 100644 index 0000000000..c98979da0f --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_app_service_activation_request.h @@ -0,0 +1,80 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_APP_SERVICE_ACTIVATION_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_APP_SERVICE_ACTIVATION_REQUEST_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/request_from_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASAppServiceActivationRequest command class + **/ +class ASAppServiceActivationRequest + : public app_mngr::commands::RequestFromHMI { + public: + /** + * @brief ASAppServiceActivationRequest class constructor + * + * @param message Incoming SmartObject message + **/ + ASAppServiceActivationRequest( + 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 ASAppServiceActivationRequest class destructor + **/ + virtual ~ASAppServiceActivationRequest(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(ASAppServiceActivationRequest); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_APP_SERVICE_ACTIVATION_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_app_service_activation_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_app_service_activation_response.h new file mode 100644 index 0000000000..68b77cb7e3 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_app_service_activation_response.h @@ -0,0 +1,80 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_APP_SERVICE_ACTIVATION_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_APP_SERVICE_ACTIVATION_RESPONSE_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/response_to_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASAppServiceActivationResponse command class + **/ +class ASAppServiceActivationResponse + : public app_mngr::commands::ResponseToHMI { + public: + /** + * @brief ASAppServiceActivationResponse class constructor + * + * @param message Incoming SmartObject message + **/ + ASAppServiceActivationResponse( + 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 ASAppServiceActivationResponse class destructor + **/ + virtual ~ASAppServiceActivationResponse(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(ASAppServiceActivationResponse); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_APP_SERVICE_ACTIVATION_RESPONSE_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_request.h new file mode 100644 index 0000000000..2286d4c67c --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_request.h @@ -0,0 +1,80 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_ACTIVE_SERVICE_CONSENT_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_ACTIVE_SERVICE_CONSENT_REQUEST_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/request_to_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASGetActiveServiceConsentRequest command class + **/ +class ASGetActiveServiceConsentRequest + : public app_mngr::commands::RequestToHMI { + public: + /** + * @brief ASGetActiveServiceConsentRequest class constructor + * + * @param message Incoming SmartObject message + **/ + ASGetActiveServiceConsentRequest( + 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 ASGetActiveServiceConsentRequest class destructor + **/ + virtual ~ASGetActiveServiceConsentRequest(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(ASGetActiveServiceConsentRequest); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_ACTIVE_SERVICE_CONSENT_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_response.h new file mode 100644 index 0000000000..f69152208c --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_response.h @@ -0,0 +1,80 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_ACTIVE_SERVICE_CONSENT_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_ACTIVE_SERVICE_CONSENT_RESPONSE_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/response_from_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASGetActiveServiceConsentResponse command class + **/ +class ASGetActiveServiceConsentResponse + : public app_mngr::commands::ResponseFromHMI { + public: + /** + * @brief ASGetActiveServiceConsentResponse class constructor + * + * @param message Incoming SmartObject message + **/ + ASGetActiveServiceConsentResponse( + 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 ASGetActiveServiceConsentResponse class destructor + **/ + virtual ~ASGetActiveServiceConsentResponse(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(ASGetActiveServiceConsentResponse); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_ACTIVE_SERVICE_CONSENT_RESPONSE_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h new file mode 100644 index 0000000000..7b175fc0d4 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h @@ -0,0 +1,98 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_REQUEST_FROM_HMI_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_REQUEST_FROM_HMI_H_ + +#include "application_manager/commands/request_from_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASGetAppServiceDataRequestFromHMI command class + **/ +class ASGetAppServiceDataRequestFromHMI + : public app_mngr::commands::RequestFromHMI { + public: + /** + * @brief ASGetAppServiceDataRequestFromHMI class constructor + * + * @param message Incoming SmartObject message + **/ + ASGetAppServiceDataRequestFromHMI( + 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 ASGetAppServiceDataRequestFromHMI class destructor + **/ + virtual ~ASGetAppServiceDataRequestFromHMI(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + /** + * @brief onTimeOut from request controller + */ + virtual void onTimeOut(); + + /** + * @brief on_event allows to handle events + * + * @param event event type that current request subscribed on. + */ + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; + + /** + * @brief on_event allows to handle events + * + * @param event event type that current request subscribed on. + */ + void on_event(const app_mngr::event_engine::MobileEvent& event) OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(ASGetAppServiceDataRequestFromHMI); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_REQUEST_FROM_HMI_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_to_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_to_hmi.h new file mode 100644 index 0000000000..c4b3026176 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_to_hmi.h @@ -0,0 +1,79 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_REQUEST_TO_HMI_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_REQUEST_TO_HMI_H_ + +#include "application_manager/commands/request_to_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASGetAppServiceDataRequestToHMI command class + **/ +class ASGetAppServiceDataRequestToHMI + : public app_mngr::commands::RequestToHMI { + public: + /** + * @brief ASGetAppServiceDataRequestToHMI class constructor + * + * @param message Incoming SmartObject message + **/ + ASGetAppServiceDataRequestToHMI( + 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 ASGetAppServiceDataRequestToHMI class destructor + **/ + virtual ~ASGetAppServiceDataRequestToHMI(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(ASGetAppServiceDataRequestToHMI); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_TO_HMI_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_from_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_from_hmi.h new file mode 100644 index 0000000000..b46626a56b --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_from_hmi.h @@ -0,0 +1,79 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_RESPONSE_FROM_HMI_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_RESPONSE_FROM_HMI_H_ + +#include "application_manager/commands/response_from_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASGetAppServiceDataResponseFromHMI command class + **/ +class ASGetAppServiceDataResponseFromHMI + : public app_mngr::commands::ResponseFromHMI { + public: + /** + * @brief ASGetAppServiceDataResponseFromHMI class constructor + * + * @param message Incoming SmartObject message + **/ + ASGetAppServiceDataResponseFromHMI( + 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 ASGetAppServiceDataResponseFromHMI class destructor + **/ + virtual ~ASGetAppServiceDataResponseFromHMI(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(ASGetAppServiceDataResponseFromHMI); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_RESPONSE_FROM_HMI_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_to_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_to_hmi.h new file mode 100644 index 0000000000..e48a9d1429 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_to_hmi.h @@ -0,0 +1,79 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_RESPONSE_TO_HMI_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_RESPONSE_TO_HMI_H_ + +#include "application_manager/commands/response_to_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASGetAppServiceDataResponseToHMI command class + **/ +class ASGetAppServiceDataResponseToHMI + : public app_mngr::commands::ResponseToHMI { + public: + /** + * @brief ASGetAppServiceDataResponseToHMI class constructor + * + * @param message Incoming SmartObject message + **/ + ASGetAppServiceDataResponseToHMI( + 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 ASGetAppServiceDataResponseToHMI class destructor + **/ + virtual ~ASGetAppServiceDataResponseToHMI(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(ASGetAppServiceDataResponseToHMI); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_RESPONSE_TO_HMI_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_records_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_records_request.h new file mode 100644 index 0000000000..79ea0922a8 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_records_request.h @@ -0,0 +1,80 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_RECORDS_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_RECORDS_REQUEST_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/request_from_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASGetAppServiceRecordsRequest command class + **/ +class ASGetAppServiceRecordsRequest + : public app_mngr::commands::RequestFromHMI { + public: + /** + * @brief ASGetAppServiceRecordsRequest class constructor + * + * @param message Incoming SmartObject message + **/ + ASGetAppServiceRecordsRequest( + 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 ASGetAppServiceRecordsRequest class destructor + **/ + virtual ~ASGetAppServiceRecordsRequest(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(ASGetAppServiceRecordsRequest); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_RECORDS_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_records_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_records_response.h new file mode 100644 index 0000000000..6db24132af --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_records_response.h @@ -0,0 +1,80 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_RECORDS_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_RECORDS_RESPONSE_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/response_to_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASGetAppServiceRecordsResponse command class + **/ +class ASGetAppServiceRecordsResponse + : public app_mngr::commands::ResponseToHMI { + public: + /** + * @brief ASGetAppServiceRecordsResponse class constructor + * + * @param message Incoming SmartObject message + **/ + ASGetAppServiceRecordsResponse( + 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 ASGetAppServiceRecordsResponse class destructor + **/ + virtual ~ASGetAppServiceRecordsResponse(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(ASGetAppServiceRecordsResponse); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_RECORDS_RESPONSE_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h new file mode 100644 index 0000000000..36acf116f4 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h @@ -0,0 +1,99 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_REQUEST_FROM_HMI_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_REQUEST_FROM_HMI_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/request_from_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASPerformAppServiceInteractionRequestFromHMI command class + **/ +class ASPerformAppServiceInteractionRequestFromHMI + : public app_mngr::commands::RequestFromHMI { + public: + /** + * @brief ASPerformAppServiceInteractionRequestFromHMI class constructor + * + * @param message Incoming SmartObject message + **/ + ASPerformAppServiceInteractionRequestFromHMI( + 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 ASPerformAppServiceInteractionRequestFromHMI class destructor + **/ + virtual ~ASPerformAppServiceInteractionRequestFromHMI(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + /** + * @brief on_event allows to handle events + * + * @param event event type that current request subscribed on. + */ + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; + + /** + * @brief on_event allows to handle events + * + * @param event event type that current request subscribed on. + */ + void on_event(const app_mngr::event_engine::MobileEvent& event) OVERRIDE; + + /** + * @brief onTimeOut from request controller + */ + virtual void onTimeOut(); + + private: + DISALLOW_COPY_AND_ASSIGN(ASPerformAppServiceInteractionRequestFromHMI); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_REQUEST_FROM_HMI_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_to_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_to_hmi.h new file mode 100644 index 0000000000..0b67dd5624 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_to_hmi.h @@ -0,0 +1,80 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_REQUEST_TO_HMI_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_REQUEST_TO_HMI_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/request_to_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASPerformAppServiceInteractionRequestToHMI command class + **/ +class ASPerformAppServiceInteractionRequestToHMI + : public app_mngr::commands::RequestToHMI { + public: + /** + * @brief ASPerformAppServiceInteractionRequestToHMI class constructor + * + * @param message Incoming SmartObject message + **/ + ASPerformAppServiceInteractionRequestToHMI( + 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 ASPerformAppServiceInteractionRequestToHMI class destructor + **/ + virtual ~ASPerformAppServiceInteractionRequestToHMI(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(ASPerformAppServiceInteractionRequestToHMI); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_REQUEST_TO_HMI_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_from_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_from_hmi.h new file mode 100644 index 0000000000..f807348833 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_from_hmi.h @@ -0,0 +1,80 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_FROM_HMI_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_FROM_HMI_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/response_from_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASPerformAppServiceInteractionResponseFromHMI command class + **/ +class ASPerformAppServiceInteractionResponseFromHMI + : public app_mngr::commands::ResponseFromHMI { + public: + /** + * @brief ASPerformAppServiceInteractionResponseFromHMI class constructor + * + * @param message Incoming SmartObject message + **/ + ASPerformAppServiceInteractionResponseFromHMI( + 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 ASPerformAppServiceInteractionResponseFromHMI class destructor + **/ + virtual ~ASPerformAppServiceInteractionResponseFromHMI(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(ASPerformAppServiceInteractionResponseFromHMI); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_FROM_HMI_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_to_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_to_hmi.h new file mode 100644 index 0000000000..7ce05bdba1 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_to_hmi.h @@ -0,0 +1,80 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_TO_HMI_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_TO_HMI_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/response_to_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASPerformAppServiceInteractionResponseToHMI command class + **/ +class ASPerformAppServiceInteractionResponseToHMI + : public app_mngr::commands::ResponseToHMI { + public: + /** + * @brief ASPerformAppServiceInteractionResponseToHMI class constructor + * + * @param message Incoming SmartObject message + **/ + ASPerformAppServiceInteractionResponseToHMI( + 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 ASPerformAppServiceInteractionResponseToHMI class destructor + **/ + virtual ~ASPerformAppServiceInteractionResponseToHMI(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(ASPerformAppServiceInteractionResponseToHMI); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_TO_HMI_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h new file mode 100644 index 0000000000..4433444602 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h @@ -0,0 +1,79 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PUBLISH_APP_SERVICE_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PUBLISH_APP_SERVICE_REQUEST_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/request_from_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASPublishAppServiceRequest command class + **/ +class ASPublishAppServiceRequest : public app_mngr::commands::RequestFromHMI { + public: + /** + * @brief ASPublishAppServiceRequest class constructor + * + * @param message Incoming SmartObject message + **/ + ASPublishAppServiceRequest( + 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 ASPublishAppServiceRequest class destructor + **/ + virtual ~ASPublishAppServiceRequest(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(ASPublishAppServiceRequest); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PUBLISH_APP_SERVICE_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h new file mode 100644 index 0000000000..519d57c609 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h @@ -0,0 +1,79 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PUBLISH_APP_SERVICE_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PUBLISH_APP_SERVICE_RESPONSE_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/response_to_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASPublishAppServiceResponse command class + **/ +class ASPublishAppServiceResponse : public app_mngr::commands::ResponseToHMI { + public: + /** + * @brief ASPublishAppServiceResponse class constructor + * + * @param message Incoming SmartObject message + **/ + ASPublishAppServiceResponse( + 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 ASPublishAppServiceResponse class destructor + **/ + virtual ~ASPublishAppServiceResponse(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(ASPublishAppServiceResponse); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PUBLISH_APP_SERVICE_RESPONSE_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h new file mode 100644 index 0000000000..30af13038a --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h @@ -0,0 +1,80 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_ON_AS_APP_SERVICE_DATA_NOTIFICATION_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_ON_AS_APP_SERVICE_DATA_NOTIFICATION_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/notification_to_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief OnASAppServiceDataNotification command class + **/ +class OnASAppServiceDataNotification + : public app_mngr::commands::NotificationToHMI { + public: + /** + * @brief OnASAppServiceDataNotification class constructor + * + * @param message Incoming SmartObject message + **/ + OnASAppServiceDataNotification( + 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 OnASAppServiceDataNotification class destructor + **/ + virtual ~OnASAppServiceDataNotification(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(OnASAppServiceDataNotification); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_ON_AS_APP_SERVICE_DATA_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h new file mode 100644 index 0000000000..5a23e35df0 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h @@ -0,0 +1,80 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_ON_AS_APP_SERVICE_DATA_NOTIFICATION_FROM_HMI_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_ON_AS_APP_SERVICE_DATA_NOTIFICATION_FROM_HMI_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/notification_from_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief OnASAppServiceDataNotificationFromHMI command class + **/ +class OnASAppServiceDataNotificationFromHMI + : public app_mngr::commands::NotificationFromHMI { + public: + /** + * @brief OnASAppServiceDataNotificationFromHMI class constructor + * + * @param message Incoming SmartObject message + **/ + OnASAppServiceDataNotificationFromHMI( + 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 OnASAppServiceDataNotificationFromHMI class destructor + **/ + virtual ~OnASAppServiceDataNotificationFromHMI(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(OnASAppServiceDataNotificationFromHMI); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_ON_AS_APP_SERVICE_DATA_NOTIFICATION_FROM_HMI_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h new file mode 100644 index 0000000000..7c80ec5e03 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h @@ -0,0 +1,89 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_REQUEST_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/command_request_impl.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief GetAppServiceDataRequest command class + **/ +class GetAppServiceDataRequest : public app_mngr::commands::CommandRequestImpl { + public: + /** + * @brief GetAppServiceDataRequest class constructor + * + * @param message Incoming SmartObject message + **/ + GetAppServiceDataRequest(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 GetAppServiceDataRequest class destructor + **/ + virtual ~GetAppServiceDataRequest(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + /** + * @brief Interface method that is called whenever new event received + * + * @param event The received event + */ + virtual void on_event(const app_mngr::event_engine::Event& event); + + virtual void on_event(const app_mngr::event_engine::MobileEvent& event); + + private: + void HandleSubscribe(); + + DISALLOW_COPY_AND_ASSIGN(GetAppServiceDataRequest); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request_to_mobile.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request_to_mobile.h new file mode 100644 index 0000000000..279cf15055 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request_to_mobile.h @@ -0,0 +1,79 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_REQUEST_TO_MOBILE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_REQUEST_TO_MOBILE_H_ + +#include "application_manager/commands/command_request_to_mobile.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief GetAppServiceDataRequestToMobile command class + **/ +class GetAppServiceDataRequestToMobile + : public app_mngr::commands::CommandRequestToMobile { + public: + /** + * @brief GetAppServiceDataRequestToMobile class constructor + * + * @param message Incoming SmartObject message + **/ + GetAppServiceDataRequestToMobile( + 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 GetAppServiceDataRequestToMobile class destructor + **/ + virtual ~GetAppServiceDataRequestToMobile(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(GetAppServiceDataRequestToMobile); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_REQUEST_TO_MOBILE_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response.h new file mode 100644 index 0000000000..f5758e1c39 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response.h @@ -0,0 +1,78 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_RESPONSE_H_ + +#include "application_manager/commands/command_response_impl.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief GetAppServiceDataResponse command class + **/ +class GetAppServiceDataResponse + : public app_mngr::commands::CommandResponseImpl { + public: + /** + * @brief GetAppServiceDataResponse class constructor + * + * @param message Incoming SmartObject message + **/ + GetAppServiceDataResponse(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 GetAppServiceDataResponse class destructor + **/ + virtual ~GetAppServiceDataResponse(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(GetAppServiceDataResponse); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_RESPONSE_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response_from_mobile.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response_from_mobile.h new file mode 100644 index 0000000000..7e2b26d8fb --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response_from_mobile.h @@ -0,0 +1,80 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_RESPONSE_FROM_MOBILE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_RESPONSE_FROM_MOBILE_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/command_response_from_mobile.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief GetAppServiceDataResponseFromMobile command class + **/ +class GetAppServiceDataResponseFromMobile + : public app_mngr::commands::CommandResponseFromMobile { + public: + /** + * @brief GetAppServiceDataResponseFromMobile class constructor + * + * @param message Incoming SmartObject message + **/ + GetAppServiceDataResponseFromMobile( + 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 GetAppServiceDataResponseFromMobile class destructor + **/ + virtual ~GetAppServiceDataResponseFromMobile(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(GetAppServiceDataResponseFromMobile); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_RESPONSE_FROM_MOBILE_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h new file mode 100644 index 0000000000..719f5ebf5b --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h @@ -0,0 +1,80 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_SERVICE_DATA_NOTIFICATION_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_SERVICE_DATA_NOTIFICATION_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/command_notification_impl.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief OnAppServiceDataNotification command class + **/ +class OnAppServiceDataNotification + : public app_mngr::commands::CommandNotificationImpl { + public: + /** + * @brief OnAppServiceDataNotification class constructor + * + * @param message Incoming SmartObject message + **/ + OnAppServiceDataNotification( + 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 OnAppServiceDataNotification class destructor + **/ + virtual ~OnAppServiceDataNotification(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(OnAppServiceDataNotification); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_SERVICE_DATA_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h new file mode 100644 index 0000000000..c41fabf7b1 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h @@ -0,0 +1,80 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_SERVICE_DATA_NOTIFICATION_FROM_MOBILE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_SERVICE_DATA_NOTIFICATION_FROM_MOBILE_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/command_notification_from_mobile_impl.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief OnAppServiceDataNotificationFromMobile command class + **/ +class OnAppServiceDataNotificationFromMobile + : public app_mngr::commands::CommandNotificationFromMobileImpl { + public: + /** + * @brief OnAppServiceDataNotificationFromMobile class constructor + * + * @param message Incoming SmartObject message + **/ + OnAppServiceDataNotificationFromMobile( + 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 OnAppServiceDataNotificationFromMobile class destructor + **/ + virtual ~OnAppServiceDataNotificationFromMobile(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(OnAppServiceDataNotificationFromMobile); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_SERVICE_DATA_NOTIFICATION_FROM_MOBILE_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request.h new file mode 100644 index 0000000000..854ed3c6aa --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request.h @@ -0,0 +1,89 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_REQUEST_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/command_request_impl.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief PerformAppServiceInteractionRequest command class + **/ +class PerformAppServiceInteractionRequest + : public app_mngr::commands::CommandRequestImpl { + public: + /** + * @brief PerformAppServiceInteractionRequest class constructor + * + * @param message Incoming SmartObject message + **/ + PerformAppServiceInteractionRequest( + 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 PerformAppServiceInteractionRequest class destructor + **/ + virtual ~PerformAppServiceInteractionRequest(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + /** + * @brief Interface method that is called whenever new event received + * + * @param event The received event + */ + virtual void on_event(const app_mngr::event_engine::Event& event); + + virtual void on_event(const app_mngr::event_engine::MobileEvent& event); + + private: + DISALLOW_COPY_AND_ASSIGN(PerformAppServiceInteractionRequest); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request_to_mobile.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request_to_mobile.h new file mode 100644 index 0000000000..5c38e6a71e --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request_to_mobile.h @@ -0,0 +1,80 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_REQUEST_TO_MOBILE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_REQUEST_TO_MOBILE_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/command_request_to_mobile.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief PerformAppServiceInteractionRequestToMobile command class + **/ +class PerformAppServiceInteractionRequestToMobile + : public app_mngr::commands::CommandRequestToMobile { + public: + /** + * @brief PerformAppServiceInteractionRequestToMobile class constructor + * + * @param message Incoming SmartObject message + **/ + PerformAppServiceInteractionRequestToMobile( + 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 PerformAppServiceInteractionRequestToMobile class destructor + **/ + virtual ~PerformAppServiceInteractionRequestToMobile(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(PerformAppServiceInteractionRequestToMobile); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_REQUEST_TO_MOBILE_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response.h new file mode 100644 index 0000000000..b4c422fac6 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response.h @@ -0,0 +1,80 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/command_response_impl.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief PerformAppServiceInteractionResponse command class + **/ +class PerformAppServiceInteractionResponse + : public app_mngr::commands::CommandResponseImpl { + public: + /** + * @brief PerformAppServiceInteractionResponse class constructor + * + * @param message Incoming SmartObject message + **/ + PerformAppServiceInteractionResponse( + 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 PerformAppServiceInteractionResponse class destructor + **/ + virtual ~PerformAppServiceInteractionResponse(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(PerformAppServiceInteractionResponse); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response_from_mobile.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response_from_mobile.h new file mode 100644 index 0000000000..4530cb2dfd --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response_from_mobile.h @@ -0,0 +1,80 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_FROM_MOBILE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_FROM_MOBILE_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/command_response_from_mobile.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief PerformAppServiceInteractionResponseFromMobile command class + **/ +class PerformAppServiceInteractionResponseFromMobile + : public app_mngr::commands::CommandResponseFromMobile { + public: + /** + * @brief PerformAppServiceInteractionResponseFromMobile class constructor + * + * @param message Incoming SmartObject message + **/ + PerformAppServiceInteractionResponseFromMobile( + 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 PerformAppServiceInteractionResponseFromMobile class destructor + **/ + virtual ~PerformAppServiceInteractionResponseFromMobile(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(PerformAppServiceInteractionResponseFromMobile); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_FROM_MOBILE_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h new file mode 100644 index 0000000000..d70f279658 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h @@ -0,0 +1,78 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PUBLISH_APP_SERVICE_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PUBLISH_APP_SERVICE_REQUEST_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/command_request_impl.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief PublishAppServiceRequest command class + **/ +class PublishAppServiceRequest : public app_mngr::commands::CommandRequestImpl { + public: + /** + * @brief PublishAppServiceRequest class constructor + * + * @param message Incoming SmartObject message + **/ + PublishAppServiceRequest(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 PublishAppServiceRequest class destructor + **/ + virtual ~PublishAppServiceRequest(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(PublishAppServiceRequest); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PUBLISH_APP_SERVICE_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h new file mode 100644 index 0000000000..9275f9e468 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h @@ -0,0 +1,79 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PUBLISH_APP_SERVICE_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PUBLISH_APP_SERVICE_RESPONSE_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/command_response_impl.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief PublishAppServiceResponse command class + **/ +class PublishAppServiceResponse + : public app_mngr::commands::CommandResponseImpl { + public: + /** + * @brief PublishAppServiceResponse class constructor + * + * @param message Incoming SmartObject message + **/ + PublishAppServiceResponse(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 PublishAppServiceResponse class destructor + **/ + virtual ~PublishAppServiceResponse(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(PublishAppServiceResponse); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PUBLISH_APP_SERVICE_RESPONSE_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc new file mode 100644 index 0000000000..6d8b0c08cc --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc @@ -0,0 +1,122 @@ +/* + 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 "app_service_rpc_plugin/app_service_app_extension.h" +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" + +CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin") + +namespace app_service_rpc_plugin { + +const AppExtensionUID AppServiceAppExtensionUID = 455; + +AppServiceAppExtension::AppServiceAppExtension( + AppServiceRpcPlugin& plugin, application_manager::Application& app) + : app_mngr::AppExtension(AppServiceAppExtensionUID) + , plugin_(plugin) + , app_(app) { + LOG4CXX_AUTO_TRACE(logger_); +} + +AppServiceAppExtension::~AppServiceAppExtension() { + LOG4CXX_AUTO_TRACE(logger_); +} + +bool AppServiceAppExtension::SubscribeToAppService( + const std::string app_service_type) { + LOG4CXX_DEBUG(logger_, "Subscribe to app service: " << app_service_type); + return subscribed_data_.insert(app_service_type).second; +} + +bool AppServiceAppExtension::UnsubscribeFromAppService( + const std::string app_service_type) { + LOG4CXX_DEBUG(logger_, app_service_type); + auto it = subscribed_data_.find(app_service_type); + if (it != subscribed_data_.end()) { + subscribed_data_.erase(it); + return true; + } + return false; +} + +void AppServiceAppExtension::UnsubscribeFromAppService() { + LOG4CXX_AUTO_TRACE(logger_); + subscribed_data_.clear(); +} + +bool AppServiceAppExtension::IsSubscribedToAppService( + const std::string app_service_type) const { + LOG4CXX_DEBUG(logger_, + "isSubscribedToAppService for type: " << app_service_type); + return subscribed_data_.find(app_service_type) != subscribed_data_.end(); +} + +AppServiceSubscriptions AppServiceAppExtension::Subscriptions() { + return subscribed_data_; +} + +void AppServiceAppExtension::SaveResumptionData( + smart_objects::SmartObject& resumption_data) { + const char* app_service_info = "appService"; + resumption_data[app_service_info] = + smart_objects::SmartObject(smart_objects::SmartType_Array); + int i = 0; + for (const auto& subscription : subscribed_data_) { + resumption_data[app_service_info][i] = subscription; + i++; + } +} + +void AppServiceAppExtension::ProcessResumption( + const smart_objects::SmartObject& resumption_data) { + const char* app_service_info = "appService"; + if (resumption_data.keyExists(app_service_info)) { + const smart_objects::SmartObject& subscriptions_app_services = + resumption_data[app_service_info]; + for (size_t i = 0; i < subscriptions_app_services.length(); ++i) { + std::string service_type = resumption_data[i].asString(); + SubscribeToAppService(service_type); + } + } +} + +AppServiceAppExtension& AppServiceAppExtension::ExtractASExtension( + application_manager::Application& app) { + auto ext_ptr = app.QueryInterface(AppServiceAppExtensionUID); + DCHECK(ext_ptr); + DCHECK(dynamic_cast<AppServiceAppExtension*>(ext_ptr.get())); + auto vi_app_extension = + std::static_pointer_cast<AppServiceAppExtension>(ext_ptr); + DCHECK(vi_app_extension); + return *vi_app_extension; +} +} diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_command_factory.cc new file mode 100644 index 0000000000..f0a0698bb7 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_command_factory.cc @@ -0,0 +1,77 @@ +/* + 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 "app_service_rpc_plugin/app_service_command_factory.h" + +CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin") + +namespace app_service_rpc_plugin { + +AppServiceCommandFactory::AppServiceCommandFactory( + app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : hmi_command_factory_(new AppServiceHmiCommandFactory( + application_manager, rpc_service, hmi_capabilities, policy_handler)) + , mobile_command_factory_(new AppServiceMobileCommandFactory( + application_manager, rpc_service, hmi_capabilities, policy_handler)) { + LOG4CXX_AUTO_TRACE(logger_); +} + +AppServiceCommandFactory::~AppServiceCommandFactory() { + LOG4CXX_AUTO_TRACE(logger_); +} + +app_mngr::CommandSharedPtr AppServiceCommandFactory::CreateCommand( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::commands::Command::CommandSource source) { + if (app_mngr::commands::Command::SOURCE_HMI == source || + app_mngr::commands::Command::SOURCE_SDL_TO_HMI == source) { + return hmi_command_factory_->CreateCommand(message, source); + } else { + return mobile_command_factory_->CreateCommand(message, source); + } +} + +bool AppServiceCommandFactory::IsAbleToProcess( + const int32_t function_id, + const commands::Command::CommandSource source) const { + LOG4CXX_DEBUG(logger_, + "AppServiceCommandFactory::IsAbleToProcess" << function_id + << " " << source); + return (commands::Command::SOURCE_HMI == source || + commands::Command::SOURCE_SDL_TO_HMI == source) + ? hmi_command_factory_->IsAbleToProcess(function_id, source) + : mobile_command_factory_->IsAbleToProcess(function_id, source); +} +} // namespace service_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc new file mode 100644 index 0000000000..7cfbdd22d0 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc @@ -0,0 +1,191 @@ +/* + 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 "app_service_rpc_plugin/app_service_hmi_command_factory.h" +#include "application_manager/message.h" +#include "interfaces/HMI_API.h" + +#include "app_service_rpc_plugin/commands/hmi/as_app_service_activation_request.h" +#include "app_service_rpc_plugin/commands/hmi/as_app_service_activation_response.h" +#include "app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_request.h" +#include "app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_response.h" +#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h" +#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_to_hmi.h" +#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_from_hmi.h" +#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_to_hmi.h" +#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_records_request.h" +#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_records_response.h" +#include "app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h" +#include "app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_to_hmi.h" +#include "app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_from_hmi.h" +#include "app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_to_hmi.h" +#include "app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h" +#include "app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h" +#include "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h" +#include "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h" + +CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin") + +namespace app_service_rpc_plugin { +namespace strings = app_mngr::strings; + +AppServiceHmiCommandFactory::AppServiceHmiCommandFactory( + application_manager::ApplicationManager& application_manager, + application_manager::rpc_service::RPCService& rpc_service, + application_manager::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : application_manager_(application_manager) + , rpc_service_(rpc_service) + , hmi_capabilities_(hmi_capabilities) + , policy_handler_(policy_handler) { + LOG4CXX_AUTO_TRACE(logger_); +} + +app_mngr::CommandSharedPtr AppServiceHmiCommandFactory::CreateCommand( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::commands::Command::CommandSource source) { + UNUSED(source); + + const hmi_apis::FunctionID::eType function_id = + static_cast<hmi_apis::FunctionID::eType>( + (*message)[strings::params][strings::function_id].asInt()); + + const hmi_apis::messageType::eType message_type = + static_cast<hmi_apis::messageType::eType>( + (*message)[strings::params][strings::message_type].asInt()); + + auto message_type_str = "request"; + if (hmi_apis::messageType::response == message_type) { + message_type_str = "response"; + } else if (hmi_apis::messageType::error_response == message_type) { + message_type_str = "error response"; + } else if (hmi_apis::messageType::notification == message_type) { + message_type_str = "notification"; + } + + UNUSED(message_type_str); + LOG4CXX_DEBUG(logger_, + "HMICommandFactory::CreateCommand function_id: " + << function_id << ", message type: " << message_type_str); + + return buildCommandCreator(function_id, message_type, source).create(message); +} + +bool AppServiceHmiCommandFactory::IsAbleToProcess( + const int32_t function_id, + const app_mngr::commands::Command::CommandSource source) const { + LOG4CXX_DEBUG(logger_, + "HMI App Service Plugin IsAbleToProcess: " << function_id); + UNUSED(source); + return buildCommandCreator(function_id, + hmi_apis::messageType::INVALID_ENUM, + source).CanBeCreated(); +} + +app_mngr::CommandCreator& AppServiceHmiCommandFactory::buildCommandCreator( + const int32_t function_id, + const int32_t message_type, + const app_mngr::commands::Command::CommandSource source) const { + auto factory = app_mngr::CommandCreatorFactory( + application_manager_, rpc_service_, hmi_capabilities_, policy_handler_); + + LOG4CXX_DEBUG(logger_, + "buildCommandCreator: " << function_id << " " << source); + + switch (function_id) { + case hmi_apis::FunctionID::AppService_PublishAppService: + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::ASPublishAppServiceRequest>() + : factory.GetCreator<commands::ASPublishAppServiceResponse>(); + case hmi_apis::FunctionID::AppService_OnAppServiceData: + return app_mngr::commands::Command::CommandSource::SOURCE_HMI == source + ? factory.GetCreator< + commands::OnASAppServiceDataNotificationFromHMI>() + : factory + .GetCreator<commands::OnASAppServiceDataNotification>(); + case hmi_apis::FunctionID::AppService_GetAppServiceData: + if (app_mngr::commands::Command::CommandSource::SOURCE_HMI == source) { + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::ASGetAppServiceDataRequestFromHMI>() + : factory.GetCreator< + commands::ASGetAppServiceDataResponseFromHMI>(); + } else if (app_mngr::commands::Command::CommandSource:: + SOURCE_SDL_TO_HMI == source) { + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::ASGetAppServiceDataRequestToHMI>() + : factory.GetCreator< + commands::ASGetAppServiceDataResponseToHMI>(); + } + break; + case hmi_apis::FunctionID::AppService_GetAppServiceRecords: + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::ASGetAppServiceRecordsRequest>() + : factory + .GetCreator<commands::ASGetAppServiceRecordsResponse>(); + case hmi_apis::FunctionID::AppService_AppServiceActivation: + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::ASAppServiceActivationRequest>() + : factory + .GetCreator<commands::ASAppServiceActivationResponse>(); + case hmi_apis::FunctionID::AppService_PerformAppServiceInteraction: + if (app_mngr::commands::Command::CommandSource::SOURCE_HMI == source) { + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands:: + ASPerformAppServiceInteractionRequestFromHMI>() + : factory.GetCreator< + commands:: + ASPerformAppServiceInteractionResponseFromHMI>(); + } else if (app_mngr::commands::Command::CommandSource:: + SOURCE_SDL_TO_HMI == source) { + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::ASPerformAppServiceInteractionRequestToHMI>() + : factory.GetCreator< + commands:: + ASPerformAppServiceInteractionResponseToHMI>(); + } + break; + case hmi_apis::FunctionID::AppService_GetActiveServiceConsent: + return hmi_apis::messageType::request == message_type + ? factory + .GetCreator<commands::ASGetActiveServiceConsentRequest>() + : factory.GetCreator< + commands::ASGetActiveServiceConsentResponse>(); + default: + LOG4CXX_WARN(logger_, "Unsupported HMI function_id: " << function_id); + } + return factory.GetCreator<app_mngr::InvalidCommand>(); +} +} diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc new file mode 100644 index 0000000000..4b4da5e3e9 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc @@ -0,0 +1,159 @@ +/* + 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 "app_service_rpc_plugin/app_service_mobile_command_factory.h" + +#include "application_manager/message.h" +#include "interfaces/MOBILE_API.h" + +#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h" +#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_request_to_mobile.h" +#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_response.h" +#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_response_from_mobile.h" +#include "app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h" +#include "app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h" +#include "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request.h" +#include "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request_to_mobile.h" +#include "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response.h" +#include "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response_from_mobile.h" +#include "app_service_rpc_plugin/commands/mobile/publish_app_service_request.h" +#include "app_service_rpc_plugin/commands/mobile/publish_app_service_response.h" + +CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin") + +namespace app_service_rpc_plugin { +namespace strings = app_mngr::strings; + +AppServiceMobileCommandFactory::AppServiceMobileCommandFactory( + application_manager::ApplicationManager& application_manager, + application_manager::rpc_service::RPCService& rpc_service, + application_manager::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : application_manager_(application_manager) + , rpc_service_(rpc_service) + , hmi_capabilities_(hmi_capabilities) + , policy_handler_(policy_handler) { + LOG4CXX_AUTO_TRACE(logger_); +} + +app_mngr::CommandSharedPtr AppServiceMobileCommandFactory::CreateCommand( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::commands::Command::CommandSource source) { + UNUSED(source); + + const mobile_apis::FunctionID::eType function_id = + static_cast<mobile_apis::FunctionID::eType>( + (*message)[strings::params][strings::function_id].asInt()); + + const mobile_apis::messageType::eType message_type = + static_cast<mobile_apis::messageType::eType>( + (*message)[strings::params][strings::message_type].asInt()); + + auto message_type_str = "request"; + if (mobile_apis::messageType::response == message_type) { + message_type_str = "response"; + } else if (mobile_apis::messageType::notification == message_type) { + message_type_str = "notification"; + } + + UNUSED(message_type_str); + LOG4CXX_DEBUG(logger_, + "HMICommandFactory::CreateCommand function_id: " + << function_id << ", message type: " << message_type_str); + + return buildCommandCreator(function_id, message_type, source).create(message); +} + +bool AppServiceMobileCommandFactory::IsAbleToProcess( + const int32_t function_id, + const app_mngr::commands::Command::CommandSource source) const { + UNUSED(source); + return buildCommandCreator(function_id, + mobile_apis::messageType::INVALID_ENUM, + source).CanBeCreated(); +} + +app_mngr::CommandCreator& AppServiceMobileCommandFactory::buildCommandCreator( + const int32_t function_id, + const int32_t message_type, + const app_mngr::commands::Command::CommandSource source) const { + auto factory = app_mngr::CommandCreatorFactory( + application_manager_, rpc_service_, hmi_capabilities_, policy_handler_); + + switch (function_id) { + case mobile_apis::FunctionID::PublishAppServiceID: + return mobile_apis::messageType::request == message_type + ? factory.GetCreator<commands::PublishAppServiceRequest>() + : factory.GetCreator<commands::PublishAppServiceResponse>(); + case mobile_apis::FunctionID::OnAppServiceDataID: + return app_mngr::commands::Command::CommandSource::SOURCE_MOBILE == source + ? factory.GetCreator< + commands::OnAppServiceDataNotificationFromMobile>() + : factory.GetCreator<commands::OnAppServiceDataNotification>(); + case mobile_apis::FunctionID::GetAppServiceDataID: + if (app_mngr::commands::Command::CommandSource::SOURCE_MOBILE == source) { + return mobile_apis::messageType::request == message_type + ? factory.GetCreator<commands::GetAppServiceDataRequest>() + : factory.GetCreator< + commands::GetAppServiceDataResponseFromMobile>(); + } else if (app_mngr::commands::Command::CommandSource::SOURCE_SDL == + source) { + return mobile_apis::messageType::request == message_type + ? factory.GetCreator< + commands::GetAppServiceDataRequestToMobile>() + : factory.GetCreator<commands::GetAppServiceDataResponse>(); + } + break; + case mobile_apis::FunctionID::PerformAppServiceInteractionID: + if (app_mngr::commands::Command::CommandSource::SOURCE_MOBILE == source) { + return mobile_apis::messageType::request == message_type + ? factory.GetCreator< + commands::PerformAppServiceInteractionRequest>() + : factory.GetCreator< + commands:: + PerformAppServiceInteractionResponseFromMobile>(); + } else if (app_mngr::commands::Command::CommandSource::SOURCE_SDL == + source) { + return mobile_apis::messageType::request == message_type + ? factory.GetCreator< + commands:: + PerformAppServiceInteractionRequestToMobile>() + : factory.GetCreator< + commands::PerformAppServiceInteractionResponse>(); + } + break; + default: + LOG4CXX_WARN(logger_, "Unsupported function_id: " << function_id); + } + return factory.GetCreator<app_mngr::InvalidCommand>(); +} +} // namespace vehicle_info_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc new file mode 100644 index 0000000000..b96e5c199d --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc @@ -0,0 +1,98 @@ +/* + 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 "application_manager/message_helper.h" +#include "application_manager/smart_object_keys.h" +#include "app_service_rpc_plugin/app_service_app_extension.h" +#include "app_service_rpc_plugin/app_service_command_factory.h" +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/plugin_manager/plugin_keys.h" + +namespace app_service_rpc_plugin { +CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin") + +namespace strings = application_manager::strings; +namespace plugins = application_manager::plugin_manager; + +AppServiceRpcPlugin::AppServiceRpcPlugin() : application_manager_(nullptr) {} + +bool AppServiceRpcPlugin::Init( + application_manager::ApplicationManager& app_manager, + application_manager::rpc_service::RPCService& rpc_service, + application_manager::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) { + application_manager_ = &app_manager; + command_factory_.reset(new app_service_rpc_plugin::AppServiceCommandFactory( + app_manager, rpc_service, hmi_capabilities, policy_handler)); + return true; +} + +bool AppServiceRpcPlugin::IsAbleToProcess( + const int32_t function_id, const commands::Command::CommandSource source) { + return command_factory_->IsAbleToProcess(function_id, source); +} + +std::string AppServiceRpcPlugin::PluginName() { + return plugins::plugin_names::app_service_rpc_plugin; +} + +app_mngr::CommandFactory& AppServiceRpcPlugin::GetCommandFactory() { + return *command_factory_; +} + +void AppServiceRpcPlugin::OnPolicyEvent(plugins::PolicyEvent event) {} + +void AppServiceRpcPlugin::OnApplicationEvent( + plugins::ApplicationEvent event, + app_mngr::ApplicationSharedPtr application) { + if (plugins::ApplicationEvent::kApplicationRegistered == event) { + application->AddExtension( + std::make_shared<AppServiceAppExtension>(*this, *application)); + } else if (plugins::ApplicationEvent::kDeleteApplicationData == event) { + DeleteSubscriptions(application); + } +} + +void AppServiceRpcPlugin::DeleteSubscriptions( + application_manager::ApplicationSharedPtr app) { + auto& ext = AppServiceAppExtension::ExtractASExtension(*app); + auto subscriptions = ext.Subscriptions(); + for (auto& service_type : subscriptions) { + ext.UnsubscribeFromAppService(service_type); + } +} + +} // namespace app_service_rpc_plugin + +extern "C" application_manager::plugin_manager::RPCPlugin* Create() { + return new app_service_rpc_plugin::AppServiceRpcPlugin(); +} diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_request.cc new file mode 100644 index 0000000000..fd7312ca98 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_request.cc @@ -0,0 +1,89 @@ +/* + 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 "app_service_rpc_plugin/commands/hmi/as_app_service_activation_request.h" + +#include "application_manager/app_service_manager.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASAppServiceActivationRequest::ASAppServiceActivationRequest( + 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) + : RequestFromHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +ASAppServiceActivationRequest::~ASAppServiceActivationRequest() {} + +void ASAppServiceActivationRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + AppServiceManager& service_manager = + application_manager_.GetAppServiceManager(); + smart_objects::SmartObject params = (*message_)[strings::msg_params]; + smart_objects::SmartObject response_params(smart_objects::SmartType_Map); + std::string service_id = params[strings::service_id].asString(); + response_params[strings::service_id] = service_id; + if (params[strings::activate].asBool()) { + response_params[strings::activate] = + service_manager.ActivateAppService(service_id); + } else { + service_manager.DeactivateAppService(service_id); + response_params[strings::activate] = false; + } + + if (params.keyExists(strings::set_as_default)) { + if (params[strings::set_as_default].asBool()) { + response_params[strings::set_as_default] = + service_manager.SetDefaultService(service_id); + } else { + service_manager.RemoveDefaultService(service_id); + response_params[strings::set_as_default] = false; + } + } + + SendResponse(true, + (*message_)[strings::params][strings::correlation_id].asUInt(), + hmi_apis::FunctionID::AppService_AppServiceActivation, + hmi_apis::Common_Result::SUCCESS, + &response_params); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_response.cc new file mode 100644 index 0000000000..c77d3ed381 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_response.cc @@ -0,0 +1,59 @@ +/* + 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 "app_service_rpc_plugin/commands/hmi/as_app_service_activation_response.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASAppServiceActivationResponse::ASAppServiceActivationResponse( + 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) + : ResponseToHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +ASAppServiceActivationResponse::~ASAppServiceActivationResponse() {} + +void ASAppServiceActivationResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + rpc_service_.SendMessageToHMI(message_); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_request.cc new file mode 100644 index 0000000000..b1f3d6fdbf --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_request.cc @@ -0,0 +1,59 @@ +/* + 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 "app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_request.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASGetActiveServiceConsentRequest::ASGetActiveServiceConsentRequest( + 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) {} + +ASGetActiveServiceConsentRequest::~ASGetActiveServiceConsentRequest() {} + +void ASGetActiveServiceConsentRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + SendRequest(); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_response.cc new file mode 100644 index 0000000000..038c2922ad --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_response.cc @@ -0,0 +1,62 @@ +/* + 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 "app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_response.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASGetActiveServiceConsentResponse::ASGetActiveServiceConsentResponse( + 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) {} + +ASGetActiveServiceConsentResponse::~ASGetActiveServiceConsentResponse() {} + +void ASGetActiveServiceConsentResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + event_engine::Event event( + hmi_apis::FunctionID::AppService_GetActiveServiceConsent); + event.set_smart_object(*message_); + event.raise(application_manager_.event_dispatcher()); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc new file mode 100644 index 0000000000..a339ffb9a6 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc @@ -0,0 +1,126 @@ +/* + 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 "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h" +#include "application_manager/application_impl.h" +#include "application_manager/rpc_service.h" +#include "interfaces/MOBILE_API.h" +#include "smart_objects/enum_schema_item.h" + +#include "application_manager/message_helper.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASGetAppServiceDataRequestFromHMI::ASGetAppServiceDataRequestFromHMI( + 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) + : RequestFromHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +ASGetAppServiceDataRequestFromHMI::~ASGetAppServiceDataRequestFromHMI() {} + +void ASGetAppServiceDataRequestFromHMI::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + std::string service_type = + (*message_)[strings::msg_params][strings::service_type].asString(); + + LOG4CXX_DEBUG(logger_, "Get Service Type: " << service_type); + + SendProviderRequest(mobile_apis::FunctionID::GetAppServiceDataID, + hmi_apis::FunctionID::AppService_GetAppServiceData, + &(*message_), + true); +} + +void ASGetAppServiceDataRequestFromHMI::on_event( + const event_engine::Event& event) { + const smart_objects::SmartObject& event_message = event.smart_object(); + + auto msg_params = event_message[strings::msg_params]; + + hmi_apis::Common_Result::eType result = + static_cast<hmi_apis::Common_Result::eType>( + event_message[strings::params][hmi_response::code].asInt()); + bool success = + IsHMIResultSuccess(result, HmiInterfaces::HMI_INTERFACE_AppService); + SendResponse(success, + correlation_id(), + hmi_apis::FunctionID::AppService_GetAppServiceData, + result, + &msg_params, + application_manager::commands::Command::SOURCE_SDL_TO_HMI); +} + +void ASGetAppServiceDataRequestFromHMI::on_event( + const event_engine::MobileEvent& event) { + const smart_objects::SmartObject& event_message = event.smart_object(); + + auto msg_params = event_message[strings::msg_params]; + + mobile_apis::Result::eType mobile_result = + static_cast<mobile_apis::Result::eType>( + msg_params[strings::result_code].asInt()); + hmi_apis::Common_Result::eType result = + MessageHelper::MobileToHMIResult(mobile_result); + bool success = IsMobileResultSuccess(mobile_result); + + SendResponse(success, + correlation_id(), + hmi_apis::FunctionID::AppService_GetAppServiceData, + result, + &msg_params, + application_manager::commands::Command::SOURCE_SDL_TO_HMI); +} + +void ASGetAppServiceDataRequestFromHMI::onTimeOut() { + LOG4CXX_AUTO_TRACE(logger_); + smart_objects::SmartObject response_params; + response_params[strings::info] = + "The provider did not respond to the request"; + SendErrorResponse(correlation_id(), + hmi_apis::FunctionID::AppService_GetAppServiceData, + hmi_apis::Common_Result::GENERIC_ERROR, + "The provider did not respond to the request", + application_manager::commands::Command::SOURCE_SDL_TO_HMI); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_to_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_to_hmi.cc new file mode 100644 index 0000000000..635cd7319a --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_to_hmi.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 "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_to_hmi.h" +#include "application_manager/application_impl.h" +#include "application_manager/rpc_service.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASGetAppServiceDataRequestToHMI::ASGetAppServiceDataRequestToHMI( + 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) {} + +ASGetAppServiceDataRequestToHMI::~ASGetAppServiceDataRequestToHMI() {} + +void ASGetAppServiceDataRequestToHMI::Run() { + LOG4CXX_AUTO_TRACE(logger_); + SendRequest(); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_from_hmi.cc new file mode 100644 index 0000000000..c0b1b274fb --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_from_hmi.cc @@ -0,0 +1,67 @@ +/* + 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 "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_from_hmi.h" +#include "application_manager/application_impl.h" +#include "application_manager/rpc_service.h" +#include "interfaces/HMI_API.h" + +#include "application_manager/message_helper.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASGetAppServiceDataResponseFromHMI::ASGetAppServiceDataResponseFromHMI( + 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) {} + +ASGetAppServiceDataResponseFromHMI::~ASGetAppServiceDataResponseFromHMI() {} + +void ASGetAppServiceDataResponseFromHMI::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + event_engine::Event event(hmi_apis::FunctionID::AppService_GetAppServiceData); + event.set_smart_object(*message_); + event.raise(application_manager_.event_dispatcher()); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_to_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_to_hmi.cc new file mode 100644 index 0000000000..b489ec4765 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_to_hmi.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 "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_to_hmi.h" +#include "application_manager/application_impl.h" +#include "application_manager/rpc_service.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASGetAppServiceDataResponseToHMI::ASGetAppServiceDataResponseToHMI( + 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) + : ResponseToHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +ASGetAppServiceDataResponseToHMI::~ASGetAppServiceDataResponseToHMI() {} + +void ASGetAppServiceDataResponseToHMI::Run() { + LOG4CXX_AUTO_TRACE(logger_); + rpc_service_.SendMessageToHMI(message_); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc new file mode 100644 index 0000000000..fa704c1995 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc @@ -0,0 +1,90 @@ +/* + 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 "app_service_rpc_plugin/commands/hmi/as_get_app_service_records_request.h" + +#include "application_manager/app_service_manager.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASGetAppServiceRecordsRequest::ASGetAppServiceRecordsRequest( + 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) + : RequestFromHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +ASGetAppServiceRecordsRequest::~ASGetAppServiceRecordsRequest() {} + +void ASGetAppServiceRecordsRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + std::string type; + if ((*message_)[strings::msg_params].keyExists(strings::service_type)) { + type = (*message_)[strings::msg_params][strings::service_type].asString(); + } + smart_objects::SmartObject response_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); + smart_objects::SmartObject records = + smart_objects::SmartObject(smart_objects::SmartType_Array); + std::vector<smart_objects::SmartObject> service_records = + application_manager_.GetAppServiceManager().GetAllServiceRecords(); + + int index = 0; + for (auto& record : service_records) { + if (!type.empty() && + record[strings::service_manifest][strings::service_type].asString() != + type) { + continue; + } + records[index] = record; + index++; + } + + if (!records.empty()) { + response_params[strings::service_records] = records; + } + SendResponse(true, + (*message_)[strings::params][strings::correlation_id].asUInt(), + hmi_apis::FunctionID::AppService_GetAppServiceRecords, + hmi_apis::Common_Result::SUCCESS, + &response_params); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_response.cc new file mode 100644 index 0000000000..0479aa8d31 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_response.cc @@ -0,0 +1,59 @@ +/* + 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 "app_service_rpc_plugin/commands/hmi/as_get_app_service_records_response.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASGetAppServiceRecordsResponse::ASGetAppServiceRecordsResponse( + 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) + : ResponseToHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +ASGetAppServiceRecordsResponse::~ASGetAppServiceRecordsResponse() {} + +void ASGetAppServiceRecordsResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + rpc_service_.SendMessageToHMI(message_); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc new file mode 100644 index 0000000000..6499b08c28 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc @@ -0,0 +1,164 @@ +/* + 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 "app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h" + +#include "application_manager/app_service_manager.h" +#include "application_manager/message_helper.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASPerformAppServiceInteractionRequestFromHMI:: + ASPerformAppServiceInteractionRequestFromHMI( + 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) + : RequestFromHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +ASPerformAppServiceInteractionRequestFromHMI:: + ~ASPerformAppServiceInteractionRequestFromHMI() {} + +void ASPerformAppServiceInteractionRequestFromHMI::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; + std::string hmi_origin_id = + application_manager_.get_settings().hmi_origin_id(); + if (!msg_params.keyExists(strings::origin_app)) { + if (hmi_origin_id.empty()) { + SendErrorResponse( + correlation_id(), + hmi_apis::FunctionID::AppService_PerformAppServiceInteraction, + hmi_apis::Common_Result::INVALID_DATA, + "No HMI origin ID to use for interaction passthrough", + application_manager::commands::Command::SOURCE_SDL_TO_HMI); + return; + } + msg_params[strings::origin_app] = hmi_origin_id; + } + + std::string service_id = msg_params[strings::service_id].asString(); + auto service = + application_manager_.GetAppServiceManager().FindServiceByID(service_id); + if (!service) { + SendErrorResponse( + correlation_id(), + hmi_apis::FunctionID::AppService_PerformAppServiceInteraction, + hmi_apis::Common_Result::INVALID_ID, + "The requested service ID does not exist", + application_manager::commands::Command::SOURCE_SDL_TO_HMI); + return; + } + + bool request_service_active = false; + if (msg_params.keyExists(strings::request_service_active)) { + request_service_active = + msg_params[strings::request_service_active].asBool(); + msg_params.erase(strings::request_service_active); + } + + // Only activate service if it is not already active + bool activate_service = request_service_active && + !service->record[strings::service_active].asBool(); + if (activate_service) { + application_manager_.GetAppServiceManager().ActivateAppService(service_id); + } + + SendProviderRequest( + mobile_apis::FunctionID::PerformAppServiceInteractionID, + hmi_apis::FunctionID::AppService_PerformAppServiceInteraction, + &(*message_), + true); +} + +void ASPerformAppServiceInteractionRequestFromHMI::on_event( + const event_engine::Event& event) { + const smart_objects::SmartObject& event_message = event.smart_object(); + + auto msg_params = event_message[strings::msg_params]; + + hmi_apis::Common_Result::eType result = + static_cast<hmi_apis::Common_Result::eType>( + event_message[strings::params][hmi_response::code].asInt()); + bool success = + IsHMIResultSuccess(result, HmiInterfaces::HMI_INTERFACE_AppService); + SendResponse(success, + correlation_id(), + hmi_apis::FunctionID::AppService_PerformAppServiceInteraction, + result, + &msg_params, + application_manager::commands::Command::SOURCE_SDL_TO_HMI); +} + +void ASPerformAppServiceInteractionRequestFromHMI::on_event( + const event_engine::MobileEvent& event) { + const smart_objects::SmartObject& event_message = event.smart_object(); + + auto msg_params = event_message[strings::msg_params]; + + mobile_apis::Result::eType mobile_result = + static_cast<mobile_apis::Result::eType>( + msg_params[strings::result_code].asInt()); + hmi_apis::Common_Result::eType result = + MessageHelper::MobileToHMIResult(mobile_result); + bool success = IsMobileResultSuccess(mobile_result); + SendResponse(success, + correlation_id(), + hmi_apis::FunctionID::AppService_PerformAppServiceInteraction, + result, + &msg_params, + application_manager::commands::Command::SOURCE_SDL_TO_HMI); +} + +void ASPerformAppServiceInteractionRequestFromHMI::onTimeOut() { + LOG4CXX_AUTO_TRACE(logger_); + smart_objects::SmartObject response_params; + response_params[strings::info] = + "The provider did not respond to the request"; + SendErrorResponse( + correlation_id(), + hmi_apis::FunctionID::AppService_PerformAppServiceInteraction, + hmi_apis::Common_Result::GENERIC_ERROR, + "The provider did not respond to the request", + application_manager::commands::Command::SOURCE_SDL_TO_HMI); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_to_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_to_hmi.cc new file mode 100644 index 0000000000..22876328de --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_to_hmi.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 "app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_to_hmi.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASPerformAppServiceInteractionRequestToHMI:: + ASPerformAppServiceInteractionRequestToHMI( + 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) {} + +ASPerformAppServiceInteractionRequestToHMI:: + ~ASPerformAppServiceInteractionRequestToHMI() {} + +void ASPerformAppServiceInteractionRequestToHMI::Run() { + LOG4CXX_AUTO_TRACE(logger_); + SendRequest(); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_from_hmi.cc new file mode 100644 index 0000000000..a2ffa65a73 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_from_hmi.cc @@ -0,0 +1,64 @@ +/* + 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 "app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_from_hmi.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASPerformAppServiceInteractionResponseFromHMI:: + ASPerformAppServiceInteractionResponseFromHMI( + 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) {} + +ASPerformAppServiceInteractionResponseFromHMI:: + ~ASPerformAppServiceInteractionResponseFromHMI() {} + +void ASPerformAppServiceInteractionResponseFromHMI::Run() { + LOG4CXX_AUTO_TRACE(logger_); + event_engine::Event event( + hmi_apis::FunctionID::AppService_PerformAppServiceInteraction); + event.set_smart_object(*message_); + event.raise(application_manager_.event_dispatcher()); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_to_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_to_hmi.cc new file mode 100644 index 0000000000..5ddef55c2a --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_to_hmi.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 "app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_to_hmi.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASPerformAppServiceInteractionResponseToHMI:: + ASPerformAppServiceInteractionResponseToHMI( + 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) + : ResponseToHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +ASPerformAppServiceInteractionResponseToHMI:: + ~ASPerformAppServiceInteractionResponseToHMI() {} + +void ASPerformAppServiceInteractionResponseToHMI::Run() { + LOG4CXX_AUTO_TRACE(logger_); + rpc_service_.SendMessageToHMI(message_); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc new file mode 100644 index 0000000000..637240666d --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc @@ -0,0 +1,76 @@ +/* + 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 "app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h" + +#include "application_manager/app_service_manager.h" +#include "application_manager/message_helper.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASPublishAppServiceRequest::ASPublishAppServiceRequest( + 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) + : RequestFromHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +ASPublishAppServiceRequest::~ASPublishAppServiceRequest() {} + +void ASPublishAppServiceRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_DEBUG(logger_, "Received a PublishAppService request from HMI"); + smart_objects::SmartObject response_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); + smart_objects::SmartObject manifest = + (*message_)[strings::msg_params][strings::app_service_manifest]; + smart_objects::SmartObject service_record = + application_manager_.GetAppServiceManager().PublishAppService(manifest, + false); + + response_params[strings::app_service_record] = service_record; + SendResponse(true, + (*message_)[strings::params][strings::correlation_id].asUInt(), + hmi_apis::FunctionID::AppService_PublishAppService, + hmi_apis::Common_Result::SUCCESS, + &response_params); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc new file mode 100644 index 0000000000..c143315b8c --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_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 "app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h" +#include "application_manager/message_helper.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASPublishAppServiceResponse::ASPublishAppServiceResponse( + 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) + : ResponseToHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +ASPublishAppServiceResponse::~ASPublishAppServiceResponse() {} + +void ASPublishAppServiceResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + rpc_service_.SendMessageToHMI(message_); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc new file mode 100644 index 0000000000..80dd88c15f --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.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 "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +OnASAppServiceDataNotification::OnASAppServiceDataNotification( + 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) + : NotificationToHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +OnASAppServiceDataNotification::~OnASAppServiceDataNotification() {} + +void OnASAppServiceDataNotification::Run() { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_DEBUG(logger_, "Sending AS data to HMI"); + SendNotification(); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc new file mode 100644 index 0000000000..05266f834b --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc @@ -0,0 +1,62 @@ +/* + 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 "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +OnASAppServiceDataNotificationFromHMI::OnASAppServiceDataNotificationFromHMI( + 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) + : NotificationFromHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +OnASAppServiceDataNotificationFromHMI:: + ~OnASAppServiceDataNotificationFromHMI() {} + +void OnASAppServiceDataNotificationFromHMI::Run() { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_DEBUG(logger_, "Received an OnAppServiceData from HMI"); + SendNotificationToConsumers( + mobile_apis::FunctionID::eType::OnAppServiceDataID); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc new file mode 100644 index 0000000000..7c2e62abe2 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc @@ -0,0 +1,129 @@ +/* + 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 "app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h" +#include "app_service_rpc_plugin/app_service_app_extension.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 "smart_objects/enum_schema_item.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +GetAppServiceDataRequest::GetAppServiceDataRequest( + 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) {} + +GetAppServiceDataRequest::~GetAppServiceDataRequest() {} + +void GetAppServiceDataRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + SendProviderRequest(mobile_apis::FunctionID::GetAppServiceDataID, + hmi_apis::FunctionID::AppService_GetAppServiceData, + &(*message_), + true); +} + +void GetAppServiceDataRequest::HandleSubscribe() { + std::string service_type = + (*message_)[strings::msg_params][strings::service_type].asString(); + ApplicationSharedPtr app = application_manager_.application(connection_key()); + if (app && (*message_)[strings::msg_params].keyExists(strings::subscribe)) { + bool subscribe = + (*message_)[strings::msg_params][strings::subscribe].asBool(); + auto& ext = AppServiceAppExtension::ExtractASExtension(*app); + if (subscribe) { + ext.SubscribeToAppService(service_type); + } else { + ext.UnsubscribeFromAppService(service_type); + } + } +} + +void GetAppServiceDataRequest::on_event( + const event_engine::MobileEvent& event) { + const smart_objects::SmartObject& event_message = event.smart_object(); + + auto msg_params = event_message[strings::msg_params]; + + mobile_apis::Result::eType result = static_cast<mobile_apis::Result::eType>( + msg_params[strings::result_code].asInt()); + bool success = IsMobileResultSuccess(result); + if (success) { + HandleSubscribe(); + } + + const char* info = msg_params.keyExists(strings::info) + ? msg_params[strings::info].asCharArray() + : NULL; + + SendResponse(success, result, info, &msg_params); +} + +void GetAppServiceDataRequest::on_event(const event_engine::Event& event) { + const smart_objects::SmartObject& event_message = event.smart_object(); + + auto msg_params = event_message[strings::msg_params]; + + hmi_apis::Common_Result::eType hmi_result = + static_cast<hmi_apis::Common_Result::eType>( + event_message[strings::params][hmi_response::code].asInt()); + + mobile_apis::Result::eType result = + MessageHelper::HMIToMobileResult(hmi_result); + bool success = PrepareResultForMobileResponse( + hmi_result, HmiInterfaces::HMI_INTERFACE_AppService); + if (success) { + HandleSubscribe(); + } + + const char* info = msg_params.keyExists(strings::info) + ? msg_params[strings::info].asCharArray() + : NULL; + + SendResponse(success, result, info, &msg_params); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request_to_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request_to_mobile.cc new file mode 100644 index 0000000000..0af1a5436b --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request_to_mobile.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 "app_service_rpc_plugin/commands/mobile/get_app_service_data_request_to_mobile.h" +#include "application_manager/application_impl.h" +#include "application_manager/rpc_service.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +GetAppServiceDataRequestToMobile::GetAppServiceDataRequestToMobile( + 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) + : CommandRequestToMobile(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +GetAppServiceDataRequestToMobile::~GetAppServiceDataRequestToMobile() {} + +void GetAppServiceDataRequestToMobile::Run() { + LOG4CXX_AUTO_TRACE(logger_); + SendRequest(); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response.cc new file mode 100644 index 0000000000..32ad8e014d --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_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 "app_service_rpc_plugin/commands/mobile/get_app_service_data_response.h" +#include "application_manager/application_impl.h" +#include "application_manager/rpc_service.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +GetAppServiceDataResponse::GetAppServiceDataResponse( + 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) {} + +GetAppServiceDataResponse::~GetAppServiceDataResponse() {} + +void GetAppServiceDataResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + rpc_service_.SendMessageToMobile(message_); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response_from_mobile.cc new file mode 100644 index 0000000000..90fca04eb2 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response_from_mobile.cc @@ -0,0 +1,66 @@ +/* + 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 "app_service_rpc_plugin/commands/mobile/get_app_service_data_response_from_mobile.h" +#include "application_manager/application_impl.h" +#include "application_manager/message_helper.h" +#include "application_manager/rpc_service.h" +#include "interfaces/MOBILE_API.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +GetAppServiceDataResponseFromMobile::GetAppServiceDataResponseFromMobile( + 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) + : CommandResponseFromMobile(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +GetAppServiceDataResponseFromMobile::~GetAppServiceDataResponseFromMobile() {} + +void GetAppServiceDataResponseFromMobile::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + event_engine::MobileEvent event(mobile_apis::FunctionID::GetAppServiceDataID); + event.set_smart_object(*message_); + event.raise(application_manager_.event_dispatcher()); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc new file mode 100644 index 0000000000..fd3891e0e8 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.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 "app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h" + +#include "app_service_rpc_plugin/app_service_app_extension.h" +#include "application_manager/app_service_manager.h" +#include "application_manager/application_impl.h" +#include "application_manager/helpers/application_helper.h" +#include "application_manager/message_helper.h" +#include "application_manager/rpc_service.h" +#include "interfaces/MOBILE_API.h" + +#include "smart_objects/enum_schema_item.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +OnAppServiceDataNotification::OnAppServiceDataNotification( + 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) + : CommandNotificationImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +OnAppServiceDataNotification::~OnAppServiceDataNotification() {} + +void OnAppServiceDataNotification::Run() { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_DEBUG(logger_, "Sending OnAppServiceData to consumer"); + + std::string service_id = + (*message_)[strings::msg_params][strings::service_data] + [strings::service_id].asString(); + auto service = + application_manager_.GetAppServiceManager().FindServiceByID(service_id); + + if (!service) { + LOG4CXX_ERROR(logger_, "Service sending OnAppServiceData is not published"); + return; + } else if (!service->record[strings::service_manifest] + [strings::allow_app_consumers].asBool()) { + LOG4CXX_ERROR(logger_, + "Service does not allow for app consumers, skipping mobile " + "OnAppServiceData notification"); + return; + } + + std::string service_type = + (*message_)[strings::msg_params][strings::service_data] + [strings::service_type].asString(); + + auto subscribed_to_app_service_predicate = + [service_type](const ApplicationSharedPtr app) { + DCHECK_OR_RETURN(app, false); + auto& ext = AppServiceAppExtension::ExtractASExtension(*app); + LOG4CXX_DEBUG(logger_, "Check subscription for type: " << service_type); + return ext.IsSubscribedToAppService(service_type); + }; + + const std::vector<ApplicationSharedPtr>& applications = + application_manager::FindAllApps(application_manager_.applications(), + subscribed_to_app_service_predicate); + + std::vector<ApplicationSharedPtr>::const_iterator app_it = + applications.begin(); + + for (; applications.end() != app_it; ++app_it) { + const ApplicationSharedPtr app = *app_it; + if (!app) { + LOG4CXX_ERROR(logger_, "NULL pointer"); + continue; + } + LOG4CXX_DEBUG(logger_, + "Sending OnAppServiceDataNotification to mobile connection: " + << app->app_id()); + (*message_)[app_mngr::strings::params][app_mngr::strings::connection_key] = + app->app_id(); + SendNotification(); + } +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc new file mode 100644 index 0000000000..7bb62d298d --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc @@ -0,0 +1,84 @@ +/* + 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 "app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h" +#include "application_manager/application_impl.h" +#include "application_manager/message_helper.h" +#include "application_manager/rpc_service.h" +#include "interfaces/MOBILE_API.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +OnAppServiceDataNotificationFromMobile::OnAppServiceDataNotificationFromMobile( + 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) + : CommandNotificationFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +OnAppServiceDataNotificationFromMobile:: + ~OnAppServiceDataNotificationFromMobile() {} + +void OnAppServiceDataNotificationFromMobile::Run() { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_DEBUG(logger_, "Received an OnAppServiceData"); + MessageHelper::PrintSmartObject(*message_); + + std::string service_type = + (*message_)[strings::msg_params][strings::service_data] + [strings::service_type].asString(); + + ApplicationSharedPtr app = application_manager_.application(connection_key()); + + bool result = policy_handler_.CheckAppServiceParameters( + app->policy_app_id(), std::string(), service_type, NULL); + + if (!result) { + LOG4CXX_DEBUG(logger_, + "Incorrect service type received in " + "OnAppServiceDataNotificationFromMobile"); + return; + } + + SendNotificationToConsumers( + hmi_apis::FunctionID::eType::AppService_OnAppServiceData); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc new file mode 100644 index 0000000000..63b6e47d8e --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc @@ -0,0 +1,188 @@ +/* + 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 "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request.h" + +#include "application_manager/app_service_manager.h" +#include "application_manager/application_impl.h" +#include "application_manager/message_helper.h" +#include "interfaces/MOBILE_API.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +PerformAppServiceInteractionRequest::PerformAppServiceInteractionRequest( + 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) {} + +PerformAppServiceInteractionRequest::~PerformAppServiceInteractionRequest() {} + +void PerformAppServiceInteractionRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + auto app = application_manager_.application(connection_key()); + if (!app) { + SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); + return; + } + + smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; + std::string service_id = msg_params[strings::service_id].asString(); + auto service = + application_manager_.GetAppServiceManager().FindServiceByID(service_id); + if (!service) { + SendResponse(false, + mobile_apis::Result::INVALID_ID, + "The requested service ID does not exist"); + return; + } + + if (!service->record[strings::service_manifest][strings::allow_app_consumers] + .asBool()) { + SendResponse( + false, + mobile_apis::Result::REJECTED, + "The requested service ID does not allow mobile app consumers"); + return; + } + + bool request_service_active = false; + if (msg_params.keyExists(strings::request_service_active)) { + request_service_active = + msg_params[strings::request_service_active].asBool(); + msg_params.erase(strings::request_service_active); + } + + // Only activate service if it is not already active + bool activate_service = request_service_active && + !service->record[strings::service_active].asBool(); + if (activate_service) { + if (app->IsFullscreen()) { + // App is in foreground, we can just activate the service + application_manager_.GetAppServiceManager().ActivateAppService( + service_id); + } else { + // App is not in foreground, we need to prompt the user to activate the + // service + smart_objects::SmartObject request_params; + request_params[strings::service_id] = service_id; + application_manager_.IncreaseForwardedRequestTimeout(connection_key(), + correlation_id()); + SendHMIRequest(hmi_apis::FunctionID::AppService_GetActiveServiceConsent, + &request_params, + true); + return; + } + } + + SendProviderRequest( + mobile_apis::FunctionID::PerformAppServiceInteractionID, + hmi_apis::FunctionID::AppService_PerformAppServiceInteraction, + &(*message_), + true); +} + +void PerformAppServiceInteractionRequest::on_event( + const event_engine::Event& event) { + LOG4CXX_DEBUG(logger_, "HMI PerformAppServiceInteraction on_event"); + const smart_objects::SmartObject& event_message = event.smart_object(); + + auto msg_params = event_message[strings::msg_params]; + + const char* info = msg_params.keyExists(strings::info) + ? msg_params[strings::info].asCharArray() + : NULL; + hmi_apis::Common_Result::eType hmi_result = + static_cast<hmi_apis::Common_Result::eType>( + event_message[strings::params][hmi_response::code].asInt()); + mobile_apis::Result::eType result = + MessageHelper::HMIToMobileResult(hmi_result); + bool success = PrepareResultForMobileResponse( + hmi_result, HmiInterfaces::HMI_INTERFACE_AppService); + + switch (event.id()) { + case hmi_apis::FunctionID::AppService_PerformAppServiceInteraction: + SendResponse(success, result, info, &msg_params); + break; + case hmi_apis::FunctionID::AppService_GetActiveServiceConsent: + if (msg_params[strings::activate].asBool()) { + // User agreed to activate service, we can now send the provider request + application_manager_.GetAppServiceManager().ActivateAppService( + (*message_)[strings::msg_params][strings::service_id].asString()); + SendProviderRequest( + mobile_apis::FunctionID::PerformAppServiceInteractionID, + hmi_apis::FunctionID::AppService_PerformAppServiceInteraction, + &(*message_), + true); + } else if (mobile_apis::Result::SUCCESS == result) { + // Request was successful, but user denied the request to activate the + // service + SendResponse(false, + mobile_apis::Result::USER_DISALLOWED, + "Request to activate service was denied by driver"); + } else { + SendResponse(success, result, info); + } + break; + default: + break; + } +} + +void PerformAppServiceInteractionRequest::on_event( + const event_engine::MobileEvent& event) { + LOG4CXX_DEBUG(logger_, "Mobile PerformAppServiceInteraction on_event"); + const smart_objects::SmartObject& event_message = event.smart_object(); + + auto msg_params = event_message[strings::msg_params]; + + const char* info = msg_params.keyExists(strings::info) + ? msg_params[strings::info].asCharArray() + : NULL; + mobile_apis::Result::eType result = static_cast<mobile_apis::Result::eType>( + msg_params[strings::result_code].asInt()); + bool success = IsMobileResultSuccess(result); + + SendResponse(success, result, info, &msg_params); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request_to_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request_to_mobile.cc new file mode 100644 index 0000000000..2a7b644cb3 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request_to_mobile.cc @@ -0,0 +1,62 @@ +/* + 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 "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request_to_mobile.h" +#include "application_manager/application_impl.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +PerformAppServiceInteractionRequestToMobile:: + PerformAppServiceInteractionRequestToMobile( + 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) + : CommandRequestToMobile(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +PerformAppServiceInteractionRequestToMobile:: + ~PerformAppServiceInteractionRequestToMobile() {} + +void PerformAppServiceInteractionRequestToMobile::Run() { + LOG4CXX_AUTO_TRACE(logger_); + SendRequest(); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response.cc new file mode 100644 index 0000000000..5e84f42c34 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_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 "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response.h" +#include "application_manager/application_impl.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +PerformAppServiceInteractionResponse::PerformAppServiceInteractionResponse( + 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) {} + +PerformAppServiceInteractionResponse::~PerformAppServiceInteractionResponse() {} + +void PerformAppServiceInteractionResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + rpc_service_.SendMessageToMobile(message_); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response_from_mobile.cc new file mode 100644 index 0000000000..9912df84ce --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response_from_mobile.cc @@ -0,0 +1,66 @@ +/* + 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 "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response_from_mobile.h" +#include "application_manager/application_impl.h" +#include "interfaces/MOBILE_API.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +PerformAppServiceInteractionResponseFromMobile:: + PerformAppServiceInteractionResponseFromMobile( + 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) + : CommandResponseFromMobile(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +PerformAppServiceInteractionResponseFromMobile:: + ~PerformAppServiceInteractionResponseFromMobile() {} + +void PerformAppServiceInteractionResponseFromMobile::Run() { + LOG4CXX_AUTO_TRACE(logger_); + event_engine::MobileEvent event( + mobile_apis::FunctionID::PerformAppServiceInteractionID); + event.set_smart_object(*message_); + event.raise(application_manager_.event_dispatcher()); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc new file mode 100644 index 0000000000..bb0855d42f --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -0,0 +1,126 @@ +/* + 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 "app_service_rpc_plugin/commands/mobile/publish_app_service_request.h" + +#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 "sdl_rpc_plugin/extensions/system_capability_app_extension.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +PublishAppServiceRequest::PublishAppServiceRequest( + 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) {} + +PublishAppServiceRequest::~PublishAppServiceRequest() {} + +void PublishAppServiceRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_DEBUG(logger_, "Received a PublishAppService " << connection_key()); + MessageHelper::PrintSmartObject(*message_); + + smart_objects::SmartObject response_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); + smart_objects::SmartObject manifest = + (*message_)[strings::msg_params][strings::app_service_manifest]; + + ApplicationSharedPtr app = application_manager_.application(connection_key()); + + std::string requested_service_name = ""; + + if ((*message_)[strings::msg_params][strings::app_service_manifest].keyExists( + strings::service_name)) { + requested_service_name = + (*message_)[strings::msg_params][strings::app_service_manifest] + [strings::service_name].asString(); + } + + std::string requested_service_type = + (*message_)[strings::msg_params][strings::app_service_manifest] + [strings::service_type].asString(); + + smart_objects::SmartArray* requested_handled_rpcs = NULL; + if ((*message_)[strings::msg_params][strings::app_service_manifest].keyExists( + strings::handled_rpcs)) { + requested_handled_rpcs = + (*message_)[strings::msg_params][strings::app_service_manifest] + [strings::handled_rpcs].asArray(); + } + + bool result = + policy_handler_.CheckAppServiceParameters(app->policy_app_id(), + requested_service_name, + requested_service_type, + requested_handled_rpcs); + + if (!result) { + SendResponse(false, + mobile_apis::Result::DISALLOWED, + "Service disallowed by policies", + NULL); + return; + } + + auto& ext = + sdl_rpc_plugin::SystemCapabilityAppExtension::ExtractExtension(*app); + ext.SubscribeTo(mobile_apis::SystemCapabilityType::APP_SERVICES); + + smart_objects::SmartObject service_record = + application_manager_.GetAppServiceManager().PublishAppService( + manifest, true, connection_key()); + if (app->IsFullscreen()) { + // Service should be activated if app is in the foreground + application_manager_.GetAppServiceManager().ActivateAppService( + service_record[strings::service_id].asString()); + } + + response_params[strings::app_service_record] = service_record; + + SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &response_params); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc new file mode 100644 index 0000000000..d1bfc6e154 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc @@ -0,0 +1,62 @@ +/* + 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 "app_service_rpc_plugin/commands/mobile/publish_app_service_response.h" +#include "application_manager/application_impl.h" +#include "application_manager/message_helper.h" +#include "application_manager/rpc_service.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +PublishAppServiceResponse::PublishAppServiceResponse( + 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) {} + +PublishAppServiceResponse::~PublishAppServiceResponse() {} + +void PublishAppServiceResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + rpc_service_.SendMessageToMobile(message_); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt new file mode 100644 index 0000000000..0b56ddb7e9 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt @@ -0,0 +1,40 @@ +include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/sources.cmake) + +include_directories( + ${GMOCK_INCLUDE_DIRECTORY} + ${COMPONENTS_DIR}/application_manager/rpc_plugins/app_service_rpc_plugin/include + ${COMPONENTS_DIR}/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/ + ${COMPONENTS_DIR}/application_manager/test/include/ + ${POLICY_MOCK_INCLUDE_PATH}/ + ${CMAKE_SOURCE_DIR}/src + ${COMPONENTS_DIR}/resumption/include +) + + +set(COMMANDS_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/commands) + +file(GLOB SOURCES + ${COMPONENTS_DIR}/application_manager/test/mock_message_helper.cc + ${COMPONENTS_DIR}/application_manager/test/mock_application_helper.cc + ${COMPONENTS_DIR}/application_manager/src/smart_object_keys.cc + ${COMMANDS_TEST_DIR}/hmi/* + ${COMMANDS_TEST_DIR}/mobile/* + ${COMPONENTS_DIR}/application_manager/src/message.cc + ${COMPONENTS_DIR}/application_manager/src/event_engine/* +) + +set(LIBRARIES + gmock + Utils + SmartObjects + HMI_API + MOBILE_API + connectionHandler + app_service_rpc_plugin + sdl_rpc_plugin + jsoncpp + Policy + Resumption +) + +create_cotired_test("app_services_commands_test" "${SOURCES}" "${LIBRARIES}" ) diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc new file mode 100644 index 0000000000..8ef87b6de9 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc @@ -0,0 +1,151 @@ +/* + * 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 "application_manager/commands/command_request_test.h" + +#include <stdint.h> +#include <string> +#include <vector> +#include "gtest/gtest.h" + +#include "hmi/as_app_service_activation_request.h" +#include "hmi/as_app_service_activation_response.h" +#include "hmi/as_get_active_service_consent_request.h" +#include "hmi/as_get_active_service_consent_response.h" +#include "hmi/as_get_app_service_data_request_from_hmi.h" +#include "hmi/as_get_app_service_data_request_to_hmi.h" +#include "hmi/as_get_app_service_data_response_from_hmi.h" +#include "hmi/as_get_app_service_data_response_to_hmi.h" +#include "hmi/as_get_app_service_records_request.h" +#include "hmi/as_get_app_service_records_response.h" +#include "hmi/as_perform_app_service_interaction_request_from_hmi.h" +#include "hmi/as_perform_app_service_interaction_request_to_hmi.h" +#include "hmi/as_perform_app_service_interaction_response_from_hmi.h" +#include "hmi/as_perform_app_service_interaction_response_to_hmi.h" +#include "hmi/as_publish_app_service_request.h" +#include "hmi/as_publish_app_service_response.h" +#include "hmi/on_as_app_service_data_notification.h" +#include "hmi/on_as_app_service_data_notification_from_hmi.h" + +#include "application_manager/commands/commands_test.h" +#include "application_manager/mock_application.h" +#include "application_manager/mock_application_manager.h" +#include "application_manager/mock_application_manager_settings.h" +#include "application_manager/mock_event_dispatcher.h" + +namespace am = application_manager; + +namespace test { +namespace components { +namespace commands_test { +namespace hmi_commands_test { +namespace dummy_hmi_commands_test { + +namespace commands = app_service_rpc_plugin::commands; + +using ::testing::_; +using ::testing::NotNull; +using ::testing::Types; +using application_manager::commands::MessageSharedPtr; +using ::test::components::event_engine_test::MockEventDispatcher; +using ::test::components::application_manager_test::MockApplicationManager; +using ::test::components::application_manager_test:: + MockApplicationManagerSettings; +using ::application_manager::ApplicationSharedPtr; +using ::test::components::application_manager_test::MockApplication; + +template <class Command> +class HMICommandsTest : public components::commands_test::CommandRequestTest< + CommandsTestMocks::kIsNice> { + public: + typedef Command CommandType; + + void InitCommand(const uint32_t& timeout) OVERRIDE { + stream_retry_.first = 0; + stream_retry_.second = 0; + EXPECT_CALL(app_mngr_settings_, default_timeout()) + .WillOnce(ReturnRef(timeout)); + ON_CALL(app_mngr_, event_dispatcher()) + .WillByDefault(ReturnRef(event_dispatcher_)); + ON_CALL(app_mngr_, get_settings()) + .WillByDefault(ReturnRef(app_mngr_settings_)); + ON_CALL(app_mngr_settings_, start_stream_retry_amount()) + .WillByDefault(ReturnRef(stream_retry_)); + } + + protected: + std::pair<uint32_t, int32_t> stream_retry_; +}; + +template <class Command> +class HMICommandsTestFirst : public HMICommandsTest<Command> { + public: + using typename HMICommandsTest<Command>::CommandType; +}; + +/* macro TYPED_TEST_CASE takes max 50 args. That is why there are few + * TYPED_TEST_CASE for HMI and mobile commands + */ + +typedef Types<commands::ASAppServiceActivationRequest, + commands::ASAppServiceActivationResponse, + commands::ASGetActiveServiceConsentRequest, + commands::ASGetActiveServiceConsentResponse, + commands::ASPerformAppServiceInteractionRequestFromHMI, + commands::ASGetAppServiceDataRequestToHMI, + commands::ASGetAppServiceDataResponseFromHMI, + commands::ASGetAppServiceDataResponseToHMI, + commands::ASGetAppServiceRecordsRequest, + commands::ASGetAppServiceRecordsResponse, + commands::ASPerformAppServiceInteractionRequestFromHMI, + commands::ASPerformAppServiceInteractionRequestToHMI, + commands::ASPerformAppServiceInteractionResponseFromHMI, + commands::ASPerformAppServiceInteractionResponseToHMI, + commands::ASPublishAppServiceRequest, + commands::ASPublishAppServiceResponse, + commands::OnASAppServiceDataNotification, + commands::OnASAppServiceDataNotificationFromHMI> + HMICommandsListFirst; + +TYPED_TEST_CASE(HMICommandsTestFirst, HMICommandsListFirst); + +TYPED_TEST(HMICommandsTestFirst, CtorAndDtorCall) { + std::shared_ptr<typename TestFixture::CommandType> command = + this->template CreateCommand<typename TestFixture::CommandType>(); + EXPECT_NE(command.use_count(), 0); +} + +} // namespace dummy_hmi_commands_test +} // namespace hmi_commands_test +} // namespace commands_test +} // namespace components +} // namespace test diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc new file mode 100644 index 0000000000..3c8a780128 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc @@ -0,0 +1,135 @@ +/* + * 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 "application_manager/commands/command_request_test.h" + +#include <stdint.h> +#include <string> +#include <vector> +#include "gtest/gtest.h" + +#include "mobile/get_app_service_data_request.h" +#include "mobile/get_app_service_data_request_to_mobile.h" +#include "mobile/get_app_service_data_response.h" +#include "mobile/get_app_service_data_response_from_mobile.h" +#include "mobile/on_app_service_data_notification.h" +#include "mobile/on_app_service_data_notification_from_mobile.h" +#include "mobile/perform_app_service_interaction_request.h" +#include "mobile/perform_app_service_interaction_request_to_mobile.h" +#include "mobile/perform_app_service_interaction_response.h" +#include "mobile/perform_app_service_interaction_response_from_mobile.h" +#include "mobile/publish_app_service_request.h" +#include "mobile/publish_app_service_response.h" + +#include "application_manager/mock_application.h" +#include "application_manager/mock_application_manager.h" +#include "test/application_manager/mock_application_manager_settings.h" +#include "application_manager/mock_event_dispatcher.h" + +namespace am = application_manager; + +namespace test { +namespace components { +namespace commands_test { +namespace mobile_commands_test { +namespace dummy_mobile_commands_test { + +namespace commands = app_service_rpc_plugin::commands; +using ::testing::_; +using ::testing::NotNull; +using ::testing::Types; +using am::commands::MessageSharedPtr; +using ::test::components::event_engine_test::MockEventDispatcher; +using ::test::components::application_manager_test::MockApplicationManager; +using ::test::components::application_manager_test:: + MockApplicationManagerSettings; +using ::application_manager::ApplicationSharedPtr; +using ::test::components::application_manager_test::MockApplication; + +namespace { +const std::string kEmptyString_ = ""; +} // namespace + +template <class Command> +class MobileCommandsTest : public components::commands_test::CommandRequestTest< + CommandsTestMocks::kIsNice> { + public: + typedef Command CommandType; + + void InitCommand(const uint32_t& timeout) OVERRIDE { + EXPECT_CALL(app_mngr_settings_, default_timeout()) + .WillOnce(ReturnRef(timeout)); + ON_CALL(app_mngr_, event_dispatcher()) + .WillByDefault(ReturnRef(event_dispatcher_)); + ON_CALL(app_mngr_, get_settings()) + .WillByDefault(ReturnRef(app_mngr_settings_)); + ON_CALL(app_mngr_settings_, app_icons_folder()) + .WillByDefault(ReturnRef(kEmptyString_)); + } +}; + +template <class Command> +class MobileCommandsTestFirst : public MobileCommandsTest<Command> { + public: + using typename MobileCommandsTest<Command>::CommandType; +}; + +/* macro TYPED_TEST_CASE takes max 50 args. That is why there are few + * TYPED_TEST_CASE for HMI and mobile commands + */ + +typedef Types<commands::GetAppServiceDataRequest, + commands::GetAppServiceDataRequestToMobile, + commands::GetAppServiceDataResponse, + commands::GetAppServiceDataResponseFromMobile, + commands::OnAppServiceDataNotification, + commands::OnAppServiceDataNotificationFromMobile, + commands::PerformAppServiceInteractionRequest, + commands::PerformAppServiceInteractionRequestToMobile, + commands::PerformAppServiceInteractionResponse, + commands::PerformAppServiceInteractionResponseFromMobile, + commands::PublishAppServiceRequest, + commands::PublishAppServiceResponse> MobileCommandsListFirst; + +TYPED_TEST_CASE(MobileCommandsTestFirst, MobileCommandsListFirst); + +TYPED_TEST(MobileCommandsTestFirst, CtorAndDtorCall) { + std::shared_ptr<typename TestFixture::CommandType> command = + this->template CreateCommand<typename TestFixture::CommandType>(); + EXPECT_NE(command.use_count(), 0); +} + +} // namespace dummy_mobile_commands_test +} // namespace mobile_commands_test +} // namespace commands_test +} // namespace components +} // namespace test diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/on_app_service_data_notification_test.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/on_app_service_data_notification_test.cc new file mode 100644 index 0000000000..47358ef631 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/on_app_service_data_notification_test.cc @@ -0,0 +1,217 @@ +/* + * 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 "application_manager/application.h" +#include "application_manager/mock_application.h" +#include "application_manager/mock_app_service_manager.h" +#include "application_manager/commands/commands_test.h" +#include "app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h" +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "app_service_rpc_plugin/app_service_app_extension.h" +#include "gtest/gtest.h" +#include "interfaces/MOBILE_API.h" +#include "application_manager/commands/command_impl.h" +#include "resumption/last_state_impl.h" + +namespace am = application_manager; +using ::testing::_; +using ::testing::Return; +using ::testing::ReturnRef; +using ::testing::ReturnNull; +using ::testing::NiceMock; +using ::testing::SaveArg; +using ::testing::Mock; +using am::ApplicationSet; +using am::commands::MessageSharedPtr; +using test::components::application_manager_test::MockApplication; +using test::components::application_manager_test::MockApplicationManager; +using test::components::application_manager_test::MockAppServiceManager; +using test::components::commands_test::CommandsTest; +using test::components::commands_test::CommandsTestMocks; +using app_service_rpc_plugin::commands::OnAppServiceDataNotification; + +namespace { +const uint32_t kAppId = 0u; +const uint32_t kConnectionKey = 1u; +const std::string kPolicyAppId = "Test"; +const int kModuleId = 153u; +} + +namespace app_service_plugin_test { +using namespace app_service_rpc_plugin; +using application_manager::ApplicationSet; + +class OnAppServiceDataNotificationTest + : public CommandsTest<CommandsTestMocks::kIsNice> { + public: + OnAppServiceDataNotificationTest() + : mock_app_(std::make_shared<NiceMock<MockApplication> >()) + , app_service_app_extension_( + std::make_shared<app_service_rpc_plugin::AppServiceAppExtension>( + app_service_plugin_, *mock_app_)) + , apps_lock_(std::make_shared<sync_primitives::Lock>()) + , apps_da_(apps_, apps_lock_) + , last_state_("app_storage_folder", "app_info_storage") + , app_service_manager_(app_mngr_, last_state_) { + ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId)); + ON_CALL(*mock_app_, is_remote_control_supported()) + .WillByDefault(Return(true)); + ON_CALL(*mock_app_, QueryInterface(_)) + .WillByDefault(Return(app_service_app_extension_)); + } + + MessageSharedPtr CreateBasicMessage() { + MessageSharedPtr message = CreateMessage(); + (*message)[application_manager::strings::params] + [application_manager::strings::function_id] = + mobile_apis::FunctionID::OnAppServiceDataID; + (*message)[application_manager::strings::params] + [application_manager::strings::connection_key] = kConnectionKey; + (*message)[application_manager::strings::params] + [application_manager::strings::app_id] = kAppId; + + return message; + } + + protected: + std::shared_ptr<MockApplication> mock_app_; + std::shared_ptr<AppServiceAppExtension> app_service_app_extension_; + app_service_rpc_plugin::AppServiceRpcPlugin app_service_plugin_; + application_manager::ApplicationSet apps_; + const std::shared_ptr<sync_primitives::Lock> apps_lock_; + DataAccessor<application_manager::ApplicationSet> apps_da_; + resumption::LastStateImpl last_state_; + MockAppServiceManager app_service_manager_; +}; + +TEST_F(OnAppServiceDataNotificationTest, Run_SendMessageToMobile_Notification) { + MessageSharedPtr mobile_message = CreateBasicMessage(); + + (*mobile_message)[am::strings::msg_params][am::strings::service_data] + [am::strings::service_type] = "MEDIA"; + (*mobile_message)[am::strings::msg_params][am::strings::service_data] + [am::strings::service_id] = "mediaid1234"; + (*mobile_message)[am::strings::msg_params][am::strings::service_data] + ["mediaServiceData"]["mediaTitle"] = "media title"; + + apps_.insert(mock_app_); + app_service_app_extension_->SubscribeToAppService("MEDIA"); + ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_da_)); + + am::AppService service; + service.connection_key = 1; + service.mobile_service = true; + service + .record[am::strings::service_manifest][am::strings::allow_app_consumers] = + true; + EXPECT_CALL(app_service_manager_, FindServiceByID(_)) + .WillOnce(Return(&service)); + + EXPECT_CALL(app_mngr_, GetAppServiceManager()) + .WillRepeatedly(ReturnRef(app_service_manager_)); + + std::shared_ptr<OnAppServiceDataNotification> command = + CreateCommand<OnAppServiceDataNotification>(mobile_message); + + EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, false)) + .WillOnce(SaveArg<0>(&mobile_message)); + // Act + command->Run(); + + // Assertions + ASSERT_TRUE(mobile_message.get()); + Mock::VerifyAndClearExpectations(&app_mngr_); +} + +TEST_F(OnAppServiceDataNotificationTest, Run_NoService) { + MessageSharedPtr mobile_message = CreateBasicMessage(); + + (*mobile_message)[am::strings::msg_params][am::strings::service_data] + [am::strings::service_type] = "MEDIA"; + (*mobile_message)[am::strings::msg_params][am::strings::service_data] + [am::strings::service_id] = "mediaid1234"; + (*mobile_message)[am::strings::msg_params][am::strings::service_data] + ["mediaServiceData"]["mediaTitle"] = "media title"; + + apps_.insert(mock_app_); + app_service_app_extension_->SubscribeToAppService("MEDIA"); + ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_da_)); + + EXPECT_CALL(app_service_manager_, FindServiceByID(_)).WillOnce(ReturnNull()); + + EXPECT_CALL(app_mngr_, GetAppServiceManager()) + .WillRepeatedly(ReturnRef(app_service_manager_)); + + std::shared_ptr<OnAppServiceDataNotification> command = + CreateCommand<OnAppServiceDataNotification>(mobile_message); + + EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, false)).Times(0); + command->Run(); + + Mock::VerifyAndClearExpectations(&app_mngr_); +} + +TEST_F(OnAppServiceDataNotificationTest, Run_NoSubscribedApps) { + MessageSharedPtr mobile_message = CreateBasicMessage(); + + (*mobile_message)[am::strings::msg_params][am::strings::service_data] + [am::strings::service_type] = "MEDIA"; + (*mobile_message)[am::strings::msg_params][am::strings::service_data] + [am::strings::service_id] = "mediaid1234"; + (*mobile_message)[am::strings::msg_params][am::strings::service_data] + ["mediaServiceData"]["mediaTitle"] = "media title"; + + apps_.insert(mock_app_); + ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_da_)); + + am::AppService service; + service.connection_key = 1; + service.mobile_service = true; + service + .record[am::strings::service_manifest][am::strings::allow_app_consumers] = + true; + EXPECT_CALL(app_service_manager_, FindServiceByID(_)) + .WillOnce(Return(&service)); + + EXPECT_CALL(app_mngr_, GetAppServiceManager()) + .WillRepeatedly(ReturnRef(app_service_manager_)); + + std::shared_ptr<OnAppServiceDataNotification> command = + CreateCommand<OnAppServiceDataNotification>(mobile_message); + + EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, false)).Times(0); + command->Run(); + + Mock::VerifyAndClearExpectations(&app_mngr_); +} + +} // namespace rc_rpc_plugin_test diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc index ecfc1dcda4..d49f3e9e36 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc @@ -124,7 +124,8 @@ RCCommandFactory::RCCommandFactory(const RCCommandParams& params) CommandSharedPtr RCCommandFactory::CreateCommand( const app_mngr::commands::MessageSharedPtr& message, app_mngr::commands::Command::CommandSource source) { - if (app_mngr::commands::Command::SOURCE_HMI == source) { + if (app_mngr::commands::Command::SOURCE_HMI == source || + app_mngr::commands::Command::SOURCE_SDL_TO_HMI == source) { hmi_apis::messageType::eType message_type = static_cast<hmi_apis::messageType::eType>( (*message)[strings::params][strings::message_type].asInt()); @@ -153,7 +154,8 @@ bool RCCommandFactory::IsAbleToProcess( const application_manager::commands::Command::CommandSource message_source) const { using app_mngr::commands::Command; - if (Command::SOURCE_HMI == message_source) { + if (Command::SOURCE_HMI == message_source || + Command::SOURCE_SDL_TO_HMI == message_source) { return get_hmi_creator_factory( static_cast<hmi_apis::FunctionID::eType>(function_id), hmi_apis::messageType::INVALID_ENUM).CanBeCreated(); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc index fd6b4e86ac..3bc1106573 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc @@ -29,7 +29,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - +#include "application_manager/plugin_manager/plugin_keys.h" #include "rc_rpc_plugin/rc_rpc_plugin.h" #include "rc_rpc_plugin/rc_command_factory.h" #include "rc_rpc_plugin/rc_app_extension.h" @@ -77,7 +77,7 @@ bool RCRPCPlugin::IsAbleToProcess( } std::string RCRPCPlugin::PluginName() { - return "RC RPC Plugin"; + return plugins::plugin_names::rc_rpc_plugin; } application_manager::CommandFactory& RCRPCPlugin::GetCommandFactory() { diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc index 59d038a790..e9d1063648 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc @@ -196,8 +196,8 @@ TEST_F(ButtonPressRequestTest, SetResourceState(resource, kAppId, rc_rpc_plugin::ResourceState::BUSY)); EXPECT_CALL(mock_rpc_service_, ManageHMICommand( - HMIResultCodeIs(hmi_apis::FunctionID::Buttons_ButtonPress))) - .WillOnce(Return(true)); + HMIResultCodeIs(hmi_apis::FunctionID::Buttons_ButtonPress), + _)).WillOnce(Return(true)); // Act std::shared_ptr<rc_rpc_plugin::commands::ButtonPressRequest> command = @@ -230,8 +230,9 @@ TEST_F( .Times(2); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::Buttons_ButtonPress))).Times(0); + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::Buttons_ButtonPress), + _)).Times(0); MessageSharedPtr command_result; EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc index 25dad2dc04..4e74e74ef8 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc @@ -199,9 +199,10 @@ TEST_F(GetInteriorVehicleDataRequestTest, mobile_message); // Expectations - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::RC_GetInteriorVehicleData))) + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData), _)) .WillOnce(Return(true)); // Act command->Run(); @@ -225,9 +226,10 @@ TEST_F(GetInteriorVehicleDataRequestTest, mobile_message); // Expectations - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::RC_GetInteriorVehicleData))) + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData), _)) .WillOnce(Return(true)); // Act command->Run(); @@ -253,7 +255,7 @@ TEST_F( .WillOnce(Return(true)); EXPECT_CALL(mock_interior_data_cache_, Retrieve(enums_value::kRadio)) .WillOnce(Return(radio_data)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); MessageSharedPtr command_result; EXPECT_CALL( mock_rpc_service_, @@ -295,9 +297,10 @@ TEST_F( .WillByDefault(Return(true)); // Expectations - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::RC_GetInteriorVehicleData))) + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData), _)) .WillOnce(Return(true)); EXPECT_CALL( mock_rpc_service_, @@ -347,7 +350,7 @@ TEST_F(GetInteriorVehicleDataRequestTest, EXPECT_CALL(mock_interior_data_cache_, Retrieve(enums_value::kRadio)) .WillOnce(Return(radio_data)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); MessageSharedPtr command_result; EXPECT_CALL( mock_rpc_service_, @@ -383,7 +386,7 @@ TEST_F( .WillByDefault(Return(&rc_capabilities)); // Expectations - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( MobileResultCodeIs(mobile_apis::Result::UNSUPPORTED_RESOURCE), @@ -407,7 +410,7 @@ TEST_F( ON_CALL(mock_policy_handler_, CheckModule(_, _)).WillByDefault(Return(false)); // Expectations - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( MobileResultCodeIs(mobile_apis::Result::DISALLOWED), _)) @@ -443,9 +446,10 @@ TEST_F(GetInteriorVehicleDataRequestTest, ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), _)) .WillOnce(Return(true)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::RC_GetInteriorVehicleData))) + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData), _)) .WillOnce(Return(true)); // Act @@ -478,9 +482,10 @@ TEST_F(GetInteriorVehicleDataRequestTest, .WillByDefault(Return(true)); // Expectations - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::RC_GetInteriorVehicleData))) + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData), _)) .WillOnce(Return(true)); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( @@ -519,9 +524,10 @@ TEST_F(GetInteriorVehicleDataRequestTest, .WillByDefault(Return(true)); // Expectations - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::RC_GetInteriorVehicleData))) + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData), _)) .WillOnce(Return(true)); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( @@ -569,10 +575,11 @@ TEST_F(GetInteriorVehicleDataRequestTest, StoreRequestToHMITime(enums_value::kRadio)); EXPECT_CALL(mock_interior_data_cache_, Contains(enums_value::kRadio)) .WillRepeatedly(Return(false)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::RC_GetInteriorVehicleData))) - .WillRepeatedly(Return(true)); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData), + _)).WillRepeatedly(Return(true)); // Act command->Run(); } @@ -585,7 +592,7 @@ TEST_F(GetInteriorVehicleDataRequestTest, mock_rpc_service_, ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::REJECTED), _)) .WillOnce(Return(false)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); // Act command->Run(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt index 11dd35d061..fdf02b57cb 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt @@ -42,8 +42,12 @@ set (HMI_COMMANDS_SOURCE_DIR ${COMMANDS_SOURCE_DIR}/hmi ) +set (EXTENSIONS_SOURCE_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/src/extensions +) collect_sources(MOBILE_COMMANDS "${MOBILE_COMMANDS_SOURCE_DIR}") collect_sources(HMI_COMMANDS "${HMI_COMMANDS_SOURCE_DIR}") +collect_sources(APP_EXTENSIONS "${EXTENSIONS_SOURCE_DIR}") collect_sources(RPC_PLUGIN_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src") set(LIBRARIES @@ -60,7 +64,7 @@ if(ENABLE_LOG) list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) endif() -add_library("sdl_rpc_plugin" SHARED ${MOBILE_COMMANDS} ${HMI_COMMANDS} ${RPC_PLUGIN_SOURCES}) +add_library("sdl_rpc_plugin" SHARED ${MOBILE_COMMANDS} ${HMI_COMMANDS} ${RPC_PLUGIN_SOURCES} ${APP_EXTENSIONS}) target_link_libraries("sdl_rpc_plugin" ${LIBRARIES}) set(INSTALL_DESTINATION bin) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_response.h index 90160d9953..3a97ebdfb5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_response.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_response.h @@ -36,7 +36,7 @@ #include "application_manager/commands/response_from_hmi.h" #include "utils/macro.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace sdl_rpc_plugin { namespace app_mngr = application_manager; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_request.h new file mode 100644 index 0000000000..fd241da3c4 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_request.h @@ -0,0 +1,77 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_GET_FILE_PATH_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_GET_FILE_PATH_REQUEST_H_ + +#include "application_manager/commands/request_to_hmi.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief BCGetFilePathRequest command class + **/ +class BCGetFilePathRequest : public app_mngr::commands::RequestToHMI { + public: + /** + * @brief BCGetFilePathRequest class constructor + * + * @param message Incoming SmartObject message + **/ + BCGetFilePathRequest(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 BCGetFilePathRequest class destructor + **/ + virtual ~BCGetFilePathRequest(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(BCGetFilePathRequest); +}; + +} // namespace commands + +} // namespace sdl_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_sdl_RPC_PLUGIN_INCLUDE_sdl_RPC_PLUGIN_COMMANDS_HMI_BC_GET_FILE_PATH_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_response.h new file mode 100644 index 0000000000..2a6025cbdf --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_response.h @@ -0,0 +1,77 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_GET_FILE_PATH_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_GET_FILE_PATH_RESPONSE_H_ + +#include "application_manager/commands/response_from_hmi.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief BCGetFilePathResponse command class + **/ +class BCGetFilePathResponse : public app_mngr::commands::ResponseFromHMI { + public: + /** + * @brief BCGetFilePathResponse class constructor + * + * @param message Incoming SmartObject message + **/ + BCGetFilePathResponse(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 BCGetFilePathResponse class destructor + **/ + virtual ~BCGetFilePathResponse(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(BCGetFilePathResponse); +}; + +} // namespace commands + +} // namespace sdl_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_GET_FILE_PATH_RESPONSE_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification.h new file mode 100644 index 0000000000..17f8a5b3c8 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification.h @@ -0,0 +1,79 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_BC_SYSTEM_CAPABILITY_UPDATED_NOTIFICATION_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_BC_SYSTEM_CAPABILITY_UPDATED_NOTIFICATION_H_ + +#include "application_manager/commands/notification_to_hmi.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief OnASSystemCapabilityUpdatedNotification command class + **/ +class OnBCSystemCapabilityUpdatedNotification + : public app_mngr::commands::NotificationToHMI { + public: + /** + * @brief OnASSystemCapabilityUpdatedNotification class constructor + * + * @param message Incoming SmartObject message + **/ + OnBCSystemCapabilityUpdatedNotification( + 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 OnASSystemCapabilityUpdatedNotification class destructor + **/ + virtual ~OnBCSystemCapabilityUpdatedNotification(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(OnBCSystemCapabilityUpdatedNotification); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_BC_SYSTEM_CAPABILITY_UPDATED_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_time_ready_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_time_ready_notification.h index 0beba8dc6b..7cd8410d8e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_time_ready_notification.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_time_ready_notification.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_SYSTEM_TIME_READY_NOTIFICATION_H_ #include "application_manager/commands/notification_from_hmi.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace sdl_rpc_plugin { namespace app_mngr = application_manager; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h new file mode 100644 index 0000000000..3d74a80dc2 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h @@ -0,0 +1,31 @@ +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_CLOUD_APP_PROPERTIES_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_CLOUD_APP_PROPERTIES_REQUEST_H_ + +#include "application_manager/commands/command_request_impl.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +class GetCloudAppPropertiesRequest + : public app_mngr::commands::CommandRequestImpl { + public: + GetCloudAppPropertiesRequest( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler); + virtual ~GetCloudAppPropertiesRequest(); + virtual void Run(); + virtual void on_event(const app_mngr::event_engine::Event& event); + + private: + DISALLOW_COPY_AND_ASSIGN(GetCloudAppPropertiesRequest); +}; // GetCloudAppPropertiesRequest + +} // namespace commands +} // namespace sdl_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_CLOUD_APP_PROPERTIES_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_response.h new file mode 100644 index 0000000000..f716c7dcb5 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_response.h @@ -0,0 +1,31 @@ +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_CLOUD_APP_PROPERTIES_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_CLOUD_APP_PROPERTIES_RESPONSE_H_ + +#include "application_manager/commands/command_response_impl.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +class GetCloudAppPropertiesResponse + : public app_mngr::commands::CommandResponseImpl { + public: + GetCloudAppPropertiesResponse( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler); + virtual ~GetCloudAppPropertiesResponse(); + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(GetCloudAppPropertiesResponse); + +}; // GetCloudAppPropertiesResponse + +} // namespace commands +} // namespace sdl_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_CLOUD_APP_PROPERTIES_RESPONSE_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_request.h new file mode 100644 index 0000000000..d4182ea004 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_request.h @@ -0,0 +1,87 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_REQUEST_H_ + +#include "application_manager/commands/command_request_impl.h" +#include "application_manager/event_engine/event.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief GetFileRequest command class + **/ +class GetFileRequest : public app_mngr::commands::CommandRequestImpl { + public: + /** + * @brief GetFileRequest class constructor + * + * @param message Incoming SmartObject message + **/ + GetFileRequest(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 GetFileRequest class destructor + **/ + virtual ~GetFileRequest(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + bool GetFilePath(std::string& file_path, bool& forward_to_hmi); + + void on_event(const app_mngr::event_engine::Event& event) FINAL; + + private: + std::string file_name_; + mobile_apis::FileType::eType file_type_; + uint32_t length_; + uint32_t offset_; + + DISALLOW_COPY_AND_ASSIGN(GetFileRequest); +}; + +} // namespace commands + +} // namespace sdl_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_response.h new file mode 100644 index 0000000000..bc191d224c --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_response.h @@ -0,0 +1,77 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_RESPONSE_H_ + +#include "application_manager/commands/command_response_impl.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief GetFileResponse command class + **/ +class GetFileResponse : public app_mngr::commands::CommandResponseImpl { + public: + /** + * @brief GetFileResponse class constructor + * + * @param message Incoming SmartObject message + **/ + GetFileResponse(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 GetFileResponse class destructor + **/ + virtual ~GetFileResponse(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(GetFileResponse); +}; + +} // namespace commands + +} // namespace sdl_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_RESPONSE_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_system_capability_updated_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_system_capability_updated_notification.h new file mode 100644 index 0000000000..1f7e8468db --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_system_capability_updated_notification.h @@ -0,0 +1,84 @@ +/* + 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_ON_SYSTEM_CAPABILITY_UPDATED_NOTIFICATION_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_SYSTEM_CAPABILITY_UPDATED_NOTIFICATION_H_ + +#include "application_manager/commands/command_notification_impl.h" +#include "policy/policy_table/enums.h" +#include <vector> + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +namespace mobile { + +/** + * @brief OnSystemCapabilityUpdatedNotification class + **/ +class OnSystemCapabilityUpdatedNotification + : public app_mngr::commands::CommandNotificationImpl { + public: + typedef std::vector<uint8_t> BinaryMessage; + /** + * @brief OnSystemCapabilityUpdatedNotification class constructor + * + * @param message Incoming SmartObject message + **/ + OnSystemCapabilityUpdatedNotification( + 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 OnSystemCapabilityUpdatedNotification class destructor + **/ + ~OnSystemCapabilityUpdatedNotification() OVERRIDE; + + /** + * @brief Execute command + **/ + void Run() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(OnSystemCapabilityUpdatedNotification); +}; + +} // namespace mobile +} // namespace commands +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_SYSTEM_CAPABILITY_UPDATED_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h index 542fdac5f8..91ee8ea813 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h @@ -124,11 +124,14 @@ class RegisterAppInterfaceRequest /** * @brief Sends OnAppRegistered notification to HMI * - *@param application_impl application with changed HMI status - * + * @param app application with changed HMI status + * @param resumption If true, resumption-related parameters will be sent to + *the HMI + * @param need_restore_vr If resumption is true, whether or not VR commands + *should be resumed **/ void SendOnAppRegisteredNotificationToHMI( - const app_mngr::Application& application_impl, + app_mngr::ApplicationConstSharedPtr app, bool resumption = false, bool need_restore_vr = false); /* @@ -141,11 +144,14 @@ class RegisterAppInterfaceRequest /* * @brief Check new application parameters (name, tts, vr) for * coincidence with already known parameters of registered applications + * @param out_duplicate_apps In the case other apps was found with duplicate + * names, this field will be filled with a list of said apps * * return SUCCESS if there is no coincidence of app.name/TTS/VR synonyms, * otherwise appropriate error code returns - */ - mobile_apis::Result::eType CheckCoincidence(); + */ + mobile_apis::Result::eType CheckCoincidence( + std::vector<app_mngr::ApplicationSharedPtr>& out_duplicate_apps); /* * @brief Predicate for using with CheckCoincidence method to compare with VR diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h new file mode 100644 index 0000000000..a3a3ea12f9 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h @@ -0,0 +1,31 @@ +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_REQUEST_H_ + +#include "application_manager/commands/command_request_impl.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +class SetCloudAppPropertiesRequest + : public app_mngr::commands::CommandRequestImpl { + public: + SetCloudAppPropertiesRequest( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler); + virtual ~SetCloudAppPropertiesRequest(); + virtual void Run(); + virtual void on_event(const app_mngr::event_engine::Event& event); + + private: + DISALLOW_COPY_AND_ASSIGN(SetCloudAppPropertiesRequest); +}; // SetCloudAppPropertiesRequest + +} // namespace commands +} // namespace sdl_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_REQUEST_H_
\ No newline at end of file diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_response.h new file mode 100644 index 0000000000..df71a2aaf5 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_response.h @@ -0,0 +1,31 @@ +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_RESPONSE_H_ + +#include "application_manager/commands/command_response_impl.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +class SetCloudAppPropertiesResponse + : public app_mngr::commands::CommandResponseImpl { + public: + SetCloudAppPropertiesResponse( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler); + virtual ~SetCloudAppPropertiesResponse(); + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(SetCloudAppPropertiesResponse); + +}; // SetCloudAppPropertiesResponse + +} // namespace commands +} // namespace sdl_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_RESPONSE_H_
\ No newline at end of file diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/extensions/system_capability_app_extension.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/extensions/system_capability_app_extension.h new file mode 100644 index 0000000000..fb82cf37c2 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/extensions/system_capability_app_extension.h @@ -0,0 +1,83 @@ +/* + 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_EXTENSIONS_SYSTEM_CAPABILITY_APP_EXTENSION_H +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_EXTENSIONS_SYSTEM_CAPABILITY_APP_EXTENSION_H +#include <application_manager/application_manager.h> +#include <set> +#include <string> +#include "sdl_rpc_plugin/sdl_rpc_plugin.h" + +namespace sdl_rpc_plugin { +class SDLRPCPlugin; + +namespace app_mngr_ = application_manager; + +typedef mobile_apis::SystemCapabilityType::eType SystemCapabilityType; +typedef std::set<mobile_apis::SystemCapabilityType::eType> + SystemCapabilitySubscriptions; + +class SystemCapabilityAppExtension : public app_mngr_::AppExtension { + public: + SystemCapabilityAppExtension(SDLRPCPlugin& plugin, + app_mngr_::Application& app); + virtual ~SystemCapabilityAppExtension(); + + bool SubscribeTo(const SystemCapabilityType system_capability_type); + + bool UnsubscribeFrom(const SystemCapabilityType system_capability_type); + + void UnsubscribeFromAll(); + + bool IsSubscribedTo(const SystemCapabilityType system_capability_type) const; + + SystemCapabilitySubscriptions Subscriptions(); + + void SaveResumptionData(ns_smart_device_link::ns_smart_objects::SmartObject& + resumption_data) OVERRIDE; + + void ProcessResumption( + const smart_objects::SmartObject& resumption_data) OVERRIDE; + + static const app_mngr_::AppExtensionUID SystemCapabilityAppExtensionUID; + + static SystemCapabilityAppExtension& ExtractExtension( + app_mngr_::Application& app); + + private: + SystemCapabilitySubscriptions subscribed_data_; + SDLRPCPlugin& plugin_; + app_mngr_::Application& app_; +}; +} + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_EXTENSIONS_SYSTEM_CAPABILITY_APP_EXTENSION_H diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h index 6ae3a0b6bc..b57fcbec12 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h @@ -36,29 +36,32 @@ #include "application_manager/command_factory.h" namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; namespace plugins = application_manager::plugin_manager; + +class SystemCapabilityAppExtension; + class SDLRPCPlugin : public plugins::RPCPlugin { // RPCPlugin interface public: - bool Init(application_manager::ApplicationManager& app_manager, - application_manager::rpc_service::RPCService& rpc_service, - application_manager::HMICapabilities& hmi_capabilities, + bool Init(app_mngr::ApplicationManager& app_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) OVERRIDE; bool IsAbleToProcess( const int32_t function_id, - const application_manager::commands::Command::CommandSource - message_source) OVERRIDE; + const app_mngr::commands::Command::CommandSource message_source) OVERRIDE; std::string PluginName() OVERRIDE; - application_manager::CommandFactory& GetCommandFactory() OVERRIDE; - void OnPolicyEvent( - application_manager::plugin_manager::PolicyEvent event) OVERRIDE; - void OnApplicationEvent( - application_manager::plugin_manager::ApplicationEvent event, - application_manager::ApplicationSharedPtr application) OVERRIDE; + app_mngr::CommandFactory& GetCommandFactory() OVERRIDE; + void OnPolicyEvent(plugins::PolicyEvent event) OVERRIDE; + void OnApplicationEvent(plugins::ApplicationEvent event, + app_mngr::ApplicationSharedPtr application) OVERRIDE; private: + void ClearSubscriptions(app_mngr::ApplicationSharedPtr app); + std::unique_ptr<application_manager::CommandFactory> command_factory_; }; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_request.cc new file mode 100644 index 0000000000..b735cd9bdf --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_request.cc @@ -0,0 +1,62 @@ +/* + 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/bc_get_file_path_request.h" +#include "application_manager/application_impl.h" +#include "application_manager/rpc_service.h" +#include "interfaces/MOBILE_API.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; +namespace commands { + +BCGetFilePathRequest::BCGetFilePathRequest( + 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) {} + +BCGetFilePathRequest::~BCGetFilePathRequest() {} + +void BCGetFilePathRequest::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/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 new file mode 100644 index 0000000000..b86ab6a2b8 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_response.cc @@ -0,0 +1,66 @@ +/* + 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/bc_get_file_path_response.h" +#include "application_manager/application_impl.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; +namespace commands { + +BCGetFilePathResponse::BCGetFilePathResponse( + 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) {} + +BCGetFilePathResponse::~BCGetFilePathResponse() {} + +void BCGetFilePathResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + application_manager::event_engine::Event event( + hmi_apis::FunctionID::BasicCommunication_GetFilePath); + 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/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 new file mode 100644 index 0000000000..0677c97db8 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc @@ -0,0 +1,167 @@ +/* + 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/on_bc_system_capability_updated_notification.h" + +#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/HMI_API.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; +namespace commands { + +OnBCSystemCapabilityUpdatedNotification:: + OnBCSystemCapabilityUpdatedNotification( + 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) + : NotificationToHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +OnBCSystemCapabilityUpdatedNotification:: + ~OnBCSystemCapabilityUpdatedNotification() {} + +void OnBCSystemCapabilityUpdatedNotification::Run() { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_DEBUG(logger_, + "Sending BasicCommunication.OnSystemCapabilityUpdated " + "Notification to HMI"); + + smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; + + 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()); + switch (system_capability_type) { + case hmi_apis::Common_SystemCapabilityType::NAVIGATION: { + smart_objects::SmartObject nav_capability(smart_objects::SmartType_Map); + bool has_nav_capability = false; + if (hmi_capabilities_.navigation_capability()) { + has_nav_capability = true; + nav_capability = *hmi_capabilities_.navigation_capability(); + } + has_nav_capability = application_manager_.GetAppServiceManager() + .UpdateNavigationCapabilities(nav_capability) || + has_nav_capability; + + if (has_nav_capability) { + msg_params[strings::system_capability][strings::navigation_capability] = + nav_capability; + } else { + return; + } + break; + } + case hmi_apis::Common_SystemCapabilityType::PHONE_CALL: { + if (hmi_capabilities_.phone_capability()) { + msg_params[strings::system_capability][strings::phone_capability] = + *hmi_capabilities_.phone_capability(); + } else { + return; + } + break; + } + case hmi_apis::Common_SystemCapabilityType::REMOTE_CONTROL: { + if (!hmi_capabilities_.is_rc_cooperating()) { + return; + } + if (hmi_capabilities_.rc_capability()) { + msg_params[strings::system_capability][strings::rc_capability] = + *hmi_capabilities_.rc_capability(); + } else { + return; + } + break; + } + case hmi_apis::Common_SystemCapabilityType::VIDEO_STREAMING: + if (hmi_capabilities_.video_streaming_capability()) { + msg_params[strings::system_capability] + [strings::video_streaming_capability] = + *hmi_capabilities_.video_streaming_capability(); + } else { + return; + } + break; + case hmi_apis::Common_SystemCapabilityType::APP_SERVICES: { + auto all_services = + application_manager_.GetAppServiceManager().GetAllServiceRecords(); + auto app_service_caps = + MessageHelper::CreateAppServiceCapabilities(all_services); + + smart_objects::SmartArray* app_services = + app_service_caps[strings::app_services].asArray(); + smart_objects::SmartObject& updated_capabilities = + msg_params[strings::system_capability] + [strings::app_services_capabilities][strings::app_services]; + 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(); + }; + + 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); + app_services->erase(it); + } + app_services->push_back(updated_capabilities[i]); + } + msg_params[strings::system_capability] + [strings::app_services_capabilities] = app_service_caps; + break; + } + default: + return; + } + SendNotification(); +} + +} // namespace commands +} // namespace app_service_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 681390fbf4..b6d44a4511 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 @@ -106,6 +106,10 @@ void OnExitApplicationNotification::Run() { application_manager_.UnregisterApplication(app_id, Result::SUCCESS); return; } + case Common_ApplicationExitReason::CLOSE_CLOUD_CONNECTION: { + application_manager_.DisconnectCloudApp(app_impl); + break; + } default: { LOG4CXX_WARN(logger_, "Unhandled reason"); return; 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 f89ae1f697..92a7020208 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 @@ -115,6 +115,8 @@ void SDLActivateAppRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); using namespace hmi_apis::FunctionID; + ApplicationConstSharedPtr app = + application_manager_.WaitingApplicationByID(app_id()); if (application_manager_.state_controller().IsStateActive( HmiState::STATE_ID_DEACTIVATE_HMI)) { LOG4CXX_DEBUG(logger_, @@ -124,6 +126,16 @@ void SDLActivateAppRequest::Run() { static_cast<eType>(function_id()), hmi_apis::Common_Result::REJECTED, "HMIDeactivate is active"); + } else if (app && !app->IsRegistered() && app->is_cloud_app()) { + LOG4CXX_DEBUG(logger_, "Starting cloud application."); + const ApplicationManagerSettings& settings = + application_manager_.get_settings(); + uint32_t total_retry_timeout = (settings.cloud_app_retry_timeout() * + settings.cloud_app_max_retry_attempts()); + application_manager_.updateRequestTimeout( + 0, correlation_id(), default_timeout_ + total_retry_timeout); + subscribe_on_event(BasicCommunication_OnAppRegistered); + application_manager_.connection_handler().ConnectToDevice(app->device()); } else { const uint32_t application_id = app_id(); policy_handler_.OnActivateApp(application_id, correlation_id()); @@ -181,6 +193,18 @@ void SDLActivateAppRequest::Run() { LOG4CXX_DEBUG(logger_, "Application is registered. Activating."); policy_handler_.OnActivateApp(application_id, correlation_id()); return; + } else if (app_to_activate->is_cloud_app()) { + LOG4CXX_DEBUG(logger_, "Starting cloud application."); + const ApplicationManagerSettings& settings = + application_manager_.get_settings(); + uint32_t total_retry_timeout = (settings.cloud_app_retry_timeout() * + settings.cloud_app_max_retry_attempts()); + application_manager_.updateRequestTimeout( + 0, correlation_id(), default_timeout_ + total_retry_timeout); + subscribe_on_event(BasicCommunication_OnAppRegistered); + application_manager_.connection_handler().ConnectToDevice( + app_to_activate->device()); + return; } connection_handler::DeviceHandle device_handle = app_to_activate->device(); @@ -225,8 +249,10 @@ void SDLActivateAppRequest::onTimeOut() { using namespace hmi_apis::Common_Result; using namespace application_manager; unsubscribe_from_event(BasicCommunication_OnAppRegistered); - SendErrorResponse( - correlation_id(), SDL_ActivateApp, APPLICATION_NOT_REGISTERED, ""); + SendErrorResponse(correlation_id(), + SDL_ActivateApp, + APPLICATION_NOT_REGISTERED, + "App registration timed out"); } void SDLActivateAppRequest::on_event(const event_engine::Event& event) { @@ -262,7 +288,7 @@ uint32_t SDLActivateAppRequest::hmi_app_id( LOG4CXX_DEBUG(logger_, application << " section is absent in the message."); return 0; } - if (so[msg_params][application].keyExists(strings::app_id)) { + if (!so[msg_params][application].keyExists(strings::app_id)) { LOG4CXX_DEBUG(logger_, strings::app_id << " section is absent in the message."); return 0; 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 new file mode 100644 index 0000000000..34ed30c243 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc @@ -0,0 +1,98 @@ +#include "sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; + +namespace commands { + +GetCloudAppPropertiesRequest::GetCloudAppPropertiesRequest( + 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) {} + +GetCloudAppPropertiesRequest::~GetCloudAppPropertiesRequest() {} + +void GetCloudAppPropertiesRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + ApplicationSharedPtr app = application_manager_.application(connection_key()); + + if (!app) { + LOG4CXX_ERROR(logger_, "Application is not registered"); + SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); + return; + } + + std::string policy_app_id = + (*message_)[strings::msg_params][strings::app_id].asString(); + + bool enabled = true; + std::string endpoint; + std::string auth_token; + std::string certificate; + std::string cloud_transport_type; + std::string hybrid_app_preference; + + bool result = policy_handler_.GetCloudAppParameters(policy_app_id, + enabled, + endpoint, + certificate, + auth_token, + cloud_transport_type, + hybrid_app_preference); + + if (!result) { + SendResponse(false, + mobile_apis::Result::DATA_NOT_AVAILABLE, + "Cloud app does not exist on module"); + return; + } + + policy::StringArray nicknames; + policy::StringArray app_hmi_types; + + policy_handler_.GetInitialAppData(policy_app_id, &nicknames, &app_hmi_types); + + smart_objects::SmartObject response_params(smart_objects::SmartType_Map); + smart_objects::SmartObject properties(smart_objects::SmartType_Map); + smart_objects::SmartObject nicknames_array(smart_objects::SmartType_Array); + size_t i = 0; + for (std::string nickname : nicknames) { + nicknames_array[i] = nickname; + ++i; + } + properties[strings::nicknames] = nicknames_array; + properties[strings::app_id] = policy_app_id; + properties[strings::enabled] = enabled; + + if (!auth_token.empty()) { + properties[strings::auth_token] = auth_token; + } + if (!cloud_transport_type.empty()) { + properties[strings::cloud_transport_type] = cloud_transport_type; + } + if (!hybrid_app_preference.empty()) { + properties[strings::hybrid_app_preference] = hybrid_app_preference; + } + if (!endpoint.empty()) { + properties[strings::endpoint] = endpoint; + } + + response_params[strings::properties] = properties; + + SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &response_params); +} + +void GetCloudAppPropertiesRequest::on_event( + const app_mngr::event_engine::Event& event) { + LOG4CXX_INFO(logger_, "GetCloudAppPropertiesRequest on_event"); +} + +} // namespace commands +} // namespace sdl_rpc_plugin 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 new file mode 100644 index 0000000000..813a9e7006 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_response.cc @@ -0,0 +1,31 @@ +#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; + +namespace commands { + +GetCloudAppPropertiesResponse::GetCloudAppPropertiesResponse( + 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) {} + +GetCloudAppPropertiesResponse::~GetCloudAppPropertiesResponse() {} + +void GetCloudAppPropertiesResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + rpc_service_.SendMessageToMobile(message_); +} + +} // namespace commands +} // namespace sdl_rpc_plugins 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 new file mode 100644 index 0000000000..a582670426 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc @@ -0,0 +1,356 @@ +/* + 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/get_file_request.h" + +#include "application_manager/app_service_manager.h" +#include "application_manager/application_impl.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 +*/ +uint32_t GetCrc32CheckSum(const std::vector<uint8_t>& binary_data) { + const std::size_t file_size = binary_data.size(); + boost::crc_32_type result; + result.process_bytes(&binary_data[0], file_size); + return result.checksum(); +} + +} // namespace + +namespace sdl_rpc_plugin { +using namespace application_manager; +namespace commands { + +GetFileRequest::GetFileRequest( + 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) + , file_name_("") + , file_type_(mobile_apis::FileType::INVALID_ENUM) + , length_(0) + , offset_(0) {} + +GetFileRequest::~GetFileRequest() {} + +bool GetFileRequest::GetFilePath(std::string& file_path, bool& forward_to_hmi) { + std::string path = application_manager_.get_settings().app_storage_folder(); + auto connect_key = connection_key(); + forward_to_hmi = false; + + if ((*message_)[strings::msg_params].keyExists(strings::app_service_id)) { + std::string service_id = + (*message_)[strings::msg_params][strings::app_service_id].asString(); + LOG4CXX_DEBUG(logger_, + "Finding storage directory for service id: " << service_id); + + AppService* app_service_info = + application_manager_.GetAppServiceManager().FindServiceByID(service_id); + if (app_service_info) { + if (app_service_info->mobile_service) { + connect_key = app_service_info->connection_key; + } else { + forward_to_hmi = true; + return true; + } + } else { + return false; + } + } else { + LOG4CXX_DEBUG(logger_, "Using current storage directory"); + } + + ApplicationSharedPtr app = application_manager_.application(connect_key); + file_path = path + "/" + app->folder_name(); + return true; +} + +void GetFileRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_INFO(logger_, "Received GetFile request"); + + ApplicationSharedPtr app = application_manager_.application(connection_key()); + smart_objects::SmartObject response_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); + + if (!app) { + LOG4CXX_ERROR(logger_, "Application is not registered"); + SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); + return; + } + + file_name_ = (*message_)[strings::msg_params][strings::file_name].asString(); + + if (!file_system::IsFileNameValid(file_name_)) { + LOG4CXX_ERROR(logger_, + "File name " << file_name_ << " contains forbidden symbols."); + SendResponse(false, + mobile_apis::Result::INVALID_DATA, + "File name contains forbidden symbols", + &response_params); + return; + } + + // Initialize other params with default values. If exists overwrite the values + LOG4CXX_DEBUG(logger_, "Intialize non manadatory params with default values"); + + if ((*message_)[strings::msg_params].keyExists(strings::file_type)) { + file_type_ = static_cast<mobile_apis::FileType::eType>( + (*message_)[strings::msg_params][strings::file_type].asInt()); + } + + // Check if file exists on system (may have to use app service id to get the + // correct app folder) + LOG4CXX_DEBUG(logger_, "Check if file exists on system"); + std::string file_path; + bool forward_to_hmi; + + if (GetFilePath(file_path, forward_to_hmi)) { + if (forward_to_hmi) { + LOG4CXX_DEBUG(logger_, "Forwarding GetFile request to HMI"); + application_manager_.IncreaseForwardedRequestTimeout(connection_key(), + correlation_id()); + SendHMIRequest(hmi_apis::FunctionID::BasicCommunication_GetFilePath, + &(*message_)[strings::msg_params], + true); + return; + } + } else { + LOG4CXX_ERROR(logger_, "Could not get file path"); + SendResponse(false, + mobile_apis::Result::INVALID_DATA, + "Could not get file path", + &response_params); + return; + } + + const std::string full_path = file_path + "/" + file_name_; + if (!file_system::FileExists(full_path)) { + LOG4CXX_ERROR(logger_, "File " << full_path << " does not exist"); + SendResponse(false, + mobile_apis::Result::FILE_NOT_FOUND, + "File does not exist", + &response_params); + return; + } + + // Handle offset + LOG4CXX_DEBUG(logger_, "Handle offset and length parameters"); + const uint64_t file_size = file_system::FileSize(full_path); + + if ((*message_)[strings::msg_params].keyExists(strings::offset)) { + offset_ = (*message_)[strings::msg_params][strings::offset].asUInt(); + } + + length_ = file_size - offset_; + if ((*message_)[strings::msg_params].keyExists(strings::length)) { + length_ = std::min( + static_cast<uint32_t>( + (*message_)[strings::msg_params][strings::length].asUInt()), + length_); + } + + if (offset_ > 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", + &response_params); + return; + } + if (length_ > file_size - offset_) { + LOG4CXX_ERROR(logger_, + "Length " << length_ << " greater than file size - offset" + << file_size); + SendResponse(false, + mobile_apis::Result::INVALID_DATA, + "Length greater than file size - offset", + &response_params); + return; + } + + // Load data from file as binary data + LOG4CXX_DEBUG(logger_, "Load binary data from file"); + std::vector<uint8_t> bin_data; + if (!file_system::ReadBinaryFile(full_path, bin_data, offset_, length_)) { + LOG4CXX_ERROR(logger_, "Failed to read from file: " << full_path); + SendResponse(false, + mobile_apis::Result::GENERIC_ERROR, + "Unable to read from file", + &response_params); + return; + } + + // Construct response message + if ((*message_)[strings::msg_params].keyExists(strings::offset)) { + response_params[strings::offset] = offset_; + } + if ((*message_)[strings::msg_params].keyExists(strings::length)) { + response_params[strings::length] = length_; + } + if ((*message_)[strings::msg_params].keyExists(strings::file_type)) { + response_params[strings::file_type] = file_type_; + } + const uint32_t crc_calculated = GetCrc32CheckSum(bin_data); + response_params[strings::crc32_check_sum] = crc_calculated; + + SendResponse(true, + mobile_apis::Result::SUCCESS, + "File uploaded", + &response_params, + bin_data); +} + +void GetFileRequest::on_event(const app_mngr::event_engine::Event& event) { + LOG4CXX_AUTO_TRACE(logger_); + + if (hmi_apis::FunctionID::BasicCommunication_GetFilePath != event.id()) { + return; + } + const smart_objects::SmartObject& event_message = event.smart_object(); + + hmi_apis::Common_Result::eType hmi_result = + static_cast<hmi_apis::Common_Result::eType>( + event_message[strings::params][hmi_response::code].asInt()); + + mobile_apis::Result::eType result = + MessageHelper::HMIToMobileResult(hmi_result); + bool success = PrepareResultForMobileResponse( + hmi_result, HmiInterfaces::HMI_INTERFACE_AppService); + + if (!success) { + auto msg_params = event_message[strings::msg_params]; + const char* info = msg_params.keyExists(strings::info) + ? msg_params[strings::info].asCharArray() + : NULL; + + SendResponse(false, result, info, &msg_params); + return; + } + smart_objects::SmartObject response_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); + std::vector<uint8_t> bin_data; + + if (event_message[strings::msg_params].keyExists(strings::file_type)) { + response_params[strings::file_type] = + event_message[strings::msg_params][strings::file_type]; + } + + if (event_message[strings::msg_params].keyExists(strings::file_path)) { + std::string full_path = + event_message[strings::msg_params][strings::file_path].asString(); + + if (!file_system::FileExists(full_path)) { + LOG4CXX_ERROR(logger_, "File " << full_path << " does not exist"); + SendResponse(false, + mobile_apis::Result::FILE_NOT_FOUND, + "File does not exist", + &response_params); + return; + } + + const uint64_t file_size = file_system::FileSize(full_path); + if ((*message_)[strings::msg_params].keyExists(strings::offset)) { + offset_ = (*message_)[strings::msg_params][strings::offset].asUInt(); + } + + length_ = file_size - offset_; + if ((*message_)[strings::msg_params].keyExists(strings::length)) { + length_ = std::min( + static_cast<uint32_t>( + (*message_)[strings::msg_params][strings::length].asUInt()), + length_); + } + + if (offset_ > 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", + &response_params); + return; + } + if (length_ > file_size - offset_) { + LOG4CXX_ERROR(logger_, + "Length " << length_ << " greater than file size - offset" + << file_size); + SendResponse(false, + mobile_apis::Result::INVALID_DATA, + "Length greater than file size - offset", + &response_params); + return; + } + if (!file_system::ReadBinaryFile(full_path, bin_data, offset_, length_)) { + LOG4CXX_ERROR(logger_, "Failed to read from file: " << full_path); + SendResponse(false, + mobile_apis::Result::GENERIC_ERROR, + "Failed to read from file", + &response_params); + return; + } + + const uint32_t crc_calculated = GetCrc32CheckSum(bin_data); + response_params[strings::crc32_check_sum] = crc_calculated; + + } else { + LOG4CXX_ERROR(logger_, "HMI did not return a file path: "); + SendResponse(false, + mobile_apis::Result::INVALID_DATA, + "HMI did not return a file path", + &response_params); + return; + } + + SendResponse(true, result, "File uploaded", &response_params, bin_data); +} + +} // namespace commands +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_response.cc new file mode 100644 index 0000000000..2ea8dde02a --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_response.cc @@ -0,0 +1,63 @@ +/* + 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/get_file_response.h" +#include "application_manager/application_impl.h" +#include "application_manager/rpc_service.h" +#include "interfaces/MOBILE_API.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; +namespace commands { + +GetFileResponse::GetFileResponse( + 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) {} + +GetFileResponse::~GetFileResponse() {} + +void GetFileResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_INFO(logger_, "Sending GetFile response"); + 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/get_system_capability_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc index a6c627aad2..2a25928b97 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,6 +32,11 @@ #include "sdl_rpc_plugin/commands/mobile/get_system_capability_request.h" +#include "sdl_rpc_plugin/extensions/system_capability_app_extension.h" +#include "application_manager/app_service_manager.h" +#include "application_manager/message_helper.h" +#include <set> + namespace sdl_rpc_plugin { using namespace application_manager; @@ -80,10 +85,20 @@ void GetSystemCapabilityRequest::Run() { switch (response_type) { case mobile_apis::SystemCapabilityType::NAVIGATION: { + smart_objects::SmartObject nav_capability(smart_objects::SmartType_Map); + bool has_nav_capability = false; if (hmi_capabilities.navigation_capability()) { + has_nav_capability = true; + auto nav_capability = *hmi_capabilities.navigation_capability(); + } + + has_nav_capability = application_manager_.GetAppServiceManager() + .UpdateNavigationCapabilities(nav_capability) || + has_nav_capability; + + if (has_nav_capability) { response_params[strings::system_capability] - [strings::navigation_capability] = - *hmi_capabilities.navigation_capability(); + [strings::navigation_capability] = nav_capability; } else { SendResponse(false, mobile_apis::Result::DATA_NOT_AVAILABLE); return; @@ -128,10 +143,34 @@ void GetSystemCapabilityRequest::Run() { return; } break; + 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); + break; + } default: // Return unsupported resource SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE); 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); + } + } + SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &response_params); } 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 new file mode 100644 index 0000000000..a8544ae643 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc @@ -0,0 +1,177 @@ +#include "sdl_rpc_plugin/commands/mobile/on_system_capability_updated_notification.h" + +#include "application_manager/app_service_manager.h" +#include "application_manager/application_manager.h" +#include "application_manager/helpers/application_helper.h" +#include "application_manager/message_helper.h" +#include "sdl_rpc_plugin/extensions/system_capability_app_extension.h" +#include "smart_objects/enum_schema_item.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; +namespace commands { +namespace mobile { + +OnSystemCapabilityUpdatedNotification::OnSystemCapabilityUpdatedNotification( + 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) + : CommandNotificationImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +OnSystemCapabilityUpdatedNotification:: + ~OnSystemCapabilityUpdatedNotification() {} + +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()); + + switch (system_capability_type) { + case mobile_apis::SystemCapabilityType::NAVIGATION: { + smart_objects::SmartObject nav_capability(smart_objects::SmartType_Map); + bool has_nav_capability = false; + if (hmi_capabilities_.navigation_capability()) { + has_nav_capability = true; + nav_capability = *hmi_capabilities_.navigation_capability(); + } + has_nav_capability = application_manager_.GetAppServiceManager() + .UpdateNavigationCapabilities(nav_capability) || + has_nav_capability; + + if (has_nav_capability) { + msg_params[strings::system_capability][strings::navigation_capability] = + nav_capability; + } else { + return; + } + break; + } + case mobile_apis::SystemCapabilityType::PHONE_CALL: { + if (hmi_capabilities_.phone_capability()) { + msg_params[strings::system_capability][strings::phone_capability] = + *hmi_capabilities_.phone_capability(); + } else { + return; + } + break; + } + case mobile_apis::SystemCapabilityType::REMOTE_CONTROL: { + if (!hmi_capabilities_.is_rc_cooperating()) { + return; + } + if (hmi_capabilities_.rc_capability()) { + msg_params[strings::system_capability][strings::rc_capability] = + *hmi_capabilities_.rc_capability(); + } else { + return; + } + break; + } + case mobile_apis::SystemCapabilityType::VIDEO_STREAMING: + if (hmi_capabilities_.video_streaming_capability()) { + msg_params[strings::system_capability] + [strings::video_streaming_capability] = + *hmi_capabilities_.video_streaming_capability(); + } else { + return; + } + break; + case mobile_apis::SystemCapabilityType::APP_SERVICES: { + auto all_services = + application_manager_.GetAppServiceManager().GetAllServiceRecords(); + auto app_service_caps = + MessageHelper::CreateAppServiceCapabilities(all_services); + + smart_objects::SmartArray* app_services = + app_service_caps[strings::app_services].asArray(); + smart_objects::SmartObject& updated_capabilities = + msg_params[strings::system_capability] + [strings::app_services_capabilities][strings::app_services]; + 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(); + }; + + 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); + app_services->erase(it); + } + app_services->push_back(updated_capabilities[i]); + } + msg_params[strings::system_capability] + [strings::app_services_capabilities] = app_service_caps; + break; + } + default: + return; + } + + const char* capability_type_string; + ns_smart_device_link::ns_smart_objects::EnumConversionHelper< + mobile_apis::SystemCapabilityType::eType>:: + EnumToCString(system_capability_type, &capability_type_string); + + auto subscribed_to_capability_predicate = + [&system_capability_type](const ApplicationSharedPtr app) { + DCHECK_OR_RETURN(app, false); + auto& ext = SystemCapabilityAppExtension::ExtractExtension(*app); + return ext.IsSubscribedTo(system_capability_type); + }; + + const std::vector<ApplicationSharedPtr>& applications = FindAllApps( + application_manager_.applications(), subscribed_to_capability_predicate); + + LOG4CXX_DEBUG(logger_, + "Number of Notifications to be sent: " << applications.size()); + + std::vector<ApplicationSharedPtr>::const_iterator app_it = + applications.begin(); + + for (; applications.end() != app_it; ++app_it) { + const ApplicationSharedPtr app = *app_it; + if (system_capability_type == + mobile_apis::SystemCapabilityType::REMOTE_CONTROL && + !app->is_remote_control_supported()) { + LOG4CXX_WARN( + logger_, + "App with connection key: " + << app->app_id() + << " was subcribed to REMOTE_CONTROL system capabilities, but " + "does not have RC permissions. Unsubscribing"); + auto& ext = SystemCapabilityAppExtension::ExtractExtension(*app); + ext.UnsubscribeFrom(system_capability_type); + continue; + } + LOG4CXX_INFO(logger_, + "Sending OnSystemCapabilityUpdated " << capability_type_string + << " application id " + << app->app_id()); + (*message_)[strings::params][strings::connection_key] = app->app_id(); + SendNotification(); + } +} + +} // namespace mobile +} // namespace commands +} // namespace application_manager 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 7957d9e055..924705f82b 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 @@ -281,17 +281,51 @@ void RegisterAppInterfaceRequest::Run() { return; } - mobile_apis::Result::eType coincidence_result = CheckCoincidence(); + std::vector<ApplicationSharedPtr> duplicate_apps; + mobile_apis::Result::eType coincidence_result = + CheckCoincidence(duplicate_apps); + + if (mobile_apis::Result::DUPLICATE_NAME == coincidence_result && + duplicate_apps.size() == 1) { + ApplicationSharedPtr duplicate_app = duplicate_apps.front(); + bool error_response = true; + if (duplicate_app->is_cloud_app()) { + if (duplicate_app->hybrid_app_preference() == + mobile_apis::HybridAppPreference::MOBILE) { + // Unregister cloud application and allow mobile application to register + // in it's place + application_manager_.UnregisterApplication( + duplicate_app->app_id(), mobile_apis::Result::USER_DISALLOWED); + error_response = false; + } + } else { + ApplicationSharedPtr cloud_app = + application_manager_.pending_application_by_policy_id(policy_app_id); + // If the duplicate name was not because of a mobile/cloud app pair, go + // through the normal process for handling duplicate names + if (cloud_app.use_count() == 0 || !cloud_app->is_cloud_app()) { + usage_statistics::AppCounter count_of_rejections_duplicate_name( + GetPolicyHandler().GetStatisticManager(), + policy_app_id, + usage_statistics::REJECTIONS_DUPLICATE_NAME); + ++count_of_rejections_duplicate_name; + } else if (cloud_app->hybrid_app_preference() == + mobile_apis::HybridAppPreference::CLOUD) { + // Unregister mobile application and allow cloud application to + // register in it's place + application_manager_.UnregisterApplication( + duplicate_app->app_id(), mobile_apis::Result::USER_DISALLOWED); + error_response = false; + } + } - if (mobile_apis::Result::SUCCESS != coincidence_result) { - LOG4CXX_ERROR(logger_, "Coincidence check failed."); - if (mobile_apis::Result::DUPLICATE_NAME == coincidence_result) { - usage_statistics::AppCounter count_of_rejections_duplicate_name( - GetPolicyHandler().GetStatisticManager(), - policy_app_id, - usage_statistics::REJECTIONS_DUPLICATE_NAME); - ++count_of_rejections_duplicate_name; + if (error_response) { + LOG4CXX_ERROR(logger_, "Coincidence check failed."); + SendResponse(false, coincidence_result); + return; } + } else if (mobile_apis::Result::SUCCESS != coincidence_result) { + LOG4CXX_ERROR(logger_, "Coincidence check failed."); SendResponse(false, coincidence_result); return; } @@ -346,19 +380,6 @@ void RegisterAppInterfaceRequest::Run() { application->set_msg_version(module_version); } - // For resuming application need to restore hmi_app_id from resumeCtrl - resumption::ResumeCtrl& resumer = application_manager_.resume_controller(); - const std::string& device_mac = application->mac_address(); - - // there is side affect with 2 mobile app with the same mobile app_id - if (resumer.IsApplicationSaved(policy_app_id, device_mac)) { - application->set_hmi_application_id( - resumer.GetHMIApplicationID(policy_app_id, device_mac)); - } else { - application->set_hmi_application_id( - application_manager_.GenerateNewHMIAppID()); - } - application->set_is_media_application( msg_params[strings::is_media_application].asBool()); @@ -451,6 +472,8 @@ void RegisterAppInterfaceRequest::Run() { FillDeviceInfo(&device_info); } + const std::string& device_mac = application->mac_address(); + GetPolicyHandler().SetDeviceInfo(device_mac, device_info); SendRegisterAppInterfaceResponseToMobile(ApplicationType::kNewApplication); @@ -458,6 +481,9 @@ void RegisterAppInterfaceRequest::Run() { GetLockScreenIconUrlNotification(connection_key(), application); rpc_service_.ManageMobileCommand(so, SOURCE_SDL); application_manager_.SendDriverDistractionState(application); + // Create onSystemRequest to mobile to obtain cloud app icons + application_manager_.SendGetIconUrlNotifications(connection_key(), + application); } smart_objects::SmartObjectSPtr @@ -816,8 +842,6 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile( file_system::FileExists(application->app_icon_path()); SendResponse(true, result_code, add_info.c_str(), &response_params); - SendOnAppRegisteredNotificationToHMI( - *(application.get()), resumption, need_restore_vr); if (msg_params.keyExists(strings::app_hmi_type)) { GetPolicyHandler().SetDefaultHmiTypes(application->policy_app_id(), &(msg_params[strings::app_hmi_type])); @@ -826,6 +850,8 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile( // Default HMI level should be set before any permissions validation, since it // relies on HMI level. application_manager_.OnApplicationRegistered(application); + SendOnAppRegisteredNotificationToHMI( + application, resumption, need_restore_vr); (*notify_upd_manager)(); // Start PTU after successfull registration @@ -877,9 +903,7 @@ void RegisterAppInterfaceRequest::SendChangeRegistrationOnHMI( } void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI( - const app_mngr::Application& application_impl, - bool resumption, - bool need_restore_vr) { + ApplicationConstSharedPtr app, bool resumption, bool need_restore_vr) { using namespace smart_objects; SmartObjectSPtr notification = std::make_shared<SmartObject>(SmartType_Map); if (!notification) { @@ -903,15 +927,15 @@ void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI( msg_params[strings::resume_vr_grammars] = need_restore_vr; } - if (application_impl.vr_synonyms()) { - msg_params[strings::vr_synonyms] = *(application_impl.vr_synonyms()); + if (app->vr_synonyms()) { + msg_params[strings::vr_synonyms] = *(app->vr_synonyms()); } - if (application_impl.tts_name()) { - msg_params[strings::tts_name] = *(application_impl.tts_name()); + if (app->tts_name()) { + msg_params[strings::tts_name] = *(app->tts_name()); } - const std::string policy_app_id = application_impl.policy_app_id(); + const std::string policy_app_id = app->policy_app_id(); std::string priority; GetPolicyHandler().GetPriority(policy_app_id, &priority); @@ -921,105 +945,19 @@ void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI( msg_params[strings::msg_params] = SmartObject(SmartType_Map); smart_objects::SmartObject& application = msg_params[strings::application]; - application[strings::app_name] = application_impl.name(); - application[strings::app_id] = application_impl.app_id(); - application[hmi_response::policy_app_id] = policy_app_id; - if (file_system::FileExists(application_impl.app_icon_path())) { - application[strings::icon] = application_impl.app_icon_path(); - } - - const smart_objects::SmartObject* ngn_media_screen_name = - application_impl.ngn_media_screen_name(); - if (ngn_media_screen_name) { - application[strings::ngn_media_screen_app_name] = *ngn_media_screen_name; - } - - application[strings::hmi_display_language_desired] = - static_cast<int32_t>(application_impl.ui_language()); - - application[strings::is_media_application] = - application_impl.is_media_application(); - - const smart_objects::SmartObject* app_type = application_impl.app_types(); - if (app_type) { - application[strings::app_type] = *app_type; - } - - const policy::RequestType::State app_request_types_state = - GetPolicyHandler().GetAppRequestTypeState(policy_app_id); - if (policy::RequestType::State::AVAILABLE == app_request_types_state) { - const auto request_types = - GetPolicyHandler().GetAppRequestTypes(policy_app_id); - application[strings::request_type] = SmartObject(SmartType_Array); - smart_objects::SmartObject& request_types_array = - application[strings::request_type]; - - size_t index = 0; - for (auto it : request_types) { - request_types_array[index] = it; - ++index; - } - } else if (policy::RequestType::State::EMPTY == app_request_types_state) { - application[strings::request_type] = SmartObject(SmartType_Array); - } - - const policy::RequestSubType::State app_request_subtypes_state = - GetPolicyHandler().GetAppRequestSubTypeState(policy_app_id); - if (policy::RequestSubType::State::AVAILABLE == app_request_subtypes_state) { - const auto request_subtypes = - GetPolicyHandler().GetAppRequestSubTypes(policy_app_id); - application[strings::request_subtype] = SmartObject(SmartType_Array); - smart_objects::SmartObject& request_subtypes_array = - application[strings::request_subtype]; - - size_t index = 0; - for (auto it : request_subtypes) { - request_subtypes_array[index] = it; - ++index; - } - } else if (policy::RequestSubType::State::EMPTY == - app_request_subtypes_state) { - application[strings::request_subtype] = SmartObject(SmartType_Array); - } - const protocol_handler::SessionObserver& session_observer = application_manager_.connection_handler().get_session_observer(); - - application[strings::device_info] = SmartObject(SmartType_Map); - smart_objects::SmartObject& device_info = application[strings::device_info]; - MessageHelper::CreateDeviceInfo(application_impl.device(), - session_observer, - GetPolicyHandler(), - application_manager_, - &device_info); - - if (application_impl.secondary_device() != 0) { - application[strings::secondary_device_info] = SmartObject(SmartType_Map); - smart_objects::SmartObject& secondary_device_info = - application[strings::secondary_device_info]; - MessageHelper::CreateDeviceInfo(application_impl.secondary_device(), - session_observer, - GetPolicyHandler(), - application_manager_, - &secondary_device_info); - } - - const smart_objects::SmartObject* day_color_scheme = - application_impl.day_color_scheme(); - if (day_color_scheme) { - application[strings::day_color_scheme] = *day_color_scheme; - } - - const smart_objects::SmartObject* night_color_scheme = - application_impl.night_color_scheme(); - if (night_color_scheme) { - application[strings::night_color_scheme] = *night_color_scheme; - } + MessageHelper::CreateHMIApplicationStruct(app, + session_observer, + GetPolicyHandler(), + &application, + application_manager_); DCHECK(rpc_service_.ManageHMICommand(notification)); } -mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() { +mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence( + std::vector<ApplicationSharedPtr>& out_duplicate_apps) { LOG4CXX_AUTO_TRACE(logger_); const smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; @@ -1035,7 +973,8 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() { const custom_str::CustomString& cur_name = (*it)->name(); if (app_name.CompareIgnoreCase(cur_name)) { LOG4CXX_ERROR(logger_, "Application name is known already."); - return mobile_apis::Result::DUPLICATE_NAME; + out_duplicate_apps.push_back(*it); + continue; } const smart_objects::SmartObject* vr = (*it)->vr_synonyms(); @@ -1046,7 +985,8 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() { if (0 != std::count_if(curr_vr->begin(), curr_vr->end(), v)) { LOG4CXX_ERROR(logger_, "Application name is known already."); - return mobile_apis::Result::DUPLICATE_NAME; + out_duplicate_apps.push_back(*it); + continue; } } @@ -1058,12 +998,16 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() { 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; + out_duplicate_apps.push_back(*it); + continue; } } // end vr check } // application for end + if (!out_duplicate_apps.empty()) { + return mobile_apis::Result::DUPLICATE_NAME; + } return mobile_apis::Result::SUCCESS; } // method end 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 new file mode 100644 index 0000000000..5173be56d6 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc @@ -0,0 +1,43 @@ +#include "sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; + +namespace commands { + +SetCloudAppPropertiesRequest::SetCloudAppPropertiesRequest( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : CommandRequestImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +SetCloudAppPropertiesRequest::~SetCloudAppPropertiesRequest() {} + +void SetCloudAppPropertiesRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + ApplicationSharedPtr app = application_manager_.application(connection_key()); + + if (!app) { + LOG4CXX_ERROR(logger_, "Application is not registered"); + SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); + return; + } + + policy_handler_.OnSetCloudAppProperties(*message_); + + SendResponse(true, mobile_apis::Result::SUCCESS); +} + +void SetCloudAppPropertiesRequest::on_event( + const app_mngr::event_engine::Event& event) { + LOG4CXX_INFO(logger_, "SetCloudAppPropertiesRequest on_event"); +} + +} // namespace commands +} // namespace sdl_rpc_plugin
\ No newline at end of file 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 new file mode 100644 index 0000000000..6d27ce8b3e --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_response.cc @@ -0,0 +1,31 @@ +#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; + +namespace commands { + +SetCloudAppPropertiesResponse::SetCloudAppPropertiesResponse( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : CommandResponseImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +SetCloudAppPropertiesResponse::~SetCloudAppPropertiesResponse() {} + +void SetCloudAppPropertiesResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + rpc_service_.SendMessageToMobile(message_); +} + +} // namespace commands +} // namespace sdl_rpc_plugins 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 cea00a9d5e..ca9182469a 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 @@ -511,7 +511,8 @@ void SystemRequest::Run() { return; } - if (!file_system::IsFileNameValid(file_name)) { + if (!file_system::IsFileNameValid(file_name) && + mobile_apis::RequestType::ICON_URL != request_type) { const std::string err_msg = "Sync file name contains forbidden symbols."; LOG4CXX_ERROR(logger_, err_msg); SendResponse(false, mobile_apis::Result::INVALID_DATA, err_msg.c_str()); @@ -533,8 +534,22 @@ void SystemRequest::Run() { std::string binary_data_folder; if ((*message_)[strings::params].keyExists(strings::binary_data)) { binary_data = (*message_)[strings::params][strings::binary_data].asBinary(); - binary_data_folder = - application_manager_.get_settings().system_files_path(); + if (mobile_apis::RequestType::ICON_URL == request_type) { + binary_data_folder = + application_manager_.get_settings().app_icons_folder(); + // Use the URL file name to identify the policy id. + // Save the icon file with the policy id as the name. + file_name = application_manager_.PolicyIDByIconUrl(file_name); + if (file_name.empty()) { + const std::string err_msg = "Invalid file name"; + SendResponse(false, mobile_apis::Result::INVALID_DATA, err_msg.c_str()); + return; + } + LOG4CXX_DEBUG(logger_, "Got ICON_URL Request. File name: " << file_name); + } else { + binary_data_folder = + application_manager_.get_settings().system_files_path(); + } } else { binary_data_folder = application_manager_.get_settings().app_storage_folder(); @@ -581,6 +596,12 @@ void SystemRequest::Run() { LOG4CXX_DEBUG(logger_, "Binary data ok."); + if (mobile_apis::RequestType::ICON_URL == request_type) { + application_manager_.SetIconFileFromSystemRequest(file_name); + SendResponse(true, mobile_apis::Result::SUCCESS); + return; + } + if (mobile_apis::RequestType::HTTP == request_type && (*message_)[strings::msg_params].keyExists(strings::file_name)) { const std::string& file = 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 40bb1ddfc9..4b40b7a9ce 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 @@ -71,9 +71,20 @@ void UnsubscribeWayPointsRequest::Run() { return; } - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); - SendHMIRequest( - hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints, NULL, true); + std::set<uint32_t> subscribed_apps = + application_manager_.GetAppsSubscribedForWayPoints(); + + if (subscribed_apps.size() > 1) { + // More than 1 subscribed app, don't send HMI unsubscribe request + application_manager_.UnsubscribeAppFromWayPoints(app); + SendResponse(true, mobile_apis::Result::SUCCESS, NULL); + return; + } else { + // Only subscribed app, send HMI unsubscribe request + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); + SendHMIRequest( + hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints, NULL, true); + } } void UnsubscribeWayPointsRequest::on_event(const event_engine::Event& event) { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc new file mode 100644 index 0000000000..130585a927 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc @@ -0,0 +1,98 @@ +#include "sdl_rpc_plugin/extensions/system_capability_app_extension.h" + +namespace sdl_rpc_plugin { +CREATE_LOGGERPTR_GLOBAL(logger_, "GetSystemCapabilitiesAppExtension") + +namespace app_mngr_ = application_manager; +const app_mngr_::AppExtensionUID + SystemCapabilityAppExtension::SystemCapabilityAppExtensionUID = 200; + +SystemCapabilityAppExtension::SystemCapabilityAppExtension( + sdl_rpc_plugin::SDLRPCPlugin& plugin, app_mngr_::Application& app) + : app_mngr_::AppExtension( + SystemCapabilityAppExtension::SystemCapabilityAppExtensionUID) + , plugin_(plugin) + , app_(app) {} + +SystemCapabilityAppExtension::~SystemCapabilityAppExtension() {} + +bool SystemCapabilityAppExtension::SubscribeTo( + const SystemCapabilityType system_capability_type) { + LOG4CXX_INFO(logger_, + "Subscribing to System Capability " << system_capability_type); + return subscribed_data_.insert(system_capability_type).second; +} + +bool SystemCapabilityAppExtension::UnsubscribeFrom( + const SystemCapabilityType system_capability_type) { + LOG4CXX_INFO(logger_, + "Unsubscribing from System Capability " + << system_capability_type); + auto it = subscribed_data_.find(system_capability_type); + if (it != subscribed_data_.end()) { + subscribed_data_.erase(it); + return true; + } + return false; +} + +void SystemCapabilityAppExtension::UnsubscribeFromAll() { + LOG4CXX_INFO(logger_, "Unsubscribing from ALL System Capabilities"); + subscribed_data_.clear(); +} + +bool SystemCapabilityAppExtension::IsSubscribedTo( + const SystemCapabilityType system_capability_type) const { + LOG4CXX_DEBUG(logger_, system_capability_type); + return subscribed_data_.find(system_capability_type) != + subscribed_data_.end(); +} + +SystemCapabilitySubscriptions SystemCapabilityAppExtension::Subscriptions() { + return subscribed_data_; +} + +void SystemCapabilityAppExtension::SaveResumptionData( + ns_smart_device_link::ns_smart_objects::SmartObject& resumption_data) { + LOG4CXX_AUTO_TRACE(logger_); + const char* application_system_capability = "systemCapability"; + + resumption_data[application_system_capability] = + smart_objects::SmartObject(smart_objects::SmartType_Array); + + int i = 0; + for (const auto& subscription : subscribed_data_) { + resumption_data[application_system_capability][i] = subscription; + i++; + } +} + +void SystemCapabilityAppExtension::ProcessResumption( + const smart_objects::SmartObject& resumption_data) { + LOG4CXX_AUTO_TRACE(logger_); + + const char* application_system_capability = "systemCapability"; + if (resumption_data.keyExists(application_system_capability)) { + const smart_objects::SmartObject& subscriptions = + resumption_data[application_system_capability]; + for (size_t i = 0; i < subscriptions.length(); ++i) { + SystemCapabilityType capability_type = + static_cast<SystemCapabilityType>((resumption_data[i]).asInt()); + SubscribeTo(capability_type); + } + } +} + +SystemCapabilityAppExtension& SystemCapabilityAppExtension::ExtractExtension( + app_mngr_::Application& app) { + LOG4CXX_AUTO_TRACE(logger_); + auto ext_ptr = app.QueryInterface( + SystemCapabilityAppExtension::SystemCapabilityAppExtensionUID); + DCHECK(ext_ptr); + DCHECK(dynamic_cast<SystemCapabilityAppExtension*>(ext_ptr.get())); + auto app_extension = + std::static_pointer_cast<SystemCapabilityAppExtension>(ext_ptr); + DCHECK(app_extension); + return *app_extension; +} +}
\ No newline at end of file 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 7065c7cf7d..fb809e8834 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 @@ -240,10 +240,16 @@ #include "sdl_rpc_plugin/commands/hmi/rc_is_ready_response.h" #include "sdl_rpc_plugin/commands/hmi/rc_get_capabilities_request.h" #include "sdl_rpc_plugin/commands/hmi/rc_get_capabilities_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" + +#include "sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification.h" namespace sdl_rpc_plugin { using namespace application_manager; +CREATE_LOGGERPTR_GLOBAL(logger_, "HMICommandFactory") + HMICommandFactory::HMICommandFactory( ApplicationManager& application_manager, rpc_service::RPCService& rpc_service, @@ -840,6 +846,15 @@ CommandCreator& HMICommandFactory::get_creator_factory( ? factory.GetCreator<commands::UISendHapticDataRequest>() : factory.GetCreator<commands::UISendHapticDataResponse>(); } + case hmi_apis::FunctionID::BasicCommunication_GetFilePath: { + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::BCGetFilePathRequest>() + : factory.GetCreator<commands::BCGetFilePathResponse>(); + } + case hmi_apis::FunctionID::BasicCommunication_OnSystemCapabilityUpdated: { + return factory + .GetCreator<commands::OnBCSystemCapabilityUpdatedNotification>(); + } default: { return factory.GetCreator<InvalidCommand>(); } } } 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 5207c7e432..554d004360 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 @@ -73,6 +73,7 @@ #include "sdl_rpc_plugin/commands/mobile/on_tbt_client_state_notification.h" #include "sdl_rpc_plugin/commands/mobile/on_hash_change_notification.h" #include "sdl_rpc_plugin/commands/mobile/on_way_point_change_notification.h" +#include "sdl_rpc_plugin/commands/mobile/on_system_capability_updated_notification.h" #include "sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_request.h" #include "sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_response.h" #include "sdl_rpc_plugin/commands/mobile/perform_interaction_request.h" @@ -124,6 +125,12 @@ #include "sdl_rpc_plugin/commands/mobile/dial_number_response.h" #include "sdl_rpc_plugin/commands/mobile/send_haptic_data_request.h" #include "sdl_rpc_plugin/commands/mobile/send_haptic_data_response.h" +#include "sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h" +#include "sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_response.h" +#include "sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h" +#include "sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_response.h" +#include "sdl_rpc_plugin/commands/mobile/get_file_request.h" +#include "sdl_rpc_plugin/commands/mobile/get_file_response.h" #include "interfaces/MOBILE_API.h" CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") @@ -231,6 +238,11 @@ CommandCreator& MobileCommandFactory::get_creator_factory( ? factory.GetCreator<commands::PutFileRequest>() : factory.GetCreator<commands::PutFileResponse>(); } + case mobile_apis::FunctionID::GetFileID: { + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::GetFileRequest>() + : factory.GetCreator<commands::GetFileResponse>(); + } case mobile_apis::FunctionID::DeleteFileID: { return mobile_api::messageType::request == message_type ? factory.GetCreator<commands::DeleteFileRequest>() @@ -337,6 +349,18 @@ CommandCreator& MobileCommandFactory::get_creator_factory( ? factory.GetCreator<commands::SendHapticDataRequest>() : factory.GetCreator<commands::SendHapticDataResponse>(); } + case mobile_apis::FunctionID::SetCloudAppPropertiesID: { + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::SetCloudAppPropertiesRequest>() + : factory + .GetCreator<commands::SetCloudAppPropertiesResponse>(); + } + case mobile_apis::FunctionID::GetCloudAppPropertiesID: { + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::GetCloudAppPropertiesRequest>() + : factory + .GetCreator<commands::GetCloudAppPropertiesResponse>(); + } case mobile_apis::FunctionID::OnButtonEventID: { return factory.GetCreator<commands::mobile::OnButtonEventNotification>(); } @@ -380,6 +404,10 @@ CommandCreator& MobileCommandFactory::get_creator_factory( case mobile_apis::FunctionID::OnTouchEventID: { return factory.GetCreator<commands::mobile::OnTouchEventNotification>(); } + case mobile_apis::FunctionID::OnSystemCapabilityUpdatedID: { + return factory.GetCreator< + commands::mobile::OnSystemCapabilityUpdatedNotification>(); + } case mobile_apis::FunctionID::OnSystemRequestID: { return factory .GetCreator<commands::mobile::OnSystemRequestNotification>(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_command_factory.cc index efdcde7526..d745cd8f44 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_command_factory.cc @@ -55,7 +55,8 @@ SDLCommandFactory::SDLCommandFactory( app_mngr::CommandSharedPtr SDLCommandFactory::CreateCommand( const app_mngr::commands::MessageSharedPtr& message, app_mngr::commands::Command::CommandSource source) { - if (app_mngr::commands::Command::SOURCE_HMI == source) { + if (app_mngr::commands::Command::SOURCE_HMI == source || + app_mngr::commands::Command::SOURCE_SDL_TO_HMI == source) { return hmi_command_factory_->CreateCommand(message, source); } else { return mobile_command_factory_->CreateCommand(message, source); @@ -70,7 +71,8 @@ bool SDLCommandFactory::IsAbleToProcess( bool is_mobile_command_factory_able_to_process = mobile_command_factory_->IsAbleToProcess(FunctionID, source); - return app_mngr::commands::Command::SOURCE_HMI == source + return (app_mngr::commands::Command::SOURCE_HMI == source || + app_mngr::commands::Command::SOURCE_SDL_TO_HMI == source) ? is_hmi_command_factory_able_to_process : is_mobile_command_factory_able_to_process; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc index 22b818f5e0..c448b41ff1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc @@ -30,17 +30,21 @@ POSSIBILITY OF SUCH DAMAGE. */ +#include "application_manager/plugin_manager/plugin_keys.h" #include "sdl_rpc_plugin/sdl_rpc_plugin.h" #include "sdl_rpc_plugin/sdl_command_factory.h" +#include "sdl_rpc_plugin/extensions/system_capability_app_extension.h" namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; namespace plugins = application_manager::plugin_manager; -bool SDLRPCPlugin::Init( - application_manager::ApplicationManager& app_manager, - application_manager::rpc_service::RPCService& rpc_service, - application_manager::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handler) { +CREATE_LOGGERPTR_GLOBAL(logger_, "SdlRPCPlugin") + +bool SDLRPCPlugin::Init(app_mngr::ApplicationManager& app_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) { command_factory_.reset(new sdl_rpc_plugin::SDLCommandFactory( app_manager, rpc_service, hmi_capabilities, policy_handler)); return true; @@ -48,25 +52,35 @@ bool SDLRPCPlugin::Init( bool SDLRPCPlugin::IsAbleToProcess( const int32_t function_id, - const application_manager::commands::Command::CommandSource - message_source) { + const app_mngr::commands::Command::CommandSource message_source) { return command_factory_->IsAbleToProcess(function_id, message_source); } std::string SDLRPCPlugin::PluginName() { - return "SDL RPC Plugin"; + return plugins::plugin_names::sdl_rpc_plugin; } -application_manager::CommandFactory& SDLRPCPlugin::GetCommandFactory() { +app_mngr::CommandFactory& SDLRPCPlugin::GetCommandFactory() { return *command_factory_; } -void SDLRPCPlugin::OnPolicyEvent( - application_manager::plugin_manager::PolicyEvent event) {} +void SDLRPCPlugin::OnPolicyEvent(plugins::PolicyEvent event) {} void SDLRPCPlugin::OnApplicationEvent( - application_manager::plugin_manager::ApplicationEvent event, - application_manager::ApplicationSharedPtr application) {} + plugins::ApplicationEvent event, + app_mngr::ApplicationSharedPtr application) { + if (plugins::ApplicationEvent::kApplicationRegistered == event) { + application->AddExtension( + std::make_shared<SystemCapabilityAppExtension>(*this, *application)); + } else if (plugins::ApplicationEvent::kDeleteApplicationData == event) { + ClearSubscriptions(application); + } +} + +void SDLRPCPlugin::ClearSubscriptions(app_mngr::ApplicationSharedPtr app) { + auto& ext = SystemCapabilityAppExtension::ExtractExtension(*app); + ext.UnsubscribeFromAll(); +} } // namespace sdl_rpc_plugin 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 a6497ca6e1..874d27b4b0 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 @@ -223,6 +223,8 @@ #include "hmi/on_tts_reset_timeout_notification.h" #include "hmi/dial_number_request.h" #include "hmi/dial_number_response.h" +#include "hmi/bc_get_file_path_request.h" +#include "hmi/bc_get_file_path_response.h" #include "application_manager/commands/commands_test.h" #include "application_manager/mock_application.h" @@ -496,7 +498,9 @@ typedef Types<commands::hmi::OnButtonEventNotification, typedef Types<commands::AllowAllAppsRequest, commands::AllowAllAppsResponse, commands::AllowAppRequest, - commands::AllowAppResponse> HMICommandsListFifth; + commands::AllowAppResponse, + commands::BCGetFilePathRequest, + commands::BCGetFilePathResponse> HMICommandsListFifth; TYPED_TEST_CASE(HMICommandsTestFirst, HMICommandsListFirst); TYPED_TEST_CASE(HMICommandsTestSecond, HMICommandsListSecond); @@ -507,30 +511,30 @@ TYPED_TEST_CASE(HMICommandsTestFifth, HMICommandsListFifth); TYPED_TEST(HMICommandsTestFirst, CtorAndDtorCall) { std::shared_ptr<typename TestFixture::CommandType> command = this->template CreateCommand<typename TestFixture::CommandType>(); - UNUSED(command); + EXPECT_NE(command.use_count(), 0); } TYPED_TEST(HMICommandsTestSecond, CtorAndDtorCall) { std::shared_ptr<typename TestFixture::CommandType> command = this->template CreateCommand<typename TestFixture::CommandType>(); - UNUSED(command); + EXPECT_NE(command.use_count(), 0); } TYPED_TEST(HMICommandsTestThird, CtorAndDtorCall) { std::shared_ptr<typename TestFixture::CommandType> command = this->template CreateCommand<typename TestFixture::CommandType>(); - UNUSED(command); + EXPECT_NE(command.use_count(), 0); } TYPED_TEST(HMICommandsTestFourth, CtorAndDtorCall) { std::shared_ptr<typename TestFixture::CommandType> command = this->template CreateCommand<typename TestFixture::CommandType>(); - UNUSED(command); + EXPECT_NE(command.use_count(), 0); } TYPED_TEST(HMICommandsTestFifth, CtorAndDtorCall) { std::shared_ptr<typename TestFixture::CommandType> command = this->template CreateCommand<typename TestFixture::CommandType>(); - UNUSED(command); + EXPECT_NE(command.use_count(), 0); } } // namespace dummy_hmi_commands_test diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_test.cc index 2191900750..20a05d8601 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_test.cc @@ -110,7 +110,7 @@ TEST_F(GetUrlsTest, RUN_SUCCESS) { TEST_F(GetUrlsTest, RUN_PolicyNotEnabled_UNSUCCESS) { EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(false)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_, _)) .WillOnce(Return(true)); request_command_->Run(); @@ -127,7 +127,7 @@ TEST_F(GetUrlsTest, RUN_EmptyEndpoints_UNSUCCESS) { .WillOnce(SetArgReferee<1>(endpoints_)); EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(true)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_, _)) .WillOnce(Return(true)); request_command_->Run(); @@ -160,7 +160,7 @@ TEST_F(GetUrlsTest, ProcessPolicyServiceURLs_SUCCESS) { EXPECT_CALL(app_mngr_, application(kAppIdForSending)) .WillOnce(Return(mock_app)); EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kAppIdForSending)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_, _)) .WillOnce(Return(true)); request_command_->Run(); @@ -197,7 +197,7 @@ TEST_F(GetUrlsTest, ProcessPolicyServiceURLs_IncorrectIdForSending_UNSUCCESS) { EXPECT_CALL(mock_policy_handler_, GetAppIdForSending()) .WillOnce(Return(kInvalidAppId_)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_, _)) .WillOnce(Return(true)); EXPECT_CALL(app_mngr_, application(kInvalidAppId_)).Times(0); @@ -226,7 +226,7 @@ TEST_F(GetUrlsTest, ProcessPolicyServiceURLs_ApplicationIsNotValid_UNSUCCESS) { EXPECT_CALL(app_mngr_, application(kAppIdForSending)) .WillOnce(Return(invalid_mock_app)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_, _)) .WillOnce(Return(true)); request_command_->Run(); @@ -261,7 +261,7 @@ TEST_F(GetUrlsTest, ProcessPolicyServiceURLs_FoundURLForApplication_SUCCESS) { EXPECT_CALL(*mock_app, policy_app_id()).WillOnce(Return(kPolicyAppId)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_, _)) .WillOnce(Return(true)); request_command_->Run(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc index fe82b16f3f..ca322ea425 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc @@ -945,7 +945,7 @@ TEST_F(HMICommandsNotificationsTest, EXPECT_CALL(app_mngr_, GetNextHMICorrelationID()) .WillOnce(Return(kCorrelationId_)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(GetMessage(temp_message)); command->Run(); @@ -973,7 +973,7 @@ TEST_F(HMICommandsNotificationsTest, EXPECT_CALL(app_mngr_, SetUnregisterAllApplicationsReason(_)).Times(0); EXPECT_CALL(app_mngr_, HeadUnitReset(_)).Times(0); EXPECT_CALL(app_mngr_, GetNextHMICorrelationID()).Times(0); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); command->Run(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc index 030db2f424..c7fbdb663b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc @@ -99,7 +99,7 @@ class RCIsReadyRequestTest EXPECT_CALL(mock_message_helper_, CreateModuleInfoSO(hmi_apis::FunctionID::RC_GetCapabilities, _)) .WillOnce(Return(capabilities)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(capabilities)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(capabilities, _)); } void PrepareEvent(bool is_message_contain_param, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/response_from_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/response_from_hmi_test.cc index 0b1f2df491..25abefb010 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/response_from_hmi_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/response_from_hmi_test.cc @@ -86,7 +86,7 @@ TEST_F(ResponseFromHMITest, CreateHMIRequest_SUCCESS) { ResponseFromHMIPtr command(CreateCommand<ResponseFromHMI>()); MessageSharedPtr result_msg; - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&result_msg), Return(true))); const hmi_apis::FunctionID::eType posted_function_id = @@ -115,7 +115,7 @@ TEST_F(ResponseFromHMITest, CreateHMIRequest_CantManageCommand_Covering) { MessageSharedPtr result_msg; ON_CALL(app_mngr_, GetNextHMICorrelationID()).WillByDefault(Return(1u)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&result_msg), Return(false))); const hmi_apis::FunctionID::eType posted_function_id = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc index 38cbc7b069..917de81fb3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc @@ -44,6 +44,7 @@ #include "application_manager/event_engine/event.h" #include "application_manager/mock_event_dispatcher.h" #include "application_manager/mock_state_controller.h" +#include "connection_handler/mock_connection_handler.h" namespace test { namespace components { @@ -61,8 +62,10 @@ using testing::Mock; using testing::Return; using testing::ReturnRef; using testing::Mock; +using testing::Gt; using ::testing::NiceMock; using policy_test::MockPolicyHandlerInterface; +using connection_handler_test::MockConnectionHandler; using am::event_engine::Event; namespace { @@ -137,6 +140,8 @@ TEST_F(SDLActivateAppRequestTest, Run_ActivateApp_SUCCESS) { std::shared_ptr<SDLActivateAppRequest> command( CreateCommand<SDLActivateAppRequest>(msg)); + EXPECT_CALL(app_mngr_, WaitingApplicationByID(kAppID)) + .WillOnce(Return(ApplicationSharedPtr())); EXPECT_CALL(app_mngr_, state_controller()) .WillOnce(ReturnRef(mock_state_controller_)); EXPECT_CALL(mock_state_controller_, @@ -148,7 +153,7 @@ TEST_F(SDLActivateAppRequestTest, Run_ActivateApp_SUCCESS) { command->Run(); } -TEST_F(SDLActivateAppRequestTest, DISABLED_Run_DactivateApp_REJECTED) { +TEST_F(SDLActivateAppRequestTest, DISABLED_Run_DeactivateApp_REJECTED) { MessageSharedPtr msg = CreateMessage(); SetCorrelationAndAppID(msg); (*msg)[strings::msg_params][strings::function_id] = @@ -163,9 +168,9 @@ TEST_F(SDLActivateAppRequestTest, DISABLED_Run_DactivateApp_REJECTED) { IsStateActive(am::HmiState::StateID::STATE_ID_DEACTIVATE_HMI)) .WillOnce(Return(true)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::SDL_ActivateApp))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::SDL_ActivateApp), _)) .WillOnce(Return(true)); command->Run(); @@ -189,6 +194,7 @@ TEST_F(SDLActivateAppRequestTest, FindAppToRegister_SUCCESS) { .WillOnce(Return(false)); EXPECT_CALL(*mock_app, IsRegistered()).WillOnce(Return(false)); + EXPECT_CALL(*mock_app, is_cloud_app()).WillOnce(Return(false)); ON_CALL(*mock_app, device()).WillByDefault(Return(kHandle)); MockAppPtr mock_app_first(CreateMockApp()); @@ -250,6 +256,7 @@ TEST_F(SDLActivateAppRequestTest, DevicesAppsEmpty_SUCCESS) { .WillOnce(Return(false)); EXPECT_CALL(*mock_app, IsRegistered()).WillOnce(Return(false)); + EXPECT_CALL(*mock_app, is_cloud_app()).WillOnce(Return(false)); ON_CALL(*mock_app, device()).WillByDefault(Return(kHandle)); DataAccessor<ApplicationSet> accessor(app_list_, lock_); @@ -336,6 +343,7 @@ TEST_F(SDLActivateAppRequestTest, FirstAppIsForeground_SUCCESS) { EXPECT_CALL(*mock_app, device()).WillOnce(Return(kHandle)); EXPECT_CALL(*mock_app, IsRegistered()).WillOnce(Return(false)); + EXPECT_CALL(*mock_app, is_cloud_app()).WillOnce(Return(false)); EXPECT_CALL(app_mngr_, state_controller()) .WillOnce(ReturnRef(mock_state_controller_)); EXPECT_CALL(mock_state_controller_, @@ -427,6 +435,55 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotRegistered_SUCCESS) { } #endif +TEST_F(SDLActivateAppRequestTest, WaitingCloudApplication_ConnectDevice) { + MessageSharedPtr msg = CreateMessage(); + SetCorrelationAndAppID(msg); + + std::shared_ptr<SDLActivateAppRequest> command( + CreateCommand<SDLActivateAppRequest>(msg)); + + MockAppPtr mock_app(CreateMockApp()); + + EXPECT_CALL(*mock_app, device()).WillOnce(Return(kHandle)); + EXPECT_CALL(*mock_app, IsRegistered()).WillOnce(Return(false)); + EXPECT_CALL(*mock_app, is_cloud_app()).WillOnce(Return(true)); + +#ifndef EXTERNAL_PROPRIETARY_MODE + EXPECT_CALL(app_mngr_, application(kAppID)) + .WillOnce(Return(ApplicationSharedPtr())); +#endif + EXPECT_CALL(app_mngr_, WaitingApplicationByID(kAppID)) + .WillOnce(Return(mock_app)); + + EXPECT_CALL(app_mngr_, state_controller()) + .WillOnce(ReturnRef(mock_state_controller_)); + EXPECT_CALL(mock_state_controller_, + IsStateActive(am::HmiState::StateID::STATE_ID_DEACTIVATE_HMI)) + .WillOnce(Return(false)); + + const uint16_t kRetries = 3; + const uint32_t kRetryTimeout = 2000; + const uint32_t kMinimumTimeout = kRetries * kRetryTimeout; + + MockApplicationManagerSettings settings; + EXPECT_CALL(settings, cloud_app_max_retry_attempts()) + .WillOnce(Return(kRetries)); + EXPECT_CALL(settings, cloud_app_retry_timeout()) + .WillOnce(Return(kRetryTimeout)); + EXPECT_CALL(app_mngr_, get_settings()).WillOnce(ReturnRef(settings)); + + EXPECT_CALL(app_mngr_, + updateRequestTimeout(0, kCorrelationID, Gt(kMinimumTimeout))); + + MockConnectionHandler connection_handler; + EXPECT_CALL(connection_handler, ConnectToDevice(kHandle)); + + EXPECT_CALL(app_mngr_, connection_handler()) + .WillOnce(ReturnRef(connection_handler)); + + command->Run(); +} + TEST_F(SDLActivateAppRequestTest, OnTimeout_SUCCESS) { MessageSharedPtr msg = CreateMessage(); SetCorrelationAndAppID(msg); @@ -434,7 +491,7 @@ TEST_F(SDLActivateAppRequestTest, OnTimeout_SUCCESS) { std::shared_ptr<SDLActivateAppRequest> command( CreateCommand<SDLActivateAppRequest>(msg)); ON_CALL(mock_event_dispatcher_, remove_observer(_, _)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true)); command->onTimeOut(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_request_from_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_request_from_hmi_test.cc index 5c42d265c7..a69f6c71fc 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_request_from_hmi_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_request_from_hmi_test.cc @@ -81,7 +81,7 @@ TEST_F(RequestFromHMITest, SendResponse_SUCCESS) { const bool success = false; const uint32_t correlation_id = 1u; - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(NotNull())); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(NotNull(), _)); command->SendResponse(success, correlation_id, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_from_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_from_hmi_test.cc index 4a86fa9458..4f415975ba 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_from_hmi_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_from_hmi_test.cc @@ -310,7 +310,7 @@ TEST_F(NotificationFromHMITest, CreateHMIRequest_UNSUCCESS) { EXPECT_CALL(app_mngr_, GetNextHMICorrelationID()) .WillOnce(Return(correlation_id)); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(CheckMsgType(am::MessageType::kRequest))) + ManageHMICommand(CheckMsgType(am::MessageType::kRequest), _)) .WillOnce(Return(false)); command->CreateHMIRequest(hmi_apis::FunctionID::INVALID_ENUM, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc index fe0d8a8470..70fc80bbd1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc @@ -125,9 +125,9 @@ class UIIsReadyRequestTest .WillOnce(Return(get_capabilities)); EXPECT_CALL(mock_hmi_capabilities_, set_handle_response_for(*get_language)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(get_language)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(get_all_language)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(get_capabilities)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(get_language, _)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(get_all_language, _)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(get_capabilities, _)); } void PrepareEvent(bool is_message_contain_param, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc index 5aa00e0264..259fd0b92b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc @@ -98,7 +98,7 @@ class VRIsReadyRequestTest CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetLanguage, _)) .WillOnce(Return(language)); EXPECT_CALL(mock_hmi_capabilities_, set_handle_response_for(*language)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(language)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(language, _)); smart_objects::SmartObjectSPtr support_language( new smart_objects::SmartObject(smart_objects::SmartType_Map)); @@ -106,14 +106,14 @@ class VRIsReadyRequestTest mock_message_helper_, CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetSupportedLanguages, _)) .WillOnce(Return(support_language)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(support_language)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(support_language, _)); smart_objects::SmartObjectSPtr capabilities( new smart_objects::SmartObject(smart_objects::SmartType_Map)); EXPECT_CALL(mock_message_helper_, CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetCapabilities, _)) .WillOnce(Return(capabilities)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(capabilities)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(capabilities, _)); } void PrepareEvent(bool is_message_contain_param, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc index 7c99b5f2b8..0023368b5a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc @@ -190,11 +190,11 @@ class AddCommandRequestTest EXPECT_CALL(mock_rpc_service_, ManageHMICommand( - HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) + HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) .WillOnce(Return(true)); EXPECT_CALL(mock_rpc_service_, ManageHMICommand( - HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand))) + HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _)) .WillOnce(Return(true)); } EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0); @@ -207,7 +207,7 @@ class AddCommandRequestTest EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(cmd_to_delete))) + ManageHMICommand(HMIResultCodeIs(cmd_to_delete), _)) .WillOnce(Return(true)); SmartObjectSPtr response = std::make_shared<SmartObject>(SmartType_Map); @@ -276,7 +276,7 @@ TEST_F(AddCommandRequestTest, Run_ImageVerificationFailed_EXPECT_WARNINGS) { commands_map, lock_ptr_))); EXPECT_CALL( mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) .WillOnce(Return(true)); std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); @@ -492,13 +492,13 @@ TEST_F(AddCommandRequestTest, { InSequence dummy; - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) .WillOnce(Return(true)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _)) .WillOnce(Return(true)); } EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0); @@ -522,7 +522,7 @@ TEST_F(AddCommandRequestTest, GetRunMethods_SUCCESS) { EXPECT_CALL( mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) .WillOnce(Return(true)); std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); @@ -547,7 +547,7 @@ TEST_F(AddCommandRequestTest, OnEvent_UI_SUCCESS) { EXPECT_CALL( mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) .WillOnce(Return(true)); EXPECT_CALL(*mock_app_, help_prompt_manager()) @@ -578,7 +578,7 @@ TEST_F(AddCommandRequestTest, OnEvent_VR_SUCCESS) { EXPECT_CALL( mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand))) + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _)) .WillOnce(Return(true)); EXPECT_CALL(*mock_app_, help_prompt_manager()) @@ -659,7 +659,7 @@ TEST_F(AddCommandRequestTest, EXPECT_CALL( mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) .WillOnce(Return(true)); std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); @@ -690,13 +690,13 @@ TEST_F(AddCommandRequestTest, { InSequence dummy; - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) .WillOnce(Return(true)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _)) .WillOnce(Return(true)); } EXPECT_CALL(mock_rpc_service_, @@ -734,13 +734,13 @@ TEST_F( commands_map, lock_ptr_))); { InSequence dummy; - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) .WillOnce(Return(true)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _)) .WillOnce(Return(true)); } @@ -779,13 +779,13 @@ TEST_F( { InSequence dummy; - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) .WillOnce(Return(true)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _)) .WillOnce(Return(true)); } @@ -824,13 +824,13 @@ TEST_F( { InSequence dummy; - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) .WillOnce(Return(true)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _)) .WillOnce(Return(true)); } std::shared_ptr<AddCommandRequest> request_ptr = @@ -873,13 +873,13 @@ TEST_F( commands_map, lock_ptr_))); { InSequence dummy; - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) .WillOnce(Return(true)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _)) .WillOnce(Return(true)); } std::shared_ptr<AddCommandRequest> request_ptr = @@ -921,7 +921,7 @@ TEST_F( commands_map, lock_ptr_))); EXPECT_CALL( mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) .WillOnce(Return(true)); std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); @@ -958,7 +958,7 @@ TEST_F( EXPECT_CALL( mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand))) + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _)) .WillOnce(Return(true)); std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); @@ -996,13 +996,13 @@ TEST_F(AddCommandRequestTest, commands_map, lock_ptr_))); { InSequence dummy; - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) .WillOnce(Return(true)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _)) .WillOnce(Return(true)); } EXPECT_CALL(mock_rpc_service_, @@ -1020,9 +1020,9 @@ TEST_F(AddCommandRequestTest, event_ui.set_smart_object(*msg_ui); Event event_vr(hmi_apis::FunctionID::VR_AddCommand); event_vr.set_smart_object(*msg_); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_DeleteCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::VR_DeleteCommand), _)) .WillOnce(Return(true)); EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)).Times(2); request_ptr->on_event(event_ui); @@ -1044,13 +1044,13 @@ TEST_F(AddCommandRequestTest, commands_map, lock_ptr_))); { InSequence dummy; - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) .WillOnce(Return(true)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _)) .WillOnce(Return(true)); } EXPECT_CALL(mock_rpc_service_, @@ -1063,9 +1063,9 @@ TEST_F(AddCommandRequestTest, Event event_ui(hmi_apis::FunctionID::UI_AddCommand); event_ui.set_smart_object(*msg_); request_ptr->on_event(event_ui); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteCommand), _)) .WillOnce(Return(true)); EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)).Times(2); Event event_vr(hmi_apis::FunctionID::VR_AddCommand); @@ -1119,13 +1119,13 @@ TEST_F(AddCommandRequestTest, OnTimeOut_AppRemoveCommandCalled) { .WillOnce(Return(so_ptr_.get())); { InSequence dummy; - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) .WillOnce(Return(true)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _)) .WillOnce(Return(true)); } EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc index e32cc2b335..a66d0d557f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc @@ -169,11 +169,11 @@ class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { void ExpectManageHmiCommandTTSAndUI() { EXPECT_CALL( mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_Alert))) + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_Alert), _)) .WillOnce(Return(true)); EXPECT_CALL( mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak))) + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak), _)) .WillOnce(Return(true)); } sync_primitives::Lock lock_; @@ -452,7 +452,7 @@ TEST_F(AlertRequestTest, OnEvent_UIAlertHasHmiResponsesToWait_UNSUCCESS) { EXPECT_CALL(mock_rpc_service_, ManageHMICommand( - HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking))); + HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking), _)); command->on_event(event); } @@ -477,10 +477,9 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSWarnings_SUCCESS) { (*msg_)[am::strings::msg_params][am::strings::tts_chunks], _, _)) .WillOnce(Return(mobile_apis::Result::SUCCESS)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak))) - .WillOnce(Return(true)); + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak), + _)).WillOnce(Return(true)); CommandPtr command(CreateCommand<AlertRequest>(msg_)); command->Run(); @@ -509,10 +508,9 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSUnsupportedResource_SUCCESS) { VerifyTtsFiles( (*msg_)[am::strings::msg_params][am::strings::tts_chunks], _, _)) .WillOnce(Return(mobile_apis::Result::SUCCESS)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak))) - .WillOnce(Return(true)); + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak), + _)).WillOnce(Return(true)); CommandPtr command(CreateCommand<AlertRequest>(msg_)); command->Run(); @@ -556,9 +554,9 @@ TEST_F(AlertRequestTest, CommandPtr command(CreateCommand<AlertRequest>(msg_)); command->Run(); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking), _)) .WillOnce(Return(true)); Event ui_event(hmi_apis::FunctionID::UI_Alert); @@ -605,9 +603,9 @@ TEST_F(AlertRequestTest, OnEvent_TTSUnsupportedResourceUiAlertSuccess_SUCCESS) { (*msg_)[am::strings::params][am::hmi_response::code] = hmi_apis::Common_Result::SUCCESS; - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking), _)) .WillOnce(Return(true)); Event ui_event(hmi_apis::FunctionID::UI_Alert); @@ -643,10 +641,9 @@ TEST_F(AlertRequestTest, OnEvent_TTSSuccesUiAlertInvalidEnum_SUCCESS) { VerifyTtsFiles( (*msg_)[am::strings::msg_params][am::strings::tts_chunks], _, _)) .WillOnce(Return(mobile_apis::Result::SUCCESS)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak))) - .WillOnce(Return(true)); + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak), + _)).WillOnce(Return(true)); CommandPtr command(CreateCommand<AlertRequest>(msg_)); command->Run(); @@ -654,9 +651,9 @@ TEST_F(AlertRequestTest, OnEvent_TTSSuccesUiAlertInvalidEnum_SUCCESS) { (*msg_)[am::strings::params][am::hmi_response::code] = hmi_apis::Common_Result::INVALID_ENUM; - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking), _)) .WillOnce(Return(true)); Event ui_event(hmi_apis::FunctionID::UI_Alert); @@ -693,10 +690,9 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSAbortedUiAlertNotSent_SUCCESS) { VerifyTtsFiles( (*msg_)[am::strings::msg_params][am::strings::tts_chunks], _, _)) .WillOnce(Return(mobile_apis::Result::SUCCESS)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak))) - .WillOnce(Return(true)); + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak), + _)).WillOnce(Return(true)); CommandPtr command(CreateCommand<AlertRequest>(msg_)); command->Run(); @@ -704,9 +700,9 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSAbortedUiAlertNotSent_SUCCESS) { (*msg_)[am::strings::params][am::hmi_response::code] = hmi_apis::Common_Result::INVALID_ENUM; - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking), _)) .WillOnce(Return(true)); Event ui_event(hmi_apis::FunctionID::UI_Alert); @@ -743,9 +739,9 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSWarningUiAlertWarning_SUCCESS) { CommandPtr command(CreateCommand<AlertRequest>(msg_)); command->Run(); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking), _)) .WillOnce(Return(true)); Event ui_event(hmi_apis::FunctionID::UI_Alert); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc index c42be48e57..3abda89234 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc @@ -232,7 +232,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnEvent_VR_UNSUPPORTED_RESOURCE) { .WillByDefault( Return(am::HmiInterfaces::HMI_INTERFACE_BasicCommunication)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true)); ON_CALL(mock_message_helper_, CheckChoiceSetVRCommands(_)) .WillByDefault(Return(am::MessageHelper::ChoiceSetVRCommandsStatus::ALL)); req_vr->Run(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc index 43c30809e5..c209c4fea2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc @@ -252,7 +252,7 @@ TEST_F(DeleteInteractionChoiceSetRequestTest, Run_SendVrDeleteCommand_SUCCESS) { EXPECT_CALL(*app_, UpdateHash()); } - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true)); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)); DeleteInteractionChoiceSetRequestPtr command = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc index f1c44f86ac..ff9e29c872 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc @@ -224,9 +224,9 @@ TEST_F(DeleteSubMenuRequestTest, Run_SendHMIRequest_SUCCESS) { EXPECT_CALL(app_mngr_, GetNextHMICorrelationID()) .WillOnce(Return(kCorrelationId)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteSubMenu))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteSubMenu), _)) .WillOnce(Return(true)); command_->Run(); } @@ -273,9 +273,9 @@ TEST_F(DeleteSubMenuRequestTest, OnEvent_DeleteSubmenu_SUCCESS) { EXPECT_CALL(*app_, app_id()).WillOnce(Return(kConnectionKey)); EXPECT_CALL(*app_, get_grammar_id()).WillOnce(Return(kGrammarId)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_DeleteCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::VR_DeleteCommand), _)) .WillOnce(Return(true)); EXPECT_CALL(*app_, commands_map()).WillOnce(Return(accessor_)); @@ -284,9 +284,9 @@ TEST_F(DeleteSubMenuRequestTest, OnEvent_DeleteSubmenu_SUCCESS) { EXPECT_CALL(*app_, help_prompt_manager()) .WillOnce(ReturnRef(*mock_help_prompt_manager_)); EXPECT_CALL(*mock_help_prompt_manager_, OnVrCommandDeleted(kCmdId, false)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteCommand), _)) .WillOnce(Return(true)); EXPECT_CALL(*app_, RemoveSubMenu(_)); @@ -330,7 +330,7 @@ TEST_F(DeleteSubMenuRequestTest, std::make_pair(0, &((*message_)[am::strings::msg_params]))); EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app_)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); EXPECT_CALL(*app_, commands_map()).Times(2).WillRepeatedly(Return(accessor_)); EXPECT_CALL(*app_, RemoveCommand(_)).Times(0); @@ -357,7 +357,7 @@ TEST_F(DeleteSubMenuRequestTest, std::make_pair(0, &((*message_)[am::strings::msg_params]))); EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app_)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); EXPECT_CALL(*app_, commands_map()).Times(2).WillRepeatedly(Return(accessor_)); EXPECT_CALL(*app_, RemoveCommand(_)).Times(0); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dial_number_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dial_number_request_test.cc index 5d6c6dc89e..ffa1b833be 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dial_number_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dial_number_request_test.cc @@ -131,9 +131,11 @@ TEST_F(DialNumberRequestTest, Run_SUCCESS) { MockAppPtr app(CreateMockApp()); EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::BasicCommunication_DialNumber))); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::BasicCommunication_DialNumber), + _)); command->Run(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc index 8589cbb6be..9c20143c39 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc @@ -62,6 +62,8 @@ #include "mobile/end_audio_pass_thru_request.h" #include "mobile/end_audio_pass_thru_response.h" #include "mobile/generic_response.h" +#include "mobile/get_file_request.h" +#include "mobile/get_file_response.h" #include "mobile/get_way_points_request.h" #include "mobile/get_way_points_response.h" #include "mobile/list_files_request.h" @@ -78,6 +80,7 @@ #include "mobile/on_keyboard_input_notification.h" #include "mobile/on_language_change_notification.h" #include "mobile/on_permissions_change_notification.h" +#include "mobile/on_system_capability_updated_notification.h" #include "mobile/on_system_request_notification.h" #include "mobile/on_tbt_client_state_notification.h" #include "mobile/on_touch_event_notification.h" @@ -220,6 +223,8 @@ typedef Types<commands::AddCommandRequest, commands::EndAudioPassThruRequest, commands::EndAudioPassThruResponse, commands::GenericResponse, + commands::GetFileRequest, + commands::GetFileResponse, commands::GetWayPointsRequest, commands::GetWayPointsResponse, commands::ListFilesRequest, @@ -236,12 +241,13 @@ typedef Types<commands::AddCommandRequest, commands::mobile::OnKeyBoardInputNotification, commands::OnLanguageChangeNotification, commands::OnPermissionsChangeNotification, - commands::mobile::OnSystemRequestNotification, - commands::OnTBTClientStateNotification, - commands::mobile::OnTouchEventNotification> + commands::mobile::OnSystemCapabilityUpdatedNotification> MobileCommandsListFirst; -typedef Types<commands::OnWayPointChangeNotification, +typedef Types<commands::mobile::OnSystemRequestNotification, + commands::OnTBTClientStateNotification, + commands::mobile::OnTouchEventNotification, + commands::OnWayPointChangeNotification, commands::PerformAudioPassThruRequest, commands::PerformAudioPassThruResponse, commands::PerformInteractionRequest, @@ -277,12 +283,12 @@ typedef Types<commands::OnWayPointChangeNotification, commands::SubscribeWayPointsRequest, commands::SubscribeWayPointsResponse, commands::SystemResponse, - commands::UnregisterAppInterfaceRequest, - commands::UnregisterAppInterfaceResponse, - commands::UnsubscribeButtonRequest, - commands::UnsubscribeButtonResponse> MobileCommandsListSecond; + commands::UnregisterAppInterfaceRequest> MobileCommandsListSecond; -typedef Types<commands::UnsubscribeWayPointsRequest, +typedef Types<commands::UnregisterAppInterfaceResponse, + commands::UnsubscribeButtonRequest, + commands::UnsubscribeButtonResponse, + commands::UnsubscribeWayPointsRequest, commands::UnsubscribeWayPointsResponse, commands::UpdateTurnListRequest, commands::UpdateTurnListResponse> MobileCommandsListThird; @@ -294,18 +300,18 @@ TYPED_TEST_CASE(MobileCommandsTestThird, MobileCommandsListThird); TYPED_TEST(MobileCommandsTestFirst, CtorAndDtorCall) { std::shared_ptr<typename TestFixture::CommandType> command = this->template CreateCommand<typename TestFixture::CommandType>(); - UNUSED(command); + EXPECT_NE(command.use_count(), 0); } TYPED_TEST(MobileCommandsTestSecond, CtorAndDtorCall) { std::shared_ptr<typename TestFixture::CommandType> command = this->template CreateCommand<typename TestFixture::CommandType>(); - UNUSED(command); + EXPECT_NE(command.use_count(), 0); } TYPED_TEST(MobileCommandsTestThird, CtorAndDtorCall) { std::shared_ptr<typename TestFixture::CommandType> command = this->template CreateCommand<typename TestFixture::CommandType>(); - UNUSED(command); + EXPECT_NE(command.use_count(), 0); } } // namespace dummy_mobile_commands_test diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_way_points_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_way_points_request_test.cc index 09a3336a10..f450d4b671 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_way_points_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_way_points_request_test.cc @@ -205,7 +205,7 @@ TEST_F(GetWayPointsRequestTest, OnEvent_DefaultCase) { EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)).Times(0); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); CallOnEvent caller(*command_sptr_, event); caller(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc index f51f1aa655..acda9b9fc7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc @@ -239,7 +239,7 @@ TEST_F(PerformAudioPassThruRequestTest, MessageSharedPtr response_to_mobile; uint32_t app_id = kConnectionKey; EXPECT_CALL(app_mngr_, EndAudioPassThru(app_id)).WillOnce(Return(false)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillRepeatedly(Return(true)); EXPECT_CALL( mock_rpc_service_, @@ -342,7 +342,7 @@ TEST_F(PerformAudioPassThruRequestTest, ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&speak_reqeust_result_msg), Return(true))); // Perform audio path thru request sending @@ -355,7 +355,7 @@ TEST_F(PerformAudioPassThruRequestTest, ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&perform_result_msg), Return(true))); } CallRun run_caller(*command_sptr_); @@ -431,7 +431,7 @@ TEST_F(PerformAudioPassThruRequestTest, ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&speak_reqeust_result_msg), Return(true))); // Perform audio path thru request sending @@ -444,7 +444,7 @@ TEST_F(PerformAudioPassThruRequestTest, ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&perform_result_msg), Return(true))); } CallRun caller(*command_sptr_); @@ -505,7 +505,7 @@ TEST_F(PerformAudioPassThruRequestTest, ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&speak_reqeust_result_msg), Return(true))); // Perform audio path thru request sending @@ -518,7 +518,7 @@ TEST_F(PerformAudioPassThruRequestTest, ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&perform_result_msg), Return(true))); } CallRun caller(*command_sptr_); @@ -551,7 +551,7 @@ TEST_F( .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); // Perform audio path thru request sending - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&perform_result_msg), Return(true))); // Perform audio path thru request sending @@ -564,7 +564,7 @@ TEST_F( .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); // Start recording notification sending - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&start_record_result_msg), Return(true))); } @@ -613,7 +613,7 @@ TEST_F(PerformAudioPassThruRequestTest, // Start recording notification sending - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true)); // Start microphone recording cals uint32_t app_id = kConnectionKey; @@ -676,7 +676,7 @@ TEST_F(PerformAudioPassThruRequestTest, msg_params_[am::strings::function_id] = kFunctionId; msg_params_[am::strings::correlation_id] = kCorrelationId; - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true)); uint32_t app_id = kConnectionKey; EXPECT_CALL(app_mngr_, BeginAudioPassThru(app_id)).WillOnce(Return(true)); @@ -703,7 +703,7 @@ TEST_F(PerformAudioPassThruRequestTest, msg_params_[am::strings::function_id] = kFunctionId; uint32_t app_id = kConnectionKey; - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true)); EXPECT_CALL(app_mngr_, BeginAudioPassThru(app_id)).WillOnce(Return(true)); EXPECT_CALL( @@ -751,7 +751,7 @@ TEST_F(PerformAudioPassThruRequestTest, EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)); command_sptr_->SendResponse(true, am::mobile_api::Result::SUCCESS); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); command_sptr_->onTimeOut(); } @@ -783,7 +783,7 @@ TEST_F(PerformAudioPassThruRequestTest, ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&speak_reqeust_result_msg), Return(true))); // Perform audio path thru request sending @@ -796,7 +796,7 @@ TEST_F(PerformAudioPassThruRequestTest, ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&perform_result_msg), Return(true))); MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map); @@ -807,7 +807,7 @@ TEST_F(PerformAudioPassThruRequestTest, // For setting is_active_tts_speak -> true - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .Times(2) .WillRepeatedly(Return(false)); CallRun caller(*command_sptr_); @@ -819,9 +819,9 @@ TEST_F(PerformAudioPassThruRequestTest, ManageMobileCommand(_, am::commands::Command::SOURCE_SDL)); command_sptr_->SendResponse(true, am::mobile_api::Result::SUCCESS); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking), _)) .WillOnce(Return(false)); command_sptr_->onTimeOut(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc index df4f69f0d0..415b559f82 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc @@ -315,10 +315,11 @@ TEST_F(PutFileRequestTest, Run_SendOnPutFileNotification_SUCCESS) { EXPECT_CALL(app_mngr_, SaveBinary(binary_data_, kStorageFolder, kFileName, kZeroOffset)) .WillOnce(Return(mobile_apis::Result::SUCCESS)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::BasicCommunication_OnPutFile))) - .WillOnce(Return(true)); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::BasicCommunication_OnPutFile), + _)).WillOnce(Return(true)); ExpectManageMobileCommandWithResultCode(mobile_apis::Result::SUCCESS); PutFileRequestPtr command(CreateCommand<PutFileRequest>(msg_)); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc index 7dab16fe35..868d353a85 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc @@ -207,27 +207,36 @@ class RegisterAppInterfaceRequestTest mock_rpc_service_, ManageMobileCommand(MobileResultCodeIs(response_result_code), _)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::BasicCommunication_OnAppRegistered))) - .Times(0); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs( + hmi_apis::FunctionID::BasicCommunication_OnAppRegistered), + _)).Times(0); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::Buttons_OnButtonSubscription))) - .Times(0); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription), + _)).Times(0); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::UI_ChangeRegistration))).Times(0); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_ChangeRegistration), _)) + .Times(0); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::TTS_ChangeRegistration))).Times(0); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::TTS_ChangeRegistration), _)) + .Times(0); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::VR_ChangeRegistration))).Times(0); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::VR_ChangeRegistration), _)) + .Times(0); EXPECT_CALL(app_mngr_, OnApplicationSwitched( @@ -297,13 +306,15 @@ TEST_F(RegisterAppInterfaceRequestTest, Run_MinimalData_SUCCESS) { EXPECT_CALL(app_mngr_, RegisterApplication(msg_)).WillOnce(Return(mock_app)); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::BasicCommunication_OnAppRegistered))) - .WillOnce(Return(true)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::Buttons_OnButtonSubscription))) - .WillOnce(Return(true)); + ManageHMICommand( + HMIResultCodeIs( + hmi_apis::FunctionID::BasicCommunication_OnAppRegistered), + _)).WillOnce(Return(true)); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription), + _)).WillOnce(Return(true)); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, am::commands::Command::SOURCE_SDL)) .Times(2); @@ -399,25 +410,27 @@ TEST_F(RegisterAppInterfaceRequestTest, .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE)); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::BasicCommunication_OnAppRegistered))) - .WillOnce(Return(true)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::Buttons_OnButtonSubscription))) - .WillOnce(Return(true)); + ManageHMICommand( + HMIResultCodeIs( + hmi_apis::FunctionID::BasicCommunication_OnAppRegistered), + _)).WillOnce(Return(true)); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription), + _)).WillOnce(Return(true)); EXPECT_CALL(mock_rpc_service_, ManageHMICommand( - HMIResultCodeIs(hmi_apis::FunctionID::VR_ChangeRegistration))) - .WillOnce(Return(true)); + HMIResultCodeIs(hmi_apis::FunctionID::VR_ChangeRegistration), + _)).WillOnce(Return(true)); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::TTS_ChangeRegistration))) - .WillOnce(Return(true)); + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::TTS_ChangeRegistration), + _)).WillOnce(Return(true)); EXPECT_CALL(mock_rpc_service_, ManageHMICommand( - HMIResultCodeIs(hmi_apis::FunctionID::UI_ChangeRegistration))) - .WillOnce(Return(true)); + HMIResultCodeIs(hmi_apis::FunctionID::UI_ChangeRegistration), + _)).WillOnce(Return(true)); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, am::commands::Command::SOURCE_SDL)) .Times(2); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc index 0e3cd685fa..38585319e4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc @@ -170,7 +170,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_InvalidVrHelp_UNSUCCESS) { EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_)) .WillOnce(Return(vr_help)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); command_->Run(); } @@ -238,12 +238,13 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_SUCCESS) { .WillOnce(Return(so_help_prompt.get())); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::UI_SetGlobalProperties))) - .WillOnce(Return(true)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::TTS_SetGlobalProperties))) + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), + _)).WillOnce(Return(true)); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::TTS_SetGlobalProperties), _)) .WillOnce(Return(true)); command_->Run(); @@ -275,9 +276,9 @@ TEST_F(ResetGlobalPropertiesRequestTest, EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_)) .WillOnce(Return(vr_help)); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::UI_SetGlobalProperties))) - .WillOnce(Return(true)); + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), + _)).WillOnce(Return(true)); command_->Run(); @@ -321,12 +322,13 @@ TEST_F(ResetGlobalPropertiesRequestTest, (*ui_msg)[am::strings::params][am::hmi_response::code] = hmi_apis::Common_Result::eType::SUCCESS; EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::UI_SetGlobalProperties))) - .WillOnce(Return(true)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::TTS_SetGlobalProperties))) + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), + _)).WillOnce(Return(true)); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::TTS_SetGlobalProperties), _)) .WillOnce(Return(true)); Event ui_event(hmi_apis::FunctionID::UI_SetGlobalProperties); ui_event.set_smart_object(*ui_msg); @@ -363,9 +365,9 @@ TEST_F(ResetGlobalPropertiesRequestTest, OnEvent_InvalidApp_NoHashUpdate) { EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true)); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::UI_SetGlobalProperties))) - .WillOnce(Return(true)); + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), + _)).WillOnce(Return(true)); smart_objects::SmartObjectSPtr vr_help = std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); @@ -413,12 +415,13 @@ TEST_F(ResetGlobalPropertiesRequestTest, EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true)); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::UI_SetGlobalProperties))) - .WillOnce(Return(true)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::TTS_SetGlobalProperties))) + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), + _)).WillOnce(Return(true)); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::TTS_SetGlobalProperties), _)) .WillOnce(Return(true)); ResetGlobalPropertiesRequestPtr command = @@ -478,12 +481,13 @@ TEST_F(ResetGlobalPropertiesRequestTest, EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true)); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::UI_SetGlobalProperties))) - .WillOnce(Return(true)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::TTS_SetGlobalProperties))) + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), + _)).WillOnce(Return(true)); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::TTS_SetGlobalProperties), _)) .WillOnce(Return(true)); command_->Run(); @@ -542,12 +546,13 @@ TEST_F(ResetGlobalPropertiesRequestTest, EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true)); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::UI_SetGlobalProperties))) - .WillOnce(Return(true)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::TTS_SetGlobalProperties))) + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), + _)).WillOnce(Return(true)); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::TTS_SetGlobalProperties), _)) .WillOnce(Return(true)); command_->Run(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_haptic_data_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_haptic_data_test.cc index 6c7127e48c..19f799448a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_haptic_data_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_haptic_data_test.cc @@ -102,7 +102,7 @@ TEST_F(SendHapticDataRequestTest, Run_SUCCESS) { EXPECT_CALL(mock_rpc_service_, ManageHMICommand( - HMIResultCodeIs(hmi_apis::FunctionID::UI_SendHapticData))) + HMIResultCodeIs(hmi_apis::FunctionID::UI_SendHapticData), _)) .WillOnce(Return(true)); SendHapticDataRequestPtr command(CreateCommand<SendHapticDataRequest>(msg_)); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc index 4f44293fc9..4cab3db2a3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc @@ -137,15 +137,16 @@ class SendLocationRequestTest void FinishSetup() { EXPECT_CALL(*mock_app_, hmi_app_id()).WillOnce(Return(kAppID)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::Navigation_SendLocation))); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::Navigation_SendLocation), _)); } void FinishSetupCancelled(mobile_apis::Result::eType result) { EXPECT_CALL(*mock_app_, hmi_app_id()).Times(0); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(MobileResultCodeIs(result), _)); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc index cd6af1512d..10ca925739 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc @@ -201,7 +201,7 @@ TEST_F(SetDisplayLayoutRequestTest, Run_SUCCESS) { GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE)); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(CheckMshCorrId(kCorrelationKey))) + ManageHMICommand(CheckMshCorrId(kCorrelationKey), _)) .WillOnce(Return(true)); command->Run(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc index 03aa5d85a1..94dbbc8b44 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc @@ -322,12 +322,13 @@ TEST_F(SetGlobalPropertiesRequestTest, (*msg_vr)[am::strings::msg_params][am::strings::help_prompt], _, _)) .WillOnce(Return(mobile_apis::Result::SUCCESS)); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::UI_SetGlobalProperties))) - .WillOnce(Return(true)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::TTS_SetGlobalProperties))) + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), + _)).WillOnce(Return(true)); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::TTS_SetGlobalProperties), _)) .WillOnce(Return(true)); (*msg_vr)[am::strings::params][am::hmi_response::code] = hmi_apis::Common_Result::SUCCESS; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_media_clock_timer_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_media_clock_timer_test.cc index a69d3d741b..04a7da60cf 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_media_clock_timer_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_media_clock_timer_test.cc @@ -179,7 +179,7 @@ TEST_F(SetMediaClockRequestTest, Run_UpdateCountUp_SUCCESS) { GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true)); command->Run(); } @@ -217,7 +217,7 @@ TEST_F(SetMediaClockRequestTest, Run_UpdateCountDown_SUCCESS) { GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true)); command->Run(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc index 4725af4671..4540980b9e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc @@ -125,7 +125,7 @@ class ShowRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { static_cast<int32_t>(field_name); msg_params[am::hmi_request::show_strings][0][am::hmi_request::field_text] = text_field_; - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)); EXPECT_CALL(*mock_app_, set_show_command(msg_params)); } @@ -143,7 +143,7 @@ class ShowRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)); EXPECT_CALL(*mock_app_, app_id()).Times(0); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); EXPECT_CALL(*mock_app_, set_show_command(_)).Times(0); } @@ -196,7 +196,7 @@ class ShowRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { } } - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)); EXPECT_CALL(*mock_app_, set_show_command(msg_params)); } @@ -272,7 +272,7 @@ TEST_F(ShowRequestTest, Run_SoftButtonExists_SUCCESS) { EXPECT_CALL( mock_message_helper_, SubscribeApplicationToSoftButton(creation_msg_params, _, kFunctionID)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)); EXPECT_CALL(*mock_app_, set_show_command(msg_params)); command->Run(); @@ -296,7 +296,7 @@ TEST_F(ShowRequestTest, Run_SoftButtonNotExists_SUCCESS) { smart_objects::SmartObject(smart_objects::SmartType_Array); EXPECT_CALL(*mock_app_, UnsubscribeFromSoftButtons(kFunctionID)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)); EXPECT_CALL(*mock_app_, set_show_command(msg_params)); command->Run(); @@ -321,7 +321,7 @@ TEST_F(ShowRequestTest, Run_SoftButtonExists_Canceled) { EXPECT_CALL(mock_message_helper_, SubscribeApplicationToSoftButton(_, _, _)) .Times(0); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); EXPECT_CALL(*mock_app_, set_show_command(_)).Times(0); command->Run(); @@ -348,7 +348,7 @@ TEST_F(ShowRequestTest, Run_Graphic_SUCCESS) { msg_params[am::hmi_request::show_strings] = smart_objects::SmartObject(smart_objects::SmartType_Array); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)); EXPECT_CALL(*mock_app_, set_show_command(msg_params)); command->Run(); @@ -375,7 +375,7 @@ TEST_F(ShowRequestTest, Run_Graphic_WARNINGS) { msg_params[am::hmi_request::show_strings] = smart_objects::SmartObject(smart_objects::SmartType_Array); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)); EXPECT_CALL(*mock_app_, set_show_command(msg_params)); command->Run(); @@ -398,7 +398,7 @@ TEST_F(ShowRequestTest, Run_Graphic_Canceled) { .WillOnce(Return(mobile_apis::Result::INVALID_DATA)); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)); EXPECT_CALL(*mock_app_, app_id()).Times(0); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0); command->Run(); @@ -421,7 +421,7 @@ TEST_F(ShowRequestTest, Run_Graphic_WrongSyntax) { EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)); EXPECT_CALL(*mock_app_, app_id()).Times(0); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0); command->Run(); @@ -447,7 +447,7 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_SUCCESS) { msg_params[am::strings::app_id] = kAppId; msg_params[am::hmi_request::show_strings] = smart_objects::SmartObject(smart_objects::SmartType_Array); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)); EXPECT_CALL(*mock_app_, set_show_command(msg_params)); command->Run(); @@ -473,7 +473,7 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_WARNINGS) { msg_params[am::strings::app_id] = kAppId; msg_params[am::hmi_request::show_strings] = smart_objects::SmartObject(smart_objects::SmartType_Array); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)); EXPECT_CALL(*mock_app_, set_show_command(msg_params)); command->Run(); @@ -497,7 +497,7 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_Canceled) { EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)); EXPECT_CALL(*mock_app_, app_id()).Times(0); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0); command->Run(); @@ -520,7 +520,7 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_WrongSyntax) { EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)); EXPECT_CALL(*mock_app_, app_id()).Times(0); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0); command->Run(); @@ -836,7 +836,7 @@ TEST_F(ShowRequestTest, Run_Alignment_SUCCESS) { msg_params[am::hmi_request::show_strings] = smart_objects::SmartObject(smart_objects::SmartType_Array); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)); EXPECT_CALL(*mock_app_, set_show_command(msg_params)); command->Run(); @@ -859,7 +859,7 @@ TEST_F(ShowRequestTest, Run_CustomPresets_SUCCESS) { msg_params[am::strings::app_id] = kAppId; msg_params[am::hmi_request::show_strings] = smart_objects::SmartObject(smart_objects::SmartType_Array); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)); EXPECT_CALL(*mock_app_, set_show_command(msg_params)); command->Run(); @@ -880,7 +880,7 @@ TEST_F(ShowRequestTest, Run_CustomPresets_WrongSyntax) { EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)); EXPECT_CALL(*mock_app_, app_id()).Times(0); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); EXPECT_CALL(*mock_app_, set_show_command(_)).Times(0); command->Run(); @@ -895,7 +895,7 @@ TEST_F(ShowRequestTest, Run_InvalidApp_Canceled) { .WillOnce(Return(MockAppPtr())); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)); EXPECT_CALL(*mock_app_, app_id()).Times(0); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); EXPECT_CALL(*mock_app_, set_show_command(_)).Times(0); command->Run(); @@ -910,7 +910,7 @@ TEST_F(ShowRequestTest, Run_EmptyParams_Canceled) { .WillOnce(Return(mock_app_)); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)); EXPECT_CALL(*mock_app_, app_id()).Times(0); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); EXPECT_CALL(*mock_app_, set_show_command(_)).Times(0); command->Run(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc index be14aebc8f..14e670a387 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc @@ -268,7 +268,7 @@ TEST_F(SliderRequestTest, Run_SUCCESS) { EXPECT_CALL( mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_Slider))); + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_Slider), _)); CommandPtr command(CreateCommand<SliderRequest>(msg_)); command->Run(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc index 9eb23eeee3..5dcbd7e6b9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc @@ -295,7 +295,7 @@ TEST_F(SpeakRequestTest, Run_MsgWithEmptyString_Success) { EXPECT_CALL( mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak))); + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak), _)); command->Run(); } @@ -315,7 +315,7 @@ TEST_F(SpeakRequestTest, Run_MsgCorrect_Success) { EXPECT_CALL( mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak))); + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak), _)); command->Run(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc index caca56e297..df3e778ee6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc @@ -182,7 +182,7 @@ TEST_F(SubscribeButtonRequestTest, Run_SUCCESS) { MessageSharedPtr hmi_result_msg; - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&hmi_result_msg), Return(true))); MessageSharedPtr mobile_result_msg; @@ -230,7 +230,7 @@ TEST_F(SubscribeButtonRequestTest, Run_SUCCESS_App_Base_RPC_Version) { MessageSharedPtr hmi_result_msg; - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&hmi_result_msg), Return(true))); MessageSharedPtr mobile_result_msg; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc index 9e6bc8f505..298661dc74 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc @@ -160,7 +160,7 @@ TEST_F(SystemRequestTest, .WillOnce(Return(mobile_apis::Result::SUCCESS)); smart_objects::SmartObjectSPtr result; - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&result), Return(true))); std::shared_ptr<SystemRequest> command(CreateCommand<SystemRequest>(msg)); @@ -201,7 +201,7 @@ TEST_F( .WillOnce(Return(false)); ExpectManageMobileCommandWithResultCode(mobile_apis::Result::DISALLOWED); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); std::shared_ptr<SystemRequest> command(CreateCommand<SystemRequest>(msg)); ASSERT_TRUE(command->Init()); @@ -222,7 +222,7 @@ TEST_F(SystemRequestTest, Run_RequestTypeDisallowed_SendDisallowedResponse) { .WillOnce(Return(false)); ExpectManageMobileCommandWithResultCode(mobile_apis::Result::DISALLOWED); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); std::shared_ptr<SystemRequest> command(CreateCommand<SystemRequest>(msg)); ASSERT_TRUE(command->Init()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc index a848fff2b2..22893b771c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc @@ -139,9 +139,11 @@ TEST_F(UnsubscribeButtonRequestTest, Run_SUCCESS) { EXPECT_CALL(*mock_app, UnsubscribeFromButton(kButtonId)) .WillOnce(Return(true)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::Buttons_OnButtonSubscription))); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription), + _)); EXPECT_CALL( mock_rpc_service_, ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _)); @@ -182,9 +184,11 @@ TEST_F(UnsubscribeButtonRequestTest, Run_SUCCESS_Base_RPC_Version) { EXPECT_CALL(*mock_app, UnsubscribeFromButton(mobile_apis::ButtonName::PLAY_PAUSE)) .WillOnce(Return(true)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::Buttons_OnButtonSubscription))); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription), + _)); EXPECT_CALL( mock_rpc_service_, ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _)); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc index f345d719c6..05e15a78af 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc @@ -122,9 +122,16 @@ TEST_F(UnsubscribeWayPointsRequestTest, Run_AppSubscribedForWayPoints_SUCCESS) { ::testing::Matcher<am::ApplicationSharedPtr>(mock_app))) .WillOnce(Return(true)); + const std::set<uint32_t> subscribed_apps{kConnectionKey}; + + EXPECT_CALL(app_mngr_, GetAppsSubscribedForWayPoints()) + .WillOnce(Return(subscribed_apps)); + EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints))); + ManageHMICommand( + HMIResultCodeIs( + hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints), + _)); command_->Run(); } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_command_factory.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_command_factory.cc index 32959174da..0c6e0a07b1 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_command_factory.cc @@ -53,7 +53,8 @@ VehicleInfoCommandFactory::~VehicleInfoCommandFactory() {} app_mngr::CommandSharedPtr VehicleInfoCommandFactory::CreateCommand( const app_mngr::commands::MessageSharedPtr& message, app_mngr::commands::Command::CommandSource source) { - if (app_mngr::commands::Command::SOURCE_HMI == source) { + if (app_mngr::commands::Command::SOURCE_HMI == source || + app_mngr::commands::Command::SOURCE_SDL_TO_HMI == source) { return hmi_command_factory_->CreateCommand(message, source); } else { return mob_command_factory_->CreateCommand(message, source); @@ -63,7 +64,8 @@ app_mngr::CommandSharedPtr VehicleInfoCommandFactory::CreateCommand( bool VehicleInfoCommandFactory::IsAbleToProcess( const int32_t function_id, const commands::Command::CommandSource source) const { - return commands::Command::SOURCE_HMI == source + return (commands::Command::SOURCE_HMI == source || + app_mngr::commands::Command::SOURCE_SDL_TO_HMI == source) ? hmi_command_factory_->IsAbleToProcess(function_id, source) : mob_command_factory_->IsAbleToProcess(function_id, source); } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc index d0bcc36ab4..c9e9839929 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc @@ -33,6 +33,7 @@ #include "vehicle_info_plugin/vehicle_info_plugin.h" #include "vehicle_info_plugin/vehicle_info_command_factory.h" #include "vehicle_info_plugin/vehicle_info_app_extension.h" +#include "application_manager/plugin_manager/plugin_keys.h" #include "application_manager/smart_object_keys.h" #include "application_manager/message_helper.h" #include "application_manager/message_helper.h" @@ -41,6 +42,7 @@ namespace vehicle_info_plugin { CREATE_LOGGERPTR_GLOBAL(logger_, "VehicleInfoPlugin") namespace strings = application_manager::strings; +namespace plugins = application_manager::plugin_manager; VehicleInfoPlugin::VehicleInfoPlugin() : application_manager_(nullptr) {} @@ -61,7 +63,7 @@ bool VehicleInfoPlugin::IsAbleToProcess( } std::string VehicleInfoPlugin::PluginName() { - return "Vehicle Info Plugin"; + return plugins::plugin_names::vehicle_info_rpc_plugin; } app_mngr::CommandFactory& VehicleInfoPlugin::GetCommandFactory() { diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_is_ready_request_test.cc index d4477d5d5f..679d9d0e58 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_is_ready_request_test.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_is_ready_request_test.cc @@ -101,7 +101,7 @@ class VIIsReadyRequestTest mock_message_helper_, CreateModuleInfoSO(hmi_apis::FunctionID::VehicleInfo_GetVehicleType, _)) .WillOnce(Return(ivi_type)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(ivi_type)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(ivi_type, _)); } void PrepareEvent(bool is_message_contain_param, diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/diagnostic_message_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/diagnostic_message_request_test.cc index 9cdf60b1ea..b27a306a5c 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/diagnostic_message_request_test.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/diagnostic_message_request_test.cc @@ -141,9 +141,11 @@ TEST_F(DiagnosticMessageRequestTest, Run_SUCCESS) { EXPECT_CALL(app_mngr_settings_, supported_diag_modes()) .WillOnce(ReturnRef(supported_diag_modes)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::VehicleInfo_DiagnosticMessage))); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::VehicleInfo_DiagnosticMessage), + _)); command->Run(); } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_dtcs_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_dtcs_request_test.cc index 4473a36c63..981d649a94 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_dtcs_request_test.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_dtcs_request_test.cc @@ -98,9 +98,10 @@ TEST_F(GetDTCsRequestTest, Run_SUCCESS) { MockAppPtr app(CreateMockApp()); EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand( - HMIResultCodeIs(hmi_apis::FunctionID::VehicleInfo_GetDTCs))); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::VehicleInfo_GetDTCs), _)); command->Run(); } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_request_test.cc index a88d362968..cb78e44904 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_request_test.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_request_test.cc @@ -200,9 +200,11 @@ TEST_F(GetVehicleDataRequestTest, Run_SUCCESS) { MockAppPtr app(CreateMockApp()); EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::VehicleInfo_GetVehicleData))); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::VehicleInfo_GetVehicleData), + _)); command->Run(); } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc index 323334de2d..165c7694b1 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc @@ -149,9 +149,10 @@ TEST_F(UnsubscribeVehicleRequestTest, .WillOnce(Return(mock_app_)); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData))) - .WillOnce(Return(true)); + ManageHMICommand( + HMIResultCodeIs( + hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData), + _)).WillOnce(Return(true)); vehicle_info_plugin::VehicleInfoAppExtension* vi_app_extension = dynamic_cast<vehicle_info_plugin::VehicleInfoAppExtension*>( vi_app_extension_ptr_.get()); |