]> granicus.if.org Git - esp-idf/commitdiff
gatts_demo: re-enter advertising after client disconnects
authorMike Ryan <mikeryan@lacklustre.net>
Thu, 12 Jan 2017 00:40:37 +0000 (16:40 -0800)
committerAngus Gratton <angus@espressif.com>
Fri, 20 Jan 2017 03:57:41 +0000 (14:57 +1100)
In the existing tree, after a connected client disconnects the device
will never re-enter the advertising state. Additional clients will not
be able to discover or connect to the device. This patch forces the
device back into the advertising state upon disconnection.

Resolves Pull Request #217 https://github.com/espressif/esp-idf/pull/217

examples/bluetooth/gatt_server/main/gatts_demo.c

index 11b3da64738315956f031d811b1428ad75a01f59..a018ddb7526a2b0466bc08e03bf15e49fc3f25be 100644 (file)
@@ -250,6 +250,8 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
         gl_profile_tab[PROFILE_A_APP_ID].conn_id = param->connect.conn_id;
         break;
     case ESP_GATTS_DISCONNECT_EVT:
+        esp_ble_gap_start_advertising(&test_adv_params);
+        break;
     case ESP_GATTS_OPEN_EVT:
     case ESP_GATTS_CANCEL_OPEN_EVT:
     case ESP_GATTS_CLOSE_EVT: