diff options
author | Andrey Oleynik (GitHub) <aoleynik@luxoft.com> | 2017-09-21 19:03:44 +0300 |
---|---|---|
committer | Andriy Byzhynar <AByzhynar@luxoft.com> | 2018-01-18 11:28:38 +0200 |
commit | 7d03482c7f9689a375cd87f3acabda1b9af7624f (patch) | |
tree | 7840ca08e1c3697fd0beb188efcb6a53df75b9d9 /src | |
parent | 8fa4f3b498916b89552394d25f9482ce4b06de5a (diff) | |
download | sdl_core-7d03482c7f9689a375cd87f3acabda1b9af7624f.tar.gz |
Reverts deprecated interfaces
Diffstat (limited to 'src')
33 files changed, 796 insertions, 86 deletions
diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h index 63b8589b59..4e10d8d435 100644 --- a/src/components/application_manager/include/application_manager/application.h +++ b/src/components/application_manager/include/application_manager/application.h @@ -561,6 +561,8 @@ class Application : public virtual InitialApplicationData, virtual void increment_list_files_in_none_count() = 0; virtual bool set_app_icon_path(const std::string& file_name) = 0; virtual void set_app_allowed(const bool allowed) = 0; + // DEPRECATED + virtual void set_device(connection_handler::DeviceHandle device) = 0; virtual uint32_t get_grammar_id() const = 0; virtual void set_grammar_id(uint32_t value) = 0; @@ -713,6 +715,16 @@ class Application : public virtual InitialApplicationData, virtual bool IsAudioApplication() const = 0; /** + * DEPRECATED + * @brief GetDeviceId allows to obtain device id which posseses + * by this application. + * @return device the device id. + */ + std::string GetDeviceId() const { + return device_id_; + } + + /** * @brief IsRegistered allows to distinguish if this * application has been registered. * @@ -857,6 +869,7 @@ class Application : public virtual InitialApplicationData, ApplicationState state_; std::string url_; std::string package_name_; + std::string device_id_; ssize_t connection_id_; bool is_greyed_out_; }; diff --git a/src/components/application_manager/include/application_manager/application_impl.h b/src/components/application_manager/include/application_manager/application_impl.h index e0e3d317e3..5d12cab6ba 100644 --- a/src/components/application_manager/include/application_manager/application_impl.h +++ b/src/components/application_manager/include/application_manager/application_impl.h @@ -173,6 +173,8 @@ class ApplicationImpl : public virtual Application, void increment_list_files_in_none_count(); bool set_app_icon_path(const std::string& path); void set_app_allowed(const bool allowed); + // DEPRECATED + void set_device(connection_handler::DeviceHandle device); virtual uint32_t get_grammar_id() const; virtual void set_grammar_id(uint32_t value); bool is_audio() const OVERRIDE; diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h index 754a2bfa43..f0c8d459a1 100644 --- a/src/components/application_manager/include/application_manager/application_manager_impl.h +++ b/src/components/application_manager/include/application_manager/application_manager_impl.h @@ -531,6 +531,21 @@ class ApplicationManagerImpl mobile_apis::SystemContext::eType system_context) const OVERRIDE; /** + * DEPRECATED + * @brief CreateRegularState create regular HMI state for application + * @param app_id Application id + * @param hmi_level of returned state + * @param audio_state of returned state + * @param system_context of returned state + * @return new regular HMI state + */ + HmiStatePtr CreateRegularState( + uint32_t app_id, + mobile_apis::HMILevel::eType hmi_level, + mobile_apis::AudioStreamingState::eType audio_state, + mobile_apis::SystemContext::eType system_context) const OVERRIDE; + + /** * @brief SetState set regular audio state * @param app_id applicatio id * @param audio_state aaudio streaming state @@ -1022,15 +1037,15 @@ class ApplicationManagerImpl uint32_t GenerateNewHMIAppID() OVERRIDE; /** + * DERPECATED * @brief Parse smartObject and replace mobile app Id by HMI app ID - * * @param message Smartobject to be parsed */ void ReplaceMobileByHMIAppId(smart_objects::SmartObject& message); /** + * DEPRECATED * @brief Parse smartObject and replace HMI app ID by mobile app Id - * * @param message Smartobject to be parsed */ void ReplaceHMIByMobileAppId(smart_objects::SmartObject& message); diff --git a/src/components/application_manager/include/application_manager/commands/command_impl.h b/src/components/application_manager/include/application_manager/commands/command_impl.h index 32e50fe4f1..5fee7500ce 100644 --- a/src/components/application_manager/include/application_manager/commands/command_impl.h +++ b/src/components/application_manager/include/application_manager/commands/command_impl.h @@ -146,14 +146,28 @@ class CommandImpl : public Command { * @param message Message to replace its ids * @return True if replacement succeeded, otherwise - false */ - bool ReplaceMobileByHMIAppId(smart_objects::SmartObject& message); + bool ReplaceMobileWithHMIAppId(smart_objects::SmartObject& message); + + /** + * DEPRECATED + * @brief Parses mobile message and replaces mobile app id with HMI app id + * @param message Message to replace its ids + */ + void ReplaceMobileByHMIAppId(smart_objects::SmartObject& message); /** * @brief Parses message from HMI and replaces HMI app id with mobile app id * @param message Message to replace its ids * @return True if replacement succeeded, otherwise - false */ - bool ReplaceHMIByMobileAppId(smart_objects::SmartObject& message); + bool ReplaceHMIWithMobileAppId(smart_objects::SmartObject& message); + + /** + * DEPRECATED + * @brief Parses message from HMI and replaces HMI app id with mobile app id + * @param message Message to replace its ids + */ + void ReplaceHMIByMobileAppId(smart_objects::SmartObject& message); MessageSharedPtr message_; uint32_t default_timeout_; diff --git a/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h b/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h index 938981f382..a7c627b529 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h @@ -77,6 +77,12 @@ class RegisterAppInterfaceRequest : public CommandRequestImpl { **/ virtual void Run(); + /** + * @brief Prepares and sends RegisterAppInterface response to mobile + * considering application type + **/ + void SendRegisterAppInterfaceResponseToMobile(); + private: /** * @brief The AppicationType enum defines whether application is newly diff --git a/src/components/application_manager/include/application_manager/hmi_state.h b/src/components/application_manager/include/application_manager/hmi_state.h index 16d6d2c271..a747c9b0f7 100644 --- a/src/components/application_manager/include/application_manager/hmi_state.h +++ b/src/components/application_manager/include/application_manager/hmi_state.h @@ -89,6 +89,25 @@ class HmiState { const ApplicationManager& app_mngr, StateID state_id); + /** + * DEPRECATED + * @brief HmiState constructor + * @param app_id Application id + * @param app_mngr Application manager + */ + HmiState(uint32_t app_id, const ApplicationManager& app_mngr); + + /** + * DEPRECATED + * @brief HmiState constructor + * @param app_id Application id + * @param app_mngr Application manager + * @param state_id HMI state to assign + */ + HmiState(uint32_t app_id, + const ApplicationManager& app_mngr, + StateID state_id); + virtual ~HmiState() {} /** @@ -227,6 +246,9 @@ class VRHmiState : public HmiState { const OVERRIDE; VRHmiState(utils::SharedPtr<Application> app, const ApplicationManager& app_mngr); + + // DEPRECATED + VRHmiState(uint32_t app_id, const ApplicationManager& app_mngr); }; /** @@ -236,6 +258,10 @@ class TTSHmiState : public HmiState { public: TTSHmiState(utils::SharedPtr<Application> app, const ApplicationManager& app_mngr); + + // DEPRECATED + TTSHmiState(uint32_t app_id, const ApplicationManager& app_mngr); + virtual mobile_apis::AudioStreamingState::eType audio_streaming_state() const OVERRIDE; }; @@ -248,6 +274,10 @@ class NaviStreamingHmiState : public HmiState { public: NaviStreamingHmiState(utils::SharedPtr<Application> app, const ApplicationManager& app_mngr); + + // DEPRECATED + NaviStreamingHmiState(uint32_t app_id, const ApplicationManager& app_mngr); + mobile_apis::AudioStreamingState::eType audio_streaming_state() const OVERRIDE; }; @@ -260,6 +290,10 @@ class PhoneCallHmiState : public HmiState { public: PhoneCallHmiState(utils::SharedPtr<Application> app, const ApplicationManager& app_mngr); + + // DEPRECATED + PhoneCallHmiState(uint32_t app_id, const ApplicationManager& app_mngr); + mobile_apis::HMILevel::eType hmi_level() const OVERRIDE; mobile_apis::AudioStreamingState::eType audio_streaming_state() const OVERRIDE { @@ -275,6 +309,10 @@ class SafetyModeHmiState : public HmiState { public: SafetyModeHmiState(utils::SharedPtr<Application> app, const ApplicationManager& app_mngr); + + // DEPRECATED + SafetyModeHmiState(uint32_t app_id, const ApplicationManager& app_mngr); + mobile_apis::AudioStreamingState::eType audio_streaming_state() const OVERRIDE { return mobile_apis::AudioStreamingState::NOT_AUDIBLE; @@ -289,6 +327,10 @@ class DeactivateHMI : public HmiState { public: DeactivateHMI(utils::SharedPtr<Application> app, const ApplicationManager& app_mngr); + + // DEPRECATED + DeactivateHMI(uint32_t app_id, const ApplicationManager& app_mngr); + mobile_apis::HMILevel::eType hmi_level() const OVERRIDE; mobile_apis::AudioStreamingState::eType audio_streaming_state() const OVERRIDE { @@ -304,6 +346,10 @@ class AudioSource : public HmiState { public: AudioSource(utils::SharedPtr<Application> app, const ApplicationManager& app_mngr); + + // DEPRECATED + AudioSource(uint32_t app_id, const ApplicationManager& app_mngr); + mobile_apis::HMILevel::eType hmi_level() const OVERRIDE; mobile_apis::AudioStreamingState::eType audio_streaming_state() const OVERRIDE { @@ -320,6 +366,10 @@ class EmbeddedNavi : public HmiState { public: EmbeddedNavi(utils::SharedPtr<Application> app, const ApplicationManager& app_mngr); + + // DEPRECATED + EmbeddedNavi(uint32_t app_id, const ApplicationManager& app_mngr); + mobile_apis::HMILevel::eType hmi_level() const OVERRIDE; mobile_apis::AudioStreamingState::eType audio_streaming_state() const OVERRIDE { diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc index 467d606f06..8af4c97543 100644 --- a/src/components/application_manager/src/application_impl.cc +++ b/src/components/application_manager/src/application_impl.cc @@ -612,6 +612,11 @@ void ApplicationImpl::set_app_allowed(const bool allowed) { is_app_allowed_ = allowed; } +// DEPRECATED +void ApplicationImpl::set_device(connection_handler::DeviceHandle device) { + device_id_ = device; +} + uint32_t ApplicationImpl::get_grammar_id() const { return grammar_id_; } diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index 20083702d4..fe9d2d8370 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -839,6 +839,18 @@ HmiStatePtr ApplicationManagerImpl::CreateRegularState( return state; } +HmiStatePtr ApplicationManagerImpl::CreateRegularState( + uint32_t app_id, + mobile_apis::HMILevel::eType hmi_level, + mobile_apis::AudioStreamingState::eType audio_state, + mobile_apis::SystemContext::eType system_context) const { + HmiStatePtr state(new HmiState(app_id, *this)); + state->set_hmi_level(hmi_level); + state->set_audio_streaming_state(audio_state); + state->set_system_context(system_context); + return state; +} + bool ApplicationManagerImpl::IsStateActive(HmiState::StateID state_id) const { LOG4CXX_AUTO_TRACE(logger_); LOG4CXX_DEBUG(logger_, "Checking for active state id " << state_id); diff --git a/src/components/application_manager/src/commands/command_impl.cc b/src/components/application_manager/src/commands/command_impl.cc index d17f6cdc10..f9cb09816e 100644 --- a/src/components/application_manager/src/commands/command_impl.cc +++ b/src/components/application_manager/src/commands/command_impl.cc @@ -94,7 +94,7 @@ void CommandImpl::SetAllowedToTerminate(const bool allowed) { allowed_to_terminate_ = allowed; } -bool CommandImpl::ReplaceMobileByHMIAppId( +bool CommandImpl::ReplaceMobileWithHMIAppId( NsSmartDeviceLink::NsSmartObjects::SmartObject& message) { if (message.keyExists(strings::app_id)) { ApplicationSharedPtr application = @@ -104,7 +104,7 @@ bool CommandImpl::ReplaceMobileByHMIAppId( return false; } LOG4CXX_DEBUG(logger_, - "ReplaceMobileByHMIAppId from " + "ReplaceMobileWithHMIAppId from " << message[strings::app_id].asInt() << " to " << application->hmi_app_id()); message[strings::app_id] = application->hmi_app_id(); @@ -114,7 +114,7 @@ bool CommandImpl::ReplaceMobileByHMIAppId( smart_objects::SmartArray* message_array = message.asArray(); smart_objects::SmartArray::iterator it = message_array->begin(); for (; it != message_array->end(); ++it) { - ReplaceMobileByHMIAppId(*it); + ReplaceMobileWithHMIAppId(*it); } break; } @@ -123,7 +123,7 @@ bool CommandImpl::ReplaceMobileByHMIAppId( std::set<std::string>::const_iterator key = keys.begin(); for (; key != keys.end(); ++key) { std::string k = *key; - ReplaceMobileByHMIAppId(message[*key]); + ReplaceMobileWithHMIAppId(message[*key]); } break; } @@ -134,7 +134,44 @@ bool CommandImpl::ReplaceMobileByHMIAppId( return true; } -bool CommandImpl::ReplaceHMIByMobileAppId( +// DEPRECATED +void CommandImpl::ReplaceMobileByHMIAppId( + NsSmartDeviceLink::NsSmartObjects::SmartObject& message) { + if (message.keyExists(strings::app_id)) { + ApplicationSharedPtr application = + application_manager_.application(message[strings::app_id].asUInt()); + if (application.valid()) { + LOG4CXX_DEBUG(logger_, + "ReplaceMobileWithHMIAppId from " + << message[strings::app_id].asInt() << " to " + << application->hmi_app_id()); + message[strings::app_id] = application->hmi_app_id(); + } + } else { + switch (message.getType()) { + case smart_objects::SmartType::SmartType_Array: { + smart_objects::SmartArray* message_array = message.asArray(); + smart_objects::SmartArray::iterator it = message_array->begin(); + for (; it != message_array->end(); ++it) { + ReplaceMobileWithHMIAppId(*it); + } + break; + } + case smart_objects::SmartType::SmartType_Map: { + std::set<std::string> keys = message.enumerate(); + std::set<std::string>::const_iterator key = keys.begin(); + for (; key != keys.end(); ++key) { + std::string k = *key; + ReplaceMobileWithHMIAppId(message[*key]); + } + break; + } + default: { break; } + } + } +} + +bool CommandImpl::ReplaceHMIWithMobileAppId( NsSmartDeviceLink::NsSmartObjects::SmartObject& message) { if (message.keyExists(strings::app_id)) { ApplicationSharedPtr application = @@ -146,7 +183,7 @@ bool CommandImpl::ReplaceHMIByMobileAppId( return false; } LOG4CXX_DEBUG(logger_, - "ReplaceHMIByMobileAppId from " + "ReplaceHMIWithMobileAppId from " << message[strings::app_id].asInt() << " to " << application->app_id()); message[strings::app_id] = application->app_id(); @@ -156,7 +193,7 @@ bool CommandImpl::ReplaceHMIByMobileAppId( smart_objects::SmartArray* message_array = message.asArray(); smart_objects::SmartArray::iterator it = message_array->begin(); for (; it != message_array->end(); ++it) { - ReplaceHMIByMobileAppId(*it); + ReplaceHMIWithMobileAppId(*it); } break; } @@ -164,7 +201,7 @@ bool CommandImpl::ReplaceHMIByMobileAppId( std::set<std::string> keys = message.enumerate(); std::set<std::string>::const_iterator key = keys.begin(); for (; key != keys.end(); ++key) { - ReplaceHMIByMobileAppId(message[*key]); + ReplaceHMIWithMobileAppId(message[*key]); } break; } @@ -175,5 +212,43 @@ bool CommandImpl::ReplaceHMIByMobileAppId( return true; } +// DEPRECATED +void CommandImpl::ReplaceHMIByMobileAppId( + NsSmartDeviceLink::NsSmartObjects::SmartObject& message) { + if (message.keyExists(strings::app_id)) { + ApplicationSharedPtr application = + application_manager_.application_by_hmi_app( + message[strings::app_id].asUInt()); + + if (application.valid()) { + LOG4CXX_DEBUG(logger_, + "ReplaceHMIByMobileAppId from " + << message[strings::app_id].asInt() << " to " + << application->app_id()); + message[strings::app_id] = application->app_id(); + } + } else { + switch (message.getType()) { + case smart_objects::SmartType::SmartType_Array: { + smart_objects::SmartArray* message_array = message.asArray(); + smart_objects::SmartArray::iterator it = message_array->begin(); + for (; it != message_array->end(); ++it) { + ReplaceHMIByMobileAppId(*it); + } + break; + } + case smart_objects::SmartType::SmartType_Map: { + std::set<std::string> keys = message.enumerate(); + std::set<std::string>::const_iterator key = keys.begin(); + for (; key != keys.end(); ++key) { + ReplaceHMIByMobileAppId(message[*key]); + } + break; + } + default: { break; } + } + } +} + } // namespace commands } // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/notification_from_hmi.cc b/src/components/application_manager/src/commands/hmi/notification_from_hmi.cc index 64eb63fde8..3c2d73b10c 100644 --- a/src/components/application_manager/src/commands/hmi/notification_from_hmi.cc +++ b/src/components/application_manager/src/commands/hmi/notification_from_hmi.cc @@ -42,7 +42,7 @@ NotificationFromHMI::NotificationFromHMI( const MessageSharedPtr& message, ApplicationManager& application_manager) : CommandImpl(message, application_manager) { // Replace HMI app id with Mobile connection id - ReplaceHMIByMobileAppId(*message); + ReplaceHMIWithMobileAppId(*message); } NotificationFromHMI::~NotificationFromHMI() {} diff --git a/src/components/application_manager/src/commands/hmi/notification_to_hmi.cc b/src/components/application_manager/src/commands/hmi/notification_to_hmi.cc index 7e24dce8d9..b6639c9aea 100644 --- a/src/components/application_manager/src/commands/hmi/notification_to_hmi.cc +++ b/src/components/application_manager/src/commands/hmi/notification_to_hmi.cc @@ -44,7 +44,7 @@ NotificationToHMI::NotificationToHMI(const MessageSharedPtr& message, NotificationToHMI::~NotificationToHMI() {} bool NotificationToHMI::Init() { - return ReplaceMobileByHMIAppId(*message_); + return ReplaceMobileWithHMIAppId(*message_); } bool NotificationToHMI::CleanUp() { diff --git a/src/components/application_manager/src/commands/hmi/request_from_hmi.cc b/src/components/application_manager/src/commands/hmi/request_from_hmi.cc index 1119e7c4fd..c91423e369 100644 --- a/src/components/application_manager/src/commands/hmi/request_from_hmi.cc +++ b/src/components/application_manager/src/commands/hmi/request_from_hmi.cc @@ -43,7 +43,7 @@ RequestFromHMI::RequestFromHMI(const MessageSharedPtr& message, : CommandImpl(message, application_manager) , EventObserver(application_manager.event_dispatcher()) { // Replace HMI app id with Mobile connection id - ReplaceHMIByMobileAppId(*(message.get())); + ReplaceHMIWithMobileAppId(*(message.get())); } RequestFromHMI::~RequestFromHMI() {} diff --git a/src/components/application_manager/src/commands/hmi/request_to_hmi.cc b/src/components/application_manager/src/commands/hmi/request_to_hmi.cc index f26dc26ef6..cba36cbb0c 100644 --- a/src/components/application_manager/src/commands/hmi/request_to_hmi.cc +++ b/src/components/application_manager/src/commands/hmi/request_to_hmi.cc @@ -66,7 +66,7 @@ RequestToHMI::RequestToHMI(const MessageSharedPtr& message, RequestToHMI::~RequestToHMI() {} bool RequestToHMI::Init() { - return ReplaceMobileByHMIAppId(*message_); + return ReplaceMobileWithHMIAppId(*message_); } bool RequestToHMI::CleanUp() { diff --git a/src/components/application_manager/src/commands/hmi/response_from_hmi.cc b/src/components/application_manager/src/commands/hmi/response_from_hmi.cc index 23d8e6e229..c5a6dd9d3e 100644 --- a/src/components/application_manager/src/commands/hmi/response_from_hmi.cc +++ b/src/components/application_manager/src/commands/hmi/response_from_hmi.cc @@ -48,7 +48,7 @@ ResponseFromHMI::ResponseFromHMI(const MessageSharedPtr& message, } // Replace HMI app id with Mobile connection id - ReplaceHMIByMobileAppId(*(message.get())); + ReplaceHMIWithMobileAppId(*(message.get())); } ResponseFromHMI::~ResponseFromHMI() {} diff --git a/src/components/application_manager/src/commands/hmi/response_to_hmi.cc b/src/components/application_manager/src/commands/hmi/response_to_hmi.cc index 77e523378a..94f6967e23 100644 --- a/src/components/application_manager/src/commands/hmi/response_to_hmi.cc +++ b/src/components/application_manager/src/commands/hmi/response_to_hmi.cc @@ -44,7 +44,7 @@ ResponseToHMI::ResponseToHMI(const MessageSharedPtr& message, ResponseToHMI::~ResponseToHMI() {} bool ResponseToHMI::Init() { - return ReplaceMobileByHMIAppId(*message_); + return ReplaceMobileWithHMIAppId(*message_); } bool ResponseToHMI::CleanUp() { diff --git a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc index 1939150541..775811fce0 100644 --- a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc @@ -729,6 +729,219 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile( SendChangeRegistrationOnHMI(application); } +// DEPRECATED +void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() { + LOG4CXX_AUTO_TRACE(logger_); + smart_objects::SmartObject response_params(smart_objects::SmartType_Map); + + mobile_apis::Result::eType result_code = mobile_apis::Result::SUCCESS; + + const HMICapabilities& hmi_capabilities = + application_manager_.hmi_capabilities(); + + const uint32_t key = connection_key(); + ApplicationSharedPtr application = application_manager_.application(key); + + resumption::ResumeCtrl& resumer = application_manager_.resume_controller(); + + if (!application) { + LOG4CXX_ERROR(logger_, + "There is no application for such connection key" << key); + LOG4CXX_DEBUG(logger_, "Need to start resume data persistent timer"); + resumer.OnAppRegistrationEnd(); + return; + } + + response_params[strings::sync_msg_version][strings::major_version] = + major_version; // From generated file interfaces/generated_msg_version.h + response_params[strings::sync_msg_version][strings::minor_version] = + minor_version; // From generated file interfaces/generated_msg_version.h + response_params[strings::sync_msg_version][strings::patch_version] = + patch_version; // From generated file interfaces/generated_msg_version.h + + const smart_objects::SmartObject& msg_params = + (*message_)[strings::msg_params]; + + if (msg_params[strings::language_desired].asInt() != + hmi_capabilities.active_vr_language() || + msg_params[strings::hmi_display_language_desired].asInt() != + hmi_capabilities.active_ui_language()) { + LOG4CXX_WARN(logger_, + "Wrong language on registering application " + << application->name().c_str()); + + LOG4CXX_ERROR( + logger_, + "VR language desired code is " + << msg_params[strings::language_desired].asInt() + << " , active VR language code is " + << hmi_capabilities.active_vr_language() << ", UI language code is " + << msg_params[strings::hmi_display_language_desired].asInt() + << " , active UI language code is " + << hmi_capabilities.active_ui_language()); + + result_code = mobile_apis::Result::WRONG_LANGUAGE; + } + + if (HmiInterfaces::STATE_NOT_AVAILABLE != + application_manager_.hmi_interfaces().GetInterfaceState( + HmiInterfaces::HMI_INTERFACE_TTS)) { + FillTTSRelatedFields(response_params, hmi_capabilities); + } + + if (HmiInterfaces::STATE_NOT_AVAILABLE != + application_manager_.hmi_interfaces().GetInterfaceState( + HmiInterfaces::HMI_INTERFACE_VR)) { + FillVRRelatedFields(response_params, hmi_capabilities); + } + + if (HmiInterfaces::STATE_NOT_AVAILABLE != + application_manager_.hmi_interfaces().GetInterfaceState( + HmiInterfaces::HMI_INTERFACE_UI)) { + FillUIRelatedFields(response_params, hmi_capabilities); + } + + if (hmi_capabilities.button_capabilities()) { + response_params[hmi_response::button_capabilities] = + *hmi_capabilities.button_capabilities(); + } + if (hmi_capabilities.soft_button_capabilities()) { + response_params[hmi_response::soft_button_capabilities] = + *hmi_capabilities.soft_button_capabilities(); + } + if (hmi_capabilities.preset_bank_capabilities()) { + response_params[hmi_response::preset_bank_capabilities] = + *hmi_capabilities.preset_bank_capabilities(); + } + if (hmi_capabilities.hmi_zone_capabilities()) { + if (smart_objects::SmartType_Array == + hmi_capabilities.hmi_zone_capabilities()->getType()) { + // hmi_capabilities json contains array and HMI response object + response_params[hmi_response::hmi_zone_capabilities] = + *hmi_capabilities.hmi_zone_capabilities(); + } else { + response_params[hmi_response::hmi_zone_capabilities][0] = + *hmi_capabilities.hmi_zone_capabilities(); + } + } + + if (HmiInterfaces::STATE_NOT_AVAILABLE != + application_manager_.hmi_interfaces().GetInterfaceState( + HmiInterfaces::HMI_INTERFACE_TTS)) { + FillTTSRelatedFields(response_params, hmi_capabilities); + } + + if (hmi_capabilities.pcm_stream_capabilities()) { + response_params[strings::pcm_stream_capabilities] = + *hmi_capabilities.pcm_stream_capabilities(); + } + + if (HmiInterfaces::STATE_NOT_AVAILABLE != + application_manager_.hmi_interfaces().GetInterfaceState( + HmiInterfaces::HMI_INTERFACE_VehicleInfo)) { + FillVIRelatedFields(response_params, hmi_capabilities); + } + + const std::vector<uint32_t>& diag_modes = + application_manager_.get_settings().supported_diag_modes(); + if (!diag_modes.empty()) { + std::vector<uint32_t>::const_iterator it = diag_modes.begin(); + uint32_t index = 0; + for (; it != diag_modes.end(); ++it) { + response_params[strings::supported_diag_modes][index] = *it; + ++index; + } + } + response_params[strings::sdl_version] = + application_manager_.get_settings().sdl_version(); + const std::string ccpu_version = + application_manager_.hmi_capabilities().ccpu_version(); + if (!ccpu_version.empty()) { + response_params[strings::system_software_version] = ccpu_version; + } + + bool resumption = + (*message_)[strings::msg_params].keyExists(strings::hash_id); + + bool need_restore_vr = resumption; + + std::string hash_id; + std::string add_info; + if (resumption) { + hash_id = (*message_)[strings::msg_params][strings::hash_id].asString(); + if (!resumer.CheckApplicationHash(application, hash_id)) { + LOG4CXX_WARN(logger_, + "Hash from RAI does not match to saved resume data."); + result_code = mobile_apis::Result::RESUME_FAILED; + add_info = "Hash from RAI does not match to saved resume data."; + need_restore_vr = false; + } else if (!resumer.CheckPersistenceFilesForResumption(application)) { + LOG4CXX_WARN(logger_, "Persistent data is missing."); + result_code = mobile_apis::Result::RESUME_FAILED; + add_info = "Persistent data is missing."; + need_restore_vr = false; + } else { + add_info = "Resume succeeded."; + } + } + if ((mobile_apis::Result::SUCCESS == result_code) && + (mobile_apis::Result::INVALID_ENUM != result_checking_app_hmi_type_)) { + add_info += response_info_; + result_code = result_checking_app_hmi_type_; + } + + // in case application exist in resumption we need to send resumeVrgrammars + if (false == resumption) { + resumption = resumer.IsApplicationSaved(application->policy_app_id(), + application->mac_address()); + } + + AppHmiTypes hmi_types; + if ((*message_)[strings::msg_params].keyExists(strings::app_hmi_type)) { + smart_objects::SmartArray* hmi_types_ptr = + (*message_)[strings::msg_params][strings::app_hmi_type].asArray(); + DCHECK_OR_RETURN_VOID(hmi_types_ptr); + SmartArrayValueExtractor extractor; + if (hmi_types_ptr && 0 < hmi_types_ptr->size()) { + std::transform(hmi_types_ptr->begin(), + hmi_types_ptr->end(), + std::back_inserter(hmi_types), + extractor); + } + } + policy::StatusNotifier notify_upd_manager = GetPolicyHandler().AddApplication( + application->policy_app_id(), hmi_types); + SendResponse(true, result_code, add_info.c_str(), &response_params); + SendOnAppRegisteredNotificationToHMI( + *(application.get()), resumption, need_restore_vr); +#ifdef SDL_REMOTE_CONTROL + if (msg_params.keyExists(strings::app_hmi_type)) { + GetPolicyHandler().SetDefaultHmiTypes(application->policy_app_id(), + &(msg_params[strings::app_hmi_type])); + } +#endif // SDL_REMOTE_CONTROL + + // Default HMI level should be set before any permissions validation, since it + // relies on HMI level. + application_manager_.OnApplicationRegistered(application); + (*notify_upd_manager)(); + + // Start PTU after successfull registration + // Sends OnPermissionChange notification to mobile right after RAI response + // and HMI level set-up + GetPolicyHandler().OnAppRegisteredOnMobile(application->policy_app_id()); + + if (result_code != mobile_apis::Result::RESUME_FAILED) { + resumer.StartResumption(application, hash_id); + } else { + resumer.StartResumptionOnlyHMILevel(application); + } + + // By default app subscribed to CUSTOM_BUTTON + SendSubscribeCustomButtonNotification(); + SendChangeRegistrationOnHMI(application); +} + void RegisterAppInterfaceRequest::SendChangeRegistration( const hmi_apis::FunctionID::eType function_id, const int32_t language, diff --git a/src/components/application_manager/src/hmi_state.cc b/src/components/application_manager/src/hmi_state.cc index d31ff364ea..f67de7a957 100644 --- a/src/components/application_manager/src/hmi_state.cc +++ b/src/components/application_manager/src/hmi_state.cc @@ -56,6 +56,28 @@ HmiState::HmiState(utils::SharedPtr<Application> app, , audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM) , system_context_(mobile_apis::SystemContext::INVALID_ENUM) {} +// DEPRECATED +HmiState::HmiState(uint32_t app_id, + const ApplicationManager& app_mngr, + StateID state_id) + : state_id_(state_id) + , app_mngr_(app_mngr) + , hmi_level_(mobile_apis::HMILevel::INVALID_ENUM) + , audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM) + , system_context_(mobile_apis::SystemContext::INVALID_ENUM) { + app_ = app_mngr_.application(app_id); +} + +// DEPRECATED +HmiState::HmiState(uint32_t app_id, const ApplicationManager& app_mngr) + : state_id_(STATE_ID_REGULAR) + , app_mngr_(app_mngr) + , hmi_level_(mobile_apis::HMILevel::INVALID_ENUM) + , audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM) + , system_context_(mobile_apis::SystemContext::INVALID_ENUM) { + app_ = app_mngr_.application(app_id); +} + void HmiState::set_parent(HmiStatePtr parent) { DCHECK_OR_RETURN_VOID(parent); parent_ = parent; @@ -87,10 +109,18 @@ VRHmiState::VRHmiState(utils::SharedPtr<Application> app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_VR_SESSION) {} +// DEPRECATED +VRHmiState::VRHmiState(uint32_t app_id, const ApplicationManager& app_mngr) + : HmiState(app_id, app_mngr, STATE_ID_VR_SESSION) {} + TTSHmiState::TTSHmiState(utils::SharedPtr<Application> app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_TTS_SESSION) {} +// DEPRECATED +TTSHmiState::TTSHmiState(uint32_t app_id, const ApplicationManager& app_mngr) + : HmiState(app_id, app_mngr, STATE_ID_TTS_SESSION) {} + mobile_apis::AudioStreamingState::eType TTSHmiState::audio_streaming_state() const { using namespace helpers; @@ -110,6 +140,11 @@ NaviStreamingHmiState::NaviStreamingHmiState(utils::SharedPtr<Application> app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_NAVI_STREAMING) {} +// DEPRECATED +NaviStreamingHmiState::NaviStreamingHmiState(uint32_t app_id, + const ApplicationManager& app_mngr) + : HmiState(app_id, app_mngr, STATE_ID_NAVI_STREAMING) {} + mobile_apis::AudioStreamingState::eType NaviStreamingHmiState::audio_streaming_state() const { using namespace helpers; @@ -130,6 +165,11 @@ PhoneCallHmiState::PhoneCallHmiState(utils::SharedPtr<Application> app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_PHONE_CALL) {} +// DEPRECATED +PhoneCallHmiState::PhoneCallHmiState(uint32_t app_id, + const ApplicationManager& app_mngr) + : HmiState(app_id, app_mngr, STATE_ID_PHONE_CALL) {} + mobile_apis::HMILevel::eType PhoneCallHmiState::hmi_level() const { using namespace helpers; using namespace mobile_apis; @@ -151,10 +191,20 @@ SafetyModeHmiState::SafetyModeHmiState(utils::SharedPtr<Application> app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_SAFETY_MODE) {} +// DEPRECATED +SafetyModeHmiState::SafetyModeHmiState(uint32_t app_id, + const ApplicationManager& app_mngr) + : HmiState(app_id, app_mngr, STATE_ID_SAFETY_MODE) {} + DeactivateHMI::DeactivateHMI(utils::SharedPtr<Application> app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_DEACTIVATE_HMI) {} +// DERECATED +DeactivateHMI::DeactivateHMI(uint32_t app_id, + const ApplicationManager& app_mngr) + : HmiState(app_id, app_mngr, STATE_ID_DEACTIVATE_HMI) {} + mobile_apis::HMILevel::eType DeactivateHMI::hmi_level() const { using namespace helpers; using namespace mobile_apis; @@ -170,6 +220,10 @@ AudioSource::AudioSource(utils::SharedPtr<Application> app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_AUDIO_SOURCE) {} +// DEPRECATED +AudioSource::AudioSource(uint32_t app_id, const ApplicationManager& app_mngr) + : HmiState(app_id, app_mngr, STATE_ID_AUDIO_SOURCE) {} + mobile_apis::HMILevel::eType AudioSource::hmi_level() const { using namespace mobile_apis; using namespace helpers; @@ -191,6 +245,10 @@ EmbeddedNavi::EmbeddedNavi(utils::SharedPtr<Application> app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_EMBEDDED_NAVI) {} +// DEPRECATED +EmbeddedNavi::EmbeddedNavi(uint32_t app_id, const ApplicationManager& app_mngr) + : HmiState(app_id, app_mngr, STATE_ID_EMBEDDED_NAVI) {} + mobile_apis::HMILevel::eType EmbeddedNavi::hmi_level() const { using namespace mobile_apis; using namespace helpers; diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc index cf64152315..af9c221a4f 100644 --- a/src/components/application_manager/src/message_helper/message_helper.cc +++ b/src/components/application_manager/src/message_helper/message_helper.cc @@ -1531,7 +1531,7 @@ void MessageHelper::SendOnAppUnregNotificationToHMI( message[strings::params][strings::message_type] = MessageType::kNotification; // we put hmi_app_id because applicaton list does not contain application on // this momment - // and ReplaceHMIByMobileAppId function will be unable to replace app_id to + // and ReplaceHMIWithMobileAppId function will be unable to replace app_id to // hmi_app_id message[strings::msg_params][strings::app_id] = app->hmi_app_id(); message[strings::msg_params][strings::unexpected_disconnect] = diff --git a/src/components/application_manager/test/application_impl_test.cc b/src/components/application_manager/test/application_impl_test.cc index e5427f4c9b..e02191e4da 100644 --- a/src/components/application_manager/test/application_impl_test.cc +++ b/src/components/application_manager/test/application_impl_test.cc @@ -131,7 +131,9 @@ class ApplicationImplTest : public ::testing::Test { HmiStatePtr ApplicationImplTest::CreateTestHmiState() { HmiStatePtr testState = utils::MakeShared<HmiState>( - app_impl, mock_application_manager_, state_id); + static_cast<utils::SharedPtr<Application> >(app_impl), + mock_application_manager_, + state_id); testState->set_hmi_level(test_lvl); testState->set_audio_streaming_state(audiostate); testState->set_system_context(syst_context); diff --git a/src/components/application_manager/test/application_state_test.cc b/src/components/application_manager/test/application_state_test.cc index 2e80273e8c..33f23022f0 100644 --- a/src/components/application_manager/test/application_state_test.cc +++ b/src/components/application_manager/test/application_state_test.cc @@ -85,8 +85,10 @@ std::vector<StateID> ApplicationStateTest::added_states_ = TEST_F(ApplicationStateTest, AddStates_GetCurrentStates) { std::vector<StateID>::iterator new_state = added_states_.begin(); for (; new_state != added_states_.end(); ++new_state) { - HmiStatePtr state = - utils::MakeShared<HmiState>(mock_app_, app_mngr_, *new_state); + HmiStatePtr state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + *new_state); app_state.AddState(state); EXPECT_EQ(state, app_state.GetState(current_id)); } @@ -95,8 +97,10 @@ TEST_F(ApplicationStateTest, AddStates_GetCurrentStates) { TEST_F(ApplicationStateTest, AddStates_RemoveStates_GetCurrentState) { std::vector<StateID>::iterator new_state = added_states_.begin(); for (; new_state != added_states_.end(); ++new_state) { - HmiStatePtr state = - utils::MakeShared<HmiState>(mock_app_, app_mngr_, *new_state); + HmiStatePtr state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + *new_state); app_state.AddState(state); HmiStatePtr curr_state = app_state.GetState(current_id); @@ -116,16 +120,20 @@ TEST_F(ApplicationStateTest, AddStatesAddPostponedState_GetPostponedState) { // Added some states std::vector<StateID>::iterator new_state = added_states_.begin(); for (; new_state != added_states_.end(); ++new_state) { - HmiStatePtr state = - utils::MakeShared<HmiState>(mock_app_, app_mngr_, *new_state); + HmiStatePtr state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + *new_state); app_state.AddState(state); } // Postponed state wasn't added HmiStatePtr get_postponed_id = app_state.GetState(postponed_id); EXPECT_EQ(NULL, get_postponed_id); // Add posponed state - HmiStatePtr state = - utils::MakeShared<HmiState>(mock_app_, app_mngr_, postponed_id); + HmiStatePtr state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + postponed_id); app_state.AddState(state); // Postponed state exists get_postponed_id = app_state.GetState(postponed_id); @@ -135,14 +143,19 @@ TEST_F(ApplicationStateTest, AddStatesAddPostponedState_GetPostponedState) { TEST_F(ApplicationStateTest, AddStates_GetRegularState) { // Add state std::vector<StateID>::iterator new_state = added_states_.begin(); - HmiStatePtr state = - utils::MakeShared<HmiState>(mock_app_, app_mngr_, *new_state); + HmiStatePtr state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + *new_state); state->set_hmi_level(HMILevel::HMI_FULL); app_state.AddState(state); ++new_state; // Add some other for (; new_state != added_states_.end(); ++new_state) { - state = utils::MakeShared<HmiState>(mock_app_, app_mngr_, *new_state); + state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + *new_state); app_state.AddState(state); state->set_hmi_level(HMILevel::HMI_LIMITED); } @@ -156,13 +169,18 @@ TEST_F(ApplicationStateTest, AddStates_GetRegularState) { TEST_F(ApplicationStateTest, AddRegularState_RemoveFirstState_GetRegularState) { std::vector<StateID>::iterator new_state = added_states_.begin(); - HmiStatePtr state = - utils::MakeShared<HmiState>(mock_app_, app_mngr_, *new_state); + HmiStatePtr state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + *new_state); app_state.AddState(state); ++new_state; // Add postponed state - state = utils::MakeShared<HmiState>(mock_app_, app_mngr_, postponed_id); + state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + postponed_id); app_state.AddState(state); // Make sure that the state was added @@ -170,7 +188,10 @@ TEST_F(ApplicationStateTest, AddRegularState_RemoveFirstState_GetRegularState) { ASSERT_EQ(state, post_state); for (; new_state != added_states_.end(); ++new_state) { - state = utils::MakeShared<HmiState>(mock_app_, app_mngr_, *new_state); + state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + *new_state); app_state.AddState(state); } @@ -190,22 +211,32 @@ TEST_F(ApplicationStateTest, AddRegularState_RemoveFirstState_GetRegularState) { TEST_F(ApplicationStateTest, AddRegularState_PreviousStatePostponed) { // Add some state StateID first_state = StateID::STATE_ID_PHONE_CALL; - HmiStatePtr state = - utils::MakeShared<HmiState>(mock_app_, app_mngr_, first_state); + HmiStatePtr state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + first_state); app_state.AddState(state); // Add postponed state - state = utils::MakeShared<HmiState>(mock_app_, app_mngr_, postponed_id); + state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + postponed_id); app_state.AddState(state); // Add new postponed state utils::SharedPtr<MockApplication> mock_app_2(new MockApplication); - state = utils::MakeShared<HmiState>(mock_app_2, app_mngr_, postponed_id); + state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + postponed_id); app_state.AddState(state); // Add regular state state = utils::MakeShared<HmiState>( - mock_app_, app_mngr_, StateID::STATE_ID_REGULAR); + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + StateID::STATE_ID_REGULAR); app_state.AddState(state); // Postponed state is the first @@ -219,8 +250,10 @@ TEST_F(ApplicationStateTest, AddRegularState_PreviousStatePostponed) { TEST_F(ApplicationStateTest, InitState_GetRegularState) { StateID init_state = StateID::STATE_ID_REGULAR; - HmiStatePtr state = - utils::MakeShared<HmiState>(mock_app_, app_mngr_, init_state); + HmiStatePtr state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + init_state); app_state.InitState(state); @@ -234,14 +267,19 @@ TEST_F(ApplicationStateTest, InitState_GetRegularState) { TEST_F(ApplicationStateTest, AddPosponedState_DeletePosponedState) { // Precondition StateID init_state = StateID::STATE_ID_REGULAR; - HmiStatePtr state = - utils::MakeShared<HmiState>(mock_app_, app_mngr_, init_state); + HmiStatePtr state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + init_state); state->set_hmi_level(mobile_apis::HMILevel::HMI_FULL); app_state.InitState(state); // Add postponed state - state = utils::MakeShared<HmiState>(mock_app_, app_mngr_, postponed_id); + state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + postponed_id); app_state.AddState(state); // Make sure that state was added @@ -258,8 +296,10 @@ TEST_F(ApplicationStateTest, AddPosponedState_DeletePosponedState) { TEST_F(ApplicationStateTest, AddRegularState_RemoveRegularState_RegularStateNotDeleted) { StateID reg_state = StateID::STATE_ID_REGULAR; - HmiStatePtr state = - utils::MakeShared<HmiState>(mock_app_, app_mngr_, reg_state); + HmiStatePtr state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + reg_state); app_state.InitState(state); // Try deleting regular state diff --git a/src/components/application_manager/test/commands/command_impl_test.cc b/src/components/application_manager/test/commands/command_impl_test.cc index fd660af210..ff9634cbb1 100644 --- a/src/components/application_manager/test/commands/command_impl_test.cc +++ b/src/components/application_manager/test/commands/command_impl_test.cc @@ -83,8 +83,8 @@ class CommandImplTest : public CommandsTest<CommandsTestMocks::kIsNice> { public: class UnwrappedCommandImpl : CommandImpl { public: - using CommandImpl::ReplaceMobileByHMIAppId; - using CommandImpl::ReplaceHMIByMobileAppId; + using CommandImpl::ReplaceMobileWithHMIAppId; + using CommandImpl::ReplaceHMIWithMobileAppId; UnwrappedCommandImpl(const MessageSharedPtr& message, ApplicationManager& application_manager) @@ -151,16 +151,16 @@ TEST_F(CommandImplTest, GetMethods_SUCCESS) { EXPECT_NO_THROW(command->onTimeOut()); } -TEST_F(CommandImplTest, ReplaceMobileByHMIAppId_NoAppIdInMessage_UNSUCCESS) { +TEST_F(CommandImplTest, ReplaceMobileWithHMIAppId_NoAppIdInMessage_UNSUCCESS) { MessageSharedPtr msg; UCommandImplPtr command = CreateCommand<UCommandImpl>(msg); EXPECT_CALL(app_mngr_, application(_)).Times(0); - command->ReplaceMobileByHMIAppId(*msg); + command->ReplaceMobileWithHMIAppId(*msg); } -TEST_F(CommandImplTest, ReplaceMobileByHMIAppId_SUCCESS) { +TEST_F(CommandImplTest, ReplaceMobileWithHMIAppId_SUCCESS) { MessageSharedPtr msg = CreateMessage(); (*msg)[strings::app_id] = kAppId1; @@ -171,12 +171,12 @@ TEST_F(CommandImplTest, ReplaceMobileByHMIAppId_SUCCESS) { EXPECT_CALL(app_mngr_, application(kAppId1)).WillOnce(Return(app)); ON_CALL(*app, hmi_app_id()).WillByDefault(Return(kAppId2)); - command->ReplaceMobileByHMIAppId(*msg); + command->ReplaceMobileWithHMIAppId(*msg); EXPECT_EQ(kAppId2, (*msg)[strings::app_id].asUInt()); } -TEST_F(CommandImplTest, ReplaceMobileByHMIAppId_Array_SUCCESS) { +TEST_F(CommandImplTest, ReplaceMobileWithHMIAppId_Array_SUCCESS) { MessageSharedPtr msg = CreateArrayMessage(kDefaultMsgCount); UCommandImplPtr command = CreateCommand<UCommandImpl>(msg); @@ -187,14 +187,14 @@ TEST_F(CommandImplTest, ReplaceMobileByHMIAppId_Array_SUCCESS) { .WillRepeatedly(Return(app)); ON_CALL(*app, hmi_app_id()).WillByDefault(Return(kAppId2)); - command->ReplaceMobileByHMIAppId(*msg); + command->ReplaceMobileWithHMIAppId(*msg); EXPECT_TRUE(msg->asArray()); std::for_each( msg->asArray()->begin(), msg->asArray()->end(), ExpectEqualAppId); } -TEST_F(CommandImplTest, ReplaceMobileByHMIAppId_Map_SUCCESS) { +TEST_F(CommandImplTest, ReplaceMobileWithHMIAppId_Map_SUCCESS) { MessageSharedPtr msg = CreateMapMessage(kDefaultMsgCount); UCommandImplPtr command = CreateCommand<UCommandImpl>(msg); @@ -205,7 +205,7 @@ TEST_F(CommandImplTest, ReplaceMobileByHMIAppId_Map_SUCCESS) { .WillRepeatedly(Return(app)); ON_CALL(*app, hmi_app_id()).WillByDefault(Return(kAppId2)); - command->ReplaceMobileByHMIAppId(*msg); + command->ReplaceMobileWithHMIAppId(*msg); std::set<std::string> keys(msg->enumerate()); std::for_each(keys.begin(), @@ -213,16 +213,17 @@ TEST_F(CommandImplTest, ReplaceMobileByHMIAppId_Map_SUCCESS) { std::bind2nd(std::ptr_fun(&ExpectEqualKeyAppId), msg)); } -TEST_F(CommandImplTest, ReplaceHMIByMobileAppId_NoHMIAppIdInMessage_UNSUCCESS) { +TEST_F(CommandImplTest, + ReplaceHMIWithMobileAppId_NoHMIAppIdInMessage_UNSUCCESS) { MessageSharedPtr msg; UCommandImplPtr command = CreateCommand<UCommandImpl>(msg); EXPECT_CALL(app_mngr_, application_by_hmi_app(_)).Times(0); - command->ReplaceHMIByMobileAppId(*msg); + command->ReplaceHMIWithMobileAppId(*msg); } -TEST_F(CommandImplTest, ReplaceHMIByMobileAppId_SUCCESS) { +TEST_F(CommandImplTest, ReplaceHMIWithMobileAppId_SUCCESS) { MessageSharedPtr msg = CreateMessage(); (*msg)[strings::app_id] = kAppId1; @@ -233,12 +234,12 @@ TEST_F(CommandImplTest, ReplaceHMIByMobileAppId_SUCCESS) { EXPECT_CALL(app_mngr_, application_by_hmi_app(kAppId1)).WillOnce(Return(app)); ON_CALL(*app, app_id()).WillByDefault(Return(kAppId2)); - command->ReplaceHMIByMobileAppId(*msg); + command->ReplaceHMIWithMobileAppId(*msg); EXPECT_EQ(kAppId2, (*msg)[strings::app_id].asUInt()); } -TEST_F(CommandImplTest, ReplaceHMIByMobileAppId_Array_SUCCESS) { +TEST_F(CommandImplTest, ReplaceHMIWithMobileAppId_Array_SUCCESS) { MessageSharedPtr msg = CreateArrayMessage(kDefaultMsgCount); UCommandImplPtr command = CreateCommand<UCommandImpl>(msg); @@ -249,14 +250,14 @@ TEST_F(CommandImplTest, ReplaceHMIByMobileAppId_Array_SUCCESS) { .WillRepeatedly(Return(app)); ON_CALL(*app, app_id()).WillByDefault(Return(kAppId2)); - command->ReplaceHMIByMobileAppId(*msg); + command->ReplaceHMIWithMobileAppId(*msg); EXPECT_TRUE(msg->asArray()); std::for_each( msg->asArray()->begin(), msg->asArray()->end(), ExpectEqualAppId); } -TEST_F(CommandImplTest, ReplaceHMIByMobileAppId_Map_SUCCESS) { +TEST_F(CommandImplTest, ReplaceHMIWithMobileAppId_Map_SUCCESS) { MessageSharedPtr msg = CreateMapMessage(kDefaultMsgCount); UCommandImplPtr command = CreateCommand<UCommandImpl>(msg); @@ -267,7 +268,7 @@ TEST_F(CommandImplTest, ReplaceHMIByMobileAppId_Map_SUCCESS) { .WillRepeatedly(Return(app)); ON_CALL(*app, app_id()).WillByDefault(Return(kAppId2)); - command->ReplaceHMIByMobileAppId(*msg); + command->ReplaceHMIWithMobileAppId(*msg); std::set<std::string> keys = msg->enumerate(); std::for_each(keys.begin(), diff --git a/src/components/application_manager/test/commands/hmi/hmi_notifications/hmi_notifications_test.cc b/src/components/application_manager/test/commands/hmi/hmi_notifications/hmi_notifications_test.cc index 03e1187d35..5a40a4e582 100644 --- a/src/components/application_manager/test/commands/hmi/hmi_notifications/hmi_notifications_test.cc +++ b/src/components/application_manager/test/commands/hmi/hmi_notifications/hmi_notifications_test.cc @@ -1595,7 +1595,10 @@ TEST_F(HMICommandsNotificationsTest, ON_CALL(mock_connection_handler_, get_session_observer()) .WillByDefault(ReturnRef(mock_session_observer_)); const int32_t device_id = 1; - ON_CALL(mock_session_observer_, GetDataOnDeviceID(_, NULL, NULL, _, NULL)) + ON_CALL( + mock_session_observer_, + GetDataOnDeviceID( + testing::An<transport_manager::DeviceHandle>(), NULL, NULL, _, NULL)) .WillByDefault(Return(device_id)); EXPECT_CALL(policy_interface_, GetUserConsentForDevice(_)) @@ -1645,7 +1648,10 @@ TEST_F(HMICommandsNotificationsTest, ON_CALL(mock_connection_handler_, get_session_observer()) .WillByDefault(ReturnRef(mock_session_observer_)); const int32_t device_id = 1; - ON_CALL(mock_session_observer_, GetDataOnDeviceID(_, NULL, NULL, _, NULL)) + ON_CALL( + mock_session_observer_, + GetDataOnDeviceID( + testing::An<transport_manager::DeviceHandle>(), NULL, NULL, _, NULL)) .WillByDefault(Return(device_id)); EXPECT_CALL(policy_interface_, GetUserConsentForDevice(_)) diff --git a/src/components/application_manager/test/policy_handler_test.cc b/src/components/application_manager/test/policy_handler_test.cc index 4c3e882eae..66efe45e30 100644 --- a/src/components/application_manager/test/policy_handler_test.cc +++ b/src/components/application_manager/test/policy_handler_test.cc @@ -803,8 +803,14 @@ void PolicyHandlerTest::TestActivateApp(const uint32_t connection_key, EXPECT_CALL(*application1, is_audio()).WillRepeatedly(Return(false)); EXPECT_CALL(mock_message_helper_, SendOnAppPermissionsChangedNotification(kAppId1_, _, _)); - EXPECT_CALL(mock_session_observer, - GetDataOnDeviceID(device_handle, _, _, _, _)); + EXPECT_CALL( + mock_session_observer, + GetDataOnDeviceID( + testing::Matcher<transport_manager::DeviceHandle>(device_handle), + _, + _, + _, + _)); #endif // EXTERNAL_PROPRIETARY_MODE EXPECT_CALL(*application1, policy_app_id()).WillOnce(Return(kPolicyAppId_)); @@ -1162,7 +1168,15 @@ TEST_F(PolicyHandlerTest, OnCurrentDeviceIdUpdateRequired) { EXPECT_CALL(conn_handler, get_session_observer()) .WillOnce(ReturnRef(session_observer)); - EXPECT_CALL(session_observer, GetDataOnDeviceID(0u, _, _, _, _)); + const transport_manager::DeviceHandle handle = 0u; + + EXPECT_CALL(session_observer, + GetDataOnDeviceID( + testing::Matcher<transport_manager::DeviceHandle>(handle), + _, + _, + _, + _)); // Act policy_handler_.OnCurrentDeviceIdUpdateRequired(kPolicyAppId_); @@ -1463,7 +1477,9 @@ TEST_F(PolicyHandlerTest, OnGetListOfPermissions) { EXPECT_CALL(app_manager_, application(app_id)) .WillRepeatedly(Return(mock_app_)); EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(std::string())); - EXPECT_CALL(mock_session_observer, GetDataOnDeviceID(_, _, _, _, _)); + EXPECT_CALL(mock_session_observer, + GetDataOnDeviceID( + testing::An<transport_manager::DeviceHandle>(), _, _, _, _)); policy_handler_.OnGetListOfPermissions(app_id, corr_id); } @@ -1489,7 +1505,9 @@ TEST_F(PolicyHandlerTest, OnGetListOfPermissions_WithoutConnectionKey) { EXPECT_CALL(app_manager_, applications()).WillRepeatedly(Return(app_set)); EXPECT_CALL(*mock_app_, device()).WillOnce(Return(0)); EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(std::string())); - EXPECT_CALL(mock_session_observer, GetDataOnDeviceID(_, _, _, _, _)); + EXPECT_CALL(mock_session_observer, + GetDataOnDeviceID( + testing::An<transport_manager::DeviceHandle>(), _, _, _, _)); #ifdef EXTERNAL_PROPRIETARY_MODE policy::ExternalConsentStatus external_consent_status = @@ -1563,7 +1581,9 @@ TEST_F(PolicyHandlerTest, OnGetListOfPermissions_GroupPermissions_SUCCESS) { EXPECT_CALL(app_manager_, applications()).WillRepeatedly(Return(app_set)); EXPECT_CALL(*mock_app_, device()).WillOnce(Return(0)); EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(std::string())); - EXPECT_CALL(mock_session_observer, GetDataOnDeviceID(_, _, _, _, _)); + EXPECT_CALL(mock_session_observer, + GetDataOnDeviceID( + testing::An<transport_manager::DeviceHandle>(), _, _, _, _)); #ifdef EXTERNAL_PROPRIETARY_MODE policy::ExternalConsentStatus external_consent_status = @@ -1878,7 +1898,9 @@ void PolicyHandlerTest::GetAppIDForSending() { EXPECT_CALL(*mock_app_, IsRegistered()).WillOnce(Return(true)); EXPECT_CALL(*mock_app_, hmi_level()) .WillRepeatedly(Return(mobile_api::HMILevel::HMI_FULL)); - EXPECT_CALL(mock_session_observer, GetDataOnDeviceID(_, _, _, _, _)) + EXPECT_CALL(mock_session_observer, + GetDataOnDeviceID( + testing::An<transport_manager::DeviceHandle>(), _, _, _, _)) .WillOnce(DoAll(SetArgPointee<3>(kMacAddr_), Return(0))); EXPECT_CALL(*mock_policy_manager_, GetUserConsentForDevice(kMacAddr_)) @@ -1944,7 +1966,9 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyIdButNone) { // Check expectations - EXPECT_CALL(mock_session_observer, GetDataOnDeviceID(_, _, _, _, _)) + EXPECT_CALL(mock_session_observer, + GetDataOnDeviceID( + testing::An<transport_manager::DeviceHandle>(), _, _, _, _)) .WillOnce(DoAll(SetArgPointee<3>(kMacAddr_), Return(0))); EXPECT_CALL(*mock_policy_manager_, GetUserConsentForDevice(kMacAddr_)) @@ -1984,7 +2008,9 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyAppInNone) { // Check expectations - EXPECT_CALL(mock_session_observer, GetDataOnDeviceID(_, _, _, _, _)) + EXPECT_CALL(mock_session_observer, + GetDataOnDeviceID( + testing::An<transport_manager::DeviceHandle>(), _, _, _, _)) .WillOnce(DoAll(SetArgPointee<3>(kMacAddr_), Return(0))); EXPECT_CALL(*mock_policy_manager_, GetUserConsentForDevice(kMacAddr_)) @@ -2077,7 +2103,9 @@ TEST_F(PolicyHandlerTest, CanUpdate_TwoApplicationForSending_SUCCESS) { test_app.insert(mock_app_); test_app.insert(second_mock_app); - EXPECT_CALL(mock_session_observer, GetDataOnDeviceID(_, _, _, _, _)) + EXPECT_CALL(mock_session_observer, + GetDataOnDeviceID( + testing::An<transport_manager::DeviceHandle>(), _, _, _, _)) .WillOnce(DoAll(SetArgPointee<3>(kMacAddr_), Return(0))); EXPECT_CALL(*mock_policy_manager_, GetUserConsentForDevice(kMacAddr_)) @@ -2111,8 +2139,13 @@ TEST_F(PolicyHandlerTest, .WillOnce(ReturnRef(conn_handler)); EXPECT_CALL(conn_handler, get_session_observer()) .WillOnce(ReturnRef(mock_session_observer)); - EXPECT_CALL(mock_session_observer, GetDataOnDeviceID(device, _, NULL, _, _)) - .WillOnce(Return(1u)); + EXPECT_CALL(mock_session_observer, + GetDataOnDeviceID( + testing::Matcher<transport_manager::DeviceHandle>(device), + _, + NULL, + _, + _)).WillOnce(Return(1u)); EXPECT_CALL(app_manager_, application(kConnectionKey_)) .WillOnce(Return(mock_app_)); @@ -2265,7 +2298,10 @@ TEST_F(PolicyHandlerTest, EXPECT_CALL(*mock_app_, policy_app_id()) .WillRepeatedly(Return(kPolicyAppId_)); - EXPECT_CALL(mock_session_observer, GetDataOnDeviceID(_, _, NULL, _, _)) + EXPECT_CALL( + mock_session_observer, + GetDataOnDeviceID( + testing::An<transport_manager::DeviceHandle>(), _, NULL, _, _)) .WillRepeatedly(DoAll(SetDeviceParamsMacAdress(kMacAddr_), (Return(1u)))); EXPECT_CALL(app_manager_, connection_handler()) @@ -2326,7 +2362,10 @@ TEST_F(PolicyHandlerTest, EXPECT_CALL(*mock_app_, policy_app_id()) .WillRepeatedly(Return(kPolicyAppId_)); - EXPECT_CALL(mock_session_observer, GetDataOnDeviceID(_, _, NULL, _, _)) + EXPECT_CALL( + mock_session_observer, + GetDataOnDeviceID( + testing::An<transport_manager::DeviceHandle>(), _, NULL, _, _)) .WillRepeatedly(DoAll(SetDeviceParamsMacAdress(kMacAddr_), (Return(1u)))); EXPECT_CALL(app_manager_, connection_handler()) diff --git a/src/components/connection_handler/include/connection_handler/connection_handler_impl.h b/src/components/connection_handler/include/connection_handler/connection_handler_impl.h index d0e34a99b9..d073d06aa1 100644 --- a/src/components/connection_handler/include/connection_handler/connection_handler_impl.h +++ b/src/components/connection_handler/include/connection_handler/connection_handler_impl.h @@ -490,6 +490,20 @@ class ConnectionHandlerImpl std::list<int32_t>* sessions_list, connection_handler::DeviceHandle* device_id) const OVERRIDE; + /** + * DEPRECATED + * \brief information about given Connection Key. + * \param key Unique key used by other components as session identifier + * \param app_id Returned: ApplicationID + * \param sessions_list Returned: List of session keys + * \param device_id Returned: DeviceID + * \return int32_t -1 in case of error or 0 in case of success + */ + int32_t GetDataOnSessionKey(uint32_t key, + uint32_t* app_id, + std::list<int32_t>* sessions_list, + uint32_t* device_id) const OVERRIDE; + const ConnectionHandlerSettings& get_settings() const OVERRIDE; const protocol_handler::SessionObserver& get_session_observer(); diff --git a/src/components/connection_handler/src/connection_handler_impl.cc b/src/components/connection_handler/src/connection_handler_impl.cc index b7baf614a0..f1051931a6 100644 --- a/src/components/connection_handler/src/connection_handler_impl.cc +++ b/src/components/connection_handler/src/connection_handler_impl.cc @@ -671,7 +671,56 @@ int32_t ConnectionHandlerImpl::GetDataOnSessionKey( uint32_t key, uint32_t* app_id, std::list<int32_t>* sessions_list, - transport_manager::DeviceHandle* device_id) const { + connection_handler::DeviceHandle* device_id) const { + LOG4CXX_AUTO_TRACE(logger_); + + const int32_t error_result = -1; + transport_manager::ConnectionUID conn_handle = 0; + uint8_t session_id = 0; + PairFromKey(key, &conn_handle, &session_id); + + ConnectionList::const_iterator it = connection_list_.find(conn_handle); + if (connection_list_.end() == it) { + LOG4CXX_ERROR(logger_, "Connection not found for key: " << key); + return error_result; + } + + const Connection& connection = *it->second; + const SessionMap session_map = connection.session_map(); + if (0 == session_id || session_map.end() == session_map.find(session_id)) { + LOG4CXX_ERROR(logger_, + "Session not found in connection: " + << static_cast<int32_t>(conn_handle)); + return error_result; + } + + if (device_id) { + *device_id = connection.connection_device_handle(); + } + if (app_id) { + *app_id = KeyFromPair(conn_handle, session_id); + } + if (sessions_list) { + sessions_list->clear(); + + SessionMap::const_iterator session_it = session_map.begin(); + for (; session_map.end() != session_it; ++session_it) { + sessions_list->push_back(KeyFromPair(conn_handle, it->first)); + } + } + + LOG4CXX_INFO(logger_, + "Connection " << static_cast<int32_t>(conn_handle) << " has " + << session_map.size() << " sessions."); + return 0; +} + +// DEPRECATED +int32_t ConnectionHandlerImpl::GetDataOnSessionKey( + uint32_t key, + uint32_t* app_id, + std::list<int32_t>* sessions_list, + uint32_t* device_id) const { LOG4CXX_AUTO_TRACE(logger_); const int32_t error_result = -1; diff --git a/src/components/connection_handler/test/connection_handler_impl_test.cc b/src/components/connection_handler/test/connection_handler_impl_test.cc index 566036794d..a49d1b4be8 100644 --- a/src/components/connection_handler/test/connection_handler_impl_test.cc +++ b/src/components/connection_handler/test/connection_handler_impl_test.cc @@ -342,9 +342,10 @@ TEST_F(ConnectionHandlerTest, GetAppIdOnSessionKey) { uint32_t app_id = 0; const uint32_t testid = SessionHash(uid_, start_session_id_); + connection_handler::DeviceHandle null_handle = 0; EXPECT_EQ(0, connection_handler_->GetDataOnSessionKey( - connection_key_, &app_id, NULL, NULL)); + connection_key_, &app_id, NULL, &null_handle)); EXPECT_EQ(testid, app_id); } @@ -352,9 +353,10 @@ TEST_F(ConnectionHandlerTest, GetAppIdOnSessionKey_SessionNotStarted) { AddTestDeviceConnection(); uint32_t app_id = 0; + connection_handler::DeviceHandle null_handle = 0; EXPECT_EQ(-1, connection_handler_->GetDataOnSessionKey( - connection_key_, &app_id, NULL, NULL)); + connection_key_, &app_id, NULL, &null_handle)); } TEST_F(ConnectionHandlerTest, GetDeviceID) { diff --git a/src/components/include/application_manager/application_manager.h b/src/components/include/application_manager/application_manager.h index f137208757..be872109b3 100644 --- a/src/components/include/application_manager/application_manager.h +++ b/src/components/include/application_manager/application_manager.h @@ -626,6 +626,21 @@ class ApplicationManager { mobile_apis::AudioStreamingState::eType audio_state, mobile_apis::SystemContext::eType system_context) const = 0; + /** + * DEPRECATED + * @brief CreateRegularState create regular HMI state for application + * @param app_id Application id + * @param hmi_level of returned state + * @param audio_state of returned state + * @param system_context of returned state + * @return new regular HMI state + */ + virtual HmiStatePtr CreateRegularState( + uint32_t app_id, + mobile_apis::HMILevel::eType hmi_level, + mobile_apis::AudioStreamingState::eType audio_state, + mobile_apis::SystemContext::eType system_context) const = 0; + virtual void SendAudioPassThroughNotification( uint32_t session_key, std::vector<uint8_t>& binary_data) = 0; diff --git a/src/components/include/connection_handler/connection_handler.h b/src/components/include/connection_handler/connection_handler.h index 7b86cd43dc..b2ceb450ea 100644 --- a/src/components/include/connection_handler/connection_handler.h +++ b/src/components/include/connection_handler/connection_handler.h @@ -168,6 +168,20 @@ class ConnectionHandler { uint8_t protocol_version) = 0; /** + * DEPRECATED + * \brief information about given Connection Key. + * \param key Unique key used by other components as session identifier + * \param app_id Returned: ApplicationID + * \param sessions_list Returned: List of session keys + * \param device_id Returned: DeviceID + * \return int32_t -1 in case of error or 0 in case of success + */ + virtual int32_t GetDataOnSessionKey(uint32_t key, + uint32_t* app_id, + std::list<int32_t>* sessions_list, + uint32_t* device_id) const = 0; + + /** * @brief GetConnectedDevicesMAC allows to obtain MAC adresses for all * currently connected devices. * diff --git a/src/components/include/protocol_handler/session_observer.h b/src/components/include/protocol_handler/session_observer.h index e84172524a..35cbb8da94 100644 --- a/src/components/include/protocol_handler/session_observer.h +++ b/src/components/include/protocol_handler/session_observer.h @@ -176,6 +176,20 @@ class SessionObserver { uint8_t* sessionId) const = 0; /** + * DEPRECATED + * \brief information about given Connection Key. + * \param key Unique key used by other components as session identifier + * \param app_id Returned: ApplicationID + * \param sessions_list Returned: List of session keys + * \param device_id Returned: DeviceID + * \return int32_t -1 in case of error or 0 in case of success + */ + virtual int32_t GetDataOnSessionKey(uint32_t key, + uint32_t* app_id, + std::list<int32_t>* sessions_list, + uint32_t* device_id) const = 0; + + /** * \brief information about given Connection Key. * \param key Unique key used by other components as session identifier * \param app_id Returned: ApplicationID diff --git a/src/components/include/test/application_manager/mock_application_manager.h b/src/components/include/test/application_manager/mock_application_manager.h index fa4cda9207..df360eaa94 100644 --- a/src/components/include/test/application_manager/mock_application_manager.h +++ b/src/components/include/test/application_manager/mock_application_manager.h @@ -248,6 +248,14 @@ class MockApplicationManager : public application_manager::ApplicationManager { mobile_apis::HMILevel::eType hmi_level, mobile_apis::AudioStreamingState::eType audio_state, mobile_apis::SystemContext::eType system_context)); + // DEPRECATED + MOCK_CONST_METHOD4(CreateRegularState, + application_manager::HmiStatePtr( + uint32_t app_id, + mobile_apis::HMILevel::eType hmi_level, + mobile_apis::AudioStreamingState::eType audio_state, + mobile_apis::SystemContext::eType system_context)); + MOCK_METHOD2(SendAudioPassThroughNotification, void(uint32_t session_key, std::vector<uint8_t>& binary_data)); MOCK_CONST_METHOD2(CanAppStream, @@ -271,9 +279,9 @@ class MockApplicationManager : public application_manager::ApplicationManager { AppsWaitingForRegistration, DataAccessor<application_manager::AppsWaitRegistrationSet>()); - MOCK_METHOD1(ReplaceMobileByHMIAppId, + MOCK_METHOD1(ReplaceMobileWithHMIAppId, void(smart_objects::SmartObject& message)); - MOCK_METHOD1(ReplaceHMIByMobileAppId, + MOCK_METHOD1(ReplaceHMIWithMobileAppId, void(smart_objects::SmartObject& message)); MOCK_METHOD1(GetAvailableSpaceForApp, uint32_t(const std::string& folder_name)); diff --git a/src/components/include/test/connection_handler/mock_connection_handler.h b/src/components/include/test/connection_handler/mock_connection_handler.h index 5cb5f471b5..8800751fe1 100644 --- a/src/components/include/test/connection_handler/mock_connection_handler.h +++ b/src/components/include/test/connection_handler/mock_connection_handler.h @@ -84,6 +84,8 @@ class MockConnectionHandler : public connection_handler::ConnectionHandler { void(uint32_t connection_key, uint8_t session_id)); MOCK_METHOD2(BindProtocolVersionWithSession, void(uint32_t connection_key, uint8_t protocol_version)); + + // DEPRECATED MOCK_CONST_METHOD4(GetDataOnSessionKey, int32_t(uint32_t key, uint32_t* app_id, diff --git a/src/components/include/test/protocol_handler/mock_session_observer.h b/src/components/include/test/protocol_handler/mock_session_observer.h index dea91e0a82..197a4a86a9 100644 --- a/src/components/include/test/protocol_handler/mock_session_observer.h +++ b/src/components/include/test/protocol_handler/mock_session_observer.h @@ -89,12 +89,28 @@ class MockSessionObserver : public ::protocol_handler::SessionObserver { uint32_t* app_id, std::list<int32_t>* sessions_list, transport_manager::DeviceHandle* device_id)); + // DEPRECATED + MOCK_CONST_METHOD4(GetDataOnSessionKey, + int32_t(uint32_t key, + uint32_t* app_id, + std::list<int32_t>* sessions_list, + uint32_t* device_id)); + MOCK_CONST_METHOD5(GetDataOnDeviceID, int32_t(transport_manager::DeviceHandle device_handle, std::string* device_name, std::list<uint32_t>* applications_list, std::string* mac_address, std::string* connection_type)); + + // DEPRECATED + MOCK_CONST_METHOD5(GetDataOnDeviceID, + int32_t(uint32_t device_handle, + std::string* device_name, + std::list<uint32_t>* applications_list, + std::string* mac_address, + std::string* connection_type)); + MOCK_CONST_METHOD2(IsHeartBeatSupported, bool(transport_manager::ConnectionUID connection_handle, uint8_t session_id)); diff --git a/src/components/include/transport_manager/transport_adapter/transport_adapter_event.h b/src/components/include/transport_manager/transport_adapter/transport_adapter_event.h index 8221ecf10b..0c06c39723 100644 --- a/src/components/include/transport_manager/transport_adapter/transport_adapter_event.h +++ b/src/components/include/transport_manager/transport_adapter/transport_adapter_event.h @@ -85,6 +85,31 @@ class TransportAdapterEvent { , transport_adapter(adapter) , event_data(data) , event_error(error) {} + + /** + * DEPRECATED + * @brief Constructor. + * + * @param type Event type. + * @param transport_adapter Transport adapter + * @param device_handle Handle of device. + * @param application_id Handle of application. + * @param data Smart pointer to the raw message. + * @param error Error class that contains details of this error situation. + */ + TransportAdapterEvent(int type, + transport_adapter::TransportAdapter* adapter, + const DeviceUID& device_handle, + const ApplicationHandle& application_id, + ::protocol_handler::RawMessagePtr data, + BaseErrorPtr error) + : event_type(static_cast<EventTypeEnum>(type)) + , application_id(application_id) + , device_uid(device_handle) + , transport_adapter(adapter) + , event_data(data) + , event_error(error) {} + /** * @brief Value that describe event type. */ |