2020-05-21 18:01:55

by Sonny Sasaka

[permalink] [raw]
Subject: [PATCH v3 1/3] device: Add device type property

From: Eric Caruso <[email protected]>

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


2020-05-21 18:03:48

by Sonny Sasaka

[permalink] [raw]
Subject: [PATCH v3 2/3] doc/device-api: Add Types property to org.bluez.Device1

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

diff --git a/doc/device-api.txt b/doc/device-api.txt
index 65d8fee37..32a146321 100644
--- a/doc/device-api.txt
+++ b/doc/device-api.txt
@@ -137,6 +137,11 @@ Properties string Address [readonly]
"public" - Public address
"random" - Random address

+ array{string} Types [readonly]
+
+ The core configurations supported by this remote device.
+ It can contain "le" and "bredr".
+
string Name [readonly, optional]

The Bluetooth remote name. This value can not be
--
2.17.1

2020-05-21 18:09:00

by bluez.test.bot

[permalink] [raw]
Subject: RE: [v3,2/3] doc/device-api: Add Types property to org.bluez.Device1


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