summaryrefslogtreecommitdiff
path: root/android/bluetooth.c
diff options
context:
space:
mode:
authorSzymon Janc <szymon.janc@tieto.com>2015-03-05 12:43:03 +0100
committerSzymon Janc <szymon.janc@tieto.com>2015-03-05 16:58:49 +0100
commitfb865d80db38bdb9ac044c863ca8695c5be86bad (patch)
tree7739d183209b055bbfe030835a186a5ebe2cbd0a /android/bluetooth.c
parent0f40779ee29133a35f9d9f420bd1cdda426787f6 (diff)
downloadbluez-fb865d80db38bdb9ac044c863ca8695c5be86bad.tar.gz
android/bluetooth: Remove address type from BT callbacks
GATT code should always use bt_get_id_addr() when directly dealing with remote address. This is to make sure that proper address and type is used.
Diffstat (limited to 'android/bluetooth.c')
-rw-r--r--android/bluetooth.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/android/bluetooth.c b/android/bluetooth.c
index e684d3196..4d0cd48e6 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -887,7 +887,7 @@ static void send_paired_notification(void *data, void *user_data)
bt_paired_device_cb cb = data;
struct device *dev = user_data;
- cb(&dev->bdaddr, dev->bdaddr_type);
+ cb(&dev->bdaddr);
}
static void update_device_state(struct device *dev, uint8_t addr_type,
@@ -1946,8 +1946,7 @@ static void update_found_device(const bdaddr_t *bdaddr, uint8_t bdaddr_type,
/* Notify Gatt if its registered for LE events */
if (bdaddr_type != BDADDR_BREDR && gatt_device_found_cb) {
- bdaddr_t *addr;
- uint8_t addr_type;
+ const bdaddr_t *addr;
/*
* If RPA is set it means that IRK was received and ID address
@@ -1955,16 +1954,13 @@ static void update_found_device(const bdaddr_t *bdaddr, uint8_t bdaddr_type,
* it needs to be used also in GATT notifications. Also GATT
* HAL implementation is using RPA for devices matching.
*/
- if (bacmp(&dev->rpa, BDADDR_ANY)) {
+ if (bacmp(&dev->rpa, BDADDR_ANY))
addr = &dev->rpa;
- addr_type = dev->rpa_type;
- } else {
+ else
addr = &dev->bdaddr;
- addr_type = dev->bdaddr_type;
- }
- gatt_device_found_cb(addr, addr_type, rssi, data_len, data,
- connectable, dev->le_bonded);
+ gatt_device_found_cb(addr, rssi, data_len, data, connectable,
+ dev->le_bonded);
}
if (!dev->bredr_paired && !dev->le_paired)
@@ -4403,7 +4399,7 @@ static void send_unpaired_notification(void *data, void *user_data)
bt_unpaired_device_cb cb = data;
struct mgmt_addr_info *addr = user_data;
- cb(&addr->bdaddr, addr->type);
+ cb(&addr->bdaddr);
}
static void unpair_device_complete(uint8_t status, uint16_t length,
@@ -4425,7 +4421,9 @@ static void unpair_device_complete(uint8_t status, uint16_t length,
false, false);
/* Cast rp->addr to (void *) since queue_foreach don't take const */
- queue_foreach(unpaired_cb_list, send_unpaired_notification,
+
+ if (!dev->le_paired && !dev->bredr_paired)
+ queue_foreach(unpaired_cb_list, send_unpaired_notification,
(void *)&rp->addr);
}