diff options
Diffstat (limited to 'src/org/traccar/model/Position.java')
-rw-r--r-- | src/org/traccar/model/Position.java | 46 |
1 files changed, 16 insertions, 30 deletions
diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java index 4f78867c2..fca0f16e3 100644 --- a/src/org/traccar/model/Position.java +++ b/src/org/traccar/model/Position.java @@ -58,6 +58,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"; @@ -115,6 +116,7 @@ public class Position extends Message { public static final String ALARM_GPS_ANTENNA_CUT = "gpsAntennaCut"; 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_ACCELERATION = "hardAcceleration"; public static final String ALARM_BRAKING = "hardBraking"; public static final String ALARM_CORNERING = "hardCornering"; @@ -131,6 +133,14 @@ public class Position extends Message { public static final String ALARM_TAMPERING = "tampering"; public static final String ALARM_REMOVING = "removing"; + public Position() { + } + + public Position(String protocol) { + this.protocol = protocol; + this.serverTime = new Date(); + } + private String protocol; public String getProtocol() { @@ -144,55 +154,31 @@ public class Position extends Message { private Date serverTime; public Date getServerTime() { - if (serverTime != null) { - return new Date(serverTime.getTime()); - } else { - return null; - } + return serverTime; } public void setServerTime(Date serverTime) { - if (serverTime != null) { - this.serverTime = new Date(serverTime.getTime()); - } else { - this.serverTime = null; - } + this.serverTime = serverTime; } private Date deviceTime; public Date getDeviceTime() { - if (deviceTime != null) { - return new Date(deviceTime.getTime()); - } else { - return null; - } + return deviceTime; } public void setDeviceTime(Date deviceTime) { - if (deviceTime != null) { - this.deviceTime = new Date(deviceTime.getTime()); - } else { - this.deviceTime = null; - } + this.deviceTime = deviceTime; } private Date fixTime; public Date getFixTime() { - if (fixTime != null) { - return new Date(fixTime.getTime()); - } else { - return null; - } + return fixTime; } public void setFixTime(Date fixTime) { - if (fixTime != null) { - this.fixTime = new Date(fixTime.getTime()); - } else { - this.fixTime = null; - } + this.fixTime = fixTime; } public void setTime(Date time) { |