My sample Applet (using Java Plug-in, PC/SC terminal, ocfpcfc1.dll) runs
well on browser.
But after moving another page, it does not work.
Test sequence is as follows:
1) Start up browser(IE 5.5).
2) Open my sample Applet page.
3) Applet works well !
4) Move another page.
5) Return my sample Applet page.
6) Applet does not work. ! Card in/out cannot detect.
The source code of my sample Applet is as follows:
SmartCard card = null;
CardTerminal terminal = null;
int slotID = 0;
PassThruCardService service = null;
CTListener listener = null;
CommandAPDU cmmandAPDU = null;
public void init() {
commandAPDU = new CommandAPDU(256);
}
public void start() {
try {
SmartCard.start();
listener = new CTAdapter();
EventGenerator.getGenerator().addCTListener(listener);
EventGenerator.getGenerator().createEventsForPresentCards(listener);
} catch (...) {
...
}
}
public void stop() {
try {
EventGenerator.getGenerator().removeCTListener(listener);
SmartCard.shutdown();
listener = null;
} catch (...) {
...
}
}
class CTAdapter implements CTListener {
public void cardInserted(CardTerminalEvent event) {
if (card == null) {
try {
CardRequest cr = new
CardRequest(CardRequest.ANYCARD,null,PassThruCardService.class);
card = SmartCard.getSmartCard(event,cr);
terminal = event.getCardTerminal();
slotID = event.getSlotID();
atr = card.getSlotID.getATR();
service =
(PassThruCardService)card.getCardService(PassThruCardService.class,true);
System.out.println("Card in");
} catch (...) {
...
}
}
}
public void cardRemoved(CardTerminalEvent event) {
if (event.getSlotID() == slotID && event.getCardTerminal() == terminal)
{
card = null;
terminal = null;
slotID = null;
service = null;
atr = null;
System.out.println("Card out");
}
}
}
Do you know the reason why my sample Applet dones not work well ?
H.Yasudo
---
> Visit the OpenCard web site at http://www.opencard.org/ for more
> information on OpenCard---binaries, source code, documents.
> This list is being archived at http://www.opencard.org/archive/opencard/
! To unsubscribe from the [EMAIL PROTECTED] mailing list send an email
! to
! [EMAIL PROTECTED]
! containing the word
! unsubscribe
! in the body.