nimble: Indicating a characteristic will also send indications for other characteristics.
Related to the send_update arg added to ble.gatts_write in #7564.
The following code on a server (with a connected but unsubscribed client) results in the client receiving an indication for both characteristics.
ble.gatts_write(first_char_handle, "value", True) # (1)
ble.gatts_write(second_char_handle, "value", False)
ble.gatts_indicate(conn_handle, second_char_handle) # (2)
I would expect:
- (1) should not be sent to an unsubscribed client.
- (2) should only trigger an indication for
second_char_handle(regardless of subscription state).
It's not obvious to me that this is being caused by modbluetooth.c / modbluetooth_nimble.c, so might need to investigate in NimBLE (or confirm that this is the expected behaviour). I don't see this for notify, only indicate.
extmod/modbluetooth: Add send_update arg to gatts_write.
This allows a server to automatically notify/indicate subscribed clients on characteristic writes.
WIP: Needs btstack support and multi-tests. btstack support will take more work because we need to manage the CCCD state ourselves.
Related to #6848 #7555 https://github.com/micropython/micropython-lib/pull/436 @andrewleech @MarceauFillon