aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/model
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/model')
-rw-r--r--src/org/traccar/model/DeviceState.java10
-rw-r--r--src/org/traccar/model/Event.java10
-rw-r--r--src/org/traccar/model/Geofence.java4
-rw-r--r--src/org/traccar/model/Maintenance.java61
-rw-r--r--src/org/traccar/model/Position.java9
-rw-r--r--src/org/traccar/model/User.java12
6 files changed, 98 insertions, 8 deletions
diff --git a/src/org/traccar/model/DeviceState.java b/src/org/traccar/model/DeviceState.java
index f2d0ff614..75d6726ee 100644
--- a/src/org/traccar/model/DeviceState.java
+++ b/src/org/traccar/model/DeviceState.java
@@ -58,4 +58,14 @@ public class DeviceState {
return overspeedPosition;
}
+ private long overspeedGeofenceId;
+
+ public void setOverspeedGeofenceId(long overspeedGeofenceId) {
+ this.overspeedGeofenceId = overspeedGeofenceId;
+ }
+
+ public long getOverspeedGeofenceId() {
+ return overspeedGeofenceId;
+ }
+
}
diff --git a/src/org/traccar/model/Event.java b/src/org/traccar/model/Event.java
index 465afeb35..ee7fcc679 100644
--- a/src/org/traccar/model/Event.java
+++ b/src/org/traccar/model/Event.java
@@ -91,4 +91,14 @@ public class Event extends Message {
this.geofenceId = geofenceId;
}
+ private long maintenanceId = 0;
+
+ public long getMaintenanceId() {
+ return maintenanceId;
+ }
+
+ public void setMaintenanceId(long maintenanceId) {
+ this.maintenanceId = maintenanceId;
+ }
+
}
diff --git a/src/org/traccar/model/Geofence.java b/src/org/traccar/model/Geofence.java
index 7042325dc..8560d22e9 100644
--- a/src/org/traccar/model/Geofence.java
+++ b/src/org/traccar/model/Geofence.java
@@ -65,7 +65,9 @@ public class Geofence extends ScheduledModel {
} else if (area.startsWith("POLYGON")) {
geometry = new GeofencePolygon(area);
} else if (area.startsWith("LINESTRING")) {
- geometry = new GeofencePolyline(area, Context.getConfig().getDouble("geofence.polylineDistance", 25));
+ final double distance = getDouble("polylineDistance");
+ geometry = new GeofencePolyline(area, distance > 0 ? distance
+ : Context.getConfig().getDouble("geofence.polylineDistance", 25));
} else {
throw new ParseException("Unknown geometry type", 0);
}
diff --git a/src/org/traccar/model/Maintenance.java b/src/org/traccar/model/Maintenance.java
new file mode 100644
index 000000000..73f67ea96
--- /dev/null
+++ b/src/org/traccar/model/Maintenance.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2018 Andrey Kunitsyn (andrey@traccar.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.traccar.model;
+
+public class Maintenance extends ExtendedModel {
+
+ private String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ private String type;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ private double start;
+
+ public double getStart() {
+ return start;
+ }
+
+ public void setStart(double start) {
+ this.start = start;
+ }
+
+ private double period;
+
+ public double getPeriod() {
+ return period;
+ }
+
+ public void setPeriod(double period) {
+ this.period = period;
+ }
+
+}
diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java
index 49e3231c3..4b327cbd2 100644
--- a/src/org/traccar/model/Position.java
+++ b/src/org/traccar/model/Position.java
@@ -39,6 +39,7 @@ public class Position extends Message {
public static final String KEY_ODOMETER_TRIP = "tripOdometer"; // meters
public static final String KEY_HOURS = "hours";
public static final String KEY_STEPS = "steps";
+ public static final String KEY_HEART_RATE = "heartRate";
public static final String KEY_INPUT = "input";
public static final String KEY_OUTPUT = "output";
public static final String KEY_IMAGE = "image";
@@ -51,6 +52,7 @@ public class Position extends Message {
public static final String KEY_BATTERY = "battery"; // volts
public static final String KEY_BATTERY_LEVEL = "batteryLevel"; // percentage
public static final String KEY_FUEL_LEVEL = "fuel"; // liters
+ public static final String KEY_FUEL_USED = "fuelUsed"; // liters
public static final String KEY_FUEL_CONSUMPTION = "fuelConsumption"; // liters/hour
public static final String KEY_VERSION_FW = "versionFw";
@@ -58,6 +60,7 @@ public class Position extends Message {
public static final String KEY_TYPE = "type";
public static final String KEY_IGNITION = "ignition";
public static final String KEY_FLAGS = "flags";
+ public static final String KEY_ANTENNA = "antenna";
public static final String KEY_CHARGE = "charge";
public static final String KEY_IP = "ip";
public static final String KEY_ARCHIVE = "archive";
@@ -109,6 +112,8 @@ public class Position extends Message {
public static final String ALARM_POWER_OFF = "powerOff";
public static final String ALARM_POWER_ON = "powerOn";
public static final String ALARM_DOOR = "door";
+ public static final String ALARM_LOCK = "lock";
+ public static final String ALARM_UNLOCK = "unlock";
public static final String ALARM_GEOFENCE = "geofence";
public static final String ALARM_GEOFENCE_ENTER = "geofenceEnter";
public static final String ALARM_GEOFENCE_EXIT = "geofenceExit";
@@ -116,9 +121,11 @@ public class Position extends Message {
public static final String ALARM_ACCIDENT = "accident";
public static final String ALARM_TOW = "tow";
public static final String ALARM_IDLE = "idle";
+ public static final String ALARM_HIGH_RPM = "highRpm";
public static final String ALARM_ACCELERATION = "hardAcceleration";
public static final String ALARM_BRAKING = "hardBraking";
public static final String ALARM_CORNERING = "hardCornering";
+ public static final String ALARM_LANE_CHANGE = "laneChange";
public static final String ALARM_FATIGUE_DRIVING = "fatigueDriving";
public static final String ALARM_POWER_CUT = "powerCut";
public static final String ALARM_POWER_RESTORED = "powerRestored";
@@ -128,7 +135,7 @@ public class Position extends Message {
public static final String ALARM_SHOCK = "shock";
public static final String ALARM_BONNET = "bonnet";
public static final String ALARM_FOOT_BRAKE = "footBrake";
- public static final String ALARM_OIL_LEAK = "oilLeak";
+ public static final String ALARM_FUEL_LEAK = "fuelLeak";
public static final String ALARM_TAMPERING = "tampering";
public static final String ALARM_REMOVING = "removing";
diff --git a/src/org/traccar/model/User.java b/src/org/traccar/model/User.java
index 1a131a4e8..976b6aac0 100644
--- a/src/org/traccar/model/User.java
+++ b/src/org/traccar/model/User.java
@@ -75,14 +75,14 @@ public class User extends ExtendedModel {
this.readonly = readonly;
}
- private boolean admin;
+ private boolean administrator;
- public boolean getAdmin() {
- return admin;
+ public boolean getAdministrator() {
+ return administrator;
}
- public void setAdmin(boolean admin) {
- this.admin = admin;
+ public void setAdministrator(boolean administrator) {
+ this.administrator = administrator;
}
private String map;
@@ -203,7 +203,7 @@ public class User extends ExtendedModel {
public void setToken(String token) {
if (token != null && !token.isEmpty()) {
- if (!token.matches("^[a-zA-Z0-9]{16,}$")) {
+ if (!token.matches("^[a-zA-Z0-9-]{16,}$")) {
throw new IllegalArgumentException("Illegal token");
}
this.token = token;