summaryrefslogtreecommitdiffstats
path: root/src/adapter.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@indt.org.br>2008-09-03 19:31:10 -0300
committerLuiz Augusto von Dentz <luiz.dentz@indt.org.br>2008-09-04 10:05:58 -0300
commit531fe8fae7f46a86ec850748ffd44ffa754014bd (patch)
treef69173c150ad7e061b0477bdea5a283f1865254c /src/adapter.c
parent01761bea1ce6539b97640123660c67d81c54318b (diff)
Rename DiscoverDevices to StartDiscovery, CancelDiscovery to StopDiscovery and fix logic around Discovering property to reflect when the base band is busy.
Diffstat (limited to 'src/adapter.c')
-rw-r--r--src/adapter.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/adapter.c b/src/adapter.c
index 36cac369..4f30bbfb 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1413,7 +1413,7 @@ static int start_periodic_inquiry(struct btd_adapter *adapter)
return 0;
}
-static DBusMessage *adapter_discover_devices(DBusConnection *conn,
+static DBusMessage *adapter_start_discovery(DBusConnection *conn,
DBusMessage *msg, void *data)
{
struct session_req *req;
@@ -1450,7 +1450,7 @@ done:
return dbus_message_new_method_return(msg);
}
-static DBusMessage *adapter_cancel_discovery(DBusConnection *conn,
+static DBusMessage *adapter_stop_discovery(DBusConnection *conn,
DBusMessage *msg, void *data)
{
struct btd_adapter *adapter = data;
@@ -1973,8 +1973,8 @@ static GDBusMethodTable adapter_methods[] = {
{ "RequestMode", "s", "", request_mode,
G_DBUS_METHOD_FLAG_ASYNC},
{ "ReleaseMode", "", "", release_mode },
- { "DiscoverDevices", "", "", adapter_discover_devices},
- { "CancelDiscovery", "", "", adapter_cancel_discovery,
+ { "StartDiscovery", "", "", adapter_start_discovery },
+ { "StopDiscovery", "", "", adapter_stop_discovery,
G_DBUS_METHOD_FLAG_ASYNC},
{ "ListDevices", "", "ao", list_devices },
{ "CreateDevice", "s", "o", create_device,
@@ -2777,15 +2777,11 @@ void adapter_set_state(struct btd_adapter *adapter, int state)
if (adapter->state == state)
return;
- if (state & PERIODIC_INQUIRY || state & STD_INQUIRY) {
+ if (state & PERIODIC_INQUIRY || state & STD_INQUIRY)
discov_active = TRUE;
- if (adapter->scheduler_id)
- goto done;
- } else if (adapter->disc_sessions && adapter->state & STD_INQUIRY) {
+ else if (adapter->disc_sessions && main_opts.inqmode)
adapter->scheduler_id = g_timeout_add(main_opts.inqmode * 1000,
(GSourceFunc) start_inquiry, adapter);
- goto done;
- }
if (!discov_active && adapter->found_devices) {
g_slist_foreach(adapter->found_devices, (GFunc) g_free, NULL);
@@ -2803,7 +2799,6 @@ void adapter_set_state(struct btd_adapter *adapter, int state)
ADAPTER_INTERFACE, "Discovering",
DBUS_TYPE_BOOLEAN, &discov_active);
-done:
adapter->state = state;
}