2015-02-06 12:47:19

by Gowtham Anandha Babu

[permalink] [raw]
Subject: [PATCH] gatt-server: Fix mutlpile definition of same func

Removed 'put_uuid_le' func from gatt-server,
which was already defined in gatt-helpers.
---
src/shared/gatt-helpers.c | 2 +-
src/shared/gatt-helpers.h | 2 ++
src/shared/gatt-server.c | 21 ---------------------
3 files changed, 3 insertions(+), 22 deletions(-)

diff --git a/src/shared/gatt-helpers.c b/src/shared/gatt-helpers.c
index a33f960..6dfc24f 100644
--- a/src/shared/gatt-helpers.c
+++ b/src/shared/gatt-helpers.c
@@ -567,7 +567,7 @@ bool bt_gatt_exchange_mtu(struct bt_att *att, uint16_t client_rx_mtu,
return true;
}

-static void put_uuid_le(const bt_uuid_t *src, void *dst)
+void put_uuid_le(const bt_uuid_t *src, void *dst)
{
bt_uuid_t uuid;

diff --git a/src/shared/gatt-helpers.h b/src/shared/gatt-helpers.h
index 0217e82..7a2076b 100644
--- a/src/shared/gatt-helpers.h
+++ b/src/shared/gatt-helpers.h
@@ -105,3 +105,5 @@ bool bt_gatt_read_by_type(struct bt_att *att, uint16_t start, uint16_t end,
bt_gatt_discovery_callback_t callback,
void *user_data,
bt_gatt_destroy_func_t destroy);
+
+void put_uuid_le(const bt_uuid_t *src, void *dst);
diff --git a/src/shared/gatt-server.c b/src/shared/gatt-server.c
index 8f7b5cd..0652d3d 100644
--- a/src/shared/gatt-server.c
+++ b/src/shared/gatt-server.c
@@ -499,27 +499,6 @@ error:
queue_destroy(q, NULL);
}

-static void put_uuid_le(const bt_uuid_t *src, void *dst)
-{
- bt_uuid_t uuid;
-
- switch (src->type) {
- case BT_UUID16:
- put_le16(src->value.u16, dst);
- break;
- case BT_UUID128:
- bswap_128(&src->value.u128, dst);
- break;
- case BT_UUID32:
- bt_uuid_to_uuid128(src, &uuid);
- bswap_128(&uuid.value.u128, dst);
- break;
- case BT_UUID_UNSPEC:
- default:
- break;
- }
-}
-
static bool encode_find_info_rsp(struct gatt_db *db, struct queue *q,
uint16_t mtu,
uint8_t *pdu, uint16_t *len)
--
1.9.1



2015-02-13 14:25:54

by Gowtham Anandha Babu

[permalink] [raw]
Subject: RE: [PATCH] gatt-server: Fix mutlpile definition of same func

Hi Johan & Luiz,

> -----Original Message-----
> From: [email protected] [mailto:linux-bluetooth-
> [email protected]] On Behalf Of Luiz Augusto von Dentz
> Sent: Friday, February 13, 2015 7:19 PM
> To: Gowtham Anandha Babu; [email protected]; Bharat
> Panda; [email protected]
> Subject: Re: [PATCH] gatt-server: Fix mutlpile definition of same func
>
> Hi Johan,
>
> On Fri, Feb 13, 2015 at 1:33 PM, Johan Hedberg <[email protected]>
> wrote:
> > Hi,
> >
> > On Fri, Feb 06, 2015, Gowtham Anandha Babu wrote:
> >> --- a/src/shared/gatt-helpers.h
> >> +++ b/src/shared/gatt-helpers.h
> >> @@ -105,3 +105,5 @@ bool bt_gatt_read_by_type(struct bt_att *att,
> uint16_t start, uint16_t end,
> >> bt_gatt_discovery_callback_t callback,
> >> void *user_data,
> >> bt_gatt_destroy_func_t
> >> destroy);
> >> +
> >> +void put_uuid_le(const bt_uuid_t *src, void *dst);
> >
> > gatt-helpers.h uses a namespace prefix of "bt_gatt" so you should at
> > the very least conform to that. The function name would then become e.g.
> > bt_gatt_put_uuid(). Besides that I don't have any objections to the
> > patch.
>
> You are absolutely right, this function does not belong here, Ive send and
> patch moving it to lib/uuid.h where bt_uuid is implemented since it is given
> as parameter here.
>
> @Gowtham, I hope you are paying attention to the outcome of these
> changes.
>

I am about to submit a patch to address Johan comments (to add "bt_uuid" prefix to put_uuid_le func).
Anyway your patch optimizes the whole thing. Thanks !.

