It depends upon whether you're talking about OS 5 or 6.
On OS 5, the normal return value is btLibErrPending. You can't send
another packet until you receive a btLibSocketEventSendComplete (if you
try, you get BtLibErrBusy). You can call BtLibSocketSend() even if you
have no credit. The packet will be held until the credit arrives, then
transmitted, and then you'll get the SendComplete event.
On OS 6, things are different because there is a buffer between your
application and the stack. Although you will get a SendComplete event
for every packet you send, you are not required to wait for that event
before sending another packet. In fact, to improve throughput, you
should not stop sending packets until the difference between the number
of packets sent and the number of SendComplete events exceeds some small
constant. The normal return value is 0; you never get BtLibErrPending.
If you send packets faster than they can be sent over the air, the
buffer will eventually saturate, and BtLibSocketSend() will simply block
until the buffer desaturates. As with OS 5, the stack will not transmit
a packet if it doesn't have the credit, but you don't really have to
worry about it.
>Can I call BtLibSocketSend() even if I run out of credits?
>What status shall this API provide? btLibErrPending?
>So BtLib will automatically send the data once it receive credits from the remote device.
>Just making sure that the assumptions I made is correct. Otherwise I need to poll for outstanding credits before sending data.