summaryrefslogtreecommitdiffstats
path: root/hcid
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2008-04-02 20:09:15 +0000
committerLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2008-04-02 20:09:15 +0000
commite4d81182fb08f0cdfad672d0e95b0aaf48eefa7c (patch)
tree7dd515ba9f1f53e23d0a0248466e75ae3f6903dc /hcid
parent0d753f3a8fd1de89f9f43a6bdb69068fd420d905 (diff)
Change last_mode to global_mode.
Diffstat (limited to 'hcid')
-rw-r--r--hcid/adapter.c17
-rw-r--r--hcid/adapter.h2
2 files changed, 10 insertions, 9 deletions
diff --git a/hcid/adapter.c b/hcid/adapter.c
index 1ca70276..9202b69c 100644
--- a/hcid/adapter.c
+++ b/hcid/adapter.c
@@ -700,9 +700,9 @@ static DBusHandlerResult adapter_set_mode(DBusConnection *conn,
if (!mode)
return error_invalid_arguments(conn, msg, NULL);
- adapter->last_mode = str2mode(adapter->address, mode);
+ adapter->global_mode = str2mode(adapter->address, mode);
- if (adapter->sessions && adapter->last_mode > adapter->mode) {
+ if (adapter->sessions && adapter->global_mode > adapter->mode) {
reply = dbus_message_new_method_return(msg);
if (!reply)
return DBUS_HANDLER_RESULT_NEED_MEMORY;
@@ -3459,9 +3459,9 @@ static DBusHandlerResult set_property(DBusConnection *conn,
return error_invalid_arguments(conn, msg, NULL);
dbus_message_iter_get_basic(&sub, &mode);
- adapter->last_mode = str2mode(adapter->address, mode);
+ adapter->global_mode = str2mode(adapter->address, mode);
- if (adapter->sessions && adapter->last_mode > adapter->mode) {
+ if (adapter->sessions && adapter->global_mode > adapter->mode) {
reply = dbus_message_new_method_return(msg);
if (!reply)
return DBUS_HANDLER_RESULT_NEED_MEMORY;
@@ -3483,11 +3483,12 @@ static void session_exit(const char *name, void *data)
adapter->sessions = g_slist_remove(adapter->sessions, req);
- if (!adapter->sessions)
- debug("Falling back to %d mode", mode2str(adapter->last_mode));
+ if (!adapter->sessions) {
+ debug("Falling back to %d mode", mode2str(adapter->global_mode));
/* FIXME: fallback to previous mode
- set_mode(req->conn, req->msg, adapter->last_mode, adapter);
+ set_mode(req->conn, req->msg, adapter->global_mode, adapter);
*/
+ }
dbus_connection_unref(req->conn);
dbus_message_unref(req->msg);
g_free(req);
@@ -3557,7 +3558,7 @@ static DBusHandlerResult request_mode(DBusConnection *conn,
(name_cb_t) session_exit, req);
if (!adapter->sessions)
- adapter->last_mode = adapter->mode;
+ adapter->global_mode = adapter->mode;
adapter->sessions = g_slist_append(adapter->sessions, req);
/* No need to change mode */
diff --git a/hcid/adapter.h b/hcid/adapter.h
index f520f718..9da56d3e 100644
--- a/hcid/adapter.h
+++ b/hcid/adapter.h
@@ -88,7 +88,7 @@ struct adapter {
uint32_t discov_timeout; /* discoverable time(msec) */
uint8_t scan_enable; /* scan mode: SCAN_DISABLED, SCAN_PAGE, SCAN_INQUIRY */
uint8_t mode; /* off, connectable, discoverable, limited */
- uint8_t last_mode; /* last mode changed */
+ uint8_t global_mode; /* last valid global mode */
uint8_t class[3]; /* device class */
int discov_active; /* standard discovery active: includes name resolution step */
int pdiscov_active; /* periodic discovery active */