aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-05-26 09:30:43 +0500
committerAbyss777 <abyss@fox5.ru>2016-05-26 09:30:43 +0500
commitaa12e5c750e771016545269ffa39409b06b47eee (patch)
treed21b4414b532bfc53c9a905f3caa09f70b43b59e
parentac2405f0d57fac51fe95aa755f90fe82f26f73bc (diff)
downloadtrackermap-server-aa12e5c750e771016545269ffa39409b06b47eee.tar.gz
trackermap-server-aa12e5c750e771016545269ffa39409b06b47eee.tar.bz2
trackermap-server-aa12e5c750e771016545269ffa39409b06b47eee.zip
- Simplification of the hierarchy of models classes
- Removed automatically founded unnecessary imports
-rw-r--r--src/org/traccar/DistanceHandler.java7
-rw-r--r--src/org/traccar/ExtendedObjectDecoder.java5
-rw-r--r--src/org/traccar/FilterHandler.java3
-rw-r--r--src/org/traccar/LocationProviderHandler.java3
-rw-r--r--src/org/traccar/MainEventHandler.java3
-rw-r--r--src/org/traccar/RemoteAddressHandler.java3
-rw-r--r--src/org/traccar/WebDataHandler.java3
-rw-r--r--src/org/traccar/helper/ObdDecoder.java8
-rw-r--r--src/org/traccar/location/BaseLocationProvider.java10
-rw-r--r--src/org/traccar/model/Command.java2
-rw-r--r--src/org/traccar/model/Event.java125
-rw-r--r--src/org/traccar/model/Extensible.java61
-rw-r--r--src/org/traccar/model/Message.java41
-rw-r--r--src/org/traccar/model/Position.java105
-rw-r--r--src/org/traccar/protocol/AdmProtocolDecoder.java13
-rw-r--r--src/org/traccar/protocol/ApelProtocolDecoder.java27
-rw-r--r--src/org/traccar/protocol/AplicomProtocolDecoder.java25
-rwxr-xr-xsrc/org/traccar/protocol/AppelloProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/AquilaProtocolDecoder.java17
-rw-r--r--src/org/traccar/protocol/Ardi01ProtocolDecoder.java9
-rw-r--r--src/org/traccar/protocol/ArknavProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/ArnaviProtocolDecoder.java13
-rw-r--r--src/org/traccar/protocol/AstraProtocolDecoder.java21
-rw-r--r--src/org/traccar/protocol/AtrackProtocolDecoder.java41
-rw-r--r--src/org/traccar/protocol/AuroProtocolDecoder.java7
-rw-r--r--src/org/traccar/protocol/AutoFonProtocolDecoder.java19
-rw-r--r--src/org/traccar/protocol/Avl301ProtocolDecoder.java13
-rw-r--r--src/org/traccar/protocol/BceProtocolDecoder.java21
-rw-r--r--src/org/traccar/protocol/BlackKiteProtocolDecoder.java19
-rw-r--r--src/org/traccar/protocol/BoxProtocolDecoder.java7
-rw-r--r--src/org/traccar/protocol/CalAmpProtocolDecoder.java15
-rw-r--r--src/org/traccar/protocol/CarTrackProtocolDecoder.java9
-rw-r--r--src/org/traccar/protocol/CarscopProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/CastelProtocolDecoder.java23
-rw-r--r--src/org/traccar/protocol/CellocatorProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/CityeasyProtocolDecoder.java13
-rw-r--r--src/org/traccar/protocol/DishaProtocolDecoder.java19
-rw-r--r--src/org/traccar/protocol/EasyTrackProtocolDecoder.java7
-rw-r--r--src/org/traccar/protocol/EelinkProtocolDecoder.java15
-rw-r--r--src/org/traccar/protocol/FlextrackProtocolDecoder.java21
-rw-r--r--src/org/traccar/protocol/FoxProtocolDecoder.java21
-rw-r--r--src/org/traccar/protocol/GalileoProtocolDecoder.java9
-rw-r--r--src/org/traccar/protocol/GatorProtocolDecoder.java9
-rw-r--r--src/org/traccar/protocol/Gl200ProtocolDecoder.java85
-rw-r--r--src/org/traccar/protocol/GlobalSatProtocolDecoder.java7
-rw-r--r--src/org/traccar/protocol/GnxProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/GoSafeProtocolDecoder.java27
-rw-r--r--src/org/traccar/protocol/GotopProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/Gps103ProtocolDecoder.java27
-rw-r--r--src/org/traccar/protocol/GpsMarkerProtocolDecoder.java11
-rw-r--r--src/org/traccar/protocol/GpsmtaProtocolDecoder.java9
-rw-r--r--src/org/traccar/protocol/Gt02ProtocolDecoder.java7
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolDecoder.java27
-rw-r--r--src/org/traccar/protocol/H02ProtocolDecoder.java9
-rw-r--r--src/org/traccar/protocol/HaicomProtocolDecoder.java15
-rw-r--r--src/org/traccar/protocol/HomtecsProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/HuabaoProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/IntellitracProtocolDecoder.java25
-rw-r--r--src/org/traccar/protocol/Jt600ProtocolDecoder.java21
-rwxr-xr-xsrc/org/traccar/protocol/KenjiProtocolDecoder.java9
-rw-r--r--src/org/traccar/protocol/KhdProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/M2mProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/ManPowerProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/MegastekProtocolDecoder.java75
-rw-r--r--src/org/traccar/protocol/MeiligaoProtocolDecoder.java19
-rw-r--r--src/org/traccar/protocol/MeitrackProtocolDecoder.java59
-rw-r--r--src/org/traccar/protocol/MiniFinderProtocol.java2
-rw-r--r--src/org/traccar/protocol/MiniFinderProtocolDecoder.java7
-rw-r--r--src/org/traccar/protocol/Mta6ProtocolDecoder.java49
-rw-r--r--src/org/traccar/protocol/MtxProtocolDecoder.java11
-rw-r--r--src/org/traccar/protocol/MxtProtocolDecoder.java31
-rw-r--r--src/org/traccar/protocol/NavigilProtocolDecoder.java23
-rw-r--r--src/org/traccar/protocol/NavisProtocolDecoder.java31
-rw-r--r--src/org/traccar/protocol/NoranProtocolDecoder.java11
-rw-r--r--src/org/traccar/protocol/NvsProtocolDecoder.java11
-rw-r--r--src/org/traccar/protocol/OrionProtocolDecoder.java7
-rw-r--r--src/org/traccar/protocol/OsmAndProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/PiligrimProtocolDecoder.java7
-rw-r--r--src/org/traccar/protocol/ProgressProtocolDecoder.java17
-rw-r--r--src/org/traccar/protocol/Pt502ProtocolDecoder.java17
-rw-r--r--src/org/traccar/protocol/RitiProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/RuptelaProtocolDecoder.java13
-rw-r--r--src/org/traccar/protocol/SkypatrolProtocolDecoder.java11
-rw-r--r--src/org/traccar/protocol/Stl060ProtocolDecoder.java25
-rw-r--r--src/org/traccar/protocol/SuntechProtocolDecoder.java7
-rwxr-xr-xsrc/org/traccar/protocol/SupermateProtocolDecoder.java7
-rw-r--r--src/org/traccar/protocol/T55ProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/T800xProtocolDecoder.java23
-rw-r--r--src/org/traccar/protocol/TaipProtocolDecoder.java7
-rw-r--r--src/org/traccar/protocol/TelicProtocolDecoder.java7
-rw-r--r--src/org/traccar/protocol/TeltonikaProtocolDecoder.java25
-rw-r--r--src/org/traccar/protocol/ThinkRaceProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/Tk103ProtocolDecoder.java25
-rw-r--r--src/org/traccar/protocol/Tlt2hProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/TotemProtocolDecoder.java65
-rw-r--r--src/org/traccar/protocol/Tr900ProtocolDecoder.java13
-rw-r--r--src/org/traccar/protocol/TrackboxProtocolDecoder.java7
-rw-r--r--src/org/traccar/protocol/TramigoProtocolDecoder.java9
-rw-r--r--src/org/traccar/protocol/TrvProtocolDecoder.java25
-rw-r--r--src/org/traccar/protocol/Tt8850ProtocolDecoder.java9
-rw-r--r--src/org/traccar/protocol/TytanProtocolDecoder.java31
-rw-r--r--src/org/traccar/protocol/TzoneProtocolDecoder.java25
-rw-r--r--src/org/traccar/protocol/UlbotechProtocolDecoder.java31
-rw-r--r--src/org/traccar/protocol/V680ProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/VisiontekProtocolDecoder.java17
-rw-r--r--src/org/traccar/protocol/WatchProtocolDecoder.java9
-rw-r--r--src/org/traccar/protocol/WialonProtocolDecoder.java13
-rw-r--r--src/org/traccar/protocol/WondexProtocolDecoder.java21
-rw-r--r--src/org/traccar/protocol/XexunProtocolDecoder.java7
-rw-r--r--src/org/traccar/protocol/XirgoProtocolDecoder.java15
-rw-r--r--src/org/traccar/protocol/Xt013ProtocolDecoder.java9
-rw-r--r--src/org/traccar/protocol/YwtProtocolDecoder.java5
-rw-r--r--test/org/traccar/DistanceHandlerTest.java3
-rw-r--r--test/org/traccar/ProtocolTest.java18
-rw-r--r--test/org/traccar/location/LocationProviderTest.java15
115 files changed, 928 insertions, 1084 deletions
diff --git a/src/org/traccar/DistanceHandler.java b/src/org/traccar/DistanceHandler.java
index c26ac786f..b22815033 100644
--- a/src/org/traccar/DistanceHandler.java
+++ b/src/org/traccar/DistanceHandler.java
@@ -17,7 +17,6 @@
package org.traccar;
import org.traccar.helper.DistanceCalculator;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.math.BigDecimal;
@@ -38,8 +37,8 @@ public class DistanceHandler extends BaseDataHandler {
Position last = getLastPosition(position.getDeviceId());
if (last != null) {
- if (last.getAttributes().containsKey(Event.KEY_DISTANCE)) {
- distance = ((Number) last.getAttributes().get(Event.KEY_DISTANCE)).doubleValue();
+ if (last.getAttributes().containsKey(Position.KEY_DISTANCE)) {
+ distance = ((Number) last.getAttributes().get(Position.KEY_DISTANCE)).doubleValue();
}
if (position.getValid()) {
@@ -51,7 +50,7 @@ public class DistanceHandler extends BaseDataHandler {
}
}
- position.set(Event.KEY_DISTANCE, distance);
+ position.set(Position.KEY_DISTANCE, distance);
return position;
}
diff --git a/src/org/traccar/ExtendedObjectDecoder.java b/src/org/traccar/ExtendedObjectDecoder.java
index ded749e6c..d7ca30de4 100644
--- a/src/org/traccar/ExtendedObjectDecoder.java
+++ b/src/org/traccar/ExtendedObjectDecoder.java
@@ -23,7 +23,6 @@ import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ChannelUpstreamHandler;
import org.jboss.netty.channel.Channels;
import org.jboss.netty.channel.MessageEvent;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import javax.xml.bind.DatatypeConverter;
@@ -37,9 +36,9 @@ public abstract class ExtendedObjectDecoder implements ChannelUpstreamHandler {
if (Context.getConfig().getBoolean("database.saveOriginal") && decodedMessage instanceof Position) {
Position position = (Position) decodedMessage;
if (originalMessage instanceof ChannelBuffer) {
- position.set(Event.KEY_ORIGINAL, ChannelBuffers.hexDump((ChannelBuffer) originalMessage));
+ position.set(Position.KEY_ORIGINAL, ChannelBuffers.hexDump((ChannelBuffer) originalMessage));
} else if (originalMessage instanceof String) {
- position.set(Event.KEY_ORIGINAL, DatatypeConverter.printHexBinary(
+ position.set(Position.KEY_ORIGINAL, DatatypeConverter.printHexBinary(
((String) originalMessage).getBytes(StandardCharsets.US_ASCII)));
}
}
diff --git a/src/org/traccar/FilterHandler.java b/src/org/traccar/FilterHandler.java
index 75f2bfd2c..ab570ee26 100644
--- a/src/org/traccar/FilterHandler.java
+++ b/src/org/traccar/FilterHandler.java
@@ -17,7 +17,6 @@ package org.traccar;
import org.traccar.helper.DistanceCalculator;
import org.traccar.helper.Log;
-import org.traccar.model.Event;
import org.traccar.model.Position;
public class FilterHandler extends BaseDataHandler {
@@ -90,7 +89,7 @@ public class FilterHandler extends BaseDataHandler {
}
private boolean filterApproximate(Position position) {
- Boolean approximate = (Boolean) position.getAttributes().get(Event.KEY_APPROXIMATE);
+ Boolean approximate = (Boolean) position.getAttributes().get(Position.KEY_APPROXIMATE);
return filterApproximate && approximate != null && approximate;
}
diff --git a/src/org/traccar/LocationProviderHandler.java b/src/org/traccar/LocationProviderHandler.java
index 3c0fcf522..8d5647d4b 100644
--- a/src/org/traccar/LocationProviderHandler.java
+++ b/src/org/traccar/LocationProviderHandler.java
@@ -21,7 +21,6 @@ import org.jboss.netty.channel.ChannelUpstreamHandler;
import org.jboss.netty.channel.Channels;
import org.jboss.netty.channel.MessageEvent;
import org.traccar.location.LocationProvider;
-import org.traccar.model.Event;
import org.traccar.model.Position;
public class LocationProviderHandler implements ChannelUpstreamHandler {
@@ -49,7 +48,7 @@ public class LocationProviderHandler implements ChannelUpstreamHandler {
locationProvider.getLocation(position.getAttributes(), new LocationProvider.LocationProviderCallback() {
@Override
public void onSuccess(double latitude, double longitude) {
- position.set(Event.KEY_APPROXIMATE, true);
+ position.set(Position.KEY_APPROXIMATE, true);
position.setValid(true);
position.setFixTime(position.getDeviceTime());
position.setLatitude(latitude);
diff --git a/src/org/traccar/MainEventHandler.java b/src/org/traccar/MainEventHandler.java
index 0f20b312b..a0df34de5 100644
--- a/src/org/traccar/MainEventHandler.java
+++ b/src/org/traccar/MainEventHandler.java
@@ -24,7 +24,6 @@ import org.jboss.netty.channel.socket.DatagramChannel;
import org.jboss.netty.handler.timeout.IdleStateAwareChannelHandler;
import org.jboss.netty.handler.timeout.IdleStateEvent;
import org.traccar.helper.Log;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.text.SimpleDateFormat;
@@ -50,7 +49,7 @@ public class MainEventHandler extends IdleStateAwareChannelHandler {
s.append("lon: ").append(String.format("%.5f", position.getLongitude())).append(", ");
s.append("speed: ").append(String.format("%.1f", position.getSpeed())).append(", ");
s.append("course: ").append(String.format("%.1f", position.getCourse()));
- Object cmdResult = position.getAttributes().get(Event.KEY_RESULT);
+ Object cmdResult = position.getAttributes().get(Position.KEY_RESULT);
if (cmdResult != null) {
s.append(", result: ").append(cmdResult);
}
diff --git a/src/org/traccar/RemoteAddressHandler.java b/src/org/traccar/RemoteAddressHandler.java
index 1bbe87567..3d9695dab 100644
--- a/src/org/traccar/RemoteAddressHandler.java
+++ b/src/org/traccar/RemoteAddressHandler.java
@@ -16,7 +16,6 @@
package org.traccar;
import org.jboss.netty.channel.Channel;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.InetSocketAddress;
@@ -32,7 +31,7 @@ public class RemoteAddressHandler extends ExtendedObjectDecoder {
if (msg instanceof Position) {
Position position = (Position) msg;
- position.set(Event.KEY_IP, hostAddress);
+ position.set(Position.KEY_IP, hostAddress);
}
return msg;
diff --git a/src/org/traccar/WebDataHandler.java b/src/org/traccar/WebDataHandler.java
index efef8d2e1..b179fac8f 100644
--- a/src/org/traccar/WebDataHandler.java
+++ b/src/org/traccar/WebDataHandler.java
@@ -18,7 +18,6 @@ package org.traccar;
import org.traccar.helper.Checksum;
import org.traccar.helper.Log;
import org.traccar.model.Device;
-import org.traccar.model.Event;
import org.traccar.model.MiscFormatter;
import org.traccar.model.Position;
@@ -80,7 +79,7 @@ public class WebDataHandler extends BaseDataHandler {
}
private String calculateStatus(Position position) {
- if (position.getAttributes().containsKey(Event.KEY_ALARM)) {
+ if (position.getAttributes().containsKey(Position.KEY_ALARM)) {
return "0xF841"; // STATUS_PANIC_ON
} else if (position.getSpeed() < 1.0) {
return "0xF020"; // STATUS_LOCATION
diff --git a/src/org/traccar/helper/ObdDecoder.java b/src/org/traccar/helper/ObdDecoder.java
index c2d9b1841..a98408e05 100644
--- a/src/org/traccar/helper/ObdDecoder.java
+++ b/src/org/traccar/helper/ObdDecoder.java
@@ -15,7 +15,7 @@
*/
package org.traccar.helper;
-import org.traccar.model.Event;
+import org.traccar.model.Position;
import java.util.AbstractMap;
import java.util.Map;
@@ -86,15 +86,15 @@ public final class ObdDecoder {
case PID_COOLANT_TEMPERATURE:
return createEntry("coolant-temperature", intValue - 40);
case PID_ENGINE_RPM:
- return createEntry(Event.KEY_RPM, intValue / 4);
+ return createEntry(Position.KEY_RPM, intValue / 4);
case PID_VEHICLE_SPEED:
- return createEntry(Event.KEY_OBD_SPEED, intValue);
+ return createEntry(Position.KEY_OBD_SPEED, intValue);
case PID_THROTTLE_POSITION:
return createEntry("throttle", intValue * 100 / 255);
case PID_MIL_DISTANCE:
return createEntry("mil-distance", intValue);
case PID_FUEL_LEVEL:
- return createEntry(Event.KEY_FUEL, intValue * 100 / 255);
+ return createEntry(Position.KEY_FUEL, intValue * 100 / 255);
case PID_DISTANCE_CLEARED:
return createEntry("cleared-distance", intValue);
default:
diff --git a/src/org/traccar/location/BaseLocationProvider.java b/src/org/traccar/location/BaseLocationProvider.java
index c422ed50a..7778cc0c5 100644
--- a/src/org/traccar/location/BaseLocationProvider.java
+++ b/src/org/traccar/location/BaseLocationProvider.java
@@ -17,7 +17,7 @@ package org.traccar.location;
import org.traccar.Config;
import org.traccar.Context;
-import org.traccar.model.Event;
+import org.traccar.model.Position;
import java.util.Map;
@@ -28,18 +28,18 @@ public abstract class BaseLocationProvider implements LocationProvider {
Config config = Context.getConfig();
- Number mcc = (Number) attributes.get(Event.KEY_MCC);
+ Number mcc = (Number) attributes.get(Position.KEY_MCC);
if (mcc == null && config.hasKey("location.mcc")) {
mcc = config.getInteger("location.mcc");
}
- Number mnc = (Number) attributes.get(Event.KEY_MNC);
+ Number mnc = (Number) attributes.get(Position.KEY_MNC);
if (mnc == null && config.hasKey("location.mnc")) {
mnc = config.getInteger("location.mnc");
}
- Number lac = (Number) attributes.get(Event.KEY_LAC);
- Number cid = (Number) attributes.get(Event.KEY_CID);
+ Number lac = (Number) attributes.get(Position.KEY_LAC);
+ Number cid = (Number) attributes.get(Position.KEY_CID);
if (mcc != null && mnc != null && lac != null && cid != null) {
getLocation(mcc.intValue(), mnc.intValue(), lac.longValue(), cid.longValue(), callback);
diff --git a/src/org/traccar/model/Command.java b/src/org/traccar/model/Command.java
index 4525b3cde..69172ecee 100644
--- a/src/org/traccar/model/Command.java
+++ b/src/org/traccar/model/Command.java
@@ -18,7 +18,7 @@ package org.traccar.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
-public class Command extends Extensible {
+public class Command extends Message {
public static final String TYPE_CUSTOM = "custom";
public static final String TYPE_POSITION_SINGLE = "positionSingle";
diff --git a/src/org/traccar/model/Event.java b/src/org/traccar/model/Event.java
deleted file mode 100644
index 8ae817e30..000000000
--- a/src/org/traccar/model/Event.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright 2015 - 2016 Anton Tananaev (anton.tananaev@gmail.com)
- *
- * 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;
-
-import java.util.Date;
-
-public abstract class Event extends Extensible {
-
- // Words separated by dashes (word-second-third)
- public static final String KEY_ORIGINAL = "raw";
- public static final String KEY_INDEX = "index";
- public static final String KEY_HDOP = "hdop";
- public static final String KEY_SATELLITES = "sat";
- public static final String KEY_GSM = "gsm";
- public static final String KEY_GPS = "gps";
- public static final String KEY_EVENT = "event";
- public static final String KEY_ALARM = "alarm";
- public static final String KEY_STATUS = "status";
- public static final String KEY_ODOMETER = "odometer";
- public static final String KEY_HOURS = "hours";
- public static final String KEY_INPUT = "input";
- public static final String KEY_OUTPUT = "output";
- public static final String KEY_POWER = "power";
- public static final String KEY_BATTERY = "battery";
- public static final String KEY_MCC = "mcc";
- public static final String KEY_MNC = "mnc";
- public static final String KEY_LAC = "lac";
- public static final String KEY_CID = "cid";
- public static final String KEY_FUEL = "fuel";
- public static final String KEY_RFID = "rfid";
- public static final String KEY_VERSION = "version";
- 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_CHARGE = "charge";
- public static final String KEY_IP = "ip";
- public static final String KEY_ARCHIVE = "archive";
- public static final String KEY_DISTANCE = "distance";
- public static final String KEY_RPM = "rpm";
- public static final String KEY_VIN = "vin";
- public static final String KEY_APPROXIMATE = "approximate";
- public static final String KEY_THROTTLE = "throttle";
- public static final String KEY_MOTION = "motion";
-
- public static final String KEY_OBD_SPEED = "obd-speed";
- public static final String KEY_OBD_ODOMETER = "obd-odometer";
-
- public static final String KEY_RESULT = "result";
-
- // Starts with 1 not 0
- public static final String PREFIX_TEMP = "temp";
- public static final String PREFIX_ADC = "adc";
- public static final String PREFIX_IO = "io";
- public static final String PREFIX_COUNT = "count";
-
- private long id;
-
- public long getId() {
- return id;
- }
-
- public void setId(long id) {
- this.id = id;
- }
-
- private String protocol;
-
- public String getProtocol() {
- return protocol;
- }
-
- public void setProtocol(String protocol) {
- this.protocol = protocol;
- }
-
- private Date serverTime;
-
- public Date getServerTime() {
- if (serverTime != null) {
- return new Date(serverTime.getTime());
- } else {
- return null;
- }
- }
-
- public void setServerTime(Date serverTime) {
- if (serverTime != null) {
- this.serverTime = new Date(serverTime.getTime());
- } else {
- this.serverTime = null;
- }
- }
-
- private Date deviceTime;
-
- public Date getDeviceTime() {
- if (deviceTime != null) {
- return new Date(deviceTime.getTime());
- } else {
- return null;
- }
- }
-
- public void setDeviceTime(Date deviceTime) {
- if (deviceTime != null) {
- this.deviceTime = new Date(deviceTime.getTime());
- } else {
- this.deviceTime = null;
- }
- }
-
-}
diff --git a/src/org/traccar/model/Extensible.java b/src/org/traccar/model/Extensible.java
deleted file mode 100644
index f59b3d22e..000000000
--- a/src/org/traccar/model/Extensible.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com)
- *
- * 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;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-public abstract class Extensible extends Message {
-
- private Map<String, Object> attributes = new LinkedHashMap<>();
-
- public Map<String, Object> getAttributes() {
- return attributes;
- }
-
- public void setAttributes(Map<String, Object> attributes) {
- this.attributes = attributes;
- }
-
- public void set(String key, boolean value) {
- attributes.put(key, value);
- }
-
- public void set(String key, int value) {
- attributes.put(key, value);
- }
-
- public void set(String key, long value) {
- attributes.put(key, value);
- }
-
- public void set(String key, double value) {
- attributes.put(key, value);
- }
-
- public void set(String key, String value) {
- if (value != null && !value.isEmpty()) {
- attributes.put(key, value);
- }
- }
-
- public void add(Map.Entry<String, Object> entry) {
- if (entry != null && entry.getValue() != null) {
- attributes.put(entry.getKey(), entry.getValue());
- }
- }
-
-}
diff --git a/src/org/traccar/model/Message.java b/src/org/traccar/model/Message.java
index bac6661a8..8722acc16 100644
--- a/src/org/traccar/model/Message.java
+++ b/src/org/traccar/model/Message.java
@@ -15,6 +15,9 @@
*/
package org.traccar.model;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
public class Message {
private long deviceId;
@@ -37,4 +40,42 @@ public class Message {
this.type = type;
}
+ private Map<String, Object> attributes = new LinkedHashMap<>();
+
+ public Map<String, Object> getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Map<String, Object> attributes) {
+ this.attributes = attributes;
+ }
+
+ public void set(String key, boolean value) {
+ attributes.put(key, value);
+ }
+
+ public void set(String key, int value) {
+ attributes.put(key, value);
+ }
+
+ public void set(String key, long value) {
+ attributes.put(key, value);
+ }
+
+ public void set(String key, double value) {
+ attributes.put(key, value);
+ }
+
+ public void set(String key, String value) {
+ if (value != null && !value.isEmpty()) {
+ attributes.put(key, value);
+ }
+ }
+
+ public void add(Map.Entry<String, Object> entry) {
+ if (entry != null && entry.getValue() != null) {
+ attributes.put(entry.getKey(), entry.getValue());
+ }
+ }
+
}
diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java
index 1a38681ca..22d1be846 100644
--- a/src/org/traccar/model/Position.java
+++ b/src/org/traccar/model/Position.java
@@ -17,7 +17,110 @@ package org.traccar.model;
import java.util.Date;
-public class Position extends Event {
+public class Position extends Message {
+
+ // Words separated by dashes (word-second-third)
+ public static final String KEY_ORIGINAL = "raw";
+ public static final String KEY_INDEX = "index";
+ public static final String KEY_HDOP = "hdop";
+ public static final String KEY_SATELLITES = "sat";
+ public static final String KEY_GSM = "gsm";
+ public static final String KEY_GPS = "gps";
+ public static final String KEY_EVENT = "event";
+ public static final String KEY_ALARM = "alarm";
+ public static final String KEY_STATUS = "status";
+ public static final String KEY_ODOMETER = "odometer";
+ public static final String KEY_HOURS = "hours";
+ public static final String KEY_INPUT = "input";
+ public static final String KEY_OUTPUT = "output";
+ public static final String KEY_POWER = "power";
+ public static final String KEY_BATTERY = "battery";
+ public static final String KEY_MCC = "mcc";
+ public static final String KEY_MNC = "mnc";
+ public static final String KEY_LAC = "lac";
+ public static final String KEY_CID = "cid";
+ public static final String KEY_FUEL = "fuel";
+ public static final String KEY_RFID = "rfid";
+ public static final String KEY_VERSION = "version";
+ 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_CHARGE = "charge";
+ public static final String KEY_IP = "ip";
+ public static final String KEY_ARCHIVE = "archive";
+ public static final String KEY_DISTANCE = "distance";
+ public static final String KEY_RPM = "rpm";
+ public static final String KEY_VIN = "vin";
+ public static final String KEY_APPROXIMATE = "approximate";
+ public static final String KEY_THROTTLE = "throttle";
+ public static final String KEY_MOTION = "motion";
+
+ public static final String KEY_OBD_SPEED = "obd-speed";
+ public static final String KEY_OBD_ODOMETER = "obd-odometer";
+
+ public static final String KEY_RESULT = "result";
+
+ // Starts with 1 not 0
+ public static final String PREFIX_TEMP = "temp";
+ public static final String PREFIX_ADC = "adc";
+ public static final String PREFIX_IO = "io";
+ public static final String PREFIX_COUNT = "count";
+
+ private long id;
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ private String protocol;
+
+ public String getProtocol() {
+ return protocol;
+ }
+
+ public void setProtocol(String protocol) {
+ this.protocol = protocol;
+ }
+
+ private Date serverTime;
+
+ public Date getServerTime() {
+ if (serverTime != null) {
+ return new Date(serverTime.getTime());
+ } else {
+ return null;
+ }
+ }
+
+ public void setServerTime(Date serverTime) {
+ if (serverTime != null) {
+ this.serverTime = new Date(serverTime.getTime());
+ } else {
+ this.serverTime = null;
+ }
+ }
+
+ private Date deviceTime;
+
+ public Date getDeviceTime() {
+ if (deviceTime != null) {
+ return new Date(deviceTime.getTime());
+ } else {
+ return null;
+ }
+ }
+
+ public void setDeviceTime(Date deviceTime) {
+ if (deviceTime != null) {
+ this.deviceTime = new Date(deviceTime.getTime());
+ } else {
+ this.deviceTime = null;
+ }
+ }
private Date fixTime;
diff --git a/src/org/traccar/protocol/AdmProtocolDecoder.java b/src/org/traccar/protocol/AdmProtocolDecoder.java
index 28d0b5105..dd089e8e3 100644
--- a/src/org/traccar/protocol/AdmProtocolDecoder.java
+++ b/src/org/traccar/protocol/AdmProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.BitUtil;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -61,7 +60,7 @@ public class AdmProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte(); // firmware version
buf.readUnsignedShort(); // index
- position.set(Event.KEY_STATUS, buf.readUnsignedShort());
+ position.set(Position.KEY_STATUS, buf.readUnsignedShort());
position.setValid(true);
position.setLatitude(buf.readFloat());
@@ -73,13 +72,13 @@ public class AdmProtocolDecoder extends BaseProtocolDecoder {
position.setAltitude(buf.readUnsignedShort());
- position.set(Event.KEY_HDOP, buf.readUnsignedByte() * 0.1);
- position.set(Event.KEY_SATELLITES, buf.readUnsignedByte() & 0x0f);
+ position.set(Position.KEY_HDOP, buf.readUnsignedByte() * 0.1);
+ position.set(Position.KEY_SATELLITES, buf.readUnsignedByte() & 0x0f);
position.setTime(new Date(buf.readUnsignedInt() * 1000));
- position.set(Event.KEY_POWER, buf.readUnsignedShort());
- position.set(Event.KEY_BATTERY, buf.readUnsignedShort());
+ position.set(Position.KEY_POWER, buf.readUnsignedShort());
+ position.set(Position.KEY_BATTERY, buf.readUnsignedShort());
if (BitUtil.check(type, 2)) {
buf.skipBytes(4);
@@ -102,7 +101,7 @@ public class AdmProtocolDecoder extends BaseProtocolDecoder {
}
if (BitUtil.check(type, 7)) {
- position.set(Event.KEY_ODOMETER, buf.readUnsignedInt());
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
}
return position;
diff --git a/src/org/traccar/protocol/ApelProtocolDecoder.java b/src/org/traccar/protocol/ApelProtocolDecoder.java
index b75bcbda3..fb473be1e 100644
--- a/src/org/traccar/protocol/ApelProtocolDecoder.java
+++ b/src/org/traccar/protocol/ApelProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.Checksum;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -138,9 +137,9 @@ public class ApelProtocolDecoder extends BaseProtocolDecoder {
int subtype = type;
if (type == MSG_LOG_RECORDS) {
- position.set(Event.KEY_ARCHIVE, true);
+ position.set(Position.KEY_ARCHIVE, true);
lastIndex = buf.readUnsignedInt() + 1;
- position.set(Event.KEY_INDEX, lastIndex);
+ position.set(Position.KEY_INDEX, lastIndex);
subtype = buf.readUnsignedShort();
if (subtype != MSG_CURRENT_GPS_DATA && subtype != MSG_STATE_FULL_INFO_T104) {
@@ -158,7 +157,7 @@ public class ApelProtocolDecoder extends BaseProtocolDecoder {
int speed = buf.readUnsignedByte();
position.setValid(speed != 255);
position.setSpeed(UnitsConverter.knotsFromKph(speed));
- position.set(Event.KEY_HDOP, buf.readByte());
+ position.set(Position.KEY_HDOP, buf.readByte());
} else {
int speed = buf.readShort();
position.setValid(speed != -1);
@@ -170,20 +169,20 @@ public class ApelProtocolDecoder extends BaseProtocolDecoder {
if (subtype == MSG_STATE_FULL_INFO_T104) {
- position.set(Event.KEY_SATELLITES, buf.readUnsignedByte());
- position.set(Event.KEY_GSM, buf.readUnsignedByte());
- position.set(Event.KEY_EVENT, buf.readUnsignedShort());
- position.set(Event.KEY_ODOMETER, buf.readUnsignedInt());
- position.set(Event.KEY_INPUT, buf.readUnsignedByte());
- position.set(Event.KEY_OUTPUT, buf.readUnsignedByte());
+ position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
+ position.set(Position.KEY_GSM, buf.readUnsignedByte());
+ position.set(Position.KEY_EVENT, buf.readUnsignedShort());
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
+ position.set(Position.KEY_INPUT, buf.readUnsignedByte());
+ position.set(Position.KEY_OUTPUT, buf.readUnsignedByte());
for (int i = 1; i <= 8; i++) {
- position.set(Event.PREFIX_ADC + i, buf.readUnsignedShort());
+ position.set(Position.PREFIX_ADC + i, buf.readUnsignedShort());
}
- position.set(Event.PREFIX_COUNT + 1, buf.readUnsignedInt());
- position.set(Event.PREFIX_COUNT + 2, buf.readUnsignedInt());
- position.set(Event.PREFIX_COUNT + 3, buf.readUnsignedInt());
+ position.set(Position.PREFIX_COUNT + 1, buf.readUnsignedInt());
+ position.set(Position.PREFIX_COUNT + 2, buf.readUnsignedInt());
+ position.set(Position.PREFIX_COUNT + 3, buf.readUnsignedInt());
}
positions.add(position);
diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java
index e8e070d67..70e5d7d71 100644
--- a/src/org/traccar/protocol/AplicomProtocolDecoder.java
+++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java
@@ -23,7 +23,6 @@ import org.traccar.Context;
import org.traccar.helper.Checksum;
import org.traccar.helper.Log;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -132,7 +131,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder {
ChannelBuffer value = values.get(i);
switch (buf.readInt()) {
case 0x20D:
- position.set(Event.KEY_RPM, ChannelBuffers.swapShort(value.readShort()));
+ position.set(Position.KEY_RPM, ChannelBuffers.swapShort(value.readShort()));
position.set("diesel-temperature", ChannelBuffers.swapShort(value.readShort()) * 0.1);
position.set("battery-voltage", ChannelBuffers.swapShort(value.readShort()) * 0.01);
position.set("supply-air-temp-dep1", ChannelBuffers.swapShort(value.readShort()) * 0.1);
@@ -222,7 +221,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(getDeviceId());
int event = buf.readUnsignedByte();
- position.set(Event.KEY_EVENT, event);
+ position.set(Position.KEY_EVENT, event);
position.set("event-info", buf.readUnsignedByte());
if ((selector & 0x0008) != 0) {
@@ -239,7 +238,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder {
position.setTime(new Date(buf.readUnsignedInt() * 1000));
position.setLatitude(buf.readInt() / 1000000.0);
position.setLongitude(buf.readInt() / 1000000.0);
- position.set(Event.KEY_SATELLITES, buf.readUnsignedByte());
+ position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
}
if ((selector & 0x0010) != 0) {
@@ -249,19 +248,19 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder {
}
if ((selector & 0x0040) != 0) {
- position.set(Event.KEY_INPUT, buf.readUnsignedByte());
+ position.set(Position.KEY_INPUT, buf.readUnsignedByte());
}
if ((selector & 0x0020) != 0) {
- position.set(Event.PREFIX_ADC + 1, buf.readUnsignedShort());
- position.set(Event.PREFIX_ADC + 2, buf.readUnsignedShort());
- position.set(Event.PREFIX_ADC + 3, buf.readUnsignedShort());
- position.set(Event.PREFIX_ADC + 4, buf.readUnsignedShort());
+ position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort());
+ position.set(Position.PREFIX_ADC + 2, buf.readUnsignedShort());
+ position.set(Position.PREFIX_ADC + 3, buf.readUnsignedShort());
+ position.set(Position.PREFIX_ADC + 4, buf.readUnsignedShort());
}
if ((selector & 0x8000) != 0) {
- position.set(Event.KEY_POWER, buf.readUnsignedShort() / 1000.0);
- position.set(Event.KEY_BATTERY, buf.readUnsignedShort());
+ position.set(Position.KEY_POWER, buf.readUnsignedShort() / 1000.0);
+ position.set(Position.KEY_BATTERY, buf.readUnsignedShort());
}
// Pulse rate 1
@@ -285,11 +284,11 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder {
}
if ((selector & 0x0040) != 0) {
- position.set(Event.KEY_OUTPUT, buf.readUnsignedByte());
+ position.set(Position.KEY_OUTPUT, buf.readUnsignedByte());
}
if ((selector & 0x0200) != 0) {
- position.set(Event.KEY_RFID, (((long) buf.readUnsignedShort()) << 32) + buf.readUnsignedInt());
+ position.set(Position.KEY_RFID, (((long) buf.readUnsignedShort()) << 32) + buf.readUnsignedInt());
}
if ((selector & 0x0400) != 0) {
diff --git a/src/org/traccar/protocol/AppelloProtocolDecoder.java b/src/org/traccar/protocol/AppelloProtocolDecoder.java
index 48e624f40..bc3e7885d 100755
--- a/src/org/traccar/protocol/AppelloProtocolDecoder.java
+++ b/src/org/traccar/protocol/AppelloProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -83,7 +82,7 @@ public class AppelloProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(parser.nextDouble());
position.setCourse(parser.nextDouble());
- position.set(Event.KEY_SATELLITES, parser.nextInt());
+ position.set(Position.KEY_SATELLITES, parser.nextInt());
position.setAltitude(parser.nextDouble());
diff --git a/src/org/traccar/protocol/AquilaProtocolDecoder.java b/src/org/traccar/protocol/AquilaProtocolDecoder.java
index 0431e0a26..52f6c61a4 100644
--- a/src/org/traccar/protocol/AquilaProtocolDecoder.java
+++ b/src/org/traccar/protocol/AquilaProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -86,7 +85,7 @@ public class AquilaProtocolDecoder extends BaseProtocolDecoder {
}
position.setDeviceId(getDeviceId());
- position.set(Event.KEY_EVENT, parser.nextInt());
+ position.set(Position.KEY_EVENT, parser.nextInt());
position.setLatitude(parser.nextDouble());
position.setLongitude(parser.nextDouble());
@@ -98,17 +97,17 @@ public class AquilaProtocolDecoder extends BaseProtocolDecoder {
position.setValid(parser.next().equals("A"));
- position.set(Event.KEY_GSM, parser.nextInt());
+ position.set(Position.KEY_GSM, parser.nextInt());
position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble()));
- position.set(Event.KEY_ODOMETER, parser.next());
- position.set(Event.KEY_FUEL, parser.next());
- position.set(Event.PREFIX_IO + 1, parser.next());
- position.set(Event.KEY_CHARGE, parser.next());
- position.set(Event.PREFIX_IO + 2, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_FUEL, parser.next());
+ position.set(Position.PREFIX_IO + 1, parser.next());
+ position.set(Position.KEY_CHARGE, parser.next());
+ position.set(Position.PREFIX_IO + 2, parser.next());
- position.set(Event.KEY_IGNITION, parser.nextInt() == 1);
+ position.set(Position.KEY_IGNITION, parser.nextInt() == 1);
int course = (parser.nextInt() << 3) + (parser.nextInt() << 2) + (parser.nextInt() << 1) + parser.nextInt();
if (course > 0 && course <= 8) {
diff --git a/src/org/traccar/protocol/Ardi01ProtocolDecoder.java b/src/org/traccar/protocol/Ardi01ProtocolDecoder.java
index 2a7324127..1dcfc51bf 100644
--- a/src/org/traccar/protocol/Ardi01ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Ardi01ProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -78,11 +77,11 @@ public class Ardi01ProtocolDecoder extends BaseProtocolDecoder {
int satellites = parser.nextInt();
position.setValid(satellites >= 3);
- position.set(Event.KEY_SATELLITES, satellites);
+ position.set(Position.KEY_SATELLITES, satellites);
- position.set(Event.KEY_EVENT, parser.next());
- position.set(Event.KEY_BATTERY, parser.next());
- position.set(Event.PREFIX_TEMP + 1, parser.next());
+ position.set(Position.KEY_EVENT, parser.next());
+ position.set(Position.KEY_BATTERY, parser.next());
+ position.set(Position.PREFIX_TEMP + 1, parser.next());
return position;
}
diff --git a/src/org/traccar/protocol/ArknavProtocolDecoder.java b/src/org/traccar/protocol/ArknavProtocolDecoder.java
index 9e85cac3b..5e633c198 100644
--- a/src/org/traccar/protocol/ArknavProtocolDecoder.java
+++ b/src/org/traccar/protocol/ArknavProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -73,7 +72,7 @@ public class ArknavProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(parser.nextDouble());
position.setCourse(parser.nextDouble());
- position.set(Event.KEY_HDOP, parser.nextDouble());
+ position.set(Position.KEY_HDOP, parser.nextDouble());
DateBuilder dateBuilder = new DateBuilder()
.setTime(parser.nextInt(), parser.nextInt(), parser.nextInt())
diff --git a/src/org/traccar/protocol/ArnaviProtocolDecoder.java b/src/org/traccar/protocol/ArnaviProtocolDecoder.java
index 47c459446..46728c53e 100644
--- a/src/org/traccar/protocol/ArnaviProtocolDecoder.java
+++ b/src/org/traccar/protocol/ArnaviProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -73,12 +72,12 @@ public class ArnaviProtocolDecoder extends BaseProtocolDecoder {
}
position.setDeviceId(getDeviceId());
- position.set(Event.KEY_INDEX, parser.nextInt());
- position.set(Event.KEY_POWER, parser.nextInt() * 0.01);
- position.set(Event.KEY_BATTERY, parser.nextInt() * 0.01);
- position.set(Event.KEY_IGNITION, parser.nextInt() == 1);
- position.set(Event.KEY_INPUT, parser.nextInt());
- position.set(Event.KEY_SATELLITES, parser.nextInt());
+ position.set(Position.KEY_INDEX, parser.nextInt());
+ position.set(Position.KEY_POWER, parser.nextInt() * 0.01);
+ position.set(Position.KEY_BATTERY, parser.nextInt() * 0.01);
+ position.set(Position.KEY_IGNITION, parser.nextInt() == 1);
+ position.set(Position.KEY_INPUT, parser.nextInt());
+ position.set(Position.KEY_SATELLITES, parser.nextInt());
DateBuilder dateBuilder = new DateBuilder()
.setTime(parser.nextInt(), parser.nextInt(), parser.nextInt());
diff --git a/src/org/traccar/protocol/AstraProtocolDecoder.java b/src/org/traccar/protocol/AstraProtocolDecoder.java
index 8f40abedf..f6b4ed559 100644
--- a/src/org/traccar/protocol/AstraProtocolDecoder.java
+++ b/src/org/traccar/protocol/AstraProtocolDecoder.java
@@ -22,7 +22,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -78,13 +77,13 @@ public class AstraProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(buf.readUnsignedByte() * 2);
int reason = buf.readUnsignedMedium();
- position.set(Event.KEY_EVENT, reason);
+ position.set(Position.KEY_EVENT, reason);
- position.set(Event.KEY_STATUS, buf.readUnsignedShort());
- position.set(Event.PREFIX_IO + 1, buf.readUnsignedByte());
- position.set(Event.PREFIX_ADC + 1, buf.readUnsignedByte());
- position.set(Event.KEY_BATTERY, buf.readUnsignedByte());
- position.set(Event.KEY_POWER, buf.readUnsignedByte());
+ position.set(Position.KEY_STATUS, buf.readUnsignedShort());
+ position.set(Position.PREFIX_IO + 1, buf.readUnsignedByte());
+ position.set(Position.PREFIX_ADC + 1, buf.readUnsignedByte());
+ position.set(Position.KEY_BATTERY, buf.readUnsignedByte());
+ position.set(Position.KEY_POWER, buf.readUnsignedByte());
buf.readUnsignedByte(); // max journey speed
buf.skipBytes(6); // accelerometer
@@ -94,15 +93,15 @@ public class AstraProtocolDecoder extends BaseProtocolDecoder {
position.setAltitude(buf.readUnsignedByte() * 20);
int quality = buf.readUnsignedByte();
- position.set(Event.KEY_SATELLITES, quality & 0xf);
- position.set(Event.KEY_GSM, quality >> 4);
+ position.set(Position.KEY_SATELLITES, quality & 0xf);
+ position.set(Position.KEY_GSM, quality >> 4);
buf.readUnsignedByte(); // geofence events
if (BitUtil.check(reason, 6) || BitUtil.check(reason, 7)) {
- position.set(Event.KEY_RFID, buf.readBytes(7).toString(StandardCharsets.US_ASCII));
- position.set(Event.KEY_ODOMETER, buf.readUnsignedMedium());
+ position.set(Position.KEY_RFID, buf.readBytes(7).toString(StandardCharsets.US_ASCII));
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedMedium());
buf.readUnsignedShort(); // engine time
diff --git a/src/org/traccar/protocol/AtrackProtocolDecoder.java b/src/org/traccar/protocol/AtrackProtocolDecoder.java
index 27c5b8902..0f1eb5f8e 100644
--- a/src/org/traccar/protocol/AtrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/AtrackProtocolDecoder.java
@@ -22,7 +22,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.Context;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -84,22 +83,22 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
for (String key : keys) {
switch (key) {
case "SA":
- position.set(Event.KEY_SATELLITES, buf.readUnsignedByte());
+ position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
break;
case "MV":
- position.set(Event.KEY_POWER, buf.readUnsignedShort());
+ position.set(Position.KEY_POWER, buf.readUnsignedShort());
break;
case "BV":
- position.set(Event.KEY_BATTERY, buf.readUnsignedShort());
+ position.set(Position.KEY_BATTERY, buf.readUnsignedShort());
break;
case "GQ":
- position.set(Event.KEY_GSM, buf.readUnsignedByte());
+ position.set(Position.KEY_GSM, buf.readUnsignedByte());
break;
case "CE":
- position.set(Event.KEY_CID, buf.readUnsignedInt());
+ position.set(Position.KEY_CID, buf.readUnsignedInt());
break;
case "LC":
- position.set(Event.KEY_LAC, buf.readUnsignedShort());
+ position.set(Position.KEY_LAC, buf.readUnsignedShort());
break;
case "CN":
buf.readUnsignedInt(); // mcc + mnc
@@ -114,16 +113,16 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
position.setAltitude(buf.readUnsignedInt());
break;
case "RP":
- position.set(Event.KEY_RPM, buf.readUnsignedShort());
+ position.set(Position.KEY_RPM, buf.readUnsignedShort());
break;
case "GS":
buf.readUnsignedByte(); // gsm status
break;
case "DT":
- position.set(Event.KEY_ARCHIVE, buf.readUnsignedByte() == 1);
+ position.set(Position.KEY_ARCHIVE, buf.readUnsignedByte() == 1);
break;
case "VN":
- position.set(Event.KEY_VIN, readString(buf));
+ position.set(Position.KEY_VIN, readString(buf));
break;
case "MF":
buf.readUnsignedShort(); // mass air flow rate
@@ -132,13 +131,13 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte(); // engine load
break;
case "TR":
- position.set(Event.KEY_THROTTLE, buf.readUnsignedByte());
+ position.set(Position.KEY_THROTTLE, buf.readUnsignedByte());
break;
case "ET":
buf.readUnsignedShort(); // engine coolant temp
break;
case "FL":
- position.set(Event.KEY_FUEL, buf.readUnsignedByte());
+ position.set(Position.KEY_FUEL, buf.readUnsignedByte());
break;
case "ML":
buf.readUnsignedByte(); // mil status
@@ -150,7 +149,7 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
readString(buf); // format string
break;
case "AV1":
- position.set(Event.PREFIX_ADC + 1, buf.readUnsignedShort());
+ position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort());
break;
case "NC":
readString(buf); // gsm neighbor cell info
@@ -225,20 +224,20 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
position.setLatitude(buf.readInt() * 0.000001);
position.setCourse(buf.readUnsignedShort());
- position.set(Event.KEY_TYPE, buf.readUnsignedByte());
- position.set(Event.KEY_ODOMETER, buf.readUnsignedInt() * 0.1);
- position.set(Event.KEY_HDOP, buf.readUnsignedShort() * 0.1);
- position.set(Event.KEY_INPUT, buf.readUnsignedByte());
+ position.set(Position.KEY_TYPE, buf.readUnsignedByte());
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedInt() * 0.1);
+ position.set(Position.KEY_HDOP, buf.readUnsignedShort() * 0.1);
+ position.set(Position.KEY_INPUT, buf.readUnsignedByte());
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShort()));
- position.set(Event.KEY_OUTPUT, buf.readUnsignedByte());
- position.set(Event.PREFIX_ADC + 1, buf.readUnsignedShort() * 0.001);
+ position.set(Position.KEY_OUTPUT, buf.readUnsignedByte());
+ position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort() * 0.001);
position.set("driver", readString(buf));
- position.set(Event.PREFIX_TEMP + 1, buf.readShort() * 0.1);
- position.set(Event.PREFIX_TEMP + 2, buf.readShort() * 0.1);
+ position.set(Position.PREFIX_TEMP + 1, buf.readShort() * 0.1);
+ position.set(Position.PREFIX_TEMP + 2, buf.readShort() * 0.1);
position.set("message", readString(buf));
diff --git a/src/org/traccar/protocol/AuroProtocolDecoder.java b/src/org/traccar/protocol/AuroProtocolDecoder.java
index fd7690733..ff3ab5b0d 100644
--- a/src/org/traccar/protocol/AuroProtocolDecoder.java
+++ b/src/org/traccar/protocol/AuroProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -66,7 +65,7 @@ public class AuroProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- position.set(Event.KEY_INDEX, parser.nextInt());
+ position.set(Position.KEY_INDEX, parser.nextInt());
if (!identify(parser.next(), channel, remoteAddress)) {
return null;
@@ -85,8 +84,8 @@ public class AuroProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(parser.nextDouble());
position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble()));
- position.set(Event.KEY_BATTERY, parser.nextInt());
- position.set(Event.KEY_CHARGE, parser.nextInt() == 1);
+ position.set(Position.KEY_BATTERY, parser.nextInt());
+ position.set(Position.KEY_CHARGE, parser.nextInt() == 1);
return position;
}
diff --git a/src/org/traccar/protocol/AutoFonProtocolDecoder.java b/src/org/traccar/protocol/AutoFonProtocolDecoder.java
index 011a6542b..b80fd6bcb 100644
--- a/src/org/traccar/protocol/AutoFonProtocolDecoder.java
+++ b/src/org/traccar/protocol/AutoFonProtocolDecoder.java
@@ -22,7 +22,6 @@ import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -72,7 +71,7 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
if (!history) {
buf.readUnsignedShort();
}
- position.set(Event.KEY_BATTERY, buf.readUnsignedByte());
+ position.set(Position.KEY_BATTERY, buf.readUnsignedByte());
buf.skipBytes(6); // time
if (!history) {
@@ -83,8 +82,8 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
}
}
- position.set(Event.PREFIX_TEMP + 1, buf.readByte());
- position.set(Event.KEY_GSM, buf.readUnsignedByte());
+ position.set(Position.PREFIX_TEMP + 1, buf.readByte());
+ position.set(Position.KEY_GSM, buf.readUnsignedByte());
buf.readUnsignedShort(); // mcc
buf.readUnsignedShort(); // mnc
buf.readUnsignedShort(); // lac
@@ -92,7 +91,7 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
int valid = buf.readUnsignedByte();
position.setValid((valid & 0xc0) != 0);
- position.set(Event.KEY_SATELLITES, valid & 0x3f);
+ position.set(Position.KEY_SATELLITES, valid & 0x3f);
DateBuilder dateBuilder = new DateBuilder()
.setDateReverse(buf.readUnsignedByte(), buf.readUnsignedByte(), buf.readUnsignedByte())
@@ -105,7 +104,7 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(buf.readUnsignedByte());
position.setCourse(buf.readUnsignedByte() * 2.0);
- position.set(Event.KEY_HDOP, buf.readUnsignedShort());
+ position.set(Position.KEY_HDOP, buf.readUnsignedShort());
buf.readUnsignedShort(); // reserved
buf.readUnsignedByte(); // checksum
@@ -162,12 +161,12 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(getDeviceId());
short status = buf.readUnsignedByte();
- position.set(Event.KEY_ALARM, BitUtil.check(status, 7));
- position.set(Event.KEY_BATTERY, BitUtil.to(status, 7));
+ position.set(Position.KEY_ALARM, BitUtil.check(status, 7));
+ position.set(Position.KEY_BATTERY, BitUtil.to(status, 7));
buf.skipBytes(2); // remaining time
- position.set(Event.PREFIX_TEMP + 1, buf.readByte());
+ position.set(Position.PREFIX_TEMP + 1, buf.readByte());
buf.skipBytes(2); // timer (interval and units)
buf.readByte(); // mode
@@ -177,7 +176,7 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
int valid = buf.readUnsignedByte();
position.setValid(BitUtil.from(valid, 6) != 0);
- position.set(Event.KEY_SATELLITES, BitUtil.from(valid, 6));
+ position.set(Position.KEY_SATELLITES, BitUtil.from(valid, 6));
int time = buf.readUnsignedMedium();
int date = buf.readUnsignedMedium();
diff --git a/src/org/traccar/protocol/Avl301ProtocolDecoder.java b/src/org/traccar/protocol/Avl301ProtocolDecoder.java
index 7f2e3ece7..1f7e3470c 100644
--- a/src/org/traccar/protocol/Avl301ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Avl301ProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -90,7 +89,7 @@ public class Avl301ProtocolDecoder extends BaseProtocolDecoder {
position.setTime(dateBuilder.getDate());
int gpsLength = buf.readUnsignedByte(); // gps len and sat
- position.set(Event.KEY_SATELLITES, gpsLength & 0xf);
+ position.set(Position.KEY_SATELLITES, gpsLength & 0xf);
buf.readUnsignedByte(); // satellites
@@ -115,16 +114,16 @@ public class Avl301ProtocolDecoder extends BaseProtocolDecoder {
position.set("acc", (union & 0x8000) != 0);
}
- position.set(Event.KEY_LAC, buf.readUnsignedShort());
- position.set(Event.KEY_CID, buf.readUnsignedMedium());
- position.set(Event.KEY_ALARM, true);
+ position.set(Position.KEY_LAC, buf.readUnsignedShort());
+ position.set(Position.KEY_CID, buf.readUnsignedMedium());
+ position.set(Position.KEY_ALARM, true);
int flags = buf.readUnsignedByte();
position.set("acc", (flags & 0x2) != 0);
// parse other flags
- position.set(Event.KEY_POWER, buf.readUnsignedByte());
- position.set(Event.KEY_GSM, buf.readUnsignedByte());
+ position.set(Position.KEY_POWER, buf.readUnsignedByte());
+ position.set(Position.KEY_GSM, buf.readUnsignedByte());
return position;
}
diff --git a/src/org/traccar/protocol/BceProtocolDecoder.java b/src/org/traccar/protocol/BceProtocolDecoder.java
index fc0a9a3f4..5502de5b2 100644
--- a/src/org/traccar/protocol/BceProtocolDecoder.java
+++ b/src/org/traccar/protocol/BceProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.BitUtil;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -94,22 +93,22 @@ public class BceProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(buf.readUnsignedByte());
int gps = buf.readUnsignedByte();
- position.set(Event.KEY_SATELLITES, gps & 0xf);
- position.set(Event.KEY_HDOP, gps >> 4);
+ position.set(Position.KEY_SATELLITES, gps & 0xf);
+ position.set(Position.KEY_HDOP, gps >> 4);
position.setCourse(buf.readUnsignedByte());
position.setAltitude(buf.readUnsignedShort());
- position.set(Event.KEY_ODOMETER, buf.readUnsignedInt());
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
}
if (BitUtil.check(mask, 1)) {
- position.set(Event.KEY_INPUT, buf.readUnsignedShort());
+ position.set(Position.KEY_INPUT, buf.readUnsignedShort());
}
for (int i = 1; i <= 8; i++) {
if (BitUtil.check(mask, i + 1)) {
- position.set(Event.PREFIX_ADC + i, buf.readUnsignedShort());
+ position.set(Position.PREFIX_ADC + i, buf.readUnsignedShort());
}
}
@@ -127,11 +126,11 @@ public class BceProtocolDecoder extends BaseProtocolDecoder {
}
if (BitUtil.check(mask, 14)) {
- position.set(Event.KEY_MCC, buf.readUnsignedShort());
- position.set(Event.KEY_MNC, buf.readUnsignedByte());
- position.set(Event.KEY_LAC, buf.readUnsignedShort());
- position.set(Event.KEY_CID, buf.readUnsignedShort());
- position.set(Event.KEY_GSM, buf.readUnsignedByte());
+ position.set(Position.KEY_MCC, buf.readUnsignedShort());
+ position.set(Position.KEY_MNC, buf.readUnsignedByte());
+ position.set(Position.KEY_LAC, buf.readUnsignedShort());
+ position.set(Position.KEY_CID, buf.readUnsignedShort());
+ position.set(Position.KEY_GSM, buf.readUnsignedByte());
buf.readUnsignedByte();
}
diff --git a/src/org/traccar/protocol/BlackKiteProtocolDecoder.java b/src/org/traccar/protocol/BlackKiteProtocolDecoder.java
index c4f2eaff9..6787140e0 100644
--- a/src/org/traccar/protocol/BlackKiteProtocolDecoder.java
+++ b/src/org/traccar/protocol/BlackKiteProtocolDecoder.java
@@ -22,7 +22,6 @@ import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.BitUtil;
import org.traccar.helper.Log;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -124,39 +123,39 @@ public class BlackKiteProtocolDecoder extends BaseProtocolDecoder {
case TAG_STATUS:
int status = buf.readUnsignedShort();
- position.set(Event.KEY_IGNITION, BitUtil.check(status, 9));
- position.set(Event.KEY_ALARM, BitUtil.check(status, 15));
- position.set(Event.KEY_POWER, BitUtil.check(status, 2));
+ position.set(Position.KEY_IGNITION, BitUtil.check(status, 9));
+ position.set(Position.KEY_ALARM, BitUtil.check(status, 15));
+ position.set(Position.KEY_POWER, BitUtil.check(status, 2));
break;
case TAG_DIGITAL_INPUTS:
int input = buf.readUnsignedShort();
for (int i = 0; i < 16; i++) {
- position.set(Event.PREFIX_IO + (i + 1), BitUtil.check(input, i));
+ position.set(Position.PREFIX_IO + (i + 1), BitUtil.check(input, i));
}
break;
case TAG_DIGITAL_OUTPUTS:
int output = buf.readUnsignedShort();
for (int i = 0; i < 16; i++) {
- position.set(Event.PREFIX_IO + (i + 17), BitUtil.check(output, i));
+ position.set(Position.PREFIX_IO + (i + 17), BitUtil.check(output, i));
}
break;
case TAG_INPUT_VOLTAGE1:
- position.set(Event.PREFIX_ADC + 1, buf.readUnsignedShort() / 1000.0);
+ position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort() / 1000.0);
break;
case TAG_INPUT_VOLTAGE2:
- position.set(Event.PREFIX_ADC + 2, buf.readUnsignedShort() / 1000.0);
+ position.set(Position.PREFIX_ADC + 2, buf.readUnsignedShort() / 1000.0);
break;
case TAG_INPUT_VOLTAGE3:
- position.set(Event.PREFIX_ADC + 3, buf.readUnsignedShort() / 1000.0);
+ position.set(Position.PREFIX_ADC + 3, buf.readUnsignedShort() / 1000.0);
break;
case TAG_INPUT_VOLTAGE4:
- position.set(Event.PREFIX_ADC + 4, buf.readUnsignedShort() / 1000.0);
+ position.set(Position.PREFIX_ADC + 4, buf.readUnsignedShort() / 1000.0);
break;
case TAG_XT1:
diff --git a/src/org/traccar/protocol/BoxProtocolDecoder.java b/src/org/traccar/protocol/BoxProtocolDecoder.java
index 5edc23a80..480417607 100644
--- a/src/org/traccar/protocol/BoxProtocolDecoder.java
+++ b/src/org/traccar/protocol/BoxProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -87,12 +86,12 @@ public class BoxProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble()));
position.setCourse(parser.nextDouble());
- position.set(Event.KEY_ODOMETER, parser.next());
- position.set(Event.KEY_EVENT, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_EVENT, parser.next());
int status = parser.nextInt();
position.setValid((status & 0x04) == 0);
- position.set(Event.KEY_STATUS, status);
+ position.set(Position.KEY_STATUS, status);
return position;
}
diff --git a/src/org/traccar/protocol/CalAmpProtocolDecoder.java b/src/org/traccar/protocol/CalAmpProtocolDecoder.java
index 292666c31..69fca3914 100644
--- a/src/org/traccar/protocol/CalAmpProtocolDecoder.java
+++ b/src/org/traccar/protocol/CalAmpProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.BitUtil;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -86,35 +85,35 @@ public class CalAmpProtocolDecoder extends BaseProtocolDecoder {
}
if (type == MSG_MINI_EVENT_REPORT) {
- position.set(Event.KEY_SATELLITES, buf.getUnsignedByte(buf.readerIndex()) & 0xf);
+ position.set(Position.KEY_SATELLITES, buf.getUnsignedByte(buf.readerIndex()) & 0xf);
position.setValid((buf.readUnsignedByte() & 0x20) == 0);
} else {
- position.set(Event.KEY_SATELLITES, buf.readUnsignedByte());
+ position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
position.setValid((buf.readUnsignedByte() & 0x08) == 0);
}
if (type != MSG_MINI_EVENT_REPORT) {
position.set("carrier", buf.readUnsignedShort());
- position.set(Event.KEY_GSM, buf.readShort());
+ position.set(Position.KEY_GSM, buf.readShort());
}
position.set("modem", buf.readUnsignedByte());
if (type != MSG_MINI_EVENT_REPORT) {
- position.set(Event.KEY_HDOP, buf.readUnsignedByte());
+ position.set(Position.KEY_HDOP, buf.readUnsignedByte());
}
- position.set(Event.KEY_INPUT, buf.readUnsignedByte());
+ position.set(Position.KEY_INPUT, buf.readUnsignedByte());
if (type != MSG_MINI_EVENT_REPORT) {
- position.set(Event.KEY_STATUS, buf.readUnsignedByte());
+ position.set(Position.KEY_STATUS, buf.readUnsignedByte());
}
if (type == MSG_EVENT_REPORT || type == MSG_MINI_EVENT_REPORT) {
if (type != MSG_MINI_EVENT_REPORT) {
buf.readUnsignedByte(); // event index
}
- position.set(Event.KEY_EVENT, buf.readUnsignedByte());
+ position.set(Position.KEY_EVENT, buf.readUnsignedByte());
}
int accType = BitUtil.from(buf.getUnsignedByte(buf.readerIndex()), 6);
diff --git a/src/org/traccar/protocol/CarTrackProtocolDecoder.java b/src/org/traccar/protocol/CarTrackProtocolDecoder.java
index cd5269221..ff9d32c49 100644
--- a/src/org/traccar/protocol/CarTrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/CarTrackProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -87,7 +86,7 @@ public class CarTrackProtocolDecoder extends BaseProtocolDecoder {
dateBuilder.setDateReverse(parser.nextInt(), parser.nextInt(), parser.nextInt());
position.setTime(dateBuilder.getDate());
- position.set(Event.PREFIX_IO + 1, parser.next());
+ position.set(Position.PREFIX_IO + 1, parser.next());
String odometer = parser.next();
odometer = odometer.replace(":", "A");
@@ -96,10 +95,10 @@ public class CarTrackProtocolDecoder extends BaseProtocolDecoder {
odometer = odometer.replace("=", "D");
odometer = odometer.replace(">", "E");
odometer = odometer.replace("?", "F");
- position.set(Event.KEY_ODOMETER, Integer.parseInt(odometer, 16));
+ position.set(Position.KEY_ODOMETER, Integer.parseInt(odometer, 16));
- position.set(Event.KEY_ALARM, parser.next());
- position.set(Event.PREFIX_ADC + 1, parser.next());
+ position.set(Position.KEY_ALARM, parser.next());
+ position.set(Position.PREFIX_ADC + 1, parser.next());
return position;
}
diff --git a/src/org/traccar/protocol/CarscopProtocolDecoder.java b/src/org/traccar/protocol/CarscopProtocolDecoder.java
index 250a4c564..4c1aced57 100644
--- a/src/org/traccar/protocol/CarscopProtocolDecoder.java
+++ b/src/org/traccar/protocol/CarscopProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -85,8 +84,8 @@ public class CarscopProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(parser.nextDouble());
- position.set(Event.KEY_STATUS, parser.next());
- position.set(Event.KEY_ODOMETER, parser.nextInt());
+ position.set(Position.KEY_STATUS, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.nextInt());
return position;
}
diff --git a/src/org/traccar/protocol/CastelProtocolDecoder.java b/src/org/traccar/protocol/CastelProtocolDecoder.java
index d3d505c86..e379b6f2d 100644
--- a/src/org/traccar/protocol/CastelProtocolDecoder.java
+++ b/src/org/traccar/protocol/CastelProtocolDecoder.java
@@ -22,7 +22,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.Checksum;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -79,7 +78,7 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder {
position.setLatitude(lat);
position.setLongitude(lon);
position.setValid((flags & 0x0C) > 0);
- position.set(Event.KEY_SATELLITES, flags >> 4);
+ position.set(Position.KEY_SATELLITES, flags >> 4);
return position;
}
@@ -207,8 +206,8 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder {
for (int i = 0; i < count; i++) {
Position position = readPosition(buf);
- position.set(Event.KEY_ODOMETER, odometer);
- position.set(Event.KEY_STATUS, status);
+ position.set(Position.KEY_ODOMETER, odometer);
+ position.set(Position.KEY_STATUS, status);
positions.add(position);
}
@@ -236,16 +235,16 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder {
for (int i = 0; i < count; i++) {
Position position = readPosition(buf);
- position.set(Event.KEY_STATUS, buf.readUnsignedInt());
- position.set(Event.KEY_BATTERY, buf.readUnsignedByte());
- position.set(Event.KEY_ODOMETER, buf.readUnsignedInt());
+ position.set(Position.KEY_STATUS, buf.readUnsignedInt());
+ position.set(Position.KEY_BATTERY, buf.readUnsignedByte());
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
buf.readUnsignedByte(); // geo-fencing id
buf.readUnsignedByte(); // geo-fencing flags
buf.readUnsignedByte(); // additional flags
- position.set(Event.KEY_LAC, buf.readUnsignedShort());
- position.set(Event.KEY_CID, buf.readUnsignedShort());
+ position.set(Position.KEY_LAC, buf.readUnsignedShort());
+ position.set(Position.KEY_CID, buf.readUnsignedShort());
positions.add(position);
}
@@ -258,9 +257,9 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder {
Position position = readPosition(buf);
- position.set(Event.KEY_STATUS, buf.readUnsignedInt());
- position.set(Event.KEY_BATTERY, buf.readUnsignedByte());
- position.set(Event.KEY_ODOMETER, buf.readUnsignedInt());
+ position.set(Position.KEY_STATUS, buf.readUnsignedInt());
+ position.set(Position.KEY_BATTERY, buf.readUnsignedByte());
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
buf.readUnsignedByte(); // geo-fencing id
buf.readUnsignedByte(); // geo-fencing flags
diff --git a/src/org/traccar/protocol/CellocatorProtocolDecoder.java b/src/org/traccar/protocol/CellocatorProtocolDecoder.java
index 0a3e4599f..f5a77e387 100644
--- a/src/org/traccar/protocol/CellocatorProtocolDecoder.java
+++ b/src/org/traccar/protocol/CellocatorProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -99,7 +98,7 @@ public class CellocatorProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte(); // software version
buf.readUnsignedByte(); // protocol version
- position.set(Event.KEY_STATUS, buf.getUnsignedByte(buf.readerIndex()) & 0x0f);
+ position.set(Position.KEY_STATUS, buf.getUnsignedByte(buf.readerIndex()) & 0x0f);
int operator = (buf.readUnsignedByte() & 0xf0) << 4;
operator += buf.readUnsignedByte();
diff --git a/src/org/traccar/protocol/CityeasyProtocolDecoder.java b/src/org/traccar/protocol/CityeasyProtocolDecoder.java
index 9aae900d9..77d7570dc 100644
--- a/src/org/traccar/protocol/CityeasyProtocolDecoder.java
+++ b/src/org/traccar/protocol/CityeasyProtocolDecoder.java
@@ -23,7 +23,6 @@ import org.traccar.helper.Checksum;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -101,13 +100,13 @@ public class CityeasyProtocolDecoder extends BaseProtocolDecoder {
position.setTime(dateBuilder.getDate());
position.setValid(parser.next().equals("A"));
- position.set(Event.KEY_SATELLITES, parser.next());
+ position.set(Position.KEY_SATELLITES, parser.next());
position.setLatitude(parser.nextCoordinate(Parser.CoordinateFormat.HEM_DEG));
position.setLongitude(parser.nextCoordinate(Parser.CoordinateFormat.HEM_DEG));
position.setSpeed(parser.nextDouble());
- position.set(Event.KEY_HDOP, parser.nextDouble());
+ position.set(Position.KEY_HDOP, parser.nextDouble());
position.setAltitude(parser.nextDouble());
} else {
@@ -116,10 +115,10 @@ public class CityeasyProtocolDecoder extends BaseProtocolDecoder {
}
- position.set(Event.KEY_MCC, parser.nextInt());
- position.set(Event.KEY_MNC, parser.nextInt());
- position.set(Event.KEY_LAC, parser.nextInt());
- position.set(Event.KEY_CID, parser.nextInt());
+ position.set(Position.KEY_MCC, parser.nextInt());
+ position.set(Position.KEY_MNC, parser.nextInt());
+ position.set(Position.KEY_LAC, parser.nextInt());
+ position.set(Position.KEY_CID, parser.nextInt());
return position;
}
diff --git a/src/org/traccar/protocol/DishaProtocolDecoder.java b/src/org/traccar/protocol/DishaProtocolDecoder.java
index 37ff29fac..02f92d017 100644
--- a/src/org/traccar/protocol/DishaProtocolDecoder.java
+++ b/src/org/traccar/protocol/DishaProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -87,17 +86,17 @@ public class DishaProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(parser.nextDouble());
position.setCourse(parser.nextDouble());
- position.set(Event.KEY_SATELLITES, parser.next());
- position.set(Event.KEY_HDOP, parser.next());
- position.set(Event.KEY_GSM, parser.next());
- position.set(Event.KEY_CHARGE, parser.nextInt() == 2);
- position.set(Event.KEY_BATTERY, parser.next());
+ position.set(Position.KEY_SATELLITES, parser.next());
+ position.set(Position.KEY_HDOP, parser.next());
+ position.set(Position.KEY_GSM, parser.next());
+ position.set(Position.KEY_CHARGE, parser.nextInt() == 2);
+ position.set(Position.KEY_BATTERY, parser.next());
- position.set(Event.PREFIX_ADC + 1, parser.nextInt());
- position.set(Event.PREFIX_ADC + 2, parser.nextInt());
+ position.set(Position.PREFIX_ADC + 1, parser.nextInt());
+ position.set(Position.PREFIX_ADC + 2, parser.nextInt());
- position.set(Event.KEY_ODOMETER, parser.next());
- position.set(Event.KEY_INPUT, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_INPUT, parser.next());
return position;
}
diff --git a/src/org/traccar/protocol/EasyTrackProtocolDecoder.java b/src/org/traccar/protocol/EasyTrackProtocolDecoder.java
index 320cb3a4f..013b9cc43 100644
--- a/src/org/traccar/protocol/EasyTrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/EasyTrackProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -100,11 +99,11 @@ public class EasyTrackProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(parser.nextInt(16) / 100.0);
position.setCourse(parser.nextInt(16) / 100.0);
- position.set(Event.KEY_STATUS, parser.next());
+ position.set(Position.KEY_STATUS, parser.next());
position.set("signal", parser.next());
- position.set(Event.KEY_POWER, parser.nextDouble());
+ position.set(Position.KEY_POWER, parser.nextDouble());
position.set("oil", parser.nextInt(16));
- position.set(Event.KEY_ODOMETER, parser.nextInt(16));
+ position.set(Position.KEY_ODOMETER, parser.nextInt(16));
position.setAltitude(parser.nextDouble());
diff --git a/src/org/traccar/protocol/EelinkProtocolDecoder.java b/src/org/traccar/protocol/EelinkProtocolDecoder.java
index 07dde53d7..09cf1808f 100644
--- a/src/org/traccar/protocol/EelinkProtocolDecoder.java
+++ b/src/org/traccar/protocol/EelinkProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -79,7 +78,7 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(getDeviceId());
position.setProtocol(getProtocolName());
- position.set(Event.KEY_INDEX, index);
+ position.set(Position.KEY_INDEX, index);
position.setTime(new Date(buf.readUnsignedInt() * 1000));
position.setLatitude(buf.readInt() / 1800000.0);
@@ -87,19 +86,19 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedByte()));
position.setCourse(buf.readUnsignedShort());
- position.set(Event.KEY_MCC, buf.readUnsignedShort());
- position.set(Event.KEY_MNC, buf.readUnsignedShort());
- position.set(Event.KEY_LAC, buf.readUnsignedShort());
- position.set(Event.KEY_CID, buf.readUnsignedMedium());
+ position.set(Position.KEY_MCC, buf.readUnsignedShort());
+ position.set(Position.KEY_MNC, buf.readUnsignedShort());
+ position.set(Position.KEY_LAC, buf.readUnsignedShort());
+ position.set(Position.KEY_CID, buf.readUnsignedMedium());
position.setValid((buf.readUnsignedByte() & 0x01) != 0);
if (type == MSG_ALARM) {
- position.set(Event.KEY_ALARM, buf.readUnsignedByte());
+ position.set(Position.KEY_ALARM, buf.readUnsignedByte());
}
if (type == MSG_STATE) {
- position.set(Event.KEY_STATUS, buf.readUnsignedByte());
+ position.set(Position.KEY_STATUS, buf.readUnsignedByte());
}
return position;
diff --git a/src/org/traccar/protocol/FlextrackProtocolDecoder.java b/src/org/traccar/protocol/FlextrackProtocolDecoder.java
index 9bfac2537..a0f151ac2 100644
--- a/src/org/traccar/protocol/FlextrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/FlextrackProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -116,19 +115,19 @@ public class FlextrackProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(UnitsConverter.knotsFromKph(parser.nextInt()));
position.setCourse(parser.nextInt());
- position.set(Event.KEY_SATELLITES, parser.nextInt());
- position.set(Event.KEY_BATTERY, parser.nextInt());
- position.set(Event.KEY_GSM, parser.nextInt());
- position.set(Event.KEY_STATUS, parser.nextInt(16));
- position.set(Event.KEY_MCC, parser.nextInt());
- position.set(Event.KEY_MNC, parser.nextInt());
+ position.set(Position.KEY_SATELLITES, parser.nextInt());
+ position.set(Position.KEY_BATTERY, parser.nextInt());
+ position.set(Position.KEY_GSM, parser.nextInt());
+ position.set(Position.KEY_STATUS, parser.nextInt(16));
+ position.set(Position.KEY_MCC, parser.nextInt());
+ position.set(Position.KEY_MNC, parser.nextInt());
position.setAltitude(parser.nextInt());
- position.set(Event.KEY_HDOP, parser.nextInt() * 0.1);
- position.set(Event.KEY_CID, parser.nextInt(16));
- position.set(Event.KEY_LAC, parser.nextInt(16));
- position.set(Event.KEY_ODOMETER, parser.nextInt());
+ position.set(Position.KEY_HDOP, parser.nextInt() * 0.1);
+ position.set(Position.KEY_CID, parser.nextInt(16));
+ position.set(Position.KEY_LAC, parser.nextInt(16));
+ position.set(Position.KEY_ODOMETER, parser.nextInt());
return position;
}
diff --git a/src/org/traccar/protocol/FoxProtocolDecoder.java b/src/org/traccar/protocol/FoxProtocolDecoder.java
index 1b50545f8..ac267f567 100644
--- a/src/org/traccar/protocol/FoxProtocolDecoder.java
+++ b/src/org/traccar/protocol/FoxProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -92,7 +91,7 @@ public class FoxProtocolDecoder extends BaseProtocolDecoder {
position.setProtocol(getProtocolName());
position.setDeviceId(getDeviceId());
- position.set(Event.KEY_STATUS, parser.nextInt());
+ position.set(Position.KEY_STATUS, parser.nextInt());
position.setValid(parser.next().equals("A"));
@@ -106,15 +105,15 @@ public class FoxProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble()));
position.setCourse(parser.nextDouble());
- position.set(Event.KEY_INPUT, parser.nextInt(2));
- position.set(Event.KEY_POWER, parser.nextDouble() / 10);
- position.set(Event.PREFIX_TEMP + 1, parser.nextInt());
- position.set(Event.KEY_RPM, parser.nextInt());
- position.set(Event.KEY_FUEL, parser.nextInt());
- position.set(Event.PREFIX_ADC + 1, parser.nextInt());
- position.set(Event.PREFIX_ADC + 2, parser.nextInt());
- position.set(Event.KEY_OUTPUT, parser.nextInt(2));
- position.set(Event.KEY_ODOMETER, parser.nextInt());
+ position.set(Position.KEY_INPUT, parser.nextInt(2));
+ position.set(Position.KEY_POWER, parser.nextDouble() / 10);
+ position.set(Position.PREFIX_TEMP + 1, parser.nextInt());
+ position.set(Position.KEY_RPM, parser.nextInt());
+ position.set(Position.KEY_FUEL, parser.nextInt());
+ position.set(Position.PREFIX_ADC + 1, parser.nextInt());
+ position.set(Position.PREFIX_ADC + 2, parser.nextInt());
+ position.set(Position.KEY_OUTPUT, parser.nextInt(2));
+ position.set(Position.KEY_ODOMETER, parser.nextInt());
position.set("status-data", parser.next());
diff --git a/src/org/traccar/protocol/GalileoProtocolDecoder.java b/src/org/traccar/protocol/GalileoProtocolDecoder.java
index f9c7fb935..fddabee60 100644
--- a/src/org/traccar/protocol/GalileoProtocolDecoder.java
+++ b/src/org/traccar/protocol/GalileoProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.Log;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -169,19 +168,19 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder {
break;
case TAG_STATUS:
- position.set(Event.KEY_STATUS, buf.readUnsignedShort());
+ position.set(Position.KEY_STATUS, buf.readUnsignedShort());
break;
case TAG_POWER:
- position.set(Event.KEY_POWER, buf.readUnsignedShort());
+ position.set(Position.KEY_POWER, buf.readUnsignedShort());
break;
case TAG_BATTERY:
- position.set(Event.KEY_BATTERY, buf.readUnsignedShort());
+ position.set(Position.KEY_BATTERY, buf.readUnsignedShort());
break;
case TAG_ODOMETER:
- position.set(Event.KEY_ODOMETER, buf.readUnsignedInt());
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
break;
default:
diff --git a/src/org/traccar/protocol/GatorProtocolDecoder.java b/src/org/traccar/protocol/GatorProtocolDecoder.java
index 1c8e1f4e4..873fef3c9 100644
--- a/src/org/traccar/protocol/GatorProtocolDecoder.java
+++ b/src/org/traccar/protocol/GatorProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.BcdUtil;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -96,13 +95,13 @@ public class GatorProtocolDecoder extends BaseProtocolDecoder {
int flags = buf.readUnsignedByte();
position.setValid((flags & 0x80) != 0);
- position.set(Event.KEY_SATELLITES, flags & 0x0f);
+ position.set(Position.KEY_SATELLITES, flags & 0x0f);
- position.set(Event.KEY_STATUS, buf.readUnsignedByte());
+ position.set(Position.KEY_STATUS, buf.readUnsignedByte());
position.set("key", buf.readUnsignedByte());
position.set("oil", buf.readUnsignedShort() / 10.0);
- position.set(Event.KEY_POWER, buf.readUnsignedByte() + buf.readUnsignedByte() / 100.0);
- position.set(Event.KEY_ODOMETER, buf.readUnsignedInt());
+ position.set(Position.KEY_POWER, buf.readUnsignedByte() + buf.readUnsignedByte() / 100.0);
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
return position;
}
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
index 4e78ff6ed..2793e123a 100644
--- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
@@ -23,7 +23,6 @@ import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -264,10 +263,10 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
}
position.setDeviceId(getDeviceId());
- position.set(Event.KEY_STATUS, parser.next());
- position.set(Event.KEY_POWER, parser.next());
- position.set(Event.KEY_BATTERY, parser.next());
- position.set(Event.KEY_CHARGE, parser.next());
+ position.set(Position.KEY_STATUS, parser.next());
+ position.set(Position.KEY_POWER, parser.next());
+ position.set(Position.KEY_BATTERY, parser.next());
+ position.set(Position.KEY_CHARGE, parser.next());
DateBuilder dateBuilder = new DateBuilder()
.setDate(parser.nextInt(), parser.nextInt(), parser.nextInt())
@@ -275,7 +274,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
getLastLocation(position, dateBuilder.getDate());
- position.set(Event.KEY_INDEX, parser.next());
+ position.set(Position.KEY_INDEX, parser.next());
return position;
}
@@ -299,15 +298,15 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
}
if (parser.hasNext(4)) {
- position.set(Event.KEY_MCC, parser.nextInt());
- position.set(Event.KEY_MNC, parser.nextInt());
- position.set(Event.KEY_LAC, parser.nextInt(16));
- position.set(Event.KEY_CID, parser.nextInt(16));
+ position.set(Position.KEY_MCC, parser.nextInt());
+ position.set(Position.KEY_MNC, parser.nextInt());
+ position.set(Position.KEY_LAC, parser.nextInt(16));
+ position.set(Position.KEY_CID, parser.nextInt(16));
}
parser.skip(4); // alternative networks
- position.set(Event.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.next());
}
private Object decodeObd(Channel channel, SocketAddress remoteAddress, String sentence) {
@@ -324,21 +323,21 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
}
position.setDeviceId(getDeviceId());
- position.set(Event.KEY_RPM, parser.next());
- position.set(Event.KEY_OBD_SPEED, parser.next());
- position.set(Event.PREFIX_TEMP + 1, parser.next());
+ position.set(Position.KEY_RPM, parser.next());
+ position.set(Position.KEY_OBD_SPEED, parser.next());
+ position.set(Position.PREFIX_TEMP + 1, parser.next());
position.set("fuel-consumption", parser.next());
position.set("dtcs-cleared-distance", parser.next());
position.set("odb-connect", parser.next());
position.set("dtcs-number", parser.next());
position.set("dtcs-codes", parser.next());
- position.set(Event.KEY_THROTTLE, parser.next());
- position.set(Event.KEY_FUEL, parser.next());
- position.set(Event.KEY_OBD_ODOMETER, parser.next());
+ position.set(Position.KEY_THROTTLE, parser.next());
+ position.set(Position.KEY_FUEL, parser.next());
+ position.set(Position.KEY_OBD_ODOMETER, parser.next());
decodeLocation(position, parser);
- position.set(Event.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.next());
if (parser.hasNext(6)) {
DateBuilder dateBuilder = new DateBuilder()
@@ -373,7 +372,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
position.setProtocol(getProtocolName());
position.setDeviceId(getDeviceId());
- position.set(Event.KEY_VIN, vin);
+ position.set(Position.KEY_VIN, vin);
decodeLocation(position, itemParser);
@@ -386,31 +385,31 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
// power value only on some devices
if (power > 10) {
- position.set(Event.KEY_POWER, power);
+ position.set(Position.KEY_POWER, power);
}
- position.set(Event.KEY_ODOMETER, parser.next());
- position.set(Event.KEY_BATTERY, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_BATTERY, parser.next());
- position.set(Event.KEY_ODOMETER, parser.next());
- position.set(Event.KEY_HOURS, parser.next());
- position.set(Event.PREFIX_ADC + 1, parser.next());
- position.set(Event.PREFIX_ADC + 2, parser.next());
- position.set(Event.KEY_BATTERY, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_HOURS, parser.next());
+ position.set(Position.PREFIX_ADC + 1, parser.next());
+ position.set(Position.PREFIX_ADC + 2, parser.next());
+ position.set(Position.KEY_BATTERY, parser.next());
if (parser.hasNext(3)) {
int ignition = parser.nextInt(16);
if (BitUtil.check(ignition, 4)) {
- position.set(Event.KEY_IGNITION, false);
+ position.set(Position.KEY_IGNITION, false);
} else if (BitUtil.check(ignition, 5)) {
- position.set(Event.KEY_IGNITION, true);
+ position.set(Position.KEY_IGNITION, true);
}
- position.set(Event.KEY_INPUT, parser.nextInt(16));
- position.set(Event.KEY_OUTPUT, parser.nextInt(16));
+ position.set(Position.KEY_INPUT, parser.nextInt(16));
+ position.set(Position.KEY_OUTPUT, parser.nextInt(16));
}
- position.set(Event.KEY_RPM, parser.next());
- position.set(Event.KEY_FUEL, parser.next());
+ position.set(Position.KEY_RPM, parser.next());
+ position.set(Position.KEY_FUEL, parser.next());
// workaround for wrong location time
if (parser.hasNext(6)) {
@@ -441,8 +440,8 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
decodeLocation(position, parser);
- position.set(Event.KEY_HOURS, parser.next());
- position.set(Event.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_HOURS, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.next());
if (parser.hasNext(6)) {
DateBuilder dateBuilder = new DateBuilder()
@@ -470,11 +469,11 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
}
position.setDeviceId(getDeviceId());
- position.set(Event.KEY_RFID, parser.next());
+ position.set(Position.KEY_RFID, parser.next());
decodeLocation(position, parser);
- position.set(Event.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.next());
if (parser.hasNext(6)) {
DateBuilder dateBuilder = new DateBuilder()
@@ -504,15 +503,15 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
int reportType = parser.nextInt();
if (type.equals("NMR")) {
- position.set(Event.KEY_MOTION, reportType);
+ position.set(Position.KEY_MOTION, reportType);
}
decodeLocation(position, parser);
- position.set(Event.KEY_ODOMETER, parser.next());
- position.set(Event.KEY_BATTERY, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_BATTERY, parser.next());
- position.set(Event.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.next());
// workaround for wrong location time
if (parser.hasNext(6)) {
@@ -614,10 +613,10 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
if (result != null) {
if (result instanceof Position) {
- ((Position) result).set(Event.KEY_TYPE, type);
+ ((Position) result).set(Position.KEY_TYPE, type);
} else {
for (Position p : (List<Position>) result) {
- p.set(Event.KEY_TYPE, type);
+ p.set(Position.KEY_TYPE, type);
}
}
}
diff --git a/src/org/traccar/protocol/GlobalSatProtocolDecoder.java b/src/org/traccar/protocol/GlobalSatProtocolDecoder.java
index 8c378af90..b8bb742e4 100644
--- a/src/org/traccar/protocol/GlobalSatProtocolDecoder.java
+++ b/src/org/traccar/protocol/GlobalSatProtocolDecoder.java
@@ -22,7 +22,6 @@ import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -164,7 +163,7 @@ public class GlobalSatProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(Double.parseDouble(value));
break;
case 'N':
- position.set(Event.KEY_BATTERY, value);
+ position.set(Position.KEY_BATTERY, value);
break;
default:
// Unsupported
@@ -222,8 +221,8 @@ public class GlobalSatProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(parser.nextDouble());
position.setCourse(parser.nextDouble());
- position.set(Event.KEY_SATELLITES, parser.nextInt());
- position.set(Event.KEY_HDOP, parser.next());
+ position.set(Position.KEY_SATELLITES, parser.nextInt());
+ position.set(Position.KEY_HDOP, parser.next());
return position;
}
diff --git a/src/org/traccar/protocol/GnxProtocolDecoder.java b/src/org/traccar/protocol/GnxProtocolDecoder.java
index 0928e476a..3b1cccfc4 100644
--- a/src/org/traccar/protocol/GnxProtocolDecoder.java
+++ b/src/org/traccar/protocol/GnxProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -94,7 +93,7 @@ public class GnxProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(getDeviceId());
if (parser.nextInt() == 1) {
- position.set(Event.KEY_ARCHIVE, true);
+ position.set(Position.KEY_ARCHIVE, true);
}
DateBuilder dateBuilder;
@@ -116,7 +115,7 @@ public class GnxProtocolDecoder extends BaseProtocolDecoder {
switch (type) {
case "MIF":
- position.set(Event.KEY_RFID, parser.next());
+ position.set(Position.KEY_RFID, parser.next());
break;
default:
break;
diff --git a/src/org/traccar/protocol/GoSafeProtocolDecoder.java b/src/org/traccar/protocol/GoSafeProtocolDecoder.java
index e3ab37fbd..50e39d67f 100644
--- a/src/org/traccar/protocol/GoSafeProtocolDecoder.java
+++ b/src/org/traccar/protocol/GoSafeProtocolDecoder.java
@@ -22,7 +22,6 @@ import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -137,10 +136,10 @@ public class GoSafeProtocolDecoder extends BaseProtocolDecoder {
position.setTime(time);
}
- position.set(Event.KEY_EVENT, parser.next());
+ position.set(Position.KEY_EVENT, parser.next());
position.setValid(parser.next().equals("A"));
- position.set(Event.KEY_SATELLITES, parser.next());
+ position.set(Position.KEY_SATELLITES, parser.next());
position.setLatitude(parser.nextCoordinate(Parser.CoordinateFormat.HEM_DEG));
position.setLongitude(parser.nextCoordinate(Parser.CoordinateFormat.HEM_DEG));
@@ -148,23 +147,23 @@ public class GoSafeProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(parser.nextDouble());
position.setAltitude(parser.nextDouble());
- position.set(Event.KEY_HDOP, parser.next());
+ position.set(Position.KEY_HDOP, parser.next());
if (parser.hasNext(4)) {
- position.set(Event.KEY_MCC, parser.nextInt());
- position.set(Event.KEY_MNC, parser.nextInt());
- position.set(Event.KEY_LAC, parser.nextInt(16));
- position.set(Event.KEY_CID, parser.nextInt(16));
+ position.set(Position.KEY_MCC, parser.nextInt());
+ position.set(Position.KEY_MNC, parser.nextInt());
+ position.set(Position.KEY_LAC, parser.nextInt(16));
+ position.set(Position.KEY_CID, parser.nextInt(16));
}
- position.set(Event.KEY_ODOMETER, parser.next());
- position.set(Event.KEY_POWER, parser.next());
- position.set(Event.KEY_BATTERY, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_POWER, parser.next());
+ position.set(Position.KEY_BATTERY, parser.next());
String status = parser.next();
if (status != null) {
- position.set(Event.KEY_IGNITION, BitUtil.check(Integer.parseInt(status, 16), 13));
- position.set(Event.KEY_STATUS, status);
+ position.set(Position.KEY_IGNITION, BitUtil.check(Integer.parseInt(status, 16), 13));
+ position.set(Position.KEY_STATUS, status);
}
if (parser.hasNext()) {
@@ -212,7 +211,7 @@ public class GoSafeProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(parser.nextDouble());
position.setCourse(parser.nextDouble());
- position.set(Event.KEY_HDOP, parser.next());
+ position.set(Position.KEY_HDOP, parser.next());
dateBuilder.setDateReverse(parser.nextInt(), parser.nextInt(), parser.nextInt());
position.setTime(dateBuilder.getDate());
diff --git a/src/org/traccar/protocol/GotopProtocolDecoder.java b/src/org/traccar/protocol/GotopProtocolDecoder.java
index 65b694aaf..a62cfc623 100644
--- a/src/org/traccar/protocol/GotopProtocolDecoder.java
+++ b/src/org/traccar/protocol/GotopProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -75,7 +74,7 @@ public class GotopProtocolDecoder extends BaseProtocolDecoder {
position.setLongitude(parser.nextCoordinate(Parser.CoordinateFormat.DEG_HEM));
position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble()));
- position.set(Event.KEY_STATUS, parser.next());
+ position.set(Position.KEY_STATUS, parser.next());
position.setCourse(parser.nextDouble());
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
index c1f0af42f..f8256a5ab 100644
--- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -146,8 +145,8 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
getLastLocation(position, null);
- position.set(Event.KEY_LAC, parser.nextInt(16));
- position.set(Event.KEY_CID, parser.nextInt(16));
+ position.set(Position.KEY_LAC, parser.nextInt(16));
+ position.set(Position.KEY_CID, parser.nextInt(16));
return position;
@@ -167,14 +166,14 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
getLastLocation(position, dateBuilder.getDate());
- position.set(Event.KEY_ODOMETER, parser.nextInt());
- position.set(Event.KEY_FUEL, parser.next());
- position.set(Event.KEY_HOURS, parser.next());
- position.set(Event.KEY_OBD_SPEED, parser.next());
- position.set(Event.PREFIX_TEMP + 1, parser.next());
- position.set(Event.KEY_THROTTLE, parser.next());
- position.set(Event.KEY_RPM, parser.next());
- position.set(Event.KEY_BATTERY, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.nextInt());
+ position.set(Position.KEY_FUEL, parser.next());
+ position.set(Position.KEY_HOURS, parser.next());
+ position.set(Position.KEY_OBD_SPEED, parser.next());
+ position.set(Position.PREFIX_TEMP + 1, parser.next());
+ position.set(Position.KEY_THROTTLE, parser.next());
+ position.set(Position.KEY_RPM, parser.next());
+ position.set(Position.KEY_BATTERY, parser.next());
return position;
@@ -192,7 +191,7 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(getDeviceId());
String alarm = parser.next();
- position.set(Event.KEY_ALARM, alarm);
+ position.set(Position.KEY_ALARM, alarm);
if (channel != null && alarm.equals("help me")) {
channel.write("**,imei:" + imei + ",E;", remoteAddress);
}
@@ -205,7 +204,7 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
String rfid = parser.next();
if (alarm.equals("rfid")) {
- position.set(Event.KEY_RFID, rfid);
+ position.set(Position.KEY_RFID, rfid);
}
String utcHours = parser.next();
@@ -234,7 +233,7 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
position.setAltitude(parser.nextDouble());
for (int i = 1; i <= 5; i++) {
- position.set(Event.PREFIX_IO + i, parser.next());
+ position.set(Position.PREFIX_IO + i, parser.next());
}
return position;
diff --git a/src/org/traccar/protocol/GpsMarkerProtocolDecoder.java b/src/org/traccar/protocol/GpsMarkerProtocolDecoder.java
index e08886938..515958339 100644
--- a/src/org/traccar/protocol/GpsMarkerProtocolDecoder.java
+++ b/src/org/traccar/protocol/GpsMarkerProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -81,11 +80,11 @@ public class GpsMarkerProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(parser.nextDouble());
position.setCourse(parser.nextDouble());
- position.set(Event.KEY_SATELLITES, parser.next());
- position.set(Event.KEY_BATTERY, parser.next());
- position.set(Event.KEY_INPUT, parser.next());
- position.set(Event.KEY_OUTPUT, parser.next());
- position.set(Event.PREFIX_TEMP + 1, parser.next());
+ position.set(Position.KEY_SATELLITES, parser.next());
+ position.set(Position.KEY_BATTERY, parser.next());
+ position.set(Position.KEY_INPUT, parser.next());
+ position.set(Position.KEY_OUTPUT, parser.next());
+ position.set(Position.PREFIX_TEMP + 1, parser.next());
return position;
}
diff --git a/src/org/traccar/protocol/GpsmtaProtocolDecoder.java b/src/org/traccar/protocol/GpsmtaProtocolDecoder.java
index eee4afd36..b46d4c6f2 100644
--- a/src/org/traccar/protocol/GpsmtaProtocolDecoder.java
+++ b/src/org/traccar/protocol/GpsmtaProtocolDecoder.java
@@ -19,7 +19,6 @@ import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -75,10 +74,10 @@ public class GpsmtaProtocolDecoder extends BaseProtocolDecoder {
parser.next();
position.setAltitude(parser.nextInt());
- position.set(Event.KEY_STATUS, parser.nextInt());
- position.set(Event.KEY_BATTERY, parser.nextInt());
- position.set(Event.PREFIX_TEMP + 1, parser.nextInt());
- position.set(Event.KEY_CHARGE, parser.nextInt() == 1);
+ position.set(Position.KEY_STATUS, parser.nextInt());
+ position.set(Position.KEY_BATTERY, parser.nextInt());
+ position.set(Position.PREFIX_TEMP + 1, parser.nextInt());
+ position.set(Position.KEY_CHARGE, parser.nextInt() == 1);
if (channel != null) {
channel.write(time, remoteAddress);
diff --git a/src/org/traccar/protocol/Gt02ProtocolDecoder.java b/src/org/traccar/protocol/Gt02ProtocolDecoder.java
index 05655d87f..2cc31bb30 100644
--- a/src/org/traccar/protocol/Gt02ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gt02ProtocolDecoder.java
@@ -22,7 +22,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -58,7 +57,7 @@ public class Gt02ProtocolDecoder extends BaseProtocolDecoder {
}
position.setDeviceId(getDeviceId());
- position.set(Event.KEY_INDEX, buf.readUnsignedShort());
+ position.set(Position.KEY_INDEX, buf.readUnsignedShort());
int type = buf.readUnsignedByte();
@@ -66,8 +65,8 @@ public class Gt02ProtocolDecoder extends BaseProtocolDecoder {
getLastLocation(position, null);
- position.set(Event.KEY_POWER, power);
- position.set(Event.KEY_GSM, gsm);
+ position.set(Position.KEY_POWER, power);
+ position.set(Position.KEY_GSM, gsm);
if (channel != null) {
byte[] response = {0x54, 0x68, 0x1A, 0x0D, 0x0A};
diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
index 6dc382a04..e9799c1b0 100644
--- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -24,7 +24,6 @@ import org.traccar.helper.BitUtil;
import org.traccar.helper.Checksum;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -106,7 +105,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
position.setTime(dateBuilder.getDate());
int length = buf.readUnsignedByte();
- position.set(Event.KEY_SATELLITES, BitUtil.to(length, 4));
+ position.set(Position.KEY_SATELLITES, BitUtil.to(length, 4));
length = BitUtil.from(length, 4);
double latitude = buf.readUnsignedInt() / 60.0 / 30000.0;
@@ -128,7 +127,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
position.setLongitude(longitude);
if (BitUtil.check(flags, 14)) {
- position.set(Event.KEY_IGNITION, BitUtil.check(flags, 15));
+ position.set(Position.KEY_IGNITION, BitUtil.check(flags, 15));
}
buf.skipBytes(length - 12); // skip reserved
@@ -141,10 +140,10 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
lbsLength = buf.readUnsignedByte();
}
- position.set(Event.KEY_MCC, buf.readUnsignedShort());
- position.set(Event.KEY_MNC, buf.readUnsignedByte());
- position.set(Event.KEY_LAC, buf.readUnsignedShort());
- position.set(Event.KEY_CID, buf.readUnsignedMedium());
+ position.set(Position.KEY_MCC, buf.readUnsignedShort());
+ position.set(Position.KEY_MNC, buf.readUnsignedByte());
+ position.set(Position.KEY_LAC, buf.readUnsignedShort());
+ position.set(Position.KEY_CID, buf.readUnsignedMedium());
if (lbsLength > 0) {
buf.skipBytes(lbsLength - 9);
@@ -153,14 +152,14 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
private void decodeStatus(Position position, ChannelBuffer buf) {
- position.set(Event.KEY_ALARM, true);
+ position.set(Position.KEY_ALARM, true);
int flags = buf.readUnsignedByte();
- position.set(Event.KEY_IGNITION, BitUtil.check(flags, 1));
- position.set(Event.KEY_STATUS, flags);
- position.set(Event.KEY_POWER, buf.readUnsignedByte());
- position.set(Event.KEY_GSM, buf.readUnsignedByte());
+ position.set(Position.KEY_IGNITION, BitUtil.check(flags, 1));
+ position.set(Position.KEY_STATUS, flags);
+ position.set(Position.KEY_POWER, buf.readUnsignedByte());
+ position.set(Position.KEY_GSM, buf.readUnsignedByte());
}
@Override
@@ -246,14 +245,14 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
}
if (type == MSG_GPS_LBS_1 && buf.readableBytes() == 4 + 6) {
- position.set(Event.KEY_ODOMETER, buf.readUnsignedInt());
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
}
if (buf.readableBytes() > 6) {
buf.skipBytes(buf.readableBytes() - 6);
}
int index = buf.readUnsignedShort();
- position.set(Event.KEY_INDEX, index);
+ position.set(Position.KEY_INDEX, index);
sendResponse(channel, type, index);
return position;
diff --git a/src/org/traccar/protocol/H02ProtocolDecoder.java b/src/org/traccar/protocol/H02ProtocolDecoder.java
index 8230639e6..9ba30f12b 100644
--- a/src/org/traccar/protocol/H02ProtocolDecoder.java
+++ b/src/org/traccar/protocol/H02ProtocolDecoder.java
@@ -24,7 +24,6 @@ import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -65,10 +64,10 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder {
private void processStatus(Position position, long status) {
if (!BitUtil.check(status, 0) || !BitUtil.check(status, 1)
|| !BitUtil.check(status, 3) || !BitUtil.check(status, 4)) {
- position.set(Event.KEY_ALARM, true);
+ position.set(Position.KEY_ALARM, true);
}
- position.set(Event.KEY_IGNITION, !BitUtil.check(status, 10));
- position.set(Event.KEY_STATUS, status);
+ position.set(Position.KEY_IGNITION, !BitUtil.check(status, 10));
+ position.set(Position.KEY_STATUS, status);
}
private Position decodeBinary(ChannelBuffer buf, Channel channel, SocketAddress remoteAddress) {
@@ -93,7 +92,7 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder {
position.setTime(dateBuilder.getDate());
double latitude = readCoordinate(buf, false);
- position.set(Event.KEY_POWER, buf.readByte());
+ position.set(Position.KEY_POWER, buf.readByte());
double longitude = readCoordinate(buf, true);
int flags = buf.readUnsignedByte() & 0x0f;
diff --git a/src/org/traccar/protocol/HaicomProtocolDecoder.java b/src/org/traccar/protocol/HaicomProtocolDecoder.java
index fd989cecb..f8509d63a 100644
--- a/src/org/traccar/protocol/HaicomProtocolDecoder.java
+++ b/src/org/traccar/protocol/HaicomProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -71,7 +70,7 @@ public class HaicomProtocolDecoder extends BaseProtocolDecoder {
}
position.setDeviceId(getDeviceId());
- position.set(Event.KEY_VERSION, parser.next());
+ position.set(Position.KEY_VERSION, parser.next());
DateBuilder dateBuilder = new DateBuilder()
.setDate(parser.nextInt(), parser.nextInt(), parser.nextInt())
@@ -99,12 +98,12 @@ public class HaicomProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(parser.nextDouble() / 10);
position.setCourse(parser.nextDouble() / 10);
- position.set(Event.KEY_STATUS, parser.next());
- position.set(Event.KEY_GSM, parser.next());
- position.set(Event.KEY_GPS, parser.next());
- position.set(Event.KEY_INPUT, parser.next());
- position.set(Event.KEY_OUTPUT, parser.next());
- position.set(Event.KEY_BATTERY, parser.nextDouble() / 10);
+ position.set(Position.KEY_STATUS, parser.next());
+ position.set(Position.KEY_GSM, parser.next());
+ position.set(Position.KEY_GPS, parser.next());
+ position.set(Position.KEY_INPUT, parser.next());
+ position.set(Position.KEY_OUTPUT, parser.next());
+ position.set(Position.KEY_BATTERY, parser.nextDouble() / 10);
return position;
}
diff --git a/src/org/traccar/protocol/HomtecsProtocolDecoder.java b/src/org/traccar/protocol/HomtecsProtocolDecoder.java
index 0b1cd99e9..c09ef75b1 100644
--- a/src/org/traccar/protocol/HomtecsProtocolDecoder.java
+++ b/src/org/traccar/protocol/HomtecsProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -70,7 +69,7 @@ public class HomtecsProtocolDecoder extends BaseProtocolDecoder {
position.setTime(dateBuilder.getDate());
position.setValid(true);
- position.set(Event.KEY_SATELLITES, parser.nextInt());
+ position.set(Position.KEY_SATELLITES, parser.nextInt());
position.setLatitude(parser.nextCoordinate());
position.setLongitude(parser.nextCoordinate());
diff --git a/src/org/traccar/protocol/HuabaoProtocolDecoder.java b/src/org/traccar/protocol/HuabaoProtocolDecoder.java
index 1978fae94..55473e180 100644
--- a/src/org/traccar/protocol/HuabaoProtocolDecoder.java
+++ b/src/org/traccar/protocol/HuabaoProtocolDecoder.java
@@ -24,7 +24,6 @@ import org.traccar.helper.BitUtil;
import org.traccar.helper.Checksum;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -104,11 +103,11 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder {
position.setProtocol(getProtocolName());
position.setDeviceId(getDeviceId());
- position.set(Event.KEY_ALARM, buf.readUnsignedInt());
+ position.set(Position.KEY_ALARM, buf.readUnsignedInt());
int flags = buf.readInt();
- position.set(Event.KEY_IGNITION, BitUtil.check(flags, 0));
+ position.set(Position.KEY_IGNITION, BitUtil.check(flags, 0));
position.setValid(BitUtil.check(flags, 1));
diff --git a/src/org/traccar/protocol/IntellitracProtocolDecoder.java b/src/org/traccar/protocol/IntellitracProtocolDecoder.java
index 11f7aab8d..98ba90aa7 100644
--- a/src/org/traccar/protocol/IntellitracProtocolDecoder.java
+++ b/src/org/traccar/protocol/IntellitracProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -94,26 +93,26 @@ public class IntellitracProtocolDecoder extends BaseProtocolDecoder {
int satellites = parser.nextInt();
position.setValid(satellites >= 3);
- position.set(Event.KEY_SATELLITES, satellites);
+ position.set(Position.KEY_SATELLITES, satellites);
- position.set(Event.KEY_INDEX, parser.nextLong());
- position.set(Event.KEY_INPUT, parser.next());
- position.set(Event.KEY_OUTPUT, parser.next());
+ position.set(Position.KEY_INDEX, parser.nextLong());
+ position.set(Position.KEY_INPUT, parser.next());
+ position.set(Position.KEY_OUTPUT, parser.next());
- position.set(Event.PREFIX_ADC + 1, parser.next());
- position.set(Event.PREFIX_ADC + 2, parser.next());
+ position.set(Position.PREFIX_ADC + 1, parser.next());
+ position.set(Position.PREFIX_ADC + 2, parser.next());
// J1939 data
- position.set(Event.KEY_OBD_SPEED, parser.next());
- position.set(Event.KEY_RPM, parser.next());
+ position.set(Position.KEY_OBD_SPEED, parser.next());
+ position.set(Position.KEY_RPM, parser.next());
position.set("coolant", parser.next());
- position.set(Event.KEY_FUEL, parser.next());
+ position.set(Position.KEY_FUEL, parser.next());
position.set("consumption", parser.next());
- position.set(Event.PREFIX_TEMP + 1, parser.next());
- position.set(Event.KEY_CHARGE, parser.next());
+ position.set(Position.PREFIX_TEMP + 1, parser.next());
+ position.set(Position.KEY_CHARGE, parser.next());
position.set("tpl", parser.next());
position.set("axle", parser.next());
- position.set(Event.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.next());
return position;
}
diff --git a/src/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
index 5c247c08a..6529ff124 100644
--- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
@@ -24,7 +24,6 @@ import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -88,8 +87,8 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
if (version == 1) {
- position.set(Event.KEY_SATELLITES, buf.readUnsignedByte());
- position.set(Event.KEY_POWER, buf.readUnsignedByte());
+ position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
+ position.set(Position.KEY_POWER, buf.readUnsignedByte());
buf.readByte(); // other flags and sensors
@@ -98,21 +97,21 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
int cid = buf.readUnsignedShort();
int lac = buf.readUnsignedShort();
if (cid != 0 && lac != 0) {
- position.set(Event.KEY_CID, cid);
- position.set(Event.KEY_LAC, lac);
+ position.set(Position.KEY_CID, cid);
+ position.set(Position.KEY_LAC, lac);
}
- position.set(Event.KEY_GSM, buf.readUnsignedByte());
+ position.set(Position.KEY_GSM, buf.readUnsignedByte());
} else if (version == 2) {
int fuel = buf.readUnsignedByte() << 8;
- position.set(Event.KEY_STATUS, buf.readUnsignedInt());
- position.set(Event.KEY_ODOMETER, buf.readUnsignedInt());
+ position.set(Position.KEY_STATUS, buf.readUnsignedInt());
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
fuel += buf.readUnsignedByte();
- position.set(Event.KEY_FUEL, fuel);
+ position.set(Position.KEY_FUEL, fuel);
}
@@ -150,7 +149,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- position.set(Event.KEY_ALARM, true);
+ position.set(Position.KEY_ALARM, true);
if (!identify(parser.next(), channel, remoteAddress)) {
return null;
@@ -169,7 +168,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble()));
position.setCourse(parser.nextDouble());
- position.set(Event.KEY_POWER, parser.nextDouble());
+ position.set(Position.KEY_POWER, parser.nextDouble());
return position;
}
diff --git a/src/org/traccar/protocol/KenjiProtocolDecoder.java b/src/org/traccar/protocol/KenjiProtocolDecoder.java
index 39bd72b48..2756cb1ec 100755
--- a/src/org/traccar/protocol/KenjiProtocolDecoder.java
+++ b/src/org/traccar/protocol/KenjiProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -66,9 +65,9 @@ public class KenjiProtocolDecoder extends BaseProtocolDecoder {
}
position.setDeviceId(getDeviceId());
- position.set(Event.KEY_ALARM, parser.nextInt(16));
- position.set(Event.KEY_OUTPUT, parser.nextInt(16));
- position.set(Event.KEY_INPUT, parser.nextInt(16));
+ position.set(Position.KEY_ALARM, parser.nextInt(16));
+ position.set(Position.KEY_OUTPUT, parser.nextInt(16));
+ position.set(Position.KEY_INPUT, parser.nextInt(16));
DateBuilder dateBuilder = new DateBuilder()
.setTime(parser.nextInt(), parser.nextInt(), parser.nextInt());
@@ -83,7 +82,7 @@ public class KenjiProtocolDecoder extends BaseProtocolDecoder {
dateBuilder.setDateReverse(parser.nextInt(), parser.nextInt(), parser.nextInt());
position.setTime(dateBuilder.getDate());
- position.set(Event.KEY_SATELLITES, parser.nextInt());
+ position.set(Position.KEY_SATELLITES, parser.nextInt());
return position;
}
diff --git a/src/org/traccar/protocol/KhdProtocolDecoder.java b/src/org/traccar/protocol/KhdProtocolDecoder.java
index b54b8860f..f4350d2cc 100644
--- a/src/org/traccar/protocol/KhdProtocolDecoder.java
+++ b/src/org/traccar/protocol/KhdProtocolDecoder.java
@@ -23,7 +23,6 @@ import org.traccar.helper.BcdUtil;
import org.traccar.helper.Checksum;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -102,7 +101,7 @@ public class KhdProtocolDecoder extends BaseProtocolDecoder {
} else {
- position.set(Event.KEY_ODOMETER, buf.readUnsignedMedium());
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedMedium());
buf.skipBytes(4); // status
buf.skipBytes(8); // other
diff --git a/src/org/traccar/protocol/M2mProtocolDecoder.java b/src/org/traccar/protocol/M2mProtocolDecoder.java
index ad9db9a0b..9a328472c 100644
--- a/src/org/traccar/protocol/M2mProtocolDecoder.java
+++ b/src/org/traccar/protocol/M2mProtocolDecoder.java
@@ -19,7 +19,6 @@ import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -108,7 +107,7 @@ public class M2mProtocolDecoder extends BaseProtocolDecoder {
if (satellites == 0) {
return null; // cell information
}
- position.set(Event.KEY_SATELLITES, satellites);
+ position.set(Position.KEY_SATELLITES, satellites);
// decode other data
diff --git a/src/org/traccar/protocol/ManPowerProtocolDecoder.java b/src/org/traccar/protocol/ManPowerProtocolDecoder.java
index dd3d72d42..5ff111927 100644
--- a/src/org/traccar/protocol/ManPowerProtocolDecoder.java
+++ b/src/org/traccar/protocol/ManPowerProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -66,7 +65,7 @@ public class ManPowerProtocolDecoder extends BaseProtocolDecoder {
}
position.setDeviceId(getDeviceId());
- position.set(Event.KEY_STATUS, parser.next());
+ position.set(Position.KEY_STATUS, parser.next());
DateBuilder dateBuilder = new DateBuilder()
.setDate(parser.nextInt(), parser.nextInt(), parser.nextInt())
diff --git a/src/org/traccar/protocol/MegastekProtocolDecoder.java b/src/org/traccar/protocol/MegastekProtocolDecoder.java
index aa60dde58..0c332d0da 100644
--- a/src/org/traccar/protocol/MegastekProtocolDecoder.java
+++ b/src/org/traccar/protocol/MegastekProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -156,29 +155,29 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
Parser parser = new Parser(PATTERN_SIMPLE, status);
if (parser.matches()) {
- position.set(Event.KEY_ALARM, parser.next());
+ position.set(Position.KEY_ALARM, parser.next());
if (!identify(parser.next(), channel, remoteAddress, false) && !identify(id, channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
- position.set(Event.KEY_SATELLITES, parser.next());
+ position.set(Position.KEY_SATELLITES, parser.next());
position.setAltitude(parser.nextDouble());
- position.set(Event.KEY_POWER, parser.nextDouble());
+ position.set(Position.KEY_POWER, parser.nextDouble());
String charger = parser.next();
if (charger != null) {
- position.set(Event.KEY_CHARGE, Integer.parseInt(charger) == 1);
+ position.set(Position.KEY_CHARGE, Integer.parseInt(charger) == 1);
}
if (parser.hasNext(3)) {
- position.set(Event.KEY_MCC, parser.nextInt());
- position.set(Event.KEY_MNC, parser.nextInt());
- position.set(Event.KEY_LAC, parser.nextInt(16));
- position.set(Event.KEY_CID, parser.nextInt(16));
+ position.set(Position.KEY_MCC, parser.nextInt());
+ position.set(Position.KEY_MNC, parser.nextInt());
+ position.set(Position.KEY_LAC, parser.nextInt(16));
+ position.set(Position.KEY_CID, parser.nextInt(16));
}
} else {
@@ -200,21 +199,21 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
}
position.setDeviceId(getDeviceId());
- position.set(Event.KEY_MCC, parser.nextInt());
- position.set(Event.KEY_MNC, parser.nextInt());
- position.set(Event.KEY_LAC, parser.nextInt(16));
- position.set(Event.KEY_CID, parser.nextInt(16));
- position.set(Event.KEY_GSM, parser.next());
+ position.set(Position.KEY_MCC, parser.nextInt());
+ position.set(Position.KEY_MNC, parser.nextInt());
+ position.set(Position.KEY_LAC, parser.nextInt(16));
+ position.set(Position.KEY_CID, parser.nextInt(16));
+ position.set(Position.KEY_GSM, parser.next());
- position.set(Event.KEY_BATTERY, Double.parseDouble(parser.next()));
+ position.set(Position.KEY_BATTERY, Double.parseDouble(parser.next()));
- position.set(Event.KEY_FLAGS, parser.next());
- position.set(Event.KEY_INPUT, parser.next());
- position.set(Event.KEY_OUTPUT, parser.next());
- position.set(Event.PREFIX_ADC + 1, parser.next());
- position.set(Event.PREFIX_ADC + 2, parser.next());
- position.set(Event.PREFIX_ADC + 3, parser.next());
- position.set(Event.KEY_ALARM, parser.next());
+ position.set(Position.KEY_FLAGS, parser.next());
+ position.set(Position.KEY_INPUT, parser.next());
+ position.set(Position.KEY_OUTPUT, parser.next());
+ position.set(Position.PREFIX_ADC + 1, parser.next());
+ position.set(Position.PREFIX_ADC + 2, parser.next());
+ position.set(Position.PREFIX_ADC + 3, parser.next());
+ position.set(Position.KEY_ALARM, parser.next());
}
}
@@ -282,7 +281,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(getDeviceId());
if (parser.next().equals("S")) {
- position.set(Event.KEY_ARCHIVE, true);
+ position.set(Position.KEY_ARCHIVE, true);
}
DateBuilder dateBuilder = new DateBuilder()
@@ -294,46 +293,46 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
position.setLatitude(parser.nextCoordinate());
position.setLongitude(parser.nextCoordinate());
- position.set(Event.KEY_SATELLITES, parser.nextInt());
- position.set(Event.KEY_HDOP, parser.nextDouble());
+ position.set(Position.KEY_SATELLITES, parser.nextInt());
+ position.set(Position.KEY_HDOP, parser.nextDouble());
position.setSpeed(parser.nextDouble());
position.setCourse(parser.nextDouble());
position.setAltitude(parser.nextDouble());
- position.set(Event.KEY_ODOMETER, parser.nextDouble());
- position.set(Event.KEY_MCC, parser.nextInt());
- position.set(Event.KEY_MNC, parser.nextInt());
- position.set(Event.KEY_LAC, parser.nextInt(16));
- position.set(Event.KEY_CID, parser.nextInt(16));
+ position.set(Position.KEY_ODOMETER, parser.nextDouble());
+ position.set(Position.KEY_MCC, parser.nextInt());
+ position.set(Position.KEY_MNC, parser.nextInt());
+ position.set(Position.KEY_LAC, parser.nextInt(16));
+ position.set(Position.KEY_CID, parser.nextInt(16));
String gsm = parser.next();
if (gsm != null) {
- position.set(Event.KEY_GSM, Integer.parseInt(gsm));
+ position.set(Position.KEY_GSM, Integer.parseInt(gsm));
}
- position.set(Event.KEY_INPUT, parser.nextInt(2));
- position.set(Event.KEY_OUTPUT, parser.nextInt(2));
+ position.set(Position.KEY_INPUT, parser.nextInt(2));
+ position.set(Position.KEY_OUTPUT, parser.nextInt(2));
for (int i = 1; i <= 3; i++) {
- position.set(Event.PREFIX_ADC + i, parser.nextInt());
+ position.set(Position.PREFIX_ADC + i, parser.nextInt());
}
for (int i = 1; i <= 2; i++) {
String adc = parser.next();
if (adc != null) {
- position.set(Event.PREFIX_TEMP + i, Double.parseDouble(adc));
+ position.set(Position.PREFIX_TEMP + i, Double.parseDouble(adc));
}
}
- position.set(Event.KEY_RFID, parser.next());
+ position.set(Position.KEY_RFID, parser.next());
String battery = parser.next();
if (battery != null) {
- position.set(Event.KEY_BATTERY, Integer.parseInt(battery));
+ position.set(Position.KEY_BATTERY, Integer.parseInt(battery));
}
- position.set(Event.KEY_ALARM, parser.next());
+ position.set(Position.KEY_ALARM, parser.next());
return position;
}
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
index 92df085a6..48ee95c13 100644
--- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
@@ -24,7 +24,6 @@ import org.traccar.helper.Checksum;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.InetSocketAddress;
@@ -198,7 +197,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
// Custom data
if (command == MSG_ALARM) {
- position.set(Event.KEY_ALARM, buf.readUnsignedByte());
+ position.set(Position.KEY_ALARM, buf.readUnsignedByte());
} else if (command == MSG_POSITION_LOGGED) {
buf.skipBytes(6);
}
@@ -214,7 +213,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
if (rfid != 0) {
String card = String.format("%010d", rfid);
position.set("card" + (i + 1), card);
- position.set(Event.KEY_RFID, card);
+ position.set(Position.KEY_RFID, card);
}
}
}
@@ -266,33 +265,33 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
dateBuilder.setDateReverse(parser.nextInt(), parser.nextInt(), parser.nextInt());
position.setTime(dateBuilder.getDate());
- position.set(Event.KEY_HDOP, parser.next());
+ position.set(Position.KEY_HDOP, parser.next());
if (parser.hasNext()) {
position.setAltitude(parser.nextDouble());
}
- position.set(Event.KEY_STATUS, parser.next());
+ position.set(Position.KEY_STATUS, parser.next());
for (int i = 1; i <= 8; i++) {
if (parser.hasNext()) {
- position.set(Event.PREFIX_ADC + i, parser.nextInt(16));
+ position.set(Position.PREFIX_ADC + i, parser.nextInt(16));
}
}
if (parser.hasNext()) {
- position.set(Event.KEY_GSM, parser.nextInt(16));
+ position.set(Position.KEY_GSM, parser.nextInt(16));
}
if (parser.hasNext()) {
- position.set(Event.KEY_ODOMETER, parser.nextInt(16));
+ position.set(Position.KEY_ODOMETER, parser.nextInt(16));
}
if (parser.hasNext()) {
- position.set(Event.KEY_ODOMETER, parser.nextInt(16));
+ position.set(Position.KEY_ODOMETER, parser.nextInt(16));
}
if (parser.hasNext()) {
- position.set(Event.KEY_RFID, parser.nextInt(16));
+ position.set(Position.KEY_RFID, parser.nextInt(16));
}
}
diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java
index bbd7c521c..a03a3aeec 100644
--- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java
@@ -23,7 +23,6 @@ import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -97,7 +96,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(getDeviceId());
int event = parser.nextInt();
- position.set(Event.KEY_EVENT, event);
+ position.set(Position.KEY_EVENT, event);
position.setLatitude(parser.nextDouble());
position.setLongitude(parser.nextDouble());
@@ -109,38 +108,38 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
position.setValid(parser.next().equals("A"));
- position.set(Event.KEY_SATELLITES, parser.next());
- position.set(Event.KEY_GSM, parser.next());
+ position.set(Position.KEY_SATELLITES, parser.next());
+ position.set(Position.KEY_GSM, parser.next());
position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble()));
position.setCourse(parser.nextDouble());
- position.set(Event.KEY_HDOP, parser.next());
+ position.set(Position.KEY_HDOP, parser.next());
position.setAltitude(parser.nextDouble());
- position.set(Event.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.next());
position.set("runtime", parser.next());
- position.set(Event.KEY_MCC, parser.nextInt());
- position.set(Event.KEY_MNC, parser.nextInt());
- position.set(Event.KEY_LAC, parser.nextInt(16));
- position.set(Event.KEY_CID, parser.nextInt(16));
- position.set(Event.KEY_STATUS, parser.next());
+ position.set(Position.KEY_MCC, parser.nextInt());
+ position.set(Position.KEY_MNC, parser.nextInt());
+ position.set(Position.KEY_LAC, parser.nextInt(16));
+ position.set(Position.KEY_CID, parser.nextInt(16));
+ position.set(Position.KEY_STATUS, parser.next());
for (int i = 1; i <= 3; i++) {
if (parser.hasNext()) {
- position.set(Event.PREFIX_ADC + i, parser.nextInt(16));
+ position.set(Position.PREFIX_ADC + i, parser.nextInt(16));
}
}
- position.set(Event.KEY_BATTERY, parser.nextInt(16));
- position.set(Event.KEY_POWER, parser.nextInt(16));
+ position.set(Position.KEY_BATTERY, parser.nextInt(16));
+ position.set(Position.KEY_POWER, parser.nextInt(16));
String eventData = parser.next();
if (eventData != null && !eventData.isEmpty()) {
switch (event) {
case 37:
- position.set(Event.KEY_RFID, eventData);
+ position.set(Position.KEY_RFID, eventData);
break;
default:
position.set("event-data", eventData);
@@ -150,7 +149,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
if (parser.hasNext()) {
String fuel = parser.next();
- position.set(Event.KEY_FUEL,
+ position.set(Position.KEY_FUEL,
Integer.parseInt(fuel.substring(0, 2), 16) + Integer.parseInt(fuel.substring(2), 16) * 0.01);
}
@@ -176,7 +175,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
position.setProtocol(getProtocolName());
position.setDeviceId(getDeviceId());
- position.set(Event.KEY_EVENT, buf.readUnsignedByte());
+ position.set(Position.KEY_EVENT, buf.readUnsignedByte());
position.setLatitude(buf.readInt() * 0.000001);
position.setLongitude(buf.readInt() * 0.000001);
@@ -185,27 +184,27 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
position.setValid(buf.readUnsignedByte() == 1);
- position.set(Event.KEY_SATELLITES, buf.readUnsignedByte());
- position.set(Event.KEY_GSM, buf.readUnsignedByte());
+ position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
+ position.set(Position.KEY_GSM, buf.readUnsignedByte());
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShort()));
position.setCourse(buf.readUnsignedShort());
- position.set(Event.KEY_HDOP, buf.readUnsignedShort() * 0.1);
+ position.set(Position.KEY_HDOP, buf.readUnsignedShort() * 0.1);
position.setAltitude(buf.readUnsignedShort());
- position.set(Event.KEY_ODOMETER, buf.readUnsignedInt());
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
position.set("runtime", buf.readUnsignedInt());
- position.set(Event.KEY_MCC, buf.readUnsignedShort());
- position.set(Event.KEY_MNC, buf.readUnsignedShort());
- position.set(Event.KEY_LAC, buf.readUnsignedShort());
- position.set(Event.KEY_CID, buf.readUnsignedShort());
- position.set(Event.KEY_STATUS, buf.readUnsignedShort());
-
- position.set(Event.PREFIX_ADC + 1, buf.readUnsignedShort());
- position.set(Event.KEY_BATTERY, buf.readUnsignedShort() * 0.01);
- position.set(Event.KEY_POWER, buf.readUnsignedShort());
+ position.set(Position.KEY_MCC, buf.readUnsignedShort());
+ position.set(Position.KEY_MNC, buf.readUnsignedShort());
+ position.set(Position.KEY_LAC, buf.readUnsignedShort());
+ position.set(Position.KEY_CID, buf.readUnsignedShort());
+ position.set(Position.KEY_STATUS, buf.readUnsignedShort());
+
+ position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort());
+ position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.01);
+ position.set(Position.KEY_POWER, buf.readUnsignedShort());
buf.readUnsignedInt(); // geo-fence
diff --git a/src/org/traccar/protocol/MiniFinderProtocol.java b/src/org/traccar/protocol/MiniFinderProtocol.java
index e9f6d4cde..d237fe0aa 100644
--- a/src/org/traccar/protocol/MiniFinderProtocol.java
+++ b/src/org/traccar/protocol/MiniFinderProtocol.java
@@ -22,8 +22,6 @@ import org.jboss.netty.handler.codec.string.StringEncoder;
import org.traccar.BaseProtocol;
import org.traccar.CharacterDelimiterFrameDecoder;
import org.traccar.TrackerServer;
-import org.traccar.model.Command;
-
import java.util.List;
public class MiniFinderProtocol extends BaseProtocol {
diff --git a/src/org/traccar/protocol/MiniFinderProtocolDecoder.java b/src/org/traccar/protocol/MiniFinderProtocolDecoder.java
index 42962f2f0..089b491d2 100644
--- a/src/org/traccar/protocol/MiniFinderProtocolDecoder.java
+++ b/src/org/traccar/protocol/MiniFinderProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -91,13 +90,13 @@ public class MiniFinderProtocolDecoder extends BaseProtocolDecoder {
if (parser.hasNext(5)) {
int flags = parser.nextInt(16);
- position.set(Event.KEY_FLAGS, flags);
+ position.set(Position.KEY_FLAGS, flags);
position.setValid(BitUtil.check(flags, 0));
position.setAltitude(parser.nextDouble());
- position.set(Event.KEY_BATTERY, parser.next());
- position.set(Event.KEY_SATELLITES, parser.next());
+ position.set(Position.KEY_BATTERY, parser.next());
+ position.set(Position.KEY_SATELLITES, parser.next());
}
diff --git a/src/org/traccar/protocol/Mta6ProtocolDecoder.java b/src/org/traccar/protocol/Mta6ProtocolDecoder.java
index aea6cbddc..791a1acab 100644
--- a/src/org/traccar/protocol/Mta6ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Mta6ProtocolDecoder.java
@@ -28,7 +28,6 @@ import org.traccar.Protocol;
import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Log;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -155,39 +154,39 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder {
}
if (BitUtil.check(flags, 3)) {
- position.set(Event.KEY_ODOMETER, buf.readUnsignedShort());
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedShort());
}
if (BitUtil.check(flags, 4)) {
- position.set(Event.KEY_FUEL, buf.readUnsignedInt() + "|" + buf.readUnsignedInt());
+ position.set(Position.KEY_FUEL, buf.readUnsignedInt() + "|" + buf.readUnsignedInt());
position.set("hours1", buf.readUnsignedShort());
position.set("hours2", buf.readUnsignedShort());
}
if (BitUtil.check(flags, 5)) {
- position.set(Event.PREFIX_ADC + 1, buf.readUnsignedShort() & 0x03ff);
- position.set(Event.PREFIX_ADC + 2, buf.readUnsignedShort() & 0x03ff);
- position.set(Event.PREFIX_ADC + 3, buf.readUnsignedShort() & 0x03ff);
- position.set(Event.PREFIX_ADC + 4, buf.readUnsignedShort() & 0x03ff);
+ position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort() & 0x03ff);
+ position.set(Position.PREFIX_ADC + 2, buf.readUnsignedShort() & 0x03ff);
+ position.set(Position.PREFIX_ADC + 3, buf.readUnsignedShort() & 0x03ff);
+ position.set(Position.PREFIX_ADC + 4, buf.readUnsignedShort() & 0x03ff);
}
if (BitUtil.check(flags, 6)) {
- position.set(Event.PREFIX_TEMP + 1, buf.readByte());
+ position.set(Position.PREFIX_TEMP + 1, buf.readByte());
buf.getUnsignedByte(buf.readerIndex()); // control (>> 4)
- position.set(Event.KEY_INPUT, buf.readUnsignedShort() & 0x0fff);
+ position.set(Position.KEY_INPUT, buf.readUnsignedShort() & 0x0fff);
buf.readUnsignedShort(); // old sensor state (& 0x0fff)
}
if (BitUtil.check(flags, 7)) {
- position.set(Event.KEY_BATTERY, buf.getUnsignedByte(buf.readerIndex()) >> 2);
- position.set(Event.KEY_POWER, buf.readUnsignedShort() & 0x03ff);
+ position.set(Position.KEY_BATTERY, buf.getUnsignedByte(buf.readerIndex()) >> 2);
+ position.set(Position.KEY_POWER, buf.readUnsignedShort() & 0x03ff);
buf.readByte(); // microcontroller temperature
- position.set(Event.KEY_GSM, (buf.getUnsignedByte(buf.readerIndex()) >> 4) & 0x07);
+ position.set(Position.KEY_GSM, (buf.getUnsignedByte(buf.readerIndex()) >> 4) & 0x07);
int satellites = buf.readUnsignedByte() & 0x0f;
position.setValid(satellites >= 3);
- position.set(Event.KEY_SATELLITES, satellites);
+ position.set(Position.KEY_SATELLITES, satellites);
}
positions.add(position);
}
@@ -227,7 +226,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder {
position.setAltitude(buf.readUnsignedShort());
position.setSpeed(buf.readUnsignedByte());
position.setCourse(buf.readByte());
- position.set(Event.KEY_ODOMETER, new FloatReader().readFloat(buf));
+ position.set(Position.KEY_ODOMETER, new FloatReader().readFloat(buf));
}
if (BitUtil.check(flags, 1)) {
@@ -239,34 +238,34 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder {
if (BitUtil.check(flags, 2)) {
position.set("engine", buf.readUnsignedShort() * 0.125);
position.set("pedals", buf.readUnsignedByte());
- position.set(Event.PREFIX_TEMP + 1, buf.readUnsignedByte() - 40);
+ position.set(Position.PREFIX_TEMP + 1, buf.readUnsignedByte() - 40);
buf.readUnsignedShort(); // service odometer
}
if (BitUtil.check(flags, 3)) {
- position.set(Event.KEY_FUEL, buf.readUnsignedShort());
- position.set(Event.PREFIX_ADC + 2, buf.readUnsignedShort());
- position.set(Event.PREFIX_ADC + 3, buf.readUnsignedShort());
- position.set(Event.PREFIX_ADC + 4, buf.readUnsignedShort());
+ position.set(Position.KEY_FUEL, buf.readUnsignedShort());
+ position.set(Position.PREFIX_ADC + 2, buf.readUnsignedShort());
+ position.set(Position.PREFIX_ADC + 3, buf.readUnsignedShort());
+ position.set(Position.PREFIX_ADC + 4, buf.readUnsignedShort());
}
if (BitUtil.check(flags, 4)) {
- position.set(Event.PREFIX_TEMP + 1, buf.readByte());
+ position.set(Position.PREFIX_TEMP + 1, buf.readByte());
buf.getUnsignedByte(buf.readerIndex()); // control (>> 4)
- position.set(Event.KEY_INPUT, buf.readUnsignedShort() & 0x0fff);
+ position.set(Position.KEY_INPUT, buf.readUnsignedShort() & 0x0fff);
buf.readUnsignedShort(); // old sensor state (& 0x0fff)
}
if (BitUtil.check(flags, 5)) {
- position.set(Event.KEY_BATTERY, buf.getUnsignedByte(buf.readerIndex()) >> 2);
- position.set(Event.KEY_POWER, buf.readUnsignedShort() & 0x03ff);
+ position.set(Position.KEY_BATTERY, buf.getUnsignedByte(buf.readerIndex()) >> 2);
+ position.set(Position.KEY_POWER, buf.readUnsignedShort() & 0x03ff);
buf.readByte(); // microcontroller temperature
- position.set(Event.KEY_GSM, buf.getUnsignedByte(buf.readerIndex()) >> 5);
+ position.set(Position.KEY_GSM, buf.getUnsignedByte(buf.readerIndex()) >> 5);
int satellites = buf.readUnsignedByte() & 0x1f;
position.setValid(satellites >= 3);
- position.set(Event.KEY_SATELLITES, satellites);
+ position.set(Position.KEY_SATELLITES, satellites);
}
// other data
diff --git a/src/org/traccar/protocol/MtxProtocolDecoder.java b/src/org/traccar/protocol/MtxProtocolDecoder.java
index b524c23bb..8af10c7d8 100644
--- a/src/org/traccar/protocol/MtxProtocolDecoder.java
+++ b/src/org/traccar/protocol/MtxProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -88,11 +87,11 @@ public class MtxProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(parser.nextDouble());
position.setCourse(parser.nextDouble());
- position.set(Event.KEY_ODOMETER, parser.nextDouble());
- position.set(Event.KEY_INPUT, parser.next());
- position.set(Event.KEY_OUTPUT, parser.next());
- position.set(Event.PREFIX_ADC + 1, parser.next());
- position.set(Event.PREFIX_ADC + 2, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.nextDouble());
+ position.set(Position.KEY_INPUT, parser.next());
+ position.set(Position.KEY_OUTPUT, parser.next());
+ position.set(Position.PREFIX_ADC + 1, parser.next());
+ position.set(Position.PREFIX_ADC + 2, parser.next());
return position;
}
diff --git a/src/org/traccar/protocol/MxtProtocolDecoder.java b/src/org/traccar/protocol/MxtProtocolDecoder.java
index 600be753d..92e941e6d 100644
--- a/src/org/traccar/protocol/MxtProtocolDecoder.java
+++ b/src/org/traccar/protocol/MxtProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -60,7 +59,7 @@ public class MxtProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte(); // protocol
int infoGroups = buf.readUnsignedByte();
- position.set(Event.KEY_INDEX, buf.readUnsignedShort());
+ position.set(Position.KEY_INDEX, buf.readUnsignedShort());
DateBuilder dateBuilder = new DateBuilder().setDate(2000, 1, 1);
@@ -80,13 +79,13 @@ public class MxtProtocolDecoder extends BaseProtocolDecoder {
position.setLongitude(buf.readInt() / 1000000.0);
long flags = buf.readUnsignedInt();
- position.set(Event.KEY_IGNITION, BitUtil.check(flags, 0));
- position.set(Event.KEY_ALARM, BitUtil.check(flags, 1));
- position.set(Event.KEY_INPUT, BitUtil.between(flags, 2, 7));
- position.set(Event.KEY_OUTPUT, BitUtil.between(flags, 7, 10));
+ position.set(Position.KEY_IGNITION, BitUtil.check(flags, 0));
+ position.set(Position.KEY_ALARM, BitUtil.check(flags, 1));
+ position.set(Position.KEY_INPUT, BitUtil.between(flags, 2, 7));
+ position.set(Position.KEY_OUTPUT, BitUtil.between(flags, 7, 10));
position.setCourse(BitUtil.between(flags, 10, 13) * 45);
//position.setValid(BitUtil.check(flags, 15));
- position.set(Event.KEY_CHARGE, BitUtil.check(flags, 20));
+ position.set(Position.KEY_CHARGE, BitUtil.check(flags, 20));
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedByte()));
@@ -101,21 +100,21 @@ public class MxtProtocolDecoder extends BaseProtocolDecoder {
}
if (BitUtil.check(infoGroups, 2)) {
- position.set(Event.KEY_SATELLITES, buf.readUnsignedByte());
- position.set(Event.KEY_HDOP, buf.readUnsignedByte());
+ position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
+ position.set(Position.KEY_HDOP, buf.readUnsignedByte());
buf.readUnsignedByte(); // GPS accuracy
- position.set(Event.KEY_GSM, buf.readUnsignedByte());
+ position.set(Position.KEY_GSM, buf.readUnsignedByte());
buf.readUnsignedShort(); // time since boot
buf.readUnsignedByte(); // input voltage
- position.set(Event.PREFIX_TEMP + 1, buf.readByte());
+ position.set(Position.PREFIX_TEMP + 1, buf.readByte());
}
if (BitUtil.check(infoGroups, 3)) {
- position.set(Event.KEY_ODOMETER, buf.readUnsignedInt());
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
}
if (BitUtil.check(infoGroups, 4)) {
- position.set(Event.KEY_HOURS, buf.readUnsignedInt());
+ position.set(Position.KEY_HOURS, buf.readUnsignedInt());
}
if (BitUtil.check(infoGroups, 5)) {
@@ -123,12 +122,12 @@ public class MxtProtocolDecoder extends BaseProtocolDecoder {
}
if (BitUtil.check(infoGroups, 6)) {
- position.set(Event.KEY_POWER, buf.readUnsignedShort() * 0.001);
- position.set(Event.KEY_BATTERY, buf.readUnsignedShort());
+ position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.001);
+ position.set(Position.KEY_BATTERY, buf.readUnsignedShort());
}
if (BitUtil.check(infoGroups, 7)) {
- position.set(Event.KEY_RFID, buf.readUnsignedInt());
+ position.set(Position.KEY_RFID, buf.readUnsignedInt());
}
return position;
diff --git a/src/org/traccar/protocol/NavigilProtocolDecoder.java b/src/org/traccar/protocol/NavigilProtocolDecoder.java
index 22ae7ddee..8dd4e140b 100644
--- a/src/org/traccar/protocol/NavigilProtocolDecoder.java
+++ b/src/org/traccar/protocol/NavigilProtocolDecoder.java
@@ -22,7 +22,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.Checksum;
import org.traccar.helper.Log;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -84,7 +83,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
position.setProtocol(getProtocolName());
position.setValid(true);
- position.set(Event.KEY_INDEX, sequenceNumber);
+ position.set(Position.KEY_INDEX, sequenceNumber);
position.setDeviceId(getDeviceId());
buf.readUnsignedShort(); // report trigger
@@ -104,7 +103,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedInt(); // distance
buf.readUnsignedInt(); // delta distance
- position.set(Event.KEY_BATTERY, buf.readUnsignedShort() * 0.001);
+ position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001);
buf.readUnsignedShort(); // battery charger status
@@ -118,7 +117,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
position.setProtocol(getProtocolName());
position.setValid(true);
- position.set(Event.KEY_INDEX, sequenceNumber);
+ position.set(Position.KEY_INDEX, sequenceNumber);
position.setDeviceId(getDeviceId());
buf.readUnsignedShort(); // report trigger
@@ -144,7 +143,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedShort(); // VSAUT1 voltage
buf.readUnsignedShort(); // VSAUT2 voltage
buf.readUnsignedShort(); // solar voltage
- position.set(Event.KEY_BATTERY, buf.readUnsignedShort() * 0.001);
+ position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001);
return position;
}
@@ -153,7 +152,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- position.set(Event.KEY_INDEX, sequenceNumber);
+ position.set(Position.KEY_INDEX, sequenceNumber);
position.setDeviceId(getDeviceId());
position.setTime(convertTimestamp(timestamp));
@@ -174,7 +173,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- position.set(Event.KEY_INDEX, sequenceNumber);
+ position.set(Position.KEY_INDEX, sequenceNumber);
position.setDeviceId(getDeviceId());
position.setTime(convertTimestamp(timestamp));
@@ -188,7 +187,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
short flags = buf.readUnsignedByte();
position.setValid((flags & 0x80) == 0x80 && (flags & 0x40) == 0x40);
- position.set(Event.KEY_SATELLITES, buf.readUnsignedByte());
+ position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
buf.readUnsignedInt(); // distance
return position;
}
@@ -197,7 +196,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- position.set(Event.KEY_INDEX, sequenceNumber);
+ position.set(Position.KEY_INDEX, sequenceNumber);
position.setDeviceId(getDeviceId());
buf.readUnsignedByte(); // report trigger
@@ -226,7 +225,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte(); // supply voltage 1
buf.readUnsignedByte(); // supply voltage 2
- position.set(Event.KEY_BATTERY, buf.readUnsignedShort() * 0.001);
+ position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001);
return position;
}
@@ -235,7 +234,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- position.set(Event.KEY_INDEX, sequenceNumber);
+ position.set(Position.KEY_INDEX, sequenceNumber);
position.setDeviceId(getDeviceId());
position.setTime(convertTimestamp(timestamp));
@@ -254,7 +253,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte(); // satellites in fix
- position.set(Event.KEY_BATTERY, buf.readUnsignedShort() * 0.001);
+ position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001);
buf.readUnsignedInt(); // distance
return position;
diff --git a/src/org/traccar/protocol/NavisProtocolDecoder.java b/src/org/traccar/protocol/NavisProtocolDecoder.java
index 06af49893..fbd704355 100644
--- a/src/org/traccar/protocol/NavisProtocolDecoder.java
+++ b/src/org/traccar/protocol/NavisProtocolDecoder.java
@@ -22,7 +22,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Log;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -91,38 +90,38 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
position.set("format", format);
long index = buf.readUnsignedInt();
- position.set(Event.KEY_INDEX, index);
+ position.set(Position.KEY_INDEX, index);
- position.set(Event.KEY_EVENT, buf.readUnsignedShort());
+ position.set(Position.KEY_EVENT, buf.readUnsignedShort());
buf.skipBytes(6); // event time
- position.set(Event.KEY_ALARM, buf.readUnsignedByte());
- position.set(Event.KEY_STATUS, buf.readUnsignedByte());
- position.set(Event.KEY_GSM, buf.readUnsignedByte());
+ position.set(Position.KEY_ALARM, buf.readUnsignedByte());
+ position.set(Position.KEY_STATUS, buf.readUnsignedByte());
+ position.set(Position.KEY_GSM, buf.readUnsignedByte());
if (isFormat(format, F10, F20, F30)) {
- position.set(Event.KEY_OUTPUT, buf.readUnsignedShort());
+ position.set(Position.KEY_OUTPUT, buf.readUnsignedShort());
} else if (isFormat(format, F40, F50, F51, F52)) {
- position.set(Event.KEY_OUTPUT, buf.readUnsignedByte());
+ position.set(Position.KEY_OUTPUT, buf.readUnsignedByte());
}
if (isFormat(format, F10, F20, F30, F40)) {
- position.set(Event.KEY_INPUT, buf.readUnsignedShort());
+ position.set(Position.KEY_INPUT, buf.readUnsignedShort());
} else if (isFormat(format, F50, F51, F52)) {
- position.set(Event.KEY_INPUT, buf.readUnsignedByte());
+ position.set(Position.KEY_INPUT, buf.readUnsignedByte());
}
- position.set(Event.KEY_POWER, buf.readUnsignedShort() * 0.001);
- position.set(Event.KEY_BATTERY, buf.readUnsignedShort());
+ position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.001);
+ position.set(Position.KEY_BATTERY, buf.readUnsignedShort());
if (isFormat(format, F10, F20, F30)) {
- position.set(Event.PREFIX_TEMP + 1, buf.readShort());
+ position.set(Position.PREFIX_TEMP + 1, buf.readShort());
}
if (isFormat(format, F10, F20, F50, F52)) {
- position.set(Event.PREFIX_ADC + 1, buf.readUnsignedShort());
- position.set(Event.PREFIX_ADC + 2, buf.readUnsignedShort());
+ position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort());
+ position.set(Position.PREFIX_ADC + 2, buf.readUnsignedShort());
}
// Impulse counters
@@ -145,7 +144,7 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(buf.readFloat());
position.setCourse(buf.readUnsignedShort());
- position.set(Event.KEY_ODOMETER, buf.readFloat());
+ position.set(Position.KEY_ODOMETER, buf.readFloat());
position.set("segment", buf.readFloat()); // last segment
diff --git a/src/org/traccar/protocol/NoranProtocolDecoder.java b/src/org/traccar/protocol/NoranProtocolDecoder.java
index 693947e58..2fe680560 100644
--- a/src/org/traccar/protocol/NoranProtocolDecoder.java
+++ b/src/org/traccar/protocol/NoranProtocolDecoder.java
@@ -22,7 +22,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -90,7 +89,7 @@ public class NoranProtocolDecoder extends BaseProtocolDecoder {
position.setValid(BitUtil.check(buf.readUnsignedByte(), 0));
- position.set(Event.KEY_ALARM, buf.readUnsignedByte());
+ position.set(Position.KEY_ALARM, buf.readUnsignedByte());
if (newFormat) {
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedInt()));
@@ -133,11 +132,11 @@ public class NoranProtocolDecoder extends BaseProtocolDecoder {
}
if (!newFormat) {
- position.set(Event.PREFIX_IO + 1, buf.readUnsignedByte());
- position.set(Event.KEY_FUEL, buf.readUnsignedByte());
+ position.set(Position.PREFIX_IO + 1, buf.readUnsignedByte());
+ position.set(Position.KEY_FUEL, buf.readUnsignedByte());
} else if (type == MSG_UPLOAD_POSITION_NEW) {
- position.set(Event.PREFIX_TEMP + 1, buf.readShort());
- position.set(Event.KEY_ODOMETER, buf.readFloat());
+ position.set(Position.PREFIX_TEMP + 1, buf.readShort());
+ position.set(Position.KEY_ODOMETER, buf.readFloat());
}
return position;
diff --git a/src/org/traccar/protocol/NvsProtocolDecoder.java b/src/org/traccar/protocol/NvsProtocolDecoder.java
index 5d91a04ab..2a195c599 100644
--- a/src/org/traccar/protocol/NvsProtocolDecoder.java
+++ b/src/org/traccar/protocol/NvsProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -84,7 +83,7 @@ public class NvsProtocolDecoder extends BaseProtocolDecoder {
position.setAltitude(buf.readShort());
position.setCourse(buf.readUnsignedShort());
- position.set(Event.KEY_SATELLITES, buf.readUnsignedByte());
+ position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShort()));
position.setValid(buf.readUnsignedByte() != 0);
@@ -96,25 +95,25 @@ public class NvsProtocolDecoder extends BaseProtocolDecoder {
// Read 1 byte data
int cnt = buf.readUnsignedByte();
for (int j = 0; j < cnt; j++) {
- position.set(Event.PREFIX_IO + buf.readUnsignedByte(), buf.readUnsignedByte());
+ position.set(Position.PREFIX_IO + buf.readUnsignedByte(), buf.readUnsignedByte());
}
// Read 2 byte data
cnt = buf.readUnsignedByte();
for (int j = 0; j < cnt; j++) {
- position.set(Event.PREFIX_IO + buf.readUnsignedByte(), buf.readUnsignedShort());
+ position.set(Position.PREFIX_IO + buf.readUnsignedByte(), buf.readUnsignedShort());
}
// Read 4 byte data
cnt = buf.readUnsignedByte();
for (int j = 0; j < cnt; j++) {
- position.set(Event.PREFIX_IO + buf.readUnsignedByte(), buf.readUnsignedInt());
+ position.set(Position.PREFIX_IO + buf.readUnsignedByte(), buf.readUnsignedInt());
}
// Read 8 byte data
cnt = buf.readUnsignedByte();
for (int j = 0; j < cnt; j++) {
- position.set(Event.PREFIX_IO + buf.readUnsignedByte(), buf.readLong());
+ position.set(Position.PREFIX_IO + buf.readUnsignedByte(), buf.readLong());
}
positions.add(position);
diff --git a/src/org/traccar/protocol/OrionProtocolDecoder.java b/src/org/traccar/protocol/OrionProtocolDecoder.java
index 341110ea8..0f6d88203 100644
--- a/src/org/traccar/protocol/OrionProtocolDecoder.java
+++ b/src/org/traccar/protocol/OrionProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -81,9 +80,9 @@ public class OrionProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(getDeviceId());
position.setProtocol(getProtocolName());
- position.set(Event.KEY_EVENT, buf.readUnsignedByte());
+ position.set(Position.KEY_EVENT, buf.readUnsignedByte());
buf.readUnsignedByte(); // length
- position.set(Event.KEY_FLAGS, buf.readUnsignedShort());
+ position.set(Position.KEY_FLAGS, buf.readUnsignedShort());
position.setLatitude(convertCoordinate(buf.readInt()));
position.setLongitude(convertCoordinate(buf.readInt()));
@@ -98,7 +97,7 @@ public class OrionProtocolDecoder extends BaseProtocolDecoder {
int satellites = buf.readUnsignedByte();
position.setValid(satellites >= 3);
- position.set(Event.KEY_SATELLITES, satellites);
+ position.set(Position.KEY_SATELLITES, satellites);
positions.add(position);
}
diff --git a/src/org/traccar/protocol/OsmAndProtocolDecoder.java b/src/org/traccar/protocol/OsmAndProtocolDecoder.java
index 61a83f317..cea2e6b56 100644
--- a/src/org/traccar/protocol/OsmAndProtocolDecoder.java
+++ b/src/org/traccar/protocol/OsmAndProtocolDecoder.java
@@ -25,7 +25,6 @@ import org.jboss.netty.handler.codec.http.HttpVersion;
import org.jboss.netty.handler.codec.http.QueryStringDecoder;
import org.joda.time.format.ISODateTimeFormat;
import org.traccar.BaseProtocolDecoder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -106,10 +105,10 @@ public class OsmAndProtocolDecoder extends BaseProtocolDecoder {
position.setAltitude(Double.parseDouble(value));
break;
case "hdop":
- position.set(Event.KEY_HDOP, Double.parseDouble(value));
+ position.set(Position.KEY_HDOP, Double.parseDouble(value));
break;
case "batt":
- position.set(Event.KEY_BATTERY, value);
+ position.set(Position.KEY_BATTERY, value);
break;
default:
position.set(entry.getKey(), value);
diff --git a/src/org/traccar/protocol/PiligrimProtocolDecoder.java b/src/org/traccar/protocol/PiligrimProtocolDecoder.java
index b191d2d1f..48e694b19 100644
--- a/src/org/traccar/protocol/PiligrimProtocolDecoder.java
+++ b/src/org/traccar/protocol/PiligrimProtocolDecoder.java
@@ -27,7 +27,6 @@ import org.jboss.netty.handler.codec.http.QueryStringDecoder;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -127,7 +126,7 @@ public class PiligrimProtocolDecoder extends BaseProtocolDecoder {
position.setLongitude(longitude);
int satellites = buf.readUnsignedByte();
- position.set(Event.KEY_SATELLITES, satellites);
+ position.set(Position.KEY_SATELLITES, satellites);
position.setValid(satellites >= 3);
position.setSpeed(buf.readUnsignedByte());
@@ -140,11 +139,11 @@ public class PiligrimProtocolDecoder extends BaseProtocolDecoder {
if (type == MSG_GPS_SENSORS) {
double power = buf.readUnsignedByte();
power += buf.readUnsignedByte() << 8;
- position.set(Event.KEY_POWER, power * 0.01);
+ position.set(Position.KEY_POWER, power * 0.01);
double battery = buf.readUnsignedByte();
battery += buf.readUnsignedByte() << 8;
- position.set(Event.KEY_BATTERY, battery * 0.01);
+ position.set(Position.KEY_BATTERY, battery * 0.01);
buf.skipBytes(6);
}
diff --git a/src/org/traccar/protocol/ProgressProtocolDecoder.java b/src/org/traccar/protocol/ProgressProtocolDecoder.java
index e45cf313c..0439c99db 100644
--- a/src/org/traccar/protocol/ProgressProtocolDecoder.java
+++ b/src/org/traccar/protocol/ProgressProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.BitUtil;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -96,17 +95,17 @@ public class ProgressProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(getDeviceId());
if (type == MSG_LOGMSG) {
- position.set(Event.KEY_ARCHIVE, true);
+ position.set(Position.KEY_ARCHIVE, true);
int subtype = buf.readUnsignedShort();
if (subtype == MSG_ALARM) {
- position.set(Event.KEY_ALARM, true);
+ position.set(Position.KEY_ALARM, true);
}
if (buf.readUnsignedShort() > buf.readableBytes()) {
lastIndex += 1;
break; // workaround for device bug
}
lastIndex = buf.readUnsignedInt();
- position.set(Event.KEY_INDEX, lastIndex);
+ position.set(Position.KEY_INDEX, lastIndex);
} else {
newIndex = buf.readUnsignedInt();
}
@@ -120,17 +119,17 @@ public class ProgressProtocolDecoder extends BaseProtocolDecoder {
int satellites = buf.readUnsignedByte();
position.setValid(satellites >= 3);
- position.set(Event.KEY_SATELLITES, satellites);
+ position.set(Position.KEY_SATELLITES, satellites);
- position.set(Event.KEY_GSM, buf.readUnsignedByte());
- position.set(Event.KEY_ODOMETER, buf.readUnsignedInt());
+ position.set(Position.KEY_GSM, buf.readUnsignedByte());
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
long extraFlags = buf.readLong();
if (BitUtil.check(extraFlags, 0)) {
int count = buf.readUnsignedShort();
for (int i = 1; i <= count; i++) {
- position.set(Event.PREFIX_ADC + i, buf.readUnsignedShort());
+ position.set(Position.PREFIX_ADC + i, buf.readUnsignedShort());
}
}
@@ -146,7 +145,7 @@ public class ProgressProtocolDecoder extends BaseProtocolDecoder {
}
if (type == MSG_ALARM) {
- position.set(Event.KEY_ALARM, true);
+ position.set(Position.KEY_ALARM, true);
byte[] response = {(byte) 0xC9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
channel.write(ChannelBuffers.wrappedBuffer(response));
}
diff --git a/src/org/traccar/protocol/Pt502ProtocolDecoder.java b/src/org/traccar/protocol/Pt502ProtocolDecoder.java
index 5a1a97056..850e9fcff 100644
--- a/src/org/traccar/protocol/Pt502ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Pt502ProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -86,24 +85,24 @@ public class Pt502ProtocolDecoder extends BaseProtocolDecoder {
dateBuilder.setDateReverse(parser.nextInt(), parser.nextInt(), parser.nextInt());
position.setTime(dateBuilder.getDate());
- position.set(Event.KEY_INPUT, parser.next());
- position.set(Event.KEY_OUTPUT, parser.next());
+ position.set(Position.KEY_INPUT, parser.next());
+ position.set(Position.KEY_OUTPUT, parser.next());
if (parser.hasNext()) {
String[] values = parser.next().split(",");
for (int i = 0; i < values.length; i++) {
- position.set(Event.PREFIX_ADC + (i + 1), Integer.parseInt(values[i], 16));
+ position.set(Position.PREFIX_ADC + (i + 1), Integer.parseInt(values[i], 16));
}
}
- position.set(Event.KEY_ODOMETER, parser.next());
- position.set(Event.KEY_RFID, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_RFID, parser.next());
if (parser.hasNext()) {
int value = parser.nextInt(16);
- position.set(Event.KEY_BATTERY, value >> 8);
- position.set(Event.KEY_GSM, (value >> 4) & 0xf);
- position.set(Event.KEY_SATELLITES, value & 0xf);
+ position.set(Position.KEY_BATTERY, value >> 8);
+ position.set(Position.KEY_GSM, (value >> 4) & 0xf);
+ position.set(Position.KEY_SATELLITES, value & 0xf);
}
return position;
diff --git a/src/org/traccar/protocol/RitiProtocolDecoder.java b/src/org/traccar/protocol/RitiProtocolDecoder.java
index 5db126a83..b509367bb 100644
--- a/src/org/traccar/protocol/RitiProtocolDecoder.java
+++ b/src/org/traccar/protocol/RitiProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -66,14 +65,14 @@ public class RitiProtocolDecoder extends BaseProtocolDecoder {
position.set("mode", buf.readUnsignedByte());
position.set("command", buf.readUnsignedByte());
- position.set(Event.KEY_POWER, buf.readUnsignedShort());
+ position.set(Position.KEY_POWER, buf.readUnsignedShort());
buf.skipBytes(5);
buf.readUnsignedShort();
buf.readUnsignedShort();
position.set("distance", buf.readUnsignedInt());
- position.set(Event.KEY_ODOMETER, buf.readUnsignedInt());
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
// Parse GPRMC
int end = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) '*');
diff --git a/src/org/traccar/protocol/RuptelaProtocolDecoder.java b/src/org/traccar/protocol/RuptelaProtocolDecoder.java
index ef54bdd19..0e1ab3d22 100644
--- a/src/org/traccar/protocol/RuptelaProtocolDecoder.java
+++ b/src/org/traccar/protocol/RuptelaProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -73,37 +72,37 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(buf.readUnsignedShort() / 100.0);
int satellites = buf.readUnsignedByte();
- position.set(Event.KEY_SATELLITES, satellites);
+ position.set(Position.KEY_SATELLITES, satellites);
position.setValid(satellites >= 3);
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShort()));
- position.set(Event.KEY_HDOP, buf.readUnsignedByte() / 10.0);
+ position.set(Position.KEY_HDOP, buf.readUnsignedByte() / 10.0);
buf.readUnsignedByte();
// Read 1 byte data
int cnt = buf.readUnsignedByte();
for (int j = 0; j < cnt; j++) {
- position.set(Event.PREFIX_IO + buf.readUnsignedByte(), buf.readUnsignedByte());
+ position.set(Position.PREFIX_IO + buf.readUnsignedByte(), buf.readUnsignedByte());
}
// Read 2 byte data
cnt = buf.readUnsignedByte();
for (int j = 0; j < cnt; j++) {
- position.set(Event.PREFIX_IO + buf.readUnsignedByte(), buf.readUnsignedShort());
+ position.set(Position.PREFIX_IO + buf.readUnsignedByte(), buf.readUnsignedShort());
}
// Read 4 byte data
cnt = buf.readUnsignedByte();
for (int j = 0; j < cnt; j++) {
- position.set(Event.PREFIX_IO + buf.readUnsignedByte(), buf.readUnsignedInt());
+ position.set(Position.PREFIX_IO + buf.readUnsignedByte(), buf.readUnsignedInt());
}
// Read 8 byte data
cnt = buf.readUnsignedByte();
for (int j = 0; j < cnt; j++) {
- position.set(Event.PREFIX_IO + buf.readUnsignedByte(), buf.readLong());
+ position.set(Position.PREFIX_IO + buf.readUnsignedByte(), buf.readLong());
}
positions.add(position);
diff --git a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java
index 087dc8841..13e036f0a 100644
--- a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java
+++ b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java
@@ -22,7 +22,6 @@ import org.traccar.Context;
import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Log;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -71,7 +70,7 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder {
position.setProtocol(getProtocolName());
if (BitUtil.check(mask, 1)) {
- position.set(Event.KEY_STATUS, buf.readUnsignedInt());
+ position.set(Position.KEY_STATUS, buf.readUnsignedInt());
}
String id;
@@ -145,7 +144,7 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder {
}
if (BitUtil.check(mask, 16)) {
- position.set(Event.KEY_SATELLITES, buf.readUnsignedByte());
+ position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
}
if (BitUtil.check(mask, 17)) {
@@ -157,7 +156,7 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder {
}
if (BitUtil.check(mask, 21)) {
- position.set(Event.KEY_ODOMETER, buf.readUnsignedInt());
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
}
if (BitUtil.check(mask, 22)) {
@@ -165,7 +164,7 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder {
}
if (BitUtil.check(mask, 24)) {
- position.set(Event.KEY_POWER, buf.readUnsignedShort() / 1000.0);
+ position.set(Position.KEY_POWER, buf.readUnsignedShort() / 1000.0);
}
if (BitUtil.check(mask, 25)) {
@@ -177,7 +176,7 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder {
}
if (BitUtil.check(mask, 28)) {
- position.set(Event.KEY_INDEX, buf.readUnsignedShort());
+ position.set(Position.KEY_INDEX, buf.readUnsignedShort());
}
return position;
diff --git a/src/org/traccar/protocol/Stl060ProtocolDecoder.java b/src/org/traccar/protocol/Stl060ProtocolDecoder.java
index 59a76e4b2..a966dfea1 100644
--- a/src/org/traccar/protocol/Stl060ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Stl060ProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -96,23 +95,23 @@ public class Stl060ProtocolDecoder extends BaseProtocolDecoder {
// Old format
if (parser.hasNext(5)) {
- position.set(Event.KEY_ODOMETER, parser.nextInt());
- position.set(Event.KEY_IGNITION, parser.nextInt());
- position.set(Event.KEY_INPUT, parser.nextInt() + parser.nextInt() << 1);
- position.set(Event.KEY_FUEL, parser.nextInt());
+ position.set(Position.KEY_ODOMETER, parser.nextInt());
+ position.set(Position.KEY_IGNITION, parser.nextInt());
+ position.set(Position.KEY_INPUT, parser.nextInt() + parser.nextInt() << 1);
+ position.set(Position.KEY_FUEL, parser.nextInt());
}
// New format
if (parser.hasNext(10)) {
- position.set(Event.KEY_CHARGE, parser.nextInt() == 1);
- position.set(Event.KEY_IGNITION, parser.nextInt());
- position.set(Event.KEY_INPUT, parser.nextInt());
- position.set(Event.KEY_RFID, parser.next());
- position.set(Event.KEY_ODOMETER, parser.nextInt());
- position.set(Event.PREFIX_TEMP + 1, parser.nextInt());
- position.set(Event.KEY_FUEL, parser.nextInt());
+ position.set(Position.KEY_CHARGE, parser.nextInt() == 1);
+ position.set(Position.KEY_IGNITION, parser.nextInt());
+ position.set(Position.KEY_INPUT, parser.nextInt());
+ position.set(Position.KEY_RFID, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.nextInt());
+ position.set(Position.PREFIX_TEMP + 1, parser.nextInt());
+ position.set(Position.KEY_FUEL, parser.nextInt());
position.set("accel", parser.nextInt() == 1);
- position.set(Event.KEY_OUTPUT, parser.nextInt() + parser.nextInt() << 1);
+ position.set(Position.KEY_OUTPUT, parser.nextInt() + parser.nextInt() << 1);
}
position.setValid(parser.next().equals("A"));
diff --git a/src/org/traccar/protocol/SuntechProtocolDecoder.java b/src/org/traccar/protocol/SuntechProtocolDecoder.java
index 0203f8277..5f18fd3ee 100644
--- a/src/org/traccar/protocol/SuntechProtocolDecoder.java
+++ b/src/org/traccar/protocol/SuntechProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -68,7 +67,7 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
if (parser.hasNext()) {
String type = parser.next();
if (type.equals("Alert") || type.equals("Emergency")) {
- position.set(Event.KEY_ALARM, true);
+ position.set(Position.KEY_ALARM, true);
}
}
@@ -77,7 +76,7 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
}
position.setDeviceId(getDeviceId());
- position.set(Event.KEY_VERSION, parser.next());
+ position.set(Position.KEY_VERSION, parser.next());
DateBuilder dateBuilder = new DateBuilder()
.setDate(parser.nextInt(), parser.nextInt(), parser.nextInt())
@@ -92,7 +91,7 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble()));
position.setCourse(parser.nextDouble());
- position.set(Event.KEY_BATTERY, parser.next());
+ position.set(Position.KEY_BATTERY, parser.next());
return position;
}
diff --git a/src/org/traccar/protocol/SupermateProtocolDecoder.java b/src/org/traccar/protocol/SupermateProtocolDecoder.java
index cc02c8615..bcbd02eb0 100755
--- a/src/org/traccar/protocol/SupermateProtocolDecoder.java
+++ b/src/org/traccar/protocol/SupermateProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -105,11 +104,11 @@ public class SupermateProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(parser.nextInt(16) / 100.0);
position.setCourse(parser.nextInt(16) / 100.0);
- position.set(Event.KEY_STATUS, parser.next());
+ position.set(Position.KEY_STATUS, parser.next());
position.set("signal", parser.next());
- position.set(Event.KEY_POWER, parser.nextDouble());
+ position.set(Position.KEY_POWER, parser.nextDouble());
position.set("oil", parser.nextInt(16));
- position.set(Event.KEY_ODOMETER, parser.nextInt(16));
+ position.set(Position.KEY_ODOMETER, parser.nextInt(16));
if (channel != null) {
Calendar calendar = Calendar.getInstance();
diff --git a/src/org/traccar/protocol/T55ProtocolDecoder.java b/src/org/traccar/protocol/T55ProtocolDecoder.java
index e4d94b0aa..0a86e46a7 100644
--- a/src/org/traccar/protocol/T55ProtocolDecoder.java
+++ b/src/org/traccar/protocol/T55ProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -123,7 +122,7 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder {
position.setTime(dateBuilder.getDate());
if (parser.hasNext(3)) {
- position.set(Event.KEY_SATELLITES, parser.next());
+ position.set(Position.KEY_SATELLITES, parser.next());
if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
@@ -205,7 +204,7 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(parser.nextDouble());
position.setAltitude(parser.nextDouble());
- position.set(Event.KEY_BATTERY, parser.next());
+ position.set(Position.KEY_BATTERY, parser.next());
return position;
}
diff --git a/src/org/traccar/protocol/T800xProtocolDecoder.java b/src/org/traccar/protocol/T800xProtocolDecoder.java
index c5dc103b1..67a4d55ca 100644
--- a/src/org/traccar/protocol/T800xProtocolDecoder.java
+++ b/src/org/traccar/protocol/T800xProtocolDecoder.java
@@ -23,7 +23,6 @@ import org.traccar.helper.BcdUtil;
import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -85,7 +84,7 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
position.setProtocol(getProtocolName());
position.setDeviceId(getDeviceId());
- position.set(Event.KEY_INDEX, index);
+ position.set(Position.KEY_INDEX, index);
buf.readUnsignedShort(); // acc on interval
buf.readUnsignedShort(); // acc off interval
@@ -102,23 +101,23 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedShort(); // drag alarm setting
int io = buf.readUnsignedShort();
- position.set(Event.KEY_IGNITION, BitUtil.check(io, 14));
+ position.set(Position.KEY_IGNITION, BitUtil.check(io, 14));
position.set("ac", BitUtil.check(io, 13));
- position.set(Event.PREFIX_ADC + 1, buf.readUnsignedShort());
- position.set(Event.PREFIX_ADC + 2, buf.readUnsignedShort());
+ position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort());
+ position.set(Position.PREFIX_ADC + 2, buf.readUnsignedShort());
- position.set(Event.KEY_ALARM, buf.readUnsignedByte());
+ position.set(Position.KEY_ALARM, buf.readUnsignedByte());
buf.readUnsignedByte(); // reserved
- position.set(Event.KEY_ODOMETER, buf.readUnsignedInt());
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
int battery = BcdUtil.readInteger(buf, 2);
if (battery == 0) {
battery = 100;
}
- position.set(Event.KEY_BATTERY, battery);
+ position.set(Position.KEY_BATTERY, battery);
DateBuilder dateBuilder = new DateBuilder()
.setYear(BcdUtil.readInteger(buf, 2))
@@ -147,10 +146,10 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
buf.readBytes(array);
ChannelBuffer swapped = ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, array);
- position.set(Event.KEY_MCC, swapped.readUnsignedShort());
- position.set(Event.KEY_MNC, swapped.readUnsignedShort());
- position.set(Event.KEY_LAC, swapped.readUnsignedShort());
- position.set(Event.KEY_CID, swapped.readUnsignedShort());
+ position.set(Position.KEY_MCC, swapped.readUnsignedShort());
+ position.set(Position.KEY_MNC, swapped.readUnsignedShort());
+ position.set(Position.KEY_LAC, swapped.readUnsignedShort());
+ position.set(Position.KEY_CID, swapped.readUnsignedShort());
// two more cell towers
diff --git a/src/org/traccar/protocol/TaipProtocolDecoder.java b/src/org/traccar/protocol/TaipProtocolDecoder.java
index 3e1529338..f44b9bcbe 100644
--- a/src/org/traccar/protocol/TaipProtocolDecoder.java
+++ b/src/org/traccar/protocol/TaipProtocolDecoder.java
@@ -22,7 +22,6 @@ import org.traccar.helper.DateUtil;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -167,15 +166,15 @@ public class TaipProtocolDecoder extends BaseProtocolDecoder {
break;
case "sv":
- position.set(Event.KEY_SATELLITES, value);
+ position.set(Position.KEY_SATELLITES, value);
break;
case "bl":
- position.set(Event.KEY_BATTERY, value);
+ position.set(Position.KEY_BATTERY, value);
break;
case "vo":
- position.set(Event.KEY_ODOMETER, value);
+ position.set(Position.KEY_ODOMETER, value);
break;
default:
diff --git a/src/org/traccar/protocol/TelicProtocolDecoder.java b/src/org/traccar/protocol/TelicProtocolDecoder.java
index 0399271d6..812aeec0a 100644
--- a/src/org/traccar/protocol/TelicProtocolDecoder.java
+++ b/src/org/traccar/protocol/TelicProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -73,7 +72,7 @@ public class TelicProtocolDecoder extends BaseProtocolDecoder {
}
position.setDeviceId(getDeviceId());
- position.set(Event.KEY_TYPE, parser.next());
+ position.set(Position.KEY_TYPE, parser.next());
DateBuilder dateBuilder = new DateBuilder()
.setDateReverse(parser.nextInt(), parser.nextInt(), parser.nextInt())
@@ -94,8 +93,8 @@ public class TelicProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(parser.nextDouble());
position.setCourse(parser.nextDouble());
- position.set(Event.KEY_SATELLITES, parser.next());
- position.set(Event.KEY_BATTERY, parser.nextInt());
+ position.set(Position.KEY_SATELLITES, parser.next());
+ position.set(Position.KEY_BATTERY, parser.nextInt());
return position;
}
diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
index 4bf3678c0..1706a34a5 100644
--- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
+++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.BitUtil;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -61,7 +60,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
getLastLocation(position, null);
- position.set(Event.KEY_TYPE, buf.readUnsignedByte());
+ position.set(Position.KEY_TYPE, buf.readUnsignedByte());
position.set("command", buf.readBytes(buf.readInt()).toString(StandardCharsets.US_ASCII));
@@ -102,17 +101,17 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
if (BitUtil.check(locationMask, 4)) {
int satellites = buf.readUnsignedByte();
- position.set(Event.KEY_SATELLITES, satellites);
+ position.set(Position.KEY_SATELLITES, satellites);
position.setValid(satellites >= 3);
}
if (BitUtil.check(locationMask, 5)) {
- position.set(Event.KEY_LAC, buf.readUnsignedShort());
- position.set(Event.KEY_CID, buf.readUnsignedShort());
+ position.set(Position.KEY_LAC, buf.readUnsignedShort());
+ position.set(Position.KEY_CID, buf.readUnsignedShort());
}
if (BitUtil.check(locationMask, 6)) {
- position.set(Event.KEY_GSM, buf.readUnsignedByte());
+ position.set(Position.KEY_GSM, buf.readUnsignedByte());
}
if (BitUtil.check(locationMask, 7)) {
@@ -137,13 +136,13 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(buf.readUnsignedShort());
int satellites = buf.readUnsignedByte();
- position.set(Event.KEY_SATELLITES, satellites);
+ position.set(Position.KEY_SATELLITES, satellites);
position.setValid(satellites != 0);
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShort()));
- position.set(Event.KEY_EVENT, buf.readUnsignedByte());
+ position.set(Position.KEY_EVENT, buf.readUnsignedByte());
buf.readUnsignedByte(); // total IO data records
@@ -155,9 +154,9 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
for (int j = 0; j < cnt; j++) {
int id = buf.readUnsignedByte();
if (id == 1) {
- position.set(Event.KEY_POWER, buf.readUnsignedByte());
+ position.set(Position.KEY_POWER, buf.readUnsignedByte());
} else {
- position.set(Event.PREFIX_IO + id, buf.readUnsignedByte());
+ position.set(Position.PREFIX_IO + id, buf.readUnsignedByte());
}
}
}
@@ -166,7 +165,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
if (BitUtil.check(globalMask, 2)) {
int cnt = buf.readUnsignedByte();
for (int j = 0; j < cnt; j++) {
- position.set(Event.PREFIX_IO + buf.readUnsignedByte(), buf.readUnsignedShort());
+ position.set(Position.PREFIX_IO + buf.readUnsignedByte(), buf.readUnsignedShort());
}
}
@@ -174,7 +173,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
if (BitUtil.check(globalMask, 3)) {
int cnt = buf.readUnsignedByte();
for (int j = 0; j < cnt; j++) {
- position.set(Event.PREFIX_IO + buf.readUnsignedByte(), buf.readUnsignedInt());
+ position.set(Position.PREFIX_IO + buf.readUnsignedByte(), buf.readUnsignedInt());
}
}
@@ -182,7 +181,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
if (codec == CODEC_FM4X00) {
int cnt = buf.readUnsignedByte();
for (int j = 0; j < cnt; j++) {
- position.set(Event.PREFIX_IO + buf.readUnsignedByte(), buf.readLong());
+ position.set(Position.PREFIX_IO + buf.readUnsignedByte(), buf.readLong());
}
}
diff --git a/src/org/traccar/protocol/ThinkRaceProtocolDecoder.java b/src/org/traccar/protocol/ThinkRaceProtocolDecoder.java
index ed8cd827a..c7236dc6d 100644
--- a/src/org/traccar/protocol/ThinkRaceProtocolDecoder.java
+++ b/src/org/traccar/protocol/ThinkRaceProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.BitUtil;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -94,8 +93,8 @@ public class ThinkRaceProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(buf.readUnsignedByte());
position.setCourse(buf.readUnsignedByte());
- position.set(Event.KEY_LAC, buf.readUnsignedShort());
- position.set(Event.KEY_CID, buf.readUnsignedShort());
+ position.set(Position.KEY_LAC, buf.readUnsignedShort());
+ position.set(Position.KEY_CID, buf.readUnsignedShort());
return position;
diff --git a/src/org/traccar/protocol/Tk103ProtocolDecoder.java b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
index 760b089de..9512910f2 100644
--- a/src/org/traccar/protocol/Tk103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
@@ -23,7 +23,6 @@ import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -117,12 +116,12 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
int battery = parser.nextInt();
if (battery != 65535) {
- position.set(Event.KEY_BATTERY, battery);
+ position.set(Position.KEY_BATTERY, battery);
}
int power = parser.nextInt();
if (power != 65535) {
- position.set(Event.KEY_POWER, battery);
+ position.set(Position.KEY_POWER, battery);
}
return position;
@@ -137,10 +136,10 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
getLastLocation(position, null);
- position.set(Event.KEY_MCC, parser.nextInt());
- position.set(Event.KEY_MNC, parser.nextInt());
- position.set(Event.KEY_LAC, parser.nextInt(16));
- position.set(Event.KEY_CID, parser.nextInt(16));
+ position.set(Position.KEY_MCC, parser.nextInt());
+ position.set(Position.KEY_MNC, parser.nextInt());
+ position.set(Position.KEY_LAC, parser.nextInt(16));
+ position.set(Position.KEY_CID, parser.nextInt(16));
return position;
}
@@ -157,7 +156,7 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
int alarm = sentence.indexOf("BO01");
if (alarm != -1) {
- position.set(Event.KEY_ALARM, Integer.parseInt(sentence.substring(alarm + 4, alarm + 5)));
+ position.set(Position.KEY_ALARM, Integer.parseInt(sentence.substring(alarm + 4, alarm + 5)));
}
DateBuilder dateBuilder = new DateBuilder();
@@ -185,16 +184,16 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
// Status
String status = parser.next();
if (status != null) {
- position.set(Event.KEY_STATUS, status); // binary status
+ position.set(Position.KEY_STATUS, status); // binary status
int value = Integer.parseInt(new StringBuilder(status).reverse().toString(), 2);
- position.set(Event.KEY_CHARGE, !BitUtil.check(value, 0));
- position.set(Event.KEY_IGNITION, BitUtil.check(value, 1));
+ position.set(Position.KEY_CHARGE, !BitUtil.check(value, 0));
+ position.set(Position.KEY_IGNITION, BitUtil.check(value, 1));
}
- position.set(Event.KEY_STATUS, parser.next()); // hex status
+ position.set(Position.KEY_STATUS, parser.next()); // hex status
if (parser.hasNext()) {
- position.set(Event.KEY_ODOMETER, parser.nextLong(16));
+ position.set(Position.KEY_ODOMETER, parser.nextLong(16));
}
return position;
diff --git a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
index f78dbd5eb..d7cc74e84 100644
--- a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -102,7 +101,7 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
dateBuilder.setDateReverse(parser.nextInt(), parser.nextInt(), parser.nextInt());
position.setTime(dateBuilder.getDate());
- position.set(Event.KEY_STATUS, status);
+ position.set(Position.KEY_STATUS, status);
positions.add(position);
}
diff --git a/src/org/traccar/protocol/TotemProtocolDecoder.java b/src/org/traccar/protocol/TotemProtocolDecoder.java
index 95cb37138..bf24706c6 100644
--- a/src/org/traccar/protocol/TotemProtocolDecoder.java
+++ b/src/org/traccar/protocol/TotemProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -186,7 +185,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
if (pattern == PATTERN1 || pattern == PATTERN2) {
- position.set(Event.KEY_ALARM, parser.next());
+ position.set(Position.KEY_ALARM, parser.next());
DateBuilder dateBuilder = new DateBuilder();
int year = 0;
@@ -213,76 +212,76 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
}
position.setTime(dateBuilder.getDate());
- position.set(Event.KEY_HDOP, parser.next());
- position.set(Event.PREFIX_IO + 1, parser.next());
- position.set(Event.KEY_BATTERY, parser.next());
- position.set(Event.KEY_POWER, parser.nextDouble());
- position.set(Event.PREFIX_ADC + 1, parser.next());
+ position.set(Position.KEY_HDOP, parser.next());
+ position.set(Position.PREFIX_IO + 1, parser.next());
+ position.set(Position.KEY_BATTERY, parser.next());
+ position.set(Position.KEY_POWER, parser.nextDouble());
+ position.set(Position.PREFIX_ADC + 1, parser.next());
int lac = parser.nextInt(16);
int cid = parser.nextInt(16);
if (lac != 0 && cid != 0) {
- position.set(Event.KEY_LAC, lac);
- position.set(Event.KEY_CID, cid);
+ position.set(Position.KEY_LAC, lac);
+ position.set(Position.KEY_CID, cid);
}
- position.set(Event.PREFIX_TEMP + 1, parser.next());
- position.set(Event.KEY_ODOMETER, parser.next());
+ position.set(Position.PREFIX_TEMP + 1, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.next());
} else if (pattern == PATTERN3) {
- position.set(Event.KEY_ALARM, parser.next());
+ position.set(Position.KEY_ALARM, parser.next());
DateBuilder dateBuilder = new DateBuilder()
.setDateReverse(parser.nextInt(), parser.nextInt(), parser.nextInt())
.setTime(parser.nextInt(), parser.nextInt(), parser.nextInt());
position.setTime(dateBuilder.getDate());
- position.set(Event.PREFIX_IO + 1, parser.next());
- position.set(Event.KEY_BATTERY, parser.nextDouble() / 10);
- position.set(Event.KEY_POWER, parser.nextDouble());
- position.set(Event.PREFIX_ADC + 1, parser.next());
- position.set(Event.PREFIX_ADC + 2, parser.next());
- position.set(Event.PREFIX_TEMP + 1, parser.next());
- position.set(Event.PREFIX_TEMP + 2, parser.next());
- position.set(Event.KEY_LAC, parser.nextInt(16));
- position.set(Event.KEY_CID, parser.nextInt(16));
+ position.set(Position.PREFIX_IO + 1, parser.next());
+ position.set(Position.KEY_BATTERY, parser.nextDouble() / 10);
+ position.set(Position.KEY_POWER, parser.nextDouble());
+ position.set(Position.PREFIX_ADC + 1, parser.next());
+ position.set(Position.PREFIX_ADC + 2, parser.next());
+ position.set(Position.PREFIX_TEMP + 1, parser.next());
+ position.set(Position.PREFIX_TEMP + 2, parser.next());
+ position.set(Position.KEY_LAC, parser.nextInt(16));
+ position.set(Position.KEY_CID, parser.nextInt(16));
position.setValid(parser.next().equals("A"));
- position.set(Event.KEY_SATELLITES, parser.next());
+ position.set(Position.KEY_SATELLITES, parser.next());
position.setCourse(parser.nextDouble());
position.setSpeed(parser.nextDouble());
position.set("pdop", parser.next());
- position.set(Event.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.next());
position.setLatitude(parser.nextCoordinate());
position.setLongitude(parser.nextCoordinate());
} else if (pattern == PATTERN4) {
- position.set(Event.KEY_STATUS, parser.next());
+ position.set(Position.KEY_STATUS, parser.next());
DateBuilder dateBuilder = new DateBuilder()
.setDate(parser.nextInt(), parser.nextInt(), parser.nextInt())
.setTime(parser.nextInt(), parser.nextInt(), parser.nextInt());
position.setTime(dateBuilder.getDate());
- position.set(Event.KEY_BATTERY, parser.nextDouble() / 10);
- position.set(Event.KEY_POWER, parser.nextDouble());
- position.set(Event.PREFIX_ADC + 1, parser.next());
- position.set(Event.KEY_LAC, parser.nextInt(16));
- position.set(Event.KEY_CID, parser.nextInt(16));
- position.set(Event.KEY_SATELLITES, parser.nextInt());
- position.set(Event.KEY_GSM, parser.nextInt());
+ position.set(Position.KEY_BATTERY, parser.nextDouble() / 10);
+ position.set(Position.KEY_POWER, parser.nextDouble());
+ position.set(Position.PREFIX_ADC + 1, parser.next());
+ position.set(Position.KEY_LAC, parser.nextInt(16));
+ position.set(Position.KEY_CID, parser.nextInt(16));
+ position.set(Position.KEY_SATELLITES, parser.nextInt());
+ position.set(Position.KEY_GSM, parser.nextInt());
position.setCourse(parser.nextDouble());
position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble()));
- position.set(Event.KEY_HDOP, parser.nextDouble());
- position.set(Event.KEY_ODOMETER, parser.nextInt());
+ position.set(Position.KEY_HDOP, parser.nextDouble());
+ position.set(Position.KEY_ODOMETER, parser.nextInt());
position.setValid(true);
position.setLatitude(parser.nextCoordinate());
diff --git a/src/org/traccar/protocol/Tr900ProtocolDecoder.java b/src/org/traccar/protocol/Tr900ProtocolDecoder.java
index 8e96df2bf..8659861d8 100644
--- a/src/org/traccar/protocol/Tr900ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tr900ProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -84,12 +83,12 @@ public class Tr900ProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(parser.nextDouble());
position.setCourse(parser.nextDouble());
- position.set(Event.KEY_GSM, parser.next());
- position.set(Event.KEY_EVENT, parser.nextInt());
- position.set(Event.PREFIX_ADC + 1, parser.nextInt());
- position.set(Event.KEY_BATTERY, parser.nextInt());
- position.set(Event.KEY_INPUT, parser.next());
- position.set(Event.KEY_STATUS, parser.next());
+ position.set(Position.KEY_GSM, parser.next());
+ position.set(Position.KEY_EVENT, parser.nextInt());
+ position.set(Position.PREFIX_ADC + 1, parser.nextInt());
+ position.set(Position.KEY_BATTERY, parser.nextInt());
+ position.set(Position.KEY_INPUT, parser.next());
+ position.set(Position.KEY_STATUS, parser.next());
return position;
}
diff --git a/src/org/traccar/protocol/TrackboxProtocolDecoder.java b/src/org/traccar/protocol/TrackboxProtocolDecoder.java
index 63249e25e..369409fc9 100644
--- a/src/org/traccar/protocol/TrackboxProtocolDecoder.java
+++ b/src/org/traccar/protocol/TrackboxProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -82,12 +81,12 @@ public class TrackboxProtocolDecoder extends BaseProtocolDecoder {
position.setLatitude(parser.nextCoordinate());
position.setLongitude(parser.nextCoordinate());
- position.set(Event.KEY_HDOP, parser.next());
+ position.set(Position.KEY_HDOP, parser.next());
position.setAltitude(parser.nextDouble());
int fix = parser.nextInt();
- position.set(Event.KEY_GPS, fix);
+ position.set(Position.KEY_GPS, fix);
position.setValid(fix > 0);
position.setCourse(parser.nextDouble());
@@ -96,7 +95,7 @@ public class TrackboxProtocolDecoder extends BaseProtocolDecoder {
dateBuilder.setDateReverse(parser.nextInt(), parser.nextInt(), parser.nextInt());
position.setTime(dateBuilder.getDate());
- position.set(Event.KEY_SATELLITES, parser.next());
+ position.set(Position.KEY_SATELLITES, parser.next());
return position;
}
diff --git a/src/org/traccar/protocol/TramigoProtocolDecoder.java b/src/org/traccar/protocol/TramigoProtocolDecoder.java
index 6291ece14..be276a5f7 100644
--- a/src/org/traccar/protocol/TramigoProtocolDecoder.java
+++ b/src/org/traccar/protocol/TramigoProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateUtil;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -61,7 +60,7 @@ public class TramigoProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- position.set(Event.KEY_INDEX, index);
+ position.set(Position.KEY_INDEX, index);
position.setValid(true);
if (!identify(String.valueOf(id), channel, remoteAddress)) {
@@ -89,7 +88,7 @@ public class TramigoProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedInt(); // distance
- position.set(Event.KEY_BATTERY, buf.readUnsignedShort());
+ position.set(Position.KEY_BATTERY, buf.readUnsignedShort());
buf.readUnsignedShort(); // battery charger status
@@ -132,9 +131,9 @@ public class TramigoProtocolDecoder extends BaseProtocolDecoder {
dateFormat.parse(matcher.group(1) + " " + Calendar.getInstance().get(Calendar.YEAR))));
if (sentence.contains("Ignition on detected")) {
- position.set(Event.KEY_IGNITION, true);
+ position.set(Position.KEY_IGNITION, true);
} else if (sentence.contains("Ignition off detected")) {
- position.set(Event.KEY_IGNITION, false);
+ position.set(Position.KEY_IGNITION, false);
}
return position;
diff --git a/src/org/traccar/protocol/TrvProtocolDecoder.java b/src/org/traccar/protocol/TrvProtocolDecoder.java
index 8075515c2..8b35805a4 100644
--- a/src/org/traccar/protocol/TrvProtocolDecoder.java
+++ b/src/org/traccar/protocol/TrvProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -103,10 +102,10 @@ public class TrvProtocolDecoder extends BaseProtocolDecoder {
getLastLocation(position, null);
- position.set(Event.KEY_GSM, parser.nextInt());
- position.set(Event.KEY_SATELLITES, parser.nextInt());
- position.set(Event.KEY_BATTERY, parser.nextInt());
- position.set(Event.KEY_IGNITION, parser.nextInt() != 0);
+ position.set(Position.KEY_GSM, parser.nextInt());
+ position.set(Position.KEY_SATELLITES, parser.nextInt());
+ position.set(Position.KEY_BATTERY, parser.nextInt());
+ position.set(Position.KEY_IGNITION, parser.nextInt() != 0);
position.set("arm", parser.nextInt());
position.set("mode", parser.nextInt());
@@ -137,19 +136,19 @@ public class TrvProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(parser.nextDouble());
- position.set(Event.KEY_GSM, parser.nextInt());
- position.set(Event.KEY_SATELLITES, parser.nextInt());
- position.set(Event.KEY_BATTERY, parser.nextInt());
+ position.set(Position.KEY_GSM, parser.nextInt());
+ position.set(Position.KEY_SATELLITES, parser.nextInt());
+ position.set(Position.KEY_BATTERY, parser.nextInt());
int acc = parser.nextInt();
if (acc != 0) {
- position.set(Event.KEY_IGNITION, acc == 1);
+ position.set(Position.KEY_IGNITION, acc == 1);
}
- position.set(Event.KEY_MCC, parser.nextInt());
- position.set(Event.KEY_MNC, parser.nextInt());
- position.set(Event.KEY_LAC, parser.nextInt());
- position.set(Event.KEY_CID, parser.nextInt());
+ position.set(Position.KEY_MCC, parser.nextInt());
+ position.set(Position.KEY_MNC, parser.nextInt());
+ position.set(Position.KEY_LAC, parser.nextInt());
+ position.set(Position.KEY_CID, parser.nextInt());
return position;
}
diff --git a/src/org/traccar/protocol/Tt8850ProtocolDecoder.java b/src/org/traccar/protocol/Tt8850ProtocolDecoder.java
index 9979fd61d..614522f2b 100644
--- a/src/org/traccar/protocol/Tt8850ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tt8850ProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -89,10 +88,10 @@ public class Tt8850ProtocolDecoder extends BaseProtocolDecoder {
position.setTime(dateBuilder.getDate());
if (parser.hasNext(4)) {
- position.set(Event.KEY_MCC, parser.nextInt());
- position.set(Event.KEY_MNC, parser.nextInt());
- position.set(Event.KEY_LAC, parser.nextInt(16));
- position.set(Event.KEY_CID, parser.nextInt(16));
+ position.set(Position.KEY_MCC, parser.nextInt());
+ position.set(Position.KEY_MNC, parser.nextInt());
+ position.set(Position.KEY_LAC, parser.nextInt(16));
+ position.set(Position.KEY_CID, parser.nextInt(16));
}
return position;
diff --git a/src/org/traccar/protocol/TytanProtocolDecoder.java b/src/org/traccar/protocol/TytanProtocolDecoder.java
index a30bd6763..b657ae029 100644
--- a/src/org/traccar/protocol/TytanProtocolDecoder.java
+++ b/src/org/traccar/protocol/TytanProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.BitUtil;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -49,15 +48,15 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder {
switch (type) {
case 2:
- position.set(Event.KEY_ODOMETER, buf.readUnsignedMedium());
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedMedium());
break;
case 5:
- position.set(Event.KEY_INPUT, buf.readUnsignedByte());
+ position.set(Position.KEY_INPUT, buf.readUnsignedByte());
break;
case 6:
n = buf.readUnsignedByte() >> 4;
if (n < 2) {
- position.set(Event.PREFIX_ADC + n, buf.readFloat());
+ position.set(Position.PREFIX_ADC + n, buf.readFloat());
} else {
position.set("di" + (n - 2), buf.readFloat());
}
@@ -66,7 +65,7 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder {
int alarm = buf.readUnsignedByte();
buf.readUnsignedByte();
if (BitUtil.check(alarm, 5)) {
- position.set(Event.KEY_ALARM, BitUtil.to(alarm, 4));
+ position.set(Position.KEY_ALARM, BitUtil.to(alarm, 4));
}
break;
case 8:
@@ -80,7 +79,7 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder {
break;
case 24:
for (int i = 0; i < length / 2; i++) {
- position.set(Event.PREFIX_TEMP + buf.readUnsignedByte(), buf.readByte());
+ position.set(Position.PREFIX_TEMP + buf.readUnsignedByte(), buf.readByte());
}
break;
case 28:
@@ -88,27 +87,27 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte();
break;
case 90:
- position.set(Event.KEY_POWER, buf.readFloat());
+ position.set(Position.KEY_POWER, buf.readFloat());
break;
case 101:
- position.set(Event.KEY_OBD_SPEED, buf.readUnsignedByte());
+ position.set(Position.KEY_OBD_SPEED, buf.readUnsignedByte());
break;
case 102:
- position.set(Event.KEY_RPM, buf.readUnsignedByte() * 50);
+ position.set(Position.KEY_RPM, buf.readUnsignedByte() * 50);
break;
case 107:
int fuel = buf.readUnsignedShort();
int fuelFormat = fuel >> 14;
if (fuelFormat == 1) {
- position.set(Event.KEY_FUEL, (fuel & 0x3fff) * 0.4 + "%");
+ position.set(Position.KEY_FUEL, (fuel & 0x3fff) * 0.4 + "%");
} else if (fuelFormat == 2) {
- position.set(Event.KEY_FUEL, (fuel & 0x3fff) * 0.5 + " l");
+ position.set(Position.KEY_FUEL, (fuel & 0x3fff) * 0.5 + " l");
} else if (fuelFormat == 3) {
- position.set(Event.KEY_FUEL, (fuel & 0x3fff) * -0.5 + " l");
+ position.set(Position.KEY_FUEL, (fuel & 0x3fff) * -0.5 + " l");
}
break;
case 108:
- position.set(Event.KEY_OBD_ODOMETER, buf.readUnsignedInt() * 5);
+ position.set(Position.KEY_OBD_ODOMETER, buf.readUnsignedInt() * 5);
break;
case 150:
position.set("door", buf.readUnsignedByte());
@@ -154,7 +153,7 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder {
position.setTime(new Date(buf.readUnsignedInt() * 1000));
int flags = buf.readUnsignedByte();
- position.set(Event.KEY_SATELLITES, BitUtil.from(flags, 2));
+ position.set(Position.KEY_SATELLITES, BitUtil.from(flags, 2));
position.setValid(BitUtil.to(flags, 2) > 0);
// Latitude
@@ -169,8 +168,8 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder {
// Status
flags = buf.readUnsignedByte();
- position.set(Event.KEY_IGNITION, BitUtil.check(flags, 0));
- position.set(Event.KEY_GSM, BitUtil.between(flags, 2, 5));
+ position.set(Position.KEY_IGNITION, BitUtil.check(flags, 0));
+ position.set(Position.KEY_GSM, BitUtil.between(flags, 2, 5));
position.setCourse((BitUtil.from(flags, 5) * 45 + 180) % 360);
// Speed
diff --git a/src/org/traccar/protocol/TzoneProtocolDecoder.java b/src/org/traccar/protocol/TzoneProtocolDecoder.java
index 01e42964d..f4d6c68f3 100644
--- a/src/org/traccar/protocol/TzoneProtocolDecoder.java
+++ b/src/org/traccar/protocol/TzoneProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -66,7 +65,7 @@ public class TzoneProtocolDecoder extends BaseProtocolDecoder {
return null;
}
- position.set(Event.KEY_SATELLITES, buf.readUnsignedByte());
+ position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
double lat = buf.readUnsignedInt() / 600000.0;
double lon = buf.readUnsignedInt() / 600000.0;
@@ -78,7 +77,7 @@ public class TzoneProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(buf.readUnsignedShort() * 0.01);
- position.set(Event.KEY_ODOMETER, buf.readUnsignedMedium());
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedMedium());
int flags = buf.readUnsignedShort();
position.setCourse(BitUtil.to(flags, 9));
@@ -101,8 +100,8 @@ public class TzoneProtocolDecoder extends BaseProtocolDecoder {
if (blockLength > 0) {
- position.set(Event.KEY_LAC, buf.readUnsignedShort());
- position.set(Event.KEY_CID, buf.readUnsignedShort());
+ position.set(Position.KEY_LAC, buf.readUnsignedShort());
+ position.set(Position.KEY_CID, buf.readUnsignedShort());
}
@@ -115,16 +114,16 @@ public class TzoneProtocolDecoder extends BaseProtocolDecoder {
if (blockLength > 0) {
- position.set(Event.KEY_ALARM, buf.readUnsignedByte());
+ position.set(Position.KEY_ALARM, buf.readUnsignedByte());
buf.readUnsignedByte(); // terminal info
- position.set(Event.PREFIX_IO + 1, buf.readUnsignedShort());
- position.set(Event.KEY_GSM, buf.readUnsignedByte());
+ position.set(Position.PREFIX_IO + 1, buf.readUnsignedShort());
+ position.set(Position.KEY_GSM, buf.readUnsignedByte());
buf.readUnsignedByte(); // GSM status
- position.set(Event.KEY_BATTERY, buf.readUnsignedShort());
- position.set(Event.KEY_POWER, buf.readUnsignedShort());
- position.set(Event.PREFIX_ADC + 1, buf.readUnsignedShort());
- position.set(Event.PREFIX_ADC + 2, buf.readUnsignedShort());
- position.set(Event.PREFIX_TEMP + 1, buf.readUnsignedShort());
+ position.set(Position.KEY_BATTERY, buf.readUnsignedShort());
+ position.set(Position.KEY_POWER, buf.readUnsignedShort());
+ position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort());
+ position.set(Position.PREFIX_ADC + 2, buf.readUnsignedShort());
+ position.set(Position.PREFIX_TEMP + 1, buf.readUnsignedShort());
}
diff --git a/src/org/traccar/protocol/UlbotechProtocolDecoder.java b/src/org/traccar/protocol/UlbotechProtocolDecoder.java
index 60d8ba52d..9cbaadfb4 100644
--- a/src/org/traccar/protocol/UlbotechProtocolDecoder.java
+++ b/src/org/traccar/protocol/UlbotechProtocolDecoder.java
@@ -23,7 +23,6 @@ import org.traccar.Context;
import org.traccar.helper.BitUtil;
import org.traccar.helper.ObdDecoder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -139,19 +138,19 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder {
position.setLongitude(buf.readInt() / 1000000.0);
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShort()));
position.setCourse(buf.readUnsignedShort());
- position.set(Event.KEY_HDOP, buf.readUnsignedShort());
+ position.set(Position.KEY_HDOP, buf.readUnsignedShort());
break;
case DATA_LBS:
- position.set(Event.KEY_MCC, buf.readUnsignedShort());
- position.set(Event.KEY_MNC, buf.readUnsignedShort());
- position.set(Event.KEY_LAC, buf.readUnsignedShort());
+ position.set(Position.KEY_MCC, buf.readUnsignedShort());
+ position.set(Position.KEY_MNC, buf.readUnsignedShort());
+ position.set(Position.KEY_LAC, buf.readUnsignedShort());
if (length == 11) {
- position.set(Event.KEY_CID, buf.readUnsignedInt());
+ position.set(Position.KEY_CID, buf.readUnsignedInt());
} else {
- position.set(Event.KEY_CID, buf.readUnsignedShort());
+ position.set(Position.KEY_CID, buf.readUnsignedShort());
}
- position.set(Event.KEY_GSM, -buf.readUnsignedByte());
+ position.set(Position.KEY_GSM, -buf.readUnsignedByte());
if (length > 9 && length != 11) {
buf.skipBytes(length - 9);
}
@@ -159,19 +158,19 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder {
case DATA_STATUS:
int status = buf.readUnsignedShort();
- position.set(Event.KEY_IGNITION, BitUtil.check(status, 9));
- position.set(Event.KEY_STATUS, status);
- position.set(Event.KEY_ALARM, buf.readUnsignedShort());
+ position.set(Position.KEY_IGNITION, BitUtil.check(status, 9));
+ position.set(Position.KEY_STATUS, status);
+ position.set(Position.KEY_ALARM, buf.readUnsignedShort());
break;
case DATA_ODOMETER:
- position.set(Event.KEY_ODOMETER, buf.readUnsignedInt());
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
break;
case DATA_ADC:
for (int i = 0; i < length / 2; i++) {
int value = buf.readUnsignedShort();
- position.set(Event.PREFIX_ADC + BitUtil.from(value, 12), BitUtil.to(value, 12));
+ position.set(Position.PREFIX_ADC + BitUtil.from(value, 12), BitUtil.to(value, 12));
}
break;
@@ -205,16 +204,16 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder {
break;
case DATA_VIN:
- position.set(Event.KEY_VIN, buf.readBytes(length).toString(StandardCharsets.US_ASCII));
+ position.set(Position.KEY_VIN, buf.readBytes(length).toString(StandardCharsets.US_ASCII));
break;
case DATA_RFID:
- position.set(Event.KEY_RFID, buf.readBytes(length - 1).toString(StandardCharsets.US_ASCII));
+ position.set(Position.KEY_RFID, buf.readBytes(length - 1).toString(StandardCharsets.US_ASCII));
position.set("authorized", buf.readUnsignedByte() != 0);
break;
case DATA_EVENT:
- position.set(Event.KEY_EVENT, buf.readUnsignedByte());
+ position.set(Position.KEY_EVENT, buf.readUnsignedByte());
if (length > 1) {
position.set("event-mask", buf.readUnsignedInt());
}
diff --git a/src/org/traccar/protocol/V680ProtocolDecoder.java b/src/org/traccar/protocol/V680ProtocolDecoder.java
index aa1ae83fb..35bd3780b 100644
--- a/src/org/traccar/protocol/V680ProtocolDecoder.java
+++ b/src/org/traccar/protocol/V680ProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -86,9 +85,9 @@ public class V680ProtocolDecoder extends BaseProtocolDecoder {
position.set("user", parser.next());
position.setValid(parser.nextInt() > 0);
position.set("password", parser.next());
- position.set(Event.KEY_EVENT, parser.next());
+ position.set(Position.KEY_EVENT, parser.next());
position.set("packet", parser.next());
- position.set(Event.KEY_GSM, parser.next());
+ position.set(Position.KEY_GSM, parser.next());
position.setLongitude(parser.nextCoordinate());
position.setLatitude(parser.nextCoordinate());
diff --git a/src/org/traccar/protocol/VisiontekProtocolDecoder.java b/src/org/traccar/protocol/VisiontekProtocolDecoder.java
index 63f43fda8..5d9b905f1 100644
--- a/src/org/traccar/protocol/VisiontekProtocolDecoder.java
+++ b/src/org/traccar/protocol/VisiontekProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -108,18 +107,18 @@ public class VisiontekProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(parser.nextDouble());
position.setAltitude(parser.nextDouble());
- position.set(Event.KEY_SATELLITES, parser.next());
- position.set(Event.KEY_ODOMETER, parser.next());
- position.set(Event.KEY_IGNITION, parser.next());
- position.set(Event.PREFIX_IO + 1, parser.next());
- position.set(Event.PREFIX_IO + 2, parser.next());
+ position.set(Position.KEY_SATELLITES, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_IGNITION, parser.next());
+ position.set(Position.PREFIX_IO + 1, parser.next());
+ position.set(Position.PREFIX_IO + 2, parser.next());
position.set("immobilizer", parser.next());
- position.set(Event.KEY_POWER, parser.next());
- position.set(Event.KEY_GSM, parser.next());
+ position.set(Position.KEY_POWER, parser.next());
+ position.set(Position.KEY_GSM, parser.next());
position.setValid(parser.next().equals("A"));
- position.set(Event.KEY_RFID, parser.next());
+ position.set(Position.KEY_RFID, parser.next());
return position;
}
diff --git a/src/org/traccar/protocol/WatchProtocolDecoder.java b/src/org/traccar/protocol/WatchProtocolDecoder.java
index 0c35ef3a0..b9b42332f 100644
--- a/src/org/traccar/protocol/WatchProtocolDecoder.java
+++ b/src/org/traccar/protocol/WatchProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -100,7 +99,7 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder {
getLastLocation(position, null);
- position.set(Event.KEY_BATTERY, values[3]);
+ position.set(Position.KEY_BATTERY, values[3]);
return position;
}
@@ -133,9 +132,9 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(parser.nextDouble());
position.setAltitude(parser.nextDouble());
- position.set(Event.KEY_SATELLITES, parser.nextInt());
- position.set(Event.KEY_GSM, parser.nextInt());
- position.set(Event.KEY_BATTERY, parser.nextInt());
+ position.set(Position.KEY_SATELLITES, parser.nextInt());
+ position.set(Position.KEY_GSM, parser.nextInt());
+ position.set(Position.KEY_BATTERY, parser.nextInt());
position.set("steps", parser.nextInt());
diff --git a/src/org/traccar/protocol/WialonProtocolDecoder.java b/src/org/traccar/protocol/WialonProtocolDecoder.java
index bf6857ee9..1de2f9dbf 100644
--- a/src/org/traccar/protocol/WialonProtocolDecoder.java
+++ b/src/org/traccar/protocol/WialonProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -92,21 +91,21 @@ public class WialonProtocolDecoder extends BaseProtocolDecoder {
if (parser.hasNext()) {
int satellites = parser.nextInt();
position.setValid(satellites >= 3);
- position.set(Event.KEY_SATELLITES, satellites);
+ position.set(Position.KEY_SATELLITES, satellites);
}
- position.set(Event.KEY_HDOP, parser.next());
- position.set(Event.KEY_INPUT, parser.next());
- position.set(Event.KEY_OUTPUT, parser.next());
+ position.set(Position.KEY_HDOP, parser.next());
+ position.set(Position.KEY_INPUT, parser.next());
+ position.set(Position.KEY_OUTPUT, parser.next());
if (parser.hasNext()) {
String[] values = parser.next().split(",");
for (int i = 0; i < values.length; i++) {
- position.set(Event.PREFIX_ADC + (i + 1), values[i]);
+ position.set(Position.PREFIX_ADC + (i + 1), values[i]);
}
}
- position.set(Event.KEY_RFID, parser.next());
+ position.set(Position.KEY_RFID, parser.next());
if (parser.hasNext()) {
String[] values = parser.next().split(",");
diff --git a/src/org/traccar/protocol/WondexProtocolDecoder.java b/src/org/traccar/protocol/WondexProtocolDecoder.java
index 366466143..81aeff54e 100644
--- a/src/org/traccar/protocol/WondexProtocolDecoder.java
+++ b/src/org/traccar/protocol/WondexProtocolDecoder.java
@@ -22,7 +22,6 @@ import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -77,7 +76,7 @@ public class WondexProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(getDeviceId());
getLastLocation(position, new Date());
position.setValid(false);
- position.set(Event.KEY_RESULT, buf.toString(StandardCharsets.US_ASCII));
+ position.set(Position.KEY_RESULT, buf.toString(StandardCharsets.US_ASCII));
return position;
} else {
@@ -108,15 +107,15 @@ public class WondexProtocolDecoder extends BaseProtocolDecoder {
int satellites = parser.nextInt();
position.setValid(satellites >= 3);
- position.set(Event.KEY_SATELLITES, satellites);
-
- position.set(Event.KEY_EVENT, parser.next());
- position.set(Event.KEY_BATTERY, parser.next());
- position.set(Event.KEY_ODOMETER, parser.next());
- position.set(Event.KEY_INPUT, parser.next());
- position.set(Event.PREFIX_ADC + 1, parser.next());
- position.set(Event.PREFIX_ADC + 2, parser.next());
- position.set(Event.KEY_OUTPUT, parser.next());
+ position.set(Position.KEY_SATELLITES, satellites);
+
+ position.set(Position.KEY_EVENT, parser.next());
+ position.set(Position.KEY_BATTERY, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_INPUT, parser.next());
+ position.set(Position.PREFIX_ADC + 1, parser.next());
+ position.set(Position.PREFIX_ADC + 2, parser.next());
+ position.set(Position.KEY_OUTPUT, parser.next());
return position;
}
diff --git a/src/org/traccar/protocol/XexunProtocolDecoder.java b/src/org/traccar/protocol/XexunProtocolDecoder.java
index 3a1005f09..82dc16d11 100644
--- a/src/org/traccar/protocol/XexunProtocolDecoder.java
+++ b/src/org/traccar/protocol/XexunProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -99,7 +98,7 @@ public class XexunProtocolDecoder extends BaseProtocolDecoder {
position.setTime(dateBuilder.getDate());
position.set("signal", parser.next());
- position.set(Event.KEY_ALARM, parser.next());
+ position.set(Position.KEY_ALARM, parser.next());
if (!identify(parser.next(), channel, remoteAddress)) {
return null;
@@ -107,11 +106,11 @@ public class XexunProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(getDeviceId());
if (full) {
- position.set(Event.KEY_SATELLITES, parser.next().replaceFirst("^0*(?![\\.$])", ""));
+ position.set(Position.KEY_SATELLITES, parser.next().replaceFirst("^0*(?![\\.$])", ""));
position.setAltitude(parser.nextDouble());
- position.set(Event.KEY_POWER, parser.nextDouble());
+ position.set(Position.KEY_POWER, parser.nextDouble());
}
return position;
diff --git a/src/org/traccar/protocol/XirgoProtocolDecoder.java b/src/org/traccar/protocol/XirgoProtocolDecoder.java
index debb0657c..415d8dee3 100644
--- a/src/org/traccar/protocol/XirgoProtocolDecoder.java
+++ b/src/org/traccar/protocol/XirgoProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -115,7 +114,7 @@ public class XirgoProtocolDecoder extends BaseProtocolDecoder {
}
position.setDeviceId(getDeviceId());
- position.set(Event.KEY_EVENT, parser.next());
+ position.set(Position.KEY_EVENT, parser.next());
DateBuilder dateBuilder = new DateBuilder()
.setDate(parser.nextInt(), parser.nextInt(), parser.nextInt())
@@ -128,18 +127,18 @@ public class XirgoProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(UnitsConverter.knotsFromMph(parser.nextDouble()));
position.setCourse(parser.nextDouble());
- position.set(Event.KEY_SATELLITES, parser.next());
- position.set(Event.KEY_HDOP, parser.next());
+ position.set(Position.KEY_SATELLITES, parser.next());
+ position.set(Position.KEY_HDOP, parser.next());
if (newFormat) {
- position.set(Event.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.next());
}
- position.set(Event.KEY_BATTERY, parser.next());
- position.set(Event.KEY_GSM, parser.next());
+ position.set(Position.KEY_BATTERY, parser.next());
+ position.set(Position.KEY_GSM, parser.next());
if (!newFormat) {
- position.set(Event.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.next());
}
position.setValid(parser.nextInt() == 1);
diff --git a/src/org/traccar/protocol/Xt013ProtocolDecoder.java b/src/org/traccar/protocol/Xt013ProtocolDecoder.java
index 45897b4aa..1c0726d8c 100644
--- a/src/org/traccar/protocol/Xt013ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Xt013ProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -86,10 +85,10 @@ public class Xt013ProtocolDecoder extends BaseProtocolDecoder {
position.setAltitude(parser.nextDouble());
position.setValid(parser.next().equals("F"));
- position.set(Event.KEY_GPS, parser.next());
- position.set(Event.KEY_GSM, parser.next());
- position.set(Event.KEY_BATTERY, parser.next());
- position.set(Event.KEY_CHARGE, parser.next());
+ position.set(Position.KEY_GPS, parser.next());
+ position.set(Position.KEY_GSM, parser.next());
+ position.set(Position.KEY_BATTERY, parser.next());
+ position.set(Position.KEY_CHARGE, parser.next());
return position;
}
diff --git a/src/org/traccar/protocol/YwtProtocolDecoder.java b/src/org/traccar/protocol/YwtProtocolDecoder.java
index 384fe1184..b653c1ec4 100644
--- a/src/org/traccar/protocol/YwtProtocolDecoder.java
+++ b/src/org/traccar/protocol/YwtProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -100,11 +99,11 @@ public class YwtProtocolDecoder extends BaseProtocolDecoder {
int satellites = parser.nextInt();
position.setValid(satellites >= 3);
- position.set(Event.KEY_SATELLITES, satellites);
+ position.set(Position.KEY_SATELLITES, satellites);
String reportId = parser.next();
- position.set(Event.KEY_STATUS, parser.next());
+ position.set(Position.KEY_STATUS, parser.next());
// Send response
if ((type.equals("KP") || type.equals("EP")) && channel != null) {
diff --git a/test/org/traccar/DistanceHandlerTest.java b/test/org/traccar/DistanceHandlerTest.java
index e58d9c772..853f2c645 100644
--- a/test/org/traccar/DistanceHandlerTest.java
+++ b/test/org/traccar/DistanceHandlerTest.java
@@ -1,7 +1,6 @@
package org.traccar;
import org.junit.Test;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import static org.junit.Assert.assertEquals;
@@ -15,7 +14,7 @@ public class DistanceHandlerTest {
Position position = distanceHandler.calculateDistance(new Position());
- assertEquals(0.0, position.getAttributes().get(Event.KEY_DISTANCE));
+ assertEquals(0.0, position.getAttributes().get(Position.KEY_DISTANCE));
}
diff --git a/test/org/traccar/ProtocolTest.java b/test/org/traccar/ProtocolTest.java
index a8f3d13cf..503bc4c00 100644
--- a/test/org/traccar/ProtocolTest.java
+++ b/test/org/traccar/ProtocolTest.java
@@ -9,12 +9,10 @@ import org.junit.Assert;
import org.traccar.database.IdentityManager;
import org.traccar.model.Command;
import org.traccar.model.Device;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import javax.xml.bind.DatatypeConverter;
import java.nio.ByteOrder;
-import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.text.DateFormat;
import java.text.ParseException;
@@ -198,16 +196,16 @@ public class ProtocolTest {
Assert.assertFalse("no attributes", attributes.isEmpty());
}
- if (attributes.containsKey(Event.KEY_LAC) || attributes.containsKey(Event.KEY_CID)) {
- checkInteger(attributes.get(Event.KEY_LAC), 1, 65535);
- checkInteger(attributes.get(Event.KEY_CID), 0, 268435455);
+ if (attributes.containsKey(Position.KEY_LAC) || attributes.containsKey(Position.KEY_CID)) {
+ checkInteger(attributes.get(Position.KEY_LAC), 1, 65535);
+ checkInteger(attributes.get(Position.KEY_CID), 0, 268435455);
}
- if (attributes.containsKey(Event.KEY_MCC) || attributes.containsKey(Event.KEY_MNC)) {
- checkInteger(attributes.get(Event.KEY_MCC), 100, 999);
- checkInteger(attributes.get(Event.KEY_MNC), 0, 999);
- Assert.assertTrue("value missing", attributes.containsKey(Event.KEY_LAC));
- Assert.assertTrue("value missing", attributes.containsKey(Event.KEY_CID));
+ if (attributes.containsKey(Position.KEY_MCC) || attributes.containsKey(Position.KEY_MNC)) {
+ checkInteger(attributes.get(Position.KEY_MCC), 100, 999);
+ checkInteger(attributes.get(Position.KEY_MNC), 0, 999);
+ Assert.assertTrue("value missing", attributes.containsKey(Position.KEY_LAC));
+ Assert.assertTrue("value missing", attributes.containsKey(Position.KEY_CID));
}
}
diff --git a/test/org/traccar/location/LocationProviderTest.java b/test/org/traccar/location/LocationProviderTest.java
index b7280cfea..910f9e9ea 100644
--- a/test/org/traccar/location/LocationProviderTest.java
+++ b/test/org/traccar/location/LocationProviderTest.java
@@ -2,12 +2,7 @@ package org.traccar.location;
import org.junit.Assert;
import org.junit.Test;
-import org.traccar.geocode.AddressFormat;
-import org.traccar.geocode.GisgraphyReverseGeocoder;
-import org.traccar.geocode.GoogleReverseGeocoder;
-import org.traccar.geocode.NominatimReverseGeocoder;
-import org.traccar.geocode.ReverseGeocoder;
-import org.traccar.model.Event;
+import org.traccar.model.Position;
import java.util.HashMap;
import java.util.Map;
@@ -27,10 +22,10 @@ public class LocationProviderTest {
OpenCellIdLocationProvider locationProvider = new OpenCellIdLocationProvider("fake");
Map<String, Object> attributes = new HashMap<>();
- attributes.put(Event.KEY_MCC, 260);
- attributes.put(Event.KEY_MNC, 2);
- attributes.put(Event.KEY_LAC, 10250);
- attributes.put(Event.KEY_CID, 26511);
+ attributes.put(Position.KEY_MCC, 260);
+ attributes.put(Position.KEY_MNC, 2);
+ attributes.put(Position.KEY_LAC, 10250);
+ attributes.put(Position.KEY_CID, 26511);
locationProvider.getLocation(attributes, new LocationProvider.LocationProviderCallback() {
@Override