Question on apdu.getBuffer() and apdu.setIncomingAndReceive()

Hi,

I have some questions on methods of APDU class.

When we want to receive APDU, we first create a buffer to hold APDU command bytes.

For example: byte[] buf=apdu.getBuffer();

All of the APDU bytes we receive and send are all stored in this byte array.

Another method :apdu.setIncomingAndReceive() is used to recieve APDU and put it in buf[].

So if we want to handle APDU,we should first call this method. Otherwise the APDU in buf[] is still the last reveived APDU but not the current APDU we want to receive.

And we should call this method wherever we want to recieve current APDU.

Am I right?

[652 byte] By [Bobby_SHa] at [2007-11-27 6:40:49]
# 1
Once in the process method, you get hold of the APDU. The buffer contained has just the APDU header (CLA, INS, P1, P2 and Lc). Once you decided what to do (e.g. Lc > 0 --> data) you get the DATA field via setIncomingAndReceive(). Now the buffer will contain the DATA as well.
lexdabeara at 2007-7-12 18:10:12 > top of Java-index,Java Mobility Forums,Consumer and Commerce...