OpenCard Mailing List: Events Humm, perhaps I found you start your program instal listener module and you exit immediately. You surely need a loop to stay in execution... Have a look below... >Hi, > >I have written the following program which traps the events of card >insertion and card removal. >But It does not wait for the events and comes out of the execution. >What could be the problem?? > >The program is, >--------------------------------------------------------------------------- ---------------- > >import opencard.core.event.CTListener; >import opencard.core.event.CardTerminalEvent; >import opencard.core.event.EventGenerator; >import opencard.core.terminal.Slot; >import opencard.core.terminal.CardTerminal; >import opencard.core.service.SmartCard; > >public class Listener implements CTListener > private SmartCard smartcard =null; > private CardTerminal terminal=null; > private int slotID =0; > > public void register() > > try > SmartCard.start(); > EventGenerator.getGenerator().addCTListener(this); > EventGenerator.getGenerator().createEventsForPresentCards(this); > System.out.println( "After Event Generation !!" ); > > } catch ( Exception e > e.printStackTrace( System.err ); > } > } > > public void unregister() > > EventGenerator.getGenerator().removeCTListener(this); > } > > public void cardInserted(CardTerminalEvent event) > > System.out.println( "Card inserted!!" ); > if ( smartcard == null ) > try > smartcard = SmartCard.getSmartCard(event); > } catch ( Exception ee ) > ee.printStackTrace( System.err ); > //handle error... > } > } > } > > public void cardRemoved(CardTerminalEvent event) > > System.out.println( "Card removed!!" ); > > } > > public static void main( String args[] ) > new Listener().register(); Missing something here, like: while (true); or wait for keystroke event too... > } > >} > >--------------------------------------------------------------------------- ------ > >Thanks and regards, >Ashish > --- > 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.
