andrzej-kaczmarek 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_r308124510
 
 

 ##########
 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:
   you want to solve one scenario here, however if you let application to 
accept just works pairing, the application does not need to decide whether to 
accept just works pairing on its own - it may display ui for user to accept it 
and this would block. for this reason it should be handled in similar way as 
other pairing methods that require user input. for this we probably would need 
to rework pairing API a bit, not yet sure.

----------------------------------------------------------------
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