diff options
| author | Johan Hedberg <johan.hedberg@nokia.com> | 2008-06-03 14:57:39 +0000 | 
|---|---|---|
| committer | Johan Hedberg <johan.hedberg@nokia.com> | 2008-06-03 14:57:39 +0000 | 
| commit | 8852bd0dc33d8737e27f41a3f3c43ca56e49116a (patch) | |
| tree | 2120c780b2a3d7a61c59d15e0be27a426af87f42 | |
| parent | c4d01c3cd114eccaa8ef79d8e082b345783ba9f1 (diff) | |
Add basic skeleton for tracking agent IO capability
| -rw-r--r-- | hcid/adapter.c | 25 | ||||
| -rw-r--r-- | hcid/agent.c | 3 | ||||
| -rw-r--r-- | hcid/agent.h | 1 | 
3 files changed, 19 insertions, 10 deletions
| diff --git a/hcid/adapter.c b/hcid/adapter.c index 1e23b10b..06082b92 100644 --- a/hcid/adapter.c +++ b/hcid/adapter.c @@ -275,7 +275,8 @@ static struct bonding_request_info *bonding_request_new(DBusConnection *conn,  							DBusMessage *msg,  							struct adapter *adapter,  							const char *address, -							const char *agent_path) +							const char *agent_path, +							const char *capability)  {  	struct bonding_request_info *bonding;  	struct device *device; @@ -285,11 +286,13 @@ static struct bonding_request_info *bonding_request_new(DBusConnection *conn,  		if (!device)  			return NULL; -		if (agent_path && strcmp(agent_path, "/")) +		if (agent_path)  			device->agent = agent_create(adapter, -				dbus_message_get_sender(msg), agent_path, -				NULL, (agent_remove_cb) device_agent_removed, -				device); +					dbus_message_get_sender(msg), +					agent_path, +					capability, NULL, +					(agent_remove_cb) device_agent_removed, +					device);  	}  	bonding = g_new0(struct bonding_request_info, 1); @@ -2660,7 +2663,7 @@ static void create_bond_req_exit(void *user_data)  static DBusMessage *create_bonding(DBusConnection *conn, DBusMessage *msg,  				const char *address, const char *agent_path, -				void *data) +				const char *capability, void *data)  {  	char filename[PATH_MAX + 1];  	char *str; @@ -2701,7 +2704,8 @@ static DBusMessage *create_bonding(DBusConnection *conn, DBusMessage *msg,  				ERROR_INTERFACE ".ConnectionAttemptFailed",  				"Connection attempt failed"); -	bonding = bonding_request_new(conn, msg, adapter, address, agent_path); +	bonding = bonding_request_new(conn, msg, adapter, address, agent_path, +					capability);  	if (!bonding) {  		close(sk);  		return NULL; @@ -2741,7 +2745,7 @@ static DBusHandlerResult adapter_create_bonding(DBusConnection *conn,  		return error_invalid_arguments(conn, msg, NULL);  	return send_message_and_unref(conn, -			create_bonding(conn, msg, address, NULL, data)); +			create_bonding(conn, msg, address, NULL, NULL, data));  }  static DBusHandlerResult adapter_cancel_bonding(DBusConnection *conn, @@ -3947,7 +3951,8 @@ static DBusMessage *create_paired_device(DBusConnection *conn,  	if (check_address(address) < 0)  		return invalid_args(msg); -	return create_bonding(conn, msg, address, agent_path, data); +	return create_bonding(conn, msg, address, agent_path, capability, +				data);  }  static gint device_path_cmp(struct device *device, const gchar *path) @@ -4036,7 +4041,7 @@ static DBusMessage *register_agent(DBusConnection *conn,  	name = dbus_message_get_sender(msg); -	agent = agent_create(adapter, name, path, NULL, +	agent = agent_create(adapter, name, path, NULL, capability,  				(agent_remove_cb) agent_removed, adapter);  	if (!agent)  		return g_dbus_create_error(msg, diff --git a/hcid/agent.c b/hcid/agent.c index 90df291a..57109603 100644 --- a/hcid/agent.c +++ b/hcid/agent.c @@ -66,6 +66,7 @@ struct agent {  	char *addr;  	char *name;  	char *path; +	char *capability;  	struct agent_request *request;  	int exited;  	guint timeout; @@ -201,6 +202,7 @@ static gboolean agent_timeout(struct agent *agent)  struct agent *agent_create(struct adapter *adapter, const char *name,  				const char *path, const char *address, +				const char *capability,  				agent_remove_cb cb, void *remove_cb_data)  {  	struct agent *agent; @@ -213,6 +215,7 @@ struct agent *agent_create(struct adapter *adapter, const char *name,  	agent->adapter = adapter;  	agent->name = g_strdup(name);  	agent->path = g_strdup(path); +	agent->capability = g_strdup(capability);  	agent->remove_cb = cb;  	agent->remove_cb_data = remove_cb_data; diff --git a/hcid/agent.h b/hcid/agent.h index 31a95428..ad648178 100644 --- a/hcid/agent.h +++ b/hcid/agent.h @@ -34,6 +34,7 @@ typedef void (*agent_remove_cb) (struct agent *agent, void *user_data);  struct agent *agent_create(struct adapter *adapter, const char *name,  				const char *path, const char *address, +				const char *capability,  				agent_remove_cb cb, void *remove_cb_data);  int agent_destroy(struct agent *agent, gboolean exited); | 
