@@ -33,6 +33,18 @@ static const struct bt_data ad[] = {
33
33
static const struct bt_data sd [] = {
34
34
BT_DATA (BT_DATA_NAME_COMPLETE , CONFIG_BT_DEVICE_NAME , sizeof (CONFIG_BT_DEVICE_NAME ) - 1 ),
35
35
};
36
+
37
+ static struct bt_le_adv_param adv_param = {
38
+ .id = BT_ID_DEFAULT ,
39
+ .sid = 0U ,
40
+ .secondary_max_skip = 0U ,
41
+ .options = (BT_LE_ADV_OPT_EXT_ADV | BT_LE_ADV_OPT_CONN | BT_LE_ADV_OPT_CODED ),
42
+ .interval_min = BT_GAP_ADV_FAST_INT_MIN_2 ,
43
+ .interval_max = BT_GAP_ADV_FAST_INT_MAX_2 ,
44
+ .peer = NULL ,
45
+ };
46
+
47
+ static struct bt_le_ext_adv * adv ;
36
48
#endif /* !CONFIG_BT_EXT_ADV */
37
49
38
50
/* Use atomic variable, 2 bits for connection and disconnection state */
@@ -205,10 +217,9 @@ static int start_adv(void)
205
217
printk ("Advertising failed to start (err %d)\n" , err );
206
218
return 0 ;
207
219
}
208
-
209
220
#else /* CONFIG_BT_EXT_ADV */
210
221
printk ("Starting Extended Advertising (connectable and non-scannable)\n" );
211
- err = bt_le_ext_adv_start (ad , BT_LE_EXT_ADV_START_DEFAULT );
222
+ err = bt_le_ext_adv_start (adv , BT_LE_EXT_ADV_START_DEFAULT );
212
223
if (err ) {
213
224
printk ("Failed to start extended advertising set (err %d)\n" , err );
214
225
return 0 ;
@@ -243,17 +254,6 @@ int main(void)
243
254
}
244
255
245
256
#else /* CONFIG_BT_EXT_ADV */
246
- struct bt_le_adv_param adv_param = {
247
- .id = BT_ID_DEFAULT ,
248
- .sid = 0U ,
249
- .secondary_max_skip = 0U ,
250
- .options = (BT_LE_ADV_OPT_EXT_ADV | BT_LE_ADV_OPT_CONN | BT_LE_ADV_OPT_CODED ),
251
- .interval_min = BT_GAP_ADV_FAST_INT_MIN_2 ,
252
- .interval_max = BT_GAP_ADV_FAST_INT_MAX_2 ,
253
- .peer = NULL ,
254
- };
255
- struct bt_le_ext_adv * adv ;
256
-
257
257
printk ("Creating a Coded PHY connectable non-scannable advertising set\n" );
258
258
err = bt_le_ext_adv_create (& adv_param , NULL , & adv );
259
259
if (err ) {
0 commit comments