Files
micropython/tests/multi_bluetooth/ble_characteristic.py.exp
Jim Mussared e152d0c197 extmod/btstack: Schedule notify/indicate/write ops for bg completion.
The goal of this commit is to allow using ble.gatts_notify() at any time,
even if the stack is not ready to send the notification right now.  It also
addresses the same issue for ble.gatts_indicate() and ble.gattc_write()
(without response).  In addition this commit fixes the case where the
buffer passed to write-with-response wasn't copied, meaning it could be
modified by the caller, affecting the in-progress write.

The changes are:

- gatts_notify/indicate will now run in the background if the ACL buffer is
  currently full, meaning that notify/indicate can be called at any time.

- gattc_write(mode=0) (no response) will now allow for one outstanding
  write.

- gattc_write(mode=1) (with response) will now copy the buffer so that it
  can't be modified by the caller while the write is in progress.

All four paths also now track the buffer while the operation is in
progress, which prevents the GC free'ing the buffer while it's still
needed.
2020-07-18 14:23:47 +10:00

40 lines
882 B
Plaintext

--- instance0 ---
gap_advertise
_IRQ_CENTRAL_CONNECT
_IRQ_GATTS_WRITE b'central0'
gatts_write
gatts_notify
_IRQ_GATTS_WRITE b'central1'
gatts_notify
_IRQ_GATTS_WRITE b'central2'
gatts_write
gatts_indicate
_IRQ_CENTRAL_DISCONNECT
--- instance1 ---
gap_connect
_IRQ_PERIPHERAL_CONNECT
_IRQ_GATTC_CHARACTERISTIC_RESULT UUID128('00000000-1111-2222-3333-444444444444')
gattc_read
_IRQ_GATTC_READ_RESULT b'periph0'
_IRQ_GATTC_READ_DONE 0
gattc_write
_IRQ_GATTC_WRITE_DONE 0
_IRQ_GATTC_NOTIFY b'periph1'
gattc_read
_IRQ_GATTC_READ_RESULT b'periph1'
_IRQ_GATTC_READ_DONE 0
gattc_write
_IRQ_GATTC_WRITE_DONE 0
_IRQ_GATTC_NOTIFY b'periph2'
gattc_read
_IRQ_GATTC_READ_RESULT b'central1'
_IRQ_GATTC_READ_DONE 0
gattc_write
_IRQ_GATTC_WRITE_DONE 0
_IRQ_GATTC_INDICATE b'periph3'
gattc_read
_IRQ_GATTC_READ_RESULT b'periph3'
_IRQ_GATTC_READ_DONE 0
gap_disconnect: True
_IRQ_PERIPHERAL_DISCONNECT