I've only had limited success with advance credit.
What I've seen is this: when you accept a connection, you pass an initial
amount of credit.
IrConnectRsp(ir_ref, currentCon, &packet, 127); // accept w/ 127 credits
Now, as far as I can tell, you will never need to advance any more credit,
regardless of how much data is sent/received. This has been tested against
PalmOS, Epoc, WinCE, and Win32.
If you accept w/o any credit:
IrConnectRsp(ir_ref, currentCon, &packet, 0);
Then the connection comes up, but the other side will block writing to you
until you advance some credit:
IrAdvanceCredit (currentCon, 127);
At this point, the other side will be able to write data to you. It seems
that once this initial advance is done, no more credit is needed.
This is from my personal observation. I don't bother with it and just
advance 127 on accept.
- John Schettino
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 12, 2001 4:37 AM
To: Palm Developer Forum
Subject: What's with this IrAdvanceCredit thing ?
Hi
I had asked this on comm-dev-forum and got no answer.
Then I asked Palm Developer Support, where I got a nice reference
number but no answer (after more than 3 weeks)
So I'm asking on this forum now, sorry for the inconvenience & this
will be the last time before I decide to change and sell pizzas or
whatever... :)
I would appreciate it if someone could at least point me in the right
direction. (I have read everything I could find, including the Palm
docs and the stuff at irda.org)
==========
So the question is : when using a TinyTP connection, when should
IrAdvanceCredit be called ?
This is totally unclear in the docs.
There's a PowerPoint presentation by Bruce Thompson floating around on
the net, saying that :
- the receiver advances credit to the sender
- IrAdvanceCredit should be called "when buffers become available"
- sending packets consumes credit
Ok, but:
1) when do "buffers become available"? Are these buffers my app's, or
are they internal IR stack buffers? If the latter, how do I know about
their becoming available?
2) The presentation by Bruce Thompson definitely says IrAdvanceCredit
SHOULD be called. But it does not say exactly when:
-do I call it upon sending data ? After or before sending ?
-do I call it on Packet Handled ?
-do I call it upon receiving data ?
3) The credit tells the remote how much packets it can send.
This corresponds to some space I have available for receiving on the
Palm. Who manages this space ? If the IR stack, how do I know how much
space it has ?
4) What are reasonable values for credit?
The doc states that credit should not exceed 127. Is the credit
cumulated every time I call IrAdvanceCredit ? How do I know how much
credit there currently is, so I can be sure not to exceed 127?
5) IrAdvanceCredit is a macro that simply increments availCredit in
the IrConnect structure. Therefore, it cannot really advance the
credit to the remote, as this requires sending a packet over the IR
link.
I have observed this:
-call IrAdvanceCredit
-note that availCredit has been incremented
-give control back to the system
-note that availCredit is now 0 ??
Does that mean that the system polls availCredit and sends an IR
packet behind the scenes when I change it ?
Thanks
Fred
--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/