diff options
Diffstat (limited to 'src/components/application_manager/rpc_plugins/sdl_rpc_plugin')
53 files changed, 1978 insertions, 320 deletions
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/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/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/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..73ec1137a8 --- /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,165 @@ +/* + 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/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().GetAllServices(); + 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/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..2b3611fece --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc @@ -0,0 +1,355 @@ +/* + 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/application_impl.h" +#include "application_manager/rpc_service.h" +#include "interfaces/MOBILE_API.h" +#include "application_manager/message_helper.h" +#include "application_manager/app_service_manager.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..63a4416139 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 @@ -31,6 +31,9 @@ */ #include "sdl_rpc_plugin/commands/mobile/get_system_capability_request.h" +#include "sdl_rpc_plugin/extensions/system_capability_app_extension.h" +#include "application_manager/message_helper.h" +#include <set> namespace sdl_rpc_plugin { using namespace application_manager; @@ -80,10 +83,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 +141,34 @@ void GetSystemCapabilityRequest::Run() { return; } break; + case mobile_apis::SystemCapabilityType::APP_SERVICES: { + auto all_services = + application_manager_.GetAppServiceManager().GetAllServices(); + 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..b5e3a73ee4 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc @@ -0,0 +1,175 @@ +#include "sdl_rpc_plugin/commands/mobile/on_system_capability_updated_notification.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().GetAllServices(); + 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/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..3cfe4d7118 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,6 +240,10 @@ #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; @@ -840,6 +844,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 5ef76b59ef..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" @@ -128,6 +129,8 @@ #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") @@ -235,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>() @@ -396,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/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 8543a201bf..a90c0c70fc 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 @@ -166,9 +166,9 @@ TEST_F(SDLActivateAppRequestTest, DISABLED_Run_DeactivateApp_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(); @@ -487,7 +487,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/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..818ee06e96 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 @@ -123,8 +123,10 @@ TEST_F(UnsubscribeWayPointsRequestTest, Run_AppSubscribedForWayPoints_SUCCESS) { .WillOnce(Return(true)); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints))); + ManageHMICommand( + HMIResultCodeIs( + hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints), + _)); command_->Run(); } |