Using an Android app called Serial Bluetooth Terminal, I'm able to get a string sent by ESP32. But when I want to send something from the phone, I always get a pairing prompt and then disconnect.
Here're the log:
[ 17356][D][BLEDevice.cpp:102] gattServerEventHandler(): gattServerEventHandler [esp_gatt_if: 3] ... ESP_GATTS_CONNECT_EVT
[ 17357][D][BLEServer.cpp:366] onConnect(): BLEServerCallbacks
[ 17361][D][BLEServer.cpp:367] onConnect(): BLEServerCallbacks
[ 17367][D][BLEServer.cpp:368] onConnect(): BLEServerCallbacks
[ 17761][D][BLEDevice.cpp:579] getAdvertising(): get advertising
[ 17761][D][BLEAdvertising.cpp:506] handleGAPEvent(): handleGAPEvent [event no: 20]
[ 17978][D][BLEDevice.cpp:102] gattServerEventHandler(): gattServerEventHandler [esp_gatt_if: 3] ... ESP_GATTS_MTU_EVT
[ 17978][D][BLEServer.cpp:385] onMtuChanged(): BLEServerCallbacks
[ 17983][D][BLEServer.cpp:386] onMtuChanged(): BLEServerCallbacks
[ 17989][D][BLEServer.cpp:387] onMtuChanged(): BLEServerCallbacks
[ 18000][D][BLEDevice.cpp:102] gattServerEventHandler(): gattServerEventHandler [esp_gatt_if: 3] ... ESP_GATTS_WRITE_EVT
[ 18005][D][BLEDescriptor.cpp:240] setValue(): Set the value in the GATTS database using handle 0x2e
[ 18014][D][BLEDevice.cpp:102] gattServerEventHandler(): gattServerEventHandler [esp_gatt_if: 3] ... ESP_GATTS_SET_ATTR_VAL_EVT
[ 18030][D][BLEDevice.cpp:579] getAdvertising(): get advertising
[ 18031][D][BLEAdvertising.cpp:506] handleGAPEvent(): handleGAPEvent [event no: 20]
E (28928) BT_GATT: gatts_write_attr_perm_check - GATT_INSUF_AUTHENTICATION
[ 28740][I][BLEDevice.cpp:222] gapEventHandler(): ESP_GAP_BLE_SEC_REQ_EVT
[ 28740][D][BLEDevice.cpp:579] getAdvertising(): get advertising
[ 28741][D][BLEAdvertising.cpp:506] handleGAPEvent(): handleGAPEvent [event no: 10]
[ 34727][D][BLEDevice.cpp:247] gapEventHandler(): ESP_GAP_BLE_KEY_EVT
[ 34727][I][BLEDevice.cpp:249] gapEventHandler(): key type = ESP_LE_KEY_LENC
[ 34729][D][BLEDevice.cpp:579] getAdvertising(): get advertising
[ 34734][D][BLEAdvertising.cpp:506] handleGAPEvent(): handleGAPEvent [event no: 9]
[ 34742][D][BLEDevice.cpp:247] gapEventHandler(): ESP_GAP_BLE_KEY_EVT
[ 34748][I][BLEDevice.cpp:249] gapEventHandler(): key type = ESP_LE_KEY_PENC
[ 34754][D][BLEDevice.cpp:579] getAdvertising(): get advertising
[ 34760][D][BLEAdvertising.cpp:506] handleGAPEvent(): handleGAPEvent [event no: 9]
[ 34768][D][BLEDevice.cpp:247] gapEventHandler(): ESP_GAP_BLE_KEY_EVT
[ 34774][I][BLEDevice.cpp:249] gapEventHandler(): key type = ESP_LE_KEY_LID
[ 34780][D][BLEDevice.cpp:579] getAdvertising(): get advertising
[ 34786][D][BLEAdvertising.cpp:506] handleGAPEvent(): handleGAPEvent [event no: 9]
[ 34793][D][BLEDevice.cpp:247] gapEventHandler(): ESP_GAP_BLE_KEY_EVT
[ 34800][I][BLEDevice.cpp:249] gapEventHandler(): key type = ESP_LE_KEY_LCSRK
[ 34806][D][BLEDevice.cpp:579] getAdvertising(): get advertising
[ 34812][D][BLEAdvertising.cpp:506] hE (35095) BT_SMP: smp_calculate_link_key_from_long_term_key failed to update link_key. Sec Mode = 2, sm4 = 0x00
E (35104) BT_SMP: smp_derive_link_key_from_long_term_key failed
/* here pairing prompt shows on my phone */
E (35111) BT_BTM: btm_proc_smp_cback received for unknown device
andleGAPEvent(): handleGAPEvent [event no: 9]
[ 34841][D][BLEDevice.cpp:247] gapEventHandler(): ESP_GAP_BLE_KEY_EVT
[ 34847][I][BLEDevice.cpp:249] gapEventHandler(): key type = ESP_LE_KEY_PID
[ 34854][D][BLEDevice.cpp:579] getAdvertising(): get advertising
[ 34859][D][BLEAdvertising.cpp:506] handleGAPEvent(): handleGAPEvent [event no: 9]
[ 34867][D][BLEDevice.cpp:247] gapEventHandler(): ESP_GAP_BLE_KEY_EVT
[ 34873][I][BLEDevice.cpp:249] gapEventHandler(): key type = ESP_LE_KEY_PCSRK
[ 34880][D][BLEDevice.cpp:579] getAdvertising(): get advertising
[ 34885][D][BLEAdvertising.cpp:506] handleGAPEvent(): handleGAPEvent [event no: 9]
[ 34894][I][BLEDevice.cpp:253] gapEventHandler(): ESP_GAP_BLE_AUTH_CMPL_EVT
[ 34899][D][BLEDevice.cpp:579] getAdvertising(): get advertising
[ 34905][D][BLEAdvertising.cpp:506] handleGAPEvent(): handleGAPEvent [event no: 8]
[ 37833][D][BLEDevice.cpp:102] gattServerEventHandler(): gattServerEventHandler [esp_gatt_if: 3] ... ESP_GATTS_DISCONNECT_EVT
[ 37834][D][BLEDevice.cpp:579] getAdvertising(): get advertising
[ 37839][D][BLEAdvertising.cpp:199] start(): - advertising service: 6e400001-b5a3-f393-e0a9-e50e24dcca9e
[ 37849][D][BLEServer.cpp:379] onDisconnect(): BLEServerCallbacks
[ 37854][D][BLEServer.cpp:380] onDisconnect(): BLEServerCallbacks
[ 37860][D][BLEServer.cpp:381] onDisconnect(): BLEServerCallbacks
[ 37869][D][BLEDevice.cpp:579] getAdvertising(): get advertising
[ 37872][D][BLEAdvertising.cpp:506E (38153) BT_BTM: Device not found
Using an Android app called Serial Bluetooth Terminal, I'm able to get a string sent by ESP32. But when I want to send something from the phone, I always get a pairing prompt and then disconnect.
Here're the log: