diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-05-04 11:27:23 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-05-04 11:27:23 +1200 |
commit | 57aec3786c265baac375720e5c5389035f12591b (patch) | |
tree | 18f4afc99aad4b5af2b6c2526cbde635e8cddb18 /src | |
parent | 93feb8a5484fd6c4c3da2032d4c843b3194b5ff7 (diff) | |
download | traccar-server-57aec3786c265baac375720e5c5389035f12591b.tar.gz traccar-server-57aec3786c265baac375720e5c5389035f12591b.tar.bz2 traccar-server-57aec3786c265baac375720e5c5389035f12591b.zip |
More other data cleanup
Diffstat (limited to 'src')
19 files changed, 33 insertions, 30 deletions
diff --git a/src/org/traccar/model/Event.java b/src/org/traccar/model/Event.java index 76ac67a11..1829b2cc4 100644 --- a/src/org/traccar/model/Event.java +++ b/src/org/traccar/model/Event.java @@ -69,6 +69,11 @@ public abstract class Event { public static final String KEY_LAC = "lac"; public static final String KEY_CELL = "cell"; public static final String KEY_FUEL = "fuel"; + public static final String KEY_RFID = "rfid"; + public static final String KEY_VERSION = "version"; + public static final String KEY_TYPE = "type"; + public static final String KEY_IGNITION = "ignition"; + public static final String KEY_FLAGS = "flags"; // Starts with 1 not 0 public static final String PREFIX_TEMP = "temp"; diff --git a/src/org/traccar/protocol/AtrackProtocolDecoder.java b/src/org/traccar/protocol/AtrackProtocolDecoder.java index b9cc60de4..d057e67c0 100644 --- a/src/org/traccar/protocol/AtrackProtocolDecoder.java +++ b/src/org/traccar/protocol/AtrackProtocolDecoder.java @@ -119,7 +119,7 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder { position.setCourse(buf.readUnsignedShort()); // Report type - position.set("type", buf.readUnsignedByte()); + position.set(Event.KEY_TYPE, buf.readUnsignedByte()); // Odometer position.set(Event.KEY_ODOMETER, buf.readUnsignedInt() * 0.1); diff --git a/src/org/traccar/protocol/CarscopProtocolDecoder.java b/src/org/traccar/protocol/CarscopProtocolDecoder.java index 6270a2804..5f7ba6374 100644 --- a/src/org/traccar/protocol/CarscopProtocolDecoder.java +++ b/src/org/traccar/protocol/CarscopProtocolDecoder.java @@ -111,7 +111,7 @@ public class CarscopProtocolDecoder extends BaseProtocolDecoder { position.setCourse(Double.valueOf(parser.group(index++))); // State - position.set("state", parser.group(index++)); + position.set(Event.KEY_STATUS, parser.group(index++)); // Odometer position.set(Event.KEY_ODOMETER, Integer.valueOf(parser.group(index++))); diff --git a/src/org/traccar/protocol/HaicomProtocolDecoder.java b/src/org/traccar/protocol/HaicomProtocolDecoder.java index 303f96793..fc144e934 100644 --- a/src/org/traccar/protocol/HaicomProtocolDecoder.java +++ b/src/org/traccar/protocol/HaicomProtocolDecoder.java @@ -78,7 +78,7 @@ public class HaicomProtocolDecoder extends BaseProtocolDecoder { position.setDeviceId(getDeviceId()); // Firmware version - position.set("version", parser.group(index++)); + position.set(Event.KEY_VERSION, parser.group(index++)); // Date Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); @@ -115,7 +115,7 @@ public class HaicomProtocolDecoder extends BaseProtocolDecoder { // Additional data position.set(Event.KEY_STATUS, parser.group(index++)); - position.set("gprs", parser.group(index++)); + position.set(Event.KEY_GSM, parser.group(index++)); position.set(Event.KEY_GPS, parser.group(index++)); position.set(Event.KEY_INPUT, parser.group(index++)); position.set(Event.KEY_OUTPUT, parser.group(index++)); diff --git a/src/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/org/traccar/protocol/Jt600ProtocolDecoder.java index 52b84296d..5c3dcef46 100644 --- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java +++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.java @@ -153,7 +153,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); position.setProtocol(getProtocol()); - position.set("alert", "true"); + position.set(Event.KEY_ALARM, true); Integer index = 1; // Get device by identifier diff --git a/src/org/traccar/protocol/MegastekProtocolDecoder.java b/src/org/traccar/protocol/MegastekProtocolDecoder.java index 054573c33..74ff67be7 100644 --- a/src/org/traccar/protocol/MegastekProtocolDecoder.java +++ b/src/org/traccar/protocol/MegastekProtocolDecoder.java @@ -244,7 +244,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder { // Battery position.set(Event.KEY_BATTERY, Double.valueOf(parser.group(index++))); - position.set("flags", parser.group(index++)); + position.set(Event.KEY_FLAGS, parser.group(index++)); position.set(Event.KEY_INPUT, parser.group(index++)); position.set(Event.KEY_OUTPUT, parser.group(index++)); position.set(Event.PREFIX_ADC + 1, parser.group(index++)); diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java index 6b40ba912..54cae7ed0 100644 --- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java +++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java @@ -249,7 +249,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder { // State String state = parser.group(index++); if (state != null) { - position.set("state", state); + position.set(Event.KEY_STATUS, state); } // ADC diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java index f9dfcd1f2..8bfd21145 100644 --- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java +++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java @@ -137,7 +137,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { position.set(Event.KEY_ODOMETER, parser.group(index++)); position.set("runtime", parser.group(index++)); position.set(Event.KEY_CELL, parser.group(index++)); - position.set("state", parser.group(index++)); + position.set(Event.KEY_STATUS, parser.group(index++)); // ADC String adc1 = parser.group(index++); @@ -160,7 +160,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { if (data != null && !data.isEmpty()) { switch (event) { case 37: - position.set("rfid", data); + position.set(Event.KEY_RFID, data); break; } } @@ -232,7 +232,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { position.set(Event.KEY_CELL, buf.readUnsignedShort() + "|" + buf.readUnsignedShort() + "|" + buf.readUnsignedShort() + "|" + buf.readUnsignedShort()); - position.set("state", buf.readUnsignedShort()); + position.set(Event.KEY_STATUS, buf.readUnsignedShort()); // ADC position.set(Event.PREFIX_ADC + 1, buf.readUnsignedShort()); diff --git a/src/org/traccar/protocol/MiniFinderProtocolDecoder.java b/src/org/traccar/protocol/MiniFinderProtocolDecoder.java index 036650657..27442875a 100644 --- a/src/org/traccar/protocol/MiniFinderProtocolDecoder.java +++ b/src/org/traccar/protocol/MiniFinderProtocolDecoder.java @@ -95,7 +95,7 @@ public class MiniFinderProtocolDecoder extends BaseProtocolDecoder { // Flags String flags = parser.group(index++); - position.set("flags", flags); + position.set(Event.KEY_FLAGS, flags); position.setValid((Integer.parseInt(flags, 16) & 0x01) != 0); // Altitude diff --git a/src/org/traccar/protocol/Mta6ProtocolDecoder.java b/src/org/traccar/protocol/Mta6ProtocolDecoder.java index 3d977706f..7d4ead62c 100644 --- a/src/org/traccar/protocol/Mta6ProtocolDecoder.java +++ b/src/org/traccar/protocol/Mta6ProtocolDecoder.java @@ -167,8 +167,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder { } if (checkBit(flags, 4)) { - position.set(Event.KEY_FUEL, buf.readUnsignedInt()); - position.set("fuel2", buf.readUnsignedInt()); + position.set(Event.KEY_FUEL, buf.readUnsignedInt() + "|" + buf.readUnsignedInt()); position.set("hours1", buf.readUnsignedShort()); position.set("hours2", buf.readUnsignedShort()); } @@ -183,7 +182,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder { if (checkBit(flags, 6)) { position.set(Event.PREFIX_TEMP + 1, buf.readByte()); buf.getUnsignedByte(buf.readerIndex()); // control (>> 4) - position.set("sensor", buf.readUnsignedShort() & 0x0fff); + position.set(Event.KEY_INPUT, buf.readUnsignedShort() & 0x0fff); buf.readUnsignedShort(); // old sensor state (& 0x0fff) } @@ -261,7 +260,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder { if (checkBit(flags, 4)) { position.set(Event.PREFIX_TEMP + 1, buf.readByte()); buf.getUnsignedByte(buf.readerIndex()); // control (>> 4) - position.set("sensor", buf.readUnsignedShort() & 0x0fff); + position.set(Event.KEY_INPUT, buf.readUnsignedShort() & 0x0fff); buf.readUnsignedShort(); // old sensor state (& 0x0fff) } diff --git a/src/org/traccar/protocol/OrionProtocolDecoder.java b/src/org/traccar/protocol/OrionProtocolDecoder.java index 0361d2234..7265a9762 100644 --- a/src/org/traccar/protocol/OrionProtocolDecoder.java +++ b/src/org/traccar/protocol/OrionProtocolDecoder.java @@ -87,9 +87,8 @@ public class OrionProtocolDecoder extends BaseProtocolDecoder { position.set(Event.KEY_EVENT, buf.readUnsignedByte()); buf.readUnsignedByte(); // length - position.set("flag1", buf.readUnsignedByte()); - position.set("flag2", buf.readUnsignedByte()); - + position.set(Event.KEY_FLAGS, buf.readUnsignedShort()); + // Location position.setLatitude(convertCoordinate(buf.readInt())); position.setLongitude(convertCoordinate(buf.readInt())); diff --git a/src/org/traccar/protocol/Stl060ProtocolDecoder.java b/src/org/traccar/protocol/Stl060ProtocolDecoder.java index d3db10d90..19930fa2e 100644 --- a/src/org/traccar/protocol/Stl060ProtocolDecoder.java +++ b/src/org/traccar/protocol/Stl060ProtocolDecoder.java @@ -110,7 +110,7 @@ public class Stl060ProtocolDecoder extends BaseProtocolDecoder { // Other position.set(Event.KEY_ODOMETER, Integer.valueOf(parser.group(index++))); - position.set("ignition", Integer.valueOf(parser.group(index++))); + position.set(Event.KEY_IGNITION, Integer.valueOf(parser.group(index++))); position.set("dip1", Integer.valueOf(parser.group(index++))); position.set("dip2", Integer.valueOf(parser.group(index++))); position.set(Event.KEY_FUEL, Integer.valueOf(parser.group(index++))); diff --git a/src/org/traccar/protocol/SuntechProtocolDecoder.java b/src/org/traccar/protocol/SuntechProtocolDecoder.java index debdb4209..dc1f2f274 100644 --- a/src/org/traccar/protocol/SuntechProtocolDecoder.java +++ b/src/org/traccar/protocol/SuntechProtocolDecoder.java @@ -73,7 +73,7 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { position.setDeviceId(getDeviceId()); // Version - position.set("version", parser.group(index++)); + position.set(Event.KEY_VERSION, parser.group(index++)); // Date and Time Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); diff --git a/src/org/traccar/protocol/TelikProtocolDecoder.java b/src/org/traccar/protocol/TelikProtocolDecoder.java index 918934bce..c1e5c9370 100644 --- a/src/org/traccar/protocol/TelikProtocolDecoder.java +++ b/src/org/traccar/protocol/TelikProtocolDecoder.java @@ -73,7 +73,7 @@ public class TelikProtocolDecoder extends BaseProtocolDecoder { position.setDeviceId(getDeviceId()); // Message type - position.set("type", parser.group(index++)); + position.set(Event.KEY_TYPE, parser.group(index++)); // Time Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); diff --git a/src/org/traccar/protocol/Tk103ProtocolDecoder.java b/src/org/traccar/protocol/Tk103ProtocolDecoder.java index 7a3a048fe..81481ced8 100644 --- a/src/org/traccar/protocol/Tk103ProtocolDecoder.java +++ b/src/org/traccar/protocol/Tk103ProtocolDecoder.java @@ -132,7 +132,7 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder { position.setCourse(Double.valueOf(parser.group(index++))); // State - position.set("state", parser.group(index++)); + position.set(Event.KEY_STATUS, parser.group(index++)); // Odometer String odometer = parser.group(index++); diff --git a/src/org/traccar/protocol/TrackboxProtocolDecoder.java b/src/org/traccar/protocol/TrackboxProtocolDecoder.java index 2bcde0602..3404486aa 100644 --- a/src/org/traccar/protocol/TrackboxProtocolDecoder.java +++ b/src/org/traccar/protocol/TrackboxProtocolDecoder.java @@ -109,7 +109,7 @@ public class TrackboxProtocolDecoder extends BaseProtocolDecoder { // Validity int fix = Integer.valueOf(parser.group(index++)); - position.set("fix", fix); + position.set(Event.KEY_GPS, fix); position.setValid(fix > 0); // Course diff --git a/src/org/traccar/protocol/VisiontekProtocolDecoder.java b/src/org/traccar/protocol/VisiontekProtocolDecoder.java index b9ac60f27..aeabed039 100644 --- a/src/org/traccar/protocol/VisiontekProtocolDecoder.java +++ b/src/org/traccar/protocol/VisiontekProtocolDecoder.java @@ -121,9 +121,9 @@ public class VisiontekProtocolDecoder extends BaseProtocolDecoder { // Additional data 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(Event.KEY_IGNITION, parser.group(index++)); + position.set(Event.PREFIX_IO + 1, parser.group(index++)); + position.set(Event.PREFIX_IO + 2, parser.group(index++)); position.set("immobilizer", parser.group(index++)); position.set(Event.KEY_POWER, parser.group(index++)); position.set(Event.KEY_GSM, parser.group(index++)); @@ -132,7 +132,7 @@ public class VisiontekProtocolDecoder extends BaseProtocolDecoder { position.setValid(parser.group(index++).compareTo("A") == 0); // RFID - position.set("rfid", parser.group(index++)); + position.set(Event.KEY_RFID, parser.group(index++)); return position; } diff --git a/src/org/traccar/protocol/WialonProtocolDecoder.java b/src/org/traccar/protocol/WialonProtocolDecoder.java index 0bd793365..5638c2dbe 100644 --- a/src/org/traccar/protocol/WialonProtocolDecoder.java +++ b/src/org/traccar/protocol/WialonProtocolDecoder.java @@ -146,7 +146,7 @@ public class WialonProtocolDecoder extends BaseProtocolDecoder { } // iButton - position.set("ibutton", parser.group(index++)); + position.set(Event.KEY_RFID, parser.group(index++)); // Params String params = parser.group(index); diff --git a/src/org/traccar/protocol/Xt7ProtocolDecoder.java b/src/org/traccar/protocol/Xt7ProtocolDecoder.java index fab55c0c2..69e72aa70 100644 --- a/src/org/traccar/protocol/Xt7ProtocolDecoder.java +++ b/src/org/traccar/protocol/Xt7ProtocolDecoder.java @@ -139,10 +139,10 @@ public class Xt7ProtocolDecoder extends BaseProtocolDecoder { position.set(Event.KEY_POWER, Double.valueOf(parser.group(index++))); // Flags - position.set("flags", parser.group(index++)); + position.set(Event.KEY_FLAGS, parser.group(index++)); // Sensors - position.set("sensors", parser.group(index++)); + position.set(Event.KEY_INPUT, parser.group(index++)); // Fuel position.set(Event.KEY_FUEL, parser.group(index++)); |