Re: [PATCH BlueZ 1/2] device: Add ConnectionType property.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Vibhav,

On Sat, Sep 7, 2024 at 4:50 PM Your Name <vibhavp@xxxxxxxxx> wrote:
>
> From: Vibhav Pant <vibhavp@xxxxxxxxx>
>
> ---
>  src/device.c | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
>
> diff --git a/src/device.c b/src/device.c
> index 0f18c8c7f..fa149f1d4 100644
> --- a/src/device.c
> +++ b/src/device.c
> @@ -1003,6 +1003,32 @@ static gboolean dev_property_exists_class(const GDBusPropertyTable *property,
>         return device->class != 0;
>  }
>
> +static gboolean
> +dev_property_get_connection_type(const GDBusPropertyTable *property,
> +                                DBusMessageIter *iter, void *data)
> +{
> +       struct btd_device *device = data;
> +       const char *str;
> +
> +       if (device->le && device->bredr)
> +               str = "dual";
> +       else if (device->le)
> +               str = "le";
> +       else
> +               str = "bredr";
> +       dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &str);
> +       return TRUE;
> +}
> +
> +static gboolean
> +dev_property_exists_connection_type(const GDBusPropertyTable *property,
> +                                   void *data)
> +{
> +       struct btd_device *device = data;
> +
> +       return device->bredr || device->le;
> +}
> +
>  static gboolean dev_property_get_class(const GDBusPropertyTable *property,
>                                         DBusMessageIter *iter, void *data)
>  {
> @@ -3234,6 +3260,8 @@ static const GDBusPropertyTable device_properties[] = {
>         { "Alias", "s", dev_property_get_alias, dev_property_set_alias },
>         { "Class", "u", dev_property_get_class, NULL,
>                                         dev_property_exists_class },
> +       { "ConnectionType", "s", dev_property_get_connection_type, NULL,
> +                                       dev_property_exists_connection_type },

Don't really like where this is going, if we need bearer specific API
like this then we need a whole new interface, besides you didn't
really explain the reason why you needed this, is that to determine if
there are SDP records to be fetched? We could perhaps implement
something like a Bearer property alongside ConnectBearer but many of
the properties of Device are sort of making sense only for one bearer.

>         { "Appearance", "q", dev_property_get_appearance, NULL,
>                                         dev_property_exists_appearance },
>         { "Icon", "s", dev_property_get_icon, NULL,
> --
> 2.46.0
>
>


-- 
Luiz Augusto von Dentz





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux