From 28e71a1283c0778e2359d6b25f2d00fa7028b07e Mon Sep 17 00:00:00 2001 From: Marcin Kraglak Date: Wed, 30 Jul 2014 11:38:47 +0200 Subject: [PATCH] android/gatt: Expose API to elevate security level It will allow to change security from external profile, for example in hog implementation. --- android/gatt.c | 11 +++++++++++ android/gatt.h | 1 + 2 files changed, 12 insertions(+) diff --git a/android/gatt.c b/android/gatt.c index 31558d056..49ca2b659 100644 --- a/android/gatt.c +++ b/android/gatt.c @@ -2860,6 +2860,17 @@ static bool set_security(struct gatt_device *device, int req_sec_level) return true; } +bool bt_gatt_set_security(const bdaddr_t *bdaddr, int sec_level) +{ + struct gatt_device *device; + + device = find_device_by_addr(bdaddr); + if (!device) + return false; + + return set_security(device, sec_level); +} + static bool set_auth_type(struct gatt_device *device, int auth_type) { int sec_level; diff --git a/android/gatt.h b/android/gatt.h index 5ba91610a..027dda3c5 100644 --- a/android/gatt.h +++ b/android/gatt.h @@ -38,3 +38,4 @@ bool bt_gatt_unregister_app(unsigned int id); bool bt_gatt_connect_app(unsigned int id, const bdaddr_t *addr); bool bt_gatt_disconnect_app(unsigned int id, const bdaddr_t *addr); +bool bt_gatt_set_security(const bdaddr_t *bdaddr, int sec_level); -- 2.47.3