summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2008-09-25 22:34:16 -0700
committerJohan Hedberg <johan.hedberg@nokia.com>2008-09-25 22:34:16 -0700
commit68b27e68b50b1e68d663142d2b0432c435329ea6 (patch)
treef0bbacbff8d42cc5385be276043fc6826e1ff6d2
parent35c7f1a0155e675c37c4e258c50ed4e49b3ae4f6 (diff)
Move more pairing and discovery initiation logic into device.c
-rw-r--r--src/dbus-hci.c21
-rw-r--r--src/device.c25
-rw-r--r--src/device.h3
3 files changed, 24 insertions, 25 deletions
diff --git a/src/dbus-hci.c b/src/dbus-hci.c
index 465f2bde..e480eb7e 100644
--- a/src/dbus-hci.c
+++ b/src/dbus-hci.c
@@ -547,26 +547,7 @@ void hcid_dbus_bonding_process_complete(bdaddr_t *local, bdaddr_t *peer,
/* If this is a new pairing send the appropriate signal for it
* and proceed with service discovery */
if (status == 0) {
- const char *dev_path;
- dbus_bool_t paired = TRUE;
-
- device_set_temporary(device, FALSE);
- dev_path = device_get_path(device);
-
- dbus_connection_emit_property_changed(connection, dev_path,
- DEVICE_INTERFACE, "Paired",
- DBUS_TYPE_BOOLEAN, &paired);
-
- /* If we were initiators start service discovery immediately.
- * However if the other end was the initator wait a few seconds
- * before SDP. This is due to potential IOP issues if the other
- * end starts doing SDP at the same time as us */
- if (bonding)
- device_browse(device, bonding->conn,
- bonding->msg, NULL);
- else
- device_schedule_service_discovery(device);
-
+ device_set_paired(connection, device, bonding);
return;
}
diff --git a/src/device.c b/src/device.c
index 82a90e05..00589006 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1271,14 +1271,31 @@ static gboolean start_discovery(gpointer user_data)
return FALSE;
}
-void device_schedule_service_discovery(struct btd_device *device)
+void device_set_paired(DBusConnection *conn, struct btd_device *device,
+ struct bonding_request_info *bonding)
{
+ dbus_bool_t paired = TRUE;
+
+ device_set_temporary(device, FALSE);
+
+ dbus_connection_emit_property_changed(conn, device->path,
+ DEVICE_INTERFACE, "Paired",
+ DBUS_TYPE_BOOLEAN, &paired);
+
if (device->discov_timer)
return;
- device->discov_timer = g_timeout_add(DISCOVERY_TIMER,
- start_discovery,
- device);
+ /* If we were initiators start service discovery immediately.
+ * However if the other end was the initator wait a few seconds
+ * before SDP. This is due to potential IOP issues if the other
+ * end starts doing SDP at the same time as us */
+ if (bonding)
+ device_browse(device, bonding->conn,
+ bonding->msg, NULL);
+ else
+ device->discov_timer = g_timeout_add(DISCOVERY_TIMER,
+ start_discovery,
+ device);
}
int btd_register_device_driver(struct btd_device_driver *driver)
diff --git a/src/device.h b/src/device.h
index af6a8755..099ecbbc 100644
--- a/src/device.h
+++ b/src/device.h
@@ -42,7 +42,8 @@ void device_set_temporary(struct btd_device *device, gboolean temporary);
void device_set_cap(struct btd_device *device, uint8_t cap);
void device_set_auth(struct btd_device *device, uint8_t auth);
uint8_t device_get_auth(struct btd_device *device);
-void device_schedule_service_discovery(struct btd_device *device);
+void device_set_paired(DBusConnection *conn, struct btd_device *device,
+ struct bonding_request_info *bonding);
void device_set_connected(DBusConnection *conn, struct btd_device *device,
gboolean connected);