Since I am new to BlueZ, may be it will take some time get an overview of all.
Please feel free to correct my patches in future, if anything is wrong.

Regards,
Gowtham Anandha Babu

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


2015-02-13 13:49:09

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH] gatt-server: Fix mutlpile definition of same func

Hi Johan,

On Fri, Feb 13, 2015 at 1:33 PM, Johan Hedberg <[email protected]> wrote:
> Hi,
>
> On Fri, Feb 06, 2015, Gowtham Anandha Babu wrote:
>> --- a/src/shared/gatt-helpers.h
>> +++ b/src/shared/gatt-helpers.h
>> @@ -105,3 +105,5 @@ bool bt_gatt_read_by_type(struct bt_att *att, uint16_t start, uint16_t end,
>> bt_gatt_discovery_callback_t callback,
>> void *user_data,
>> bt_gatt_destroy_func_t destroy);
>> +
>> +void put_uuid_le(const bt_uuid_t *src, void *dst);
>
> gatt-helpers.h uses a namespace prefix of "bt_gatt" so you should at the
> very least conform to that. The function name would then become e.g.
> bt_gatt_put_uuid(). Besides that I don't have any objections to the
> patch.

You are absolutely right, this function does not belong here, Ive send
and patch moving it to lib/uuid.h where bt_uuid is implemented since
it is given as parameter here.

@Gowtham, I hope you are paying attention to the outcome of these changes.


--
Luiz Augusto von Dentz

2015-02-13 11:33:47

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH] gatt-server: Fix mutlpile definition of same func

Hi,

On Fri, Feb 06, 2015, Gowtham Anandha Babu wrote:
> --- a/src/shared/gatt-helpers.h
> +++ b/src/shared/gatt-helpers.h
> @@ -105,3 +105,5 @@ bool bt_gatt_read_by_type(struct bt_att *att, uint16_t start, uint16_t end,
> bt_gatt_discovery_callback_t callback,
> void *user_data,
> bt_gatt_destroy_func_t destroy);
> +
> +void put_uuid_le(const bt_uuid_t *src, void *dst);

gatt-helpers.h uses a namespace prefix of "bt_gatt" so you should at the
very least conform to that. The function name would then become e.g.
bt_gatt_put_uuid(). Besides that I don't have any objections to the
patch.

Johan

2015-02-13 12:53:54

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH] gatt-server: Fix mutlpile definition of same func

Hi Gowtham,

On Fri, Feb 13, 2015 at 1:20 PM, Gowtham Anandha Babu
<[email protected]> wrote:
> Ping.
>
>> -----Original Message-----
>> From: [email protected] [mailto:linux-bluetooth-
>> [email protected]] On Behalf Of Gowtham Anandha Babu
>> Sent: Friday, February 06, 2015 6:17 PM
>> To: [email protected]
>> Cc: [email protected]; [email protected]; Gowtham Anandha
>> Babu
>> Subject: [PATCH] gatt-server: Fix mutlpile definition of same func
>>
>> Removed 'put_uuid_le' func from gatt-server, which was already defined in
>> gatt-helpers.
>> ---
>> src/shared/gatt-helpers.c | 2 +-
>> src/shared/gatt-helpers.h | 2 ++
>> src/shared/gatt-server.c | 21 ---------------------
>> 3 files changed, 3 insertions(+), 22 deletions(-)
>>
>> diff --git a/src/shared/gatt-helpers.c b/src/shared/gatt-helpers.c index
>> a33f960..6dfc24f 100644
>> --- a/src/shared/gatt-helpers.c
>> +++ b/src/shared/gatt-helpers.c
>> @@ -567,7 +567,7 @@ bool bt_gatt_exchange_mtu(struct bt_att *att,
>> uint16_t client_rx_mtu,
>> return true;
>> }
>>
>> -static void put_uuid_le(const bt_uuid_t *src, void *dst)
>> +void put_uuid_le(const bt_uuid_t *src, void *dst)
>> {
>> bt_uuid_t uuid;
>>
>> diff --git a/src/shared/gatt-helpers.h b/src/shared/gatt-helpers.h index
>> 0217e82..7a2076b 100644
>> --- a/src/shared/gatt-helpers.h
>> +++ b/src/shared/gatt-helpers.h
>> @@ -105,3 +105,5 @@ bool bt_gatt_read_by_type(struct bt_att *att,
>> uint16_t start, uint16_t end,
>> bt_gatt_discovery_callback_t
>> callback,
>> void *user_data,
>> bt_gatt_destroy_func_t destroy);
>> +
>> +void put_uuid_le(const bt_uuid_t *src, void *dst);
>> diff --git a/src/shared/gatt-server.c b/src/shared/gatt-server.c index
>> 8f7b5cd..0652d3d 100644
>> --- a/src/shared/gatt-server.c
>> +++ b/src/shared/gatt-server.c
>> @@ -499,27 +499,6 @@ error:
>> queue_destroy(q, NULL);
>> }
>>
>> -static void put_uuid_le(const bt_uuid_t *src, void *dst) -{
>> - bt_uuid_t uuid;
>> -
>> - switch (src->type) {
>> - case BT_UUID16:
>> - put_le16(src->value.u16, dst);
>> - break;
>> - case BT_UUID128:
>> - bswap_128(&src->value.u128, dst);
>> - break;
>> - case BT_UUID32:
>> - bt_uuid_to_uuid128(src, &uuid);
>> - bswap_128(&uuid.value.u128, dst);
>> - break;
>> - case BT_UUID_UNSPEC:
>> - default:
>> - break;
>> - }
>> -}
>> -
>> static bool encode_find_info_rsp(struct gatt_db *db, struct queue *q,
>> uint16_t mtu,
>> uint8_t *pdu, uint16_t *len)
>> --
>> 1.9.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth"
> in
>> the body of a message to [email protected] More majordomo
>> info at http://vger.kernel.org/majordomo-info.html

