prasad-alatkar commented on a change in pull request #540: nimble/host: Add 
support to accept or reject pairing request through GAP event
URL: https://github.com/apache/mynewt-nimble/pull/540#discussion_r375678248
 
 

 ##########
 File path: nimble/host/src/ble_gap.c
 ##########
 @@ -5309,6 +5309,29 @@ ble_gap_identity_event(uint16_t conn_handle)
     ble_gap_call_conn_event_cb(&event, conn_handle);
 }
 
+int
+ble_gap_pairing_req_event(const struct ble_gap_pairing_req *req)
+{
+#if !NIMBLE_BLE_SM
+    return 0;
+#endif
+
+    struct ble_gap_event event;
+    int rc;
+
+    memset(&event, 0, sizeof event);
+    event.type = BLE_GAP_EVENT_PAIRING_REQUEST;
+    event.pairing_req.io_cap = req->io_cap;
+    event.pairing_req.oob_data_flag = req->oob_data_flag;
+    event.pairing_req.authreq = req->authreq;
+    event.pairing_req.max_enc_key_size = req->max_enc_key_size;
+    event.pairing_req.init_key_dist = req->init_key_dist;
+    event.pairing_req.resp_key_dist = req->resp_key_dist;
+
+    rc = ble_gap_call_conn_event_cb(&event, req->conn_handle);
 
 Review comment:
   Hi @andrzej-kaczmarek , apologies for not actively working on this PR. If I 
understand correctly, the application should accept/reject the pairing request 
using API `ble_sm_inject_io`, I have made changes to this PR according to this 
assumptions. Please take a look. 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to