summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVinicius Costa Gomes <vinicius.gomes@openbossa.org>2012-01-31 14:10:48 -0300
committerJohan Hedberg <johan.hedberg@intel.com>2012-01-31 09:32:16 -0800
commit467bb33ff7253887cdb12e9ae7e0df2d7f819474 (patch)
tree78b4d856f624d28e77968dcedda1d8d7dc434075 /src
parenteeff5f200d55726d6f12828addd34ca426fd3fa0 (diff)
downloadbluez-467bb33ff7253887cdb12e9ae7e0df2d7f819474.tar.gz
event: Add type information to the mgmt "Device Connected" event
In the case of incomming connections we have to know the type of the device that connected to us. Through hciops we have the LE Connection Complete event, that information was lost when Management interface was being used.
Diffstat (limited to 'src')
-rw-r--r--src/device.c8
-rw-r--r--src/device.h1
-rw-r--r--src/event.c4
-rw-r--r--src/event.h2
4 files changed, 13 insertions, 2 deletions
diff --git a/src/device.c b/src/device.c
index c19acd4b5..d39ca530a 100644
--- a/src/device.c
+++ b/src/device.c
@@ -2005,6 +2005,14 @@ void device_get_address(struct btd_device *device, bdaddr_t *bdaddr,
*type = device->type;
}
+void device_set_addr_type(struct btd_device *device, addr_type_t type)
+{
+ if (device == NULL)
+ return;
+
+ device->type = type;
+}
+
const gchar *device_get_path(struct btd_device *device)
{
if (!device)
diff --git a/src/device.h b/src/device.h
index 13005ae06..7cb9bb22f 100644
--- a/src/device.h
+++ b/src/device.h
@@ -59,6 +59,7 @@ void btd_device_add_uuid(struct btd_device *device, const char *uuid);
struct btd_adapter *device_get_adapter(struct btd_device *device);
void device_get_address(struct btd_device *device, bdaddr_t *bdaddr,
addr_type_t *type);
+void device_set_addr_type(struct btd_device *device, addr_type_t type);
const gchar *device_get_path(struct btd_device *device);
struct agent *device_get_agent(struct btd_device *device);
gboolean device_is_bredr(struct btd_device *device);
diff --git a/src/event.c b/src/event.c
index 0783b4773..ff1896aee 100644
--- a/src/event.c
+++ b/src/event.c
@@ -442,7 +442,7 @@ int btd_event_ltk_notify(bdaddr_t *local, bdaddr_t *peer, addr_type_t addr_type,
return ret;
}
-void btd_event_conn_complete(bdaddr_t *local, bdaddr_t *peer,
+void btd_event_conn_complete(bdaddr_t *local, bdaddr_t *peer, addr_type_t type,
char *name, uint8_t *dev_class)
{
struct btd_adapter *adapter;
@@ -453,6 +453,8 @@ void btd_event_conn_complete(bdaddr_t *local, bdaddr_t *peer,
update_lastused(local, peer);
+ device_set_addr_type(device, type);
+
adapter_add_connection(adapter, device);
if (name != NULL)
diff --git a/src/event.h b/src/event.h
index ccdd47c0f..c09350d73 100644
--- a/src/event.h
+++ b/src/event.h
@@ -29,7 +29,7 @@ void btd_event_device_found(bdaddr_t *local, bdaddr_t *peer, addr_type_t type,
void btd_event_set_legacy_pairing(bdaddr_t *local, bdaddr_t *peer, gboolean legacy);
void btd_event_remote_class(bdaddr_t *local, bdaddr_t *peer, uint32_t class);
void btd_event_remote_name(bdaddr_t *local, bdaddr_t *peer, char *name);
-void btd_event_conn_complete(bdaddr_t *local, bdaddr_t *peer,
+void btd_event_conn_complete(bdaddr_t *local, bdaddr_t *peer, addr_type_t type,
char *name, uint8_t *dev_class);
void btd_event_conn_failed(bdaddr_t *local, bdaddr_t *peer, uint8_t status);
void btd_event_disconn_complete(bdaddr_t *local, bdaddr_t *peer);