diff options
author | LitvinenkoIra <ilytvynenko@luxoft.com> | 2021-02-02 11:26:12 +0200 |
---|---|---|
committer | LitvinenkoIra <ilytvynenko@luxoft.com> | 2021-02-02 11:26:12 +0200 |
commit | ca28def12d78ea566dd45120bb81ef03b06eadea (patch) | |
tree | 4dea597525934c6524b1b59ed74fedb02779d35d | |
parent | 1789f961406ade482dd701331062d15c56b66456 (diff) | |
parent | 94e3c8e0374ac6f15f109018b0bf598896d72aa4 (diff) | |
download | sdl_core-ca28def12d78ea566dd45120bb81ef03b06eadea.tar.gz |
Merge remote-tracking branch 'origin/develop' into feature/sdl_0293_enable_oem_exclusive_apps_support_base_impl
24 files changed, 239 insertions, 69 deletions
diff --git a/src/appMain/sdl_preloaded_pt.json b/src/appMain/sdl_preloaded_pt.json index cf3cc43fbb..7561d4e629 100644 --- a/src/appMain/sdl_preloaded_pt.json +++ b/src/appMain/sdl_preloaded_pt.json @@ -3858,25 +3858,63 @@ "name": "driverDoorAjar", "key": "OEM_REF_DR_DOOR_AJ", "type": "Boolean", - "mandatory": false + "mandatory": false, + "deprecated": true, + "since": "7.1" }, { "name": "passengerDoorAjar", "key": "OEM_REF_PAS_DOOR_AJ", "type": "Boolean", - "mandatory": false + "mandatory": false, + "deprecated": true, + "since": "7.1" }, { "name": "rearLeftDoorAjar", "key": "OEM_REF_REAR_LEFT_DOOR_AJ", "type": "Boolean", - "mandatory": false + "mandatory": false, + "deprecated": true, + "since": "7.1" }, { "name": "rearRightDoorAjar", "key": "OEM_REF_REAR_RIGHT_DOOR_AJ", "type": "Boolean", - "mandatory": false + "mandatory": false, + "deprecated": true, + "since": "7.1" + }, + { + "name": "doorStatuses", + "key": "OEM_REF_DOOR_STATUSES", + "array": true, + "type": "DoorStatus", + "mandatory": false, + "minsize": 0, + "maxsize": 100, + "since": "7.1" + }, + { + "name": "gateStatuses", + "key": "OEM_REF_GATE_STATUSES", + "array": true, + "type": "GateStatus", + "mandatory": false, + "minsize": 0, + "maxsize": 100, + "since": "7.1" + }, + { + "name": "roofStatuses", + "key": "OEM_REF_ROOF_STATUSES", + "array": true, + "type": "RoofStatus", + "mandatory": false, + "minsize": 0, + "maxsize": 100, + "since": "7.1" } ], "key": "OEM_REF_BODY_INF", diff --git a/src/components/application_manager/include/application_manager/smart_object_keys.h b/src/components/application_manager/include/application_manager/smart_object_keys.h index e3730480b7..89adc40894 100644 --- a/src/components/application_manager/include/application_manager/smart_object_keys.h +++ b/src/components/application_manager/include/application_manager/smart_object_keys.h @@ -171,6 +171,9 @@ extern const char* minutes; extern const char* seconds; extern const char* update_mode; extern const char* audioStreamingIndicator; +extern const char* seek_time; +extern const char* forward_seek_indicator; +extern const char* back_seek_indicator; extern const char* trigger_source; extern const char* hmi_level; extern const char* activate_app_hmi_level; diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc index b9d87d74b1..b623350388 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc @@ -88,7 +88,8 @@ void RCAppExtension::UnsubscribeFromInteriorVehicleData( void RCAppExtension::UnsubscribeFromInteriorVehicleDataOfType( const std::string& module_type) { bool unsubscribed = false; - for (auto& item : subscribed_interior_vehicle_data_) { + auto subscribed_ivi = subscribed_interior_vehicle_data_; + for (auto& item : subscribed_ivi) { if (module_type == item.first) { subscribed_interior_vehicle_data_.erase(item); unsubscribed = true; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h index adced13d73..3023bf4fec 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h @@ -74,7 +74,7 @@ class SetMediaClockRequest : public app_mngr::commands::CommandRequestImpl { void on_event(const app_mngr::event_engine::Event& event); private: - bool isDataValid(); + bool isDataValid(std::string& info); DISALLOW_COPY_AND_ASSIGN(SetMediaClockRequest); }; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc index cf5d80ecc0..285118749a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc @@ -37,6 +37,7 @@ #include "application_manager/message_helper.h" #include "interfaces/HMI_API.h" #include "interfaces/MOBILE_API.h" +#include "smart_objects/enum_schema_item.h" namespace sdl_rpc_plugin { using namespace application_manager; @@ -76,7 +77,8 @@ void SetMediaClockRequest::Run() { return; } - if (isDataValid()) { + std::string info; + if (isDataValid(info)) { // copy entirely msg smart_objects::SmartObject msg_params = (*message_)[strings::msg_params]; msg_params[strings::app_id] = app->app_id(); @@ -85,7 +87,9 @@ void SetMediaClockRequest::Run() { SendHMIRequest( hmi_apis::FunctionID::UI_SetMediaClockTimer, &msg_params, true); } else { - SendResponse(false, mobile_apis::Result::INVALID_DATA); + SendResponse(false, + mobile_apis::Result::INVALID_DATA, + info.empty() ? NULL : info.c_str()); } } @@ -117,7 +121,7 @@ void SetMediaClockRequest::on_event(const event_engine::Event& event) { } } -bool SetMediaClockRequest::isDataValid() { +bool SetMediaClockRequest::isDataValid(std::string& info) { smart_objects::SmartObject msg_params = (*message_)[strings::msg_params]; mobile_apis::UpdateMode::eType update_mode = static_cast<mobile_apis::UpdateMode::eType>( @@ -126,7 +130,10 @@ bool SetMediaClockRequest::isDataValid() { if (update_mode == mobile_apis::UpdateMode::COUNTUP || update_mode == mobile_apis::UpdateMode::COUNTDOWN) { if (!msg_params.keyExists(strings::start_time)) { - SDL_LOG_INFO("Invalid data"); + info = + "Start time must be provided for \"COUNTUP\" and \"COUNTDOWN\" " + "update modes"; + SDL_LOG_INFO("Invalid data: " << info); return false; } @@ -151,7 +158,33 @@ bool SetMediaClockRequest::isDataValid() { (update_mode == mobile_apis::UpdateMode::COUNTDOWN)) || ((end_time_in_seconds < start_time_in_seconds) && (update_mode == mobile_apis::UpdateMode::COUNTUP))) { - SDL_LOG_INFO("Invalid data"); + std::string update_mode_name; + smart_objects::EnumConversionHelper< + mobile_apis::UpdateMode::eType>::EnumToString(update_mode, + &update_mode_name); + info = "Start time must be " + + std::string((update_mode == mobile_apis::UpdateMode::COUNTUP) + ? "before" + : "after") + + " the end time for update mode " + update_mode_name; + SDL_LOG_INFO("Invalid data: " << info); + return false; + } + } + } + + std::vector<std::string> indicator_keys{strings::forward_seek_indicator, + strings::back_seek_indicator}; + for (auto& key : indicator_keys) { + if (msg_params.keyExists(key)) { + mobile_apis::SeekIndicatorType::eType seek_indicator_type = + static_cast<mobile_apis::SeekIndicatorType::eType>( + msg_params[key][strings::type].asUInt()); + if (seek_indicator_type == mobile_apis::SeekIndicatorType::TRACK && + msg_params[key].keyExists(strings::seek_time)) { + info = + "The seekTime parameter is not applicable for indicator type TRACK"; + SDL_LOG_INFO("Invalid data: " << info); return false; } } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_request.cc index 8ffeaf922a..7d81701a64 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_request.cc @@ -314,8 +314,8 @@ bool UnsubscribeVehicleDataRequest::CheckSubscriptionStatus( bool UnsubscribeVehicleDataRequest::UnsubscribePendingVehicleData( ApplicationSharedPtr app, const smart_objects::SmartObject& msg_params) { SDL_LOG_DEBUG("Unsubscribing from all pending VehicleData"); - - for (const auto& vi_name : vi_waiting_for_unsubscribe_) { + auto pending_vi = vi_waiting_for_unsubscribe_; + for (const auto& vi_name : pending_vi) { const auto converted_item = ConvertRequestToResponseName(vi_name); const bool is_unsubscription_successful = CheckSubscriptionStatus(converted_item, msg_params); diff --git a/src/components/application_manager/src/display_capabilities_builder.cc b/src/components/application_manager/src/display_capabilities_builder.cc index e0d486ab14..2988d53471 100644 --- a/src/components/application_manager/src/display_capabilities_builder.cc +++ b/src/components/application_manager/src/display_capabilities_builder.cc @@ -157,7 +157,8 @@ bool DisplayCapabilitiesBuilder::IsWaitingForWindowCapabilities( void DisplayCapabilitiesBuilder::ResetDisplayCapabilities() { SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(display_capabilities_lock_); - for (auto& window_id : window_ids_to_resume_) { + auto window_ids = window_ids_to_resume_; + for (auto& window_id : window_ids) { if (kDefaultWindowID != window_id) { window_ids_to_resume_.erase(window_id); } diff --git a/src/components/application_manager/src/helpers/application_helper.cc b/src/components/application_manager/src/helpers/application_helper.cc index c9a0d87aed..74810d7e09 100644 --- a/src/components/application_manager/src/helpers/application_helper.cc +++ b/src/components/application_manager/src/helpers/application_helper.cc @@ -23,9 +23,9 @@ void DeleteWayPoints(ApplicationSharedPtr app, void DeleteCommands(ApplicationSharedPtr app, ApplicationManager& app_manager) { auto accessor = app->commands_map(); - const auto& commands_map = accessor.GetData(); + const auto commands_map = accessor.GetData(); - for (const auto& cmd : commands_map) { + for (const auto cmd : commands_map) { auto delete_UI_msg = MessageHelper::CreateDeleteUICommandRequest( cmd.second, app->app_id(), app_manager.GetNextHMICorrelationID()); app_manager.GetRPCService().ManageHMICommand(delete_UI_msg); @@ -41,9 +41,9 @@ void DeleteCommands(ApplicationSharedPtr app, ApplicationManager& app_manager) { void DeleteSubmenus(ApplicationSharedPtr app, ApplicationManager& app_manager) { auto accessor = app->sub_menu_map(); - const auto& sub_menu_map = accessor.GetData(); + const auto sub_menu_map = accessor.GetData(); - for (const auto& smenu : sub_menu_map) { + for (const auto smenu : sub_menu_map) { MessageHelper::SendDeleteSubmenuRequest(smenu.second, app, app_manager); app->RemoveSubMenu(smenu.first); } @@ -52,9 +52,9 @@ void DeleteSubmenus(ApplicationSharedPtr app, ApplicationManager& app_manager) { void DeleteChoiceSets(ApplicationSharedPtr app, ApplicationManager& app_manager) { auto accessor = app->choice_set_map(); - const auto& choices = accessor.GetData(); + const auto choices = accessor.GetData(); - for (const auto& choice : choices) { + for (const auto choice : choices) { MessageHelper::SendDeleteChoiceSetRequest(choice.second, app, app_manager); app->RemoveChoiceSet(choice.first); } diff --git a/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc b/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc index 17980ae5ad..3b091c74a8 100644 --- a/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc +++ b/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc @@ -534,9 +534,9 @@ void ResumptionDataProcessorImpl::DeleteSubmenus( application->app_id(), resumption_status_, resumption_status_lock_); auto accessor = application->sub_menu_map(); - const auto& sub_menu_map = accessor.GetData(); + const auto sub_menu_map = accessor.GetData(); - for (const auto& smenu : sub_menu_map) { + for (const auto smenu : sub_menu_map) { auto failed_submenu_request = FindResumptionSubmenuRequest(smenu.first, failed_requests); if (!failed_submenu_request) { @@ -627,9 +627,9 @@ void ResumptionDataProcessorImpl::DeleteCommands( }; auto accessor = application->commands_map(); - const auto& commands_map = accessor.GetData(); + const auto commands_map = accessor.GetData(); - for (const auto& cmd : commands_map) { + for (const auto cmd : commands_map) { const auto cmd_id = extract_cmd_id(cmd.second); if (0 == cmd_id) { SDL_LOG_ERROR("Can't extract cmd_id for command with internal number: " @@ -719,8 +719,8 @@ void ResumptionDataProcessorImpl::DeleteChoicesets( application->app_id(), resumption_status_, resumption_status_lock_); auto accessor = application->choice_set_map(); - const auto& choices = accessor.GetData(); - for (const auto& choice : choices) { + const auto choices = accessor.GetData(); + for (const auto choice : choices) { auto failed_choice_set = FindResumptionChoiceSetRequest(choice.first, failed_requests); if (!failed_choice_set) { @@ -881,7 +881,7 @@ void ResumptionDataProcessorImpl::DeleteButtonsSubscriptions( SDL_LOG_AUTO_TRACE(); const ButtonSubscriptions button_subscriptions = application->SubscribedButtons().GetData(); - for (auto& btn : button_subscriptions) { + for (auto btn : button_subscriptions) { const auto hmi_btn = static_cast<hmi_apis::Common_ButtonName::eType>(btn); if (hmi_apis::Common_ButtonName::CUSTOM_BUTTON == hmi_btn) { continue; diff --git a/src/components/application_manager/src/smart_object_keys.cc b/src/components/application_manager/src/smart_object_keys.cc index 4db386692a..d1671f5477 100644 --- a/src/components/application_manager/src/smart_object_keys.cc +++ b/src/components/application_manager/src/smart_object_keys.cc @@ -138,6 +138,9 @@ const char* minutes = "minutes"; const char* seconds = "seconds"; const char* update_mode = "updateMode"; const char* audioStreamingIndicator = "audioStreamingIndicator"; +const char* seek_time = "seekTime"; +const char* forward_seek_indicator = "forwardSeekIndicator"; +const char* back_seek_indicator = "backSeekIndicator"; const char* trigger_source = "triggerSource"; const char* hmi_level = "hmiLevel"; const char* activate_app_hmi_level = "level"; diff --git a/src/components/include/protocol_handler/protocol_handler.h b/src/components/include/protocol_handler/protocol_handler.h index c7ee670972..b9cc2e9700 100644 --- a/src/components/include/protocol_handler/protocol_handler.h +++ b/src/components/include/protocol_handler/protocol_handler.h @@ -146,7 +146,7 @@ class ProtocolHandler { virtual void ProcessFailedPTU() = 0; -#ifdef EXTERNAL_PROPRIETARY_MODE +#if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY) /** * @brief ProcessFailedCertDecrypt is called to notify security manager that * certificate decryption failed in the external flow diff --git a/src/components/include/security_manager/security_manager.h b/src/components/include/security_manager/security_manager.h index 358c4e5268..305ade2b47 100644 --- a/src/components/include/security_manager/security_manager.h +++ b/src/components/include/security_manager/security_manager.h @@ -170,7 +170,7 @@ class SecurityManager : public protocol_handler::ProtocolObserver, virtual void ProcessFailedPTU() = 0; -#ifdef EXTERNAL_PROPRIETARY_MODE +#if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY) /** * @brief ProcessFailedCertDecrypt is called to notify listeners that * certificate decryption failed in the external flow diff --git a/src/components/include/test/protocol_handler/mock_protocol_handler.h b/src/components/include/test/protocol_handler/mock_protocol_handler.h index 94a9efd9e5..da71d9bc90 100644 --- a/src/components/include/test/protocol_handler/mock_protocol_handler.h +++ b/src/components/include/test/protocol_handler/mock_protocol_handler.h @@ -71,7 +71,7 @@ class MockProtocolHandler : public ::protocol_handler::ProtocolHandler { MOCK_METHOD0(NotifyOnGetSystemTimeFailed, void()); MOCK_CONST_METHOD1(IsRPCServiceSecure, bool(const uint32_t connection_key)); MOCK_METHOD0(ProcessFailedPTU, void()); -#ifdef EXTERNAL_PROPRIETARY_MODE +#if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY) MOCK_METHOD0(ProcessFailedCertDecrypt, void()); #endif }; diff --git a/src/components/include/test/security_manager/mock_security_manager.h b/src/components/include/test/security_manager/mock_security_manager.h index e44d6207c1..d6ef7d1bbd 100644 --- a/src/components/include/test/security_manager/mock_security_manager.h +++ b/src/components/include/test/security_manager/mock_security_manager.h @@ -75,7 +75,7 @@ class MockSecurityManager : public ::security_manager::SecurityManager { MOCK_METHOD1(PostponeHandshake, void(const uint32_t)); MOCK_CONST_METHOD0(IsSystemTimeProviderReady, bool()); MOCK_METHOD0(ResetPendingSystemTimeRequests, void()); -#ifdef EXTERNAL_PROPRIETARY_MODE +#if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY) MOCK_METHOD0(ProcessFailedCertDecrypt, void()); #endif }; diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml index 56e47d2b1f..6ec966925d 100644 --- a/src/components/interfaces/HMI_API.xml +++ b/src/components/interfaces/HMI_API.xml @@ -1741,7 +1741,6 @@ <!-- End of Policies --> <!-- Remote Control --> - <struct name="Grid"> <description>Describes a location (origin coordinates and span) of a vehicle component.</description> <param name="col" type="Integer" mandatory="true" minvalue="-1" maxvalue="100"> @@ -3334,6 +3333,35 @@ </param> </struct> +<enum name="DoorStatusType"> + <element name="CLOSED"/> + <element name="LOCKED"/> + <element name="AJAR"/> + <element name="REMOVED"/> +</enum> + +<struct name="DoorStatus"> + <description>Describes the status of a parameter of door.</description> + <param name="location" type="Common.Grid" mandatory="true"/> + <param name="status" type="Common.DoorStatusType" mandatory="true"/> +</struct> + +<struct name="GateStatus"> + <description>Describes the status of a parameter of trunk/hood/etc.</description> + <param name="location" type="Common.Grid" mandatory="true"/> + <param name="status" type="Common.DoorStatusType" mandatory="true"/> +</struct> + +<struct name="RoofStatus"> + <description> + Describes the status of a parameter of roof, convertible roof, sunroof/moonroof etc. + If roof is open (AJAR), state will determine percentage of roof open. + </description> + <param name="location" type="Common.Grid" mandatory="true"/> + <param name="status" type="Common.DoorStatusType" mandatory="true"/> + <param name="state" type="Common.WindowState" mandatory="false"/> +</struct> + <struct name="BodyInformation"> <param name="parkBrakeActive" type="Boolean" mandatory="true"> <description>Must be true if the park brake is active</description> @@ -3345,16 +3373,25 @@ <description>The status of the ignition. See IgnitionStatus.</description> </param> <param name="driverDoorAjar" type="Boolean" mandatory="false"> - <description>References signal "DrStatDrv_B_Actl".</description> + <description>References signal "DrStatDrv_B_Actl". Deprecated starting with RPC Spec 7.1.0.</description> </param> <param name="passengerDoorAjar" type="Boolean" mandatory="false"> - <description>References signal "DrStatPsngr_B_Actl".</description> + <description>References signal "DrStatPsngr_B_Actl". Deprecated starting with RPC Spec 7.1.0.</description> </param> <param name="rearLeftDoorAjar" type="Boolean" mandatory="false"> - <description>References signal "DrStatRl_B_Actl".</description> + <description>References signal "DrStatRl_B_Actl". Deprecated starting with RPC Spec 7.1.0.</description> </param> <param name="rearRightDoorAjar" type="Boolean" mandatory="false"> - <description>References signal "DrStatRr_B_Actl".</description> + <description>References signal "DrStatRr_B_Actl". Deprecated starting with RPC Spec 7.1.0.</description> + </param> + <param name="doorStatuses" type="Common.DoorStatus" array="true" minsize="0" maxsize="100" mandatory="false"> + <description>Provides status for doors if Ajar/Closed/Locked</description> + </param> + <param name="gateStatuses" type="Common.GateStatus" array="true" minsize="0" maxsize="100" mandatory="false"> + <description>Provides status for trunk/hood/etc. if Ajar/Closed/Locked</description> + </param> + <param name="roofStatuses" type="Common.RoofStatus" array="true" minsize="0" maxsize="100" mandatory="false"> + <description>Provides status for roof/convertible roof/sunroof/moonroof etc., if Closed/Ajar/Removed etc.</description> </param> </struct> @@ -4312,6 +4349,23 @@ </param> </struct> + <enum name="SeekIndicatorType"> + <element name="TRACK" /> + <element name="TIME" /> + </enum> + + <struct name="SeekStreamingIndicator"> + <description> + The seek next / skip previous subscription buttons' content + </description> + <param name="type" type="SeekIndicatorType" mandatory="true" /> + <param name="seekTime" type="Integer" minvalue="1" maxvalue="99" mandatory="false"> + <description> + If the type is TIME, this number of seconds may be present alongside the skip indicator. + It will indicate the number of seconds that the currently playing media will skip forward or backward. + </description> + </param> + </struct> </interface> <interface name="Buttons" version="1.3.0" date="2017-07-18"> @@ -5556,6 +5610,12 @@ <param name="audioStreamingIndicator" type="Common.AudioStreamingIndicator" mandatory="false"> <description>Indicates that a button press of the Play/Pause button would play, pause or Stop the current playback.</description> </param> + <param name="forwardSeekIndicator" type="Common.SeekStreamingIndicator" mandatory="false"> + <description>Used to control the forward seek button to either skip forward a set amount of time or to the next track.</description> + </param> + <param name="backSeekIndicator" type="Common.SeekStreamingIndicator" mandatory="false"> + <description>Used to control the backward seek button to either skip back a set amount of time or to the previous track.</description> + </param> <param name="countRate" type="Float" minvalue="0.1" maxvalue="100.0" defvalue="1.0" mandatory="false"> <description> The value of this parameter is the amount that the media clock timer will advance per 1.0 seconds of real time. diff --git a/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h b/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h index 3ea77c19cb..c75b1f272c 100644 --- a/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h +++ b/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h @@ -214,7 +214,7 @@ class ProtocolHandlerImpl void ProcessFailedPTU() OVERRIDE; -#ifdef EXTERNAL_PROPRIETARY_MODE +#if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY) /** * @brief ProcessFailedCertDecrypt is called to notify security manager that * certificate decryption failed in the external flow diff --git a/src/components/protocol_handler/src/protocol_handler_impl.cc b/src/components/protocol_handler/src/protocol_handler_impl.cc index 5017051a37..ca15e9481a 100644 --- a/src/components/protocol_handler/src/protocol_handler_impl.cc +++ b/src/components/protocol_handler/src/protocol_handler_impl.cc @@ -1210,7 +1210,7 @@ void ProtocolHandlerImpl::ProcessFailedPTU() { #endif // ENABLE_SECURITY } -#ifdef EXTERNAL_PROPRIETARY_MODE +#if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY) void ProtocolHandlerImpl::ProcessFailedCertDecrypt() { SDL_LOG_AUTO_TRACE(); security_manager_->ProcessFailedCertDecrypt(); diff --git a/src/components/protocol_handler/test/protocol_handler_tm_test.cc b/src/components/protocol_handler/test/protocol_handler_tm_test.cc index 40658c637f..f8b6de9548 100644 --- a/src/components/protocol_handler/test/protocol_handler_tm_test.cc +++ b/src/components/protocol_handler/test/protocol_handler_tm_test.cc @@ -47,6 +47,8 @@ #ifdef ENABLE_SECURITY #include "security_manager/mock_security_manager.h" #include "security_manager/mock_ssl_context.h" +#else +#include "utils/byte_order.h" #endif // ENABLE_SECURITY #include "transport_manager/mock_transport_manager.h" #include "utils/mock_system_time_handler.h" @@ -4486,8 +4488,8 @@ TEST_F(ProtocolHandlerImplTest, SetHashId_CorrectHashId) { RawMessagePtr raw_message; EXPECT_CALL(transport_manager_mock, SendMessageToDevice(_)) - .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), - SaveArg<0>(&raw_message), + .WillOnce(DoAll(SaveArg<0>(&raw_message), + NotifyTestAsyncWaiter(waiter), Return(transport_manager::E_SUCCESS))); times++; @@ -4500,6 +4502,7 @@ TEST_F(ProtocolHandlerImplTest, SetHashId_CorrectHashId) { full_version); EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout)); + ASSERT_NE(0, raw_message.use_count()); ProtocolPacket protocol_packet; RESULT_CODE res = protocol_packet.deserializePacket(raw_message->data(), @@ -4523,8 +4526,8 @@ TEST_F(ProtocolHandlerImplTest, SetHashId_HASH_ID_NOT_SUPPORTED) { RawMessagePtr raw_message; EXPECT_CALL(transport_manager_mock, SendMessageToDevice(_)) - .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), - SaveArg<0>(&raw_message), + .WillOnce(DoAll(SaveArg<0>(&raw_message), + NotifyTestAsyncWaiter(waiter), Return(transport_manager::E_SUCCESS))); times++; @@ -4537,6 +4540,7 @@ TEST_F(ProtocolHandlerImplTest, SetHashId_HASH_ID_NOT_SUPPORTED) { full_version); EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout)); + ASSERT_NE(0, raw_message.use_count()); ProtocolPacket protocol_packet; RESULT_CODE res = protocol_packet.deserializePacket(raw_message->data(), @@ -4558,8 +4562,8 @@ TEST_F(ProtocolHandlerImplTest, SetHashId_HASH_ID_WRONG) { RawMessagePtr raw_message; EXPECT_CALL(transport_manager_mock, SendMessageToDevice(_)) - .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), - SaveArg<0>(&raw_message), + .WillOnce(DoAll(SaveArg<0>(&raw_message), + NotifyTestAsyncWaiter(waiter), Return(transport_manager::E_SUCCESS))); times++; @@ -4572,6 +4576,7 @@ TEST_F(ProtocolHandlerImplTest, SetHashId_HASH_ID_WRONG) { full_version); EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout)); + ASSERT_NE(0, raw_message.use_count()); ProtocolPacket protocol_packet; RESULT_CODE res = protocol_packet.deserializePacket(raw_message->data(), @@ -4698,8 +4703,8 @@ TEST_F(ProtocolHandlerImplTest, RawMessagePtr raw_message; EXPECT_CALL(transport_manager_mock, SendMessageToDevice(_)) - .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), - SaveArg<0>(&raw_message), + .WillOnce(DoAll(SaveArg<0>(&raw_message), + NotifyTestAsyncWaiter(waiter), Return(transport_manager::E_SUCCESS))); times++; @@ -4709,10 +4714,11 @@ TEST_F(ProtocolHandlerImplTest, kFinalMessage); handler->Handle(message); + EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout)); + ASSERT_NE(0, raw_message.use_count()); + EXPECT_EQ(data_value, raw_message->data()[protocol_handler::PROTOCOL_HEADER_V2_SIZE]); - - EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout)); } TEST_F(ProtocolHandlerImplTest, @@ -4737,8 +4743,8 @@ TEST_F(ProtocolHandlerImplTest, RawMessagePtr raw_message; EXPECT_CALL(transport_manager_mock, SendMessageToDevice(_)) - .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), - SaveArg<0>(&raw_message), + .WillOnce(DoAll(SaveArg<0>(&raw_message), + NotifyTestAsyncWaiter(waiter), Return(transport_manager::E_SUCCESS))); times++; @@ -4748,10 +4754,11 @@ TEST_F(ProtocolHandlerImplTest, kFinalMessage); handler->Handle(message); + EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout)); + ASSERT_NE(0, raw_message.use_count()); + EXPECT_EQ(data_value, raw_message->data()[protocol_handler::PROTOCOL_HEADER_V2_SIZE]); - - EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout)); } TEST_F(ProtocolHandlerImplTest, @@ -4789,8 +4796,8 @@ TEST_F(ProtocolHandlerImplTest, RawMessagePtr raw_message; EXPECT_CALL(transport_manager_mock, SendMessageToDevice(_)) - .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), - SaveArg<0>(&raw_message), + .WillOnce(DoAll(SaveArg<0>(&raw_message), + NotifyTestAsyncWaiter(waiter), Return(transport_manager::E_SUCCESS))); times++; @@ -4801,10 +4808,11 @@ TEST_F(ProtocolHandlerImplTest, message->set_protection_flag(PROTECTION_ON); handler->Handle(message); + EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout)); + ASSERT_NE(0, raw_message.use_count()); + EXPECT_EQ(data_value, raw_message->data()[protocol_handler::PROTOCOL_HEADER_V2_SIZE]); - - EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout)); } TEST_F(ProtocolHandlerImplTest, @@ -4839,8 +4847,8 @@ TEST_F(ProtocolHandlerImplTest, RawMessagePtr raw_message; EXPECT_CALL(transport_manager_mock, SendMessageToDevice(_)) - .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), - SaveArg<0>(&raw_message), + .WillOnce(DoAll(SaveArg<0>(&raw_message), + NotifyTestAsyncWaiter(waiter), Return(transport_manager::E_SUCCESS))); times++; @@ -4851,10 +4859,11 @@ TEST_F(ProtocolHandlerImplTest, message->set_protection_flag(PROTECTION_ON); handler->Handle(message); + EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout)); + ASSERT_NE(0, raw_message.use_count()); + EXPECT_EQ(encrypted_data, raw_message->data()[protocol_handler::PROTOCOL_HEADER_V2_SIZE]); - - EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout)); } TEST_F(ProtocolHandlerImplTest, DecryptFrame_NoSecurityManager_Cancelled) { diff --git a/src/components/security_manager/include/security_manager/security_manager_impl.h b/src/components/security_manager/include/security_manager/security_manager_impl.h index 6e5fb08c20..7cbb19708e 100644 --- a/src/components/security_manager/include/security_manager/security_manager_impl.h +++ b/src/components/security_manager/include/security_manager/security_manager_impl.h @@ -216,7 +216,7 @@ class SecurityManagerImpl : public SecurityManager, void ProcessFailedPTU() OVERRIDE; -#ifdef EXTERNAL_PROPRIETARY_MODE +#if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY) /** * @brief ProcessFailedCertDecrypt is called to notify listeners that * certificate decryption failed in the external flow diff --git a/src/components/security_manager/src/security_manager_impl.cc b/src/components/security_manager/src/security_manager_impl.cc index 1bf10c4f7c..914d30003a 100644 --- a/src/components/security_manager/src/security_manager_impl.cc +++ b/src/components/security_manager/src/security_manager_impl.cc @@ -425,7 +425,7 @@ void SecurityManagerImpl::ProcessFailedPTU() { } } -#ifdef EXTERNAL_PROPRIETARY_MODE +#if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY) void SecurityManagerImpl::ProcessFailedCertDecrypt() { SDL_LOG_AUTO_TRACE(); { diff --git a/src/components/security_manager/src/ssl_context_impl.cc b/src/components/security_manager/src/ssl_context_impl.cc index 5d151e854a..3e1b7db0bb 100644 --- a/src/components/security_manager/src/ssl_context_impl.cc +++ b/src/components/security_manager/src/ssl_context_impl.cc @@ -588,7 +588,7 @@ void CryptoManagerImpl::SSLContextImpl::ResetConnection() { SSL_shutdown(connection_); } SDL_LOG_DEBUG("SSL connection recreation"); - SSL_CTX* ssl_context = connection_->ctx; + SSL_CTX* ssl_context = SSL_get_SSL_CTX(connection_); SSL_free(connection_); connection_ = SSL_new(ssl_context); if (mode_ == SERVER) { diff --git a/src/components/transport_manager/test/websocket_server_listener_test.cc b/src/components/transport_manager/test/websocket_server_listener_test.cc index 7991c6f1cb..6e1af1ee1b 100644 --- a/src/components/transport_manager/test/websocket_server_listener_test.cc +++ b/src/components/transport_manager/test/websocket_server_listener_test.cc @@ -128,6 +128,7 @@ TEST_F(WebSocketListenerTest, StartListening_ClientConnect_SUCCESS) { ws_client->Stop(); } +#ifdef ENABLE_SECURITY TEST_F(WebSocketListenerTest, StartListening_ClientConnectSecure_SUCCESS) { const auto ws_listener = std::make_shared<WebSocketListener>( &mock_ta_controller_, mock_tm_settings_, kNumThreads); @@ -254,6 +255,7 @@ TEST_F(WebSocketListenerTest, StartListening_AcceptorIsOpen_SUCCESS) { EXPECT_EQ(TransportAdapter::Error::OK, ws_listener->StartListening()); ws_client->Stop(); } +#endif } // namespace transport_manager_test } // namespace components diff --git a/src/components/utils/src/logger/log4cxxlogger.cc b/src/components/utils/src/logger/log4cxxlogger.cc index 7d43892073..1e87d8cc53 100644 --- a/src/components/utils/src/logger/log4cxxlogger.cc +++ b/src/components/utils/src/logger/log4cxxlogger.cc @@ -90,6 +90,7 @@ log4cxx::LevelPtr getLogLevel(LogLevel log_level) { return log4cxx::Level::getFatal(); default: assert(false); + return log4cxx::Level::getTrace(); } } diff --git a/tools/Utils/generate_test_certificates.py b/tools/Utils/generate_test_certificates.py index 2c1d2cddbf..ea37eeb4cc 100755 --- a/tools/Utils/generate_test_certificates.py +++ b/tools/Utils/generate_test_certificates.py @@ -9,6 +9,7 @@ import os import subprocess import tempfile +import shutil from argparse import ArgumentParser from subprocess import check_call @@ -42,6 +43,22 @@ def gen_root_cert(out_cert_file, key_file, days, answer): """ openssl("req -x509 -new -key", key_file, "-days", days, "-out", out_cert_file, "-subj", answer) +def gen_ca_cert(out_cert_file, key_file, ca_cert_file, ca_key_file, days, answer): + request_file = out_cert_file + ".req" + openssl("req -new -key", key_file, "-days", days, "-out", request_file, "-subj", answer) + + temp_dir = tempfile.mkdtemp() + config_file_path = os.path.join(temp_dir, "ca.conf") + config_file = open(config_file_path, 'w') + config_file.write("""[ v3_intermediate_ca ] + basicConstraints = critical, CA:true\n""") + config_file.close() + + openssl("x509 -hash -req -in", request_file, "-CA", ca_cert_file, "-CAkey", ca_key_file, \ + "-CAcreateserial -out", out_cert_file, "-days", days, "-extfile", config_file_path, "-extensions v3_intermediate_ca") + + shutil.rmtree(temp_dir) + def gen_cert(out_cert_file, key_file, ca_cert_file, ca_key_file, days, answer): """Certificate generator wrap console call @@ -58,7 +75,7 @@ def gen_expire_cert(out_cert_file, key_file, ca_cert_file, ca_key_file, days, an """Expired certificate generator wrap console call 'openssl req -new -key $key_file -days $days -out $out_cert_file -subj $answer' - 'openssl ca -batch -config $config_file_path -in $request_file -out $out_cert_file, + 'openssl ca -batch -config $config_file_path -in $request_file -out $out_cert_file, "-cert", ca_cert_file, "-keyfile", ca_key_file, "-startdate 150101000000Z -enddate 150314092653Z' """ request_file = out_cert_file + ".req" @@ -83,7 +100,7 @@ def gen_expire_cert(out_cert_file, key_file, ca_cert_file, ca_key_file, days, an default_ca = ca_default [ ca_default ] - dir = %s""" % (temp_dir, ) + """ + dir = %s""" % (temp_dir, ) + """ certs = %s""" % (current_dir, ) + """ new_certs_dir = %s""" % (current_dir, ) + """ database = %s""" % (database_file_path, ) + """ @@ -93,7 +110,7 @@ def gen_expire_cert(out_cert_file, key_file, ca_cert_file, ca_key_file, days, an private_key = %s""" % (os.path.abspath(ca_key_file), ) + """ default_days = 365 default_crl_days = 30 - default_md = md5 + default_md = sha256 preserve = no policy = generic_policy [ generic_policy ] @@ -109,6 +126,8 @@ def gen_expire_cert(out_cert_file, key_file, ca_cert_file, ca_key_file, days, an openssl("ca -batch -config", config_file_path, "-in", request_file, "-out", out_cert_file, "-startdate 150101000000Z -enddate 150314092653Z") + shutil.rmtree(temp_dir) + def gen_pkcs12(out, key_file, cert_file, verification_certificate) : """Pem to PKCS#12 standard wrap console call @@ -140,7 +159,7 @@ def answers(name, app_id, country, state, locality, organization, unit, email) : return answer def concat_files(out_file_name, *args) : - print "Concatenate text files", args, "into", out_file_name + print "Concatenate text files", args, "into", out_file_name with open(out_file_name, 'w') as outfile: for fname in args : with open(fname) as infile : @@ -199,14 +218,14 @@ def main(): ford_server_key_file = os.path.join(server_dir, "ford_server.key") ford_server_cert_file = os.path.join(server_dir, "ford_server.crt") gen_rsa_key(ford_server_key_file, 2048) - gen_cert(ford_server_cert_file, ford_server_key_file, server_root_cert_file, server_root_key_file, days, ford_server_answer) + gen_ca_cert(ford_server_cert_file, ford_server_key_file, server_root_cert_file, server_root_key_file, days, ford_server_answer) print print " --== Ford client CA certificate generating ==-- " ford_client_key_file = os.path.join(client_dir, "ford_client.key") ford_client_cert_file = os.path.join(client_dir, "ford_client.crt") gen_rsa_key(ford_client_key_file, 2048) - gen_cert(ford_client_cert_file, ford_client_key_file, client_root_cert_file, client_root_key_file, days, ford_client_answer) + gen_ca_cert(ford_client_cert_file, ford_client_key_file, client_root_cert_file, client_root_key_file, days, ford_client_answer) print print " --== SDL and SPT adjustment ==-- " |