public abstract class AbstractEventHandler extends java.lang.Object implements AccessControlEventHandler, AccessModuleEventHandler, AlertEventHandler, BasicEventHandler, DoorEventHandler, LedEventHandler, ScanEventHandler, TemperatureEventHandler, ScaleEventHandler
Abstract class which implements all event handlers. Provide a convenient way to handle few events of different interfaces by creating an anonymous class.
Example:
Device remoteDev = new TcpDevice("192.168.1.10");
remoteDev.addListener(new AbstractEventHandler()
{
// from ScanEventHandler
@Override
public void scanCompleted()
{
// ask to light all the tags detected during the last scan
remoteDev.startLightingTagsLed(_currentDevice.getLastInventory().getTagsAll());
}
// from LedEventHandler
@Override
public void lightingStarted(List missingTags)
{
System.out.println("Lighting started!");
// print the UID of tags which could not be lighted
for(String uid : missingTags)
{
System.out.println("- "+ uid);
}
}
});
NB: Some of the most famous IDE's (like Intellij IDEA or Eclipse) automatically asks for the methods to override when creating an anonymous class.
Constructor and Description |
---|
AbstractEventHandler() |
Modifier and Type | Method and Description |
---|---|
void |
alertRaised(Alert alert,
java.lang.String extraData) |
void |
authenticationFailure(AuthenticationModule authModule,
User user)
Called when a user has failed authenticating himself (insufficient permissions).
|
void |
authenticationSuccess(AuthenticationModule authModule,
User user)
Called when a user has been successfully authenticated.
|
void |
badgeReaderConnected(boolean isMaster)
A badge reader has been successfully initialized.
|
void |
badgeReaderDisconnected(boolean isMaster)
A badge reader has been disconnected (serial port connection lost).
|
void |
badgeScanned(java.lang.String badgeNumber)
A badge has been scanned.
|
void |
deviceDisconnected()
Called when the device has lost the connection to its RFID board.
|
void |
deviceStatusChanged(DeviceStatus status)
Called when the device status has changed (see
DeviceStatus ). |
void |
doorClosed()
Called when a door has been closed.
|
void |
doorOpenDelay()
Called when a door has been open for too long.
|
void |
doorOpened()
Called when a door has been open.
|
void |
fingerprintEnrollmentSample(byte sampleNumber)
A new fingerprint sample has bene obtained during an Enrollment process.
|
void |
fingerTouched(boolean isMaster)
A fingerprint reader has been touched.
|
void |
lightingStarted(java.util.List<java.lang.String> tagsLeft)
Called when the tags-lighting process has started.
|
void |
lightingStopped()
The tags-lighting process has stopped.
|
void |
scanCancelledByDoor()
Called when a scan has been cancelled by a door opening.
|
void |
scanCancelledByHost()
Called when a scan has been cancelled by user.
|
void |
scanCompleted()
Called when a scan is completed.
|
void |
scanFailed()
Called when a scan failed.
|
void |
scanStarted()
Called when a scan just starts.
|
void |
tagAdded(java.lang.String tagUid)
Called when a tag is detected (during a scan process).
|
void |
temperatureMeasure(double value)
Called when a new temperature measurement has been made.
|
void |
weightMeasure(ScaleMeasure measure)
Called when a new weight measure has been sent by the scale.
|
public void scanStarted()
ScanEventHandler
scanStarted
in interface ScanEventHandler
public void scanCompleted()
ScanEventHandler
scanCompleted
in interface ScanEventHandler
public void tagAdded(java.lang.String tagUid)
ScanEventHandler
tagAdded
in interface ScanEventHandler
tagUid
- Tag unique identifier.public void scanFailed()
ScanEventHandler
scanFailed
in interface ScanEventHandler
public void scanCancelledByHost()
ScanEventHandler
scanCancelledByHost
in interface ScanEventHandler
public void authenticationSuccess(AuthenticationModule authModule, User user)
AccessControlEventHandler
authenticationSuccess
in interface AccessControlEventHandler
authModule
- Instance of AuthenticationModule
allowing the access.user
- User instance.public void authenticationFailure(AuthenticationModule authModule, User user)
AccessControlEventHandler
authenticationFailure
in interface AccessControlEventHandler
authModule
- Instance of AuthenticationModule
denying the access.user
- User instance.public void badgeReaderConnected(boolean isMaster)
AccessModuleEventHandler
badgeReaderConnected
in interface AccessModuleEventHandler
isMaster
- If true, event comes from Master badge reader. Otherwise, from the slave.public void badgeReaderDisconnected(boolean isMaster)
AccessModuleEventHandler
badgeReaderDisconnected
in interface AccessModuleEventHandler
isMaster
- If true, event comes from Master badge reader. Otherwise, from the slave.public void badgeScanned(java.lang.String badgeNumber)
AccessModuleEventHandler
badgeScanned
in interface AccessModuleEventHandler
badgeNumber
- Unique identifier of the badge scanned.public void fingerTouched(boolean isMaster)
AccessModuleEventHandler
fingerTouched
in interface AccessModuleEventHandler
isMaster
- If true, event comes from Master fingerprint reader. Otherwise, from the slave.public void fingerprintEnrollmentSample(byte sampleNumber)
AccessModuleEventHandler
fingerprintEnrollmentSample
in interface AccessModuleEventHandler
public void alertRaised(Alert alert, java.lang.String extraData)
alertRaised
in interface AlertEventHandler
public void deviceDisconnected()
BasicEventHandler
deviceDisconnected
in interface BasicEventHandler
public void deviceStatusChanged(DeviceStatus status)
BasicEventHandler
DeviceStatus
).deviceStatusChanged
in interface BasicEventHandler
status
- New status.public void scanCancelledByDoor()
DoorEventHandler
scanCancelledByDoor
in interface DoorEventHandler
public void doorOpened()
DoorEventHandler
doorOpened
in interface DoorEventHandler
public void doorClosed()
DoorEventHandler
doorClosed
in interface DoorEventHandler
public void doorOpenDelay()
DoorEventHandler
doorOpenDelay
in interface DoorEventHandler
public void lightingStarted(java.util.List<java.lang.String> tagsLeft)
LedEventHandler
lightingStarted
in interface LedEventHandler
tagsLeft
- UID's of tags which could not be lighted.public void lightingStopped()
LedEventHandler
lightingStopped
in interface LedEventHandler
public void temperatureMeasure(double value)
TemperatureEventHandler
temperatureMeasure
in interface TemperatureEventHandler
public void weightMeasure(ScaleMeasure measure)
ScaleEventHandler
weightMeasure
in interface ScaleEventHandler