Re: [PATCH BlueZ v4 06/10] core: device: Add getters for GATT db and client

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

 



Hi Arman,

On Wed, Dec 17, 2014 at 3:45 PM, Arman Uguray <armansito@xxxxxxxxxxxx> wrote:
> Hi Luiz,
>
>> On Wed, Dec 17, 2014 at 4:39 AM, Luiz Augusto von Dentz <luiz.dentz@xxxxxxxxx> wrote:
>> Hi Arman,
>>
>> On Wed, Dec 17, 2014 at 4:07 AM, Arman Uguray <armansito@xxxxxxxxxxxx> wrote:
>>> This patch adds btd_device_get_gatt_db and btd_device_get_gatt_client
>>> functions.
>>> ---
>>>  src/device.c | 16 ++++++++++++++++
>>>  src/device.h |  2 ++
>>>  2 files changed, 18 insertions(+)
>>>
>>> diff --git a/src/device.c b/src/device.c
>>> index 64591d0..854d9f3 100644
>>> --- a/src/device.c
>>> +++ b/src/device.c
>>> @@ -4844,6 +4844,22 @@ GSList *btd_device_get_primaries(struct btd_device *device)
>>>         return device->primaries;
>>>  }
>>>
>>> +struct gatt_db *btd_device_get_gatt_db(struct btd_device *device)
>>> +{
>>> +       if (!device)
>>> +               return NULL;
>>> +
>>> +       return device->db;
>>> +}
>>
>> I guess the db can be get from the gatt_client, also perhaps we should
>> return a reference otherwise it should be const.
>>
>
> I think I'll keep this getter but make things const. My idea here is
> that the gatt_db will outlive the connection and if the device is
> bonded it won't get cleared. So it might still be useful.

Sure no problem, Im just not sure if the driver would be interested in
the db without the client and as it is const it should not be possible
to register callbacks, actually const for the client perhaps is not a
good idea either for the same reason.

>>> +struct bt_gatt_client *btd_device_get_gatt_client(struct btd_device *device)
>>> +{
>>> +       if (!device)
>>> +               return NULL;
>>> +
>>> +       return device->client;
>>> +}
>>> +
>>>  void btd_device_gatt_set_service_changed(struct btd_device *device,
>>>                                                 uint16_t start, uint16_t end)
>>>  {
>>> diff --git a/src/device.h b/src/device.h
>>> index 487bd27..a7fefee 100644
>>> --- a/src/device.h
>>> +++ b/src/device.h
>>> @@ -67,6 +67,8 @@ const sdp_record_t *btd_device_get_record(struct btd_device *device,
>>>  struct gatt_primary *btd_device_get_primary(struct btd_device *device,
>>>                                                         const char *uuid);
>>>  GSList *btd_device_get_primaries(struct btd_device *device);
>>> +struct gatt_db *btd_device_get_gatt_db(struct btd_device *device);
>>> +struct bt_gatt_client *btd_device_get_gatt_client(struct btd_device *device);
>>>  void btd_device_gatt_set_service_changed(struct btd_device *device,
>>>                                                 uint16_t start, uint16_t end);
>>>  bool device_attach_att(struct btd_device *dev, GIOChannel *io);
>>> --
>>> 2.2.0.rc0.207.ga3a616c
>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
>>> the body of a message to majordomo@xxxxxxxxxxxxxxx
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>>
>>
>> --
>> Luiz Augusto von Dentz
>
> Arman



-- 
Luiz Augusto von Dentz
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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