bt_gatt_write_without_response_cb / bt_gatt_notify: how to prevent blocking

Hello,

calls to the above functions block the caller if internal queues become full.  Because my application is running in a big loop, I need those functions without blocking (a specific return code would suffice).

Is there any way to prevent those functions from blocking?  Or is there another non-blocking API doing similar things?

Thanks & regards

Hardy

PS: my current workaround is a small extra thread for packet transmission which is allowed to block (extra buffer, extra stack, extra copy operation).  But this seems to be like using a sledge-hammer to crack a nut

Parents Reply
  • personally I have dealt with the issue by using bt_gatt_notfiy_cb to have a custom function called when the notify completes. That clears a flag to let me know that particular gatt request has completed. The flag is also manually cleared if we have a disconnection event with the peer being notified. Then I basically just don't use bt_gatt_notify_cb if my flag says a gatt request hasn't been resolved - no more issue with blocking.

Children
Related