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/08 21:20:26 UTC

[39/50] [abbrv] incubator-mynewt-core git commit: BLE Host - Report HCI error code on terminate.

BLE Host - Report HCI error code on terminate.

The host reports a disconnect event via the BLE_GAP_EVENT_DISCONNECT
event code.

Prior to this change: locally-terminated connections were reported with
a status code of BLE_HS_ENOTCONN.

Now: locally-terminated connections are reported with a status code of
BLE_HS_HCI_ERR(BLE_ERR_CONN_TERM_LOCAL).


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/baee9cd0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/baee9cd0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/baee9cd0

Branch: refs/heads/master
Commit: baee9cd0593d32bacf919aea51527d1859cdfa52
Parents: 55c2e6e
Author: Christopher Collins <cc...@apache.org>
Authored: Thu Jun 30 16:30:04 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Thu Jun 30 16:30:04 2016 -0700

----------------------------------------------------------------------
 net/nimble/host/src/ble_gap.c           | 9 +--------
 net/nimble/host/src/test/ble_gap_test.c | 3 ++-
 2 files changed, 3 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/baee9cd0/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 50b1df6..309b7cf 100644
--- a/net/nimble/host/src/ble_gap.c
+++ b/net/nimble/host/src/ble_gap.c
@@ -625,14 +625,7 @@ ble_gap_rx_disconn_complete(struct hci_disconn_complete *evt)
     }
 
     if (evt->status == 0) {
-        if (evt->reason == BLE_ERR_CONN_TERM_LOCAL) {
-            /* Don't confuse the application with an HCI error code in the
-             * success case.
-             */
-            status = BLE_HS_ENOTCONN;
-        } else {
-            status = BLE_HS_HCI_ERR(evt->reason);
-        }
+        status = BLE_HS_HCI_ERR(evt->reason);
         ble_gap_conn_broken(&snap, status);
     } else {
         memset(&ctxt, 0, sizeof ctxt);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/baee9cd0/net/nimble/host/src/test/ble_gap_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_gap_test.c b/net/nimble/host/src/test/ble_gap_test.c
index 7868f2a..fcaba40 100644
--- a/net/nimble/host/src/test/ble_gap_test.c
+++ b/net/nimble/host/src/test/ble_gap_test.c
@@ -907,7 +907,8 @@ TEST_CASE(ble_gap_test_case_conn_terminate_good)
     ble_gap_test_util_terminate(peer_addr, 0);
 
     TEST_ASSERT(ble_gap_test_conn_event == BLE_GAP_EVENT_DISCONNECT);
-    TEST_ASSERT(ble_gap_test_conn_status == BLE_HS_ENOTCONN);
+    TEST_ASSERT(ble_gap_test_conn_status ==
+                BLE_HS_HCI_ERR(BLE_ERR_CONN_TERM_LOCAL));
     TEST_ASSERT(ble_gap_test_conn_desc.conn_handle == 2);
     TEST_ASSERT(ble_gap_test_conn_desc.peer_id_addr_type == BLE_ADDR_TYPE_PUBLIC);
     TEST_ASSERT(memcmp(ble_gap_test_conn_desc.peer_id_addr, peer_addr, 6) == 0);