Merge branch 'bugfix/fix_ble_battery_profile_error' into 'master'

Fixed battery profile wrong condition in bluedroid host

Closes IDFGH-9937

See merge request espressif/esp-idf!23358
This commit is contained in:
Wang Meng Yang
2023-04-28 14:50:03 +08:00

View File

@@ -104,12 +104,13 @@ static void bas_gatts_callback(esp_gatts_evt_t event, tBTA_GATTS *p_data)
p_data->add_result.char_uuid.uu.uuid16); p_data->add_result.char_uuid.uu.uuid16);
UINT16 char_uuid = p_data->add_result.char_uuid.uu.uuid16; UINT16 char_uuid = p_data->add_result.char_uuid.uu.uuid16;
UINT16 service_id = p_data->add_result.service_id; UINT16 service_id = p_data->add_result.service_id;
if (char_uuid == GATT_UUID_BATTERY_LEVEL) { UINT16 uuid_len = p_data->add_result.char_uuid.len;
bas_AddCharDescr(service_id, p_data->add_result.attr_id);
} if (uuid_len == ESP_UUID_LEN_16) {
if (char_uuid == GATT_UUID_SYSTEM_ID | GATT_UUID_MODEL_NUMBER_STR | GATT_UUID_PNP_ID | if (char_uuid == GATT_UUID_BATTERY_LEVEL) {
GATT_UUID_SERIAL_NUMBER_STR | GATT_UUID_FW_VERSION_STR | GATT_UUID_HW_VERSION_STR | bas_AddCharDescr(service_id, p_data->add_result.attr_id);
GATT_UUID_SW_VERSION_STR | GATT_UUID_MANU_NAME | GATT_UUID_IEEE_DATA) { }
switch (char_uuid) { switch (char_uuid) {
case GATT_UUID_SYSTEM_ID: case GATT_UUID_SYSTEM_ID:
dis_cb.dis_attr[0].handle = service_id; break; dis_cb.dis_attr[0].handle = service_id; break;
@@ -130,6 +131,8 @@ static void bas_gatts_callback(esp_gatts_evt_t event, tBTA_GATTS *p_data)
case GATT_UUID_PNP_ID: case GATT_UUID_PNP_ID:
dis_cb.dis_attr[8].handle = service_id; break; dis_cb.dis_attr[8].handle = service_id; break;
} }
default:
break;
} }
} }
break; break;