Yes it takes time for even the peer device to disconnect if I power of ESP32 while it is connected.
Another issue arised. Regarding Connection.
what I want is to start scaning and once connected stop scaning(this is done with in demo) but then After I am done with my device I want to disconnect and start scanning again. which I am able to do anyway. But once the scan duration is complete I don't get any event regarding it and so I am not able to start scanning.
I want to keep scanning for devices until I dont get any. this should always be scanning, or stop only when connected and then restart scaning after disconnected.
here is the serial output from my code after it disconnects its starts scan but after its scan period is finished I don't get any event of it. what should be the event after finish of scan ?
Code: Select all
.[0m
.[0;32mI (48272) GATTC_DEMO: EVT 10, gattc if 3.[0m
.[0;32mI (48272) GATTC_DEMO: NOTIFY: len 3, value 00646e65.[0m
.[0;32mI (48272) BLE_CMD: Commander Here.
.[0m
.[0;32mI (48282) BLE_CMD: data: 101 e .[0m <---my device sends this to indicate end of sending
.[0;32mI (48282) BLE_CMD: data: 110 n .[0m
.[0;32mI (48282) BLE_CMD: data: 100 d .[0m
.[0;32mI (48292) BLE_CMD: Finished Data Tansfer.[0m <-- now here I disconnect with in ESP32
.[0;31mE (48652) BT: gatt_disc_cmpl_cback() - Register for service changed indication failure.[0m
.[0;31mE (48652) BT: bta_gattc_conn_cback() - cif=3 connected=0 conn_id=3 reason=0x0016.[0m
.[0;32mI (48652) GATTC_DEMO: EVT 5, gattc if 3.[0m
.[0;32mI (48662) GATTC_DEMO: ESP_GATTC_CLOSE_EVENT.[0m
.[0;32mI (48662) DEV: Disconnected.[0m
.[0;32mI (48852) GATTC_DEMO: GAP CB EVT: 7.[0m <-- this is SCAN_START_COMPLETE_EVT
.[0;31mE (50272) BT: btm_sec_disconnected clearing pending flag handle:0 reason:22
.[0m
.[0;32mI (50272) GATTC_DEMO: GAP CB EVT: 8.[0m <--ESP_GAP_BLE_AUTH_CMPL_EVT (NRF51 has just works auth)
.[0;32mI (50272) GATTC_DEMO: GAP CB EVT: 8.[0m
.[0;31mE (78852) BT: btc_search_callback BLE observe complete. Num Resp 1 <-- I think its end of Scan duration and it stops
.[0m
.[0;32mI (78852) GATTC_DEMO: GAP CB EVT: 3.[0m
Thanks.