rymanluk commented on a change in pull request #1024:
URL: https://github.com/apache/mynewt-nimble/pull/1024#discussion_r741951023



##########
File path: apps/bttester/src/gap.c
##########
@@ -1301,6 +1301,37 @@ static void pair(const uint8_t *data, uint16_t len)
        tester_rsp(BTP_SERVICE_ID_GAP, GAP_PAIR, CONTROLLER_INDEX, status);
 }
 
+static void force_pair(const uint8_t *data, uint16_t len)
+{
+    /**
+     * This method is used to force pairing instead of giving the option
+     * of automatically choosing pairing or encryption by 
ble_gap_security_initiate()
+     */
+    struct ble_gap_conn_desc desc;
+    uint8_t status;
+    int rc;
+
+    SYS_LOG_DBG("");
+
+    rc = gap_conn_find_by_addr((ble_addr_t *)data, &desc);
+    if (rc) {
+        status = BTP_STATUS_FAILED;
+        goto rsp;
+    }
+
+    rc = ble_gap_pair_initiate(desc.conn_handle);
+    SYS_LOG_DBG("ble_gap_pair_initiate finished with rc=%d", rc);
+    if (rc) {
+        status = BTP_STATUS_FAILED;
+        goto rsp;
+    }
+
+    status = BTP_STATUS_SUCCESS;
+
+    rsp:

Review comment:
       indentation issue.

##########
File path: apps/bttester/src/gap.c
##########
@@ -1608,6 +1639,9 @@ void tester_handle_gap(uint8_t opcode, uint8_t index, 
uint8_t *data,
        case GAP_PAIR:
                pair(data, len);
                return;
+    case GAP_FORCE_PAIR:
+        force_pair(data, len);

Review comment:
       indentation issue?

##########
File path: apps/bttester/src/gap.c
##########
@@ -1301,6 +1301,37 @@ static void pair(const uint8_t *data, uint16_t len)
        tester_rsp(BTP_SERVICE_ID_GAP, GAP_PAIR, CONTROLLER_INDEX, status);
 }
 
+static void force_pair(const uint8_t *data, uint16_t len)
+{
+    /**
+     * This method is used to force pairing instead of giving the option
+     * of automatically choosing pairing or encryption by 
ble_gap_security_initiate()
+     */
+    struct ble_gap_conn_desc desc;
+    uint8_t status;
+    int rc;
+
+    SYS_LOG_DBG("");
+
+    rc = gap_conn_find_by_addr((ble_addr_t *)data, &desc);
+    if (rc) {
+        status = BTP_STATUS_FAILED;
+        goto rsp;
+    }
+
+    rc = ble_gap_pair_initiate(desc.conn_handle);
+    SYS_LOG_DBG("ble_gap_pair_initiate finished with rc=%d", rc);
+    if (rc) {
+        status = BTP_STATUS_FAILED;
+        goto rsp;
+    }
+
+    status = BTP_STATUS_SUCCESS;
+
+    rsp:

Review comment:
       indentation issue.

##########
File path: apps/bttester/src/gap.c
##########
@@ -1608,6 +1639,9 @@ void tester_handle_gap(uint8_t opcode, uint8_t index, 
uint8_t *data,
        case GAP_PAIR:
                pair(data, len);
                return;
+    case GAP_FORCE_PAIR:
+        force_pair(data, len);

Review comment:
       indentation issue?




-- 
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: commits-unsubscr...@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to