2020-04-03 15:34:33

by Alain Michaud

[permalink] [raw]
Subject: [Bluez PATCH v1 2/2] adapter:Enable wideband_speech if supported

This change will enable the MGMT_SETTING_WIDEBAND_SPEECH setting and
implement the adapter property to allow higher level profile
implementations to know if the adapter supports and has the feature
enabled.

---

src/adapter.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/src/adapter.c b/src/adapter.c
index 972d88772..02c5f7e1c 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -3424,6 +3424,15 @@ static DBusMessage *connect_device(DBusConnection *conn,
return NULL;
}

+static gboolean property_get_wideband_speech_enabled(
+ const GDBusPropertyTable *property,
+ DBusMessageIter *iter, void *user_data)
+{
+ struct btd_adapter *adapter = user_data;
+
+ return property_get_mode(adapter, MGMT_SETTING_WIDEBAND_SPEECH, iter);
+}
+
static const GDBusMethodTable adapter_methods[] = {
{ GDBUS_ASYNC_METHOD("StartDiscovery", NULL, NULL, start_discovery) },
{ GDBUS_METHOD("SetDiscoveryFilter",
@@ -3459,6 +3468,7 @@ static const GDBusPropertyTable adapter_properties[] = {
{ "UUIDs", "as", property_get_uuids },
{ "Modalias", "s", property_get_modalias, NULL,
property_exists_modalias },
+ { "WidebandSpeechEnabled", "b", property_get_wideband_speech_enabled },
{ }
};

@@ -8808,6 +8818,8 @@ static void read_info_complete(uint8_t status, uint16_t length,
set_mode(adapter, MGMT_OP_SET_LE, 0x01);
if (missing_settings & MGMT_SETTING_BREDR)
set_mode(adapter, MGMT_OP_SET_BREDR, 0x01);
+ if (missing_settings & MGMT_SETTING_WIDEBAND_SPEECH)
+ set_mode(adapter, MGMT_OP_SET_WIDEBAND_SPEECH, 0x01);
break;
case BT_MODE_BREDR:
if (!(adapter->supported_settings & MGMT_SETTING_BREDR)) {
@@ -8822,6 +8834,8 @@ static void read_info_complete(uint8_t status, uint16_t length,
set_mode(adapter, MGMT_OP_SET_BREDR, 0x01);
if (adapter->current_settings & MGMT_SETTING_LE)
set_mode(adapter, MGMT_OP_SET_LE, 0x00);
+ if (missing_settings & MGMT_SETTING_WIDEBAND_SPEECH)
+ set_mode(adapter, MGMT_OP_SET_WIDEBAND_SPEECH, 0x01);
break;
case BT_MODE_LE:
if (!(adapter->supported_settings & MGMT_SETTING_LE)) {
--
2.26.0.292.g33ef6b2f38-goog