diff options
56 files changed, 1501 insertions, 227 deletions
diff --git a/src/appMain/hmi_capabilities.json b/src/appMain/hmi_capabilities.json index 873c80d32e..481c6d0c6b 100755 --- a/src/appMain/hmi_capabilities.json +++ b/src/appMain/hmi_capabilities.json @@ -428,6 +428,7 @@ "acMaxEnableAvailable": true, "autoModeEnableAvailable": true, "circulateAirEnableAvailable": true, + "climateEnableAvailable": true, "currentTemperatureAvailable": true, "defrostZone": [ "FRONT", @@ -455,7 +456,7 @@ ], "radioControlCapabilities": [ { - "availableHDsAvailable": true, + "availableHdChannelsAvailable": true, "hdChannelAvailable": true, "moduleName": "radio", "radioBandAvailable": true, diff --git a/src/appMain/sdl_preloaded_pt.json b/src/appMain/sdl_preloaded_pt.json index c3ad296497..a34a5f92a6 100644 --- a/src/appMain/sdl_preloaded_pt.json +++ b/src/appMain/sdl_preloaded_pt.json @@ -271,6 +271,13 @@ "hmi_levels": ["BACKGROUND",
"FULL",
"LIMITED"]
+ },
+ "CloseApplication": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND"
+ ]
}
}
},
diff --git a/src/appMain/smartDeviceLink.ini b/src/appMain/smartDeviceLink.ini index 54c2395c47..40c1bf08a7 100644 --- a/src/appMain/smartDeviceLink.ini +++ b/src/appMain/smartDeviceLink.ini @@ -202,6 +202,9 @@ TCPAdapterPort = 12345 ; If the name is omitted, Core will listen on all network interfaces by binding to INADDR_ANY. TCPAdapterNetworkInterface = +; 128 bit uuid for bluetooth device discovery. Please format as 16 seperate bytes. +;BluetoothUUID = 0x93, 0x6D, 0xA0, 0x1F, 0x9A, 0xBD, 0x4D, 0x9D, 0x80, 0xC7, 0x02, 0xAF, 0x85, 0xC8, 0x22, 0xA8 + [CloudAppConnections] ; Value in milliseconds for time between retry attempts on a failed websocket connection CloudAppRetryTimeout = 1000 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 0642dd3cd1..2671278442 100644 --- a/src/components/application_manager/include/application_manager/message_helper.h +++ b/src/components/application_manager/include/application_manager/message_helper.h @@ -348,15 +348,16 @@ class MessageHelper { bool is_unexpected_disconnect, ApplicationManager& app_mngr); - static ns_smart_device_link::ns_smart_objects::SmartObjectSPtr - GetBCActivateAppRequestToHMI( + static smart_objects::SmartObjectSPtr GetBCActivateAppRequestToHMI( ApplicationConstSharedPtr app, - const protocol_handler::SessionObserver& session_observer, const policy::PolicyHandlerInterface& policy_handler, hmi_apis::Common_HMILevel::eType level, bool send_policy_priority, ApplicationManager& app_mngr); + static smart_objects::SmartObjectSPtr GetBCCloseApplicationRequestToHMI( + ApplicationConstSharedPtr app, ApplicationManager& app_mngr); + static void SendOnResumeAudioSourceToHMI(const uint32_t app_id, ApplicationManager& app_mngr); 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 fc124f7558..328d7f5e81 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 @@ -1,5 +1,5 @@ /* - Copyright (c) 2013, Ford Motor Company + Copyright (c) 2019, Ford Motor Company All rights reserved. Redistribution and use in source and binary forms, with or without @@ -216,6 +216,7 @@ extern const char* is_template; extern const char* image; extern const char* type; extern const char* system_file; +extern const char* is_system_file; extern const char* offset; extern const char* length; extern const char* secondary_image; @@ -344,6 +345,10 @@ extern const char* activate; extern const char* set_as_default; extern const char* origin_app; +// sis data +extern const char* station_short_name; +extern const char* station_location; + // resuming extern const char* application_commands; extern const char* application_submenus; @@ -367,8 +372,11 @@ extern const char* global_ign_on_counter; extern const char* connection_info; extern const char* is_download_complete; +extern const char* shifted; +extern const char* altitude; extern const char* longitude_degrees; extern const char* latitude_degrees; + extern const char* address; extern const char* country_name; extern const char* country_code; diff --git a/src/components/application_manager/include/application_manager/state_controller_impl.h b/src/components/application_manager/include/application_manager/state_controller_impl.h index f3b2966fca..77da28cc91 100644 --- a/src/components/application_manager/include/application_manager/state_controller_impl.h +++ b/src/components/application_manager/include/application_manager/state_controller_impl.h @@ -186,9 +186,9 @@ class StateControllerImpl : public event_engine::EventObserver, virtual bool IsStateActive(HmiState::StateID state_id) const; private: - int64_t SendBCActivateApp(ApplicationConstSharedPtr app, - hmi_apis::Common_HMILevel::eType level, - bool send_policy_priority); + int64_t RequestHMIStateChange(ApplicationConstSharedPtr app, + hmi_apis::Common_HMILevel::eType level, + bool send_policy_priority); /** * @brief The HmiLevelConflictResolver struct * Move other application to HmiStates if applied moved to FULL or LIMITED @@ -378,10 +378,11 @@ class StateControllerImpl : public event_engine::EventObserver, const mobile_apis::VideoStreamingState::eType video_state); /** - * @brief OnActivateAppResponse calback for activate app response + * @brief OnHMIResponse callback for activate app or close application + * response * @param message Smart Object */ - void OnActivateAppResponse(const smart_objects::SmartObject& message); + void OnHMIResponse(const smart_objects::SmartObject& message); /** * @brief OnAppDeactivated callback for OnAppDeactivated notification @@ -449,7 +450,7 @@ class StateControllerImpl : public event_engine::EventObserver, typedef std::list<HmiState::StateID> StateIDList; StateIDList active_states_; mutable sync_primitives::Lock active_states_lock_; - std::map<uint32_t, HmiStatePtr> waiting_for_activate_; + std::map<uint32_t, HmiStatePtr> waiting_for_response_; ApplicationManager& app_mngr_; }; } // namespace application_manager diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_helpers.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_helpers.h index cd87ad326e..e85ab758ad 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_helpers.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_helpers.h @@ -91,6 +91,15 @@ class RCHelpers { AppsModules; static AppsModules GetApplicationsAllowedModules( application_manager::ApplicationManager& app_mngr); + + /** + * @brief RemoveRedundantGPSDataFromVIDataMsg removes redundant GPS data + * params from interior vehicle data response message if one contains radio + * station location data + * @param msg_params Params of the interior vehicle data response message + */ + static void RemoveRedundantGPSDataFromIVDataMsg( + smart_objects::SmartObject& msg_params); }; } // namespace rc_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h index 92ff7e5f01..b9f922a1be 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h @@ -152,6 +152,7 @@ const char kBand[] = "band"; const char kRdsData[] = "rdsData"; const char kHdRadioEnable[] = "hdRadioEnable"; const char kAvailableHDs[] = "availableHDs"; +const char kAvailableHdChannels[] = "availableHdChannels"; const char kHdChannel[] = "hdChannel"; const char kSignalStrength[] = "signalStrength"; const char kSignalChangeThreshold[] = "signalChangeThreshold"; @@ -176,6 +177,8 @@ const char kHeatedSteeringWheelEnable[] = "heatedSteeringWheelEnable"; const char kHeatedWindshieldEnable[] = "heatedWindshieldEnable"; const char kHeatedRearWindowEnable[] = "heatedRearWindowEnable"; const char kHeatedMirrorsEnable[] = "heatedMirrorsEnable"; +const char kClimateEnable[] = "climateEnable"; +const char kClimateEnableAvailable[] = "climateEnableAvailable"; // ClimateControlData struct // LightControlData diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc index 47363bddcd..ded96461f5 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc @@ -109,6 +109,7 @@ void GetInteriorVehicleDataRequest::FilterDisabledModuleData( module_data[message_params::kHdRadioEnable].asBool() == false) { module_data.erase(message_params::kHdChannel); module_data.erase(message_params::kAvailableHDs); + module_data.erase(message_params::kAvailableHdChannels); module_data.erase(message_params::kSisData); } } diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_response.cc index a7572f1d62..b1fa8d6ea0 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_response.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_response.cc @@ -31,6 +31,7 @@ */ #include "rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_response.h" +#include "rc_rpc_plugin/rc_helpers.h" #include "utils/macro.h" namespace rc_rpc_plugin { @@ -49,6 +50,9 @@ GetInteriorVehicleDataResponse::~GetInteriorVehicleDataResponse() {} void GetInteriorVehicleDataResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); + + RCHelpers::RemoveRedundantGPSDataFromIVDataMsg( + (*message_)[app_mngr::strings::msg_params]); application_manager_.GetRPCService().SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc index 53b04ce3ef..06b5218bb3 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc @@ -75,6 +75,8 @@ void OnInteriorVehicleDataNotification::Run() { typedef std::vector<application_manager::ApplicationSharedPtr> AppPtrs; AppPtrs apps = RCRPCPlugin::GetRCApplications(application_manager_); + RCHelpers::RemoveRedundantGPSDataFromIVDataMsg( + (*message_)[app_mngr::strings::msg_params]); for (AppPtrs::iterator it = apps.begin(); it != apps.end(); ++it) { DCHECK(*it); application_manager::Application& app = **it; diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc index 2bf8fbbe92..44d302276d 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc @@ -55,6 +55,7 @@ std::vector<std::string> GetModuleReadOnlyParams( } else if (enums_value::kRadio == module_type) { module_ro_params.push_back(kRdsData); module_ro_params.push_back(kAvailableHDs); + module_ro_params.push_back(kAvailableHdChannels); module_ro_params.push_back(kSignalStrength); module_ro_params.push_back(kSignalChangeThreshold); module_ro_params.push_back(kState); @@ -92,6 +93,8 @@ const std::map<std::string, std::string> GetModuleDataToCapabilitiesMapping() { mapping["heatedWindshieldEnable"] = "heatedWindshieldAvailable"; mapping["heatedMirrorsEnable"] = "heatedMirrorsAvailable"; mapping["heatedRearWindowEnable"] = "heatedRearWindowAvailable"; + mapping["climateEnable"] = "climateEnableAvailable"; + mapping["climateEnableAvailable"] = "climateEnableAvailable"; // radio mapping["band"] = "radioBandAvailable"; @@ -99,7 +102,8 @@ const std::map<std::string, std::string> GetModuleDataToCapabilitiesMapping() { mapping["frequencyFraction"] = "radioFrequencyAvailable"; mapping["rdsData"] = "rdsDataAvailable"; mapping["availableHDs"] = "availableHDsAvailable"; - mapping["hdChannel"] = "availableHDsAvailable"; + mapping["availableHdChannels"] = "availableHdChannelsAvailable"; + mapping["hdChannel"] = "availableHdChannelsAvailable"; mapping["hdRadioEnable"] = "hdRadioEnableAvailable"; mapping["signalStrength"] = "signalStrengthAvailable"; mapping["signalChangeThreshold"] = "signalChangeThresholdAvailable"; @@ -716,21 +720,6 @@ void SetInteriorVehicleDataRequest::CutOffReadOnlyParams( const smart_objects::SmartObject& module_type_params = ControlData(module_data); const std::string module_type = ModuleType(); - std::vector<std::string> ro_params = GetModuleReadOnlyParams(module_type); - - for (auto& it : ro_params) { - if (module_type_params.keyExists(it)) { - if (enums_value::kClimate == module_type) { - module_data[message_params::kClimateControlData].erase(it); - } else if (enums_value::kRadio == module_type) { - module_data[message_params::kRadioControlData].erase(it); - } else { - continue; - } - - LOG4CXX_DEBUG(logger_, "Cutting-off READ ONLY parameter: " << it); - } - } if (enums_value::kAudio == module_type) { auto& equalizer_settings = module_data[message_params::kAudioControlData] @@ -745,6 +734,15 @@ void SetInteriorVehicleDataRequest::CutOffReadOnlyParams( } } } + + std::vector<std::string> ro_params = GetModuleReadOnlyParams(module_type); + const auto& data_mapping = RCHelpers::GetModuleTypeToDataMapping(); + for (const auto& param : ro_params) { + if (module_type_params.keyExists(param)) { + module_data[data_mapping(module_type)].erase(param); + LOG4CXX_DEBUG(logger_, "Cutting-off READ ONLY parameter: " << param); + } + } } std::string SetInteriorVehicleDataRequest::ModuleType() { diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc index b39b67d669..5785e58e5b 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc @@ -115,4 +115,30 @@ RCHelpers::AppsModules RCHelpers::GetApplicationsAllowedModules( } return result; } + +void RCHelpers::RemoveRedundantGPSDataFromIVDataMsg( + smart_objects::SmartObject& msg_params) { + using namespace message_params; + using namespace application_manager::strings; + + LOG4CXX_AUTO_TRACE(logger_); + auto& module_data = msg_params[kModuleData]; + if (!module_data.keyExists(kRadioControlData) || + !module_data[kRadioControlData].keyExists(kSisData) || + !module_data[kRadioControlData][kSisData].keyExists(station_location)) { + return; + } + + auto& location_data = + module_data[kRadioControlData][kSisData][station_location]; + auto new_location_data = + smart_objects::SmartObject(smart_objects::SmartType_Map); + new_location_data[latitude_degrees] = location_data[latitude_degrees]; + new_location_data[longitude_degrees] = location_data[longitude_degrees]; + if (location_data.keyExists(altitude)) { + new_location_data[altitude] = location_data[altitude]; + + location_data = new_location_data; + } +} } // namespace rc_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc index 9549830cec..123c22b944 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Ford Motor Company + * Copyright (c) 2019, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -44,6 +44,7 @@ #include "rc_rpc_plugin/rc_module_constants.h" #include "rc_rpc_plugin/rc_rpc_plugin.h" +#include <stdint.h> #include <chrono> #include <thread> @@ -205,6 +206,8 @@ TEST_F(GetInteriorVehicleDataRequestTest, HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData), _)) .WillOnce(Return(true)); // Act + + ASSERT_TRUE(command->Init()); command->Run(); } @@ -232,6 +235,7 @@ TEST_F(GetInteriorVehicleDataRequestTest, HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData), _)) .WillOnce(Return(true)); // Act + ASSERT_TRUE(command->Init()); command->Run(); } @@ -244,7 +248,19 @@ TEST_F( (*mobile_message)[application_manager::strings::msg_params] [message_params::kModuleType] = module_type; smart_objects::SmartObject radio_data; + smart_objects::SmartObject sis_data; + smart_objects::SmartObject gps_data; + + gps_data[application_manager::strings::longitude_degrees] = 1.0; + gps_data[application_manager::strings::latitude_degrees] = 1.0; + + sis_data[application_manager::strings::station_short_name] = + "dummy_short_name"; + sis_data[application_manager::strings::station_location] = gps_data; + radio_data[message_params::kBand] = enums_value::kAM; + radio_data[message_params::kSisData] = sis_data; + std::shared_ptr<rc_rpc_plugin::commands::GetInteriorVehicleDataRequest> command = CreateRCCommand< rc_rpc_plugin::commands::GetInteriorVehicleDataRequest>( @@ -263,6 +279,7 @@ TEST_F( .WillOnce(DoAll(SaveArg<0>(&command_result), Return(true))); // Act + ASSERT_TRUE(command->Init()); command->Run(); // Assert @@ -314,6 +331,7 @@ TEST_F( command = CreateRCCommand< rc_rpc_plugin::commands::GetInteriorVehicleDataRequest>( mobile_message); + ASSERT_TRUE(command->Init()); command->Run(); application_manager::event_engine::Event event( hmi_apis::FunctionID::RC_GetInteriorVehicleData); @@ -358,6 +376,7 @@ TEST_F(GetInteriorVehicleDataRequestTest, .WillOnce(DoAll(SaveArg<0>(&command_result), Return(true))); // Act + ASSERT_TRUE(command->Init()); command->Run(); // Assert @@ -393,6 +412,7 @@ TEST_F( MobileResultCodeIs(mobile_apis::Result::UNSUPPORTED_RESOURCE), _)) .WillOnce((Return(true))); // Act + ASSERT_TRUE(command->Init()); command->Run(); } @@ -418,6 +438,7 @@ TEST_F( .WillOnce((Return(true))); // Act + ASSERT_TRUE(command->Init()); command->Run(); } @@ -458,6 +479,7 @@ TEST_F(GetInteriorVehicleDataRequestTest, application_manager::event_engine::Event event( hmi_apis::FunctionID::RC_GetInteriorVehicleData); event.set_smart_object(*hmi_response_message); + ASSERT_TRUE(command->Init()); command->Run(); command->on_event(event); } @@ -498,6 +520,7 @@ TEST_F(GetInteriorVehicleDataRequestTest, hmi_apis::FunctionID::RC_GetInteriorVehicleData); event.set_smart_object(*hmi_message); auto command = CreateRCCommand<GetInteriorVehicleDataRequest>(mobile_message); + ASSERT_TRUE(command->Init()); command->Run(); command->on_event(event); } @@ -542,6 +565,7 @@ TEST_F(GetInteriorVehicleDataRequestTest, command = CreateRCCommand< rc_rpc_plugin::commands::GetInteriorVehicleDataRequest>( mobile_message); + ASSERT_TRUE(command->Init()); command->Run(); application_manager::event_engine::Event event( hmi_apis::FunctionID::RC_GetInteriorVehicleData); @@ -583,6 +607,7 @@ TEST_F(GetInteriorVehicleDataRequestTest, _)) .WillRepeatedly(Return(true)); // Act + ASSERT_TRUE(command->Init()); command->Run(); } @@ -597,6 +622,130 @@ TEST_F(GetInteriorVehicleDataRequestTest, EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); // Act + ASSERT_TRUE(command->Init()); command->Run(); } + +TEST_F(GetInteriorVehicleDataRequestTest, + OnEvent_ValidHmiResponse_AvailableHDChanelsIsArrayWithHDChanels) { + using rc_rpc_plugin::commands::GetInteriorVehicleDataRequest; + namespace hmi_response = application_manager::hmi_response; + namespace strings = application_manager::strings; + + const uint32_t chanel1_index = 1u; + const uint32_t chanel2_index = 2u; + const uint32_t chanel3_index = 3u; + + const uint32_t expected_array_length = 3u; + + // Arrange + MessageSharedPtr mobile_message = CreateBasicMessage(); + + MessageSharedPtr hmi_response_message = CreateBasicMessage(); + auto& hmi_response_params = (*hmi_response_message)[strings::msg_params]; + hmi_response_params[hmi_response::code] = hmi_apis::Common_Result::SUCCESS; + hmi_response_params[strings::connection_key] = kAppId; + + auto& msg_params = (*hmi_response_message)[strings::msg_params]; + msg_params[message_params::kModuleType] = module_type; + + auto available_hd_chanels = + smart_objects::SmartObject(smart_objects::SmartType_Array); + + available_hd_chanels[0] = chanel1_index; + available_hd_chanels[1] = chanel2_index; + available_hd_chanels[2] = chanel3_index; + + msg_params[message_params::kModuleData][message_params::kRadioControlData] + [message_params::kAvailableHdChannels] = available_hd_chanels; + + ON_CALL(mock_interior_data_cache_, Contains(_)).WillByDefault(Return(false)); + ON_CALL(mock_interior_data_manager_, CheckRequestsToHMIFrequency(_)) + .WillByDefault(Return(true)); + + MessageSharedPtr message_to_mob = CreateBasicMessage(); + + // Expectations + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true)); + EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)) + .WillOnce(DoAll(SaveArg<0>(&message_to_mob), Return(true))); + + // Act + auto command = CreateRCCommand<GetInteriorVehicleDataRequest>(mobile_message); + application_manager::event_engine::Event event( + hmi_apis::FunctionID::RC_GetInteriorVehicleData); + + ASSERT_TRUE(command->Init()); + command->Run(); + + event.set_smart_object(*hmi_response_message); + command->on_event(event); + + auto& hd_chanels = + (*message_to_mob)[strings::msg_params][message_params::kModuleData] + [message_params::kRadioControlData] + [message_params::kAvailableHdChannels]; + const size_t array_length = hd_chanels.length(); + + EXPECT_EQ(expected_array_length, array_length); + + EXPECT_EQ(chanel1_index, hd_chanels[0].asUInt()); + EXPECT_EQ(chanel2_index, hd_chanels[1].asUInt()); + EXPECT_EQ(chanel3_index, hd_chanels[2].asUInt()); +} + +TEST_F(GetInteriorVehicleDataRequestTest, + OnEvent_ValidHmiResponse_ClimateEnableAvailable) { + using rc_rpc_plugin::commands::GetInteriorVehicleDataRequest; + namespace hmi_response = application_manager::hmi_response; + namespace strings = application_manager::strings; + + // Arrange + MessageSharedPtr mobile_message = CreateBasicMessage(); + + MessageSharedPtr hmi_response_message = CreateBasicMessage(); + auto& hmi_response_params = (*hmi_response_message)[strings::msg_params]; + hmi_response_params[hmi_response::code] = hmi_apis::Common_Result::SUCCESS; + hmi_response_params[strings::connection_key] = kAppId; + + auto& msg_params = (*hmi_response_message)[strings::msg_params]; + + auto climate_control_data = + smart_objects::SmartObject(smart_objects::SmartType_Boolean); + climate_control_data = true; + + msg_params[message_params::kModuleData][message_params::kClimateControlData] + [message_params::kClimateEnableAvailable] = climate_control_data; + + ON_CALL(mock_interior_data_cache_, Contains(_)).WillByDefault(Return(false)); + ON_CALL(mock_interior_data_manager_, CheckRequestsToHMIFrequency(_)) + .WillByDefault(Return(true)); + + auto message_to_mob = CreateBasicMessage(); + + // Expectations + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true)); + EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)) + .WillOnce(DoAll(SaveArg<0>(&message_to_mob), Return(true))); + + // Act + auto command = CreateRCCommand<GetInteriorVehicleDataRequest>(mobile_message); + application_manager::event_engine::Event event( + hmi_apis::FunctionID::RC_GetInteriorVehicleData); + + ASSERT_TRUE(command->Init()); + command->Run(); + + event.set_smart_object(*hmi_response_message); + command->on_event(event); + + const bool climate_enable_available = + (*message_to_mob)[strings::msg_params][message_params::kModuleData] + [message_params::kClimateControlData] + [message_params::kClimateEnableAvailable] + .asBool(); + + EXPECT_TRUE(climate_enable_available); +} + } // namespace rc_rpc_plugin_test diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc index 66280eb183..f7718a7248 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc @@ -34,7 +34,6 @@ #include "application_manager/application.h" #include "application_manager/commands/command_request_test.h" #include "application_manager/mock_application.h" -#include "gtest/gtest.h" #include "interfaces/MOBILE_API.h" #include "rc_rpc_plugin/mock/mock_interior_data_cache.h" #include "rc_rpc_plugin/mock/mock_interior_data_manager.h" @@ -42,15 +41,20 @@ #include "rc_rpc_plugin/rc_module_constants.h" #include "rc_rpc_plugin/rc_rpc_plugin.h" +#include <stdint.h> +#include "gtest/gtest.h" + using application_manager::ApplicationSet; using application_manager::commands::MessageSharedPtr; using test::components::application_manager_test::MockApplication; using test::components::application_manager_test::MockApplicationManager; using test::components::commands_test::CommandRequestTest; using test::components::commands_test::CommandsTestMocks; +using test::components::commands_test::HMIResultCodeIs; using ::testing::_; using ::testing::NiceMock; using ::testing::Return; +using ::testing::SaveArg; namespace { const uint32_t kAppId = 0u; @@ -140,8 +144,11 @@ TEST_F(SetInteriorVehicleDataRequestTest, (*mobile_message)[application_manager::strings::msg_params]; msg_params[message_params::kModuleData][message_params::kModuleType] = mobile_apis::ModuleType::CLIMATE; + smart_objects::SmartObject climate_control_data(smart_objects::SmartType_Map); + climate_control_data[message_params::kFanSpeed] = 10; + msg_params[message_params::kModuleData][message_params::kClimateControlData] = - smart_objects::SmartObject(smart_objects::SmartType_Map); + climate_control_data; // Expectations EXPECT_CALL(mock_policy_handler_, CheckModule(kPolicyAppId, _)) .WillOnce(Return(rc_rpc_plugin::TypeAccess::kAllowed)); @@ -151,14 +158,15 @@ TEST_F(SetInteriorVehicleDataRequestTest, EXPECT_CALL( mock_rpc_service_, - ManageMobileCommand(test::components::commands_test::MobileResultCodeIs( - mobile_apis::Result::READ_ONLY), - application_manager::commands::Command::SOURCE_SDL)); + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::RC_SetInteriorVehicleData), _)) + .WillOnce(Return(true)); // Act std::shared_ptr<rc_rpc_plugin::commands::SetInteriorVehicleDataRequest> command = CreateRCCommand< rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>( mobile_message); + ASSERT_TRUE(command->Init()); command->Run(); } @@ -189,15 +197,16 @@ TEST_F( EXPECT_CALL( mock_rpc_service_, - ManageMobileCommand(test::components::commands_test::MobileResultCodeIs( - mobile_apis::Result::OUT_OF_MEMORY), - application_manager::commands::Command::SOURCE_SDL)); + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::RC_SetInteriorVehicleData), _)) + .WillOnce(Return(true)); // Act std::shared_ptr<rc_rpc_plugin::commands::SetInteriorVehicleDataRequest> command = CreateRCCommand< rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>( mobile_message); + ASSERT_TRUE(command->Init()); command->Run(); } @@ -229,7 +238,99 @@ TEST_F( command = CreateRCCommand< rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>( mobile_message); + ASSERT_TRUE(command->Init()); command->Run(); } +TEST_F(SetInteriorVehicleDataRequestTest, + Execute_ValidWithSettableParams_SUCCESSSendToHMI) { + MessageSharedPtr mobile_message = CreateBasicMessage(); + auto& msg_params = + (*mobile_message)[application_manager::strings::msg_params]; + msg_params[message_params::kModuleData][message_params::kModuleType] = + mobile_apis::ModuleType::CLIMATE; + + msg_params[message_params::kModuleData][message_params::kClimateControlData] = + smart_objects::SmartObject(smart_objects::SmartType_Map); + + msg_params[message_params::kModuleData][message_params::kClimateControlData] + [message_params::kClimateEnable] = true; + + // Expectations + EXPECT_CALL(mock_policy_handler_, CheckModule(kPolicyAppId, _)) + .WillOnce(Return(rc_rpc_plugin::TypeAccess::kAllowed)); + + EXPECT_CALL(mock_hmi_capabilities_, rc_capability()) + .WillOnce(Return(nullptr)); + + MessageSharedPtr message_from_mobile = CreateBasicMessage(); + + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) + .WillOnce(DoAll(SaveArg<0>(&message_from_mobile), Return(true))); + + std::shared_ptr<rc_rpc_plugin::commands::SetInteriorVehicleDataRequest> + command = CreateRCCommand< + rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>( + mobile_message); + + ASSERT_TRUE(command->Init()); + command->Run(); + + auto& msg_params_from_mobile = + (*message_from_mobile)[application_manager::strings::msg_params]; + + const bool climate_enable = + msg_params_from_mobile[message_params::kModuleData] + [message_params::kClimateControlData] + [message_params::kClimateEnable] + .asBool(); + EXPECT_TRUE(climate_enable); +} + +TEST_F(SetInteriorVehicleDataRequestTest, + Execute_ValidWithSettableParams_SUCCESSSendToHMI_HDChannel) { + MessageSharedPtr mobile_message = CreateBasicMessage(); + auto& msg_params = + (*mobile_message)[application_manager::strings::msg_params]; + msg_params[message_params::kModuleData][message_params::kModuleType] = + mobile_apis::ModuleType::RADIO; + + msg_params[message_params::kModuleData][message_params::kRadioControlData] = + smart_objects::SmartObject(smart_objects::SmartType_Map); + + const std::uint32_t hd_channel = 2u; + msg_params[message_params::kModuleData][message_params::kRadioControlData] + [message_params::kHdChannel] = hd_channel; + + // Expectations + EXPECT_CALL(mock_policy_handler_, CheckModule(kPolicyAppId, _)) + .WillOnce(Return(rc_rpc_plugin::TypeAccess::kAllowed)); + + EXPECT_CALL(mock_hmi_capabilities_, rc_capability()) + .WillOnce(Return(nullptr)); + + auto message_from_mobile = CreateBasicMessage(); + + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) + .WillOnce(DoAll(SaveArg<0>(&message_from_mobile), Return(true))); + + std::shared_ptr<rc_rpc_plugin::commands::SetInteriorVehicleDataRequest> + command = CreateRCCommand< + rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>( + mobile_message); + + command->Init(); + command->Run(); + + auto& msg_params_from_mobile = + (*message_from_mobile)[application_manager::strings::msg_params]; + + const uint64_t hd_channel_from_hmi = + msg_params_from_mobile[message_params::kModuleData] + [message_params::kRadioControlData] + [message_params::kHdChannel] + .asUInt(); + + EXPECT_EQ(hd_channel, hd_channel_from_hmi); +} } // namespace rc_rpc_plugin_test diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_close_application_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_close_application_request.h new file mode 100644 index 0000000000..9847f567e0 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_close_application_request.h @@ -0,0 +1,80 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the the copyright holders nor the names of their + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BASIC_COMMUNICATION_CLOSE_APPLICATION_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BASIC_COMMUNICATION_CLOSE_APPLICATION_REQUEST_H_ + +#include "application_manager/commands/request_to_hmi.h" +#include "sdl_rpc_plugin/sdl_rpc_plugin.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief BasicCommunicationCloseApplicationRequest command class + **/ +class BasicCommunicationCloseApplicationRequest + : public app_mngr::commands::RequestToHMI { + public: + /** + * @brief BasicCommunicationCloseApplicationRequest class constructor + * + * @param message Incoming SmartObject message + **/ + BasicCommunicationCloseApplicationRequest( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handle); + + /** + * @brief BasicCommunicationCloseApplicationRequest class destructor + **/ + ~BasicCommunicationCloseApplicationRequest() OVERRIDE; + + /** + * @brief Execute command + **/ + void Run() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(BasicCommunicationCloseApplicationRequest); +}; + +} // namespace commands + +} // namespace sdl_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BASIC_COMMUNICATION_CLOSE_APPLICATION_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_close_application_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_close_application_response.h new file mode 100644 index 0000000000..9576684b77 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_close_application_response.h @@ -0,0 +1,80 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the the copyright holders nor the names of their + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BASIC_COMMUNICATION_CLOSE_APPLICATION_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BASIC_COMMUNICATION_CLOSE_APPLICATION_RESPONSE_H_ + +#include "application_manager/commands/response_from_hmi.h" +#include "sdl_rpc_plugin/sdl_rpc_plugin.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief BasicCommunicationCloseApplicationResponse command class + **/ +class BasicCommunicationCloseApplicationResponse + : public app_mngr::commands::ResponseFromHMI { + public: + /** + * @brief BasicCommunicationCloseApplicationResponse class constructor + * + * @param message Incoming SmartObject message + **/ + BasicCommunicationCloseApplicationResponse( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handle); + + /** + * @brief BasicCommunicationCloseApplicationResponse class destructor + **/ + ~BasicCommunicationCloseApplicationResponse() OVERRIDE; + + /** + * @brief Execute command + **/ + void Run() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(BasicCommunicationCloseApplicationResponse); +}; + +} // namespace commands + +} // namespace sdl_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BASIC_COMMUNICATION_CLOSE_APPLICATION_RESPONSE_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_request.h new file mode 100644 index 0000000000..b965e880b4 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_request.h @@ -0,0 +1,85 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the the copyright holders nor the names of their + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CLOSE_APPLICATION_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CLOSE_APPLICATION_REQUEST_H_ + +#include "application_manager/commands/command_request_impl.h" +#include "sdl_rpc_plugin/sdl_rpc_plugin.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief CloseApplicationRequest command class + **/ +class CloseApplicationRequest : public app_mngr::commands::CommandRequestImpl { + public: + /** + * @brief CloseApplicationRequest class constructor + * + * @param message Incoming SmartObject message + **/ + CloseApplicationRequest(const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handle); + + /** + * @brief CloseApplicationRequest class destructor + **/ + ~CloseApplicationRequest() OVERRIDE; + + /** + * @brief Execute command + **/ + void Run() OVERRIDE; + + /** + * @brief Interface method that is called whenever new event received + * + * @param event The received event + */ + void on_event(const app_mngr::event_engine::Event& event); + + private: + DISALLOW_COPY_AND_ASSIGN(CloseApplicationRequest); +}; + +} // namespace commands + +} // namespace sdl_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CLOSE_APPLICATION_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_response.h new file mode 100644 index 0000000000..c7b649f4e9 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_response.h @@ -0,0 +1,79 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the the copyright holders nor the names of their + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CLOSE_APPLICATION_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CLOSE_APPLICATION_RESPONSE_H_ + +#include "application_manager/commands/command_response_impl.h" +#include "sdl_rpc_plugin/sdl_rpc_plugin.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief CloseApplicationResponse command class + **/ +class CloseApplicationResponse + : public app_mngr::commands::CommandResponseImpl { + public: + /** + * @brief CloseApplicationResponse class constructor + * + * @param message Incoming SmartObject message + **/ + CloseApplicationResponse(const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handle); + + /** + * @brief CloseApplicationResponse class destructor + **/ + ~CloseApplicationResponse() OVERRIDE; + + /** + * @brief Execute command + **/ + void Run() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(CloseApplicationResponse); +}; + +} // namespace commands + +} // namespace sdl_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CLOSE_APPLICATION_RESPONSE_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/put_file_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/put_file_request.h index f24ce422f2..b3e04f7796 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/put_file_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/put_file_request.h @@ -76,7 +76,7 @@ class PutFileRequest : public app_mngr::commands::CommandRequestImpl { mobile_apis::FileType::eType file_type_; bool is_persistent_file_; - void SendOnPutFileNotification(); + void SendOnPutFileNotification(bool is_system_file); DISALLOW_COPY_AND_ASSIGN(PutFileRequest); }; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_request.cc new file mode 100644 index 0000000000..b021faefd8 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_request.cc @@ -0,0 +1,61 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the the copyright holders nor the names of their + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include "sdl_rpc_plugin/commands/hmi/basic_communication_close_application_request.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; +namespace commands { + +BasicCommunicationCloseApplicationRequest:: + BasicCommunicationCloseApplicationRequest( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : RequestToHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +BasicCommunicationCloseApplicationRequest:: + ~BasicCommunicationCloseApplicationRequest() {} + +void BasicCommunicationCloseApplicationRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + SendRequest(); +} + +} // namespace commands +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_response.cc new file mode 100644 index 0000000000..2e56271cf2 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_response.cc @@ -0,0 +1,65 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the the copyright holders nor the names of their + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include "sdl_rpc_plugin/commands/hmi/basic_communication_close_application_response.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; +namespace commands { + +BasicCommunicationCloseApplicationResponse:: + BasicCommunicationCloseApplicationResponse( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : ResponseFromHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +BasicCommunicationCloseApplicationResponse:: + ~BasicCommunicationCloseApplicationResponse() {} + +void BasicCommunicationCloseApplicationResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + event_engine::Event event( + hmi_apis::FunctionID::BasicCommunication_CloseApplication); + event.set_smart_object(*message_); + event.raise(application_manager_.event_dispatcher()); +} + +} // namespace commands +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc new file mode 100644 index 0000000000..736f0355dc --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc @@ -0,0 +1,118 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the the copyright holders nor the names of their + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include "sdl_rpc_plugin/commands/mobile/close_application_request.h" +#include "application_manager/application_impl.h" +#include "application_manager/message_helper.h" +#include "interfaces/MOBILE_API.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; +namespace commands { + +CloseApplicationRequest::CloseApplicationRequest( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : CommandRequestImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +CloseApplicationRequest::~CloseApplicationRequest() {} + +void CloseApplicationRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + ApplicationSharedPtr app = application_manager_.application(connection_key()); + + if (app.use_count() == 0) { + LOG4CXX_ERROR(logger_, "Application does not exist"); + SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); + return; + } + + smart_objects::SmartObject msg_params; + msg_params[strings::app_id] = connection_key(); + SendHMIRequest(hmi_apis::FunctionID::BasicCommunication_CloseApplication, + &msg_params, + true); +} + +void CloseApplicationRequest::on_event(const event_engine::Event& event) { + LOG4CXX_AUTO_TRACE(logger_); + const smart_objects::SmartObject& message = event.smart_object(); + + auto msg_params = message[strings::msg_params]; + + hmi_apis::Common_Result::eType hmi_result = + static_cast<hmi_apis::Common_Result::eType>( + message[strings::params][hmi_response::code].asInt()); + + mobile_apis::Result::eType result = + MessageHelper::HMIToMobileResult(hmi_result); + bool success = PrepareResultForMobileResponse( + hmi_result, HmiInterfaces::HMI_INTERFACE_BasicCommunication); + if (success) { + ApplicationSharedPtr app = + application_manager_.application(connection_key()); + + if (app.use_count() == 0) { + LOG4CXX_ERROR(logger_, "Application does not exist"); + SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); + return; + } + + auto on_app_exit = [app](plugin_manager::RPCPlugin& plugin) { + plugin.OnApplicationEvent(plugin_manager::kApplicationExit, app); + }; + + application_manager_.GetPluginManager().ForEachPlugin(on_app_exit); + application_manager_.state_controller().SetRegularState( + app, + mobile_apis::HMILevel::HMI_NONE, + mobile_apis::AudioStreamingState::NOT_AUDIBLE, + mobile_apis::VideoStreamingState::NOT_STREAMABLE, + false); + } + + const char* info = msg_params.keyExists(strings::info) + ? msg_params[strings::info].asCharArray() + : NULL; + + SendResponse(success, result, info, &msg_params); +} + +} // namespace commands +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_response.cc new file mode 100644 index 0000000000..934804e1b1 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_response.cc @@ -0,0 +1,61 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the the copyright holders nor the names of their + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include "sdl_rpc_plugin/commands/mobile/close_application_response.h" +#include "application_manager/application_impl.h" +#include "interfaces/MOBILE_API.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; +namespace commands { + +CloseApplicationResponse::CloseApplicationResponse( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : CommandResponseImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +CloseApplicationResponse::~CloseApplicationResponse() {} + +void CloseApplicationResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + rpc_service_.SendMessageToMobile(message_); +} + +} // namespace commands +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc index 4b34db9934..0655da27c0 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc @@ -89,7 +89,7 @@ void GetSystemCapabilityRequest::Run() { bool has_nav_capability = false; if (hmi_capabilities.navigation_capability()) { has_nav_capability = true; - auto nav_capability = *hmi_capabilities.navigation_capability(); + nav_capability = *hmi_capabilities.navigation_capability(); } has_nav_capability = application_manager_.GetAppServiceManager() diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc index 41558c08f0..f68596ce27 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc @@ -284,9 +284,7 @@ void PutFileRequest::Run() { } SendResponse(true, save_result, "File was downloaded", &response_params); - if (is_system_file) { - SendOnPutFileNotification(); - } + SendOnPutFileNotification(is_system_file); break; } default: @@ -297,7 +295,7 @@ void PutFileRequest::Run() { } } -void PutFileRequest::SendOnPutFileNotification() { +void PutFileRequest::SendOnPutFileNotification(bool is_system_file) { LOG4CXX_INFO(logger_, "SendOnPutFileNotification"); smart_objects::SmartObjectSPtr notification = std::make_shared<smart_objects::SmartObject>( @@ -316,6 +314,7 @@ void PutFileRequest::SendOnPutFileNotification() { message[strings::msg_params][strings::length] = length_; message[strings::msg_params][strings::persistent_file] = is_persistent_file_; message[strings::msg_params][strings::file_type] = file_type_; + message[strings::msg_params][strings::is_system_file] = is_system_file; rpc_service_.ManageHMICommand(notification); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc index 0734e1935d..0434eb05ec 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc @@ -158,6 +158,8 @@ #endif // EXTERNAL_PROPRIETARY_MODE #include "sdl_rpc_plugin/commands/hmi/add_statistics_info_notification.h" +#include "sdl_rpc_plugin/commands/hmi/basic_communication_close_application_request.h" +#include "sdl_rpc_plugin/commands/hmi/basic_communication_close_application_response.h" #include "sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_request.h" #include "sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_response.h" #include "sdl_rpc_plugin/commands/hmi/basic_communication_on_awake_sdl.h" @@ -317,6 +319,13 @@ CommandCreator& HMICommandFactory::get_creator_factory( ? factory.GetCreator<commands::ActivateAppRequest>() : factory.GetCreator<commands::ActivateAppResponse>(); } + case hmi_apis::FunctionID::BasicCommunication_CloseApplication: { + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::BasicCommunicationCloseApplicationRequest>() + : factory.GetCreator< + commands::BasicCommunicationCloseApplicationResponse>(); + } #ifdef EXTERNAL_PROPRIETARY_MODE case hmi_apis::FunctionID::BasicCommunication_DecryptCertificate: { return hmi_apis::messageType::request == message_type diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc index 1a1d4f725c..11f3d78026 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc @@ -42,6 +42,8 @@ #include "sdl_rpc_plugin/commands/mobile/alert_response.h" #include "sdl_rpc_plugin/commands/mobile/change_registration_request.h" #include "sdl_rpc_plugin/commands/mobile/change_registration_response.h" +#include "sdl_rpc_plugin/commands/mobile/close_application_request.h" +#include "sdl_rpc_plugin/commands/mobile/close_application_response.h" #include "sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h" #include "sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_response.h" #include "sdl_rpc_plugin/commands/mobile/delete_command_request.h" @@ -356,6 +358,11 @@ CommandCreator& MobileCommandFactory::get_command_creator( : factory .GetCreator<commands::GetCloudAppPropertiesResponse>(); } + case mobile_apis::FunctionID::CloseApplicationID: { + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::CloseApplicationRequest>() + : factory.GetCreator<commands::CloseApplicationResponse>(); + } case mobile_apis::FunctionID::GenericResponseID: { using app_mngr::commands::Command; return factory.GetCreator<commands::GenericResponse>(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_response_test.cc index d6df3e61ee..67c36dce9c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_response_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_response_test.cc @@ -139,6 +139,7 @@ TEST_F(RCGetCapabilitiesResponseTest, RUN_SUCCESSS) { radio_control_capability["hdChannelAvailable"] = true; radio_control_capability["rdsDataAvailable"] = true; radio_control_capability["availableHDsAvailable"] = true; + radio_control_capability["availableHdChannelsAvailable"] = true; radio_control_capability["stateAvailable"] = true; radio_control_capability["signalStrengthAvailable"] = true; radio_control_capability["signalChangeThresholdAvailable"] = true; diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc index 6ef76ad125..7d34bbbe37 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc @@ -72,7 +72,7 @@ void OnVehicleDataNotification::Run() { for (; vehicle_data.end() != it; ++it) { if (true == (*message_)[strings::msg_params].keyExists(it->first)) { - LOG4CXX_ERROR(logger_, "vehicle_data nanme" << it->first); + LOG4CXX_DEBUG(logger_, "vehicle_data name" << it->first); auto vehicle_data_value = (*message_)[strings::msg_params][it->first].asInt(); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_response_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_response_test.cc new file mode 100644 index 0000000000..fb14373bcf --- /dev/null +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_response_test.cc @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2019, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "gtest/gtest.h" + +#include "application_manager/commands/commands_test.h" +#include "mobile/get_vehicle_data_response.h" +#include "smart_objects/smart_object.h" + +namespace test { +namespace components { +namespace commands_test { +namespace mobile_commands_test { +namespace get_vehicle_data_response { + +namespace am = ::application_manager; +using am::commands::MessageSharedPtr; +using vehicle_info_plugin::commands::GetVehicleDataResponse; + +typedef std::shared_ptr<GetVehicleDataResponse> GetVehicleDataResponsePtr; + +class GetVehicleDataResponseTest + : public CommandsTest<CommandsTestMocks::kIsNice> {}; + +TEST_F(GetVehicleDataResponseTest, GetVehicleDataResponse_SUCCESS) { + MessageSharedPtr message(CreateMessage(smart_objects::SmartType_Map)); + GetVehicleDataResponsePtr command( + CreateCommand<GetVehicleDataResponse>(message)); + + EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(message, _)); + command->Run(); +} + +} // namespace get_vehicle_data_response +} // namespace mobile_commands_test +} // namespace commands_test +} // namespace components +} // namespace test diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/on_vehicle_data_notification_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/on_vehicle_data_notification_test.cc index 7081746f28..8df00521de 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/on_vehicle_data_notification_test.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/on_vehicle_data_notification_test.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Ford Motor Company + * Copyright (c) 2019, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,9 +30,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include <stdint.h> -#include <map> -#include <vector> +#include <strings.h> #include "gtest/gtest.h" #include "mobile/on_vehicle_data_notification.h" @@ -45,6 +43,8 @@ #include "smart_objects/smart_object.h" #include "utils/custom_string.h" #include "utils/helpers.h" +#include "vehicle_info_plugin/vehicle_info_app_extension.h" +#include "vehicle_info_plugin/vehicle_info_plugin.h" namespace test { namespace components { @@ -62,49 +62,75 @@ using am::commands::MessageSharedPtr; using vehicle_info_plugin::commands::OnVehicleDataNotification; typedef std::shared_ptr<OnVehicleDataNotification> NotificationPtr; +typedef std::shared_ptr<vehicle_info_plugin::VehicleInfoAppExtension> + VehicleInfoAppExtensionPtr; +typedef DataAccessor<application_manager::ApplicationSet> ApplicationSetDA; namespace { const uint32_t kAppId = 1u; +const utils::custom_string::CustomString kAppName("test_app"); } // namespace class OnVehicleDataNotificationTest : public CommandsTest<CommandsTestMocks::kIsNice> { public: - OnVehicleDataNotificationTest() - : command_msg_(CreateMessage(smart_objects::SmartType_Map)) - , command_(CreateCommand<OnVehicleDataNotification>(command_msg_)) {} + OnVehicleDataNotificationTest() : mock_app_(CreateMockApp()) {} - MessageSharedPtr command_msg_; - NotificationPtr command_; + protected: + void SetUp() OVERRIDE { + ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId)); + ON_CALL(*mock_app_, name()).WillByDefault(ReturnRef(kAppName)); + + ON_CALL(mock_message_helper_, PrintSmartObject(_)) + .WillByDefault(Return(false)); + } + MockAppPtr mock_app_; }; -MATCHER_P2(CheckMessageData, key, value, "") { - const bool kIsMobileProtocolTypeCorrect = - (*arg)[am::strings::params][am::strings::protocol_type].asInt() == - am::commands::CommandImpl::mobile_protocol_type_; - - const bool kIsProtocolVersionCorrect = - (*arg)[am::strings::params][am::strings::protocol_version].asInt() == - am::commands::CommandImpl::protocol_version_; - - const bool kIsNotificationCorrect = - (*arg)[am::strings::params][am::strings::message_type].asInt() == - am::MessageType::kNotification; - - const bool kIsConnectionKeyCorrect = - (*arg)[am::strings::params][am::strings::connection_key].asUInt() == - kAppId; - - const bool kAreMsgParamsCorrect = - (*arg)[am::strings::msg_params][key].asInt() == value; - - using namespace helpers; - return Compare<bool, EQ, ALL>(true, - kIsMobileProtocolTypeCorrect, - kIsProtocolVersionCorrect, - kIsNotificationCorrect, - kIsConnectionKeyCorrect, - kAreMsgParamsCorrect); +TEST_F(OnVehicleDataNotificationTest, OnVehicleDataNotification_SUCCESS) { + MessageSharedPtr message(CreateMessage(smart_objects::SmartType_Map)); + smart_objects::SmartObject gps_data; + gps_data[am::strings::longitude_degrees] = 1.0; + gps_data[am::strings::latitude_degrees] = 1.0; + gps_data[am::strings::shifted] = true; + + (*message)[am::strings::msg_params][am::strings::gps] = gps_data; + (*message)[am::strings::msg_params][am::strings::speed] = 0; + + NotificationPtr command(CreateCommand<OnVehicleDataNotification>(message)); + + vehicle_info_plugin::VehicleInfoPlugin vi_plugin; + VehicleInfoAppExtensionPtr vi_app_extention_ptr = + std::make_shared<vehicle_info_plugin::VehicleInfoAppExtension>( + vi_plugin, *mock_app_); + vi_app_extention_ptr->subscribeToVehicleInfo( + mobile_apis::VehicleDataType::VEHICLEDATA_GPS); + vi_app_extention_ptr->subscribeToVehicleInfo( + mobile_apis::VehicleDataType::VEHICLEDATA_SPEED); + + EXPECT_CALL(*mock_app_, + QueryInterface(vehicle_info_plugin::VehicleInfoAppExtension:: + VehicleInfoAppExtensionUID)) + .WillOnce(Return(vi_app_extention_ptr)); + + application_manager::ApplicationSet apps; + apps.insert(mock_app_); + std::shared_ptr<sync_primitives::Lock> apps_lock = + std::make_shared<sync_primitives::Lock>(); + ApplicationSetDA apps_da(apps, apps_lock); + EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(apps_da)); + + am::VehicleData vehicle_data; + vehicle_data.insert(am::VehicleData::value_type( + am::strings::gps, mobile_apis::VehicleDataType::VEHICLEDATA_GPS)); + vehicle_data.insert(am::VehicleData::value_type( + am::strings::gps, mobile_apis::VehicleDataType::VEHICLEDATA_SPEED)); + EXPECT_CALL(mock_message_helper_, vehicle_data()) + .WillOnce(ReturnRef(vehicle_data)); + + EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(message, _)); + + command->Run(); } } // namespace on_vehicle_data_notification diff --git a/src/components/application_manager/src/hmi_interfaces_impl.cc b/src/components/application_manager/src/hmi_interfaces_impl.cc index fc2a81b2db..04e2067916 100644 --- a/src/components/application_manager/src/hmi_interfaces_impl.cc +++ b/src/components/application_manager/src/hmi_interfaces_impl.cc @@ -105,6 +105,8 @@ generate_function_to_interface_convert_map() { HmiInterfaces::HMI_INTERFACE_BasicCommunication; convert_map[BasicCommunication_GetFilePath] = HmiInterfaces::HMI_INTERFACE_BasicCommunication; + convert_map[BasicCommunication_CloseApplication] = + HmiInterfaces::HMI_INTERFACE_BasicCommunication; convert_map[VR_IsReady] = HmiInterfaces::HMI_INTERFACE_VR; convert_map[VR_Started] = HmiInterfaces::HMI_INTERFACE_VR; convert_map[VR_Stopped] = HmiInterfaces::HMI_INTERFACE_VR; 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 6530004499..8dc57b96b0 100644 --- a/src/components/application_manager/src/message_helper/message_helper.cc +++ b/src/components/application_manager/src/message_helper/message_helper.cc @@ -1789,12 +1789,16 @@ void MessageHelper::SendOnAppUnregNotificationToHMI( smart_objects::SmartObjectSPtr MessageHelper::GetBCActivateAppRequestToHMI( ApplicationConstSharedPtr app, - const protocol_handler::SessionObserver& session_observer, const policy::PolicyHandlerInterface& policy_handler, hmi_apis::Common_HMILevel::eType level, bool send_policy_priority, ApplicationManager& app_mngr) { DCHECK_OR_RETURN(app, smart_objects::SmartObjectSPtr()); + if (hmi_apis::Common_HMILevel::NONE == level) { + LOG4CXX_WARN(logger_, + "BC.ActivateApp cannot be used to deactivate an application"); + return NULL; + } const uint32_t correlation_id = app_mngr.GetNextHMICorrelationID(); smart_objects::SmartObjectSPtr message = @@ -1831,6 +1835,23 @@ smart_objects::SmartObjectSPtr MessageHelper::GetBCActivateAppRequestToHMI( return message; } +smart_objects::SmartObjectSPtr MessageHelper::GetBCCloseApplicationRequestToHMI( + ApplicationConstSharedPtr app, ApplicationManager& app_mngr) { + DCHECK_OR_RETURN(app, smart_objects::SmartObjectSPtr()); + + const uint32_t correlation_id = app_mngr.GetNextHMICorrelationID(); + smart_objects::SmartObjectSPtr message = + std::make_shared<smart_objects::SmartObject>( + smart_objects::SmartType_Map); + (*message)[strings::params][strings::function_id] = + hmi_apis::FunctionID::BasicCommunication_CloseApplication; + (*message)[strings::params][strings::message_type] = MessageType::kRequest; + (*message)[strings::params][strings::correlation_id] = correlation_id; + (*message)[strings::msg_params][strings::app_id] = app->app_id(); + + return message; +} + void MessageHelper::SendOnResumeAudioSourceToHMI(const uint32_t app_id, ApplicationManager& app_mngr) { LOG4CXX_WARN(logger_, "SendOnResumeAudioSourceToHMI app_id: " << app_id); diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc index d94a364c8c..bee88633c1 100644 --- a/src/components/application_manager/src/policies/policy_handler.cc +++ b/src/components/application_manager/src/policies/policy_handler.cc @@ -177,41 +177,6 @@ struct DeactivateApplication { StateController& state_ctrl_; }; -struct SDLAllowedNotification { - SDLAllowedNotification(const connection_handler::DeviceHandle& device_id, - PolicyManager* policy_manager, - StateController& state_controller) - : device_id_(device_id) - , policy_manager_(policy_manager) - , state_controller_(state_controller) {} - - void operator()(const ApplicationSharedPtr& app) { - DCHECK_OR_RETURN_VOID(policy_manager_); - if (device_id_ == app->device()) { - std::string hmi_level = "NONE"; - mobile_apis::HMILevel::eType default_mobile_hmi; - policy_manager_->GetDefaultHmi(app->policy_app_id(), &hmi_level); - if ("BACKGROUND" == hmi_level) { - default_mobile_hmi = mobile_apis::HMILevel::HMI_BACKGROUND; - } else if ("FULL" == hmi_level) { - default_mobile_hmi = mobile_apis::HMILevel::HMI_FULL; - } else if ("LIMITED" == hmi_level) { - default_mobile_hmi = mobile_apis::HMILevel::HMI_LIMITED; - } else if ("NONE" == hmi_level) { - default_mobile_hmi = mobile_apis::HMILevel::HMI_NONE; - } else { - return; - } - state_controller_.SetRegularState(app, default_mobile_hmi, true); - } - } - - private: - connection_handler::DeviceHandle device_id_; - PolicyManager* policy_manager_; - StateController& state_controller_; -}; - /** * @brief Gets from system list of currently registered applications and * create collection of links device-to-application diff --git a/src/components/application_manager/src/smart_object_keys.cc b/src/components/application_manager/src/smart_object_keys.cc index 872103929f..54033b12ab 100644 --- a/src/components/application_manager/src/smart_object_keys.cc +++ b/src/components/application_manager/src/smart_object_keys.cc @@ -183,6 +183,7 @@ const char* is_template = "isTemplate"; const char* image = "image"; const char* type = "type"; const char* system_file = "systemFile"; +const char* is_system_file = "isSystemFile"; const char* offset = "offset"; const char* length = "length"; const char* secondary_image = "secondaryImage"; @@ -311,6 +312,10 @@ const char* activate = "activate"; const char* set_as_default = "setAsDefault"; const char* origin_app = "originApp"; +// sis data +const char* station_short_name = "stationShortName"; +const char* station_location = "stationLocation"; + // resuming const char* application_commands = "applicationCommands"; const char* application_submenus = "applicationSubMenus"; @@ -339,8 +344,12 @@ const char* time_stamp = "timeStamp"; const char* manual_text_entry = "manualTextEntry"; const char* image_type_supported = "imageTypeSupported"; const char* unexpected_disconnect = "unexpectedDisconnect"; + +const char* shifted = "shifted"; +const char* altitude = "altitude"; const char* longitude_degrees = "longitudeDegrees"; const char* latitude_degrees = "latitudeDegrees"; + const char* address = "address"; const char* country_name = "countryName"; const char* country_code = "countryCode"; diff --git a/src/components/application_manager/src/state_controller_impl.cc b/src/components/application_manager/src/state_controller_impl.cc index c791f58047..994c7b8b7f 100644 --- a/src/components/application_manager/src/state_controller_impl.cc +++ b/src/components/application_manager/src/state_controller_impl.cc @@ -68,7 +68,7 @@ StateControllerImpl::StateControllerImpl(ApplicationManager& app_mngr) void StateControllerImpl::SetRegularState(ApplicationSharedPtr app, HmiStatePtr state, - const bool send_activate_app) { + const bool request_hmi_state_change) { LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN_VOID(app); DCHECK_OR_RETURN_VOID(state); @@ -101,12 +101,17 @@ void StateControllerImpl::SetRegularState(ApplicationSharedPtr app, static_cast<hmi_apis::Common_HMILevel::eType>( resolved_state->hmi_level()); - if (send_activate_app) { - const int64_t corr_id = SendBCActivateApp(app, hmi_level, true); - if (-1 != corr_id) { - subscribe_on_event(hmi_apis::FunctionID::BasicCommunication_ActivateApp, - corr_id); - waiting_for_activate_[app->app_id()] = resolved_state; + if (request_hmi_state_change) { + const int64_t result = RequestHMIStateChange(app, hmi_level, true); + if (-1 != result) { + const uint32_t corr_id = static_cast<uint32_t>(result); + subscribe_on_event( + hmi_apis::Common_HMILevel::NONE == hmi_level + ? hmi_apis::FunctionID::BasicCommunication_CloseApplication + : hmi_apis::FunctionID::BasicCommunication_ActivateApp, + corr_id); + waiting_for_response_[app->app_id()] = resolved_state; + app_mngr_.set_application_id(corr_id, app->hmi_app_id()); return; } LOG4CXX_ERROR(logger_, "Unable to send BC.ActivateApp"); @@ -120,7 +125,7 @@ void StateControllerImpl::SetRegularState( const mobile_apis::HMILevel::eType hmi_level, const mobile_apis::AudioStreamingState::eType audio_state, const mobile_apis::VideoStreamingState::eType video_state, - const bool send_activate_app) { + const bool request_hmi_state_change) { LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN_VOID(app); HmiStatePtr prev_regular = app->RegularHmiState(); @@ -132,13 +137,13 @@ void StateControllerImpl::SetRegularState( hmi_state->set_audio_streaming_state(audio_state); hmi_state->set_video_streaming_state(video_state); hmi_state->set_system_context(prev_regular->system_context()); - SetRegularState(app, hmi_state, send_activate_app); + SetRegularState(app, hmi_state, request_hmi_state_change); } void StateControllerImpl::SetRegularState( ApplicationSharedPtr app, const mobile_apis::HMILevel::eType hmi_level, - const bool send_activate_app) { + const bool request_hmi_state_change) { using namespace mobile_apis; LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN_VOID(app); @@ -150,7 +155,7 @@ void StateControllerImpl::SetRegularState( hmi_state->set_audio_streaming_state(CalcAudioState(app, hmi_level)); hmi_state->set_video_streaming_state(CalcVideoState(app, hmi_level)); hmi_state->set_system_context(SystemContext::SYSCTXT_MAIN); - SetRegularState(app, hmi_state, send_activate_app); + SetRegularState(app, hmi_state, request_hmi_state_change); } void StateControllerImpl::SetRegularState( @@ -159,7 +164,7 @@ void StateControllerImpl::SetRegularState( const mobile_apis::AudioStreamingState::eType audio_state, const mobile_apis::VideoStreamingState::eType video_state, const mobile_apis::SystemContext::eType system_context, - const bool send_activate_app) { + const bool request_hmi_state_change) { LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN_VOID(app); HmiStatePtr hmi_state = @@ -169,7 +174,7 @@ void StateControllerImpl::SetRegularState( hmi_state->set_audio_streaming_state(audio_state); hmi_state->set_video_streaming_state(video_state); hmi_state->set_system_context(system_context); - SetRegularState(app, hmi_state, send_activate_app); + SetRegularState(app, hmi_state, request_hmi_state_change); } void StateControllerImpl::SetRegularState( @@ -636,8 +641,9 @@ void StateControllerImpl::on_event(const event_engine::Event& event) { const SmartObject& message = event.smart_object(); const FunctionID::eType id = static_cast<FunctionID::eType>(event.id()); switch (id) { - case FunctionID::BasicCommunication_ActivateApp: { - OnActivateAppResponse(message); + case FunctionID::BasicCommunication_ActivateApp: + case FunctionID::BasicCommunication_CloseApplication: { + OnHMIResponse(message); break; } case FunctionID::BasicCommunication_OnAppActivated: { @@ -791,31 +797,33 @@ void StateControllerImpl::OnApplicationRegistered( OnStateChanged(app, initial_state, new_state); } -int64_t StateControllerImpl::SendBCActivateApp( +int64_t StateControllerImpl::RequestHMIStateChange( ApplicationConstSharedPtr app, hmi_apis::Common_HMILevel::eType level, bool send_policy_priority) { LOG4CXX_AUTO_TRACE(logger_); - smart_objects::SmartObjectSPtr bc_activate_app_request = - MessageHelper::GetBCActivateAppRequestToHMI( - app, - app_mngr_.connection_handler().get_session_observer(), - app_mngr_.GetPolicyHandler(), - level, - send_policy_priority, - app_mngr_); - if (!bc_activate_app_request) { - LOG4CXX_ERROR(logger_, "Unable to create BC.ActivateAppRequest"); + smart_objects::SmartObjectSPtr request = NULL; + if (hmi_apis::Common_HMILevel::NONE == level) { + request = MessageHelper::GetBCCloseApplicationRequestToHMI(app, app_mngr_); + } else { + request = MessageHelper::GetBCActivateAppRequestToHMI( + app, + app_mngr_.GetPolicyHandler(), + level, + send_policy_priority, + app_mngr_); + } + if (!request) { + LOG4CXX_ERROR(logger_, "Unable to create request"); return -1; } - if (!app_mngr_.GetRPCService().ManageHMICommand(bc_activate_app_request)) { - LOG4CXX_ERROR(logger_, "Unable to send BC.ActivateAppRequest"); + if (!app_mngr_.GetRPCService().ManageHMICommand(request)) { + LOG4CXX_ERROR(logger_, "Unable to send request"); return -1; } - const int64_t corr_id = - (*bc_activate_app_request)[strings::params][strings::correlation_id] - .asInt(); - return corr_id; + const uint32_t corr_id = + (*request)[strings::params][strings::correlation_id].asUInt(); + return static_cast<int64_t>(corr_id); } void StateControllerImpl::ApplyPostponedStateForApp(ApplicationSharedPtr app) { @@ -890,18 +898,18 @@ void StateControllerImpl::DeactivateApp(ApplicationSharedPtr app) { SetRegularState(app, new_regular, false); } -void StateControllerImpl::OnActivateAppResponse( +void StateControllerImpl::OnHMIResponse( const smart_objects::SmartObject& message) { const hmi_apis::Common_Result::eType code = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); - const int32_t correlation_id = - message[strings::params][strings::correlation_id].asInt(); + const uint32_t correlation_id = + message[strings::params][strings::correlation_id].asUInt(); const uint32_t hmi_app_id = app_mngr_.application_id(correlation_id); ApplicationSharedPtr application = app_mngr_.application_by_hmi_app(hmi_app_id); if (application && hmi_apis::Common_Result::SUCCESS == code) { - HmiStatePtr pending_state = waiting_for_activate_[application->app_id()]; + HmiStatePtr pending_state = waiting_for_response_[application->app_id()]; DCHECK_OR_RETURN_VOID(pending_state); ApplyRegularState(application, pending_state); } 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 ec13137abe..819ead8d8b 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 @@ -201,14 +201,16 @@ class MockMessageHelper { MessageHelper::ChoiceSetVRCommandsStatus( const smart_objects::SmartObject&)); - MOCK_METHOD6(GetBCActivateAppRequestToHMI, + MOCK_METHOD5(GetBCActivateAppRequestToHMI, smart_objects::SmartObjectSPtr( ApplicationConstSharedPtr app, - const protocol_handler::SessionObserver& session_observer, const policy::PolicyHandlerInterface& policy_handler, hmi_apis::Common_HMILevel::eType level, bool send_policy_priority, ApplicationManager& app_mngr)); + MOCK_METHOD2(GetBCCloseApplicationRequestToHMI, + smart_objects::SmartObjectSPtr(ApplicationConstSharedPtr app, + ApplicationManager& app_mngr)); MOCK_METHOD2(GetOnAppInterfaceUnregisteredNotificationToMobile, ns_smart_device_link::ns_smart_objects::SmartObjectSPtr( int32_t connection_key, diff --git a/src/components/application_manager/test/mock_message_helper.cc b/src/components/application_manager/test/mock_message_helper.cc index 0629619397..522ef3dbd5 100644 --- a/src/components/application_manager/test/mock_message_helper.cc +++ b/src/components/application_manager/test/mock_message_helper.cc @@ -368,18 +368,18 @@ std::string MessageHelper::CommonLanguageToString( smart_objects::SmartObjectSPtr MessageHelper::GetBCActivateAppRequestToHMI( ApplicationConstSharedPtr app, - const protocol_handler::SessionObserver& session_observer, const policy::PolicyHandlerInterface& policy_handler, hmi_apis::Common_HMILevel::eType level, bool send_policy_priority, ApplicationManager& app_mngr) { return MockMessageHelper::message_helper_mock()->GetBCActivateAppRequestToHMI( - app, - session_observer, - policy_handler, - level, - send_policy_priority, - app_mngr); + app, policy_handler, level, send_policy_priority, app_mngr); +} + +smart_objects::SmartObjectSPtr MessageHelper::GetBCCloseApplicationRequestToHMI( + ApplicationConstSharedPtr app, ApplicationManager& app_mngr) { + return MockMessageHelper::message_helper_mock() + ->GetBCCloseApplicationRequestToHMI(app, app_mngr); } ns_smart_device_link::ns_smart_objects::SmartObjectSPtr diff --git a/src/components/application_manager/test/state_controller/state_controller_test.cc b/src/components/application_manager/test/state_controller/state_controller_test.cc index fbada47fec..9621e20629 100644 --- a/src/components/application_manager/test/state_controller/state_controller_test.cc +++ b/src/components/application_manager/test/state_controller/state_controller_test.cc @@ -1036,7 +1036,7 @@ class StateControllerImplTest : public ::testing::Test { (*bc_activate_app_request)[am::strings::params] [am::strings::correlation_id] = corr_id; ON_CALL(message_helper_mock_, - GetBCActivateAppRequestToHMI(_, _, _, hmi_lvl, _, _)) + GetBCActivateAppRequestToHMI(_, _, hmi_lvl, _, _)) .WillByDefault(Return(bc_activate_app_request)); ON_CALL(app_manager_mock_, GetRPCService()) .WillByDefault(ReturnRef(mock_rpc_service_)); @@ -1969,12 +1969,6 @@ TEST_F(StateControllerImplTest, DISABLED_ActivateAppSuccessReceivedFromHMI) { StateLevelPair(LimitedState(), Common_HMILevel::LIMITED)); hmi_states.push_back( StateLevelPair(BackgroundState(), Common_HMILevel::BACKGROUND)); - hmi_states.push_back( - StateLevelPair(createHmiState(HMILevel::HMI_NONE, - AudioStreamingState::NOT_AUDIBLE, - VideoStreamingState::NOT_STREAMABLE, - SystemContext::SYSCTXT_MAIN), - Common_HMILevel::NONE)); std::vector<StateLevelPair> initial_hmi_states = hmi_states; std::vector<StateLevelPair>::iterator it = hmi_states.begin(); std::vector<StateLevelPair>::iterator it2 = initial_hmi_states.begin(); diff --git a/src/components/config_profile/include/config_profile/profile.h b/src/components/config_profile/include/config_profile/profile.h index 1d3766ca97..0a1e8b2c17 100644 --- a/src/components/config_profile/include/config_profile/profile.h +++ b/src/components/config_profile/include/config_profile/profile.h @@ -423,6 +423,8 @@ class Profile : public protocol_handler::ProtocolHandlerSettings, */ uint16_t cloud_app_max_retry_attempts() const OVERRIDE; + const uint8_t* bluetooth_uuid() const OVERRIDE; + // TransportManageMMESettings interface const std::string& event_mq_name() const OVERRIDE; @@ -610,6 +612,10 @@ class Profile : public protocol_handler::ProtocolHandlerSettings, const char* const pKey, bool* out_result) const; + std::vector<uint8_t> ReadUint8Container(const char* const pSection, + const char* const pKey, + bool* out_result) const; + /** * @brief Returns delimiter for SDL-generated TTS chunks * @return TTS delimiter @@ -975,6 +981,7 @@ class Profile : public protocol_handler::ProtocolHandlerSettings, std::string transport_manager_tcp_adapter_network_interface_; uint32_t cloud_app_retry_timeout_; uint16_t cloud_app_max_retry_attempts_; + std::vector<uint8_t> bluetooth_uuid_; std::string tts_delimiter_; uint32_t audio_data_stopped_timeout_; uint32_t video_data_stopped_timeout_; diff --git a/src/components/config_profile/src/profile.cc b/src/components/config_profile/src/profile.cc index a5b2daa130..c38b28db5f 100644 --- a/src/components/config_profile/src/profile.cc +++ b/src/components/config_profile/src/profile.cc @@ -184,6 +184,7 @@ const char* kAppHmiLevelNoneRequestsTimeScaleKey = const char* kPendingRequestsAmoundKey = "PendingRequestsAmount"; const char* kSupportedDiagModesKey = "SupportedDiagModes"; const char* kTransportManagerDisconnectTimeoutKey = "DisconnectTimeout"; +const char* kBluetoothUUIDKey = "BluetoothUUID"; const char* kTTSDelimiterKey = "TTSDelimiter"; const char* kRecordingFileNameKey = "RecordingFileName"; const char* kRecordingFileSourceKey = "RecordingFileSource"; @@ -397,6 +398,22 @@ const bool kDefaultMultipleTransportsEnabled = false; const char* kDefaultLowBandwidthResumptionLevel = "NONE"; const uint32_t kDefaultRpcPassThroughTimeout = 10000; const char* kDefaultHMIOriginId = "HMI_ID"; +const std::vector<uint8_t> kDefaultBluetoothUUID = {0x93, + 0x6D, + 0xA0, + 0x1F, + 0x9A, + 0xBD, + 0x4D, + 0x9D, + 0x80, + 0xC7, + 0x02, + 0xAF, + 0x85, + 0xC8, + 0x22, + 0xA8}; } // namespace namespace profile { @@ -806,6 +823,10 @@ uint16_t Profile::cloud_app_max_retry_attempts() const { return cloud_app_max_retry_attempts_; } +const uint8_t* Profile::bluetooth_uuid() const { + return bluetooth_uuid_.data(); +} + const std::string& Profile::tts_delimiter() const { return tts_delimiter_; } @@ -1821,6 +1842,13 @@ void Profile::UpdateValues() { kCloudAppMaxRetryAttemptsKey, kCloudAppTransportSection); + bool read_result = true; + bluetooth_uuid_ = ReadUint8Container( + kTransportManagerSection, kBluetoothUUIDKey, &read_result); + if (!read_result || bluetooth_uuid_.size() != 16) { + bluetooth_uuid_ = kDefaultBluetoothUUID; + } + // Event MQ ReadStringValue( &event_mq_name_, kDefaultEventMQ, kTransportManagerSection, kEventMQKey); @@ -2449,6 +2477,10 @@ int32_t hex_to_int(const std::string& value) { return static_cast<int32_t>(strtol(value.c_str(), NULL, 16)); } +uint8_t hex_to_uint8(const std::string& value) { + return static_cast<uint8_t>(strtol(value.c_str(), NULL, 16)); +} + std::string trim_string(const std::string& str) { const char* delims = " \t"; @@ -2474,6 +2506,18 @@ std::vector<int> Profile::ReadIntContainer(const char* const pSection, return value_list; } +std::vector<uint8_t> Profile::ReadUint8Container(const char* const pSection, + const char* const pKey, + bool* out_result) const { + const std::vector<std::string> string_list = + ReadStringContainer(pSection, pKey, out_result); + std::vector<uint8_t> value_list; + value_list.resize(string_list.size()); + std::transform( + string_list.begin(), string_list.end(), value_list.begin(), hex_to_uint8); + return value_list; +} + std::vector<std::string> Profile::ReadStringContainer( const char* const pSection, const char* const pKey, diff --git a/src/components/include/application_manager/state_controller.h b/src/components/include/application_manager/state_controller.h index 753581db0e..fa0d65eb0c 100644 --- a/src/components/include/application_manager/state_controller.h +++ b/src/components/include/application_manager/state_controller.h @@ -43,25 +43,25 @@ class StateController { public: virtual void SetRegularState(ApplicationSharedPtr app, HmiStatePtr state, - const bool SendActivateApp) = 0; + const bool request_hmi_state_change) = 0; virtual void SetRegularState( ApplicationSharedPtr app, const mobile_apis::HMILevel::eType hmi_level, const mobile_apis::AudioStreamingState::eType audio_state, const mobile_apis::VideoStreamingState::eType video_state, - const bool SendActivateApp) = 0; + const bool request_hmi_state_change) = 0; virtual void SetRegularState(ApplicationSharedPtr app, const mobile_apis::HMILevel::eType hmi_level, - const bool SendActivateApp) = 0; + const bool request_hmi_state_change) = 0; virtual void SetRegularState( ApplicationSharedPtr app, const mobile_apis::HMILevel::eType hmi_level, const mobile_apis::AudioStreamingState::eType audio_state, const mobile_apis::VideoStreamingState::eType video_state, const mobile_apis::SystemContext::eType system_context, - const bool SendActivateApp) = 0; + const bool request_hmi_state_change) = 0; virtual void SetRegularState( ApplicationSharedPtr app, @@ -82,9 +82,6 @@ class StateController { ApplicationSharedPtr app, const mobile_apis::HMILevel::eType default_level) = 0; - virtual int64_t SendBCActivateApp(ApplicationConstSharedPtr app, - hmi_apis::Common_HMILevel::eType level, - bool send_policy_priority) = 0; /** * @brief OnVideoStreamingStarted process video streaming started * @param app projection or navigation application starting streaming diff --git a/src/components/include/test/application_manager/mock_state_controller.h b/src/components/include/test/application_manager/mock_state_controller.h index 5518e01383..20a84e7f00 100644 --- a/src/components/include/test/application_manager/mock_state_controller.h +++ b/src/components/include/test/application_manager/mock_state_controller.h @@ -49,24 +49,24 @@ class MockStateController : public am::StateController { MOCK_METHOD3(SetRegularState, void(am::ApplicationSharedPtr app, am::HmiStatePtr state, - const bool SendActivateApp)); + const bool request_hmi_state_change)); MOCK_METHOD5(SetRegularState, void(am::ApplicationSharedPtr app, const mobile_apis::HMILevel::eType hmi_level, const mobile_apis::AudioStreamingState::eType audio_state, const mobile_apis::VideoStreamingState::eType video_state, - const bool SendActivateApp)); + const bool request_hmi_state_change)); MOCK_METHOD3(SetRegularState, void(am::ApplicationSharedPtr app, const mobile_apis::HMILevel::eType hmi_level, - const bool SendActivateApp)); + const bool request_hmi_state_change)); MOCK_METHOD6(SetRegularState, void(am::ApplicationSharedPtr app, const mobile_apis::HMILevel::eType hmi_level, const mobile_apis::AudioStreamingState::eType audio_state, const mobile_apis::VideoStreamingState::eType video_state, const mobile_apis::SystemContext::eType system_context, - const bool SendActivateApp)); + const bool request_hmi_state_change)); MOCK_METHOD2(SetRegularState, void(am::ApplicationSharedPtr app, const mobile_apis::HMILevel::eType hmi_level)); @@ -82,7 +82,7 @@ class MockStateController : public am::StateController { MOCK_METHOD2(OnApplicationRegistered, void(am::ApplicationSharedPtr app, const mobile_apis::HMILevel::eType default_level)); - MOCK_METHOD3(SendBCActivateApp, + MOCK_METHOD3(RequestHMIStateChange, int64_t(am::ApplicationConstSharedPtr app, hmi_apis::Common_HMILevel::eType level, bool send_policy_priority)); diff --git a/src/components/include/test/transport_manager/mock_transport_manager_settings.h b/src/components/include/test/transport_manager/mock_transport_manager_settings.h index 2d9f25a44c..eb12ce1b55 100644 --- a/src/components/include/test/transport_manager/mock_transport_manager_settings.h +++ b/src/components/include/test/transport_manager/mock_transport_manager_settings.h @@ -65,6 +65,7 @@ class MockTransportManagerSettings std::string&()); MOCK_CONST_METHOD0(cloud_app_retry_timeout, uint32_t()); MOCK_CONST_METHOD0(cloud_app_max_retry_attempts, uint16_t()); + MOCK_CONST_METHOD0(bluetooth_uuid, const uint8_t*()); }; } // namespace transport_manager_test diff --git a/src/components/include/transport_manager/transport_manager_settings.h b/src/components/include/transport_manager/transport_manager_settings.h index cbc1516c29..4a183ad22d 100644 --- a/src/components/include/transport_manager/transport_manager_settings.h +++ b/src/components/include/transport_manager/transport_manager_settings.h @@ -79,6 +79,8 @@ class TransportManagerSettings : public TransportManagerMMESettings { * @brief Returns maximum retry attempts for cloud app connections */ virtual uint16_t cloud_app_max_retry_attempts() const = 0; + + virtual const uint8_t* bluetooth_uuid() const = 0; }; } // namespace transport_manager #endif // SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_SETTINGS_H_ diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml index 5d5a340b1f..839f9e21f6 100644 --- a/src/components/interfaces/HMI_API.xml +++ b/src/components/interfaces/HMI_API.xml @@ -1845,6 +1845,13 @@ <param name="speed" type="Float" minvalue="0" maxvalue="500" mandatory="false"> <description>The speed in KPH</description> </param> + <param name="shifted" type="Boolean" mandatory="false"> + <description> + True, if GPS lat/long, time, and altitude have been purposefully shifted (requires a proprietary algorithm to unshift). + False, if the GPS data is raw and un-shifted. + If not provided, then value is assumed False. + </description> + </param> </struct> <struct name="SisData"> @@ -1880,9 +1887,15 @@ <description> True if the hd radio is on, false is the radio is off</description> </param> <param name="availableHDs" type="Integer" minvalue="1" maxvalue="7" mandatory="false"> - <description>number of HD sub-channels if available</description> + <description> + Number of HD sub-channels if available. + Note that this parameter is deprecated in MOBILE API. + </description> + </param> + <param name="availableHdChannels" type="Integer" minvalue="0" maxvalue="7" array="true" minsize="0" maxsize="8" mandatory="false"> + <description>The list of available hd sub-channel indexes. Empty list means no Hd channel is available. Read-only.</description> </param> - <param name="hdChannel" type="Integer" minvalue="1" maxvalue="7" mandatory="false"> + <param name="hdChannel" type="Integer" minvalue="0" maxvalue="7" mandatory="false"> <description>Current HD sub-channel if available</description> </param> <param name="signalStrength" type="Integer" minvalue="0" maxvalue="100" mandatory="false"> @@ -1936,9 +1949,17 @@ </description> </param> <param name="availableHDsAvailable" type="Boolean" mandatory="false" > - <description> + <description> Availability of the getting the number of available HD channels. True: Available, False: Not Available, Not present: Not Available. + Note that this parameter is deprecated in MOBILE API + </description> + </param> + + <param name="availableHdChannelsAvailable" type="Boolean" mandatory="false"> + <description> + Availability of the list of available HD sub-channel indexes. + True: Available, False: Not Available, Not present: Not Available. </description> </param> <param name="stateAvailable" type="Boolean" mandatory="false" > @@ -2040,6 +2061,8 @@ <param name="heatedMirrorsEnable" type="Boolean" mandatory="false"> <description>value false means disabled, value true means enabled.</description> </param> + <param name="climateEnable" type="Boolean" mandatory="false"> + </param> </struct> <struct name="ClimateControlCapabilities"> @@ -2141,6 +2164,12 @@ True: Available, False: Not Available, Not present: Not Available. </description> </param> + <param name="climateEnableAvailable" type="Boolean" mandatory="false"> + <description> + Availability of the control of enable/disable climate control. + True: Available, False: Not Available, Not present: Not Available. + </description> + </param> </struct> <struct name="EqualizerSettings"> @@ -3981,6 +4010,14 @@ </function> <function name="ActivateApp" messagetype="response"> </function> + <function name="CloseApplication" messagetype="request"> + <description>Request from the application to exit the foreground.</description> + <param name="appID" type="Integer" mandatory="true"> + <description>ID of selected application.</description> + </param> + </function> + <function name="CloseApplication" messagetype="response"> + </function> <function name="OnAppActivated" messagetype="notification"> <description>Must be sent by HU system when the user clicks on app in the list of registered apps or on soft button with 'STEAL_FOCUS' action.</description> <param name="appID" type="Integer" mandatory="true"> @@ -4162,45 +4199,54 @@ </function> <function name="OnPutFile" messagetype="notification" > - <description> - Notification, that comes to HMI when mobile sents file with systemFile flag - </description> + <description> + Notification that is sent to HMI when a mobile application uploads a file + </description> - <param name="offset" type="Integer" minvalue="0" maxvalue="100000000000" mandatory="false"> - <description>Optional offset in bytes for resuming partial data chunks</description> - </param> - <param name="length" type="Integer" minvalue="0" maxvalue="100000000000" mandatory="false"> - <description>Optional length in bytes for resuming partial data chunks</description> - </param> + <param name="offset" type="Integer" minvalue="0" maxvalue="100000000000" mandatory="false"> + <description>Optional offset in bytes for resuming partial data chunks</description> + </param> + <param name="length" type="Integer" minvalue="0" maxvalue="100000000000" mandatory="false"> + <description>Optional length in bytes for resuming partial data chunks</description> + </param> - <param name="fileSize" type="Integer" minvalue="0" maxvalue="100000000000" mandatory="false"> - <description>Full Size of file. sends in first OnPutFile notification if file is splited - into many PutFiles - </description> - </param> + <param name="fileSize" type="Integer" minvalue="0" maxvalue="100000000000" mandatory="false"> + <description>Full Size of file. sends in first OnPutFile notification if file is splited + into many PutFiles + </description> + </param> - <param name="FileName" type="String" maxlength="255" mandatory="true"> - <description>File reference name.</description> - </param> + <param name="FileName" type="String" maxlength="255" mandatory="true"> + <description>File reference name.</description> + </param> - <param name="syncFileName" type="String" maxlength="255" mandatory="true"> - <description>File reference name.</description> - </param> + <param name="syncFileName" type="String" maxlength="255" mandatory="true"> + <description>File reference name.</description> + </param> - <param name="fileType" type="Common.FileType" mandatory="true"> - <description>Selected file type.</description> - </param> + <param name="fileType" type="Common.FileType" mandatory="true"> + <description>Selected file type.</description> + </param> - <param name="persistentFile" type="Boolean" defvalue="false" mandatory="false"> - <description> - Indicates if the file is meant to persist between sessions / ignition cycles. - If set to TRUE, then the system will aim to persist this file through session / cycles. - While files with this designation will have priority over others, they are subject to deletion by the system at any time. - In the event of automatic deletion by the system, the app will receive a rejection and have to resend the file. - If omitted, the value will be set to false. - </description> - </param> - </function> + <param name="persistentFile" type="Boolean" defvalue="false" mandatory="false"> + <description> + Indicates if the file is meant to persist between sessions / ignition cycles. + If set to TRUE, then the system will aim to persist this file through session / cycles. + While files with this designation will have priority over others, they are subject to deletion by the system at any time. + In the event of automatic deletion by the system, the app will receive a rejection and have to resend the file. + If omitted, the value will be set to false. + </description> + </param> + <param name="isSystemFile" type="Boolean" defvalue="false" mandatory="false"> + <description> + Indicates if the file is meant to be passed thru core to elsewhere on the system. + If true the system will pass the data thru as it arrives to a predetermined area outside of core. + </description> + </param> + <param name="appID" type="Integer" mandatory="false"> + <description> ID of application that uploaded this file. </description> + </param> + </function> <function name="GetFilePath" messagetype="request"> <description>This request is sent to retrieve a file path from the HMI.</description> diff --git a/src/components/interfaces/MOBILE_API.xml b/src/components/interfaces/MOBILE_API.xml index 1cafb883fa..0bcdc59859 100644 --- a/src/components/interfaces/MOBILE_API.xml +++ b/src/components/interfaces/MOBILE_API.xml @@ -1,7 +1,7 @@ <?xml version="1.0" standalone="no"?> <?xml-stylesheet type="text/xml" href="protocol2html.xsl"?> -<interface name="SmartDeviceLink RAPI" version="5.2.0" minVersion="1.0" date="2019-03-19"> +<interface name="SmartDeviceLink RAPI" version="6.0.0" minVersion="1.0" date="2019-03-19"> <enum name="Result" internal_scope="base" since="1.0"> <element name="SUCCESS"> <description>The request succeeded</description> @@ -2014,6 +2014,13 @@ <param name="speed" type="Float" minvalue="0" maxvalue="500" mandatory="true" since="2.0" until="5.0"/> </history> </param> + <param name="shifted" type="Boolean" mandatory="false" since="6.0"> + <description> + True, if GPS lat/long, time, and altitude have been purposefully shifted (requires a proprietary algorithm to unshift). + False, if the GPS data is raw and un-shifted. + If not provided, then value is assumed False. + </description> + </param> </struct> <struct name="VehicleDataResult" since="2.0"> @@ -2646,6 +2653,7 @@ <element name="GetFileID" value="54" hexvalue="36" since="5.1" /> <element name="PerformAppServiceInteractionID" value="55" hexvalue="37" since="5.1" /> <element name="UnpublishAppServiceID" value="56" hexvalue="38" since="6.0" /> + <element name="CloseApplicationID" value="58" hexvalue="3A" since="6.0" /> <!-- Base Notifications @@ -3101,16 +3109,21 @@ <param name="hdRadioEnable" type="Boolean" mandatory="false" since="5.0"> <description> True if the hd radio is on, false if the radio is off</description> </param> - <param name="availableHDs" type="Integer" minvalue="1" maxvalue="7" mandatory="false" since="5.0"> - <description>number of HD sub-channels if available</description> + <param name="availableHDs" type="Integer" minvalue="1" maxvalue="7" mandatory="false" deprecated="true" since="6.0"> + <description>Number of HD sub-channels if available</description> <history> <param name="availableHDs" type="Integer" minvalue="1" maxvalue="3" mandatory="false" since="4.5" until="5.0"/> + <param name="availableHDs" type="Integer" minvalue="1" maxvalue="7" mandatory="false" since="5.0" until="6.0"/> </history> </param> - <param name="hdChannel" type="Integer" minvalue="1" maxvalue="7" mandatory="false" since="5.0"> + <param name="availableHdChannels" type="Integer" minvalue="0" maxvalue="7" array="true" minsize="0" maxsize="8" mandatory="false" since="6.0"> + <description>The list of available HD sub-channel indexes. Empty list means no Hd channel is available. Read-only. </description> + </param> + <param name="hdChannel" type="Integer" minvalue="0" maxvalue="7" mandatory="false" since="6.0"> <description>Current HD sub-channel if available</description> <history> <param name="hdChannel" type="Integer" minvalue="1" maxvalue="3" mandatory="false" since="4.5" until="5.0"/> + <param name="hdChannel" type="Integer" minvalue="1" maxvalue="7" mandatory="false" since="5.0" until="6.0"/> </history> </param> <param name="signalStrength" type="Integer" minvalue="0" maxvalue="100" mandatory="false"> @@ -3161,6 +3174,8 @@ <param name="heatedMirrorsEnable" type="Boolean" mandatory="false" since="5.0"> <description>value false means disabled, value true means enabled.</description> </param> + <param name="climateEnable" type="Boolean" mandatory="false" since="6.0"> + </param> </struct> <struct name="RadioControlCapabilities" since="4.5"> @@ -3202,11 +3217,20 @@ True: Available, False: Not Available, Not present: Not Available. </description> </param> - <param name="availableHDsAvailable" type="Boolean" mandatory="false"> + <param name="availableHDsAvailable" type="Boolean" mandatory="false" deprecated="true" since="6.0"> <description> Availability of the getting the number of available HD channels. True: Available, False: Not Available, Not present: Not Available. </description> + <history> + <param name="availableHDsAvailable" type="Boolean" mandatory="false" since="4.5" until="6.0"/> + </history> + </param> + <param name="availableHdChannelsAvailable" type="Boolean" mandatory="false" since="6.0"> + <description> + Availability of the list of available HD sub-channel indexes. + True: Available, False: Not Available, Not present: Not Available. + </description> </param> <param name="stateAvailable" type="Boolean" mandatory="false"> <description> @@ -3347,6 +3371,12 @@ True: Available, False: Not Available, Not present: Not Available. </description> </param> + <param name="climateEnableAvailable" type="Boolean" mandatory="false" since="6.0"> + <description> + Availability of the control of enable/disable climate control. + True: Available, False: Not Available, Not present: Not Available. + </description> + </param> </struct> <struct name="EqualizerSettings" since="5.0"> @@ -3831,7 +3861,7 @@ Audiobook: The total number of sections in the playback queue (e.g. the number of chapters in the book) </description> </param> - <param name="mediaImage" type="Image" mandatory="false" since="5.2"> + <param name="mediaImage" type="Image" mandatory="false" since="6.0"> <description> Music: The album art of the current track Podcast: The podcast or chapter artwork of the current podcast episode @@ -7350,6 +7380,28 @@ </param> </function> + <function name="CloseApplication" functionID="CloseApplicationID" messagetype="request" since="6.0"> + <description>Request from the application to exit the foreground and enter HMI_NONE.</description> + </function> + + <function name="CloseApplication" functionID="CloseApplicationID" messagetype="response" since="6.0"> + <param name="success" type="Boolean" platform="documentation" mandatory="true"> + <description> true if successful; false, if failed </description> + </param> + + <param name="resultCode" type="Result" platform="documentation" mandatory="true"> + <element name="SUCCESS"/> + <element name="DISALLOWED"/> + <element name="APPLICATION_NOT_REGISTERED"/> + <element name="GENERIC_ERROR"/> + <element name="IGNORED"/> + </param> + + <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation"> + <description>Provides additional human readable info regarding the result.</description> + </param> + </function> + <!-- Notifications --> <function name="OnHMIStatus" functionID="OnHMIStatusID" messagetype="notification" since="1.0"> diff --git a/src/components/policy/policy_external/include/policy/policy_table/enums.h b/src/components/policy/policy_external/include/policy/policy_table/enums.h index 05eed535f7..ad16d6e59d 100644 --- a/src/components/policy/policy_external/include/policy/policy_table/enums.h +++ b/src/components/policy/policy_external/include/policy/policy_table/enums.h @@ -477,6 +477,11 @@ enum FunctionID { UnpublishAppServiceID = 56, /** + * @brief CloseApplicationID. + */ + CloseApplicationID = 58, + + /** * @brief OnHMIStatusID. */ OnHMIStatusID = 32768, diff --git a/src/components/policy/policy_external/src/policy_table/enums.cc b/src/components/policy/policy_external/src/policy_table/enums.cc index bb66892e83..6dc4d53aa1 100644 --- a/src/components/policy/policy_external/src/policy_table/enums.cc +++ b/src/components/policy/policy_external/src/policy_table/enums.cc @@ -1164,6 +1164,11 @@ bool EnumFromJsonString(const std::string& literal, FunctionID* result) { return true; } + if ("CloseApplication" == literal) { + *result = CloseApplicationID; + return true; + } + if ("OnHMIStatus" == literal) { *result = OnHMIStatusID; return true; diff --git a/src/components/policy/policy_regular/include/policy/policy_table/enums.h b/src/components/policy/policy_regular/include/policy/policy_table/enums.h index 4093726821..ad1d05f59b 100644 --- a/src/components/policy/policy_regular/include/policy/policy_table/enums.h +++ b/src/components/policy/policy_regular/include/policy/policy_table/enums.h @@ -462,6 +462,11 @@ enum FunctionID { UnpublishAppServiceID = 56, /** + * @brief CloseApplicationID. + */ + CloseApplicationID = 58, + + /** * @brief OnHMIStatusID. */ OnHMIStatusID = 32768, diff --git a/src/components/policy/policy_regular/src/policy_table/enums.cc b/src/components/policy/policy_regular/src/policy_table/enums.cc index ce698aa56f..8fc5b0b369 100644 --- a/src/components/policy/policy_regular/src/policy_table/enums.cc +++ b/src/components/policy/policy_regular/src/policy_table/enums.cc @@ -861,6 +861,8 @@ bool IsValidEnum(FunctionID val) { return true; case UnpublishAppServiceID: return true; + case CloseApplicationID: + return true; case OnHMIStatusID: return true; case OnAppInterfaceUnregisteredID: @@ -1026,6 +1028,8 @@ const char* EnumToJsonString(FunctionID val) { return "PerformAppServiceInteraction"; case UnpublishAppServiceID: return "UnpublishAppService"; + case CloseApplicationID: + return "CloseApplication"; case OnHMIStatusID: return "OnHMIStatus"; case OnAppInterfaceUnregisteredID: @@ -1355,6 +1359,11 @@ bool EnumFromJsonString(const std::string& literal, FunctionID* result) { return true; } + if ("CloseApplication" == literal) { + *result = CloseApplicationID; + return true; + } + if ("OnHMIStatus" == literal) { *result = OnHMIStatusID; return true; diff --git a/src/components/transport_manager/include/transport_manager/bluetooth/bluetooth_device_scanner.h b/src/components/transport_manager/include/transport_manager/bluetooth/bluetooth_device_scanner.h index 13fef1d017..768d9ebb54 100644 --- a/src/components/transport_manager/include/transport_manager/bluetooth/bluetooth_device_scanner.h +++ b/src/components/transport_manager/include/transport_manager/bluetooth/bluetooth_device_scanner.h @@ -70,6 +70,11 @@ class BluetoothDeviceScanner : public DeviceScanner { BluetoothDeviceScanner(TransportAdapterController* controller, bool auto_repeat_search, int repeat_search_pause_sec); + + BluetoothDeviceScanner(TransportAdapterController* controller, + bool auto_repeat_search, + int repeat_search_pause_sec, + const uint8_t* smart_device_link_service_uuid_data); /** * @brief Destructor. */ diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc b/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc index 7e9b4c1332..4759b2003a 100644 --- a/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc +++ b/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc @@ -133,7 +133,27 @@ BluetoothDeviceScanner::BluetoothDeviceScanner( 0xA8}; sdp_uuid128_create(&smart_device_link_service_uuid_, smart_device_link_service_uuid_data); - thread_ = threads::CreateThread("BT Device Scaner", + thread_ = threads::CreateThread("BT Device Scanner", + new BluetoothDeviceScannerDelegate(this)); +} + +BluetoothDeviceScanner::BluetoothDeviceScanner( + TransportAdapterController* controller, + bool auto_repeat_search, + int auto_repeat_pause_sec, + const uint8_t* smart_device_link_service_uuid_data) + : controller_(controller) + , thread_(NULL) + , shutdown_requested_(false) + , ready_(true) + , device_scan_requested_(false) + , device_scan_requested_lock_() + , device_scan_requested_cv_() + , auto_repeat_search_(auto_repeat_search) + , auto_repeat_pause_sec_(auto_repeat_pause_sec) { + sdp_uuid128_create(&smart_device_link_service_uuid_, + smart_device_link_service_uuid_data); + thread_ = threads::CreateThread("BT Device Scanner", new BluetoothDeviceScannerDelegate(this)); } diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter.cc b/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter.cc index 95265cad2e..911658bc56 100644 --- a/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter.cc +++ b/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter.cc @@ -58,11 +58,12 @@ BluetoothTransportAdapter::~BluetoothTransportAdapter() {} BluetoothTransportAdapter::BluetoothTransportAdapter( resumption::LastState& last_state, const TransportManagerSettings& settings) - : TransportAdapterImpl(new BluetoothDeviceScanner(this, true, 0), - new BluetoothConnectionFactory(this), - NULL, - last_state, - settings) {} + : TransportAdapterImpl( + new BluetoothDeviceScanner(this, true, 0, settings.bluetooth_uuid()), + new BluetoothConnectionFactory(this), + NULL, + last_state, + settings) {} DeviceType BluetoothTransportAdapter::GetDeviceType() const { return BLUETOOTH; diff --git a/src/components/transport_manager/test/transport_manager_default_test.cc b/src/components/transport_manager/test/transport_manager_default_test.cc index d8bf51ef88..e102458b96 100644 --- a/src/components/transport_manager/test/transport_manager_default_test.cc +++ b/src/components/transport_manager/test/transport_manager_default_test.cc @@ -57,6 +57,22 @@ const std::string kTransportManager = "TransportManager"; const std::string kTcpAdapter = "TcpAdapter"; const std::string kBluetoothAdapter = "BluetoothAdapter"; const std::string kDevices = "devices"; +std::vector<uint8_t> kBTUUID = {0x93, + 0x6D, + 0xA0, + 0x1F, + 0x9A, + 0xBD, + 0x4D, + 0x9D, + 0x80, + 0xC7, + 0x02, + 0xAF, + 0x85, + 0xC8, + 0x22, + 0xA8}; } // namespace TEST(TestTransportManagerDefault, Init_LastStateNotUsed) { @@ -78,6 +94,8 @@ TEST(TestTransportManagerDefault, Init_LastStateNotUsed) { EXPECT_CALL(transport_manager_settings, transport_manager_tcp_adapter_network_interface()) .WillRepeatedly(ReturnRef(network_interface)); + EXPECT_CALL(transport_manager_settings, bluetooth_uuid()) + .WillRepeatedly(Return(kBTUUID.data())); transport_manager.Init(mock_last_state); transport_manager.Stop(); @@ -114,6 +132,8 @@ TEST(TestTransportManagerDefault, Init_LastStateUsed) { EXPECT_CALL(transport_manager_settings, transport_manager_tcp_adapter_network_interface()) .WillRepeatedly(ReturnRef(network_interface)); + EXPECT_CALL(transport_manager_settings, bluetooth_uuid()) + .WillRepeatedly(Return(kBTUUID.data())); transport_manager.Init(mock_last_state); transport_manager.Stop(); } @@ -149,6 +169,8 @@ TEST(TestTransportManagerDefault, Init_LastStateUsed_InvalidPort) { EXPECT_CALL(transport_manager_settings, transport_manager_tcp_adapter_network_interface()) .WillRepeatedly(ReturnRef(network_interface)); + EXPECT_CALL(transport_manager_settings, bluetooth_uuid()) + .WillRepeatedly(Return(kBTUUID.data())); transport_manager.Init(mock_last_state); transport_manager.Stop(); } |