Bluetooth: CTS: Fix issue with writing without subscription
The write_ct function calls bt_cts_send_notification and if
bt_cts_send_notification fails to send a notification (e.g.
if there are no clients subscribed), it would return an
error, and thus send a ATT error response to the client,
even if the value was actually written.
This commit changes the behavior so that the notification
does not affect the return value (as it is not directly
linked to the write itself), but rather just logs it if
it fails to send the notification.
The notification can failed to be send for 2 main reasons:
1) The application returns an error on fill_current_cts_time
2) bt_gatt_notify fails to notify due to missing buffers
The first we cannot do much about. For the latter we can
either just live with the missing notification, or implement
a retry if we run out of buffers. For this simple fix the
former was chosen, but can be revisited if it turns out
to be a significant problem.
Signed-off-by:
Emil Gydesen <emil.gydesen@nordicsemi.no>
Loading
Please sign in to comment