diff --git a/tests/multi_bluetooth/ble_characteristic.py b/tests/multi_bluetooth/ble_characteristic.py index 327822a01e..492f59dbd4 100644 --- a/tests/multi_bluetooth/ble_characteristic.py +++ b/tests/multi_bluetooth/ble_characteristic.py @@ -23,7 +23,11 @@ SERVICE_UUID = bluetooth.UUID("A5A5A5A5-FFFF-9999-1111-5A5A5A5A5A5A") CHAR_UUID = bluetooth.UUID("00000000-1111-2222-3333-444444444444") CHAR = ( CHAR_UUID, - bluetooth.FLAG_READ | bluetooth.FLAG_WRITE | bluetooth.FLAG_NOTIFY | bluetooth.FLAG_INDICATE, + bluetooth.FLAG_READ + | bluetooth.FLAG_WRITE + | bluetooth.FLAG_WRITE_NO_RESPONSE + | bluetooth.FLAG_NOTIFY + | bluetooth.FLAG_INDICATE, ) SERVICE = ( SERVICE_UUID, @@ -125,6 +129,13 @@ def instance0(): ble.gatts_indicate(conn_handle, char_handle) wait_for_event(_IRQ_GATTS_INDICATE_DONE, TIMEOUT_MS) + # D + # Wait for a write to the characteristic from the central, + # then reply with no-payload notification. + wait_for_event(_IRQ_GATTS_WRITE, TIMEOUT_MS) + print("gatts_notify") + ble.gatts_notify(conn_handle, char_handle) + # Wait for the central to disconnect. wait_for_event(_IRQ_CENTRAL_DISCONNECT, TIMEOUT_MS) finally: @@ -180,6 +191,11 @@ def instance1(): ble.gattc_read(conn_handle, value_handle) wait_for_event(_IRQ_GATTC_READ_RESULT, TIMEOUT_MS) + # Write-without-response, which will trigger another notification with that value. + ble.gattc_write(conn_handle, value_handle, "central3", 0) + # D + wait_for_event(_IRQ_GATTC_NOTIFY, TIMEOUT_MS) + # Disconnect from peripheral. print("gap_disconnect:", ble.gap_disconnect(conn_handle)) wait_for_event(_IRQ_PERIPHERAL_DISCONNECT, TIMEOUT_MS) diff --git a/tests/multi_bluetooth/ble_characteristic.py.exp b/tests/multi_bluetooth/ble_characteristic.py.exp index 31667415ee..e4c9f1a57e 100644 --- a/tests/multi_bluetooth/ble_characteristic.py.exp +++ b/tests/multi_bluetooth/ble_characteristic.py.exp @@ -10,6 +10,8 @@ _IRQ_GATTS_WRITE b'central2' gatts_write gatts_indicate _IRQ_GATTS_INDICATE_DONE 0 +_IRQ_GATTS_WRITE b'central3' +gatts_notify _IRQ_CENTRAL_DISCONNECT --- instance1 --- gap_connect @@ -37,5 +39,6 @@ _IRQ_GATTC_INDICATE b'periph3' gattc_read _IRQ_GATTC_READ_RESULT b'periph3' _IRQ_GATTC_READ_DONE 0 +_IRQ_GATTC_NOTIFY b'central3' gap_disconnect: True _IRQ_PERIPHERAL_DISCONNECT