diff options
author | mked-luxoft <mked@luxoft.com> | 2019-08-21 15:53:30 +0300 |
---|---|---|
committer | mked-luxoft <mked@luxoft.com> | 2019-08-29 17:56:41 +0300 |
commit | 3f86f3864ae18515c5d1a9ddaf9f7fcaf4d59c62 (patch) | |
tree | 2029f4ac8fd27b3ed8fd5c203dd9a69ebe56aedd | |
parent | 4a63327a70e4d6fd817126c41e176a7a284c0a3c (diff) | |
download | sdl_core-3f86f3864ae18515c5d1a9ddaf9f7fcaf4d59c62.tar.gz |
fixup! Added sending error on PTU retries exceed allowed count
5 files changed, 8 insertions, 59 deletions
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 b0412a52cf..ddb6fb71f2 100644 --- a/src/components/application_manager/include/application_manager/message_helper.h +++ b/src/components/application_manager/include/application_manager/message_helper.h @@ -90,20 +90,6 @@ class MessageHelper { hmi_apis::FunctionID::eType function_id); /** - * @brief CreateOnSystemRequestNotificationToMobile creates mobile - * OnSystemRequestNotification - * @param policy_data pt snapshot data - * @param connection_key connection key of application - * @param request_type OnSystemRequest request type - * @return OnSystemRequest notification smart object - */ - static smart_objects::SmartObjectSPtr - CreateOnSystemRequestNotificationToMobile( - const std::vector<uint8_t>& policy_data, - const uint32_t connection_key, - const mobile_apis::RequestType::eType request_type); - - /** * @brief ServiceStatusUpdateNotificationBuilder small utility class used for * more flexible construction of OnServiceUpdateNotification */ 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 e98deab2d2..5c9e0e80b1 100644 --- a/src/components/application_manager/src/message_helper/message_helper.cc +++ b/src/components/application_manager/src/message_helper/message_helper.cc @@ -2465,49 +2465,32 @@ bool MessageHelper::SendUnsubscribedWayPoints(ApplicationManager& app_mngr) { return app_mngr.GetRPCService().ManageHMICommand(result); } -smart_objects::SmartObjectSPtr -MessageHelper::CreateOnSystemRequestNotificationToMobile( - const std::vector<uint8_t>& policy_data, - const uint32_t app_id, - const mobile_apis::RequestType::eType request_type) { - auto notification = - CreateNotification(mobile_apis::FunctionID::OnSystemRequestID, app_id); - - (*notification)[strings::params][strings::binary_data] = - smart_objects::SmartObject(policy_data); - - (*notification)[strings::msg_params][strings::request_type] = request_type; - - return notification; -} - void MessageHelper::SendPolicySnapshotNotification( uint32_t connection_key, const std::vector<uint8_t>& policy_data, const std::string& url, ApplicationManager& app_mngr) { + smart_objects::SmartObject content(smart_objects::SmartType_Map); const auto request_type = #if defined(PROPRIETARY_MODE) || defined(EXTERNAL_PROPRIETARY_MODE) mobile_apis::RequestType::PROPRIETARY; #else mobile_apis::RequestType::HTTP; #endif // PROPRIETARY || EXTERNAL_PROPRIETARY_MODE - auto notification = CreateOnSystemRequestNotificationToMobile( - policy_data, connection_key, request_type); + + content[strings::msg_params][strings::request_type] = request_type; if (!url.empty()) { - (*notification)[strings::msg_params][strings::url] = + content[strings::msg_params][strings::url] = url; // Doesn't work with mobile_notification::syncp_url ("URL") } else { LOG4CXX_WARN(logger_, "No service URLs"); } - (*notification)[strings::params][strings::binary_data] = + content[strings::params][strings::binary_data] = smart_objects::SmartObject(policy_data); - PrintSmartObject(*notification); - app_mngr.GetRPCService().ManageMobileCommand(notification, - commands::Command::SOURCE_SDL); + SendSystemRequestNotification(connection_key, content, app_mngr); } void MessageHelper::SendSystemRequestNotification( diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc index 81d80c2b00..c3b4520613 100644 --- a/src/components/application_manager/src/policies/policy_handler.cc +++ b/src/components/application_manager/src/policies/policy_handler.cc @@ -1522,13 +1522,8 @@ void PolicyHandler::OnSnapshotCreated(const BinaryMessage& pt_string, } if (PTUIterationType::RetryIteration == iteration_type) { - auto on_system_request_notification = - MessageHelper::CreateOnSystemRequestNotificationToMobile( - pt_string, - GetAppIdForSending(), - mobile_apis::RequestType::PROPRIETARY); - application_manager_.GetRPCService().ManageMobileCommand( - on_system_request_notification, commands::Command::SOURCE_SDL); + MessageHelper::SendPolicySnapshotNotification( + GetAppIdForSending(), pt_string, std::string(""), application_manager_); } else { MessageHelper::SendPolicyUpdate( policy_snapshot_full_path, 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 6f06a9adce..a164265ab0 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 @@ -141,11 +141,6 @@ class MockMessageHelper { MOCK_METHOD2(SendDecryptCertificateToHMI, void(const std::string& file_name, ApplicationManager& app_mngr)); - MOCK_METHOD3(CreateOnSystemRequestNotificationToMobile, - smart_objects::SmartObjectSPtr( - const std::vector<uint8_t>& policy_data, - const uint32_t connection_key, - const mobile_apis::RequestType::eType request_type)); #ifdef EXTERNAL_PROPRIETARY_MODE MOCK_METHOD4( SendGetListOfPermissionsResponse, diff --git a/src/components/application_manager/test/mock_message_helper.cc b/src/components/application_manager/test/mock_message_helper.cc index c11261fe88..b2c932a981 100755 --- a/src/components/application_manager/test/mock_message_helper.cc +++ b/src/components/application_manager/test/mock_message_helper.cc @@ -636,16 +636,6 @@ MessageHelper::ServiceStatusUpdateNotificationBuilder::notification() const { return MockMessageHelper::on_service_update_builder_mock()->notification(); } -smart_objects::SmartObjectSPtr -MessageHelper::CreateOnSystemRequestNotificationToMobile( - const std::vector<uint8_t>& policy_data, - const uint32_t connection_key, - const mobile_apis::RequestType::eType request_type) { - return MockMessageHelper::message_helper_mock() - ->CreateOnSystemRequestNotificationToMobile( - policy_data, connection_key, request_type); -} - smart_objects::SmartObject MessageHelper::CreateAppServiceCapabilities( std::vector<smart_objects::SmartObject>& all_services) { return MockMessageHelper::message_helper_mock()->CreateAppServiceCapabilities( |