component/bt:Added the GATTS_INCLUDED macro to the bta layer

This commit is contained in:
Yulong 2017-04-19 08:06:38 -04:00
parent 2723504473
commit 67863ec495

View file

@ -287,11 +287,12 @@ static void gattc_profile_b_event_handler(esp_gattc_cb_event_t event, esp_gatt_i
static void esp_gap_cb(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param) static void esp_gap_cb(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param)
{ {
uint8_t *adv_name = NULL; uint8_t *adv_name = NULL;
char adv_name_char[31] = {0};
uint8_t adv_name_len = 0; uint8_t adv_name_len = 0;
switch (event) { switch (event) {
case ESP_GAP_BLE_SCAN_PARAM_SET_COMPLETE_EVT: { case ESP_GAP_BLE_SCAN_PARAM_SET_COMPLETE_EVT: {
//the unit of the duration is second //the unit of the duration is second
uint32_t duration = 10; uint32_t duration = 30;
esp_ble_gap_start_scanning(duration); esp_ble_gap_start_scanning(duration);
break; break;
} }
@ -316,9 +317,9 @@ static void esp_gap_cb(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *par
for (int j = 0; j < adv_name_len; j++) { for (int j = 0; j < adv_name_len; j++) {
ESP_LOGI(GATTC_TAG, "%c", adv_name[j]); ESP_LOGI(GATTC_TAG, "%c", adv_name[j]);
} }
memcpy(adv_name_char, adv_name, adv_name_len);
if (adv_name != NULL) { if (adv_name != NULL) {
if (strcmp((char *)adv_name, device_name) == 0) { if (strcmp(adv_name_char, device_name) == 0) {
ESP_LOGI(GATTC_TAG, "Searched device %s", device_name); ESP_LOGI(GATTC_TAG, "Searched device %s", device_name);
if (connect == false) { if (connect == false) {
connect = true; connect = true;