esp_ble_gatts_send_indicate causes attr value not to change, no notification sent
Posted: Wed Dec 04, 2019 4:38 pm
Hello,
I am currently trying to change the characteristic value of a service then notify a BLE interrogator (BLE Scanner) when there is a change to the attribute.
I am adjusting the ESP_IDF example GATTS Server Service Table example with the following code:
If I do a read event prompted from the phone and just use the set attribute function that works. When I add the send indicate function not only does the value of data not change when I do a read event from the phone but I am never prompted about the change on the app.
I am currently trying to change the characteristic value of a service then notify a BLE interrogator (BLE Scanner) when there is a change to the attribute.
I am adjusting the ESP_IDF example GATTS Server Service Table example with the following code:
Code: Select all
while (true){
ets_delay_us(100000);
ret = esp_ble_gatts_set_attr_value(heart_rate_handle_table[IDX_CHAR_VAL_A],sizeof(data),data);
if (ret){
ESP_LOGE(GATTS_TABLE_TAG, "set attr value failed, error code = %x", ret);
return;
}
ret = esp_ble_gatts_send_indicate(heart_rate_profile_tab[IDX_CHAR_VAL_A].gatts_if, heart_rate_profile_tab[IDX_CHAR_VAL_A].conn_id, heart_rate_handle_table[IDX_CHAR_VAL_A], sizeof(data),data, false);
if (ret){
ESP_LOGE(GATTS_TABLE_TAG, "Send indication, error code = %x", ret);
return;
}
data[0] = data[0] + 1;
}