Hi,
I had a similar problem. As I understand OCF, this is due to
the cached ATR value when getCardID is performed. I tried
several things and finally found the following solution
working (however it might not be the best:-), which
can be included in your cardlistener:
public void cardInserted(CardTerminalEvent event)
{
try
{
Slot sl = event.getSlot();
CardTerminal ct = sl.getCardTerminal();
SlotChannel sch = ct.openSlotChannel(sl.getSlotID());
ct.reset(sch, 0);
ct.closeSlotChannel(sch);
}
// handle exceptions
}
If someone has a better solution I would appreciate to
see it!
Regards,
Marko
Jose Miguel Teruel wrote:
>
> I have a problem with OCF when trying to work with differents types of
> cards.
> I want my program to work with a JavaCard.
> When I insert a Card of another type after insert a JavaCard, OCF
> detects that card as a JavaCard and then the program continues.
> When I insert first a non-JavaCard and then insert a JavaCard, the
> program answers that the Card(JavaCard) is a non-JavaCard.
> I think that OCF doesn't reset some parameters and see the Card as the
> first Card inserted.
> I have used the SmartCard.close() method but it seems not to close the
> SmartCard object.
>
> ---
> > 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/
---
> 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/