summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2020-11-24 23:09:10 +1100
committerDamien George <damien@micropython.org>2020-12-02 14:39:17 +1100
commit5e20f689ada17dcd750d516c957115fbb36c9435 (patch)
treee62d441aa1af425966bfa2fde2f2502dd052c2b9
parent60830bcba46dd649e396b605708274a2208c398d (diff)
docs/library/ubluetooth.rst: Update read request IRQ docs.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
-rw-r--r--docs/library/ubluetooth.rst17
1 files changed, 14 insertions, 3 deletions
diff --git a/docs/library/ubluetooth.rst b/docs/library/ubluetooth.rst
index 434759b43..f65020d2a 100644
--- a/docs/library/ubluetooth.rst
+++ b/docs/library/ubluetooth.rst
@@ -119,9 +119,9 @@ Event Handling
# A client has written to this characteristic or descriptor.
conn_handle, attr_handle = data
elif event == _IRQ_GATTS_READ_REQUEST:
- # A client has issued a read. Note: this is a hard IRQ.
- # Return None to deny the read.
- # Note: This event is not supported on ESP32.
+ # A client has issued a read. Note: this is only supported on STM32.
+ # Return a non-zero integer to deny the read (see below), or zero (or None)
+ # to accept the read.
conn_handle, attr_handle = data
elif event == _IRQ_SCAN_RESULT:
# A single scan result.
@@ -234,6 +234,15 @@ The event codes are::
_IRQ_L2CAP_SEND_READY = const(26)
_IRQ_CONNECTION_UPDATE = const(27)
+For the ``_IRQ_GATTS_READ_REQUEST`` event, the available return codes are::
+
+ _GATTS_NO_ERROR = const(0x00)
+ _GATTS_ERROR_READ_NOT_PERMITTED = const(0x02)
+ _GATTS_ERROR_WRITE_NOT_PERMITTED = const(0x03)
+ _GATTS_ERROR_INSUFFICIENT_AUTHENTICATION = const(0x05)
+ _GATTS_ERROR_INSUFFICIENT_AUTHORIZATION = const(0x08)
+ _GATTS_ERROR_INSUFFICIENT_ENCRYPTION = const(0x0f)
+
In order to save space in the firmware, these constants are not included on the
:mod:`ubluetooth` module. Add the ones that you need from the list above to your
program.
@@ -420,6 +429,8 @@ writes from a client to a given characteristic, use
_FLAG_WRITE_AUTHENTICATED = const(0x2000)
_FLAG_WRITE_AUTHORIZED = const(0x4000)
+ As for the IRQs above, any required constants should be added to your Python code.
+
.. method:: BLE.gatts_read(value_handle, /)
Reads the local value for this handle (which has either been written by