Skip to content

Commit 1568da6

Browse files
m-alperen-senernordicjm
authored andcommitted
samples: bluetooth: mesh: align usage of BT_LE_ADV_CONN with NCS
Align the usage of BT_LE_ADV_CONN inline helper with the rest of the NCS Also global declaration of adv_params is optimised and cause bus failure during runtime, thus adding only lbs_conn_id to discern mesh services. Signed-off-by: alperen sener <[email protected]>
1 parent d67400d commit 1568da6

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,11 @@ Bluetooth Mesh samples
396396
* :ref:`ble_mesh_dfu_target`
397397
* :ref:`ble_mesh_dfu_distributor`
398398

399+
* :ref:`bluetooth_ble_peripheral_lbs_coex` sample:
400+
401+
* Updated the usage of the :c:macro:`BT_LE_ADV_CONN` macro.
402+
See the Bluetooth Host section in Zephyr's :ref:`zephyr:migration_3.7`.
403+
399404
Cellular samples
400405
----------------
401406

samples/bluetooth/mesh/ble_peripheral_lbs_coex/src/lb_service_handler.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static const struct bt_data sd[] = {
4141
};
4242

4343
static struct bt_le_ext_adv *adv;
44-
static struct bt_le_adv_param *adv_params = (struct bt_le_adv_param *)BT_LE_ADV_CONN;
44+
static uint8_t lbs_conn_id;
4545
static bool ble_button_state;
4646

4747
static void connected(struct bt_conn *conn, uint8_t err)
@@ -55,7 +55,7 @@ static void connected(struct bt_conn *conn, uint8_t err)
5555
return;
5656
}
5757

58-
if (cinfo.id != adv_params->id) {
58+
if (cinfo.id != lbs_conn_id) {
5959
return;
6060
}
6161

@@ -78,7 +78,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason)
7878
return;
7979
}
8080

81-
if (cinfo.id != adv_params->id) {
81+
if (cinfo.id != lbs_conn_id) {
8282
return;
8383
}
8484

@@ -119,7 +119,7 @@ static void lbs_adv_start(void)
119119
{
120120
int err;
121121
size_t id_count = 0xFF;
122-
122+
struct bt_le_adv_param adv_params = *BT_LE_ADV_CONN;
123123
/* Use different identity from Bluetooth Mesh to avoid conflicts with Mesh Provisioning
124124
* Service and Mesh Proxy Service advertisements.
125125
*/
@@ -131,18 +131,20 @@ static void lbs_adv_start(void)
131131
if (id < 0) {
132132
printk("Unable to create a new identity for LBS (err %d)."
133133
" Using the default one.\n", id);
134-
adv_params->id = BT_ID_DEFAULT;
134+
lbs_conn_id = BT_ID_DEFAULT;
135135
} else {
136-
adv_params->id = id;
136+
lbs_conn_id = id;
137137
}
138138

139-
printk("Created a new identity for LBS: %d\n", adv_params->id);
139+
printk("Created a new identity for LBS: %d\n", lbs_conn_id);
140140
} else {
141-
adv_params->id = BT_ID_DEFAULT + 1;
142-
printk("Recovered identity for LBS: %d\n", adv_params->id);
141+
lbs_conn_id = BT_ID_DEFAULT + 1;
142+
printk("Recovered identity for LBS: %d\n", lbs_conn_id);
143143
}
144144

145-
err = bt_le_ext_adv_create(adv_params, NULL, &adv);
145+
adv_params.id = lbs_conn_id;
146+
147+
err = bt_le_ext_adv_create(&adv_params, NULL, &adv);
146148
if (err) {
147149
printk("Creating LBS service adv instance failed (err %d)\n", err);
148150
return;

0 commit comments

Comments
 (0)