summaryrefslogtreecommitdiffstatshomepage
path: root/examples/bluetooth/ble_uart_peripheral.py
diff options
context:
space:
mode:
authorAndrew Leech <andrew.leech@planetinnovation.com.au>2020-08-27 09:13:25 +1000
committerDamien George <damien@micropython.org>2020-12-02 14:36:50 +1100
commit1697ff335db523ff0809051d42871beb9c86012d (patch)
tree1728bc84edc6ddf6cb759d575fc5fa604c99b891 /examples/bluetooth/ble_uart_peripheral.py
parent7a9aa49595e1c523a5765397db135ff8f00515b1 (diff)
downloadmicropython-1697ff335db523ff0809051d42871beb9c86012d.tar.gz
micropython-1697ff335db523ff0809051d42871beb9c86012d.zip
extmod/modbluetooth: Allow setting char/desc enc/auth options.
This widens the characteristic/descriptor flags to 16-bit, to allow setting encryption/authentication requirements. Sets the required flags for NimBLE and btstack implementations. The BLE.FLAG_* constants will eventually be deprecated in favour of copy and paste Python constants (like the IRQs). Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'examples/bluetooth/ble_uart_peripheral.py')
-rw-r--r--examples/bluetooth/ble_uart_peripheral.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/examples/bluetooth/ble_uart_peripheral.py b/examples/bluetooth/ble_uart_peripheral.py
index 6d167a871a..b4e352be9f 100644
--- a/examples/bluetooth/ble_uart_peripheral.py
+++ b/examples/bluetooth/ble_uart_peripheral.py
@@ -9,14 +9,17 @@ _IRQ_CENTRAL_CONNECT = const(1)
_IRQ_CENTRAL_DISCONNECT = const(2)
_IRQ_GATTS_WRITE = const(3)
+_FLAG_WRITE = const(0x0008)
+_FLAG_NOTIFY = const(0x0010)
+
_UART_UUID = bluetooth.UUID("6E400001-B5A3-F393-E0A9-E50E24DCCA9E")
_UART_TX = (
bluetooth.UUID("6E400003-B5A3-F393-E0A9-E50E24DCCA9E"),
- bluetooth.FLAG_NOTIFY,
+ _FLAG_NOTIFY,
)
_UART_RX = (
bluetooth.UUID("6E400002-B5A3-F393-E0A9-E50E24DCCA9E"),
- bluetooth.FLAG_WRITE,
+ _FLAG_WRITE,
)
_UART_SERVICE = (
_UART_UUID,