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
*`id` Only one Bluetooth peripheral available so must always be 0
66
-
*`mode` currently the only supported mode is `Bluetooth.BLE`
67
-
*`modem_sleep` Enables or Disables BLE modem sleep, Disable modem sleep as a workaround when having Crashes due to flash cache being disabled, as this prevents BLE task saving data in external RAM while accesing external flash for R/W
68
-
*`antenna` selects between the internal and the external antenna. Can be either `Bluetooth.INT_ANT`, `Bluetooth.EXT_ANT`
69
-
*`secure` enables or disables the GATT Server security features
70
-
*`pin` a six digit number to connect to the GATT Sever
65
+
*`id` Only one Bluetooth peripheral available so must always be 0.
66
+
*`mode` currently the only supported mode is `Bluetooth.BLE`.
67
+
*`antenna` selects between the internal and the external antenna. Can be either `Bluetooth.INT_ANT`, `Bluetooth.EXT_ANT`.
68
+
*`modem_sleep` Enables or Disables BLE modem sleep, Disable modem sleep as a workaround when having Crashes due to flash cache being disabled, as this prevents BLE task saving data in external RAM while accesing external flash for R/W.
69
+
*`pin` a one to six digit number (`0`-`9`) to connect to the GATT Sever. Setting any valid pin, GATT Server security features are activated.
70
+
*`privacy` Enables or Disables local privacy settings so address will be random or public.
71
+
*`secure_connections` Enables or Disables Secure Connections and MITM Protection.
72
+
*`mtu` Maximum Transmission Unit (MTU) is the maximum length of an ATT packet. Value must be between `23` and `200`.
71
73
72
-
With our development boards it defaults to using the internal antenna, but in the case of an OEM module, the antenna pin (`P12`) is not used, so it's free to be used for other things.
74
+
With our development boards it defaults to using the internal antenna, but in the case of an OEM module, the antenna pin (`P12`) is not used, so it's free to be used for other things.
73
75
74
76
Initialises and enables the Bluetooth radio in BLE mode.
75
77
@@ -156,6 +158,10 @@ while bluetooth.isscanning():
156
158
print(ubinascii.hexlify(mfg_data))
157
159
```
158
160
161
+
#### bluetooth.set\_pin()
162
+
163
+
Configures a new PIN to be used by the device. The PIN is a 1-6 digit length decimal number, if less than 6 digits are given the missing leading digits are considered as 0. E.g. 1234 becomes 001234. When a new PIN is configured, the information of all previously bonded device is removed and the current connection is terminated. To restart advertisement the advertise() must be called after PIN is changed.
164
+
159
165
#### bluetooth.connect(mac\_addr, timeout=None)
160
166
161
167
*`mac_addr` is the address of the remote device to connect
Copy file name to clipboardExpand all lines: content/firmwareapi/pycom/network/bluetooth/gattsservice.md
+1-2Lines changed: 1 addition & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,12 +27,11 @@ Stops the service if previously started.
27
27
Creates a new characteristic on the service. Returns an object of the class `GATTSCharacteristic`. The arguments are:
28
28
29
29
*`uuid` is the UUID of the service. Can take an integer or a 16 byte long string or bytes object.
30
-
*`permissions` configures the permissions of the characteristic. Takes an integer with a combination of the flags.
30
+
*`permissions` configures the permissions of the characteristic. Takes an integer with a combination of the flags. When bluetooth object is initialized with PIN, read and write permissions are set to encrypted. Setting PIN later with set_pin() call does not affect the permissions of the already existing characteristics, thus they will remain not secured.
31
31
*`properties` sets the properties. Takes an integer with an OR-ed combination of the flags.
32
32
*`value` sets the initial value. Can take an integer, a string or a bytes object.
0 commit comments