From 16acdf1bbbcedf36d8cafcf9550184eb4b78a8d1 Mon Sep 17 00:00:00 2001 From: SumeetSingh19 Date: Thu, 18 Jan 2024 17:07:05 +0530 Subject: [PATCH] feat(nimble): authorization permission on gatt read and write --- components/bt/host/nimble/nimble | 2 +- examples/bluetooth/nimble/bleprph/main/main.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/components/bt/host/nimble/nimble b/components/bt/host/nimble/nimble index f9adf083d8..8c93324990 160000 --- a/components/bt/host/nimble/nimble +++ b/components/bt/host/nimble/nimble @@ -1 +1 @@ -Subproject commit f9adf083d8d3c81c86ae1094d0d4450862fa4b04 +Subproject commit 8c93324990e26af4ae7f80118adf895dd1b0e3e5 diff --git a/examples/bluetooth/nimble/bleprph/main/main.c b/examples/bluetooth/nimble/bleprph/main/main.c index e91811dce0..d86364c41c 100644 --- a/examples/bluetooth/nimble/bleprph/main/main.c +++ b/examples/bluetooth/nimble/bleprph/main/main.c @@ -393,6 +393,16 @@ bleprph_gap_event(struct ble_gap_event *event, void *arg) } return 0; + case BLE_GAP_EVENT_AUTHORIZE: + MODLOG_DFLT(INFO, "authorize event: conn_handle=%d attr_handle=%d is_read=%d", + event->authorize.conn_handle, + event->authorize.attr_handle, + event->authorize.is_read); + + /* The default behaviour for the event is to reject authorize request */ + event->authorize.out_response = BLE_GAP_AUTHORIZE_REJECT; + return 0; + #if MYNEWT_VAL(BLE_POWER_CONTROL) case BLE_GAP_EVENT_TRANSMIT_POWER: MODLOG_DFLT(INFO, "Transmit power event : status=%d conn_handle=%d reason=%d "