Bluetooth: Tester: Device name in AD instead of SD
With the deprecation of `BT_LE_ADV_OPT_USE_NAME` and `BT_LE_ADV_OPT_FORCE_NAME_IN_AD` the tester has been updated to not use the macro adding the device name in the advertising/scan response data anymore. Instead the name was explicitly added to the scan response data. But because that part of the tester was using an extended advertiser and was already adding data in the AD, the name should have been put in the advertising data and not the scan response data. The same issue apply to both `btp_cap.c` and `btp_bap_broadcast.c`, update them to add the device name in the advertising data. Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
This commit is contained in:
parent
c9a148882c
commit
27e8bc65c7
2 changed files with 18 additions and 26 deletions
|
@ -306,12 +306,8 @@ uint8_t btp_bap_broadcast_source_setup(const void *cmd, uint16_t cmd_len,
|
|||
NET_BUF_SIMPLE_DEFINE(ad_buf, BT_UUID_SIZE_16 + BT_AUDIO_BROADCAST_ID_SIZE);
|
||||
NET_BUF_SIMPLE_DEFINE(base_buf, 128);
|
||||
|
||||
struct bt_data sd;
|
||||
|
||||
const char *dev_name = bt_get_name();
|
||||
|
||||
/* Broadcast Audio Streaming Endpoint advertising data */
|
||||
struct bt_data base_ad;
|
||||
struct bt_data base_ad[2];
|
||||
struct bt_data per_ad;
|
||||
|
||||
LOG_DBG("");
|
||||
|
@ -348,14 +344,14 @@ uint8_t btp_bap_broadcast_source_setup(const void *cmd, uint16_t cmd_len,
|
|||
/* Setup extended advertising data */
|
||||
net_buf_simple_add_le16(&ad_buf, BT_UUID_BROADCAST_AUDIO_VAL);
|
||||
net_buf_simple_add_le24(&ad_buf, source->broadcast_id);
|
||||
base_ad.type = BT_DATA_SVC_DATA16;
|
||||
base_ad.data_len = ad_buf.len;
|
||||
base_ad.data = ad_buf.data;
|
||||
sd.type = BT_DATA_NAME_COMPLETE;
|
||||
sd.data_len = strlen(dev_name);
|
||||
sd.data = (const uint8_t *)dev_name;
|
||||
err = tester_gap_create_adv_instance(param, BTP_GAP_ADDR_TYPE_IDENTITY, &base_ad, 1,
|
||||
&sd, 1, &gap_settings);
|
||||
base_ad[0].type = BT_DATA_SVC_DATA16;
|
||||
base_ad[0].data_len = ad_buf.len;
|
||||
base_ad[0].data = ad_buf.data;
|
||||
base_ad[1].type = BT_DATA_NAME_COMPLETE;
|
||||
base_ad[1].data_len = sizeof(CONFIG_BT_DEVICE_NAME) - 1;
|
||||
base_ad[1].data = CONFIG_BT_DEVICE_NAME;
|
||||
err = tester_gap_create_adv_instance(param, BTP_GAP_ADDR_TYPE_IDENTITY, base_ad, 2,
|
||||
NULL, 0, &gap_settings);
|
||||
if (err != 0) {
|
||||
LOG_DBG("Failed to create extended advertising instance: %d", err);
|
||||
|
||||
|
|
|
@ -536,12 +536,8 @@ static int cap_broadcast_source_adv_setup(struct btp_bap_broadcast_local_source
|
|||
NET_BUF_SIMPLE_DEFINE(ad_buf, BT_UUID_SIZE_16 + BT_AUDIO_BROADCAST_ID_SIZE);
|
||||
NET_BUF_SIMPLE_DEFINE(base_buf, 128);
|
||||
|
||||
struct bt_data sd;
|
||||
|
||||
const char *dev_name = bt_get_name();
|
||||
|
||||
/* Broadcast Audio Streaming Endpoint advertising data */
|
||||
struct bt_data base_ad;
|
||||
struct bt_data base_ad[2];
|
||||
struct bt_data per_ad;
|
||||
|
||||
err = bt_cap_initiator_broadcast_get_id(source->cap_broadcast, &source->broadcast_id);
|
||||
|
@ -556,14 +552,14 @@ static int cap_broadcast_source_adv_setup(struct btp_bap_broadcast_local_source
|
|||
/* Setup extended advertising data */
|
||||
net_buf_simple_add_le16(&ad_buf, BT_UUID_BROADCAST_AUDIO_VAL);
|
||||
net_buf_simple_add_le24(&ad_buf, source->broadcast_id);
|
||||
base_ad.type = BT_DATA_SVC_DATA16;
|
||||
base_ad.data_len = ad_buf.len;
|
||||
base_ad.data = ad_buf.data;
|
||||
sd.type = BT_DATA_NAME_COMPLETE;
|
||||
sd.data_len = strlen(dev_name);
|
||||
sd.data = (const uint8_t *) dev_name;
|
||||
err = tester_gap_create_adv_instance(param, BTP_GAP_ADDR_TYPE_IDENTITY, &base_ad, 1,
|
||||
&sd, 1, gap_settings);
|
||||
base_ad[0].type = BT_DATA_SVC_DATA16;
|
||||
base_ad[0].data_len = ad_buf.len;
|
||||
base_ad[0].data = ad_buf.data;
|
||||
base_ad[1].type = BT_DATA_NAME_COMPLETE;
|
||||
base_ad[1].data_len = sizeof(CONFIG_BT_DEVICE_NAME) - 1;
|
||||
base_ad[1].data = CONFIG_BT_DEVICE_NAME;
|
||||
err = tester_gap_create_adv_instance(param, BTP_GAP_ADDR_TYPE_IDENTITY, base_ad, 2,
|
||||
NULL, 0, gap_settings);
|
||||
if (err != 0) {
|
||||
LOG_DBG("Failed to create extended advertising instance: %d", err);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue