|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--opencard.core.event.EventGenerator
The EventGenerator singleton acts as a generator and multicaster for card terminal events. The singleton instance can be obtained by calling the static method getGenerator. It periodically polls the terminals and generates CARD_INSERTED or CARD_REMOVED events if it detects a card insertion or removal, respectively. The generated events are sent to all CTListeners which have been registered using the method addCTListener. If not interested in card terminal events any longer, CTListeners can remove themselves from the notification list of the registry by calling the method removeCTListener. For the case that cards were inserted before an application was started, the method createEventsForPresentCards creates events for inserted cards a posteriori.
CardTerminalEvent
,
CTListener
,
CardTerminal
,
CardTerminalRegistry
Method Summary | |
void |
addCTListener(CTListener listener)
Adds a CTListener. |
void |
createEventsForPresentCards(CTListener ctListener)
Generates events for cards which are already inserted. |
static EventGenerator |
getGenerator()
Gets the unique instance of CardTerminalRegistry. |
int |
getPollInterval()
Gets the duration of the poll interval in ms. |
void |
removeCTListener(CTListener ctListener)
Removes a CTListener. |
void |
run()
Periodically checks all Pollable terminals. |
void |
setPollInterval(int duration)
Sets the poll interval in ms |
void |
updateCards(CardTerminal terminal,
int slotID,
boolean cardInserted)
Notify listeners that a card was inserted into or removed from a slot of a terminal. |
boolean |
updateTerminals(Pollable p,
boolean terminalAdded)
. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Method Detail |
public static EventGenerator getGenerator()
public void addCTListener(CTListener listener)
listener
- The CTListener to be added.removeCTListener(CTListener)
public void createEventsForPresentCards(CTListener ctListener) throws CardTerminalException
ctListener
- the Card Terminal Listener to which the events shall be sent.public void removeCTListener(CTListener ctListener)
listener
- The CTListener to be removed.addCTListener(CTListener)
public void setPollInterval(int duration)
public int getPollInterval()
public void run()
public void updateCards(CardTerminal terminal, int slotID, boolean cardInserted)
terminal
- terminal where a card was inserted/removedslot
- slot where a card was inserted/removedcardInserted
- true if a card was inserted, false, if a card was removedpublic boolean updateTerminals(Pollable p, boolean terminalAdded)
p
- terminal that was added/removed to the registryterminalAdded
- true if a terminal was added. False,
if a terminal was removed.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |