diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2006-04-28 13:38:50 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2006-04-28 13:38:50 +0000 |
commit | fedb15c7679ca336a1e66826678679c8a59c1bec (patch) | |
tree | d7c2a61e10f7bf96bb11c4d80c124b6213ddda4f | |
parent | d69f92a7657292734448903024f4236a94874dd8 (diff) |
Remove get_dbus_connection() function
-rw-r--r-- | hcid/dbus-adapter.c | 20 | ||||
-rw-r--r-- | hcid/dbus-security.c | 15 | ||||
-rw-r--r-- | hcid/dbus.c | 10 | ||||
-rw-r--r-- | hcid/dbus.h | 4 |
4 files changed, 16 insertions, 33 deletions
diff --git a/hcid/dbus-adapter.c b/hcid/dbus-adapter.c index 49c8c526..1a57bf59 100644 --- a/hcid/dbus-adapter.c +++ b/hcid/dbus-adapter.c @@ -635,7 +635,6 @@ failed: static DBusHandlerResult handle_dev_set_minor_class_req(DBusConnection *conn, DBusMessage *msg, void *data) { struct hci_dbus_data *dbus_data = data; - DBusConnection *connection = get_dbus_connection(); DBusMessage *reply, *signal; DBusError err; bdaddr_t bdaddr; @@ -704,8 +703,8 @@ static DBusHandlerResult handle_dev_set_minor_class_req(DBusConnection *conn, DB DBUS_TYPE_STRING, &minor, DBUS_TYPE_INVALID); if (signal) { - dbus_connection_send(connection, signal, NULL); - dbus_connection_flush(connection); + dbus_connection_send(conn, signal, NULL); + dbus_connection_flush(conn); dbus_message_unref(signal); } @@ -1261,7 +1260,6 @@ static DBusHandlerResult handle_dev_get_remote_alias_req(DBusConnection *conn, D static DBusHandlerResult handle_dev_set_remote_alias_req(DBusConnection *conn, DBusMessage *msg, void *data) { struct hci_dbus_data *dbus_data = data; - DBusConnection *connection = get_dbus_connection(); DBusMessage *reply, *signal; DBusError err; char *str_ptr, *addr_ptr; @@ -1300,8 +1298,8 @@ static DBusHandlerResult handle_dev_set_remote_alias_req(DBusConnection *conn, D DBUS_TYPE_STRING, &str_ptr, DBUS_TYPE_INVALID); if (signal) { - dbus_connection_send(connection, signal, NULL); - dbus_connection_flush(connection); + dbus_connection_send(conn, signal, NULL); + dbus_connection_flush(conn); dbus_message_unref(signal); } @@ -1311,7 +1309,6 @@ static DBusHandlerResult handle_dev_set_remote_alias_req(DBusConnection *conn, D static DBusHandlerResult handle_dev_clear_remote_alias_req(DBusConnection *conn, DBusMessage *msg, void *data) { struct hci_dbus_data *dbus_data = data; - DBusConnection *connection = get_dbus_connection(); DBusMessage *reply, *signal; DBusError err; char *addr_ptr; @@ -1353,8 +1350,8 @@ static DBusHandlerResult handle_dev_clear_remote_alias_req(DBusConnection *conn, DBUS_TYPE_STRING, &addr_ptr, DBUS_TYPE_INVALID); if (signal) { - dbus_connection_send(connection, signal, NULL); - dbus_connection_flush(connection); + dbus_connection_send(conn, signal, NULL); + dbus_connection_flush(conn); dbus_message_unref(signal); } } @@ -1727,7 +1724,6 @@ static DBusHandlerResult handle_dev_remove_bonding_req(DBusConnection *conn, DBu { struct hci_dbus_data *dbus_data = data; struct slist *l; - DBusConnection *connection = get_dbus_connection(); DBusMessage *reply; DBusMessage *signal; DBusError err; @@ -1784,8 +1780,8 @@ static DBusHandlerResult handle_dev_remove_bonding_req(DBusConnection *conn, DBu DBUS_TYPE_STRING, &addr_ptr, DBUS_TYPE_INVALID); if (signal) { - dbus_connection_send(connection, signal, NULL); - dbus_connection_flush(connection); + dbus_connection_send(conn, signal, NULL); + dbus_connection_flush(conn); dbus_message_unref(signal); } diff --git a/hcid/dbus-security.c b/hcid/dbus-security.c index b69c9441..507a6475 100644 --- a/hcid/dbus-security.c +++ b/hcid/dbus-security.c @@ -397,12 +397,11 @@ done: dbus_pending_call_unref(call); } -static int call_passkey_agent(struct passkey_agent *agent, int dev, const char *path, - bdaddr_t *sba, bdaddr_t *dba) +static int call_passkey_agent(DBusConnection *conn, struct passkey_agent *agent, + int dev, const char *path, bdaddr_t *sba, bdaddr_t *dba) { DBusMessage *message = NULL; DBusPendingCall *pending = NULL; - DBusConnection *connection; struct pin_request *req; char bda[18]; char *ptr = bda; @@ -431,14 +430,12 @@ static int call_passkey_agent(struct passkey_agent *agent, int dev, const char * bacpy(&req->sba, sba); bacpy(&req->bda, dba); - connection = get_dbus_connection(); - dbus_message_append_args(message, DBUS_TYPE_STRING, &path, DBUS_TYPE_STRING, &ptr, DBUS_TYPE_INVALID); - if (dbus_connection_send_with_reply(connection, message, + if (dbus_connection_send_with_reply(conn, message, &pending, TIMEOUT) == FALSE) { error("D-Bus send failed"); goto failed; @@ -471,7 +468,7 @@ DBusHandlerResult handle_security_method(DBusConnection *conn, DBusMessage *msg, return error_unknown_method(conn, msg); } -int handle_passkey_request(int dev, const char *path, bdaddr_t *sba, bdaddr_t *dba) +int handle_passkey_request(DBusConnection *conn, int dev, const char *path, bdaddr_t *sba, bdaddr_t *dba) { struct passkey_agent *agent = default_agent; struct hci_dbus_data *adapter = NULL; @@ -479,7 +476,7 @@ int handle_passkey_request(int dev, const char *path, bdaddr_t *sba, bdaddr_t *d char addr[18]; void *data; - dbus_connection_get_object_path_data(get_dbus_connection(), path, &data); + dbus_connection_get_object_path_data(conn, path, &data); if (!data) goto done; @@ -499,5 +496,5 @@ int handle_passkey_request(int dev, const char *path, bdaddr_t *sba, bdaddr_t *d } done: - return call_passkey_agent(agent, dev, path, sba, dba); + return call_passkey_agent(conn, agent, dev, path, sba, dba); } diff --git a/hcid/dbus.c b/hcid/dbus.c index 2fb0f7e3..a6a4adf4 100644 --- a/hcid/dbus.c +++ b/hcid/dbus.c @@ -240,14 +240,6 @@ static DBusMessage *dbus_msg_new_authentication_return(DBusMessage *msg, uint8_t } } -/* - * Timeout functions Protypes - */ -DBusConnection *get_dbus_connection(void) -{ - return connection; -} - int get_default_dev_id(void) { return default_dev; @@ -571,7 +563,7 @@ void hcid_dbus_request_pin(int dev, bdaddr_t *sba, struct hci_conn_info *ci) snprintf(path, sizeof(path), "%s/hci%d", BASE_PATH, hci_devid(addr)); - handle_passkey_request(dev, path, sba, &ci->bdaddr); + handle_passkey_request(connection, dev, path, sba, &ci->bdaddr); } void hcid_dbus_bonding_process_complete(bdaddr_t *local, bdaddr_t *peer, const uint8_t status) diff --git a/hcid/dbus.h b/hcid/dbus.h index c56884f5..2c33cae9 100644 --- a/hcid/dbus.h +++ b/hcid/dbus.h @@ -135,8 +135,6 @@ DBusHandlerResult bluez_new_failure_msg(DBusConnection *conn, DBusMessage *msg, DBusMessage *dev_signal_factory(const int devid, const char *prop_name, const int first, ...); -DBusConnection *get_dbus_connection(void); - int get_default_dev_id(void); DBusHandlerResult error_failed(DBusConnection *conn, DBusMessage *msg, int err); @@ -182,7 +180,7 @@ DBusHandlerResult handle_sdp_method(DBusConnection *conn, DBusMessage *msg, void service_handler_func_t find_service_handler(struct service_data *services, DBusMessage *msg); -int handle_passkey_request(int dev, const char *path, bdaddr_t *sba, bdaddr_t *dba); +int handle_passkey_request(DBusConnection *conn, int dev, const char *path, bdaddr_t *sba, bdaddr_t *dba); static inline DBusHandlerResult send_reply_and_unref(DBusConnection *conn, DBusMessage *reply) { |