summaryrefslogtreecommitdiff
path: root/src/attrib-server.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-03-13 17:00:19 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2014-03-13 17:01:39 +0200
commit7036010169e7278e1651608c92ce6cf5ca4c10e3 (patch)
tree6b77f14eff8576b67d9a2a128830be173ee69fea /src/attrib-server.c
parentdd80cad906f33d39cc900b1ae2e5fd3de29fe4ce (diff)
downloadbluez-7036010169e7278e1651608c92ce6cf5ca4c10e3.tar.gz
core: Use device_attach_attrib for attrib-server
Diffstat (limited to 'src/attrib-server.c')
-rw-r--r--src/attrib-server.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/attrib-server.c b/src/attrib-server.c
index 3f68fea06..3f579bbbe 100644
--- a/src/attrib-server.c
+++ b/src/attrib-server.c
@@ -1247,7 +1247,10 @@ gboolean attrib_channel_detach(GAttrib *attrib, guint id)
static void connect_event(GIOChannel *io, GError *gerr, void *user_data)
{
- GAttrib *attrib;
+ struct btd_adapter *adapter;
+ struct btd_device *device;
+ uint8_t dst_type;
+ bdaddr_t src, dst;
DBG("");
@@ -1256,12 +1259,26 @@ static void connect_event(GIOChannel *io, GError *gerr, void *user_data)
return;
}
- attrib = g_attrib_new(io);
- if (!attrib)
+ bt_io_get(io, &gerr,
+ BT_IO_OPT_SOURCE_BDADDR, &src,
+ BT_IO_OPT_DEST_BDADDR, &dst,
+ BT_IO_OPT_DEST_TYPE, &dst_type,
+ BT_IO_OPT_INVALID);
+ if (gerr) {
+ error("bt_io_get: %s", gerr->message);
+ g_error_free(gerr);
+ return;
+ }
+
+ adapter = adapter_find(&src);
+ if (!adapter)
+ return;
+
+ device = btd_adapter_get_device(adapter, &dst, dst_type);
+ if (!device)
return;
- attrib_channel_attach(attrib);
- g_attrib_unref(attrib);
+ device_attach_attrib(device, io);
}
static gboolean register_core_services(struct gatt_server *server)