aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/FilterHandler.java1
-rw-r--r--src/org/traccar/ReverseGeocoderHandler.java1
-rw-r--r--src/org/traccar/TrackerEventHandler.java1
-rw-r--r--src/org/traccar/database/DataCache.java1
-rw-r--r--src/org/traccar/database/DataManager.java1
-rw-r--r--src/org/traccar/http/AsyncServlet.java1
-rw-r--r--src/org/traccar/model/Data.java2
-rw-r--r--src/org/traccar/model/Event.java (renamed from src/org/traccar/model/BaseEvent.java)24
-rw-r--r--src/org/traccar/model/Position.java4
-rw-r--r--src/org/traccar/protocol/ApelProtocolDecoder.java19
-rw-r--r--src/org/traccar/protocol/AplicomProtocolDecoder.java15
-rw-r--r--src/org/traccar/protocol/Ardi01ProtocolDecoder.java9
-rw-r--r--src/org/traccar/protocol/AtrackProtocolDecoder.java11
-rw-r--r--src/org/traccar/protocol/AutoFon45ProtocolDecoder.java9
-rw-r--r--src/org/traccar/protocol/AutoFonProtocolDecoder.java11
-rw-r--r--src/org/traccar/protocol/Avl301ProtocolDecoder.java13
-rw-r--r--src/org/traccar/protocol/BceProtocolDecoder.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.java26
-rw-r--r--src/org/traccar/protocol/CarscopProtocolDecoder.java7
-rw-r--r--src/org/traccar/protocol/CellocatorProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/EasyTrackProtocolDecoder.java11
-rw-r--r--src/org/traccar/protocol/EelinkProtocolDecoder.java11
-rw-r--r--src/org/traccar/protocol/EnforaProtocolDecoder.java1
-rw-r--r--src/org/traccar/protocol/Ev603ProtocolDecoder.java1
-rw-r--r--src/org/traccar/protocol/FreedomProtocolDecoder.java1
-rw-r--r--src/org/traccar/protocol/GalileoProtocolDecoder.java13
-rw-r--r--src/org/traccar/protocol/GatorProtocolDecoder.java11
-rw-r--r--src/org/traccar/protocol/Gl100ProtocolDecoder.java1
-rw-r--r--src/org/traccar/protocol/Gl200ProtocolDecoder.java19
-rw-r--r--src/org/traccar/protocol/GlobalSatProtocolDecoder.java7
-rw-r--r--src/org/traccar/protocol/GoSafeProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/GotopProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/Gps103ProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/GpsGateProtocolDecoder.java1
-rw-r--r--src/org/traccar/protocol/Gt02ProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolDecoder.java19
-rw-r--r--src/org/traccar/protocol/H02ProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/HaicomProtocolDecoder.java11
-rw-r--r--src/org/traccar/protocol/IntellitracProtocolDecoder.java17
-rw-r--r--src/org/traccar/protocol/Jt600ProtocolDecoder.java19
-rw-r--r--src/org/traccar/protocol/KhdProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/LaipacProtocolDecoder.java1
-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/MaxonProtocolDecoder.java1
-rw-r--r--src/org/traccar/protocol/MegastekProtocolDecoder.java29
-rw-r--r--src/org/traccar/protocol/MeiligaoProtocolDecoder.java19
-rw-r--r--src/org/traccar/protocol/MeitrackProtocolDecoder.java37
-rw-r--r--src/org/traccar/protocol/MiniFinderProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/Mta6ProtocolDecoder.java31
-rw-r--r--src/org/traccar/protocol/MtxProtocolDecoder.java9
-rw-r--r--src/org/traccar/protocol/NavigilProtocolDecoder.java21
-rw-r--r--src/org/traccar/protocol/NavisProtocolDecoder.java29
-rw-r--r--src/org/traccar/protocol/NoranProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/OrionProtocolDecoder.java5
-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.java15
-rw-r--r--src/org/traccar/protocol/Pt3000ProtocolDecoder.java1
-rw-r--r--src/org/traccar/protocol/Pt502ProtocolDecoder.java1
-rw-r--r--src/org/traccar/protocol/RitiProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/RuptelaProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/SanavProtocolDecoder.java1
-rw-r--r--src/org/traccar/protocol/SkypatrolProtocolDecoder.java15
-rw-r--r--src/org/traccar/protocol/Stl060ProtocolDecoder.java7
-rw-r--r--src/org/traccar/protocol/SuntechProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/SyrusProtocolDecoder.java1
-rw-r--r--src/org/traccar/protocol/T55ProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/TelikProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/TeltonikaProtocolDecoder.java13
-rw-r--r--src/org/traccar/protocol/Tk102ProtocolDecoder.java1
-rw-r--r--src/org/traccar/protocol/Tk103ProtocolDecoder.java11
-rw-r--r--src/org/traccar/protocol/Tlt2hProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/TopflytechProtocolDecoder.java1
-rw-r--r--src/org/traccar/protocol/TotemProtocolDecoder.java35
-rw-r--r--src/org/traccar/protocol/Tr20ProtocolDecoder.java1
-rw-r--r--src/org/traccar/protocol/Tr900ProtocolDecoder.java11
-rw-r--r--src/org/traccar/protocol/TrackboxProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/TramigoProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/TytanProtocolDecoder.java17
-rw-r--r--src/org/traccar/protocol/UlbotechProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/V680ProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/VisiontekProtocolDecoder.java11
-rw-r--r--src/org/traccar/protocol/WialonProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/WondexProtocolDecoder.java17
-rw-r--r--src/org/traccar/protocol/Xexun2ProtocolDecoder.java7
-rw-r--r--src/org/traccar/protocol/XexunProtocolDecoder.java1
-rw-r--r--src/org/traccar/protocol/XirgoProtocolDecoder.java15
-rw-r--r--src/org/traccar/protocol/Xt013ProtocolDecoder.java7
-rw-r--r--src/org/traccar/protocol/Xt7ProtocolDecoder.java11
-rw-r--r--src/org/traccar/protocol/YwtProtocolDecoder.java5
93 files changed, 469 insertions, 362 deletions
diff --git a/src/org/traccar/FilterHandler.java b/src/org/traccar/FilterHandler.java
index 455e05ffc..08621dce2 100644
--- a/src/org/traccar/FilterHandler.java
+++ b/src/org/traccar/FilterHandler.java
@@ -25,6 +25,7 @@ import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.oneone.OneToOneDecoder;
import org.traccar.helper.DistanceCalculator;
import org.traccar.helper.Log;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class FilterHandler extends OneToOneDecoder {
diff --git a/src/org/traccar/ReverseGeocoderHandler.java b/src/org/traccar/ReverseGeocoderHandler.java
index 7a3372dff..e48a11424 100644
--- a/src/org/traccar/ReverseGeocoderHandler.java
+++ b/src/org/traccar/ReverseGeocoderHandler.java
@@ -20,6 +20,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.oneone.OneToOneDecoder;
import org.traccar.geocode.ReverseGeocoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class ReverseGeocoderHandler extends OneToOneDecoder {
diff --git a/src/org/traccar/TrackerEventHandler.java b/src/org/traccar/TrackerEventHandler.java
index aeb751d4e..8d8a03e35 100644
--- a/src/org/traccar/TrackerEventHandler.java
+++ b/src/org/traccar/TrackerEventHandler.java
@@ -22,6 +22,7 @@ import org.jboss.netty.handler.timeout.IdleStateEvent;
import org.traccar.database.DataCache;
import org.traccar.helper.Log;
import org.traccar.database.DataManager;
+import org.traccar.model.Event;
import org.traccar.model.Position;
@ChannelHandler.Sharable
diff --git a/src/org/traccar/database/DataCache.java b/src/org/traccar/database/DataCache.java
index f28f1b838..de3214bd0 100644
--- a/src/org/traccar/database/DataCache.java
+++ b/src/org/traccar/database/DataCache.java
@@ -22,6 +22,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class DataCache {
diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java
index 535365af0..c62c7d7e6 100644
--- a/src/org/traccar/database/DataManager.java
+++ b/src/org/traccar/database/DataManager.java
@@ -37,6 +37,7 @@ import javax.sql.DataSource;
import org.traccar.helper.DriverDelegate;
import org.traccar.model.Device;
import org.traccar.model.Permission;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class DataManager {
diff --git a/src/org/traccar/http/AsyncServlet.java b/src/org/traccar/http/AsyncServlet.java
index 502c551cb..aeab5855b 100644
--- a/src/org/traccar/http/AsyncServlet.java
+++ b/src/org/traccar/http/AsyncServlet.java
@@ -34,6 +34,7 @@ import org.traccar.Context;
import org.traccar.GlobalTimer;
import org.traccar.database.DataCache;
import org.traccar.helper.Log;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class AsyncServlet extends HttpServlet {
diff --git a/src/org/traccar/model/Data.java b/src/org/traccar/model/Data.java
index cd72dcbb7..4777543ff 100644
--- a/src/org/traccar/model/Data.java
+++ b/src/org/traccar/model/Data.java
@@ -15,7 +15,7 @@
*/
package org.traccar.model;
-public class Data extends BaseEvent implements Factory {
+public class Data extends Event implements Factory {
@Override
public Data create() {
diff --git a/src/org/traccar/model/BaseEvent.java b/src/org/traccar/model/Event.java
index ad3c976e6..5523174b4 100644
--- a/src/org/traccar/model/BaseEvent.java
+++ b/src/org/traccar/model/Event.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 - 2015 Anton Tananaev (anton.tananaev@gmail.com)
+ * 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.
@@ -19,7 +19,7 @@ import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;
-public abstract class BaseEvent {
+public abstract class Event {
private long id;
public long getId() { return id; }
@@ -51,4 +51,24 @@ public abstract class BaseEvent {
return MiscFormatter.toXmlString(other);
}
+ 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_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_TEMPERATURE = "temperature";
+ 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_CELL = "cell";
+ public static final String KEY_FUEL = "fuel";
+
}
diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java
index b7e711c7f..62c999d94 100644
--- a/src/org/traccar/model/Position.java
+++ b/src/org/traccar/model/Position.java
@@ -16,10 +16,8 @@
package org.traccar.model;
import java.util.Date;
-import java.util.LinkedHashMap;
-import java.util.Map;
-public class Position extends BaseEvent implements Factory {
+public class Position extends Event implements Factory {
@Override
public Position create() {
diff --git a/src/org/traccar/protocol/ApelProtocolDecoder.java b/src/org/traccar/protocol/ApelProtocolDecoder.java
index 75153d0d8..b814f60e3 100644
--- a/src/org/traccar/protocol/ApelProtocolDecoder.java
+++ b/src/org/traccar/protocol/ApelProtocolDecoder.java
@@ -30,6 +30,7 @@ import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.Crc;
import org.traccar.helper.Log;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class ApelProtocolDecoder extends BaseProtocolDecoder {
@@ -166,7 +167,7 @@ public class ApelProtocolDecoder extends BaseProtocolDecoder {
if (type == MSG_TYPE_LOG_RECORDS) {
position.set("archive", true);
lastIndex = buf.readUnsignedInt() + 1;
- position.set("index", lastIndex);
+ position.set(Event.KEY_INDEX, lastIndex);
subtype = buf.readUnsignedShort();
if (subtype != MSG_TYPE_CURRENT_GPS_DATA && subtype != MSG_TYPE_STATE_FULL_INFO_T104) {
@@ -193,7 +194,7 @@ public class ApelProtocolDecoder extends BaseProtocolDecoder {
int speed = buf.readUnsignedByte();
position.setValid(speed != 255);
position.setSpeed(speed * 0.539957);
- position.set("hdop", buf.readByte());
+ position.set(Event.KEY_HDOP, buf.readByte());
} else {
int speed = buf.readShort();
position.setValid(speed != -1);
@@ -209,20 +210,20 @@ public class ApelProtocolDecoder extends BaseProtocolDecoder {
if (subtype == MSG_TYPE_STATE_FULL_INFO_T104) {
// Satellites
- position.set("satellites", buf.readUnsignedByte());
+ position.set(Event.KEY_SATELLITES, buf.readUnsignedByte());
// Cell signal
- position.set("gsm", buf.readUnsignedByte());
+ position.set(Event.KEY_GSM, buf.readUnsignedByte());
// Event type
- position.set("event", buf.readUnsignedShort());
+ position.set(Event.KEY_EVENT, buf.readUnsignedShort());
- // Milage
- position.set("milage", buf.readUnsignedInt());
+ // Odometer
+ position.set(Event.KEY_ODOMETER, buf.readUnsignedInt());
// Input/Output
- position.set("input", buf.readUnsignedByte());
- position.set("output", buf.readUnsignedByte());
+ position.set(Event.KEY_INPUT, buf.readUnsignedByte());
+ position.set(Event.KEY_OUTPUT, buf.readUnsignedByte());
// Analog sensors
for (int i = 1; i <= 8; i++) {
diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java
index 60eb7a74c..7170731f5 100644
--- a/src/org/traccar/protocol/AplicomProtocolDecoder.java
+++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java
@@ -26,6 +26,7 @@ import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
import org.traccar.Context;
import org.traccar.helper.ChannelBufferTools;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class AplicomProtocolDecoder extends BaseProtocolDecoder {
@@ -138,7 +139,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder {
// Event
int event = buf.readUnsignedByte();
- position.set("event", event);
+ position.set(Event.KEY_EVENT, event);
buf.readUnsignedByte();
// Validity
@@ -158,7 +159,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("satellites", buf.readUnsignedByte());
+ position.set(Event.KEY_SATELLITES, buf.readUnsignedByte());
}
// Speed and heading
@@ -170,7 +171,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder {
// Input
if ((selector & 0x0040) != 0) {
- position.set("input", buf.readUnsignedByte());
+ position.set(Event.KEY_INPUT, buf.readUnsignedByte());
}
// ADC
@@ -183,8 +184,8 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder {
// Power
if ((selector & 0x8000) != 0) {
- position.set("power", buf.readUnsignedShort() / 1000.0);
- position.set("battery", buf.readUnsignedShort());
+ position.set(Event.KEY_POWER, buf.readUnsignedShort() / 1000.0);
+ position.set(Event.KEY_BATTERY, buf.readUnsignedShort());
}
// Pulse rate 1
@@ -211,7 +212,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder {
// Output
if ((selector & 0x0040) != 0) {
- position.set("output", buf.readUnsignedByte());
+ position.set(Event.KEY_OUTPUT, buf.readUnsignedByte());
}
// Button
@@ -306,7 +307,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder {
case 0x20D:
position.set("diesel-rpm", ChannelBuffers.swapShort(value.readShort()));
position.set("diesel-temperature", ChannelBuffers.swapShort(value.readShort()) * 0.1);
- position.set("battery", ChannelBuffers.swapShort(value.readShort()) * 0.01);
+ position.set(Event.KEY_BATTERY, ChannelBuffers.swapShort(value.readShort()) * 0.01);
position.set("air-temperature", ChannelBuffers.swapShort(value.readShort()) * 0.1);
break;
case 0x30D:
diff --git a/src/org/traccar/protocol/Ardi01ProtocolDecoder.java b/src/org/traccar/protocol/Ardi01ProtocolDecoder.java
index 8e1185d25..6797eb01e 100644
--- a/src/org/traccar/protocol/Ardi01ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Ardi01ProtocolDecoder.java
@@ -18,6 +18,7 @@ package org.traccar.protocol;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
import java.util.Calendar;
@@ -90,16 +91,16 @@ public class Ardi01ProtocolDecoder extends BaseProtocolDecoder {
// Satellites
int satellites = Integer.valueOf(parser.group(index++));
position.setValid(satellites >= 3);
- position.set("satellites", satellites);
+ position.set(Event.KEY_SATELLITES, satellites);
// Event
- position.set("event", parser.group(index++));
+ position.set(Event.KEY_EVENT, parser.group(index++));
// Input
- position.set("battery", parser.group(index++));
+ position.set(Event.KEY_BATTERY, parser.group(index++));
// Output
- position.set("temperature", parser.group(index++));
+ position.set(Event.KEY_TEMPERATURE, parser.group(index++));
return position;
}
diff --git a/src/org/traccar/protocol/AtrackProtocolDecoder.java b/src/org/traccar/protocol/AtrackProtocolDecoder.java
index b898d9e92..5ccd8ed30 100644
--- a/src/org/traccar/protocol/AtrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/AtrackProtocolDecoder.java
@@ -27,6 +27,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class AtrackProtocolDecoder extends BaseProtocolDecoder {
@@ -120,20 +121,20 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
// Report type
position.set("type", buf.readUnsignedByte());
- // Milage
- position.set("milage", buf.readUnsignedInt() * 0.1);
+ // Odometer
+ position.set(Event.KEY_ODOMETER, buf.readUnsignedInt() * 0.1);
// Accuracy
- position.set("hdop", buf.readUnsignedShort() * 0.1);
+ position.set(Event.KEY_HDOP, buf.readUnsignedShort() * 0.1);
// Input
- position.set("input", buf.readUnsignedByte());
+ position.set(Event.KEY_INPUT, buf.readUnsignedByte());
// Speed
position.setSpeed(buf.readUnsignedShort() * 0.539957);
// Output
- position.set("output", buf.readUnsignedByte());
+ position.set(Event.KEY_OUTPUT, buf.readUnsignedByte());
// ADC
position.set("adc", buf.readUnsignedShort() * 0.001);
diff --git a/src/org/traccar/protocol/AutoFon45ProtocolDecoder.java b/src/org/traccar/protocol/AutoFon45ProtocolDecoder.java
index 3b56c8fc4..1a2ebdf4a 100644
--- a/src/org/traccar/protocol/AutoFon45ProtocolDecoder.java
+++ b/src/org/traccar/protocol/AutoFon45ProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.ChannelBufferTools;
+import org.traccar.model.Event;
import org.traccar.model.Position;
import java.util.*;
@@ -70,12 +71,12 @@ public class AutoFon45ProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(getDeviceId());
short status = buf.readUnsignedByte();
- position.set("alarm", (status & 0x80) != 0);
- position.set("battery", status & 0x7F);
+ position.set(Event.KEY_ALARM, (status & 0x80) != 0);
+ position.set(Event.KEY_BATTERY, status & 0x7F);
buf.skipBytes(2); // remaining time
- position.set("temperature", buf.readByte());
+ position.set(Event.KEY_TEMPERATURE, buf.readByte());
buf.skipBytes(2); // timer (interval and units)
buf.readByte(); // mode
@@ -86,7 +87,7 @@ public class AutoFon45ProtocolDecoder extends BaseProtocolDecoder {
// GPS status
int valid = buf.readUnsignedByte();
position.setValid((valid & 0xc0) != 0);
- position.set("satellites", valid & 0x3f);
+ position.set(Event.KEY_SATELLITES, valid & 0x3f);
// Date and time
int timeOfDay = buf.readUnsignedByte() << 16 | buf.readUnsignedByte() << 8 | buf.readUnsignedByte();
diff --git a/src/org/traccar/protocol/AutoFonProtocolDecoder.java b/src/org/traccar/protocol/AutoFonProtocolDecoder.java
index ceeb0b29d..856b19bc8 100644
--- a/src/org/traccar/protocol/AutoFonProtocolDecoder.java
+++ b/src/org/traccar/protocol/AutoFonProtocolDecoder.java
@@ -21,6 +21,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.ChannelBufferTools;
+import org.traccar.model.Event;
import org.traccar.model.Position;
import java.util.*;
@@ -56,7 +57,7 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
if (!history) {
buf.readUnsignedShort();
}
- position.set("battery", buf.readUnsignedByte());
+ position.set(Event.KEY_BATTERY, buf.readUnsignedByte());
buf.skipBytes(6); // time
// Timers
@@ -68,8 +69,8 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
}
}
- position.set("temperature", buf.readByte());
- position.set("gsm", buf.readUnsignedByte());
+ position.set(Event.KEY_TEMPERATURE, buf.readByte());
+ position.set(Event.KEY_GSM, buf.readUnsignedByte());
buf.readUnsignedShort(); // mcc
buf.readUnsignedShort(); // mnc
buf.readUnsignedShort(); // lac
@@ -78,7 +79,7 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
// GPS status
int valid = buf.readUnsignedByte();
position.setValid((valid & 0xc0) != 0);
- position.set("satellites", valid & 0x3f);
+ position.set(Event.KEY_SATELLITES, valid & 0x3f);
// Date and time
Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
@@ -98,7 +99,7 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(buf.readUnsignedByte());
position.setCourse(buf.readUnsignedByte() * 2.0);
- position.set("hdop", buf.readUnsignedShort());
+ position.set(Event.KEY_HDOP, buf.readUnsignedShort());
buf.readUnsignedShort(); // reserved
buf.readUnsignedByte(); // checksum
diff --git a/src/org/traccar/protocol/Avl301ProtocolDecoder.java b/src/org/traccar/protocol/Avl301ProtocolDecoder.java
index c74e10f5e..7a53c3d3f 100644
--- a/src/org/traccar/protocol/Avl301ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Avl301ProtocolDecoder.java
@@ -20,6 +20,7 @@ import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
import java.util.Calendar;
@@ -99,7 +100,7 @@ public class Avl301ProtocolDecoder extends BaseProtocolDecoder {
// GPS length and Satellites count
int gpsLength = buf.readUnsignedByte();
- position.set("satellites", gpsLength & 0xf);
+ position.set(Event.KEY_SATELLITES, gpsLength & 0xf);
gpsLength >>= 4;
//Skip Satellite numbers
@@ -124,16 +125,16 @@ public class Avl301ProtocolDecoder extends BaseProtocolDecoder {
position.set("acc", (union & 0x8000) != 0);
}
- position.set("lac", buf.readUnsignedShort());
- position.set("cell", buf.readUnsignedMedium());
- position.set("alarm", true);
+ position.set(Event.KEY_LAC, buf.readUnsignedShort());
+ position.set(Event.KEY_CELL, buf.readUnsignedMedium());
+ position.set(Event.KEY_ALARM, true);
int flags = buf.readUnsignedByte();
position.set("acc", (flags & 0x2) != 0);
// TODO parse other flags
- position.set("power", buf.readUnsignedByte());
- position.set("gsm", buf.readUnsignedByte());
+ position.set(Event.KEY_POWER, buf.readUnsignedByte());
+ position.set(Event.KEY_GSM, buf.readUnsignedByte());
return position;
}
diff --git a/src/org/traccar/protocol/BceProtocolDecoder.java b/src/org/traccar/protocol/BceProtocolDecoder.java
index 28570b63c..5baafd9dd 100644
--- a/src/org/traccar/protocol/BceProtocolDecoder.java
+++ b/src/org/traccar/protocol/BceProtocolDecoder.java
@@ -25,6 +25,7 @@ import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class BceProtocolDecoder extends BaseProtocolDecoder {
@@ -97,17 +98,17 @@ public class BceProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(buf.readUnsignedByte());
int gps = buf.readUnsignedByte();
- position.set("satellites", gps & 0xf);
- position.set("hdop", gps >> 4);
+ position.set(Event.KEY_SATELLITES, gps & 0xf);
+ position.set(Event.KEY_HDOP, gps >> 4);
position.setCourse(buf.readUnsignedByte());
position.setAltitude(buf.readUnsignedShort());
- position.set("milage", buf.readUnsignedInt());
+ position.set(Event.KEY_ODOMETER, buf.readUnsignedInt());
}
if (checkBit(mask, 1)) {
- position.set("input", buf.readUnsignedShort());
+ position.set(Event.KEY_INPUT, buf.readUnsignedShort());
}
for (int i = 1; i <= 8; i++) {
@@ -122,11 +123,11 @@ public class BceProtocolDecoder extends BaseProtocolDecoder {
if (checkBit(mask, 13)) buf.skipBytes(2);
if (checkBit(mask, 14)) {
- position.set("mcc", buf.readUnsignedShort());
- position.set("mnc", buf.readUnsignedByte());
- position.set("lac", buf.readUnsignedShort());
- position.set("cell", buf.readUnsignedShort());
- position.set("gsm", 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_CELL, buf.readUnsignedShort());
+ position.set(Event.KEY_GSM, buf.readUnsignedByte());
buf.readUnsignedByte();
}
diff --git a/src/org/traccar/protocol/BoxProtocolDecoder.java b/src/org/traccar/protocol/BoxProtocolDecoder.java
index a34c13a58..b7e30733c 100644
--- a/src/org/traccar/protocol/BoxProtocolDecoder.java
+++ b/src/org/traccar/protocol/BoxProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class BoxProtocolDecoder extends BaseProtocolDecoder {
@@ -93,15 +94,15 @@ public class BoxProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(Double.valueOf(parser.group(index++)));
// Distance
- position.set("milage", parser.group(index++));
+ position.set(Event.KEY_ODOMETER, parser.group(index++));
// Event
- position.set("event", parser.group(index++));
+ position.set(Event.KEY_EVENT, parser.group(index++));
// Status
int status = Integer.valueOf(parser.group(index++));
position.setValid((status & 0x04) == 0);
- position.set("status", status);
+ position.set(Event.KEY_STATUS, status);
return position;
}
diff --git a/src/org/traccar/protocol/CalAmpProtocolDecoder.java b/src/org/traccar/protocol/CalAmpProtocolDecoder.java
index 7cf5031f3..f5362f705 100644
--- a/src/org/traccar/protocol/CalAmpProtocolDecoder.java
+++ b/src/org/traccar/protocol/CalAmpProtocolDecoder.java
@@ -26,6 +26,7 @@ import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.Channels;
import org.jboss.netty.channel.MessageEvent;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class CalAmpProtocolDecoder extends BaseProtocolDecoder {
@@ -178,10 +179,10 @@ public class CalAmpProtocolDecoder extends BaseProtocolDecoder {
// Fix status
if (type == MSG_MINI_EVENT_REPORT) {
- position.set("satellites", buf.getUnsignedByte(buf.readerIndex()) & 0xf);
+ position.set(Event.KEY_SATELLITES, buf.getUnsignedByte(buf.readerIndex()) & 0xf);
position.setValid((buf.readUnsignedByte() & 0x20) == 0);
} else {
- position.set("satellites", buf.readUnsignedByte());
+ position.set(Event.KEY_SATELLITES, buf.readUnsignedByte());
position.setValid((buf.readUnsignedByte() & 0x08) == 0);
}
@@ -191,7 +192,7 @@ public class CalAmpProtocolDecoder extends BaseProtocolDecoder {
position.set("carrier", buf.readUnsignedShort());
// Cell signal
- position.set("gsm", buf.readShort());
+ position.set(Event.KEY_GSM, buf.readShort());
}
@@ -200,20 +201,20 @@ public class CalAmpProtocolDecoder extends BaseProtocolDecoder {
// HDOP
if (type != MSG_MINI_EVENT_REPORT) {
- position.set("hdop", buf.readUnsignedByte());
+ position.set(Event.KEY_HDOP, buf.readUnsignedByte());
}
// Inputs
- position.set("input", buf.readUnsignedByte());
+ position.set(Event.KEY_INPUT, buf.readUnsignedByte());
// Unit status
if (type != MSG_MINI_EVENT_REPORT) {
- position.set("status", buf.readUnsignedByte());
+ position.set(Event.KEY_STATUS, buf.readUnsignedByte());
}
// Event code and status
if (type == MSG_EVENT_REPORT || type == MSG_MINI_EVENT_REPORT) {
- position.set("event", buf.readUnsignedByte() + " - " + buf.readUnsignedByte());
+ position.set(Event.KEY_EVENT, buf.readUnsignedByte() + " - " + buf.readUnsignedByte());
}
// Accumulators
diff --git a/src/org/traccar/protocol/CarTrackProtocolDecoder.java b/src/org/traccar/protocol/CarTrackProtocolDecoder.java
index b88f9840d..06f1e5342 100644
--- a/src/org/traccar/protocol/CarTrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/CarTrackProtocolDecoder.java
@@ -25,6 +25,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class CarTrackProtocolDecoder extends BaseProtocolDecoder {
@@ -124,19 +125,18 @@ public class CarTrackProtocolDecoder extends BaseProtocolDecoder {
// State
position.set("io", parser.group(index++));
- /* Start : Added By Rohit Singhal, Decode Milage Data*/
- // Prepare Mile Meter Data
- String milage = parser.group(index++);
- milage = milage.replace(":", "A");
- milage = milage.replace(";", "B");
- milage = milage.replace("<", "C");
- milage = milage.replace("=", "D");
- milage = milage.replace(">", "E");
- milage = milage.replace("?", "F");
- position.set("milage", Integer.parseInt(milage, 16));
- /* Commented By Rohit position.set("milage", parser.group(index++)); */
- /*End : Added By Rohit Singhal, Decode Milage Data*/
- position.set("alarm", parser.group(index++));
+
+ // Odometer
+ String odometer = parser.group(index++);
+ odometer = odometer.replace(":", "A");
+ odometer = odometer.replace(";", "B");
+ odometer = odometer.replace("<", "C");
+ odometer = odometer.replace("=", "D");
+ odometer = odometer.replace(">", "E");
+ odometer = odometer.replace("?", "F");
+ position.set(Event.KEY_ODOMETER, Integer.parseInt(odometer, 16));
+
+ position.set(Event.KEY_ALARM, parser.group(index++));
position.set("ad", parser.group(index++));
return position;
}
diff --git a/src/org/traccar/protocol/CarscopProtocolDecoder.java b/src/org/traccar/protocol/CarscopProtocolDecoder.java
index 2e912961c..6270a2804 100644
--- a/src/org/traccar/protocol/CarscopProtocolDecoder.java
+++ b/src/org/traccar/protocol/CarscopProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class CarscopProtocolDecoder extends BaseProtocolDecoder {
@@ -44,7 +45,7 @@ public class CarscopProtocolDecoder extends BaseProtocolDecoder {
"(\\d{2})(\\d{2})(\\d{2})" + // Date (YYMMDD)
"(\\d{3}\\.\\d{2})" + // Course
"(\\d{8})" + // State
- "L(\\d{6})"); // Milage
+ "L(\\d{6})"); // Odometer
@Override
protected Object decode(
@@ -112,8 +113,8 @@ public class CarscopProtocolDecoder extends BaseProtocolDecoder {
// State
position.set("state", parser.group(index++));
- // Milage
- position.set("milage", Integer.valueOf(parser.group(index++)));
+ // Odometer
+ position.set(Event.KEY_ODOMETER, Integer.valueOf(parser.group(index++)));
return position;
}
diff --git a/src/org/traccar/protocol/CellocatorProtocolDecoder.java b/src/org/traccar/protocol/CellocatorProtocolDecoder.java
index 2fac487c4..70d5d7c62 100644
--- a/src/org/traccar/protocol/CellocatorProtocolDecoder.java
+++ b/src/org/traccar/protocol/CellocatorProtocolDecoder.java
@@ -25,6 +25,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class CellocatorProtocolDecoder extends BaseProtocolDecoder {
@@ -115,7 +116,7 @@ public class CellocatorProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte(); // protocol version
// Status
- position.set("status", buf.getUnsignedByte(buf.readerIndex()) & 0x0f);
+ position.set(Event.KEY_STATUS, buf.getUnsignedByte(buf.readerIndex()) & 0x0f);
int operator = (buf.readUnsignedByte() & 0xf0) << 4;
operator += buf.readUnsignedByte();
@@ -130,7 +131,7 @@ public class CellocatorProtocolDecoder extends BaseProtocolDecoder {
position.set("operator", operator);
buf.readUnsignedInt(); // ADC
- buf.readUnsignedMedium(); // milage
+ buf.readUnsignedMedium(); // Odometer
buf.skipBytes(6); // multi-purpose data
buf.readUnsignedShort(); // gps fix
diff --git a/src/org/traccar/protocol/EasyTrackProtocolDecoder.java b/src/org/traccar/protocol/EasyTrackProtocolDecoder.java
index eed94843d..a3f75973e 100644
--- a/src/org/traccar/protocol/EasyTrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/EasyTrackProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class EasyTrackProtocolDecoder extends BaseProtocolDecoder {
@@ -53,7 +54,7 @@ public class EasyTrackProtocolDecoder extends BaseProtocolDecoder {
"(\\p{XDigit}+)," + // Signal
"(\\d+)," + // Power
"(\\p{XDigit}{4})," + // Oil
- "(\\p{XDigit}+),?" + // Milage
+ "(\\p{XDigit}+),?" + // Odometer
"(\\d+)?" + // Altitude
".*");
@@ -112,19 +113,19 @@ public class EasyTrackProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(Integer.parseInt(parser.group(index++), 16) / 100.0);
// Status
- position.set("status", parser.group(index++));
+ position.set(Event.KEY_STATUS, parser.group(index++));
// Signal
position.set("signal", parser.group(index++));
// Power
- position.set("power", Double.valueOf(parser.group(index++)));
+ position.set(Event.KEY_POWER, Double.valueOf(parser.group(index++)));
// Oil
position.set("oil", Integer.parseInt(parser.group(index++), 16));
- // Milage
- position.set("milage", Integer.parseInt(parser.group(index++), 16));
+ // Odometer
+ position.set(Event.KEY_ODOMETER, Integer.parseInt(parser.group(index++), 16));
// Altitude
String altitude = parser.group(index++);
diff --git a/src/org/traccar/protocol/EelinkProtocolDecoder.java b/src/org/traccar/protocol/EelinkProtocolDecoder.java
index 8f403d95f..bbcce5cfc 100644
--- a/src/org/traccar/protocol/EelinkProtocolDecoder.java
+++ b/src/org/traccar/protocol/EelinkProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.ChannelBufferTools;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class EelinkProtocolDecoder extends BaseProtocolDecoder {
@@ -96,7 +97,7 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(getDeviceId());
position.setProtocol(getProtocol());
- position.set("index", index);
+ position.set(Event.KEY_INDEX, index);
// Location
position.setTime(new Date(buf.readUnsignedInt() * 1000));
@@ -106,17 +107,17 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(buf.readUnsignedShort());
// Cell
- position.set("cell", ChannelBufferTools.readHexString(buf, 18));
+ position.set(Event.KEY_CELL, ChannelBufferTools.readHexString(buf, 18));
// Validity
position.setValid((buf.readUnsignedByte() & 0x01) != 0);
if (type == MSG_ALARM) {
- position.set("alarm", buf.readUnsignedByte());
+ position.set(Event.KEY_ALARM, buf.readUnsignedByte());
}
if (type == MSG_STATE) {
- position.set("status", buf.readUnsignedByte());
+ position.set(Event.KEY_STATUS, buf.readUnsignedByte());
}
return position;
}
@@ -134,7 +135,7 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder {
// Create new position
Position position = new Position();
ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("gt02");
- position.set("index", index);
+ position.set(Event.KEY_INDEX, index);
// Get device id
try {
diff --git a/src/org/traccar/protocol/EnforaProtocolDecoder.java b/src/org/traccar/protocol/EnforaProtocolDecoder.java
index 67ad1a691..1185c28ad 100644
--- a/src/org/traccar/protocol/EnforaProtocolDecoder.java
+++ b/src/org/traccar/protocol/EnforaProtocolDecoder.java
@@ -28,6 +28,7 @@ import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.ChannelBufferTools;
import org.traccar.helper.Log;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class EnforaProtocolDecoder extends BaseProtocolDecoder {
diff --git a/src/org/traccar/protocol/Ev603ProtocolDecoder.java b/src/org/traccar/protocol/Ev603ProtocolDecoder.java
index 49d70d433..5024ddcd1 100644
--- a/src/org/traccar/protocol/Ev603ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Ev603ProtocolDecoder.java
@@ -25,6 +25,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class Ev603ProtocolDecoder extends BaseProtocolDecoder{
diff --git a/src/org/traccar/protocol/FreedomProtocolDecoder.java b/src/org/traccar/protocol/FreedomProtocolDecoder.java
index c0e7ec7c6..e4cfe99af 100644
--- a/src/org/traccar/protocol/FreedomProtocolDecoder.java
+++ b/src/org/traccar/protocol/FreedomProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class FreedomProtocolDecoder extends BaseProtocolDecoder {
diff --git a/src/org/traccar/protocol/GalileoProtocolDecoder.java b/src/org/traccar/protocol/GalileoProtocolDecoder.java
index ffd859f45..c2c8864e9 100644
--- a/src/org/traccar/protocol/GalileoProtocolDecoder.java
+++ b/src/org/traccar/protocol/GalileoProtocolDecoder.java
@@ -26,6 +26,7 @@ import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.Log;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class GalileoProtocolDecoder extends BaseProtocolDecoder {
@@ -42,7 +43,7 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder {
private static final int TAG_STATUS = 0x40;
private static final int TAG_POWER = 0x41;
private static final int TAG_BATTERY = 0x42;
- private static final int TAG_MILAGE = 0xd4;
+ private static final int TAG_ODOMETER = 0xd4;
private static final int TAG_REFRIGERATOR = 0x5b;
private static final int TAG_PRESSURE = 0x5c;
@@ -135,19 +136,19 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder {
break;
case TAG_STATUS:
- position.set("status", buf.readUnsignedShort());
+ position.set(Event.KEY_STATUS, buf.readUnsignedShort());
break;
case TAG_POWER:
- position.set("power", buf.readUnsignedShort());
+ position.set(Event.KEY_POWER, buf.readUnsignedShort());
break;
case TAG_BATTERY:
- position.set("battery", buf.readUnsignedShort());
+ position.set(Event.KEY_BATTERY, buf.readUnsignedShort());
break;
- case TAG_MILAGE:
- position.set("milage", buf.readUnsignedInt());
+ case TAG_ODOMETER:
+ position.set(Event.KEY_ODOMETER, buf.readUnsignedInt());
break;
default:
diff --git a/src/org/traccar/protocol/GatorProtocolDecoder.java b/src/org/traccar/protocol/GatorProtocolDecoder.java
index d277b4b3d..4078fd64f 100644
--- a/src/org/traccar/protocol/GatorProtocolDecoder.java
+++ b/src/org/traccar/protocol/GatorProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.ChannelBufferTools;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class GatorProtocolDecoder extends BaseProtocolDecoder {
@@ -96,10 +97,10 @@ public class GatorProtocolDecoder extends BaseProtocolDecoder {
// Flags
int flags = buf.readUnsignedByte();
position.setValid((flags & 0x80) != 0);
- position.set("satellites", flags & 0x0f);
+ position.set(Event.KEY_SATELLITES, flags & 0x0f);
// Status
- position.set("status", buf.readUnsignedByte());
+ position.set(Event.KEY_STATUS, buf.readUnsignedByte());
// Key switch
position.set("key", buf.readUnsignedByte());
@@ -108,10 +109,10 @@ public class GatorProtocolDecoder extends BaseProtocolDecoder {
position.set("oil", buf.readUnsignedShort() / 10.0);
// Power
- position.set("power", buf.readUnsignedByte() + buf.readUnsignedByte() / 100.0);
+ position.set(Event.KEY_POWER, buf.readUnsignedByte() + buf.readUnsignedByte() / 100.0);
- // Milage
- position.set("milage", buf.readUnsignedInt());
+ // Odometer
+ position.set(Event.KEY_ODOMETER, buf.readUnsignedInt());
return position;
}
diff --git a/src/org/traccar/protocol/Gl100ProtocolDecoder.java b/src/org/traccar/protocol/Gl100ProtocolDecoder.java
index 04be88121..a4545583b 100644
--- a/src/org/traccar/protocol/Gl100ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl100ProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class Gl100ProtocolDecoder extends BaseProtocolDecoder {
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
index dfff90e70..61282f521 100644
--- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
@@ -50,7 +51,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
"(\\d{4})?," + // MNC
"(\\p{XDigit}{4})?," + // LAC
"(\\p{XDigit}{4})?," + // Cell
- "(?:(\\d+\\.\\d)?," + // Milage
+ "(?:(\\d+\\.\\d)?," + // Odometer
"(\\d{1,3})?)?" + // Battery
".*");
@@ -118,17 +119,17 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
position.setTime(time.getTime());
// Cell information
- position.set("mcc", parser.group(index++));
- position.set("mnc", parser.group(index++));
- position.set("lac", parser.group(index++));
- position.set("cell", parser.group(index++));
+ position.set(Event.KEY_MCC, parser.group(index++));
+ position.set(Event.KEY_MNC, parser.group(index++));
+ position.set(Event.KEY_LAC, parser.group(index++));
+ position.set(Event.KEY_CELL, parser.group(index++));
// Other
- String milage = parser.group(index++);
- if (milage != null && Double.valueOf(milage) != 0) {
- position.set("milage", milage);
+ String odometer = parser.group(index++);
+ if (odometer != null && Double.valueOf(odometer) != 0) {
+ position.set(Event.KEY_ODOMETER, odometer);
}
- position.set("battery", parser.group(index++));
+ position.set(Event.KEY_BATTERY, parser.group(index++));
return position;
}
diff --git a/src/org/traccar/protocol/GlobalSatProtocolDecoder.java b/src/org/traccar/protocol/GlobalSatProtocolDecoder.java
index 05521c476..512ed9da8 100644
--- a/src/org/traccar/protocol/GlobalSatProtocolDecoder.java
+++ b/src/org/traccar/protocol/GlobalSatProtocolDecoder.java
@@ -26,6 +26,7 @@ import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
import org.traccar.Context;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class GlobalSatProtocolDecoder extends BaseProtocolDecoder {
@@ -167,7 +168,7 @@ public class GlobalSatProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(Double.valueOf(value));
break;
case 'N':
- position.set("battery", value);
+ position.set(Event.KEY_BATTERY, value);
break;
default:
// Unsupported
@@ -253,10 +254,10 @@ public class GlobalSatProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(Double.valueOf(parser.group(index++)));
// Satellites
- position.set("satellites", Integer.valueOf(parser.group(index++)));
+ position.set(Event.KEY_SATELLITES, Integer.valueOf(parser.group(index++)));
// HDOP
- position.set("hdop", parser.group(index++));
+ position.set(Event.KEY_HDOP, parser.group(index++));
return position;
}
diff --git a/src/org/traccar/protocol/GoSafeProtocolDecoder.java b/src/org/traccar/protocol/GoSafeProtocolDecoder.java
index 477845090..a768ac589 100644
--- a/src/org/traccar/protocol/GoSafeProtocolDecoder.java
+++ b/src/org/traccar/protocol/GoSafeProtocolDecoder.java
@@ -25,6 +25,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class GoSafeProtocolDecoder extends BaseProtocolDecoder {
@@ -104,7 +105,7 @@ public class GoSafeProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(Double.valueOf(parser.group(index++)));
position.setCourse(Double.valueOf(parser.group(index++)));
position.setAltitude(Double.valueOf(parser.group(index++)));
- position.set("hdop", parser.group(index++));
+ position.set(Event.KEY_HDOP, parser.group(index++));
return position;
}
diff --git a/src/org/traccar/protocol/GotopProtocolDecoder.java b/src/org/traccar/protocol/GotopProtocolDecoder.java
index 932a84f1b..baa54b09e 100644
--- a/src/org/traccar/protocol/GotopProtocolDecoder.java
+++ b/src/org/traccar/protocol/GotopProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class GotopProtocolDecoder extends BaseProtocolDecoder {
@@ -96,7 +97,7 @@ public class GotopProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(Double.valueOf(parser.group(index++)) * 0.539957);
// Status
- position.set("status", parser.group(index++));
+ position.set(Event.KEY_STATUS, parser.group(index++));
// Course
String course = parser.group(index++);
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
index 3c0cc6726..f842441a5 100644
--- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
@@ -25,6 +25,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
@@ -101,7 +102,7 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(getDeviceId());
// Alarm message
- position.set("alarm", parser.group(index++));
+ position.set(Event.KEY_ALARM, parser.group(index++));
// Date
Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
diff --git a/src/org/traccar/protocol/GpsGateProtocolDecoder.java b/src/org/traccar/protocol/GpsGateProtocolDecoder.java
index 14f665d18..dbc1ac5a9 100644
--- a/src/org/traccar/protocol/GpsGateProtocolDecoder.java
+++ b/src/org/traccar/protocol/GpsGateProtocolDecoder.java
@@ -25,6 +25,7 @@ import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.Crc;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class GpsGateProtocolDecoder extends BaseProtocolDecoder {
diff --git a/src/org/traccar/protocol/Gt02ProtocolDecoder.java b/src/org/traccar/protocol/Gt02ProtocolDecoder.java
index d5da01efb..3280be207 100644
--- a/src/org/traccar/protocol/Gt02ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gt02ProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class Gt02ProtocolDecoder extends BaseProtocolDecoder {
@@ -77,7 +78,7 @@ public class Gt02ProtocolDecoder extends BaseProtocolDecoder {
// Create new position
Position position = new Position();
position.setProtocol(getProtocol());
- position.set("index", index);
+ position.set(Event.KEY_INDEX, index);
// Get device id
if (!identify(imei)) {
diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
index f2ccea794..c4670cc2c 100644
--- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -22,6 +22,7 @@ import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
import org.traccar.Context;
import org.traccar.helper.Crc;
+import org.traccar.model.Event;
import org.traccar.model.Position;
import java.util.Calendar;
@@ -157,7 +158,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
// GPS length and Satellites count
int gpsLength = buf.readUnsignedByte();
- position.set("satellites", gpsLength & 0xf);
+ position.set(Event.KEY_SATELLITES, gpsLength & 0xf);
gpsLength >>= 4;
// Latitude
@@ -194,16 +195,16 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
}
// Cell information
- position.set("mcc", buf.readUnsignedShort());
- position.set("mnc", buf.readUnsignedByte());
- position.set("lac", buf.readUnsignedShort());
- position.set("cell", buf.readUnsignedShort() << 8 + 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_CELL, buf.readUnsignedShort() << 8 + buf.readUnsignedByte());
buf.skipBytes(lbsLength - 9);
// Status
if (type == MSG_GPS_LBS_STATUS_1 || type == MSG_GPS_LBS_STATUS_2 || type == MSG_GPS_LBS_STATUS_3) {
- position.set("alarm", true);
+ position.set(Event.KEY_ALARM, true);
int flags = buf.readUnsignedByte();
@@ -211,10 +212,10 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
// TODO parse other flags
// Voltage
- position.set("power", buf.readUnsignedByte());
+ position.set(Event.KEY_POWER, buf.readUnsignedByte());
// GSM signal
- position.set("gsm", buf.readUnsignedByte());
+ position.set(Event.KEY_GSM, buf.readUnsignedByte());
}
}
@@ -223,7 +224,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
buf.skipBytes(buf.readableBytes() - 6);
}
int index = buf.readUnsignedShort();
- position.set("index", index);
+ position.set(Event.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 3d1eadf14..30c0aaa60 100644
--- a/src/org/traccar/protocol/H02ProtocolDecoder.java
+++ b/src/org/traccar/protocol/H02ProtocolDecoder.java
@@ -27,6 +27,7 @@ import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.ChannelBufferTools;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class H02ProtocolDecoder extends BaseProtocolDecoder {
@@ -95,7 +96,7 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder {
position.setCourse((buf.readUnsignedByte() & 0x0f) * 100.0 + ChannelBufferTools.readHexInteger(buf, 2));
// Status
- position.set("status", ChannelBufferTools.readHexString(buf, 8));
+ position.set(Event.KEY_STATUS, ChannelBufferTools.readHexString(buf, 8));
return position;
}
@@ -174,7 +175,7 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder {
position.setTime(time.getTime());
// Status
- position.set("status", parser.group(index++));
+ position.set(Event.KEY_STATUS, parser.group(index++));
return position;
}
diff --git a/src/org/traccar/protocol/HaicomProtocolDecoder.java b/src/org/traccar/protocol/HaicomProtocolDecoder.java
index b685a40c5..303f96793 100644
--- a/src/org/traccar/protocol/HaicomProtocolDecoder.java
+++ b/src/org/traccar/protocol/HaicomProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class HaicomProtocolDecoder extends BaseProtocolDecoder {
@@ -113,12 +114,12 @@ public class HaicomProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(Double.valueOf(parser.group(index++)) / 10);
// Additional data
- position.set("status", parser.group(index++));
+ position.set(Event.KEY_STATUS, parser.group(index++));
position.set("gprs", parser.group(index++));
- position.set("gps", parser.group(index++));
- position.set("input", parser.group(index++));
- position.set("output", parser.group(index++));
- position.set("battery", Double.valueOf(parser.group(index++)) / 10);
+ position.set(Event.KEY_GPS, parser.group(index++));
+ position.set(Event.KEY_INPUT, parser.group(index++));
+ position.set(Event.KEY_OUTPUT, parser.group(index++));
+ position.set(Event.KEY_BATTERY, Double.valueOf(parser.group(index++)) / 10);
return position;
}
diff --git a/src/org/traccar/protocol/IntellitracProtocolDecoder.java b/src/org/traccar/protocol/IntellitracProtocolDecoder.java
index c621b07e7..e1fe91d49 100644
--- a/src/org/traccar/protocol/IntellitracProtocolDecoder.java
+++ b/src/org/traccar/protocol/IntellitracProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class IntellitracProtocolDecoder extends BaseProtocolDecoder {
@@ -57,7 +58,7 @@ public class IntellitracProtocolDecoder extends BaseProtocolDecoder {
"(\\d+)," + // Charger Pressure
"(\\d+)," + // TPL
"(\\d+)," + // Axle Weight
- "(\\d+))?" + // Milage
+ "(\\d+))?" + // Odometer
".*");
@Override
@@ -105,16 +106,16 @@ public class IntellitracProtocolDecoder extends BaseProtocolDecoder {
// Satellites
int satellites = Integer.valueOf(parser.group(index++));
position.setValid(satellites >= 3);
- position.set("satellites", satellites);
+ position.set(Event.KEY_SATELLITES, satellites);
// Report identifier
- position.set("index", Long.valueOf(parser.group(index++)));
+ position.set(Event.KEY_INDEX, Long.valueOf(parser.group(index++)));
// Input
- position.set("input", parser.group(index++));
+ position.set(Event.KEY_INPUT, parser.group(index++));
// Output
- position.set("output", parser.group(index++));
+ position.set(Event.KEY_OUTPUT, parser.group(index++));
// ADC1
position.set("adc1", parser.group(index++));
@@ -126,13 +127,13 @@ public class IntellitracProtocolDecoder extends BaseProtocolDecoder {
position.set("vss", parser.group(index++));
position.set("rpm", parser.group(index++));
position.set("coolant", parser.group(index++));
- position.set("fuel", parser.group(index++));
+ position.set(Event.KEY_FUEL, parser.group(index++));
position.set("consumption", parser.group(index++));
- position.set("temperature", parser.group(index++));
+ position.set(Event.KEY_TEMPERATURE, parser.group(index++));
position.set("charger", parser.group(index++));
position.set("tpl", parser.group(index++));
position.set("axle", parser.group(index++));
- position.set("milage", parser.group(index++));
+ position.set(Event.KEY_ODOMETER, parser.group(index++));
return position;
}
diff --git a/src/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
index 54110b101..52b84296d 100644
--- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
@@ -27,6 +27,7 @@ import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.ChannelBufferTools;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
@@ -92,29 +93,29 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
if (version == 1) {
- position.set("satellites", buf.readUnsignedByte());
+ position.set(Event.KEY_SATELLITES, buf.readUnsignedByte());
// Power
- position.set("power", buf.readUnsignedByte());
+ position.set(Event.KEY_POWER, buf.readUnsignedByte());
buf.readByte(); // other flags and sensors
// Altitude
position.setAltitude(buf.readUnsignedShort());
- position.set("cell", buf.readUnsignedShort());
- position.set("lac", buf.readUnsignedShort());
- position.set("gsm", buf.readUnsignedByte());
+ position.set(Event.KEY_CELL, buf.readUnsignedShort());
+ position.set(Event.KEY_LAC, buf.readUnsignedShort());
+ position.set(Event.KEY_GSM, buf.readUnsignedByte());
} else if (version == 2) {
int fuel = buf.readUnsignedByte() << 8;
- position.set("status", buf.readUnsignedInt());
- position.set("milage", buf.readUnsignedInt());
+ position.set(Event.KEY_STATUS, buf.readUnsignedInt());
+ position.set(Event.KEY_ODOMETER, buf.readUnsignedInt());
fuel += buf.readUnsignedByte();
- position.set("fuel", fuel);
+ position.set(Event.KEY_FUEL, fuel);
}
return position;
@@ -194,7 +195,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(Double.valueOf(parser.group(index++)));
// Power
- position.set("power", Double.valueOf(parser.group(index++)));
+ position.set(Event.KEY_POWER, Double.valueOf(parser.group(index++)));
return position;
}
diff --git a/src/org/traccar/protocol/KhdProtocolDecoder.java b/src/org/traccar/protocol/KhdProtocolDecoder.java
index cb2cf161a..bf1f5deea 100644
--- a/src/org/traccar/protocol/KhdProtocolDecoder.java
+++ b/src/org/traccar/protocol/KhdProtocolDecoder.java
@@ -26,6 +26,7 @@ import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.ChannelBufferTools;
import org.traccar.helper.Crc;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class KhdProtocolDecoder extends BaseProtocolDecoder {
@@ -107,8 +108,8 @@ public class KhdProtocolDecoder extends BaseProtocolDecoder {
} else {
- // Milage
- position.set("milage", buf.readUnsignedMedium());
+ // Odometer
+ position.set(Event.KEY_ODOMETER, buf.readUnsignedMedium());
// Status
buf.skipBytes(4);
diff --git a/src/org/traccar/protocol/LaipacProtocolDecoder.java b/src/org/traccar/protocol/LaipacProtocolDecoder.java
index efc6b0514..af43df511 100644
--- a/src/org/traccar/protocol/LaipacProtocolDecoder.java
+++ b/src/org/traccar/protocol/LaipacProtocolDecoder.java
@@ -25,6 +25,7 @@ import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.Crc;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class LaipacProtocolDecoder extends BaseProtocolDecoder {
diff --git a/src/org/traccar/protocol/M2mProtocolDecoder.java b/src/org/traccar/protocol/M2mProtocolDecoder.java
index 026a067b4..c335a2d41 100644
--- a/src/org/traccar/protocol/M2mProtocolDecoder.java
+++ b/src/org/traccar/protocol/M2mProtocolDecoder.java
@@ -23,6 +23,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class M2mProtocolDecoder extends BaseProtocolDecoder {
@@ -116,7 +117,7 @@ public class M2mProtocolDecoder extends BaseProtocolDecoder {
if (satellites == 0) {
return null; // cell information
}
- position.set("satellites", satellites);
+ position.set(Event.KEY_SATELLITES, satellites);
position.setValid(true);
// TODO decode everything else
diff --git a/src/org/traccar/protocol/ManPowerProtocolDecoder.java b/src/org/traccar/protocol/ManPowerProtocolDecoder.java
index 840a1a032..773e2d782 100644
--- a/src/org/traccar/protocol/ManPowerProtocolDecoder.java
+++ b/src/org/traccar/protocol/ManPowerProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class ManPowerProtocolDecoder extends BaseProtocolDecoder {
@@ -74,7 +75,7 @@ public class ManPowerProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(getDeviceId());
// Alarm message
- position.set("status", parser.group(index++));
+ position.set(Event.KEY_STATUS, parser.group(index++));
// Date
Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
diff --git a/src/org/traccar/protocol/MaxonProtocolDecoder.java b/src/org/traccar/protocol/MaxonProtocolDecoder.java
index 39a841a1f..c25a190f1 100644
--- a/src/org/traccar/protocol/MaxonProtocolDecoder.java
+++ b/src/org/traccar/protocol/MaxonProtocolDecoder.java
@@ -27,6 +27,7 @@ import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
import org.traccar.database.DataManager;
import org.traccar.helper.Log;
+import org.traccar.model.Event;
import org.traccar.model.Position;
/**
diff --git a/src/org/traccar/protocol/MegastekProtocolDecoder.java b/src/org/traccar/protocol/MegastekProtocolDecoder.java
index 77b1fb5ca..84bd33be8 100644
--- a/src/org/traccar/protocol/MegastekProtocolDecoder.java
+++ b/src/org/traccar/protocol/MegastekProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class MegastekProtocolDecoder extends BaseProtocolDecoder {
@@ -188,7 +189,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
int index = 1;
// Alarm
- position.set("alarm", parser.group(index++));
+ position.set(Event.KEY_ALARM, parser.group(index++));
// IMEI
if (!identify(parser.group(index++), false)) {
@@ -199,7 +200,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(getDeviceId());
// Satellites
- position.set("satellites", parser.group(index++));
+ position.set(Event.KEY_SATELLITES, parser.group(index++));
// Altitude
String altitude = parser.group(index++);
@@ -208,7 +209,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
}
// Battery
- position.set("power", Double.valueOf(parser.group(index++)));
+ position.set(Event.KEY_POWER, Double.valueOf(parser.group(index++)));
// Charger
String charger = parser.group(index++);
@@ -216,9 +217,9 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
position.set("charger", Integer.valueOf(charger) == 1);
}
- position.set("mcc", parser.group(index++));
- position.set("mnc", parser.group(index++));
- position.set("lac", parser.group(index++));
+ position.set(Event.KEY_MCC, parser.group(index++));
+ position.set(Event.KEY_MNC, parser.group(index++));
+ position.set(Event.KEY_LAC, parser.group(index++));
} else {
@@ -235,21 +236,21 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
}
position.setDeviceId(getDeviceId());
- position.set("mcc", parser.group(index++));
- position.set("mnc", parser.group(index++));
- position.set("lac", parser.group(index++));
- position.set("gsm", parser.group(index++));
+ position.set(Event.KEY_MCC, parser.group(index++));
+ position.set(Event.KEY_MNC, parser.group(index++));
+ position.set(Event.KEY_LAC, parser.group(index++));
+ position.set(Event.KEY_GSM, parser.group(index++));
// Battery
- position.set("battery", Double.valueOf(parser.group(index++)));
+ position.set(Event.KEY_BATTERY, Double.valueOf(parser.group(index++)));
position.set("flags", parser.group(index++));
- position.set("input", parser.group(index++));
- position.set("output", parser.group(index++));
+ position.set(Event.KEY_INPUT, parser.group(index++));
+ position.set(Event.KEY_OUTPUT, parser.group(index++));
position.set("adc1", parser.group(index++));
position.set("adc2", parser.group(index++));
position.set("adc3", parser.group(index++));
- position.set("alarm", parser.group(index++));
+ position.set(Event.KEY_ALARM, parser.group(index++));
}
return position;
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
index d35a75885..c58538445 100644
--- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
@@ -31,6 +31,7 @@ import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
import org.traccar.Context;
import org.traccar.helper.Crc;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
@@ -58,7 +59,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
",([0-9a-fA-F]+),([0-9a-fA-F]+))?" +
"(?:\\|([0-9a-fA-F]+))?" + // Cell
"(?:\\|([0-9a-fA-F]+))?" + // Signal
- "(?:\\|([0-9a-fA-F]+))?" + // Milage
+ "(?:\\|([0-9a-fA-F]+))?" + // Odometer
".*");
private static final int MSG_HEARTBEAT = 0x0001;
@@ -171,7 +172,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
// Custom data
if (command == MSG_ALARM) {
- position.set("alarm", buf.readUnsignedByte());
+ position.set(Event.KEY_ALARM, buf.readUnsignedByte());
} else if (command == MSG_POSITION_LOGGED) {
buf.skipBytes(6);
}
@@ -237,7 +238,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
position.setTime(time.getTime());
// Dilution of precision
- position.set("hdop", parser.group(index++));
+ position.set(Event.KEY_HDOP, parser.group(index++));
// Altitude
String altitude = parser.group(index++);
@@ -262,19 +263,19 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
// Cell identifier
String cell = parser.group(index++);
if (cell != null) {
- position.set("cell", cell);
+ position.set(Event.KEY_CELL, cell);
}
// GSM signal
String gsm = parser.group(index++);
if (gsm != null) {
- position.set("gsm", Integer.parseInt(gsm, 16));
+ position.set(Event.KEY_GSM, Integer.parseInt(gsm, 16));
}
- // Milage
- String milage = parser.group(index++);
- if (milage != null) {
- position.set("milage", Integer.parseInt(milage, 16));
+ // Odometer
+ String odometer = parser.group(index++);
+ if (odometer != null) {
+ position.set(Event.KEY_ODOMETER, Integer.parseInt(odometer, 16));
}
return position;
diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java
index d96afba01..8828bfd23 100644
--- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java
@@ -30,6 +30,7 @@ import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.ChannelBufferTools;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
@@ -56,7 +57,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
"(\\d+)," + // Course
"(\\d+\\.?\\d*)," + // HDOP
"(-?\\d+)," + // Altitude
- "(\\d+)," + // Milage
+ "(\\d+)," + // Odometer
"(\\d+)," + // Runtime
"(\\d+\\|\\d+\\|\\p{XDigit}+\\|\\p{XDigit}+)," + // Cell
"(\\p{XDigit}+)," + // State
@@ -94,7 +95,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
// Event
int event = Integer.valueOf(parser.group(index++));
- position.set("event", event);
+ position.set(Event.KEY_EVENT, event);
// Coordinates
position.setLatitude(Double.valueOf(parser.group(index++)));
@@ -115,10 +116,10 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
position.setValid(parser.group(index++).compareTo("A") == 0);
// Satellites
- position.set("satellites", parser.group(index++));
+ position.set(Event.KEY_SATELLITES, parser.group(index++));
// GSM Signal
- position.set("gsm", parser.group(index++));
+ position.set(Event.KEY_GSM, parser.group(index++));
// Speed
position.setSpeed(Double.valueOf(parser.group(index++)) * 0.539957);
@@ -127,15 +128,15 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(Double.valueOf(parser.group(index++)));
// HDOP
- position.set("hdop", parser.group(index++));
+ position.set(Event.KEY_HDOP, parser.group(index++));
// Altitude
position.setAltitude(Double.valueOf(parser.group(index++)));
// Other
- position.set("milage", parser.group(index++));
+ position.set(Event.KEY_ODOMETER, parser.group(index++));
position.set("runtime", parser.group(index++));
- position.set("cell", parser.group(index++));
+ position.set(Event.KEY_CELL, parser.group(index++));
position.set("state", parser.group(index++));
// ADC
@@ -151,8 +152,8 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
if (adc3 != null) {
position.set("adc3", Integer.parseInt(adc3, 16));
}
- position.set("battery", Integer.parseInt(parser.group(index++), 16));
- position.set("power", Integer.parseInt(parser.group(index++), 16));
+ position.set(Event.KEY_BATTERY, Integer.parseInt(parser.group(index++), 16));
+ position.set(Event.KEY_POWER, Integer.parseInt(parser.group(index++), 16));
// Event specific
String data = parser.group(index++);
@@ -167,7 +168,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
// Fuel
String fuel = parser.group(index++);
if (fuel != null) {
- position.set("fuel",
+ position.set(Event.KEY_FUEL,
Integer.parseInt(fuel.substring(0, 2), 16) + Integer.parseInt(fuel.substring(2), 16) * 0.01);
}
@@ -195,7 +196,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(getDeviceId());
// Event
- position.set("event", buf.readUnsignedByte());
+ position.set(Event.KEY_EVENT, buf.readUnsignedByte());
// Location
position.setLatitude(buf.readInt() * 0.000001);
@@ -208,10 +209,10 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
position.setValid(buf.readUnsignedByte() == 1);
// Satellites
- position.set("satellites", buf.readUnsignedByte());
+ position.set(Event.KEY_SATELLITES, buf.readUnsignedByte());
// GSM Signal
- position.set("gsm", buf.readUnsignedByte());
+ position.set(Event.KEY_GSM, buf.readUnsignedByte());
// Speed
position.setSpeed(buf.readUnsignedShort() * 0.539957);
@@ -220,23 +221,23 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(buf.readUnsignedShort());
// HDOP
- position.set("hdop", buf.readUnsignedShort() * 0.1);
+ position.set(Event.KEY_HDOP, buf.readUnsignedShort() * 0.1);
// Altitude
position.setAltitude(buf.readUnsignedShort());
// Other
- position.set("milage", buf.readUnsignedInt());
+ position.set(Event.KEY_ODOMETER, buf.readUnsignedInt());
position.set("runtime", buf.readUnsignedInt());
- position.set("cell",
+ position.set(Event.KEY_CELL,
buf.readUnsignedShort() + "|" + buf.readUnsignedShort() + "|" +
buf.readUnsignedShort() + "|" + buf.readUnsignedShort());
position.set("state", buf.readUnsignedShort());
// ADC
position.set("adc1", buf.readUnsignedShort());
- position.set("battery", buf.readUnsignedShort() * 0.01);
- position.set("power", buf.readUnsignedShort());
+ position.set(Event.KEY_BATTERY, buf.readUnsignedShort() * 0.01);
+ position.set(Event.KEY_POWER, buf.readUnsignedShort());
buf.readUnsignedInt(); // geo-fence
positions.add(position);
diff --git a/src/org/traccar/protocol/MiniFinderProtocolDecoder.java b/src/org/traccar/protocol/MiniFinderProtocolDecoder.java
index 09e8dcafe..036650657 100644
--- a/src/org/traccar/protocol/MiniFinderProtocolDecoder.java
+++ b/src/org/traccar/protocol/MiniFinderProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class MiniFinderProtocolDecoder extends BaseProtocolDecoder {
@@ -101,10 +102,10 @@ public class MiniFinderProtocolDecoder extends BaseProtocolDecoder {
position.setAltitude(Double.valueOf(parser.group(index++)));
// Battery
- position.set("battery", parser.group(index++));
+ position.set(Event.KEY_BATTERY, parser.group(index++));
// Satellites
- position.set("satellites", parser.group(index++));
+ position.set(Event.KEY_SATELLITES, parser.group(index++));
return position;
}
diff --git a/src/org/traccar/protocol/Mta6ProtocolDecoder.java b/src/org/traccar/protocol/Mta6ProtocolDecoder.java
index 69b3ee673..c5bf2827b 100644
--- a/src/org/traccar/protocol/Mta6ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Mta6ProtocolDecoder.java
@@ -34,6 +34,7 @@ import org.jboss.netty.handler.codec.http.HttpVersion;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.ChannelBufferTools;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class Mta6ProtocolDecoder extends BaseProtocolDecoder {
@@ -162,7 +163,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder {
}
if (checkBit(flags, 3)) {
- position.set("milage", buf.readUnsignedShort());
+ position.set(Event.KEY_ODOMETER, buf.readUnsignedShort());
}
if (checkBit(flags, 4)) {
@@ -180,22 +181,22 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder {
}
if (checkBit(flags, 6)) {
- position.set("temperature", buf.readByte());
+ position.set(Event.KEY_TEMPERATURE, buf.readByte());
buf.getUnsignedByte(buf.readerIndex()); // control (>> 4)
position.set("sensor", buf.readUnsignedShort() & 0x0fff);
buf.readUnsignedShort(); // old sensor state (& 0x0fff)
}
if (checkBit(flags, 7)) {
- position.set("battery", buf.getUnsignedByte(buf.readerIndex()) >> 2);
- position.set("power", buf.readUnsignedShort() & 0x03ff);
+ position.set(Event.KEY_BATTERY, buf.getUnsignedByte(buf.readerIndex()) >> 2);
+ position.set(Event.KEY_POWER, buf.readUnsignedShort() & 0x03ff);
buf.readByte(); // microcontroller temperature
- position.set("gsm", (buf.getUnsignedByte(buf.readerIndex()) >> 4) & 0x07);
+ position.set(Event.KEY_GSM, (buf.getUnsignedByte(buf.readerIndex()) >> 4) & 0x07);
int satellites = buf.readUnsignedByte() & 0x0f;
position.setValid(satellites >= 3);
- position.set("satellites", satellites);
+ position.set(Event.KEY_SATELLITES, satellites);
}
positions.add(position);
}
@@ -234,7 +235,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder {
position.setAltitude(buf.readUnsignedShort());
position.setSpeed(buf.readUnsignedByte());
position.setCourse(buf.readByte());
- position.set("milage", new FloatReader().readFloat(buf));
+ position.set(Event.KEY_ODOMETER, new FloatReader().readFloat(buf));
}
if (checkBit(flags, 1)) {
@@ -246,34 +247,34 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder {
if (checkBit(flags, 2)) {
position.set("engine", buf.readUnsignedShort() * 0.125);
position.set("pedals", buf.readUnsignedByte());
- position.set("temperature", buf.readUnsignedByte() - 40);
- buf.readUnsignedShort(); // service milage
+ position.set(Event.KEY_TEMPERATURE, buf.readUnsignedByte() - 40);
+ buf.readUnsignedShort(); // service odometer
}
if (checkBit(flags, 3)) {
- position.set("fuel", buf.readUnsignedShort());
+ position.set(Event.KEY_FUEL, buf.readUnsignedShort());
position.set("adc2", buf.readUnsignedShort());
position.set("adc3", buf.readUnsignedShort());
position.set("adc4", buf.readUnsignedShort());
}
if (checkBit(flags, 4)) {
- position.set("temperature", buf.readByte());
+ position.set(Event.KEY_TEMPERATURE, buf.readByte());
buf.getUnsignedByte(buf.readerIndex()); // control (>> 4)
position.set("sensor", buf.readUnsignedShort() & 0x0fff);
buf.readUnsignedShort(); // old sensor state (& 0x0fff)
}
if (checkBit(flags, 5)) {
- position.set("battery", buf.getUnsignedByte(buf.readerIndex()) >> 2);
- position.set("power", buf.readUnsignedShort() & 0x03ff);
+ position.set(Event.KEY_BATTERY, buf.getUnsignedByte(buf.readerIndex()) >> 2);
+ position.set(Event.KEY_POWER, buf.readUnsignedShort() & 0x03ff);
buf.readByte(); // microcontroller temperature
- position.set("gsm", buf.getUnsignedByte(buf.readerIndex()) >> 5);
+ position.set(Event.KEY_GSM, buf.getUnsignedByte(buf.readerIndex()) >> 5);
int satellites = buf.readUnsignedByte() & 0x1f;
position.setValid(satellites >= 3);
- position.set("satellites", satellites);
+ position.set(Event.KEY_SATELLITES, satellites);
}
// TODO: process other data
diff --git a/src/org/traccar/protocol/MtxProtocolDecoder.java b/src/org/traccar/protocol/MtxProtocolDecoder.java
index 809b26c25..1d32e83f6 100644
--- a/src/org/traccar/protocol/MtxProtocolDecoder.java
+++ b/src/org/traccar/protocol/MtxProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class MtxProtocolDecoder extends BaseProtocolDecoder {
@@ -41,7 +42,7 @@ public class MtxProtocolDecoder extends BaseProtocolDecoder {
"(-?\\d+\\.\\d+)," + // Longitude
"(\\d+\\.?\\d*)," + // Speed
"(\\d+)," + // Course
- "(\\d+\\.?\\d*)," + // Milage
+ "(\\d+\\.?\\d*)," + // Odometer
"(?:\\d+|X)," +
"(?:[01]|X)," +
"([01]+)," + // Input
@@ -99,9 +100,9 @@ public class MtxProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(Double.valueOf(parser.group(index++)));
// Other
- position.set("milage", Double.valueOf(parser.group(index++)));
- position.set("input", parser.group(index++));
- position.set("output", parser.group(index++));
+ position.set(Event.KEY_ODOMETER, Double.valueOf(parser.group(index++)));
+ position.set(Event.KEY_INPUT, parser.group(index++));
+ position.set(Event.KEY_OUTPUT, parser.group(index++));
position.set("adc1", parser.group(index++));
position.set("adc2", parser.group(index++));
diff --git a/src/org/traccar/protocol/NavigilProtocolDecoder.java b/src/org/traccar/protocol/NavigilProtocolDecoder.java
index 76859aa05..a51acf3fe 100644
--- a/src/org/traccar/protocol/NavigilProtocolDecoder.java
+++ b/src/org/traccar/protocol/NavigilProtocolDecoder.java
@@ -25,6 +25,7 @@ import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.Crc;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class NavigilProtocolDecoder extends BaseProtocolDecoder {
@@ -82,7 +83,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
position.setProtocol(getProtocol());
position.setValid(true);
- position.set("index", sequenceNumber);
+ position.set(Event.KEY_INDEX, sequenceNumber);
position.setDeviceId(getDeviceId());
buf.readUnsignedShort(); // report trigger
@@ -102,7 +103,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedInt(); // distance
buf.readUnsignedInt(); // delta distance
- position.set("battery", buf.readUnsignedShort() * 0.001);
+ position.set(Event.KEY_BATTERY, buf.readUnsignedShort() * 0.001);
buf.readUnsignedShort(); // battery charger status
@@ -117,7 +118,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
position.setProtocol(getProtocol());
position.setValid(true);
- position.set("index", sequenceNumber);
+ position.set(Event.KEY_INDEX, sequenceNumber);
position.setDeviceId(getDeviceId());
buf.readUnsignedShort(); // report trigger
@@ -143,7 +144,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedShort(); // VSAUT1 voltage
buf.readUnsignedShort(); // VSAUT2 voltage
buf.readUnsignedShort(); // solar voltage
- position.set("battery", buf.readUnsignedShort() * 0.001);
+ position.set(Event.KEY_BATTERY, buf.readUnsignedShort() * 0.001);
// TODO: a lot of other stuff
return position;
@@ -153,7 +154,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocol());
- position.set("index", sequenceNumber);
+ position.set(Event.KEY_INDEX, sequenceNumber);
position.setDeviceId(getDeviceId());
position.setTime(convertTimestamp(timestamp));
@@ -174,7 +175,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocol());
- position.set("index", sequenceNumber);
+ position.set(Event.KEY_INDEX, sequenceNumber);
position.setDeviceId(getDeviceId());
position.setTime(convertTimestamp(timestamp));
@@ -197,7 +198,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocol());
- position.set("index", sequenceNumber);
+ position.set(Event.KEY_INDEX, sequenceNumber);
position.setDeviceId(getDeviceId());
buf.readUnsignedByte(); // report trigger
@@ -226,7 +227,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte(); // supply voltage 1
buf.readUnsignedByte(); // supply voltage 2
- position.set("battery", buf.readUnsignedShort() * 0.001);
+ position.set(Event.KEY_BATTERY, buf.readUnsignedShort() * 0.001);
// TODO: a lot of other stuff
return position;
@@ -236,7 +237,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocol());
- position.set("index", sequenceNumber);
+ position.set(Event.KEY_INDEX, sequenceNumber);
position.setDeviceId(getDeviceId());
position.setTime(convertTimestamp(timestamp));
@@ -255,7 +256,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte(); // satellites in fix
- position.set("battery", buf.readUnsignedShort() * 0.001);
+ position.set(Event.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 1407a16db..8b142ce2e 100644
--- a/src/org/traccar/protocol/NavisProtocolDecoder.java
+++ b/src/org/traccar/protocol/NavisProtocolDecoder.java
@@ -28,6 +28,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class NavisProtocolDecoder extends BaseProtocolDecoder {
@@ -93,10 +94,10 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
position.set("format", format);
long index = buf.readUnsignedInt();
- position.set("index", index);
+ position.set(Event.KEY_INDEX, index);
// Event type
- position.set("event", buf.readUnsignedShort());
+ position.set(Event.KEY_EVENT, buf.readUnsignedShort());
// Event time
Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
@@ -110,36 +111,36 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
position.set("time", time.getTimeInMillis());
// Alarm status
- position.set("alarm", buf.readUnsignedByte());
+ position.set(Event.KEY_ALARM, buf.readUnsignedByte());
// Modules status
- position.set("status", buf.readUnsignedByte());
+ position.set(Event.KEY_STATUS, buf.readUnsignedByte());
// GSM signal
- position.set("gsm", buf.readUnsignedByte());
+ position.set(Event.KEY_GSM, buf.readUnsignedByte());
// Output
if (isFormat(format, F10, F20, F30)) {
- position.set("output", buf.readUnsignedShort());
+ position.set(Event.KEY_OUTPUT, buf.readUnsignedShort());
} else if (isFormat(format, F40, F50, F51, F52)) {
- position.set("output", buf.readUnsignedByte());
+ position.set(Event.KEY_OUTPUT, buf.readUnsignedByte());
}
// Input
if (isFormat(format, F10, F20, F30, F40)) {
- position.set("input", buf.readUnsignedShort());
+ position.set(Event.KEY_INPUT, buf.readUnsignedShort());
} else if (isFormat(format, F50, F51, F52)) {
- position.set("input", buf.readUnsignedByte());
+ position.set(Event.KEY_INPUT, buf.readUnsignedByte());
}
- position.set("power", buf.readUnsignedShort() / 1000.0);
+ position.set(Event.KEY_POWER, buf.readUnsignedShort() / 1000.0);
// Battery power
- position.set("battery", buf.readUnsignedShort());
+ position.set(Event.KEY_BATTERY, buf.readUnsignedShort());
// Temperature
if (isFormat(format, F10, F20, F30)) {
- position.set("temperature", buf.readShort());
+ position.set(Event.KEY_TEMPERATURE, buf.readShort());
}
if (isFormat(format, F10, F20, F50, F52)) {
@@ -174,8 +175,8 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(buf.readFloat());
position.setCourse(buf.readUnsignedShort());
- // Milage
- position.set("milage", buf.readFloat());
+ // Odometer
+ position.set(Event.KEY_ODOMETER, buf.readFloat());
// Last segment
position.set("segment", buf.readFloat());
diff --git a/src/org/traccar/protocol/NoranProtocolDecoder.java b/src/org/traccar/protocol/NoranProtocolDecoder.java
index a93f16872..e43f47999 100644
--- a/src/org/traccar/protocol/NoranProtocolDecoder.java
+++ b/src/org/traccar/protocol/NoranProtocolDecoder.java
@@ -27,6 +27,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class NoranProtocolDecoder extends BaseProtocolDecoder {
@@ -84,7 +85,7 @@ public class NoranProtocolDecoder extends BaseProtocolDecoder {
position.setValid((flags & 0x01) != 0);
// Alarm type
- position.set("alarm", buf.readUnsignedByte());
+ position.set(Event.KEY_ALARM, buf.readUnsignedByte());
// Location
position.setSpeed(buf.readUnsignedByte());
@@ -115,7 +116,7 @@ public class NoranProtocolDecoder extends BaseProtocolDecoder {
position.set("io", buf.readUnsignedByte());
// Fuel
- position.set("fuel", buf.readUnsignedByte());
+ position.set(Event.KEY_FUEL, buf.readUnsignedByte());
return position;
}
diff --git a/src/org/traccar/protocol/OrionProtocolDecoder.java b/src/org/traccar/protocol/OrionProtocolDecoder.java
index 3c533664b..0361d2234 100644
--- a/src/org/traccar/protocol/OrionProtocolDecoder.java
+++ b/src/org/traccar/protocol/OrionProtocolDecoder.java
@@ -26,6 +26,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class OrionProtocolDecoder extends BaseProtocolDecoder {
@@ -84,7 +85,7 @@ public class OrionProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(getDeviceId());
position.setProtocol(getProtocol());
- position.set("event", buf.readUnsignedByte());
+ position.set(Event.KEY_EVENT, buf.readUnsignedByte());
buf.readUnsignedByte(); // length
position.set("flag1", buf.readUnsignedByte());
position.set("flag2", buf.readUnsignedByte());
@@ -109,7 +110,7 @@ public class OrionProtocolDecoder extends BaseProtocolDecoder {
// Accuracy
int satellites = buf.readUnsignedByte();
- position.set("satellites", satellites);
+ position.set(Event.KEY_SATELLITES, satellites);
position.setValid(satellites >= 3);
positions.add(position);
}
diff --git a/src/org/traccar/protocol/OsmAndProtocolDecoder.java b/src/org/traccar/protocol/OsmAndProtocolDecoder.java
index e6b5476b1..6fb858d70 100644
--- a/src/org/traccar/protocol/OsmAndProtocolDecoder.java
+++ b/src/org/traccar/protocol/OsmAndProtocolDecoder.java
@@ -33,6 +33,7 @@ import org.jboss.netty.handler.codec.http.HttpVersion;
import org.jboss.netty.handler.codec.http.QueryStringDecoder;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class OsmAndProtocolDecoder extends BaseProtocolDecoder {
@@ -97,7 +98,7 @@ public class OsmAndProtocolDecoder extends BaseProtocolDecoder {
}
if (params.containsKey("hdop")) {
- position.set("hdop", params.get("hdop").get(0));
+ position.set(Event.KEY_HDOP, params.get("hdop").get(0));
}
if (params.containsKey("vacc")) {
@@ -109,7 +110,7 @@ public class OsmAndProtocolDecoder extends BaseProtocolDecoder {
}
if (params.containsKey("batt")) {
- position.set("battery", params.get("batt").get(0));
+ position.set(Event.KEY_BATTERY, params.get("batt").get(0));
}
if (params.containsKey("desc")) {
diff --git a/src/org/traccar/protocol/PiligrimProtocolDecoder.java b/src/org/traccar/protocol/PiligrimProtocolDecoder.java
index f4eafd833..30b81f5fb 100644
--- a/src/org/traccar/protocol/PiligrimProtocolDecoder.java
+++ b/src/org/traccar/protocol/PiligrimProtocolDecoder.java
@@ -34,6 +34,7 @@ import org.jboss.netty.handler.codec.http.HttpVersion;
import org.jboss.netty.handler.codec.http.QueryStringDecoder;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class PiligrimProtocolDecoder extends BaseProtocolDecoder {
@@ -133,7 +134,7 @@ public class PiligrimProtocolDecoder extends BaseProtocolDecoder {
// Satellites
int satellites = buf.readUnsignedByte();
- position.set("satellites", satellites);
+ position.set(Event.KEY_SATELLITES, satellites);
position.setValid(satellites >= 3);
// Speed
@@ -151,12 +152,12 @@ public class PiligrimProtocolDecoder extends BaseProtocolDecoder {
// External power
double power = buf.readUnsignedByte();
power += buf.readUnsignedByte() << 8;
- position.set("power", power / 100);
+ position.set(Event.KEY_POWER, power / 100);
// Battery
double battery = buf.readUnsignedByte();
battery += buf.readUnsignedByte() << 8;
- position.set("battery", battery / 100);
+ position.set(Event.KEY_BATTERY, battery / 100);
buf.skipBytes(6);
diff --git a/src/org/traccar/protocol/ProgressProtocolDecoder.java b/src/org/traccar/protocol/ProgressProtocolDecoder.java
index f07498d1e..a4231448f 100644
--- a/src/org/traccar/protocol/ProgressProtocolDecoder.java
+++ b/src/org/traccar/protocol/ProgressProtocolDecoder.java
@@ -28,6 +28,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class ProgressProtocolDecoder extends BaseProtocolDecoder {
@@ -122,14 +123,14 @@ public class ProgressProtocolDecoder extends BaseProtocolDecoder {
position.set("archive", true);
int subtype = buf.readUnsignedShort();
if (subtype == MSG_ALARM) {
- position.set("alarm", true);
+ position.set(Event.KEY_ALARM, true);
}
if (buf.readUnsignedShort() > buf.readableBytes()) {
lastIndex += 1;
break; // workaround for device bug
}
lastIndex = buf.readUnsignedInt();
- position.set("index", lastIndex);
+ position.set(Event.KEY_INDEX, lastIndex);
} else {
newIndex = buf.readUnsignedInt();
}
@@ -157,16 +158,16 @@ public class ProgressProtocolDecoder extends BaseProtocolDecoder {
// Satellites
int satellitesNumber = buf.readUnsignedByte();
- position.set("satellites", satellitesNumber);
+ position.set(Event.KEY_SATELLITES, satellitesNumber);
// Validity
position.setValid(satellitesNumber >= 3); // TODO: probably wrong
// Cell signal
- position.set("gsm", buf.readUnsignedByte());
+ position.set(Event.KEY_GSM, buf.readUnsignedByte());
- // Milage
- position.set("milage", buf.readUnsignedInt());
+ // Odometer
+ position.set(Event.KEY_ODOMETER, buf.readUnsignedInt());
long extraFlags = buf.readLong();
@@ -208,7 +209,7 @@ public class ProgressProtocolDecoder extends BaseProtocolDecoder {
byte[] response = {(byte)0xC9,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
channel.write(ChannelBuffers.wrappedBuffer(response));
- position.set("alarm", true);
+ position.set(Event.KEY_ALARM, true);
}
// Skip CRC
diff --git a/src/org/traccar/protocol/Pt3000ProtocolDecoder.java b/src/org/traccar/protocol/Pt3000ProtocolDecoder.java
index bef5f138d..01b7b284c 100644
--- a/src/org/traccar/protocol/Pt3000ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Pt3000ProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class Pt3000ProtocolDecoder extends BaseProtocolDecoder {
diff --git a/src/org/traccar/protocol/Pt502ProtocolDecoder.java b/src/org/traccar/protocol/Pt502ProtocolDecoder.java
index 6647f7e20..3db463cf6 100644
--- a/src/org/traccar/protocol/Pt502ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Pt502ProtocolDecoder.java
@@ -25,6 +25,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class Pt502ProtocolDecoder extends BaseProtocolDecoder {
diff --git a/src/org/traccar/protocol/RitiProtocolDecoder.java b/src/org/traccar/protocol/RitiProtocolDecoder.java
index 06aa39a71..7c53ec37f 100644
--- a/src/org/traccar/protocol/RitiProtocolDecoder.java
+++ b/src/org/traccar/protocol/RitiProtocolDecoder.java
@@ -27,6 +27,7 @@ import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.ChannelBufferTools;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class RitiProtocolDecoder extends BaseProtocolDecoder {
@@ -69,14 +70,14 @@ public class RitiProtocolDecoder extends BaseProtocolDecoder {
position.set("mode", buf.readUnsignedByte());
position.set("command", buf.readUnsignedByte());
- position.set("power", buf.readUnsignedShort());
+ position.set(Event.KEY_POWER, buf.readUnsignedShort());
buf.skipBytes(5);
buf.readUnsignedShort();
buf.readUnsignedShort();
position.set("distance", buf.readUnsignedInt());
- position.set("milage", buf.readUnsignedInt());
+ position.set(Event.KEY_ODOMETER, buf.readUnsignedInt());
// Parse GPRMC
Integer end = ChannelBufferTools.find(buf, buf.readerIndex(), buf.readerIndex() + 80, "*");
diff --git a/src/org/traccar/protocol/RuptelaProtocolDecoder.java b/src/org/traccar/protocol/RuptelaProtocolDecoder.java
index c68a7cedd..0cca3de26 100644
--- a/src/org/traccar/protocol/RuptelaProtocolDecoder.java
+++ b/src/org/traccar/protocol/RuptelaProtocolDecoder.java
@@ -25,6 +25,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class RuptelaProtocolDecoder extends BaseProtocolDecoder {
@@ -76,12 +77,12 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder {
// Validity
int satellites = buf.readUnsignedByte();
- position.set("satellites", satellites);
+ position.set(Event.KEY_SATELLITES, satellites);
position.setValid(satellites >= 3);
position.setSpeed(buf.readUnsignedShort() * 0.539957);
- position.set("hdop", buf.readUnsignedByte() / 10.0);
+ position.set(Event.KEY_HDOP, buf.readUnsignedByte() / 10.0);
buf.readUnsignedByte();
diff --git a/src/org/traccar/protocol/SanavProtocolDecoder.java b/src/org/traccar/protocol/SanavProtocolDecoder.java
index 0e84832de..91bba54c7 100644
--- a/src/org/traccar/protocol/SanavProtocolDecoder.java
+++ b/src/org/traccar/protocol/SanavProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class SanavProtocolDecoder extends BaseProtocolDecoder {
diff --git a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java
index 09eacacd3..acb4fa5ec 100644
--- a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java
+++ b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java
@@ -25,6 +25,7 @@ import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.Log;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class SkypatrolProtocolDecoder extends BaseProtocolDecoder {
@@ -80,7 +81,7 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder {
// Status code
if (checkBit(mask, 1)) {
- position.set("status", buf.readUnsignedInt());
+ position.set(Event.KEY_STATUS, buf.readUnsignedInt());
}
// Device id
@@ -171,7 +172,7 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder {
// Satellites
if (checkBit(mask, 16)) {
- position.set("satellites", buf.readUnsignedByte());
+ position.set(Event.KEY_SATELLITES, buf.readUnsignedByte());
}
// Battery percentage
@@ -179,14 +180,14 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedShort();
}
- // Trip milage
+ // Trip odometer
if (checkBit(mask, 20)) {
position.set("trip", buf.readUnsignedInt());
}
- // Milage
+ // Odometer
if (checkBit(mask, 21)) {
- position.set("milage", buf.readUnsignedInt());
+ position.set(Event.KEY_ODOMETER, buf.readUnsignedInt());
}
// Time of message generation
@@ -196,7 +197,7 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder {
// Battery level
if (checkBit(mask, 24)) {
- position.set("power", buf.readUnsignedShort() / 1000.0);
+ position.set(Event.KEY_POWER, buf.readUnsignedShort() / 1000.0);
}
// GPS overspeed
@@ -211,7 +212,7 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder {
// Sequence number
if (checkBit(mask, 28)) {
- position.set("index", buf.readUnsignedShort());
+ position.set(Event.KEY_INDEX, buf.readUnsignedShort());
}
return position;
diff --git a/src/org/traccar/protocol/Stl060ProtocolDecoder.java b/src/org/traccar/protocol/Stl060ProtocolDecoder.java
index d5ad651e7..d3db10d90 100644
--- a/src/org/traccar/protocol/Stl060ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Stl060ProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class Stl060ProtocolDecoder extends BaseProtocolDecoder {
@@ -43,7 +44,7 @@ public class Stl060ProtocolDecoder extends BaseProtocolDecoder {
"(\\d{3})(\\d{2})\\.?(\\d+)([EW])," + // Longitude
"(\\d+\\.?\\d*)," + // Speed
"(\\d+\\.?\\d*)," + // Course
- "(\\d+)," + // Milage
+ "(\\d+)," + // Odometer
"(\\d+)," + // Ignition
"(\\d+)," + // DIP1
"(\\d+)," + // DIP2
@@ -108,11 +109,11 @@ public class Stl060ProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(Double.valueOf(parser.group(index++)));
// Other
- position.set("milage", Integer.valueOf(parser.group(index++)));
+ position.set(Event.KEY_ODOMETER, Integer.valueOf(parser.group(index++)));
position.set("ignition", Integer.valueOf(parser.group(index++)));
position.set("dip1", Integer.valueOf(parser.group(index++)));
position.set("dip2", Integer.valueOf(parser.group(index++)));
- position.set("fuel", Integer.valueOf(parser.group(index++)));
+ position.set(Event.KEY_FUEL, Integer.valueOf(parser.group(index++)));
// Validity
position.setValid(parser.group(index++).compareTo("A") == 0);
diff --git a/src/org/traccar/protocol/SuntechProtocolDecoder.java b/src/org/traccar/protocol/SuntechProtocolDecoder.java
index 5ebf175d8..debdb4209 100644
--- a/src/org/traccar/protocol/SuntechProtocolDecoder.java
+++ b/src/org/traccar/protocol/SuntechProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class SuntechProtocolDecoder extends BaseProtocolDecoder {
@@ -86,7 +87,7 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
position.setTime(time.getTime());
// Cell
- position.set("cell", parser.group(index++));
+ position.set(Event.KEY_CELL, parser.group(index++));
// Coordinates
position.setLatitude(Double.valueOf(parser.group(index++)));
diff --git a/src/org/traccar/protocol/SyrusProtocolDecoder.java b/src/org/traccar/protocol/SyrusProtocolDecoder.java
index 56975d09d..8a12b5e26 100644
--- a/src/org/traccar/protocol/SyrusProtocolDecoder.java
+++ b/src/org/traccar/protocol/SyrusProtocolDecoder.java
@@ -25,6 +25,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class SyrusProtocolDecoder extends BaseProtocolDecoder {
diff --git a/src/org/traccar/protocol/T55ProtocolDecoder.java b/src/org/traccar/protocol/T55ProtocolDecoder.java
index a1a325c75..f20eb1bf7 100644
--- a/src/org/traccar/protocol/T55ProtocolDecoder.java
+++ b/src/org/traccar/protocol/T55ProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class T55ProtocolDecoder extends BaseProtocolDecoder {
@@ -310,7 +311,7 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder {
position.setAltitude(Double.valueOf(parser.group(index++)));
// Battery
- position.set("battery", parser.group(index++));
+ position.set(Event.KEY_BATTERY, parser.group(index++));
return position;
}
diff --git a/src/org/traccar/protocol/TelikProtocolDecoder.java b/src/org/traccar/protocol/TelikProtocolDecoder.java
index edbf10548..918934bce 100644
--- a/src/org/traccar/protocol/TelikProtocolDecoder.java
+++ b/src/org/traccar/protocol/TelikProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class TelikProtocolDecoder extends BaseProtocolDecoder {
@@ -99,7 +100,7 @@ public class TelikProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(Double.valueOf(parser.group(index++)));
// Satellites
- position.set("satellites", parser.group(index++));
+ position.set(Event.KEY_SATELLITES, parser.group(index++));
return position;
}
diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
index 7ca670fb3..85d1b939d 100644
--- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
+++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
@@ -26,6 +26,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
@@ -110,17 +111,17 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
if (checkBit(locationMask, 4)) {
int satellites = buf.readUnsignedByte();
- position.set("satellites", satellites);
+ position.set(Event.KEY_SATELLITES, satellites);
position.setValid(satellites >= 3);
}
if (checkBit(locationMask, 5)) {
position.set("area", buf.readUnsignedShort());
- position.set("cell", buf.readUnsignedShort());
+ position.set(Event.KEY_CELL, buf.readUnsignedShort());
}
if (checkBit(locationMask, 6)) {
- position.set("gsm", buf.readUnsignedByte());
+ position.set(Event.KEY_GSM, buf.readUnsignedByte());
}
if (checkBit(locationMask, 7)) {
@@ -139,13 +140,13 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(buf.readUnsignedShort());
int satellites = buf.readUnsignedByte();
- position.set("satellites", satellites);
+ position.set(Event.KEY_SATELLITES, satellites);
position.setValid(satellites != 0);
position.setSpeed(buf.readUnsignedShort() * 0.539957);
- position.set("event", buf.readUnsignedByte());
+ position.set(Event.KEY_EVENT, buf.readUnsignedByte());
buf.readUnsignedByte(); // total IO data records
@@ -157,7 +158,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
for (int j = 0; j < cnt; j++) {
int id = buf.readUnsignedByte();
if (id == 1) {
- position.set("power", buf.readUnsignedByte());
+ position.set(Event.KEY_POWER, buf.readUnsignedByte());
} else {
position.set("io" + id, buf.readUnsignedByte());
}
diff --git a/src/org/traccar/protocol/Tk102ProtocolDecoder.java b/src/org/traccar/protocol/Tk102ProtocolDecoder.java
index 9eef7cc91..020fb8013 100644
--- a/src/org/traccar/protocol/Tk102ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tk102ProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class Tk102ProtocolDecoder extends BaseProtocolDecoder {
diff --git a/src/org/traccar/protocol/Tk103ProtocolDecoder.java b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
index 948fd9fd5..7a3a048fe 100644
--- a/src/org/traccar/protocol/Tk103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
@@ -46,7 +47,7 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
"(\\d{2})(\\d{2})(\\d{2}),?" + // Time (HHMMSS)
"(\\d+\\.?\\d+),?" + // Course
"([0-9a-fA-F]{8})?,?" + // State
- "(?:L([0-9a-fA-F]+))?\\)?"); // Milage
+ "(?:L([0-9a-fA-F]+))?\\)?"); // Odometer
@Override
protected Object decode(
@@ -133,10 +134,10 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
// State
position.set("state", parser.group(index++));
- // Milage
- String milage = parser.group(index++);
- if (milage != null) {
- position.set("milage", Long.parseLong(milage, 16));
+ // Odometer
+ String odometer = parser.group(index++);
+ if (odometer != null) {
+ position.set(Event.KEY_ODOMETER, Long.parseLong(odometer, 16));
}
return position;
}
diff --git a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
index b70811dd5..ecc61d740 100644
--- a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
@@ -26,6 +26,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
@@ -91,7 +92,7 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
Integer index = 1;
// Cell
- position.set("cell", parser.group(index++));
+ position.set(Event.KEY_CELL, parser.group(index++));
// Time
Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
@@ -135,7 +136,7 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
position.setTime(time.getTime());
// Status
- position.set("status", status);
+ position.set(Event.KEY_STATUS, status);
positions.add(position);
}
}
diff --git a/src/org/traccar/protocol/TopflytechProtocolDecoder.java b/src/org/traccar/protocol/TopflytechProtocolDecoder.java
index b0edb0276..e62f77c20 100644
--- a/src/org/traccar/protocol/TopflytechProtocolDecoder.java
+++ b/src/org/traccar/protocol/TopflytechProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class TopflytechProtocolDecoder extends BaseProtocolDecoder {
diff --git a/src/org/traccar/protocol/TotemProtocolDecoder.java b/src/org/traccar/protocol/TotemProtocolDecoder.java
index faff9d300..fe39a6344 100644
--- a/src/org/traccar/protocol/TotemProtocolDecoder.java
+++ b/src/org/traccar/protocol/TotemProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class TotemProtocolDecoder extends BaseProtocolDecoder {
@@ -59,7 +60,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
"(?:(\\d+)\\|)?" + // ADC
"(\\p{XDigit}{8})\\|" + // Location Code
"(\\d+)\\|" + // Temperature
- "(\\d+.\\d+)\\|" + // Milage
+ "(\\d+.\\d+)\\|" + // Odometer
"\\d+\\|" + // Serial Number
".*\\|?" +
"\\p{XDigit}{4}"); // Checksum
@@ -86,7 +87,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
"(\\d+)\\|" + // ADC
"(\\p{XDigit}{8})\\|" + // Location Code
"(\\d+)\\|" + // Temperature
- "(\\d+.\\d+)\\|" + // Milage
+ "(\\d+.\\d+)\\|" + // Odometer
"\\d+\\|" + // Serial Number
"\\p{XDigit}{4}"); // Checksum
@@ -111,7 +112,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
"(\\d{3})" + // Course
"(\\d{3})" + // Speed
"(\\d{2}\\.\\d)" + // PDOP
- "(\\d{7})" + // Milage
+ "(\\d{7})" + // Odometer
"(\\d{2})(\\d{2}\\.\\d{4})" + // Latitude (DDMM.MMMM)
"([NS])" +
"(\\d{3})(\\d{2}\\.\\d{4})" + // Longitude (DDDMM.MMMM)
@@ -169,7 +170,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(getDeviceId());
// Alarm type
- position.set("alarm", parser.group(index++));
+ position.set(Event.KEY_ALARM, parser.group(index++));
if (format == MessageFormat.first || format == MessageFormat.second) {
@@ -227,26 +228,26 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
position.setTime(time.getTime());
// Accuracy
- position.set("hdop", parser.group(index++));
+ position.set(Event.KEY_HDOP, parser.group(index++));
// IO Status
position.set("io", parser.group(index++));
// Power
- position.set("battery", parser.group(index++));
- position.set("power", Double.valueOf(parser.group(index++)));
+ position.set(Event.KEY_BATTERY, parser.group(index++));
+ position.set(Event.KEY_POWER, Double.valueOf(parser.group(index++)));
// ADC
position.set("adc", parser.group(index++));
// Location Code
- position.set("lac", parser.group(index++));
+ position.set(Event.KEY_LAC, parser.group(index++));
// Temperature
- position.set("temperature", parser.group(index++));
+ position.set(Event.KEY_TEMPERATURE, parser.group(index++));
- // Milage
- position.set("milage", parser.group(index++));
+ // Odometer
+ position.set(Event.KEY_ODOMETER, parser.group(index++));
} else if (format == MessageFormat.third) {
@@ -265,8 +266,8 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
position.set("io", parser.group(index++));
// Power
- position.set("battery", Double.valueOf(parser.group(index++)) / 10);
- position.set("power", Double.valueOf(parser.group(index++)));
+ position.set(Event.KEY_BATTERY, Double.valueOf(parser.group(index++)) / 10);
+ position.set(Event.KEY_POWER, Double.valueOf(parser.group(index++)));
// ADC
position.set("adc1", parser.group(index++));
@@ -277,13 +278,13 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
position.set("temperature2", parser.group(index++));
// Location Code
- position.set("lac", parser.group(index++));
+ position.set(Event.KEY_LAC, parser.group(index++));
// Validity
position.setValid(parser.group(index++).compareTo("A") == 0);
// Satellites
- position.set("satellites", parser.group(index++));
+ position.set(Event.KEY_SATELLITES, parser.group(index++));
// Course
position.setCourse(Double.valueOf(parser.group(index++)));
@@ -294,8 +295,8 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
// PDOP
position.set("pdop", parser.group(index++));
- // Milage
- position.set("milage", parser.group(index++));
+ // Odometer
+ position.set(Event.KEY_ODOMETER, parser.group(index++));
// Latitude
Double latitude = Double.valueOf(parser.group(index++));
diff --git a/src/org/traccar/protocol/Tr20ProtocolDecoder.java b/src/org/traccar/protocol/Tr20ProtocolDecoder.java
index cbf1f34c0..cd0bde746 100644
--- a/src/org/traccar/protocol/Tr20ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tr20ProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class Tr20ProtocolDecoder extends BaseProtocolDecoder {
diff --git a/src/org/traccar/protocol/Tr900ProtocolDecoder.java b/src/org/traccar/protocol/Tr900ProtocolDecoder.java
index b118161e2..67783049d 100644
--- a/src/org/traccar/protocol/Tr900ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tr900ProtocolDecoder.java
@@ -18,6 +18,7 @@ package org.traccar.protocol;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
import java.util.Calendar;
@@ -112,12 +113,12 @@ public class Tr900ProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(Double.valueOf(parser.group(index++)));
// Other
- position.set("gsm", parser.group(index++));
- position.set("event", Integer.valueOf(parser.group(index++)));
+ position.set(Event.KEY_GSM, parser.group(index++));
+ position.set(Event.KEY_EVENT, Integer.valueOf(parser.group(index++)));
position.set("adc1", Integer.valueOf(parser.group(index++)));
- position.set("battery", Integer.valueOf(parser.group(index++)));
- position.set("input", parser.group(index++));
- position.set("status", parser.group(index++));
+ position.set(Event.KEY_BATTERY, Integer.valueOf(parser.group(index++)));
+ position.set(Event.KEY_INPUT, parser.group(index++));
+ position.set(Event.KEY_STATUS, parser.group(index++));
return position;
}
diff --git a/src/org/traccar/protocol/TrackboxProtocolDecoder.java b/src/org/traccar/protocol/TrackboxProtocolDecoder.java
index f53d0a2ed..2bcde0602 100644
--- a/src/org/traccar/protocol/TrackboxProtocolDecoder.java
+++ b/src/org/traccar/protocol/TrackboxProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class TrackboxProtocolDecoder extends BaseProtocolDecoder {
@@ -101,7 +102,7 @@ public class TrackboxProtocolDecoder extends BaseProtocolDecoder {
position.setLongitude(longitude);
// HDOP
- position.set("hdop", parser.group(index++));
+ position.set(Event.KEY_HDOP, parser.group(index++));
// Altitude
position.setAltitude(Double.valueOf(parser.group(index++)));
@@ -125,7 +126,7 @@ public class TrackboxProtocolDecoder extends BaseProtocolDecoder {
position.setTime(time.getTime());
// Satellites
- position.set("satellites", parser.group(index++));
+ position.set(Event.KEY_SATELLITES, parser.group(index++));
return position;
}
diff --git a/src/org/traccar/protocol/TramigoProtocolDecoder.java b/src/org/traccar/protocol/TramigoProtocolDecoder.java
index c36ee91b1..b578efb4a 100644
--- a/src/org/traccar/protocol/TramigoProtocolDecoder.java
+++ b/src/org/traccar/protocol/TramigoProtocolDecoder.java
@@ -20,6 +20,7 @@ import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
import java.nio.charset.Charset;
@@ -60,7 +61,7 @@ public class TramigoProtocolDecoder extends BaseProtocolDecoder {
// Create new position
Position position = new Position();
position.setProtocol(getProtocol());
- position.set("index", index);
+ position.set(Event.KEY_INDEX, index);
position.setValid(true);
// Get device id
@@ -89,7 +90,7 @@ public class TramigoProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedInt(); // distance
- position.set("battery", buf.readUnsignedShort());
+ position.set(Event.KEY_BATTERY, buf.readUnsignedShort());
buf.readUnsignedShort(); // battery charger status
diff --git a/src/org/traccar/protocol/TytanProtocolDecoder.java b/src/org/traccar/protocol/TytanProtocolDecoder.java
index 56b8f5622..6b08c3762 100644
--- a/src/org/traccar/protocol/TytanProtocolDecoder.java
+++ b/src/org/traccar/protocol/TytanProtocolDecoder.java
@@ -27,6 +27,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.ChannelBufferTools;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class TytanProtocolDecoder extends BaseProtocolDecoder {
@@ -69,8 +70,8 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder {
position.setTime(new Date(buf.readUnsignedInt() * 1000));
int flags = buf.readUnsignedByte();
- position.set("gps", flags >> 5);
- position.set("gsm", flags & 0x07);
+ position.set(Event.KEY_GPS, flags >> 5);
+ position.set(Event.KEY_GSM, flags & 0x07);
position.setValid(((flags & 0x08) != 0) ^ ((flags & 0x10) != 0));
// Latitude
@@ -97,20 +98,20 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder {
while (buf.readerIndex() < end) {
switch (buf.readUnsignedByte()) {
case 2:
- position.set("milage", buf.readUnsignedMedium());
+ position.set(Event.KEY_ODOMETER, buf.readUnsignedMedium());
break;
case 4:
buf.readUnsignedShort(); // device start
break;
case 5:
- position.set("input", buf.readUnsignedByte());
+ position.set(Event.KEY_INPUT, buf.readUnsignedByte());
break;
case 6:
buf.readUnsignedShort();
position.set("adc", buf.readFloat());
break;
case 7:
- position.set("alarm", buf.readUnsignedShort());
+ position.set(Event.KEY_ALARM, buf.readUnsignedShort());
break;
case 8:
position.set("antihijack", buf.readUnsignedByte());
@@ -123,7 +124,7 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder {
break;
case 24:
buf.readUnsignedByte();
- position.set("temperature", buf.readUnsignedByte());
+ position.set(Event.KEY_TEMPERATURE, buf.readUnsignedByte());
break;
case 25:
buf.readUnsignedByte();
@@ -161,7 +162,7 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedInt(); // diagnostic
break;
case 90:
- position.set("power", buf.readFloat());
+ position.set(Event.KEY_POWER, buf.readFloat());
break;
case 99:
buf.readUnsignedInt(); // tachograph
@@ -182,7 +183,7 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte(); // engine load
break;
case 107:
- position.set("fuel", buf.readUnsignedShort() & 0x3fff);
+ position.set(Event.KEY_FUEL, buf.readUnsignedShort() & 0x3fff);
break;
case 108:
buf.readUnsignedInt(); // total distance
diff --git a/src/org/traccar/protocol/UlbotechProtocolDecoder.java b/src/org/traccar/protocol/UlbotechProtocolDecoder.java
index 04b39d078..af61b0b6e 100644
--- a/src/org/traccar/protocol/UlbotechProtocolDecoder.java
+++ b/src/org/traccar/protocol/UlbotechProtocolDecoder.java
@@ -20,6 +20,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.ChannelBufferTools;
+import org.traccar.model.Event;
import org.traccar.model.Position;
import java.util.Date;
@@ -33,7 +34,7 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder {
private static final short DATA_GPS = 0x01;
private static final short DATA_LBS = 0x02;
private static final short DATA_STATUS = 0x03;
- private static final short DATA_MILAGE = 0x04;
+ private static final short DATA_ODOMETER = 0x04;
private static final short DATA_ADC = 0x05;
private static final short DATA_GEOFENCE = 0x06;
private static final short DATA_OBD2 = 0x07;
@@ -85,7 +86,7 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder {
position.setLongitude(buf.readInt() / 1000000.0);
position.setSpeed(buf.readUnsignedShort() * 0.539957);
position.setCourse(buf.readUnsignedShort());
- position.set("hdop", buf.readUnsignedShort());
+ position.set(Event.KEY_HDOP, buf.readUnsignedShort());
break;
default:
diff --git a/src/org/traccar/protocol/V680ProtocolDecoder.java b/src/org/traccar/protocol/V680ProtocolDecoder.java
index a6b5e1bc1..1558c7d8e 100644
--- a/src/org/traccar/protocol/V680ProtocolDecoder.java
+++ b/src/org/traccar/protocol/V680ProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class V680ProtocolDecoder extends BaseProtocolDecoder {
@@ -96,13 +97,13 @@ public class V680ProtocolDecoder extends BaseProtocolDecoder {
position.set("password", parser.group(index++));
// Event
- position.set("event", parser.group(index++));
+ position.set(Event.KEY_EVENT, parser.group(index++));
// Packet number
position.set("packet", parser.group(index++));
// GSM base station
- position.set("gsm", parser.group(index++));
+ position.set(Event.KEY_GSM, parser.group(index++));
// Longitude
String lon = parser.group(index++);
diff --git a/src/org/traccar/protocol/VisiontekProtocolDecoder.java b/src/org/traccar/protocol/VisiontekProtocolDecoder.java
index 2c3dad570..b9ac60f27 100644
--- a/src/org/traccar/protocol/VisiontekProtocolDecoder.java
+++ b/src/org/traccar/protocol/VisiontekProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class VisiontekProtocolDecoder extends BaseProtocolDecoder {
@@ -44,7 +45,7 @@ public class VisiontekProtocolDecoder extends BaseProtocolDecoder {
"(\\d+)," + // Course
"(?:(\\d+)," + // Altitude
"(\\d+),)?" + // Satellites
- "(\\d+)," + // Milage
+ "(\\d+)," + // Odometer
"(?:(\\d)," + // Ignition
"(\\d)," + // Input 1
"(\\d)," + // Input 2
@@ -118,14 +119,14 @@ public class VisiontekProtocolDecoder extends BaseProtocolDecoder {
}
// Additional data
- position.set("satellites", parser.group(index++));
- position.set("milage", parser.group(index++));
+ position.set(Event.KEY_SATELLITES, parser.group(index++));
+ position.set(Event.KEY_ODOMETER, parser.group(index++));
position.set("ignition", parser.group(index++));
position.set("input1", parser.group(index++));
position.set("input2", parser.group(index++));
position.set("immobilizer", parser.group(index++));
- position.set("power", parser.group(index++));
- position.set("gsm", parser.group(index++));
+ position.set(Event.KEY_POWER, parser.group(index++));
+ position.set(Event.KEY_GSM, parser.group(index++));
// Validity
position.setValid(parser.group(index++).compareTo("A") == 0);
diff --git a/src/org/traccar/protocol/WialonProtocolDecoder.java b/src/org/traccar/protocol/WialonProtocolDecoder.java
index 6f0223112..3dc282846 100644
--- a/src/org/traccar/protocol/WialonProtocolDecoder.java
+++ b/src/org/traccar/protocol/WialonProtocolDecoder.java
@@ -26,6 +26,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class WialonProtocolDecoder extends BaseProtocolDecoder {
@@ -125,13 +126,13 @@ public class WialonProtocolDecoder extends BaseProtocolDecoder {
String satellites = parser.group(index++);
if (satellites != null) {
position.setValid(Integer.valueOf(satellites) >= 3);
- position.set("satellites", satellites);
+ position.set(Event.KEY_SATELLITES, satellites);
} else {
position.setValid(false);
}
// Other
- position.set("hdop", parser.group(index++));
+ position.set(Event.KEY_HDOP, parser.group(index++));
position.set("inputs", parser.group(index++));
position.set("outputs", parser.group(index++));
diff --git a/src/org/traccar/protocol/WondexProtocolDecoder.java b/src/org/traccar/protocol/WondexProtocolDecoder.java
index cf4a3fedd..1eb727fc6 100644
--- a/src/org/traccar/protocol/WondexProtocolDecoder.java
+++ b/src/org/traccar/protocol/WondexProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class WondexProtocolDecoder extends BaseProtocolDecoder {
@@ -45,7 +46,7 @@ public class WondexProtocolDecoder extends BaseProtocolDecoder {
"(\\d+)," + // Satellites
"(\\d+),?" + // Event
"(?:(\\d+\\.\\d+)V,)?" + // Battery
- "(\\d+\\.\\d+)?,?" + // Milage
+ "(\\d+\\.\\d+)?,?" + // Odometer
"(\\d+)?,?" + // Input
"(\\d+\\.\\d+)?,?" + // ADC1
"(\\d+\\.\\d+)?,?" + // ADC2
@@ -94,26 +95,26 @@ public class WondexProtocolDecoder extends BaseProtocolDecoder {
// Satellites
int satellites = Integer.valueOf(parser.group(index++));
position.setValid(satellites >= 3);
- position.set("satellites", satellites);
+ position.set(Event.KEY_SATELLITES, satellites);
// Event
- position.set("event", parser.group(index++));
+ position.set(Event.KEY_EVENT, parser.group(index++));
// Battery
- position.set("battery", parser.group(index++));
+ position.set(Event.KEY_BATTERY, parser.group(index++));
- // Milage
- position.set("milage", parser.group(index++));
+ // Odometer
+ position.set(Event.KEY_ODOMETER, parser.group(index++));
// Input
- position.set("input", parser.group(index++));
+ position.set(Event.KEY_INPUT, parser.group(index++));
// ADC
position.set("adc1", parser.group(index++));
position.set("adc2", parser.group(index++));
// Output
- position.set("output", parser.group(index++));
+ position.set(Event.KEY_OUTPUT, parser.group(index++));
return position;
}
diff --git a/src/org/traccar/protocol/Xexun2ProtocolDecoder.java b/src/org/traccar/protocol/Xexun2ProtocolDecoder.java
index 420dfc8d0..8b654bef3 100644
--- a/src/org/traccar/protocol/Xexun2ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Xexun2ProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class Xexun2ProtocolDecoder extends BaseProtocolDecoder {
@@ -123,7 +124,7 @@ public class Xexun2ProtocolDecoder extends BaseProtocolDecoder {
position.set("signal", parser.group(index++));
// Alarm
- position.set("alarm", parser.group(index++));
+ position.set(Event.KEY_ALARM, parser.group(index++));
// Get device by IMEI
if (!identify(parser.group(index++))) {
@@ -132,7 +133,7 @@ public class Xexun2ProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(getDeviceId());
// Satellites
- position.set("satellites", parser.group(index++).replaceFirst ("^0*(?![\\.$])", ""));
+ position.set(Event.KEY_SATELLITES, parser.group(index++).replaceFirst ("^0*(?![\\.$])", ""));
// Altitude
String altitude = parser.group(index++);
@@ -141,7 +142,7 @@ public class Xexun2ProtocolDecoder extends BaseProtocolDecoder {
}
// Power
- position.set("power", Double.valueOf(parser.group(index++)));
+ position.set(Event.KEY_POWER, Double.valueOf(parser.group(index++)));
return position;
}
diff --git a/src/org/traccar/protocol/XexunProtocolDecoder.java b/src/org/traccar/protocol/XexunProtocolDecoder.java
index d54e6fb20..231d7a969 100644
--- a/src/org/traccar/protocol/XexunProtocolDecoder.java
+++ b/src/org/traccar/protocol/XexunProtocolDecoder.java
@@ -25,6 +25,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class XexunProtocolDecoder extends BaseProtocolDecoder {
diff --git a/src/org/traccar/protocol/XirgoProtocolDecoder.java b/src/org/traccar/protocol/XirgoProtocolDecoder.java
index 813a7a995..74b1bd077 100644
--- a/src/org/traccar/protocol/XirgoProtocolDecoder.java
+++ b/src/org/traccar/protocol/XirgoProtocolDecoder.java
@@ -25,6 +25,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class XirgoProtocolDecoder extends BaseProtocolDecoder {
@@ -48,7 +49,7 @@ public class XirgoProtocolDecoder extends BaseProtocolDecoder {
"(\\d+)," + // HDOP
"(\\d+\\.\\d+)," + // Battery
"(\\d+)," + // GSM
- "(\\d+\\.?\\d*)," + // Milage
+ "(\\d+\\.?\\d*)," + // Odometer
"(\\d+)," + // GPS
".*");
@@ -77,7 +78,7 @@ public class XirgoProtocolDecoder extends BaseProtocolDecoder {
}
position.setDeviceId(getDeviceId());
- position.set("event", parser.group(index++));
+ position.set(Event.KEY_EVENT, parser.group(index++));
// Date
Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
@@ -98,11 +99,11 @@ public class XirgoProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(Double.valueOf(parser.group(index++)));
// Additional data
- position.set("satellites", parser.group(index++));
- position.set("hdop", parser.group(index++));
- position.set("battery", parser.group(index++));
- position.set("gsm", parser.group(index++));
- position.set("milage", parser.group(index++));
+ position.set(Event.KEY_SATELLITES, parser.group(index++));
+ position.set(Event.KEY_HDOP, parser.group(index++));
+ position.set(Event.KEY_BATTERY, parser.group(index++));
+ position.set(Event.KEY_GSM, parser.group(index++));
+ position.set(Event.KEY_ODOMETER, parser.group(index++));
// Validity
position.setValid(Integer.valueOf(parser.group(index++)) == 1);
diff --git a/src/org/traccar/protocol/Xt013ProtocolDecoder.java b/src/org/traccar/protocol/Xt013ProtocolDecoder.java
index c1e1c3e65..62deed0ea 100644
--- a/src/org/traccar/protocol/Xt013ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Xt013ProtocolDecoder.java
@@ -18,6 +18,7 @@ package org.traccar.protocol;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
import java.text.ParseException;
@@ -99,9 +100,9 @@ public class Xt013ProtocolDecoder extends BaseProtocolDecoder {
position.setValid(parser.group(index++).equals("F"));
// Other
- position.set("gps", parser.group(index++));
- position.set("gsm", parser.group(index++));
- position.set("battery", parser.group(index++));
+ position.set(Event.KEY_GPS, parser.group(index++));
+ position.set(Event.KEY_GSM, parser.group(index++));
+ position.set(Event.KEY_BATTERY, parser.group(index++));
position.set("charging", parser.group(index++));
return position;
}
diff --git a/src/org/traccar/protocol/Xt7ProtocolDecoder.java b/src/org/traccar/protocol/Xt7ProtocolDecoder.java
index 564cbaf67..fab55c0c2 100644
--- a/src/org/traccar/protocol/Xt7ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Xt7ProtocolDecoder.java
@@ -26,6 +26,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class Xt7ProtocolDecoder extends BaseProtocolDecoder {
@@ -129,13 +130,13 @@ public class Xt7ProtocolDecoder extends BaseProtocolDecoder {
position.set("imsi", parser.group(index++));
// Cell
- position.set("cell", parser.group(index++));
+ position.set(Event.KEY_CELL, parser.group(index++));
// GSM signal quality
- position.set("gsm", parser.group(index++));
+ position.set(Event.KEY_GSM, parser.group(index++));
// Battery
- position.set("power", Double.valueOf(parser.group(index++)));
+ position.set(Event.KEY_POWER, Double.valueOf(parser.group(index++)));
// Flags
position.set("flags", parser.group(index++));
@@ -144,10 +145,10 @@ public class Xt7ProtocolDecoder extends BaseProtocolDecoder {
position.set("sensors", parser.group(index++));
// Fuel
- position.set("fuel", parser.group(index++));
+ position.set(Event.KEY_FUEL, parser.group(index++));
// Alarm
- position.set("alarm", parser.group(index++));
+ position.set(Event.KEY_ALARM, parser.group(index++));
return position;
}
diff --git a/src/org/traccar/protocol/YwtProtocolDecoder.java b/src/org/traccar/protocol/YwtProtocolDecoder.java
index 833ec4771..e216d61fc 100644
--- a/src/org/traccar/protocol/YwtProtocolDecoder.java
+++ b/src/org/traccar/protocol/YwtProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class YwtProtocolDecoder extends BaseProtocolDecoder {
@@ -128,13 +129,13 @@ public class YwtProtocolDecoder extends BaseProtocolDecoder {
// Satellites
int satellites = Integer.valueOf(parser.group(index++));
position.setValid(satellites >= 3);
- position.set("satellites", satellites);
+ position.set(Event.KEY_SATELLITES, satellites);
// Report identifier
String reportId = parser.group(index++);
// Status
- position.set("status", parser.group(index++));
+ position.set(Event.KEY_STATUS, parser.group(index++));
// Send response
if (type.equals("KP") || type.equals("EP") || type.equals("EP")) {