|
@ -559,7 +559,7 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i |
|
|
#define profile_b_buffer_size 100 |
|
|
#define profile_b_buffer_size 100 |
|
|
char gatts_profile_b_write_buffer[profile_b_buffer_size] = {0}; |
|
|
char gatts_profile_b_write_buffer[profile_b_buffer_size] = {0}; |
|
|
uint8_t gatts_profile_b_write_buffer_len = 0; |
|
|
uint8_t gatts_profile_b_write_buffer_len = 0; |
|
|
bool gatts_profile_b_write_flag = false; |
|
|
|
|
|
|
|
|
bool bluetooth_rx_off = false; |
|
|
|
|
|
|
|
|
bool flag = true; |
|
|
bool flag = true; |
|
|
uint32_t total = 0; |
|
|
uint32_t total = 0; |
|
@ -614,10 +614,10 @@ static void gatts_profile_b_event_handler(esp_gatts_cb_event_t event, esp_gatt_i |
|
|
{ |
|
|
{ |
|
|
// if ((gatts_profile_b_write_buffer_len+param->write.len > profile_b_buffer_size)) |
|
|
// if ((gatts_profile_b_write_buffer_len+param->write.len > profile_b_buffer_size)) |
|
|
// { |
|
|
// { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// } |
|
|
// } |
|
|
|
|
|
|
|
|
if (gatts_profile_b_write_flag == false) |
|
|
|
|
|
|
|
|
if (bluetooth_rx_off == false) |
|
|
{ |
|
|
{ |
|
|
timer_set_pause_and_counter_zero(TIMER_GROUP_0, TIMER_0); |
|
|
timer_set_pause_and_counter_zero(TIMER_GROUP_0, TIMER_0); |
|
|
timer_start(TIMER_GROUP_0, TIMER_0); |
|
|
timer_start(TIMER_GROUP_0, TIMER_0); |
|
@ -625,7 +625,7 @@ static void gatts_profile_b_event_handler(esp_gatts_cb_event_t event, esp_gatt_i |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
ESP_LOGI("!!!", "%s", &gatts_profile_b_write_buffer[0]); |
|
|
ESP_LOGI("!!!", "%s", &gatts_profile_b_write_buffer[0]); |
|
|
gatts_profile_b_write_flag = false; |
|
|
|
|
|
|
|
|
bluetooth_rx_off = false; |
|
|
timer_set_pause_and_counter_zero(TIMER_GROUP_0, TIMER_0); |
|
|
timer_set_pause_and_counter_zero(TIMER_GROUP_0, TIMER_0); |
|
|
buffer_all_init(); |
|
|
buffer_all_init(); |
|
|
|
|
|
|
|
@ -775,7 +775,7 @@ static bool IRAM_ATTR timer_group_isr_callback(void *args) |
|
|
// printf("esp_bt_controller_init"); |
|
|
// printf("esp_bt_controller_init"); |
|
|
// ESP_LOGI("timer","------------------"); |
|
|
// ESP_LOGI("timer","------------------"); |
|
|
|
|
|
|
|
|
gatts_profile_b_write_flag = true; |
|
|
|
|
|
|
|
|
bluetooth_rx_off = true; |
|
|
return pdFALSE; |
|
|
return pdFALSE; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -891,11 +891,17 @@ void app_main(void) |
|
|
ESP_LOGE(GATTS_TAG, "set local MTU failed, error code = %x", local_mtu_ret); |
|
|
ESP_LOGE(GATTS_TAG, "set local MTU failed, error code = %x", local_mtu_ret); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while(true) |
|
|
|
|
|
|
|
|
while (true) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
bluetooth_gatts_try_process_data(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void bluetooth_gatts_try_process_data() |
|
|
|
|
|
{ |
|
|
|
|
|
if (bluetooth_rx_off) |
|
|
|
|
|
{ |
|
|
|
|
|
} |
|
|
|
|
|
} |