diff options
author | Wootak Jung <wootak.jung@samsung.com> | 2019-03-28 13:53:30 +0900 |
---|---|---|
committer | Wootak Jung <wootak.jung@samsung.com> | 2019-03-28 13:53:30 +0900 |
commit | dd18f7a8cc99e548c929bd9f3970a65d266729a1 (patch) | |
tree | db2b764346954a6b60c33997ecbd5debc0da72fb | |
parent | 649899b984ab998c32199f9c016fd1925c50c803 (diff) | |
download | bluez-submit/tizen/20190329.002626.tar.gz bluez-submit/tizen/20190329.002626.tar.bz2 bluez-submit/tizen/20190329.002626.zip |
Add default a2dp role setting logic for headlesssubmit/tizen/20190329.002626accepted/tizen/unified/20190330.030017
Change-Id: I25f5fa87779790eb189d0ac6070a25d5cead09db
-rw-r--r-- | src/adapter.c | 7 | ||||
-rwxr-xr-x | src/hcid.h | 1 | ||||
-rwxr-xr-x | src/main.c | 11 | ||||
-rw-r--r-- | src/main_headless.conf | 9 |
4 files changed, 27 insertions, 1 deletions
diff --git a/src/adapter.c b/src/adapter.c index 0cf6c100..de5bdeef 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -9961,7 +9961,12 @@ static void load_config(struct btd_adapter *adapter) /* Get A2DP Role */ str = g_key_file_get_string(key_file, "General", "DefaultA2DPRole", &gerr); if (gerr || !str) { - adapter->a2dp_role = BLUETOOTH_A2DP_SOURCE_ROLE; + if (main_opts.default_a2dp_role_sink) { + DBG("Default A2DP role is sink"); + adapter->a2dp_role = BLUETOOTH_A2DP_SINK_ROLE; + } else { + adapter->a2dp_role = BLUETOOTH_A2DP_SOURCE_ROLE; + } g_error_free(gerr); gerr = NULL; } else { @@ -49,6 +49,7 @@ struct main_opts { #ifdef TIZEN_FEATURE_BLUEZ_MODIFY gboolean le_privacy; char *pin_code; + gboolean default_a2dp_role_sink; #endif uint16_t did_source; @@ -93,6 +93,7 @@ static const char *supported_options[] = { #ifdef TIZEN_FEATURE_BLUEZ_MODIFY "EnableLEPrivacy", "PinCode", + "DefaultA2DPRoleSink", #endif NULL }; @@ -418,6 +419,15 @@ static void parse_config(GKeyFile *config) main_opts.pin_code = g_strdup(str); g_free(str); } + + boolean = g_key_file_get_boolean(config, "General", "DefaultA2DPRoleSink", &err); + if (err) { + DBG("%s", err->message); + g_clear_error(&err); + } else { + DBG("DefaultA2DPRoleSink=%s", boolean ? "true" : "false"); + main_opts.default_a2dp_role_sink = boolean; + } #endif str = g_key_file_get_string(config, "GATT", "Cache", &err); if (err) { @@ -447,6 +457,7 @@ static void init_defaults(void) #ifdef TIZEN_FEATURE_BLUEZ_MODIFY main_opts.le_privacy = FALSE; main_opts.pin_code = NULL; + main_opts.default_a2dp_role_sink = false; #endif if (sscanf(VERSION, "%hhu.%hhu", &major, &minor) != 2) diff --git a/src/main_headless.conf b/src/main_headless.conf index 15b5fd1e..ed3eada8 100644 --- a/src/main_headless.conf +++ b/src/main_headless.conf @@ -6,7 +6,11 @@ # Default device class. Only the major and minor device class bits are # considered. Defaults to '0x000000'. +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY +Class = 0x40414 # Audio/Video(Loudspeaker) +#else #Class = 0x000100 +#endif # How long to stay in discoverable mode before going back to non-discoverable # The value is in seconds. Default is 180, i.e. 3 minutes. @@ -77,6 +81,11 @@ PinCode = 0000 #endif +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY +# Default A2DP role is sink in headless device. +DefaultA2DPRoleSink = true +#endif + [GATT] # GATT attribute cache. # Possible values: |