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;
}