You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2018/03/15 21:27:03 UTC

[mynewt-nimble] 08/14: mesh: Fix setting advertising scan response data

This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit 3c0e120bd07d465df34591a392436cd4c98ad14b
Author: MichaƂ Narajowski <mi...@codecoup.pl>
AuthorDate: Tue Mar 6 12:02:42 2018 +0100

    mesh: Fix setting advertising scan response data
    
    Previously the scan response data was ignored.
    Also the discoverable mode of advertising should be set
    to ensure that the advertising is scannable and that the controller
    can send scan response data.
    
    X-Original-Commit: 8dbd765334d696baeb2c7a20e5ea812a727180c1
---
 nimble/host/mesh/src/glue.c  | 16 ++++++++++++++++
 nimble/host/mesh/src/proxy.c |  4 +++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/nimble/host/mesh/src/glue.c b/nimble/host/mesh/src/glue.c
index b93d9db..15d8d9b 100644
--- a/nimble/host/mesh/src/glue.c
+++ b/nimble/host/mesh/src/glue.c
@@ -491,6 +491,22 @@ bt_le_adv_start(const struct ble_gap_adv_params *param,
         return err;
     }
 
+    if (sd) {
+        buf_len = 0;
+
+        err = set_ad(sd, sd_len, buf, &buf_len);
+        if (err) {
+            BT_ERR("Advertising failed: err %d", err);
+            return err;
+        }
+
+        err = ble_gap_adv_rsp_set_data(buf, buf_len);
+        if (err != 0) {
+            BT_ERR("Advertising failed: err %d", err);
+            return err;
+        }
+    }
+
     err = ble_gap_adv_start(g_mesh_addr_type, NULL, BLE_HS_FOREVER, param,
                             NULL, NULL);
     if (err) {
diff --git a/nimble/host/mesh/src/proxy.c b/nimble/host/mesh/src/proxy.c
index 1fe5317..4ec2cbe 100644
--- a/nimble/host/mesh/src/proxy.c
+++ b/nimble/host/mesh/src/proxy.c
@@ -81,13 +81,15 @@ ble_uuid16_t BT_UUID_MESH_PROXY_DATA_OUT       = BLE_UUID16_INIT(0x2ade);
 #define CLIENT_BUF_SIZE 68
 
 static const struct ble_gap_adv_params slow_adv_param = {
-	.conn_mode = (BLE_GAP_CONN_MODE_UND ),
+	.conn_mode = (BLE_GAP_CONN_MODE_UND),
+	.disc_mode = (BLE_GAP_DISC_MODE_GEN),
 	.itvl_min = BT_GAP_ADV_SLOW_INT_MIN,
 	.itvl_max = BT_GAP_ADV_SLOW_INT_MAX,
 };
 
 static const struct ble_gap_adv_params fast_adv_param = {
 	.conn_mode = (BLE_GAP_CONN_MODE_UND),
+	.disc_mode = (BLE_GAP_DISC_MODE_GEN),
 	.itvl_min = BT_GAP_ADV_FAST_INT_MIN_2,
 	.itvl_max = BT_GAP_ADV_FAST_INT_MAX_2,
 };

-- 
To stop receiving notification emails like this one, please contact
andk@apache.org.