Skip to content

Commit e52996c

Browse files
committed
docs
1 parent ebf1522 commit e52996c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

libs/bluetooth/jswrap_bluetooth.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -644,11 +644,20 @@ specifically for Espruino.
644644
"class" : "BluetoothDevice",
645645
"name" : "gattserverdisconnected",
646646
"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"]
648648
],
649649
"ifdef" : "NRF52_SERIES"
650650
}
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)
652661
653662
To connect and then print `Disconnected` when the device is disconnected, just
654663
do the following:

0 commit comments

Comments
 (0)