I have a problem that confused me for couple of day. I want to send out a data with size bigger than 255 bytes from smartcard to host application. I saw a block of code in some website. this code is like bellow:
private void sendData(APDU apdu) {
// work out how many bytes to send this time and how many will be left
BUF_IN_OFFSET[0] = 0;
short remain = (short) ((short)372 - BUF_IN_OFFSET[0]);
boolean chain = remain > MAX_APDU;
short sendLen = chain ? MAX_APDU : remain;
Util.arrayCopy(data, (short) 0, apdu.getBuffer(), (short) 0, sendLen);
// Get ready to send
apdu.setOutgoing();
apdu.setOutgoingLength((short)sendLen);
apdu.sendBytesLong(apdu.getBuffer(), BUF_IN_OFFSET[0], sendLen);
// Check to see if there are more APDU's to send
if (chain) {
BUF_IN_OFFSET[0] += sendLen; // count the bytes sent
remain -=sendLen;
ISOException.throwIt((short)((ISO7816.SW_BYTES_REMAINING_00) + remain));
} else {
BUF_IN_OFFSET[0] = 0; // no more bytes to send
}
}
When i send apdu to the card in netbeans simulator, it send 6100 correctly. but when i send it to real card (smartcafe 3.2) card. it send for me 9000. it means in simulator it works but by real card it doesn't work. I guess it related to protocol T=0 or T=1. I didn't find any code for T=1. above code is for T=0.
thanks in advance.