Repository: incubator-mynewt-larva
Updated Branches:
  refs/heads/master 04c5cff1a -> 6f814264c


If there is no connection handle and a read RSSI command is sent, return the 
handle and 127 for rssi (which is the number used by the specification to 
denote the fact that we dont know the RSSI for the connection)


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

Branch: refs/heads/master
Commit: 6f814264c2b09a0c375976cb6bcbda9ef0f6131d
Parents: 04c5cff
Author: wes3 <w...@micosa.io>
Authored: Fri Feb 12 13:44:21 2016 -0800
Committer: wes3 <w...@micosa.io>
Committed: Fri Feb 12 13:44:27 2016 -0800

----------------------------------------------------------------------
 net/nimble/controller/src/ble_ll_conn_hci.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/6f814264/net/nimble/controller/src/ble_ll_conn_hci.c
----------------------------------------------------------------------
diff --git a/net/nimble/controller/src/ble_ll_conn_hci.c 
b/net/nimble/controller/src/ble_ll_conn_hci.c
index df2f4f9..2ded499 100644
--- a/net/nimble/controller/src/ble_ll_conn_hci.c
+++ b/net/nimble/controller/src/ble_ll_conn_hci.c
@@ -765,20 +765,26 @@ ble_ll_conn_hci_rd_rem_ver_cmd(uint8_t *cmdbuf)
 int
 ble_ll_conn_hci_rd_rssi(uint8_t *cmdbuf, uint8_t *rspbuf, uint8_t *rsplen)
 {
+    int rc;
+    int8_t rssi;
     uint16_t handle;
     struct ble_ll_conn_sm *connsm;
 
     handle = le16toh(cmdbuf);
     connsm = ble_ll_conn_find_active_conn(handle);
     if (!connsm) {
-        return BLE_ERR_UNK_CONN_ID;
+        rssi = 127;
+        rc = BLE_ERR_UNK_CONN_ID;
+    } else {
+        rssi = connsm->conn_rssi;
+        rc = BLE_ERR_SUCCESS;
     }
 
     htole16(rspbuf, handle);
-    rspbuf[2] = connsm->conn_rssi;
+    rspbuf[2] = (uint8_t)rssi;
     *rsplen = 3;
 
     /* Place the RSSI of the connection into the response buffer */
-    return BLE_ERR_SUCCESS;
+    return rc;
 }
 

Reply via email to