a) The details have been entered correctly (via Bluetooth)
b) The device restarts and the user has viewed the IP address on their phone (via Bluetooth)
c) The device restarts and the user enters a previously known IP address in their browser
I'm using the following code to kill the connection (Not sure every command is necessary but I couldn't find documentation for this):
Code: Select all
Serial.println("BT stopping");
SerialBT.flush();
SerialBT.disconnect();
SerialBT.end();
Serial.println("BT stopped");
BT stopping
[V][BluetoothSerial.cpp:271] esp_spp_cb(): ESP_SPP_WRITE_EVT: 16 FREE
[V][BluetoothSerial.cpp:271] esp_spp_cb(): ESP_SPP_WRITE_EVT: 2 FREE
[BluetoothSerial.cpp:757] disconnect(): disconnecting
[BluetoothSerial.cpp:247] esp_spp_cb(): ESP_SPP_CLOSE_EVT
BT stopped
In the case c I get this:
BT stopping
BT stopped
The difference is that in a and b a callback has been called. For example b where the user has connected and has been sent the IP address looks like this:
Code: Select all
void callback_show_ip(esp_spp_cb_event_t event, esp_spp_cb_param_t *param)
{
if (event == ESP_SPP_SRV_OPEN_EVT) {
SerialBT.println("Device IP: ");
SerialBT.println(WiFi.localIP());
}
}
So... the question is. Why don't I see the 'ESP_SPP_CLOSE_EVT' message when I close a Bluetooth connection that hasn't been used?