how to make example gatt_security_server notify?
Posted: Fri Jun 28, 2019 8:33 am
Dear All,
I am working with example gatt_security_server in esp-idf and when I tested it with nordic mobile application, it just did not return any value to the nordic.
So I check the example code and found out that they just leave it blank like this :
So, I put some code in like this:
So when I set notify enable in the nordic application, I expected to get value of 2.
But turn out, I did not get any notify from the esp32.
Here is what I got from logging via UART:
it showed that the code run through this part already. Is there any idea how to make notify in this example?
May thanks.
I am working with example gatt_security_server in esp-idf and when I tested it with nordic mobile application, it just did not return any value to the nordic.
So I check the example code and found out that they just leave it blank like this :
Code: Select all
case ESP_GATTS_WRITE_EVT:
ESP_LOGI(GATTS_TABLE_TAG, "ESP_GATTS_WRITE_EVT, write value:");
esp_log_buffer_hex(GATTS_TABLE_TAG, param->write.value, param->write.len);
Code: Select all
case ESP_GATTS_WRITE_EVT:
ESP_LOGI(GATTS_TABLE_TAG, "ESP_GATTS_WRITE_EVT, write value:");
esp_log_buffer_hex(GATTS_TABLE_TAG, param->write.value, param->write.len);
uint16_t descr_value = param->write.value[1]<<8 | param->write.value[0];
if (descr_value == 0x0001){
ESP_LOGI(GATTS_TABLE_TAG, "notify enable");
uint8_t notify_data[1] = {2};
esp_ble_gatts_send_indicate(gatts_if, param->write.conn_id, heart_rate_profile_tab[HEART_PROFILE_APP_IDX].char_handle,
sizeof(notify_data), notify_data, false);
}
break;
But turn out, I did not get any notify from the esp32.
Here is what I got from logging via UART:
Code: Select all
(500) SEC_GATTS_DEMO: app_main init bluetooth
I (540) SEC_GATTS_DEMO: The number handle = 8
I (550) SEC_GATTS_DEMO: advertising start success
I (4810) SEC_GATTS_DEMO: ESP_GATTS_CONNECT_EVT
I (5150) SEC_GATTS_DEMO: remote BD_ADDR: 461b6d87b0ef
I (5150) SEC_GATTS_DEMO: address type = 1
I (5150) SEC_GATTS_DEMO: pair status = success
I (5160) SEC_GATTS_DEMO: Bonded devices number : 1
I (5160) SEC_GATTS_DEMO: Bonded devices list : 1
I (5170) SEC_GATTS_DEMO: 46 1b 6d 87 b0 ef
I (8950) SEC_GATTS_DEMO: ESP_GATTS_WRITE_EVT, write value:
I (8950) SEC_GATTS_DEMO: 00 00
I (10950) SEC_GATTS_DEMO: ESP_GATTS_WRITE_EVT, write value:
I (10950) SEC_GATTS_DEMO: 01 00
I (10950) SEC_GATTS_DEMO: notify enable
I (12850) SEC_GATTS_DEMO: ESP_GATTS_WRITE_EVT, write value:
I (12850) SEC_GATTS_DEMO: 00 00
I (13530) SEC_GATTS_DEMO: ESP_GATTS_WRITE_EVT, write value:
I (13540) SEC_GATTS_DEMO: 01 00
I (13540) SEC_GATTS_DEMO: notify enable
I (14610) SEC_GATTS_DEMO: ESP_GATTS_WRITE_EVT, write value:
I (14610) SEC_GATTS_DEMO: 00 00
I (16460) SEC_GATTS_DEMO: ESP_GATTS_WRITE_EVT, write value:
I (16460) SEC_GATTS_DEMO: 01 00
I (16460) SEC_GATTS_DEMO: notify enable
I (17480) SEC_GATTS_DEMO: ESP_GATTS_WRITE_EVT, write value:
I (17480) SEC_GATTS_DEMO: 00 00
I (18990) SEC_GATTS_DEMO: ESP_GATTS_WRITE_EVT, write value:
I (19000) SEC_GATTS_DEMO: 01 00
I (19000) SEC_GATTS_DEMO: notify enable
I (22260) SEC_GATTS_DEMO: ESP_GATTS_WRITE_EVT, write value:
I (22260) SEC_GATTS_DEMO: 00 00
May thanks.