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
  • I have been debugging essentially the same problem, and have considered the same workaround of a small extra thread. Does that workaround perform well for you?

    On my end, I have a custom service providing something that a subscriber can be notified about new values for.
    I have my main thread try to notify every 250ms if anyone is connected and subscribed. This usually works ok, until the connection fails. If I allow the connecting device to subscribe and then reduce the signal power (physically block it) then I can fairly reliably get the main thread of the notifying device to block for several seconds.

Reply
  • I have been debugging essentially the same problem, and have considered the same workaround of a small extra thread. Does that workaround perform well for you?

    On my end, I have a custom service providing something that a subscriber can be notified about new values for.
    I have my main thread try to notify every 250ms if anyone is connected and subscribed. This usually works ok, until the connection fails. If I allow the connecting device to subscribe and then reduce the signal power (physically block it) then I can fairly reliably get the main thread of the notifying device to block for several seconds.

Children
Related