linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] GATT/ATT Cleanup
@ 2012-03-26  7:35 chen.ganir
  2012-03-26  7:35 ` [PATCH v2 1/2] GATT: Rename service and char structs chen.ganir
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: chen.ganir @ 2012-03-26  7:35 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Chen Ganir

From: Chen Ganir <chen.ganir@ti.com>

Move gatt related primary and characteristic definitions
from the att.h to gatt.h (ATT does not define services and
characteristics - those are GATT terms).

This is v2 of the patch set, fixing compilation errors.

Chen Ganir (2):
  GATT: Rename service and char structs
  GATT: replace start/end with att_range

 attrib/att.h              |   13 -------------
 attrib/client.c           |   22 +++++++++++-----------
 attrib/gatt.c             |   12 ++++++------
 attrib/gatt.h             |   12 ++++++++++++
 attrib/gatttool.c         |    6 +++---
 attrib/interactive.c      |    6 +++---
 proximity/manager.c       |    6 ++++--
 proximity/monitor.c       |   22 +++++++++++-----------
 proximity/monitor.h       |    4 ++--
 src/adapter.c             |   11 ++++++-----
 src/device.c              |   14 +++++++-------
 thermometer/manager.c     |    6 ++++--
 thermometer/thermometer.c |   12 ++++++------
 thermometer/thermometer.h |    2 +-
 14 files changed, 76 insertions(+), 72 deletions(-)

-- 
1.7.4.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/2] GATT: Rename service and char structs
  2012-03-26  7:35 [PATCH v2 0/2] GATT/ATT Cleanup chen.ganir
@ 2012-03-26  7:35 ` chen.ganir
  2012-03-26  7:35 ` [PATCH v2 2/2] GATT: replace start/end with att_range chen.ganir
  2012-03-26  9:21 ` [PATCH v2 0/2] GATT/ATT Cleanup Johan Hedberg
  2 siblings, 0 replies; 4+ messages in thread
From: chen.ganir @ 2012-03-26  7:35 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Chen Ganir

From: Chen Ganir <chen.ganir@ti.com>

Rename the att_primary to gatt_primary and att_char to gatt_char.
Characteristic and Service do not exist in the ATT spec, only in
GATT.
---
 attrib/att.h              |   13 -------------
 attrib/client.c           |   12 ++++++------
 attrib/gatt.c             |    8 ++++----
 attrib/gatt.h             |   13 +++++++++++++
 attrib/gatttool.c         |    4 ++--
 attrib/interactive.c      |    4 ++--
 proximity/manager.c       |    6 ++++--
 proximity/monitor.c       |   10 +++++-----
 proximity/monitor.h       |    4 ++--
 src/adapter.c             |    7 ++++---
 src/device.c              |    8 ++++----
 thermometer/manager.c     |    6 ++++--
 thermometer/thermometer.c |    8 ++++----
 thermometer/thermometer.h |    2 +-
 14 files changed, 55 insertions(+), 50 deletions(-)

diff --git a/attrib/att.h b/attrib/att.h
index dc266f1..09511d2 100644
--- a/attrib/att.h
+++ b/attrib/att.h
@@ -148,19 +148,6 @@ struct att_range {
 	uint16_t end;
 };
 
