andrzej-kaczmarek commented on code in PR #1668:
URL: https://github.com/apache/mynewt-nimble/pull/1668#discussion_r1438254833


##########
nimble/host/include/host/ble_gap.h:
##########
@@ -292,6 +295,19 @@ struct hci_conn_update;
 
 /** @} */
 
+/**
+ * @defgroup GAP Authorize event possible responses.
+ * @{
+ */
+
+/** GAP Authorize event response: accept */
+#define BLE_GAP_AUTHORIZE_ACCEPT            1
+
+/** GAP Authorize event response: reject */
+#define BLE_GAP_AUTHORIZE_REJECT            2

Review Comment:
   authorization can be done using return value from event callback



##########
nimble/host/src/ble_gap.c:
##########
@@ -6521,6 +6521,33 @@ ble_gap_unhandled_hci_event(bool is_le_meta, bool is_vs, 
const void *buf,
 }
 #endif
 
+int
+ble_gap_authorize_event(uint16_t conn_handle, uint16_t attr_handle,
+                        int is_read)
+{
+#if MYNEWT_VAL(BLE_ROLE_PERIPHERAL)
+    struct ble_gap_event event;
+
+    memset(&event, 0, sizeof event);
+    event.type = BLE_GAP_EVENT_AUTHORIZE;
+    event.authorize.conn_handle = conn_handle;
+    event.authorize.attr_handle = attr_handle;
+    event.authorize.is_read = is_read;
+
+    ble_gap_event_listener_call(&event);

Review Comment:
   only connection owner should be able to authorize so this should not be 
dispatched to listeners



##########
nimble/host/src/ble_gap.c:
##########
@@ -6458,7 +6458,7 @@ ble_gap_subscribe_event(uint16_t conn_handle, uint16_t 
attr_handle,
                         uint8_t prev_notify, uint8_t cur_notify,
                         uint8_t prev_indicate, uint8_t cur_indicate)
 {
-#if NIMBLE_BLE_CONNECT
+#if MYNEWT_VAL(BLE_ROLE_PERIPHERAL)

Review Comment:
   not related



##########
nimble/host/include/host/ble_gap.h:
##########
@@ -258,6 +258,9 @@ struct hci_conn_update;
 /** GAP event: BIG (Broadcast Isochronous Group) information report */
 #define BLE_GAP_EVENT_BIGINFO_REPORT        30
 
+/** GAP event: Authorization request for GATT operations */
+#define BLE_GAP_EVENT_AUTHORIZE             30

Review Comment:
   duplicated id



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to