From e9d7ae033dc710ac899f994b2b01f8535f35741d Mon Sep 17 00:00:00 2001 From: Sho Amano Date: Tue, 27 Feb 2018 17:42:27 +0900 Subject: Update HMI_API.xml to add audioPassThruCapabilitiesList --- .../application_manager/smart_object_keys.h | 1 + .../commands/hmi/ui_get_capabilities_response.cc | 6 +++++- .../hmi/ui_get_capabilities_response_test.cc | 25 ++++++++++++++++++++++ .../application_manager/src/smart_object_keys.cc | 1 + src/components/interfaces/HMI_API.xml | 14 ++++++++++-- 5 files changed, 44 insertions(+), 3 deletions(-) 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 69e00f5838..c455f26578 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 @@ -169,6 +169,7 @@ extern const char* system_context; extern const char* speech_capabilities; extern const char* vr_capabilities; extern const char* audio_pass_thru_capabilities; +extern const char* audio_pass_thru_capabilities_list; extern const char* pcm_stream_capabilities; extern const char* audio_pass_thru_icon; extern const char* way_points; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc index 909e3bae47..c019dd4501 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc @@ -73,7 +73,11 @@ void UIGetCapabilitiesResponse::Run() { msg_params[hmi_response::soft_button_capabilities]); } - if (msg_params.keyExists(strings::audio_pass_thru_capabilities)) { + // use newer parameter "audioPassThruCapabilitiesList" when available + if (msg_params.keyExists(strings::audio_pass_thru_capabilities_list)) { + hmi_capabilities.set_audio_pass_thru_capabilities( + msg_params[strings::audio_pass_thru_capabilities_list]); + } else if (msg_params.keyExists(strings::audio_pass_thru_capabilities)) { hmi_capabilities.set_audio_pass_thru_capabilities( msg_params[strings::audio_pass_thru_capabilities]); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc index 3fd3a39dca..3fa26f7bd1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc @@ -160,6 +160,31 @@ TEST_F(UIGetCapabilitiesResponseTest, SetAudioPassThru_SUCCESS) { command->Run(); } +TEST_F(UIGetCapabilitiesResponseTest, SetAudioPassThruList_SUCCESS) { + MessageSharedPtr command_msg = CreateCommandMsg(); + + // if both audioPassThruCapabilities and audioPassThruCapabilitiesList are + // supplied, audioPassThruCapabilitiesList should be used + smart_objects::SmartObject audio_pass_thru_capabilities_so = + smart_objects::SmartObject(smart_objects::SmartType_Map); + smart_objects::SmartObject audio_pass_thru_capabilities_list_so = + smart_objects::SmartObject(smart_objects::SmartType_Array); + (*command_msg)[strings::msg_params][strings::audio_pass_thru_capabilities] = + audio_pass_thru_capabilities_so; + (*command_msg)[strings::msg_params] + [strings::audio_pass_thru_capabilities_list] = + audio_pass_thru_capabilities_list_so; + + ResponseFromHMIPtr command( + CreateCommand(command_msg)); + + EXPECT_CALL( + mock_hmi_capabilities_, + set_audio_pass_thru_capabilities(audio_pass_thru_capabilities_list_so)); + + command->Run(); +} + TEST_F(UIGetCapabilitiesResponseTest, SetNavigation_SUCCESS) { MessageSharedPtr command_msg = CreateCommandMsg(); (*command_msg)[strings::msg_params][strings::hmi_capabilities] = diff --git a/src/components/application_manager/src/smart_object_keys.cc b/src/components/application_manager/src/smart_object_keys.cc index 411d0a3e8a..be0b277947 100644 --- a/src/components/application_manager/src/smart_object_keys.cc +++ b/src/components/application_manager/src/smart_object_keys.cc @@ -136,6 +136,7 @@ const char* system_context = "systemContext"; const char* speech_capabilities = "speechCapabilities"; const char* vr_capabilities = "vrCapabilities"; const char* audio_pass_thru_capabilities = "audioPassThruCapabilities"; +const char* audio_pass_thru_capabilities_list = "audioPassThruCapabilitiesList"; const char* pcm_stream_capabilities = "pcmStreamCapabilities"; const char* audio_pass_thru_icon = "audioPassThruIcon"; const char* way_points = "wayPoints"; diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml index f3fe9cedab..8d7083efc1 100644 --- a/src/components/interfaces/HMI_API.xml +++ b/src/components/interfaces/HMI_API.xml @@ -4616,7 +4616,7 @@ - + Request from SDL to show an alert message on the display. @@ -4853,7 +4853,17 @@ Information about the capabilities of the display: its type, text field supported, etc. See DisplayCapabilities. - + + + Describes an audio configuration that the system supports for PerformAudioPassThru. + Note: please fill out both audioPassThruCapabilities and audioPassThruCapabilitiesList parameters, as: + - Newer SDL Core uses audioPassThruCapabilitiesList instead of audioPassThruCapabilities, and + - audioPassThruCapabilities is a mandatory field and cannot be omitted. + + + + Describes the audio configurations that the system supports for PerformAudioPassThru. + Must be returned if the platform supports on-screen SoftButtons. -- cgit v1.2.1