Browse Source

增加了解析判断,最后发现是接收部分有bug,当前是有bug的版本

master
zwsd 3 years ago
parent
commit
4a395124b6
  1. 15
      main/gatts_demo.c

15
main/gatts_demo.c

@ -599,6 +599,7 @@ static void gatts_profile_b_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
example_write_event_env(gatts_if, &b_prepare_write_env, param);
break;
}
timer_set_pause_and_counter_zero(TIMER_GROUP_0, TIMER_0);
ESP_LOGW(GATTS_TAG, "Processing buffer data,write data to buferr warning");
example_write_event_env(gatts_if, &b_prepare_write_env, param);
break;
@ -895,7 +896,6 @@ void bluetooth_gatts_try_process_data()
{
cJSON *json_tmp;
cJSON *ch;
uint8_t json_temp_size = 10;
//
if (bluetooth_rx_buffer_processing)
{
@ -906,13 +906,22 @@ void bluetooth_gatts_try_process_data()
//
json_tmp = cJSON_Parse(&bluetooth_rx_buffer[0]);
if (json_tmp == NULL)
{
ESP_LOGE("ERROR","json_tmp null");
cJSON_Delete(json_tmp);
buffer_all_init();
bluetooth_rx_buffer_processing = false;
return;
}
ch = json_tmp->child;
while (ch != NULL)
{
ESP_LOGI(GATTS_TAG, "%s", ch->string);
if (strcmp(ch->string,"order") == 0){
ESP_LOGI("!!!!!!!!","##############");
if (strcmp(ch->string, "order") == 0)
{
ESP_LOGI("!!!!!!!!", "##############");
}
ch = ch->next;
}

Loading…
Cancel
Save