-struct att_primary {
-	char uuid[MAX_LEN_UUID_STR + 1];
-	uint16_t start;
-	uint16_t end;
-};
-
-struct att_char {
-	char uuid[MAX_LEN_UUID_STR + 1];
-	uint16_t handle;
-	uint8_t properties;
-	uint16_t value_handle;
-};
-
 /* These functions do byte conversion */
 static inline uint8_t att_get_u8(const void *ptr)
 {
diff --git a/attrib/client.c b/attrib/client.c
index 60cff01..7c01514 100644
--- a/attrib/client.c
+++ b/attrib/client.c
@@ -68,7 +68,7 @@ struct query {
 
 struct gatt_service {
 	struct btd_device *dev;
-	struct att_primary *prim;
+	struct gatt_primary *prim;
 	DBusConnection *conn;
 	GAttrib *attrib;
 	guint attioid;
@@ -821,7 +821,7 @@ static void char_discovered_cb(GSList *characteristics, guint8 status,
 	DBusMessageIter iter, array_iter;
 	struct query_data *current = user_data;
 	struct gatt_service *gatt = current->gatt;
-	struct att_primary *prim = gatt->prim;
+	struct gatt_primary *prim = gatt->prim;
 	uint16_t *previous_end = NULL;
 	GSList *l;
 	bdaddr_t sba, dba;
@@ -835,7 +835,7 @@ static void char_discovered_cb(GSList *characteristics, guint8 status,
 	}
 
 	for (l = characteristics; l; l = l->next) {
-		struct att_char *current_chr = l->data;
+		struct gatt_char *current_chr = l->data;
 		struct characteristic *chr;
 		guint handle = current_chr->value_handle;
 		GSList *lchr;
@@ -895,7 +895,7 @@ static void send_discover(GAttrib *attrib, gpointer user_data)
 {
 	struct query_data *qchr = user_data;
 	struct gatt_service *gatt = qchr->gatt;
-	struct att_primary *prim = gatt->prim;
+	struct gatt_primary *prim = gatt->prim;
 
 	gatt->attrib = g_attrib_ref(attrib);
 
@@ -995,7 +995,7 @@ static GDBusMethodTable prim_methods[] = {
 
 static struct gatt_service *primary_register(DBusConnection *conn,
 						struct btd_device *device,
-						struct att_primary *prim,
+						struct gatt_primary *prim,
 						int psm)
 {
 	struct gatt_service *gatt;
@@ -1027,7 +1027,7 @@ GSList *attrib_client_register(DBusConnection *connection,
 	GSList *l, *services;
 
 	for (l = primaries, services = NULL; l; l = l->next) {
-		struct att_primary *prim = l->data;
+		struct gatt_primary *prim = l->data;
 		struct gatt_service *gatt;
 
 		gatt = primary_register(connection, device, prim, psm);
diff --git a/attrib/gatt.c b/attrib/gatt.c
index 452a4cf..7cf718d 100644
--- a/attrib/gatt.c
+++ b/attrib/gatt.c
@@ -172,7 +172,7 @@ static void primary_all_cb(guint8 status, const guint8 *ipdu, guint16 iplen,
 
 	for (i = 0, end = 0; i < list->num; i++) {
 		const uint8_t *data = list->data[i];
-		struct att_primary *primary;
+		struct gatt_primary *primary;
 		bt_uuid_t uuid;
 
 		start = att_get_u16(&data[0]);
@@ -188,7 +188,7 @@ static void primary_all_cb(guint8 status, const guint8 *ipdu, guint16 iplen,
 			continue;
 		}
 
-		primary = g_try_new0(struct att_primary, 1);
+		primary = g_try_new0(struct gatt_primary, 1);
 		if (!primary) {
 			err = ATT_ECODE_INSUFF_RESOURCES;
 			goto done;
@@ -274,7 +274,7 @@ static void char_discovered_cb(guint8 status, const guint8 *ipdu, guint16 iplen,
 
 	for (i = 0; i < list->num; i++) {
 		uint8_t *value = list->data[i];
-		struct att_char *chars;
+		struct gatt_char *chars;
 		bt_uuid_t uuid;
 
 		last = att_get_u16(value);
@@ -285,7 +285,7 @@ static void char_discovered_cb(guint8 status, const guint8 *ipdu, guint16 iplen,
 		} else
 			uuid = att_get_uuid128(&value[5]);
 
-		chars = g_try_new0(struct att_char, 1);
+		chars = g_try_new0(struct gatt_char, 1);
 		if (!chars) {
 			err = ATT_ECODE_INSUFF_RESOURCES;
 			goto done;
diff --git a/attrib/gatt.h b/attrib/gatt.h
index c5f95ac..cf37914 100644
--- a/attrib/gatt.h
+++ b/attrib/gatt.h
@@ -25,6 +25,19 @@
 
 typedef void (*gatt_cb_t) (GSList *l, guint8 status, gpointer user_data);
 
+struct gatt_primary {
+	char uuid[MAX_LEN_UUID_STR + 1];
+	uint16_t start;
+	uint16_t end;
+};
+
+struct gatt_char {
+	char uuid[MAX_LEN_UUID_STR + 1];
+	uint16_t handle;
+	uint8_t properties;
+	uint16_t value_handle;
+};
+
 guint gatt_discover_primary(GAttrib *attrib, bt_uuid_t *uuid, gatt_cb_t func,
 							gpointer user_data);
 
diff --git a/attrib/gatttool.c b/attrib/gatttool.c
index 17ee913..24a85a4 100644
--- a/attrib/gatttool.c
+++ b/attrib/gatttool.c
@@ -146,7 +146,7 @@ static void primary_all_cb(GSList *services, guint8 status, gpointer user_data)
 	}
 
 	for (l = services; l; l = l->next) {
-		struct att_primary *prim = l->data;
+		struct gatt_primary *prim = l->data;
 		g_print("attr handle = 0x%04x, end grp handle = 0x%04x "
 			"uuid: %s\n", prim->start, prim->end, prim->uuid);
 	}
@@ -201,7 +201,7 @@ static void char_discovered_cb(GSList *characteristics, guint8 status,
 	}
 
 	for (l = characteristics; l; l = l->next) {
-		struct att_char *chars = l->data;
+		struct gatt_char *chars = l->data;
 
 		g_print("handle = 0x%04x, char properties = 0x%02x, char value "
 			"handle = 0x%04x, uuid = %s\n", chars->handle,
diff --git a/attrib/interactive.c b/attrib/interactive.c
index be81424..2d650d6 100644
--- a/attrib/interactive.c
+++ b/attrib/interactive.c
@@ -161,7 +161,7 @@ static void primary_all_cb(GSList *services, guint8 status, gpointer user_data)
 
 	printf("\n");
 	for (l = services; l; l = l->next) {
-		struct att_primary *prim = l->data;
+		struct gatt_primary *prim = l->data;
 		printf("attr handle: 0x%04x, end grp handle: 0x%04x "
 			"uuid: %s\n", prim->start, prim->end, prim->uuid);
 	}
@@ -202,7 +202,7 @@ static void char_cb(GSList *characteristics, guint8 status, gpointer user_data)
 
 	printf("\n");
 	for (l = characteristics; l; l = l->next) {
-		struct att_char *chars = l->data;
+		struct gatt_char *chars = l->data;
 
 		printf("handle: 0x%04x, char properties: 0x%02x, char value "
 				"handle: 0x%04x, uuid: %s\n", chars->handle,
diff --git a/proximity/manager.c b/proximity/manager.c
index 336d8f7..286f7e3 100644
--- a/proximity/manager.c
+++ b/proximity/manager.c
@@ -33,6 +33,8 @@
 #include "adapter.h"
 #include "device.h"
 #include "att.h"
+#include "gattrib.h"
+#include "gatt.h"
 #include "monitor.h"
 #include "reporter.h"
 #include "manager.h"
@@ -51,7 +53,7 @@ static struct enabled enabled  = {
 
 static gint primary_uuid_cmp(gconstpointer a, gconstpointer b)
 {
-	const struct att_primary *prim = a;
+	const struct gatt_primary *prim = a;
 	const char *uuid = b;
 
 	return g_strcmp0(prim->uuid, uuid);
@@ -59,7 +61,7 @@ static gint primary_uuid_cmp(gconstpointer a, gconstpointer b)
 
 static int attio_device_probe(struct btd_device *device, GSList *uuids)
 {
-	struct att_primary *linkloss, *txpower, *immediate;
+	struct gatt_primary *linkloss, *txpower, *immediate;
 	GSList *l, *primaries;
 
 	primaries = btd_device_get_primaries(device);
diff --git a/proximity/monitor.c b/proximity/monitor.c
index 7bf95a1..f3d5b2d 100644
--- a/proximity/monitor.c
+++ b/proximity/monitor.c
@@ -168,7 +168,7 @@ static void char_discovered_cb(GSList *characteristics, guint8 status,
 							gpointer user_data)
 {
 	struct monitor *monitor = user_data;
-	struct att_char *chr;
+	struct gatt_char *chr;
 	uint8_t value = str2level(monitor->linklosslevel);
 
 	if (status) {
@@ -236,7 +236,7 @@ static void tx_power_handle_cb(GSList *characteristics, guint8 status,
 							gpointer user_data)
 {
 	struct monitor *monitor = user_data;
-	struct att_char *chr;
+	struct gatt_char *chr;
 
 	if (status) {
 		error("Discover Tx Power handle: %s", att_ecode2str(status));
@@ -322,7 +322,7 @@ static void immediate_handle_cb(GSList *characteristics, guint8 status,
 							gpointer user_data)
 {
 	struct monitor *monitor = user_data;
-	struct att_char *chr;
+	struct gatt_char *chr;
 
 	if (status) {
 		error("Discover Immediate Alert handle: %s",
@@ -583,8 +583,8 @@ static void monitor_destroy(gpointer user_data)
 }
 
 int monitor_register(DBusConnection *conn, struct btd_device *device,
-		struct att_primary *linkloss, struct att_primary *txpower,
-		struct att_primary *immediate, struct enabled *enabled)
+		struct gatt_primary *linkloss, struct gatt_primary *txpower,
+		struct gatt_primary *immediate, struct enabled *enabled)
 {
 	const char *path = device_get_path(device);
 	struct monitor *monitor;
diff --git a/proximity/monitor.h b/proximity/monitor.h
index fb79e26..b71363d 100644
--- a/proximity/monitor.h
+++ b/proximity/monitor.h
@@ -29,6 +29,6 @@ struct enabled {
 };
 
 int monitor_register(DBusConnection *conn, struct btd_device *device,
-		struct att_primary *linkloss, struct att_primary *txpower,
-		struct att_primary *immediate, struct enabled *enabled);
+		struct gatt_primary *linkloss, struct gatt_primary *txpower,
+		struct gatt_primary *immediate, struct enabled *enabled);
 void monitor_unregister(DBusConnection *conn, struct btd_device *device);
diff --git a/src/adapter.c b/src/adapter.c
index acb845e..c66968d 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -58,6 +58,7 @@
 #include "storage.h"
 #include "gattrib.h"
 #include "att.h"
+#include "gatt.h"
 #include "attrib-server.h"
 #include "eir.h"
 
@@ -1893,10 +1894,10 @@ static GSList *string_to_primary_list(char *str)
 		return NULL;
 
 	for (i = 0; services[i]; i++) {
-		struct att_primary *prim;
+		struct gatt_primary *prim;
 		int ret;
 
-		prim = g_new0(struct att_primary, 1);
+		prim = g_new0(struct gatt_primary, 1);
 
 		ret = sscanf(services[i], "%04hX#%04hX#%s", &prim->start,
 							&prim->end, prim->uuid);
@@ -1938,7 +1939,7 @@ static void create_stored_device_from_primary(char *key, char *value,
 		return;
 
 	for (l = services, uuids = NULL; l; l = l->next) {
-		struct att_primary *prim = l->data;
+		struct gatt_primary *prim = l->data;
 		uuids = g_slist_append(uuids, prim->uuid);
 	}
 
diff --git a/src/device.c b/src/device.c
index 2bc0620..c470ab1 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1531,7 +1531,7 @@ GSList *device_services_from_record(struct btd_device *device, GSList *profiles)
 	for (l = profiles; l; l = l->next) {
 		const char *profile_uuid = l->data;
 		const sdp_record_t *rec;
-		struct att_primary *prim;
+		struct gatt_primary *prim;
 		uint16_t start = 0, end = 0, psm = 0;
 		uuid_t prim_uuid;
 
@@ -1545,7 +1545,7 @@ GSList *device_services_from_record(struct btd_device *device, GSList *profiles)
 		if (!gatt_parse_record(rec, &prim_uuid, &psm, &start, &end))
 			continue;
 
-		prim = g_new0(struct att_primary, 1);
+		prim = g_new0(struct gatt_primary, 1);
 		prim->start = start;
 		prim->end = end;
 		sdp_uuid2strn(&prim_uuid, prim->uuid, sizeof(prim->uuid));
@@ -1700,7 +1700,7 @@ static char *primary_list_to_string(GSList *primary_list)
 	services = g_string_new(NULL);
 
 	for (l = primary_list; l; l = l->next) {
-		struct att_primary *primary = l->data;
+		struct gatt_primary *primary = l->data;
 		char service[64];
 
 		memset(service, 0, sizeof(service));
@@ -1803,7 +1803,7 @@ static void primary_cb(GSList *services, guint8 status, gpointer user_data)
 	device_set_temporary(device, FALSE);
 
 	for (l = services; l; l = l->next) {
-		struct att_primary *prim = l->data;
+		struct gatt_primary *prim = l->data;
 		uuids = g_slist_append(uuids, prim->uuid);
 	}
 
diff --git a/thermometer/manager.c b/thermometer/manager.c
index 9dfbbe8..8982beb 100644
--- a/thermometer/manager.c
+++ b/thermometer/manager.c
@@ -27,6 +27,8 @@
 #include "adapter.h"
 #include "device.h"
 #include "att.h"
+#include "gattrib.h"
+#include "gatt.h"
 #include "thermometer.h"
 #include "manager.h"
 
@@ -36,7 +38,7 @@ static DBusConnection *connection = NULL;
 
 static gint primary_uuid_cmp(gconstpointer a, gconstpointer b)
 {
-	const struct att_primary *prim = a;
+	const struct gatt_primary *prim = a;
 	const char *uuid = b;
 
 	return g_strcmp0(prim->uuid, uuid);
@@ -44,7 +46,7 @@ static gint primary_uuid_cmp(gconstpointer a, gconstpointer b)
 
 static int thermometer_driver_probe(struct btd_device *device, GSList *uuids)
 {
-	struct att_primary *tattr;
+	struct gatt_primary *tattr;
 	GSList *primaries, *l;
 
 	primaries = btd_device_get_primaries(device);
diff --git a/thermometer/thermometer.c b/thermometer/thermometer.c
index 3cc2454..de4e647 100644
--- a/thermometer/thermometer.c
+++ b/thermometer/thermometer.c
@@ -75,7 +75,7 @@ struct thermometer {
 };
 
 struct characteristic {
-	struct att_char		attr;	/* Characteristic */
+	struct gatt_char		attr;	/* Characteristic */
 	GSList			*desc;	/* Descriptors */
 	struct thermometer	*t;	/* Thermometer where the char belongs */
 };
@@ -522,7 +522,7 @@ static void configure_thermometer_cb(GSList *characteristics, guint8 status,
 	}
 
 	for (l = characteristics; l; l = l->next) {
-		struct att_char *c = l->data;
+		struct gatt_char *c = l->data;
 		struct characteristic *ch;
 		uint16_t start, end;
 
@@ -540,7 +540,7 @@ static void configure_thermometer_cb(GSList *characteristics, guint8 status,
 		start = c->value_handle + 1;
 
 		if (l->next != NULL) {
-			struct att_char *c = l->next->data;
+			struct gatt_char *c = l->next->data;
 			if (start == c->handle)
 				continue;
 			end = c->handle - 1;
@@ -1211,7 +1211,7 @@ static void attio_disconnected_cb(gpointer user_data)
 }
 
 int thermometer_register(DBusConnection *connection, struct btd_device *device,
-						struct att_primary *tattr)
+						struct gatt_primary *tattr)
 {
 	const gchar *path = device_get_path(device);
 	struct thermometer *t;
diff --git a/thermometer/thermometer.h b/thermometer/thermometer.h
index 298c9ad..330503c 100644
--- a/thermometer/thermometer.h
+++ b/thermometer/thermometer.h
@@ -21,5 +21,5 @@
  */
 
 int thermometer_register(DBusConnection *connection, struct btd_device *device,
-						struct att_primary *tattr);
+						struct gatt_primary *tattr);
 void thermometer_unregister(struct btd_device *device);
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] GATT: replace start/end with att_range
  2012-03-26  7:35 [PATCH v2 0/2] GATT/ATT Cleanup chen.ganir
  2012-03-26  7:35 ` [PATCH v2 1/2] GATT: Rename service and char structs chen.ganir
@ 2012-03-26  7:35 ` chen.ganir
  2012-03-26  9:21 ` [PATCH v2 0/2] GATT/ATT Cleanup Johan Hedberg
  2 siblings, 0 replies; 4+ messages in thread
From: chen.ganir @ 2012-03-26  7:35 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Chen Ganir

From: Chen Ganir <chen.ganir@ti.com>

Use att_range struct instead of individual start/end handles in
gatt_primary structure
---
 attrib/client.c           |   10 +++++-----
 attrib/gatt.c             |    4 ++--
 attrib/gatt.h             |    3 +--
 attrib/gatttool.c         |    2 +-
 attrib/interactive.c      |    2 +-
 proximity/monitor.c       |   12 ++++++------
 src/adapter.c             |    4 ++--
 src/device.c              |    6 +++---
 thermometer/thermometer.c |    4 ++--
 9 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/attrib/client.c b/attrib/client.c
index 7c01514..c0e00c1 100644
--- a/attrib/client.c
+++ b/attrib/client.c
@@ -860,10 +860,10 @@ static void char_discovered_cb(GSList *characteristics, guint8 status,
 	}
 
 	if (previous_end)
-		*previous_end = prim->end;
+		*previous_end = prim->range.end;
 
 	gatt_get_address(gatt, &sba, &dba);
-	store_characteristics(&sba, &dba, prim->start, gatt->chars);
+	store_characteristics(&sba, &dba, prim->range.start, gatt->chars);
 
 	g_slist_foreach(gatt->chars, register_characteristic, gatt->path);
 
@@ -899,7 +899,7 @@ static void send_discover(GAttrib *attrib, gpointer user_data)
 
 	gatt->attrib = g_attrib_ref(attrib);
 
-	gatt_discover_char(gatt->attrib, prim->start, prim->end, NULL,
+	gatt_discover_char(gatt->attrib, prim->range.start, prim->range.end, NULL,
 						char_discovered_cb, qchr);
 }
 
@@ -1009,12 +1009,12 @@ static struct gatt_service *primary_register(DBusConnection *conn,
 	gatt->psm = psm;
 	gatt->conn = dbus_connection_ref(conn);
 	gatt->path = g_strdup_printf("%s/service%04x", device_path,
-								prim->start);
+								prim->range.start);
 
 	g_dbus_register_interface(gatt->conn, gatt->path,
 					CHAR_INTERFACE, prim_methods,
 					NULL, NULL, gatt, NULL);
-	gatt->chars = load_characteristics(gatt, prim->start);
+	gatt->chars = load_characteristics(gatt, prim->range.start);
 	g_slist_foreach(gatt->chars, register_characteristic, gatt->path);
 
 	return gatt;
diff --git a/attrib/gatt.c b/attrib/gatt.c
index 7cf718d..1c3ff78 100644
--- a/attrib/gatt.c
+++ b/attrib/gatt.c
@@ -193,8 +193,8 @@ static void primary_all_cb(guint8 status, const guint8 *ipdu, guint16 iplen,
 			err = ATT_ECODE_INSUFF_RESOURCES;
 			goto done;
 		}
-		primary->start = start;
-		primary->end = end;
+		primary->range.start = start;
+		primary->range.end = end;
 		bt_uuid_to_string(&uuid, primary->uuid, sizeof(primary->uuid));
 		dp->primaries = g_slist_append(dp->primaries, primary);
 	}
diff --git a/attrib/gatt.h b/attrib/gatt.h
index cf37914..1732270 100644
--- a/attrib/gatt.h
+++ b/attrib/gatt.h
@@ -27,8 +27,7 @@ typedef void (*gatt_cb_t) (GSList *l, guint8 status, gpointer user_data);
 
 struct gatt_primary {
 	char uuid[MAX_LEN_UUID_STR + 1];
-	uint16_t start;
-	uint16_t end;
+	struct att_range range;
 };
 
 struct gatt_char {
diff --git a/attrib/gatttool.c b/attrib/gatttool.c
index 24a85a4..21514af 100644
--- a/attrib/gatttool.c
+++ b/attrib/gatttool.c
@@ -148,7 +148,7 @@ static void primary_all_cb(GSList *services, guint8 status, gpointer user_data)
 	for (l = services; l; l = l->next) {
 		struct gatt_primary *prim = l->data;
 		g_print("attr handle = 0x%04x, end grp handle = 0x%04x "
-			"uuid: %s\n", prim->start, prim->end, prim->uuid);
+			"uuid: %s\n", prim->range.start, prim->range.end, prim->uuid);
 	}
 
 done:
diff --git a/attrib/interactive.c b/attrib/interactive.c
index 2d650d6..5941811 100644
--- a/attrib/interactive.c
+++ b/attrib/interactive.c
@@ -163,7 +163,7 @@ static void primary_all_cb(GSList *services, guint8 status, gpointer user_data)
 	for (l = services; l; l = l->next) {
 		struct gatt_primary *prim = l->data;
 		printf("attr handle: 0x%04x, end grp handle: 0x%04x "
-			"uuid: %s\n", prim->start, prim->end, prim->uuid);
+			"uuid: %s\n", prim->range.start, prim->range.end, prim->uuid);
 	}
 
 	rl_forced_update_display();
diff --git a/proximity/monitor.c b/proximity/monitor.c
index f3d5b2d..687b41c 100644
--- a/proximity/monitor.c
+++ b/proximity/monitor.c
@@ -617,8 +617,8 @@ int monitor_register(DBusConnection *conn, struct btd_device *device,
 
 	if (linkloss && enabled->linkloss) {
 		monitor->linkloss = g_new0(struct att_range, 1);
-		monitor->linkloss->start = linkloss->start;
-		monitor->linkloss->end = linkloss->end;
+		monitor->linkloss->start = linkloss->range.start;
+		monitor->linkloss->end = linkloss->range.end;
 
 		monitor->enabled.linkloss = TRUE;
 	}
@@ -626,16 +626,16 @@ int monitor_register(DBusConnection *conn, struct btd_device *device,
 	if (immediate) {
 		if (txpower && enabled->pathloss) {
 			monitor->txpower = g_new0(struct att_range, 1);
-			monitor->txpower->start = txpower->start;
-			monitor->txpower->end = txpower->end;
+			monitor->txpower->start = txpower->range.start;
+			monitor->txpower->end = txpower->range.end;
 
 			monitor->enabled.pathloss = TRUE;
 		}
 
 		if (enabled->pathloss || enabled->findme) {
 			monitor->immediate = g_new0(struct att_range, 1);
-			monitor->immediate->start = immediate->start;
-			monitor->immediate->end = immediate->end;
+			monitor->immediate->start = immediate->range.start;
+			monitor->immediate->end = immediate->range.end;
 		}
 
 		monitor->enabled.findme = enabled->findme;
diff --git a/src/adapter.c b/src/adapter.c
index c66968d..fa879af 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1899,8 +1899,8 @@ static GSList *string_to_primary_list(char *str)
 
 		prim = g_new0(struct gatt_primary, 1);
 
-		ret = sscanf(services[i], "%04hX#%04hX#%s", &prim->start,
-							&prim->end, prim->uuid);
+		ret = sscanf(services[i], "%04hX#%04hX#%s", &prim->range.start,
+							&prim->range.end, prim->uuid);
 
 		if (ret < 3) {
 			g_free(prim);
diff --git a/src/device.c b/src/device.c
index c470ab1..eab7e4c 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1546,8 +1546,8 @@ GSList *device_services_from_record(struct btd_device *device, GSList *profiles)
 			continue;
 
 		prim = g_new0(struct gatt_primary, 1);
-		prim->start = start;
-		prim->end = end;
+		prim->range.start = start;
+		prim->range.end = end;
 		sdp_uuid2strn(&prim_uuid, prim->uuid, sizeof(prim->uuid));
 
 		prim_list = g_slist_append(prim_list, prim);
@@ -1706,7 +1706,7 @@ static char *primary_list_to_string(GSList *primary_list)
 		memset(service, 0, sizeof(service));
 
 		snprintf(service, sizeof(service), "%04X#%04X#%s ",
-				primary->start, primary->end, primary->uuid);
+				primary->range.start, primary->range.end, primary->uuid);
 
 		services = g_string_append(services, service);
 	}
diff --git a/thermometer/thermometer.c b/thermometer/thermometer.c
index de4e647..a64ed54 100644
--- a/thermometer/thermometer.c
+++ b/thermometer/thermometer.c
@@ -1220,8 +1220,8 @@ int thermometer_register(DBusConnection *connection, struct btd_device *device,
 	t->conn = dbus_connection_ref(connection);
 	t->dev = btd_device_ref(device);
 	t->svc_range = g_new0(struct att_range, 1);
-	t->svc_range->start = tattr->start;
-	t->svc_range->end = tattr->end;
+	t->svc_range->start = tattr->range.start;
+	t->svc_range->end = tattr->range.end;
 
 	if (!g_dbus_register_interface(t->conn, path, THERMOMETER_INTERFACE,
 				thermometer_methods, thermometer_signals,
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 0/2] GATT/ATT Cleanup
  2012-03-26  7:35 [PATCH v2 0/2] GATT/ATT Cleanup chen.ganir
  2012-03-26  7:35 ` [PATCH v2 1/2] GATT: Rename service and char structs chen.ganir
  2012-03-26  7:35 ` [PATCH v2 2/2] GATT: replace start/end with att_range chen.ganir
@ 2012-03-26  9:21 ` Johan Hedberg
  2 siblings, 0 replies; 4+ messages in thread
From: Johan Hedberg @ 2012-03-26  9:21 UTC (permalink / raw)
  To: chen.ganir; +Cc: linux-bluetooth

Hi Chen,

On Mon, Mar 26, 2012, chen.ganir@ti.com wrote:
> Move gatt related primary and characteristic definitions
> from the att.h to gatt.h (ATT does not define services and
> characteristics - those are GATT terms).
> 
> This is v2 of the patch set, fixing compilation errors.
> 
> Chen Ganir (2):
>   GATT: Rename service and char structs
>   GATT: replace start/end with att_range
> 
>  attrib/att.h              |   13 -------------
>  attrib/client.c           |   22 +++++++++++-----------
>  attrib/gatt.c             |   12 ++++++------
>  attrib/gatt.h             |   12 ++++++++++++
>  attrib/gatttool.c         |    6 +++---
>  attrib/interactive.c      |    6 +++---
>  proximity/manager.c       |    6 ++++--
>  proximity/monitor.c       |   22 +++++++++++-----------
>  proximity/monitor.h       |    4 ++--
>  src/adapter.c             |   11 ++++++-----
>  src/device.c              |   14 +++++++-------
>  thermometer/manager.c     |    6 ++++--
>  thermometer/thermometer.c |   12 ++++++------
>  thermometer/thermometer.h |    2 +-
>  14 files changed, 76 insertions(+), 72 deletions(-)

Both patches have been applied. Thanks.

Johan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-03-26  9:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-26  7:35 [PATCH v2 0/2] GATT/ATT Cleanup chen.ganir
2012-03-26  7:35 ` [PATCH v2 1/2] GATT: Rename service and char structs chen.ganir
2012-03-26  7:35 ` [PATCH v2 2/2] GATT: replace start/end with att_range chen.ganir
2012-03-26  9:21 ` [PATCH v2 0/2] GATT/ATT Cleanup Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).