You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/07/13 20:55:37 UTC

[24/50] [abbrv] incubator-mynewt-core git commit: BLE Host - Allow HCI reason in ble_gap_terminate()

BLE Host - Allow HCI reason in ble_gap_terminate()


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/f962497b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/f962497b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/f962497b

Branch: refs/heads/develop
Commit: f962497bd82556987e33731f228a7437427db07f
Parents: 3757089
Author: Christopher Collins <cc...@apache.org>
Authored: Thu Jun 30 11:32:10 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Mon Jul 11 16:43:33 2016 -0700

----------------------------------------------------------------------
 net/nimble/host/include/host/ble_gap.h      | 2 +-
 net/nimble/host/src/ble_gap.c               | 7 ++++---
 net/nimble/host/src/ble_gattc.c             | 2 +-
 net/nimble/host/src/ble_l2cap_sig.c         | 2 +-
 net/nimble/host/src/test/ble_hs_test_util.c | 2 +-
 5 files changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f962497b/net/nimble/host/include/host/ble_gap.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/include/host/ble_gap.h b/net/nimble/host/include/host/ble_gap.h
index 9b114cf..c0dc278 100644
--- a/net/nimble/host/include/host/ble_gap.h
+++ b/net/nimble/host/include/host/ble_gap.h
@@ -312,7 +312,7 @@ int ble_gap_connect(uint8_t own_addr_type,
                     ble_gap_event_fn *cb, void *cb_arg);
 int ble_gap_conn_cancel(void);
 int ble_gap_conn_active(void);
-int ble_gap_terminate(uint16_t handle);
+int ble_gap_terminate(uint16_t conn_handle, uint8_t hci_reason);
 int ble_gap_wl_set(const struct ble_gap_white_entry *white_list,
                    uint8_t white_list_count);
 int ble_gap_update_params(uint16_t conn_handle,

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f962497b/net/nimble/host/src/ble_gap.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_gap.c b/net/nimble/host/src/ble_gap.c
index d784ff5..c3df545 100644
--- a/net/nimble/host/src/ble_gap.c
+++ b/net/nimble/host/src/ble_gap.c
@@ -2148,7 +2148,7 @@ ble_gap_conn_active(void)
  *****************************************************************************/
 
 int
-ble_gap_terminate(uint16_t conn_handle)
+ble_gap_terminate(uint16_t conn_handle, uint8_t hci_reason)
 {
     uint8_t buf[BLE_HCI_CMD_HDR_LEN + BLE_HCI_DISCONNECT_CMD_LEN];
     int rc;
@@ -2163,9 +2163,10 @@ ble_gap_terminate(uint16_t conn_handle)
     }
 
     BLE_HS_LOG(INFO, "GAP procedure initiated: terminate connection; "
-                     "conn_handle=%d\n", conn_handle);
+                     "conn_handle=%d hci_reason=%d\n",
+               conn_handle, hci_reason);
 
-    host_hci_cmd_build_disconnect(conn_handle, BLE_ERR_REM_USER_CONN_TERM,
+    host_hci_cmd_build_disconnect(conn_handle, hci_reason,
                                   buf, sizeof buf);
     rc = ble_hci_cmd_tx_empty_ack(buf);
     if (rc != 0) {

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f962497b/net/nimble/host/src/ble_gattc.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_gattc.c b/net/nimble/host/src/ble_gattc.c
index 7ff37aa..929c878 100644
--- a/net/nimble/host/src/ble_gattc.c
+++ b/net/nimble/host/src/ble_gattc.c
@@ -869,7 +869,7 @@ ble_gattc_heartbeat(void)
     /* Terminate the connection associated with each timed-out procedure. */
     while ((proc = STAILQ_FIRST(&exp_list)) != NULL) {
         STATS_INC(ble_gattc_stats, proc_timeout);
-        ble_gap_terminate(proc->conn_handle);
+        ble_gap_terminate(proc->conn_handle, BLE_ERR_REM_USER_CONN_TERM);
 
         STAILQ_REMOVE_HEAD(&exp_list, next);
         ble_gattc_proc_free(proc);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f962497b/net/nimble/host/src/ble_l2cap_sig.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap_sig.c b/net/nimble/host/src/ble_l2cap_sig.c
index 9630a15..e75f06f 100644
--- a/net/nimble/host/src/ble_l2cap_sig.c
+++ b/net/nimble/host/src/ble_l2cap_sig.c
@@ -596,7 +596,7 @@ ble_l2cap_sig_heartbeat(void)
     /* Terminate the connection associated with each timed-out procedure. */
     STAILQ_FOREACH(proc, &temp_list, next) {
         STATS_INC(ble_l2cap_stats, proc_timeout);
-        ble_gap_terminate(proc->conn_handle);
+        ble_gap_terminate(proc->conn_handle, BLE_ERR_REM_USER_CONN_TERM);
     }
 
     return BLE_HS_FOREVER;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f962497b/net/nimble/host/src/test/ble_hs_test_util.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_hs_test_util.c b/net/nimble/host/src/test/ble_hs_test_util.c
index 1a08801..e2040ae 100644
--- a/net/nimble/host/src/test/ble_hs_test_util.c
+++ b/net/nimble/host/src/test/ble_hs_test_util.c
@@ -407,7 +407,7 @@ ble_hs_test_util_conn_terminate(uint16_t conn_handle, uint8_t hci_status)
                              BLE_HCI_OCF_DISCONNECT_CMD),
         hci_status);
 
-    rc = ble_gap_terminate(conn_handle);
+    rc = ble_gap_terminate(conn_handle, BLE_ERR_REM_USER_CONN_TERM);
     return rc;
 }