From dce0fadc0a263120e0346780b7fbbed89867a0a6 Mon Sep 17 00:00:00 2001 From: Alexander Date: Mon, 18 Jun 2018 10:03:43 +0300 Subject: Remove all usage of SubscribedIVI from application manager --- .../include/application_manager/application.h | 1 - .../include/application_manager/application_impl.h | 1 - .../include/application_manager/message_helper.h | 14 ---- .../application_manager/src/application_impl.cc | 5 -- .../src/message_helper/message_helper.cc | 78 ---------------------- .../src/resumption/resumption_data.cc | 3 - .../include/application_manager/mock_application.h | 3 - .../application_manager/mock_message_helper.h | 2 - .../test/message_helper/message_helper_test.cc | 19 ------ .../test/mock_message_helper.cc | 6 -- .../test/resumption/resume_ctrl_test.cc | 2 - .../test/resumption/resumption_data_test.cc | 1 - 12 files changed, 135 deletions(-) diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h index c931c492bb..b5b43cb5ca 100644 --- a/src/components/application_manager/include/application_manager/application.h +++ b/src/components/application_manager/include/application_manager/application.h @@ -185,7 +185,6 @@ class DynamicApplicationData { virtual const smart_objects::SmartObject* show_command() const = 0; virtual const smart_objects::SmartObject* tbt_show_command() const = 0; virtual DataAccessor SubscribedButtons() const = 0; - virtual DataAccessor SubscribedIVI() const = 0; virtual const smart_objects::SmartObject* keyboard_props() const = 0; virtual const smart_objects::SmartObject* menu_title() const = 0; virtual const smart_objects::SmartObject* menu_icon() const = 0; 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 30280216b1..c4d4abbae2 100644 --- a/src/components/application_manager/include/application_manager/application_impl.h +++ b/src/components/application_manager/include/application_manager/application_impl.h @@ -214,7 +214,6 @@ class ApplicationImpl : public virtual Application, bool UnsubscribeFromButton(mobile_apis::ButtonName::eType btn_name); bool IsSubscribedToIVI(uint32_t vehicle_info_type) const OVERRIDE; - DataAccessor SubscribedIVI() const OVERRIDE; inline bool IsRegistered() const OVERRIDE; /** diff --git a/src/components/application_manager/include/application_manager/message_helper.h b/src/components/application_manager/include/application_manager/message_helper.h index c91bd43e72..6590098a01 100644 --- a/src/components/application_manager/include/application_manager/message_helper.h +++ b/src/components/application_manager/include/application_manager/message_helper.h @@ -226,20 +226,6 @@ class MessageHelper { static smart_objects::SmartObjectSPtr CreateSetAppIcon( const std::string& path_to_icon, uint32_t app_id); - DEPRECATED static bool SendIVISubscribtions(const uint32_t app_id, - ApplicationManager& app_mngr); - /** - * @brief Sends IVI subscription requests - */ - static bool SendIVISubscriptions(const uint32_t app_id, - ApplicationManager& app_mngr); - - /** - * @brief Returns IVI subscription requests - */ - static smart_objects::SmartObjectList GetIVISubscriptionRequests( - ApplicationSharedPtr app, ApplicationManager& app_mngr); - /** * @brief Sends button subscription notification */ diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc index d5820eb86d..941bfbbd9a 100644 --- a/src/components/application_manager/src/application_impl.cc +++ b/src/components/application_manager/src/application_impl.cc @@ -874,11 +874,6 @@ DataAccessor ApplicationImpl::SubscribedButtons() const { return DataAccessor(subscribed_buttons_, button_lock_); } -DataAccessor ApplicationImpl::SubscribedIVI() const { - return DataAccessor(subscribed_vehicle_info_, - vi_lock_); -} - const std::string& ApplicationImpl::curHash() const { return hash_val_; } 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 972ca812d0..0f44342a02 100644 --- a/src/components/application_manager/src/message_helper/message_helper.cc +++ b/src/components/application_manager/src/message_helper/message_helper.cc @@ -1044,84 +1044,6 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateSetAppIcon( return set_icon; } -bool MessageHelper::SendIVISubscribtions(const uint32_t app_id, - ApplicationManager& app_mngr) { - return SendIVISubscriptions(app_id, app_mngr); -} - -bool MessageHelper::SendIVISubscriptions(const uint32_t app_id, - ApplicationManager& app_mngr) { - LOG4CXX_AUTO_TRACE(logger_); - - bool result = true; - ApplicationSharedPtr app = app_mngr.application(app_id); - - if (!app.valid()) { - LOG4CXX_ERROR(logger_, "Invalid application " << app_id); - return result; - } - - smart_objects::SmartObjectList requests = - GetIVISubscriptionRequests(app, app_mngr); - for (smart_objects::SmartObjectList::const_iterator it = requests.begin(); - it != requests.end(); - ++it) { - if (!app_mngr.GetRPCService().ManageHMICommand(*it)) { - result = false; - } - } - return result; -} - -smart_objects::SmartObjectList MessageHelper::GetIVISubscriptionRequests( - ApplicationSharedPtr app, ApplicationManager& app_mngr) { - LOG4CXX_AUTO_TRACE(logger_); - - smart_objects::SmartObjectList hmi_requests; - if (!app.valid()) { - LOG4CXX_ERROR(logger_, "Invalid application pointer "); - return hmi_requests; - } - - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - msg_params[strings::app_id] = app->app_id(); - const VehicleData& vehicle_data = MessageHelper::vehicle_data_; - VehicleData::const_iterator ivi_it = vehicle_data.begin(); - DataAccessor vi_accessor = app->SubscribedIVI(); - const VehicleInfoSubscriptions& subscriptions = vi_accessor.GetData(); - - for (; vehicle_data.end() != ivi_it; ++ivi_it) { - mobile_apis::VehicleDataType::eType type_id = ivi_it->second; - if (subscriptions.end() != subscriptions.find(type_id)) { - std::string key_name = ivi_it->first; - msg_params[key_name] = true; - } - } - -#ifdef HMI_JSON_API - smart_objects::SmartObjectSPtr request = MessageHelper::CreateModuleInfoSO( - hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData, app_mngr); - (*request)[strings::msg_params] = msg_params; - hmi_requests.push_back(request); -#endif // #ifdef HMI_JSON_API -#ifdef HMI_DBUS_API - // Generate list of ivi_subrequests - for (size_t i = 0; i < sizeof(ivi_subrequests) / sizeof(ivi_subrequests[0]); - ++i) { - const VehicleInfo_Requests& sr = ivi_subrequests[i]; - if (true == msg_params.keyExists(sr.str) && - true == msg_params[sr.str].asBool()) { - smart_objects::SmartObjectSPtr request = - MessageHelper::CreateModuleInfoSO(sr.func_id, app_mngr); - (*request)[strings::msg_params] = msg_params; - hmi_requests.push_back(request); - } - } -#endif // #ifdef HMI_DBUS_API - return hmi_requests; -} - void MessageHelper::SendOnButtonSubscriptionNotification( uint32_t app_id, hmi_apis::Common_ButtonName::eType button, diff --git a/src/components/application_manager/src/resumption/resumption_data.cc b/src/components/application_manager/src/resumption/resumption_data.cc index e1b86ae772..72215dcf97 100644 --- a/src/components/application_manager/src/resumption/resumption_data.cc +++ b/src/components/application_manager/src/resumption/resumption_data.cc @@ -159,9 +159,6 @@ smart_objects::SmartObject ResumptionData::GetApplicationSubscriptions( strings::application_buttons, subscriptions); - DataAccessor vi_accessor = - application->SubscribedIVI(); - for (auto extension : application->Extensions()) { extension->SaveResumptionData(subscriptions); } diff --git a/src/components/application_manager/test/include/application_manager/mock_application.h b/src/components/application_manager/test/include/application_manager/mock_application.h index 5750556774..d37beaaacf 100644 --- a/src/components/application_manager/test/include/application_manager/mock_application.h +++ b/src/components/application_manager/test/include/application_manager/mock_application.h @@ -204,9 +204,6 @@ class MockApplication : public ::application_manager::Application { MOCK_CONST_METHOD0( SubscribedButtons, DataAccessor< ::application_manager::ButtonSubscriptions>()); - MOCK_CONST_METHOD0( - SubscribedIVI, - DataAccessor< ::application_manager::VehicleInfoSubscriptions>()); MOCK_CONST_METHOD0(keyboard_props, const smart_objects::SmartObject*()); MOCK_CONST_METHOD0(menu_title, const smart_objects::SmartObject*()); MOCK_CONST_METHOD0(menu_icon, const smart_objects::SmartObject*()); diff --git a/src/components/application_manager/test/include/application_manager/mock_message_helper.h b/src/components/application_manager/test/include/application_manager/mock_message_helper.h index e8b0473c50..fe17eb6788 100644 --- a/src/components/application_manager/test/include/application_manager/mock_message_helper.h +++ b/src/components/application_manager/test/include/application_manager/mock_message_helper.h @@ -177,8 +177,6 @@ class MockMessageHelper { MOCK_METHOD1(CreateAddVRCommandRequestFromChoiceToHMI, smart_objects::SmartObjectList(ApplicationConstSharedPtr app)); MOCK_METHOD1(SendGlobalPropertiesToHMI, void(ApplicationConstSharedPtr app)); - MOCK_METHOD1(GetIVISubscriptionRequests, - smart_objects::SmartObjectList(ApplicationSharedPtr app)); MOCK_METHOD3(VerifyTtsFiles, mobile_apis::Result::eType(smart_objects::SmartObject& message, ApplicationConstSharedPtr app, diff --git a/src/components/application_manager/test/message_helper/message_helper_test.cc b/src/components/application_manager/test/message_helper/message_helper_test.cc index 8b5670037b..088eb1ca1b 100644 --- a/src/components/application_manager/test/message_helper/message_helper_test.cc +++ b/src/components/application_manager/test/message_helper/message_helper_test.cc @@ -708,25 +708,6 @@ TEST_F(MessageHelperTest, VerifySoftButtonString_CorrectStrings_True) { } } -TEST_F(MessageHelperTest, - GetIVISubscriptionRequests_ValidApplication_HmiRequestNotEmpty) { - // Creating sharedPtr to MockApplication - MockApplicationSharedPtr appSharedMock = utils::MakeShared(); - // Creating data acessor - application_manager::VehicleInfoSubscriptions vis; - DataAccessor data_accessor( - vis, true); - // Calls for ApplicationManager - EXPECT_CALL(*appSharedMock, app_id()).WillOnce(Return(1u)); - EXPECT_CALL(*appSharedMock, SubscribedIVI()).WillOnce(Return(data_accessor)); - - smart_objects::SmartObjectList outList = - MessageHelper::GetIVISubscriptionRequests(appSharedMock, - mock_application_manager); - // Expect not empty request - EXPECT_FALSE(outList.empty()); -} - TEST_F(MessageHelperTest, ProcessSoftButtons_SmartObjectWithoutButtonsKey_Success) { // Creating sharedPtr to MockApplication diff --git a/src/components/application_manager/test/mock_message_helper.cc b/src/components/application_manager/test/mock_message_helper.cc index 23dea01c8c..fc2136cdd8 100644 --- a/src/components/application_manager/test/mock_message_helper.cc +++ b/src/components/application_manager/test/mock_message_helper.cc @@ -312,12 +312,6 @@ void MessageHelper::SendGlobalPropertiesToHMI(ApplicationConstSharedPtr app, app); } -smart_objects::SmartObjectList MessageHelper::GetIVISubscriptionRequests( - ApplicationSharedPtr app, ApplicationManager& app_mngr) { - return MockMessageHelper::message_helper_mock()->GetIVISubscriptionRequests( - app); -} - mobile_apis::Result::eType MessageHelper::VerifyTtsFiles( smart_objects::SmartObject& message, ApplicationConstSharedPtr app, diff --git a/src/components/application_manager/test/resumption/resume_ctrl_test.cc b/src/components/application_manager/test/resumption/resume_ctrl_test.cc index eb724a88c2..736d5d1839 100644 --- a/src/components/application_manager/test/resumption/resume_ctrl_test.cc +++ b/src/components/application_manager/test/resumption/resume_ctrl_test.cc @@ -480,8 +480,6 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubscriptionToIVI) { EXPECT_CALL(*app_mock_, set_grammar_id(kTestGrammarId_)); smart_objects::SmartObjectList requests; - EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(), - GetIVISubscriptionRequests(_)).WillRepeatedly(Return(requests)); EXPECT_CALL(*app_mock_, UpdateHash()); const bool res = res_ctrl_->StartResumption(app_mock_, kHash_); diff --git a/src/components/application_manager/test/resumption/resumption_data_test.cc b/src/components/application_manager/test/resumption/resumption_data_test.cc index 0f90fe978f..2d9e16510b 100644 --- a/src/components/application_manager/test/resumption/resumption_data_test.cc +++ b/src/components/application_manager/test/resumption/resumption_data_test.cc @@ -364,7 +364,6 @@ void ResumptionDataTest::PrepareData() { ON_CALL(*app_mock, menu_icon()).WillByDefault(ReturnPointee(&menu_icon_)); ON_CALL(*app_mock, SubscribedButtons()).WillByDefault(Return(btn_sub)); - ON_CALL(*app_mock, SubscribedIVI()).WillByDefault(Return(ivi_access)); ON_CALL(*app_mock, getAppFiles()).WillByDefault(ReturnRef(app_files_map_)); } -- cgit v1.2.1