mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
component/bt: fix periodic adv parameters detection issue
This commit is contained in:
parent
b0133c72a0
commit
ab2148a390
@ -209,7 +209,8 @@ static void parse_ble_read_adv_max_len_response(
|
||||
{
|
||||
|
||||
uint8_t *stream = read_command_complete_header(response, HCI_BLE_RD_MAX_ADV_DATA_LEN, 1 /* bytes after */);
|
||||
STREAM_TO_UINT8(*adv_max_len_ptr, stream);
|
||||
// Size: 2 Octets ; Value: 0x001F – 0x0672 ; Maximum supported advertising data length
|
||||
STREAM_TO_UINT16(*adv_max_len_ptr, stream);
|
||||
|
||||
osi_free(response);
|
||||
}
|
||||
|
@ -689,23 +689,16 @@ tBTM_STATUS BTM_BlePeriodicAdvCfgDataRaw(UINT8 instance, UINT16 len, UINT8 *data
|
||||
{
|
||||
tBTM_STATUS status = BTM_SUCCESS;
|
||||
tHCI_STATUS err = HCI_SUCCESS;
|
||||
uint16_t rem_len;
|
||||
uint16_t rem_len = len;
|
||||
UINT8 operation = 0;
|
||||
UINT16 data_offset = 0;
|
||||
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
|
||||
|
||||
if ((status = btm_ble_ext_adv_set_data_validate(instance, len, data)) != BTM_SUCCESS) {
|
||||
BTM_TRACE_ERROR("%s, invalid extend adv data.", __func__);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (len > controller_get_interface()->ble_get_ext_adv_data_max_len()) {
|
||||
BTM_TRACE_ERROR("%s, The adv data len(%d) is longer then the controller adv max len(%d)",
|
||||
__func__, len, controller_get_interface()->ble_get_ext_adv_data_max_len());
|
||||
status = BTM_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
rem_len = len;
|
||||
|
||||
do {
|
||||
UINT8 send_data_len = (rem_len > BTM_BLE_PERIODIC_ADV_DATA_LEN_MAX) ? BTM_BLE_PERIODIC_ADV_DATA_LEN_MAX : rem_len;
|
||||
|
||||
@ -729,8 +722,8 @@ tBTM_STATUS BTM_BlePeriodicAdvCfgDataRaw(UINT8 instance, UINT16 len, UINT8 *data
|
||||
data_offset += send_data_len;
|
||||
} while(rem_len);
|
||||
|
||||
end:
|
||||
cb_params.status = status;
|
||||
|
||||
BTM_ExtBleCallbackTrigger(BTM_BLE_5_GAP_PERIODIC_ADV_DATA_SET_COMPLETE_EVT, &cb_params);
|
||||
|
||||
return status;
|
||||
@ -1108,6 +1101,12 @@ static tBTM_STATUS btm_ble_ext_adv_set_data_validate(UINT8 instance, UINT16 len,
|
||||
BTM_TRACE_ERROR("%s, for the legacy adv, the adv data length can't exceed 31. line %d", __func__, __LINE__);
|
||||
return BTM_ILLEGAL_VALUE;
|
||||
}
|
||||
} else {
|
||||
if (len > controller_get_interface()->ble_get_ext_adv_data_max_len()) {
|
||||
BTM_TRACE_ERROR("%s, The adv data len(%d) is longer then the controller adv max len(%d)",
|
||||
__func__, len, controller_get_interface()->ble_get_ext_adv_data_max_len());
|
||||
return BTM_ILLEGAL_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
return BTM_SUCCESS;
|
||||
|
Loading…
x
Reference in New Issue
Block a user