From c12323a5946a4d49c1197f5c7ac14cd22efbc2b6 Mon Sep 17 00:00:00 2001 From: Grzegorz Kolodziejczyk Date: Mon, 12 May 2014 16:38:12 +0200 Subject: [PATCH] android/bluetooth: Add function for checking device bond state This will be used by GATT HAL. --- android/bluetooth.c | 8 ++++++++ android/bluetooth.h | 1 + 2 files changed, 9 insertions(+) diff --git a/android/bluetooth.c b/android/bluetooth.c index 2a7c0e641..7a203af87 100644 --- a/android/bluetooth.c +++ b/android/bluetooth.c @@ -1218,6 +1218,14 @@ const char *bt_get_adapter_name(void) return adapter.name; } +bool bt_device_is_bonded(const bdaddr_t *bdaddr) +{ + if (g_slist_find_custom(bonded_devices, bdaddr, device_match)) + return true; + + return false; +} + static bool rssi_above_threshold(int old, int new) { /* only 8 dBm or more */ diff --git a/android/bluetooth.h b/android/bluetooth.h index dddbf201f..3eef7a428 100644 --- a/android/bluetooth.h +++ b/android/bluetooth.h @@ -49,3 +49,4 @@ bool bt_le_set_advertising(bool advertising, bt_le_set_advertising_done cb, uint8_t bt_get_device_android_type(const bdaddr_t *addr); const char *bt_get_adapter_name(void); +bool bt_device_is_bonded(const bdaddr_t *bdaddr); -- 2.47.3