linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/3] device: Add device type property
@ 2020-05-21 17:55 Sonny Sasaka
  2020-05-21 17:55 ` [PATCH v2 2/3] doc/device-api: Add Types property to org.bluez.Device1 Sonny Sasaka
  2020-05-21 17:55 ` [PATCH v2 3/3] client: Print device property "Types" Sonny Sasaka
  0 siblings, 2 replies; 5+ messages in thread
From: Sonny Sasaka @ 2020-05-21 17:55 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Eric Caruso

From: Eric Caruso <ejcaruso@chromium.org>

This allows us to gather information about whether a device
supports BR/EDR, BLE, or both. It appears as DBus Property
"Types" on the org.bluez.Device1 interface.
---
 src/device.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/src/device.c b/src/device.c
index 7b0eb256e..2b5a7f2e8 100644
--- a/src/device.c
+++ b/src/device.c
@@ -745,6 +745,32 @@ static gboolean property_get_address_type(const GDBusPropertyTable *property,
 	return TRUE;
 }
 
+static gboolean dev_property_get_types(const GDBusPropertyTable *property,
+					DBusMessageIter *iter, void *data)
+{
+	struct btd_device *device = data;
+	const char *type;
+
+	DBusMessageIter array;
+
+	dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY,
+					DBUS_TYPE_BYTE_AS_STRING, &array);
+
+	if (device->bredr) {
+		type = "bredr";
+		dbus_message_iter_append_basic(&array, DBUS_TYPE_STRING, &type);
+	}
+
+	if (device->le) {
+		type = "le";
+		dbus_message_iter_append_basic(&array, DBUS_TYPE_STRING, &type);
+	}
+
+	dbus_message_iter_close_container(iter, &array);
+
+	return TRUE;
+}
+
 static gboolean dev_property_get_name(const GDBusPropertyTable *property,
 					DBusMessageIter *iter, void *data)
 {
@@ -2759,6 +2785,7 @@ static const GDBusMethodTable device_methods[] = {
 static const GDBusPropertyTable device_properties[] = {
 	{ "Address", "s", dev_property_get_address },
 	{ "AddressType", "s", property_get_address_type },
+	{ "Types", "as", dev_property_get_types, NULL, NULL },
 	{ "Name", "s", dev_property_get_name, NULL, dev_property_exists_name },
 	{ "Alias", "s", dev_property_get_alias, dev_property_set_alias },
 	{ "Class", "u", dev_property_get_class, NULL,
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/3] doc/device-api: Add Types property to org.bluez.Device1
  2020-05-21 17:55 [PATCH v2 1/3] device: Add device type property Sonny Sasaka
@ 2020-05-21 17:55 ` Sonny Sasaka
  2020-05-21 18:07   ` [v2,2/3] " bluez.test.bot
  2020-05-21 17:55 ` [PATCH v2 3/3] client: Print device property "Types" Sonny Sasaka
  1 sibling, 1 reply; 5+ messages in thread
From: Sonny Sasaka @ 2020-05-21 17:55 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Sonny Sasaka

---
 doc/device-api.txt | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/doc/device-api.txt b/doc/device-api.txt
index 65d8fee37..ceb68d2f6 100644
--- a/doc/device-api.txt
+++ b/doc/device-api.txt
@@ -158,6 +158,11 @@ Properties	string Address [readonly]
 
 			The Bluetooth class of device of the remote device.
 
+		string Type [readonly, optional]
+
+			The carriers supported by this remote device. If it
+			exists, it can be one of "BR/EDR", "LE", or "DUAL".
+
 		uint16 Appearance [readonly, optional]
 
 			External appearance of device, as found on GAP service.
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 3/3] client: Print device property "Types"
  2020-05-21 17:55 [PATCH v2 1/3] device: Add device type property Sonny Sasaka
  2020-05-21 17:55 ` [PATCH v2 2/3] doc/device-api: Add Types property to org.bluez.Device1 Sonny Sasaka
@ 2020-05-21 17:55 ` Sonny Sasaka
  2020-05-21 18:07   ` [v2,3/3] " bluez.test.bot
  1 sibling, 1 reply; 5+ messages in thread
From: Sonny Sasaka @ 2020-05-21 17:55 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Sonny Sasaka

---
 client/main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/client/main.c b/client/main.c
index 422da5593..dd8c28cb3 100644
--- a/client/main.c
+++ b/client/main.c
@@ -1628,6 +1628,7 @@ static void cmd_info(int argc, char *argv[])
 		bt_shell_printf("Device %s\n", address);
 	}
 
+	print_property(proxy, "Types");
 	print_property(proxy, "Name");
 	print_property(proxy, "Alias");
 	print_property(proxy, "Class");
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* RE: [v2,2/3] doc/device-api: Add Types property to org.bluez.Device1
  2020-05-21 17:55 ` [PATCH v2 2/3] doc/device-api: Add Types property to org.bluez.Device1 Sonny Sasaka
@ 2020-05-21 18:07   ` bluez.test.bot
  0 siblings, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2020-05-21 18:07 UTC (permalink / raw)
  To: linux-bluetooth, sonnysasaka

[-- Attachment #1: Type: text/plain, Size: 350 bytes --]


This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
While we are preparing for reviewing the patches, we found the following
issue/warning.

Test Result:
checkgitlint Failed

Outputs:
3: B6 Body message is missing



---
Regards,
Linux Bluetooth

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [v2,3/3] client: Print device property "Types"
  2020-05-21 17:55 ` [PATCH v2 3/3] client: Print device property "Types" Sonny Sasaka
@ 2020-05-21 18:07   ` bluez.test.bot
  0 siblings, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2020-05-21 18:07 UTC (permalink / raw)
  To: linux-bluetooth, sonnysasaka

[-- Attachment #1: Type: text/plain, Size: 350 bytes --]


This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
While we are preparing for reviewing the patches, we found the following
issue/warning.

Test Result:
checkgitlint Failed

Outputs:
3: B6 Body message is missing



---
Regards,
Linux Bluetooth

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-05-21 18:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-21 17:55 [PATCH v2 1/3] device: Add device type property Sonny Sasaka
2020-05-21 17:55 ` [PATCH v2 2/3] doc/device-api: Add Types property to org.bluez.Device1 Sonny Sasaka
2020-05-21 18:07   ` [v2,2/3] " bluez.test.bot
2020-05-21 17:55 ` [PATCH v2 3/3] client: Print device property "Types" Sonny Sasaka
2020-05-21 18:07   ` [v2,3/3] " bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).