You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: libs/bluetooth/jswrap_bluetooth.c
+11-2Lines changed: 11 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -644,11 +644,20 @@ specifically for Espruino.
644
644
"class" : "BluetoothDevice",
645
645
"name" : "gattserverdisconnected",
646
646
"params" : [
647
-
["reason","int","The reason code reported back by the BLE stack - see Nordic's `ble_hci.h` file for more information"]
647
+
["reason","int","The reason for the disconnect by the BLE stack - see below"]
648
648
],
649
649
"ifdef" : "NRF52_SERIES"
650
650
}
651
-
Called when the device gets disconnected.
651
+
This is called when the device gets disconnected.
652
+
653
+
Common `reason` values for disconnection are:
654
+
655
+
* 5 - `AUTHENTICATION_FAILURE`
656
+
* 8 - `CONNECTION_TIMEOUT`
657
+
* 19 - `REMOTE_USER_TERMINATED_CONNECTION`
658
+
* 22 - `LOCAL_HOST_TERMINATED_CONNECTION`
659
+
660
+
For a full list see [`BLE_HCI_STATUS_CODES` in `ble_hci.h`](https://github.com/espruino/Espruino/blob/ebf15226b165744ac40d94996698d53da7e03219/targetlibs/nrf5x_12/components/softdevice/s132/headers/ble_hci.h#L52-L121)
652
661
653
662
To connect and then print `Disconnected` when the device is disconnected, just
0 commit comments