Skip to contentSkip to conversation

gatt-server: Fix mutlpile definition of same func

PATCH In review Gowtham Anandha Babu 3 participants 6 messages Feb 6, 2015 – Feb 13, 2015 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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(-)
src/shared/gatt-helpers.c +1 -1
index a33f960..6dfc24f 100644
@@ -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;
 
src/shared/gatt-helpers.h +2 -0
index 0217e82..7a2076b 100644
@@ -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);
src/shared/gatt-server.c +0 -21
index 8f7b5cd..0652d3d 100644
@@ -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)
Signature · 1 line
1.9.1
#1 lore raw

Ping.

Quoted 77 lines

-----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(-)
src/shared/gatt-helpers.c index renamed from src/shared/gatt-helpers.c +0 -0

a33f960..6dfc24f 100644

src/shared/gatt-helpers.c +1 -1
@@ -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;
src/shared/gatt-helpers.h index renamed from src/shared/gatt-helpers.h +0 -0

0217e82..7a2076b 100644

src/shared/gatt-helpers.h +2 -0
@@ -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);
src/shared/gatt-server.c index renamed from src/shared/gatt-server.c +0 -0

8f7b5cd..0652d3d 100644

src/shared/gatt-server.c +0 -21
@@ -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

Quoted 2 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth"

in

Quoted 2 lines

the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
In reply to Gowtham Anandha Babu

Hi,

src/shared/gatt-helpers.h bool bt_gatt_read_by_type(struct bt_att *att, uint16_t start, uint16_t end, · line 109

Quoted 8 lines · Gowtham Anandha Babu
src/shared/gatt-helpers.h +2 -0
@@ -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

#2 lore raw
In reply to Gowtham Anandha Babu

Hi Gowtham,

Quoted 79 lines · Gowtham Anandha Babu

Ping.

Quoted 77 lines

-----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(-)
src/shared/gatt-helpers.c index renamed from src/shared/gatt-helpers.c +0 -0

a33f960..6dfc24f 100644

src/shared/gatt-helpers.c +1 -1
@@ -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;
src/shared/gatt-helpers.h index renamed from src/shared/gatt-helpers.h +0 -0

0217e82..7a2076b 100644

src/shared/gatt-helpers.h +2 -0
@@ -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);
src/shared/gatt-server.c index renamed from src/shared/gatt-server.c +0 -0

8f7b5cd..0652d3d 100644

src/shared/gatt-server.c +0 -21
@@ -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

Quoted 5 lines
Quoted 2 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth"

in

Quoted 2 lines

the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Pushed, thansl

Signature · 1 line
Luiz Augusto von Dentz
#4 lore raw
In reply to Johan Hedberg

Hi Johan,

Quoted 16 lines · Johan Hedberg

Hi,

src/shared/gatt-helpers.h bool bt_gatt_read_by_type(struct bt_att *att, uint16_t start, uint16_t end, · line 109

Quoted 8 lines · Gowtham Anandha Babu
src/shared/gatt-helpers.h +2 -0
@@ -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.

Signature · 1 line
Luiz Augusto von Dentz
#5 lore raw

Hi Johan & Luiz,

Quoted 31 lines

-----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,

Quoted 6 lines · Johan Hedberg

Hi,

src/shared/gatt-helpers.h bool bt_gatt_read_by_type(struct bt_att *att,

Quoted 3 lines · Gowtham Anandha Babu
src/shared/gatt-helpers.h +0 -0
@@ -105,3 +105,5 @@ bool bt_gatt_read_by_type(struct bt_att *att,

uint16_t start, uint16_t end,

Quoted 11 lines

src/shared/gatt-helpers.h bool bt_gatt_read_by_type(struct bt_att *att, uint16_t start, uint16_t end, · line 109

Quoted 6 lines
src/shared/gatt-helpers.h +0 -0
                                      bt_gatt_discovery_callback_t callback,
                                      void *user_data,
                                      bt_gatt_destroy_func_t

destroy);

src/shared/gatt-helpers.h +2 -0
+
+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.

Quoted 7 lines

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

Quoted 7 lines

--
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