diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2008-11-29 16:44:01 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2008-11-29 16:44:01 +0200 |
commit | 860fe82a855d1ec9705f733f637d2af7277b1294 (patch) | |
tree | 9b05aa2599d1757e69b79a031447cc4744964886 /src/adapter.c | |
parent | 0d97d1961ece9c6fb7bf76f60562e9cbb19ee64c (diff) |
RequestMode end result should depend on the Discoverable property
Diffstat (limited to 'src/adapter.c')
-rw-r--r-- | src/adapter.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/adapter.c b/src/adapter.c index fb577d89..c9970d3d 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -1899,6 +1899,7 @@ static DBusMessage *request_session(DBusConnection *conn, { struct btd_adapter *adapter = data; struct session_req *req; + uint8_t new_mode; int ret; if (!adapter->agent) @@ -1908,14 +1909,16 @@ static DBusMessage *request_session(DBusConnection *conn, if (!adapter->mode_sessions) adapter->global_mode = adapter->mode; + new_mode = get_mode(&adapter->bdaddr, "on"); + req = find_session(adapter->mode_sessions, msg); if (!req) { - req = create_session(adapter, conn, msg, MODE_CONNECTABLE, + req = create_session(adapter, conn, msg, new_mode, session_owner_exit); adapter->mode_sessions = g_slist_append(adapter->mode_sessions, req); } else { - req->mode = MODE_CONNECTABLE; + req->mode = new_mode; adapter->mode_sessions = g_slist_append(adapter->mode_sessions, req); session_remove(req); @@ -1923,10 +1926,10 @@ static DBusMessage *request_session(DBusConnection *conn, } /* No need to change mode */ - if (adapter->mode >= MODE_CONNECTABLE) + if (adapter->mode >= new_mode) return dbus_message_new_method_return(msg); - ret = agent_confirm_mode_change(adapter->agent, "connectable", + ret = agent_confirm_mode_change(adapter->agent, mode2str(new_mode), confirm_mode_cb, req); if (ret < 0) { session_unref(req); |