Pushed, thansl


--
Luiz Augusto von Dentz

2015-02-13 11:20:33

by Gowtham Anandha Babu

[permalink] [raw]
Subject: RE: [PATCH] gatt-server: Fix mutlpile definition of same func

Ping.

> -----Original Message-----
> From: [email protected] [mailto:linux-bluetooth-
> [email protected]] On Behalf Of Gowtham Anandha Babu
> Sent: Friday, February 06, 2015 6:17 PM
> To: [email protected]
> Cc: [email protected]; [email protected]; Gowtham Anandha
> Babu
> Subject: [PATCH] gatt-server: Fix mutlpile definition of same func
>
> Removed 'put_uuid_le' func from gatt-server, which was already defined in
> gatt-helpers.
> ---
> src/shared/gatt-helpers.c | 2 +-
> src/shared/gatt-helpers.h | 2 ++
> src/shared/gatt-server.c | 21 ---------------------
> 3 files changed, 3 insertions(+), 22 deletions(-)
>
> diff --git a/src/shared/gatt-helpers.c b/src/shared/gatt-helpers.c index
> a33f960..6dfc24f 100644
> --- a/src/shared/gatt-helpers.c
> +++ b/src/shared/gatt-helpers.c
> @@ -567,7 +567,7 @@ bool bt_gatt_exchange_mtu(struct bt_att *att,
> uint16_t client_rx_mtu,
> return true;
> }
>
> -static void put_uuid_le(const bt_uuid_t *src, void *dst)
> +void put_uuid_le(const bt_uuid_t *src, void *dst)
> {
> bt_uuid_t uuid;
>
> diff --git a/src/shared/gatt-helpers.h b/src/shared/gatt-helpers.h index
> 0217e82..7a2076b 100644
> --- a/src/shared/gatt-helpers.h
> +++ b/src/shared/gatt-helpers.h
> @@ -105,3 +105,5 @@ bool bt_gatt_read_by_type(struct bt_att *att,
> uint16_t start, uint16_t end,
> bt_gatt_discovery_callback_t
> callback,
> void *user_data,
> bt_gatt_destroy_func_t destroy);
> +
> +void put_uuid_le(const bt_uuid_t *src, void *dst);
> diff --git a/src/shared/gatt-server.c b/src/shared/gatt-server.c index
> 8f7b5cd..0652d3d 100644
> --- a/src/shared/gatt-server.c
> +++ b/src/shared/gatt-server.c
> @@ -499,27 +499,6 @@ error:
> queue_destroy(q, NULL);
> }
>
> -static void put_uuid_le(const bt_uuid_t *src, void *dst) -{
> - bt_uuid_t uuid;
> -
> - switch (src->type) {
> - case BT_UUID16:
> - put_le16(src->value.u16, dst);
> - break;
> - case BT_UUID128:
> - bswap_128(&src->value.u128, dst);
> - break;
> - case BT_UUID32:
> - bt_uuid_to_uuid128(src, &uuid);
> - bswap_128(&uuid.value.u128, dst);
> - break;
> - case BT_UUID_UNSPEC:
> - default:
> - break;
> - }
> -}
> -
> static bool encode_find_info_rsp(struct gatt_db *db, struct queue *q,
> uint16_t mtu,
> uint8_t *pdu, uint16_t *len)
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth"
in
> the body of a message to [email protected] More majordomo
> info at http://vger.kernel.org/majordomo-info.html