aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2011-04-11 15:24:27 -0300
committerJohan Hedberg <johan.hedberg@nokia.com>2011-04-14 20:09:30 +0300
commit5eb9d13c5b75f3659454466d511533c2f413cbbd (patch)
tree938c510c56cd3aefc22c46864960a04da6f0c447
parent612d0207646064f309edd564a69d30b42de9e26f (diff)
downloadbluez-5eb9d13c5b75f3659454466d511533c2f413cbbd.tar.gz
bluez-5eb9d13c5b75f3659454466d511533c2f413cbbd.tar.xz
bluez-5eb9d13c5b75f3659454466d511533c2f413cbbd.zip
Cleanup primary service registration from storage
-rw-r--r--src/adapter.c9
-rw-r--r--src/device.c20
-rw-r--r--src/device.h4
3 files changed, 9 insertions, 24 deletions
diff --git a/src/adapter.c b/src/adapter.c
index c400bfd7..6caff9a2 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -58,8 +58,6 @@
#include "storage.h"
#include "attrib-server.h"
#include "att.h"
-#include "gattrib.h"
-#include "attrib/client.h"
/* Interleaved discovery window: 5.12 sec */
#define GAP_INTER_DISCOV_WIN 5120
@@ -2193,16 +2191,11 @@ static void create_stored_device_from_primary(char *key, char *value,
for (l = services, uuids = NULL; l; l = l->next) {
struct att_primary *prim = l->data;
uuids = g_slist_append(uuids, prim->uuid);
-
- device_add_primary(device, prim);
}
- /* FIXME: Need the correct psm */
- attrib_client_register(connection, device, -1, NULL, services);
-
device_probe_drivers(device, uuids);
+ device_register_services(connection, device, services, -1);
- g_slist_free(services);
g_slist_free(uuids);
}
diff --git a/src/device.c b/src/device.c
index ecd1861d..f9b7a735 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1406,14 +1406,6 @@ static GSList *primary_from_record(struct btd_device *device, GSList *profiles)
return prim_list;
}
-static void register_primary_services(DBusConnection *conn,
- struct btd_device *device, GSList *prim_list)
-{
- /* TODO: PSM is hardcoded */
- attrib_client_register(conn, device, 31, NULL, prim_list);
- device->primaries = g_slist_concat(device->primaries, prim_list);
-}
-
static void search_cb(sdp_list_t *recs, int err, gpointer user_data)
{
struct browse_req *req = user_data;
@@ -1450,7 +1442,7 @@ static void search_cb(sdp_list_t *recs, int err, gpointer user_data)
list = primary_from_record(device, req->profiles_added);
if (list)
- register_primary_services(req->conn, device, list);
+ device_register_services(req->conn, device, list, 31);
}
/* Remove drivers for services removed */
@@ -1592,13 +1584,11 @@ static void primary_cb(GSList *services, guint8 status, gpointer user_data)
for (l = services; l; l = l->next) {
struct att_primary *prim = l->data;
uuids = g_slist_append(uuids, prim->uuid);
- device_add_primary(device, prim);
}
device_probe_drivers(device, uuids);
- /* FIXME: Need the correct psm */
- attrib_client_register(req->conn, device, -1, req->attrib, services);
+ device_register_services(req->conn, device, services, -1);
g_slist_free(uuids);
@@ -2354,9 +2344,11 @@ void btd_device_add_service(struct btd_device *device, const char *path)
device->services = g_slist_append(device->services, g_strdup(path));
}
-void device_add_primary(struct btd_device *device, struct att_primary *prim)
+void device_register_services(DBusConnection *conn, struct btd_device *device,
+ GSList *prim_list, int psm)
{
- device->primaries = g_slist_append(device->primaries, prim);
+ attrib_client_register(conn, device, psm, NULL, prim_list);
+ device->primaries = g_slist_concat(device->primaries, prim_list);
}
GSList *btd_device_get_primaries(struct btd_device *device)
diff --git a/src/device.h b/src/device.h
index 3ce212b2..285364f9 100644
--- a/src/device.h
+++ b/src/device.h
@@ -25,7 +25,6 @@
#define DEVICE_INTERFACE "org.bluez.Device"
struct btd_device;
-struct att_primary;
typedef enum {
AUTH_TYPE_PINCODE,
@@ -58,7 +57,8 @@ const sdp_record_t *btd_device_get_record(struct btd_device *device,
const char *uuid);
GSList *btd_device_get_primaries(struct btd_device *device);
void btd_device_add_service(struct btd_device *device, const char *path);
-void device_add_primary(struct btd_device *device, struct att_primary *prim);
+void device_register_services(DBusConnection *conn, struct btd_device *device,
+ GSList *prim_list, int psm);
void btd_device_add_uuid(struct btd_device *device, const char *uuid);
struct btd_adapter *device_get_adapter(struct btd_device *device);
void device_get_address(struct btd_device *device, bdaddr_t *bdaddr);