diff options
author | Jim Mussared <jim.mussared@gmail.com> | 2023-03-02 15:40:59 +1100 |
---|---|---|
committer | Jim Mussared <jim.mussared@gmail.com> | 2023-04-26 11:37:20 +1000 |
commit | bc9ec1cf718361c1f361bb4ff6de3c660d84696d (patch) | |
tree | f4234b532df54ae9577f10cdc5aa385ce97c77d4 /ports/zephyr/modbluetooth_zephyr.c | |
parent | 9e6885ad820a9f42bf93df56eb3f3be0c8639622 (diff) | |
download | micropython-bc9ec1cf718361c1f361bb4ff6de3c660d84696d.tar.gz micropython-bc9ec1cf718361c1f361bb4ff6de3c660d84696d.zip |
extmod/modbluetooth: Merge gatts_notify/indicate implementation.
Makes gatts_notify and gatts_indicate work in the same way: by default they
send the DB value, but you can manually override the payload.
In other words, makes gatts_indicate work the same as gatts_notify.
Note: This removes support for queuing notifications and indications on
btstack when the ACL buffer is full. This functionality will be
reimplemented in a future commit.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'ports/zephyr/modbluetooth_zephyr.c')
-rw-r--r-- | ports/zephyr/modbluetooth_zephyr.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/ports/zephyr/modbluetooth_zephyr.c b/ports/zephyr/modbluetooth_zephyr.c index 4d4b19a1d9..279e4ca9a0 100644 --- a/ports/zephyr/modbluetooth_zephyr.c +++ b/ports/zephyr/modbluetooth_zephyr.c @@ -301,7 +301,7 @@ int mp_bluetooth_gap_disconnect(uint16_t conn_handle) { return MP_EOPNOTSUPP; } -int mp_bluetooth_gatts_read(uint16_t value_handle, uint8_t **value, size_t *value_len) { +int mp_bluetooth_gatts_read(uint16_t value_handle, const uint8_t **value, size_t *value_len) { if (!mp_bluetooth_is_active()) { return ERRNO_BLUETOOTH_NOT_ACTIVE; } @@ -318,21 +318,7 @@ int mp_bluetooth_gatts_write(uint16_t value_handle, const uint8_t *value, size_t return mp_bluetooth_gatts_db_write(MP_STATE_PORT(bluetooth_zephyr_root_pointers)->gatts_db, value_handle, value, value_len); } -int mp_bluetooth_gatts_notify(uint16_t conn_handle, uint16_t value_handle) { - if (!mp_bluetooth_is_active()) { - return ERRNO_BLUETOOTH_NOT_ACTIVE; - } - return MP_EOPNOTSUPP; -} - -int mp_bluetooth_gatts_notify_send(uint16_t conn_handle, uint16_t value_handle, const uint8_t *value, size_t value_len) { - if (!mp_bluetooth_is_active()) { - return ERRNO_BLUETOOTH_NOT_ACTIVE; - } - return MP_EOPNOTSUPP; -} - -int mp_bluetooth_gatts_indicate(uint16_t conn_handle, uint16_t value_handle) { +int mp_bluetooth_gatts_notify_indicate(uint16_t conn_handle, uint16_t value_handle, int gatts_op, const uint8_t *value, size_t value_len) { if (!mp_bluetooth_is_active()) { return ERRNO_BLUETOOTH_NOT_ACTIVE; } |