aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChen Ganir <chen.ganir@ti.com>2012-03-26 09:35:58 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2012-03-26 12:16:44 +0300
commit48c82115a2739881877fa857390ff2eca4dc73e0 (patch)
tree5d55bef8de7b7c56ce1734d6eedfb6720aba23bf
parentafb04979ee7b986f9351ca19565d3b0d7ac4c181 (diff)
downloadbluez-48c82115a2739881877fa857390ff2eca4dc73e0.tar.gz
bluez-48c82115a2739881877fa857390ff2eca4dc73e0.tar.xz
bluez-48c82115a2739881877fa857390ff2eca4dc73e0.zip
GATT: Rename service and char structs
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.
-rw-r--r--attrib/att.h13
-rw-r--r--attrib/client.c12
-rw-r--r--attrib/gatt.c8
-rw-r--r--attrib/gatt.h13
-rw-r--r--attrib/gatttool.c4
-rw-r--r--attrib/interactive.c4
-rw-r--r--proximity/manager.c6
-rw-r--r--proximity/monitor.c10
-rw-r--r--proximity/monitor.h4
-rw-r--r--src/adapter.c7
-rw-r--r--src/device.c8
-rw-r--r--thermometer/manager.c6
-rw-r--r--thermometer/thermometer.c8
-rw-r--r--thermometer/thermometer.h2
14 files changed, 55 insertions, 50 deletions
diff --git a/attrib/att.h b/attrib/att.h
index dc266f18..09511d22 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 60cff016..7c01514a 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 452a4cf8..7cf718db 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 c5f95ac4..cf379145 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 17ee9136..24a85a4f 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 be814249..2d650d64 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 336d8f70..286f7e3d 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 7bf95a1b..f3d5b2d3 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 fb79e260..b71363d6 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 13f36835..563cb90c 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 2bc06200..c470ab12 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 9dfbbe81..8982beb5 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 3cc2454e..de4e647a 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 298c9ad7..330503c0 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);