aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/events/DriverEventHandler.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/events/DriverEventHandler.java')
-rw-r--r--src/org/traccar/events/DriverEventHandler.java19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/org/traccar/events/DriverEventHandler.java b/src/org/traccar/events/DriverEventHandler.java
index 9109373c7..eb5f2a301 100644
--- a/src/org/traccar/events/DriverEventHandler.java
+++ b/src/org/traccar/events/DriverEventHandler.java
@@ -26,12 +26,6 @@ import org.traccar.model.Position;
public class DriverEventHandler extends BaseEventHandler {
- private boolean notRepeat;
-
- public DriverEventHandler() {
- notRepeat = Context.getConfig().getBoolean("event.driver.notRepeat");
- }
-
@Override
protected Collection<Event> analyzePosition(Position position) {
if (!Context.getIdentityManager().isLatestPosition(position)) {
@@ -40,15 +34,12 @@ public class DriverEventHandler extends BaseEventHandler {
String driverUniqueId = position.getString(Position.KEY_DRIVER_UNIQUE_ID);
if (driverUniqueId != null) {
String oldDriverUniqueId = null;
- if (notRepeat) {
- Position lastPosition = Context.getIdentityManager().getLastPosition(position.getDeviceId());
- if (lastPosition != null) {
- oldDriverUniqueId = lastPosition.getString(Position.KEY_DRIVER_UNIQUE_ID);
- }
+ Position lastPosition = Context.getIdentityManager().getLastPosition(position.getDeviceId());
+ if (lastPosition != null) {
+ oldDriverUniqueId = lastPosition.getString(Position.KEY_DRIVER_UNIQUE_ID);
}
- if (!driverUniqueId.equals(oldDriverUniqueId)
- && !Context.getDriversManager().authorizeDriverByUniqueId(driverUniqueId, position.getDeviceId())) {
- Event event = new Event(Event.TYPE_DRIVER_UNAUTHORIZED, position.getDeviceId(), position.getId());
+ if (!driverUniqueId.equals(oldDriverUniqueId)) {
+ Event event = new Event(Event.TYPE_DRIVER_CHANGED, position.getDeviceId(), position.getId());
event.set(Position.KEY_DRIVER_UNIQUE_ID, driverUniqueId);
return Collections.singleton(event);
}