|
|
@ -1,5 +1,7 @@ |
|
|
|
#include "ble_gatts_table.h" |
|
|
|
|
|
|
|
static uint16_t *hid_conn_id; |
|
|
|
|
|
|
|
static uint8_t adv_config_done = 0; |
|
|
|
|
|
|
|
uint16_t heart_rate_handle_table[HRS_IDX_NB]; |
|
|
@ -438,6 +440,8 @@ static void gatts_profile_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_ |
|
|
|
conn_params.timeout = 400; // timeout = 400*10ms = 4000ms |
|
|
|
// start sent the update connection parameters to the peer device. |
|
|
|
esp_ble_gap_update_conn_params(&conn_params); |
|
|
|
*hid_conn_id = param->connect.conn_id; |
|
|
|
// *hid_conn_id = 100; |
|
|
|
break; |
|
|
|
case ESP_GATTS_DISCONNECT_EVT: |
|
|
|
ESP_LOGI(GATTS_TABLE_TAG, "ESP_GATTS_DISCONNECT_EVT, reason = 0x%x", param->disconnect.reason); |
|
|
@ -511,10 +515,12 @@ static void gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_ |
|
|
|
} while (0); |
|
|
|
} |
|
|
|
|
|
|
|
void ble_init(void) |
|
|
|
void ble_init(uint16_t *conn_id_ble) |
|
|
|
{ |
|
|
|
esp_err_t ret; |
|
|
|
|
|
|
|
hid_conn_id = conn_id_ble; |
|
|
|
|
|
|
|
/* Initialize NVS. */ |
|
|
|
ret = nvs_flash_init(); |
|
|
|
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) |
|
|
|