diff mbox series

[Bluez,v1,2/2] adapter:Enable wideband_speech if supported

Message ID 20200403153331.101846-2-alainm@chromium.org (mailing list archive)
State New, archived
Delegated to: Marcel Holtmann
Headers show
Series [Bluez,v1,1/2] doc:adding a WidebandSpeechEnabled Api | expand

Commit Message

Alain Michaud April 3, 2020, 3:33 p.m. UTC
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 mbox series

Patch

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)) {