aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/events
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-07-14 11:59:31 +0500
committerAbyss777 <abyss@fox5.ru>2017-07-14 11:59:31 +0500
commitc0cbde51aa75a5b2df58b11e76527ee703289541 (patch)
tree394e18d9e36c1423843de01a88e290a4d25e099c /src/org/traccar/events
parent9949cadcdf3f07a4590742e2f0303d82efb653f9 (diff)
downloadtraccar-server-c0cbde51aa75a5b2df58b11e76527ee703289541.tar.gz
traccar-server-c0cbde51aa75a5b2df58b11e76527ee703289541.tar.bz2
traccar-server-c0cbde51aa75a5b2df58b11e76527ee703289541.zip
Implement driverChanged event instead of driverUnauthorized
Diffstat (limited to 'src/org/traccar/events')
-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);
}