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/03 02:30:04 UTC

[1/2] incubator-mynewt-core git commit: BLE Host - Fix read-rssi bug.

Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop bcfe3fd05 -> dda1c9a99


BLE Host - Fix read-rssi bug.

The host was passing a too-short buffer to the HCI tx function.  The
result was a BLE_HS_EMSGSIZE error.

Fix: pass correct buffer size (3) rather than 1.


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

Branch: refs/heads/develop
Commit: 2e643fd2515d163b8343b8b72e7b2daea5f55f69
Parents: bcfe3fd
Author: Christopher Collins <cc...@apache.org>
Authored: Sat Jul 2 19:28:41 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Sat Jul 2 19:28:41 2016 -0700

----------------------------------------------------------------------
 net/nimble/host/src/ble_hci_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/2e643fd2/net/nimble/host/src/ble_hci_util.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hci_util.c b/net/nimble/host/src/ble_hci_util.c
index c792b6e..f9ed2c5 100644
--- a/net/nimble/host/src/ble_hci_util.c
+++ b/net/nimble/host/src/ble_hci_util.c
@@ -87,7 +87,7 @@ ble_hci_util_read_rssi(uint16_t conn_handle, int8_t *out_rssi)
     int rc;
 
     host_hci_cmd_build_read_rssi(conn_handle, buf, sizeof buf);
-    rc = ble_hci_cmd_tx(buf, params, 1, &params_len);
+    rc = ble_hci_cmd_tx(buf, params, sizeof params, &params_len);
     if (rc != 0) {
         return rc;
     }


[2/2] incubator-mynewt-core git commit: bletiny - Add "b rssi" command for reading rssi.

Posted by cc...@apache.org.
bletiny - Add "b rssi" command for reading rssi.


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

Branch: refs/heads/develop
Commit: dda1c9a99647f3b61109d9ca35e3d1552e908e8c
Parents: 2e643fd
Author: Christopher Collins <cc...@apache.org>
Authored: Sat Jul 2 19:29:48 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Sat Jul 2 19:29:48 2016 -0700

----------------------------------------------------------------------
 apps/bletiny/src/bletiny.h |  1 +
 apps/bletiny/src/cmd.c     | 28 ++++++++++++++++++++++++++++
 apps/bletiny/src/main.c    | 13 +++++++++++++
 3 files changed, 42 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/dda1c9a9/apps/bletiny/src/bletiny.h
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/bletiny.h b/apps/bletiny/src/bletiny.h
index 738e504..29e1d63 100644
--- a/apps/bletiny/src/bletiny.h
+++ b/apps/bletiny/src/bletiny.h
@@ -178,6 +178,7 @@ int bletiny_sec_restart(uint16_t conn_handle, uint8_t *ltk, uint16_t ediv,
                         uint64_t rand_val, int auth);
 int bletiny_tx_start(uint16_t handle, uint16_t len, uint16_t rate,
                      uint16_t num);
+int bletiny_rssi(uint16_t conn_handle, int8_t *out_rssi);
 
 #define BLETINY_LOG_MODULE  (LOG_MODULE_PERUSER + 0)
 #define BLETINY_LOG(lvl, ...) \

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/dda1c9a9/apps/bletiny/src/cmd.c
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/cmd.c b/apps/bletiny/src/cmd.c
index 4c37d4a..f6ad11d 100644
--- a/apps/bletiny/src/cmd.c
+++ b/apps/bletiny/src/cmd.c
@@ -867,6 +867,33 @@ cmd_read(int argc, char **argv)
 }
 
 /*****************************************************************************
+ * $rssi                                                                     *
+ *****************************************************************************/
+
+static int
+cmd_rssi(int argc, char **argv)
+{
+    uint16_t conn_handle;
+    int8_t rssi;
+    int rc;
+
+    conn_handle = parse_arg_uint16("conn", &rc);
+    if (rc != 0) {
+        return rc;
+    }
+
+    rc = bletiny_rssi(conn_handle, &rssi);
+    if (rc != 0) {
+        console_printf("error reading rssi; rc=%d\n", rc);
+        return rc;
+    }
+
+    console_printf("conn=%d rssi=%d\n", conn_handle, rssi);
+
+    return 0;
+}
+
+/*****************************************************************************
  * $scan                                                                     *
  *****************************************************************************/
 
@@ -2153,6 +2180,7 @@ static struct cmd_entry cmd_b_entries[] = {
     { "mtu",        cmd_mtu },
     { "passkey",    cmd_passkey },
     { "read",       cmd_read },
+    { "rssi",       cmd_rssi },
     { "scan",       cmd_scan },
     { "show",       cmd_show },
     { "sec",        cmd_sec },

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/dda1c9a9/apps/bletiny/src/main.c
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/main.c b/apps/bletiny/src/main.c
index a94027b..edb1984 100755
--- a/apps/bletiny/src/main.c
+++ b/apps/bletiny/src/main.c
@@ -1475,6 +1475,19 @@ bletiny_tx_start(uint16_t handle, uint16_t len, uint16_t rate, uint16_t num)
     return 0;
 }
 
+int
+bletiny_rssi(uint16_t conn_handle, int8_t *out_rssi)
+{
+    int rc;
+
+    rc = ble_hci_util_read_rssi(conn_handle, out_rssi);
+    if (rc != 0) {
+        return rc;
+    }
+
+    return 0;
+}
+
 /**
  * BLE test task
  *