From e2ce808c94b6f53257cdd4a2ba7d3a3f616e1705 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Narajowski?= Date: Tue, 6 Mar 2018 11:31:45 +0100 Subject: [PATCH 1/4] mesh: shell: Enable beacon by default X-Original-Commit: 9d180d3b5e440c1942fbfcacb6b811d17d1bad55 --- nimble/host/mesh/src/shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nimble/host/mesh/src/shell.c b/nimble/host/mesh/src/shell.c index 8a5cb38b6..1e8e79e3b 100644 --- a/nimble/host/mesh/src/shell.c +++ b/nimble/host/mesh/src/shell.c @@ -65,7 +65,7 @@ static struct { static struct bt_mesh_cfg_srv cfg_srv = { .relay = BT_MESH_RELAY_DISABLED, - .beacon = BT_MESH_BEACON_DISABLED, + .beacon = BT_MESH_BEACON_ENABLED, #if MYNEWT_VAL(BLE_MESH_FRIEND) .frnd = BT_MESH_FRIEND_DISABLED, #else From 3c0e120bd07d465df34591a392436cd4c98ad14b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Narajowski?= Date: Tue, 6 Mar 2018 12:02:42 +0100 Subject: [PATCH 2/4] 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 b93d9dbb9..15d8d9b2a 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 1fe531752..4ec2cbe35 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, }; From 880daad2a2a6e82fd94ab0719ca162173309761c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Narajowski?= Date: Tue, 6 Mar 2018 12:17:25 +0100 Subject: [PATCH 3/4] mesh: shell: Fix supported output actions Add more supported output actions to be able to provision with the Bluetooth Mesh app from Silicon Labs. It contains a bug which causes it to select wrong (not supported) action. X-Original-Commit: 9f6b121764c0707a93ace91dbd11923c6dba1b71 --- nimble/host/mesh/src/shell.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nimble/host/mesh/src/shell.c b/nimble/host/mesh/src/shell.c index 1e8e79e3b..03ea6dd70 100644 --- a/nimble/host/mesh/src/shell.c +++ b/nimble/host/mesh/src/shell.c @@ -413,11 +413,11 @@ static struct bt_mesh_prov prov = { .reset = prov_reset, .static_val = NULL, .static_val_len = 0, - .output_size = 6, - .output_actions = (BT_MESH_DISPLAY_NUMBER | BT_MESH_DISPLAY_STRING), + .output_size = 4, + .output_actions = (BT_MESH_BLINK | BT_MESH_BEEP | BT_MESH_DISPLAY_NUMBER | BT_MESH_DISPLAY_STRING), .output_number = output_number, .output_string = output_string, - .input_size = 6, + .input_size = 4, .input_actions = (BT_MESH_ENTER_NUMBER | BT_MESH_ENTER_STRING), .input = input, }; From feb792c6e08aada3de0a3690391a8c24c28e7953 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Narajowski?= Date: Tue, 6 Mar 2018 16:07:30 +0100 Subject: [PATCH 4/4] mesh: Fix available LPN groups count X-Original-Commit: 22228bdc87d78141849ac0715c39ef50c32436fb --- nimble/host/mesh/include/mesh/glue.h | 2 +- nimble/host/mesh/src/lpn.c | 2 +- nimble/host/mesh/src/net.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nimble/host/mesh/include/mesh/glue.h b/nimble/host/mesh/include/mesh/glue.h index b1050d8c6..26ba98f2b 100644 --- a/nimble/host/mesh/include/mesh/glue.h +++ b/nimble/host/mesh/include/mesh/glue.h @@ -349,7 +349,7 @@ static inline unsigned int find_msb_set(u32_t op) /* Above flags are used with IS_ENABLED macro */ #define IS_ENABLED(config) MYNEWT_VAL(config) -#define CONFIG_BLUETOOTH_MESH_LPN_GROUPS MYNEWT_VAL(BLE_MESH_LPN_GROUPS) +#define CONFIG_BT_MESH_LPN_GROUPS MYNEWT_VAL(BLE_MESH_LPN_GROUPS) #define CONFIG_BT_MESH_ADV_BUF_COUNT MYNEWT_VAL(BLE_MESH_ADV_BUF_COUNT) #define CONFIG_BT_MESH_FRIEND_QUEUE_SIZE MYNEWT_VAL(BLE_MESH_FRIEND_QUEUE_SIZE) #define CONFIG_BT_MESH_FRIEND_RECV_WIN MYNEWT_VAL(BLE_MESH_FRIEND_RECV_WIN) diff --git a/nimble/host/mesh/src/lpn.c b/nimble/host/mesh/src/lpn.c index 165bc23b9..0cc462298 100644 --- a/nimble/host/mesh/src/lpn.c +++ b/nimble/host/mesh/src/lpn.c @@ -613,7 +613,7 @@ static void lpn_group_del(u16_t group) static inline int group_popcount(atomic_t *target) { -#if CONFIG_BLUETOOTH_MESH_LPN_GROUPS > 32 +#if CONFIG_BT_MESH_LPN_GROUPS > 32 int i, count = 0; for (i = 0; i < ARRAY_SIZE(bt_mesh.lpn.added); i++) { diff --git a/nimble/host/mesh/src/net.h b/nimble/host/mesh/src/net.h index 24940a648..5e11aa27b 100644 --- a/nimble/host/mesh/src/net.h +++ b/nimble/host/mesh/src/net.h @@ -121,7 +121,7 @@ struct bt_mesh_friend { }; #if (MYNEWT_VAL(BLE_MESH_LOW_POWER)) -#define LPN_GROUPS MYNEWT_VAL(BLE_MESH_LOW_POWER) +#define LPN_GROUPS CONFIG_BT_MESH_LPN_GROUPS #else #define LPN_GROUPS 0 #endif