From 93feb8a5484fd6c4c3da2032d4c843b3194b5ff7 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 4 May 2015 11:10:55 +1200 Subject: Create prefixes for other data --- src/org/traccar/model/Event.java | 7 ++++++- src/org/traccar/protocol/ApelProtocolDecoder.java | 8 ++++---- .../traccar/protocol/AplicomProtocolDecoder.java | 10 +++++----- .../traccar/protocol/Ardi01ProtocolDecoder.java | 2 +- .../traccar/protocol/AtrackProtocolDecoder.java | 6 +++--- .../traccar/protocol/AutoFon45ProtocolDecoder.java | 2 +- .../traccar/protocol/AutoFonProtocolDecoder.java | 2 +- src/org/traccar/protocol/BceProtocolDecoder.java | 2 +- .../traccar/protocol/CarTrackProtocolDecoder.java | 2 +- .../traccar/protocol/Gps103ProtocolDecoder.java | 8 ++++---- .../protocol/IntellitracProtocolDecoder.java | 10 ++++------ .../traccar/protocol/MegastekProtocolDecoder.java | 6 +++--- .../traccar/protocol/MeiligaoProtocolDecoder.java | 2 +- .../traccar/protocol/MeitrackProtocolDecoder.java | 8 ++++---- src/org/traccar/protocol/Mta6ProtocolDecoder.java | 22 +++++++++++----------- src/org/traccar/protocol/MtxProtocolDecoder.java | 4 ++-- src/org/traccar/protocol/NavisProtocolDecoder.java | 6 +++--- src/org/traccar/protocol/NoranProtocolDecoder.java | 2 +- .../traccar/protocol/ProgressProtocolDecoder.java | 3 +-- .../traccar/protocol/RuptelaProtocolDecoder.java | 8 ++++---- .../traccar/protocol/TeltonikaProtocolDecoder.java | 8 ++++---- src/org/traccar/protocol/TotemProtocolDecoder.java | 16 ++++++++-------- src/org/traccar/protocol/Tr900ProtocolDecoder.java | 2 +- src/org/traccar/protocol/TytanProtocolDecoder.java | 4 ++-- .../traccar/protocol/WialonProtocolDecoder.java | 6 +++--- .../traccar/protocol/WondexProtocolDecoder.java | 4 ++-- 26 files changed, 81 insertions(+), 79 deletions(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/model/Event.java b/src/org/traccar/model/Event.java index 5523174b4..76ac67a11 100644 --- a/src/org/traccar/model/Event.java +++ b/src/org/traccar/model/Event.java @@ -64,11 +64,16 @@ public abstract class Event { 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"; + // Starts with 1 not 0 + public static final String PREFIX_TEMP = "temp"; + public static final String PREFIX_ADC = "adc"; + public static final String PREFIX_IO = "io"; + public static final String PREFIX_COUNT = "count"; + } diff --git a/src/org/traccar/protocol/ApelProtocolDecoder.java b/src/org/traccar/protocol/ApelProtocolDecoder.java index b814f60e3..6b4e43dbd 100644 --- a/src/org/traccar/protocol/ApelProtocolDecoder.java +++ b/src/org/traccar/protocol/ApelProtocolDecoder.java @@ -227,13 +227,13 @@ public class ApelProtocolDecoder extends BaseProtocolDecoder { // Analog sensors for (int i = 1; i <= 8; i++) { - position.set("adc" + i, buf.readUnsignedShort()); + position.set(Event.PREFIX_ADC + i, buf.readUnsignedShort()); } // Counters - position.set("c0", buf.readUnsignedInt()); - position.set("c1", buf.readUnsignedInt()); - position.set("c2", buf.readUnsignedInt()); + position.set(Event.PREFIX_COUNT + 1, buf.readUnsignedInt()); + position.set(Event.PREFIX_COUNT + 2, buf.readUnsignedInt()); + position.set(Event.PREFIX_COUNT + 3, buf.readUnsignedInt()); } positions.add(position); diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java index 7170731f5..824c2af26 100644 --- a/src/org/traccar/protocol/AplicomProtocolDecoder.java +++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java @@ -176,10 +176,10 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { // ADC if ((selector & 0x0020) != 0) { - position.set("adc1", buf.readUnsignedShort()); - position.set("adc2", buf.readUnsignedShort()); - position.set("adc3", buf.readUnsignedShort()); - position.set("adc4", buf.readUnsignedShort()); + position.set(Event.PREFIX_ADC + 1, buf.readUnsignedShort()); + position.set(Event.PREFIX_ADC + 2, buf.readUnsignedShort()); + position.set(Event.PREFIX_ADC + 3, buf.readUnsignedShort()); + position.set(Event.PREFIX_ADC + 4, buf.readUnsignedShort()); } // Power @@ -311,7 +311,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { position.set("air-temperature", ChannelBuffers.swapShort(value.readShort()) * 0.1); break; case 0x30D: - position.set("alarms", ChannelBufferTools.readHexString(value, 16)); + position.set(Event.KEY_ALARM, ChannelBufferTools.readHexString(value, 16)); break; case 0x40D: position.set("cold-unit-status", ChannelBufferTools.readHexString(value, 16)); diff --git a/src/org/traccar/protocol/Ardi01ProtocolDecoder.java b/src/org/traccar/protocol/Ardi01ProtocolDecoder.java index 6797eb01e..fdd160bdd 100644 --- a/src/org/traccar/protocol/Ardi01ProtocolDecoder.java +++ b/src/org/traccar/protocol/Ardi01ProtocolDecoder.java @@ -100,7 +100,7 @@ public class Ardi01ProtocolDecoder extends BaseProtocolDecoder { position.set(Event.KEY_BATTERY, parser.group(index++)); // Output - position.set(Event.KEY_TEMPERATURE, parser.group(index++)); + position.set(Event.PREFIX_TEMP + 1, parser.group(index++)); return position; } diff --git a/src/org/traccar/protocol/AtrackProtocolDecoder.java b/src/org/traccar/protocol/AtrackProtocolDecoder.java index 5ccd8ed30..b9cc60de4 100644 --- a/src/org/traccar/protocol/AtrackProtocolDecoder.java +++ b/src/org/traccar/protocol/AtrackProtocolDecoder.java @@ -137,14 +137,14 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder { position.set(Event.KEY_OUTPUT, buf.readUnsignedByte()); // ADC - position.set("adc", buf.readUnsignedShort() * 0.001); + position.set(Event.PREFIX_ADC + 1, buf.readUnsignedShort() * 0.001); // Driver position.set("driver", readString(buf)); // Temperature - position.set("temperature1", buf.readShort() * 0.1); - position.set("temperature2", buf.readShort() * 0.1); + position.set(Event.PREFIX_TEMP + 1, buf.readShort() * 0.1); + position.set(Event.PREFIX_TEMP + 2, buf.readShort() * 0.1); // Text Message position.set("message", readString(buf)); diff --git a/src/org/traccar/protocol/AutoFon45ProtocolDecoder.java b/src/org/traccar/protocol/AutoFon45ProtocolDecoder.java index 1a2ebdf4a..55b4ad9dc 100644 --- a/src/org/traccar/protocol/AutoFon45ProtocolDecoder.java +++ b/src/org/traccar/protocol/AutoFon45ProtocolDecoder.java @@ -76,7 +76,7 @@ public class AutoFon45ProtocolDecoder extends BaseProtocolDecoder { buf.skipBytes(2); // remaining time - position.set(Event.KEY_TEMPERATURE, buf.readByte()); + position.set(Event.PREFIX_TEMP + 1, buf.readByte()); buf.skipBytes(2); // timer (interval and units) buf.readByte(); // mode diff --git a/src/org/traccar/protocol/AutoFonProtocolDecoder.java b/src/org/traccar/protocol/AutoFonProtocolDecoder.java index 856b19bc8..04cd4da72 100644 --- a/src/org/traccar/protocol/AutoFonProtocolDecoder.java +++ b/src/org/traccar/protocol/AutoFonProtocolDecoder.java @@ -69,7 +69,7 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder { } } - position.set(Event.KEY_TEMPERATURE, buf.readByte()); + position.set(Event.PREFIX_TEMP + 1, buf.readByte()); position.set(Event.KEY_GSM, buf.readUnsignedByte()); buf.readUnsignedShort(); // mcc buf.readUnsignedShort(); // mnc diff --git a/src/org/traccar/protocol/BceProtocolDecoder.java b/src/org/traccar/protocol/BceProtocolDecoder.java index 5baafd9dd..8f338b8c9 100644 --- a/src/org/traccar/protocol/BceProtocolDecoder.java +++ b/src/org/traccar/protocol/BceProtocolDecoder.java @@ -113,7 +113,7 @@ public class BceProtocolDecoder extends BaseProtocolDecoder { for (int i = 1; i <= 8; i++) { if (checkBit(mask, i + 1)) { - position.set("adc" + i, buf.readUnsignedShort()); + position.set(Event.PREFIX_ADC + i, buf.readUnsignedShort()); } } diff --git a/src/org/traccar/protocol/CarTrackProtocolDecoder.java b/src/org/traccar/protocol/CarTrackProtocolDecoder.java index 06f1e5342..223023a31 100644 --- a/src/org/traccar/protocol/CarTrackProtocolDecoder.java +++ b/src/org/traccar/protocol/CarTrackProtocolDecoder.java @@ -124,7 +124,7 @@ public class CarTrackProtocolDecoder extends BaseProtocolDecoder { position.setTime(time.getTime()); // State - position.set("io", parser.group(index++)); + position.set(Event.PREFIX_IO + 1, parser.group(index++)); // Odometer String odometer = parser.group(index++); diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java index f842441a5..f6b763d15 100644 --- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java @@ -190,10 +190,10 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder { } // Additional data - position.set("io1", parser.group(index++)); - position.set("io2", parser.group(index++)); - position.set("io3", parser.group(index++)); - position.set("io4", parser.group(index++)); + position.set(Event.PREFIX_IO + 1, parser.group(index++)); + position.set(Event.PREFIX_IO + 2, parser.group(index++)); + position.set(Event.PREFIX_IO + 3, parser.group(index++)); + position.set(Event.PREFIX_IO + 4, parser.group(index++)); return position; } diff --git a/src/org/traccar/protocol/IntellitracProtocolDecoder.java b/src/org/traccar/protocol/IntellitracProtocolDecoder.java index e1fe91d49..469701b24 100644 --- a/src/org/traccar/protocol/IntellitracProtocolDecoder.java +++ b/src/org/traccar/protocol/IntellitracProtocolDecoder.java @@ -117,11 +117,9 @@ public class IntellitracProtocolDecoder extends BaseProtocolDecoder { // Output position.set(Event.KEY_OUTPUT, parser.group(index++)); - // ADC1 - position.set("adc1", parser.group(index++)); - - // ADC2 - position.set("adc2", parser.group(index++)); + // ADC + position.set(Event.PREFIX_ADC + 1, parser.group(index++)); + position.set(Event.PREFIX_ADC + 2, parser.group(index++)); // J1939 data position.set("vss", parser.group(index++)); @@ -129,7 +127,7 @@ public class IntellitracProtocolDecoder extends BaseProtocolDecoder { position.set("coolant", parser.group(index++)); position.set(Event.KEY_FUEL, parser.group(index++)); position.set("consumption", parser.group(index++)); - position.set(Event.KEY_TEMPERATURE, parser.group(index++)); + position.set(Event.PREFIX_TEMP + 1, parser.group(index++)); position.set("charger", parser.group(index++)); position.set("tpl", parser.group(index++)); position.set("axle", parser.group(index++)); diff --git a/src/org/traccar/protocol/MegastekProtocolDecoder.java b/src/org/traccar/protocol/MegastekProtocolDecoder.java index 84bd33be8..054573c33 100644 --- a/src/org/traccar/protocol/MegastekProtocolDecoder.java +++ b/src/org/traccar/protocol/MegastekProtocolDecoder.java @@ -247,9 +247,9 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder { position.set("flags", 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(Event.PREFIX_ADC + 1, parser.group(index++)); + position.set(Event.PREFIX_ADC + 2, parser.group(index++)); + position.set(Event.PREFIX_ADC + 3, parser.group(index++)); position.set(Event.KEY_ALARM, parser.group(index++)); } diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java index c58538445..6b40ba912 100644 --- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java +++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java @@ -256,7 +256,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder { for (int i = 1; i <= 8; i++) { String adc = parser.group(index++); if (adc != null) { - position.set("adc" + i, Integer.parseInt(adc, 16)); + position.set(Event.PREFIX_ADC + i, Integer.parseInt(adc, 16)); } } diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java index 8828bfd23..f9dfcd1f2 100644 --- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java +++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java @@ -142,15 +142,15 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { // ADC String adc1 = parser.group(index++); if (adc1 != null) { - position.set("adc1", Integer.parseInt(adc1, 16)); + position.set(Event.PREFIX_ADC + 1, Integer.parseInt(adc1, 16)); } String adc2 = parser.group(index++); if (adc2 != null) { - position.set("adc2", Integer.parseInt(adc2, 16)); + position.set(Event.PREFIX_ADC + 2, Integer.parseInt(adc2, 16)); } String adc3 = parser.group(index++); if (adc3 != null) { - position.set("adc3", Integer.parseInt(adc3, 16)); + position.set(Event.PREFIX_ADC + 3, Integer.parseInt(adc3, 16)); } position.set(Event.KEY_BATTERY, Integer.parseInt(parser.group(index++), 16)); position.set(Event.KEY_POWER, Integer.parseInt(parser.group(index++), 16)); @@ -235,7 +235,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { position.set("state", buf.readUnsignedShort()); // ADC - position.set("adc1", buf.readUnsignedShort()); + position.set(Event.PREFIX_ADC + 1, buf.readUnsignedShort()); position.set(Event.KEY_BATTERY, buf.readUnsignedShort() * 0.01); position.set(Event.KEY_POWER, buf.readUnsignedShort()); diff --git a/src/org/traccar/protocol/Mta6ProtocolDecoder.java b/src/org/traccar/protocol/Mta6ProtocolDecoder.java index c5bf2827b..3d977706f 100644 --- a/src/org/traccar/protocol/Mta6ProtocolDecoder.java +++ b/src/org/traccar/protocol/Mta6ProtocolDecoder.java @@ -167,21 +167,21 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder { } if (checkBit(flags, 4)) { - position.set("fuel1", buf.readUnsignedInt()); + position.set(Event.KEY_FUEL, buf.readUnsignedInt()); position.set("fuel2", buf.readUnsignedInt()); position.set("hours1", buf.readUnsignedShort()); position.set("hours2", buf.readUnsignedShort()); } if (checkBit(flags, 5)) { - position.set("adc1", buf.readUnsignedShort() & 0x03ff); - position.set("adc2", buf.readUnsignedShort() & 0x03ff); - position.set("adc3", buf.readUnsignedShort() & 0x03ff); - position.set("adc4", buf.readUnsignedShort() & 0x03ff); + position.set(Event.PREFIX_ADC + 1, buf.readUnsignedShort() & 0x03ff); + position.set(Event.PREFIX_ADC + 2, buf.readUnsignedShort() & 0x03ff); + position.set(Event.PREFIX_ADC + 3, buf.readUnsignedShort() & 0x03ff); + position.set(Event.PREFIX_ADC + 4, buf.readUnsignedShort() & 0x03ff); } if (checkBit(flags, 6)) { - position.set(Event.KEY_TEMPERATURE, buf.readByte()); + position.set(Event.PREFIX_TEMP + 1, buf.readByte()); buf.getUnsignedByte(buf.readerIndex()); // control (>> 4) position.set("sensor", buf.readUnsignedShort() & 0x0fff); buf.readUnsignedShort(); // old sensor state (& 0x0fff) @@ -247,19 +247,19 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder { if (checkBit(flags, 2)) { position.set("engine", buf.readUnsignedShort() * 0.125); position.set("pedals", buf.readUnsignedByte()); - position.set(Event.KEY_TEMPERATURE, buf.readUnsignedByte() - 40); + position.set(Event.PREFIX_TEMP + 1, buf.readUnsignedByte() - 40); buf.readUnsignedShort(); // service odometer } if (checkBit(flags, 3)) { position.set(Event.KEY_FUEL, buf.readUnsignedShort()); - position.set("adc2", buf.readUnsignedShort()); - position.set("adc3", buf.readUnsignedShort()); - position.set("adc4", buf.readUnsignedShort()); + position.set(Event.PREFIX_ADC + 2, buf.readUnsignedShort()); + position.set(Event.PREFIX_ADC + 3, buf.readUnsignedShort()); + position.set(Event.PREFIX_ADC + 4, buf.readUnsignedShort()); } if (checkBit(flags, 4)) { - position.set(Event.KEY_TEMPERATURE, buf.readByte()); + position.set(Event.PREFIX_TEMP + 1, buf.readByte()); buf.getUnsignedByte(buf.readerIndex()); // control (>> 4) position.set("sensor", buf.readUnsignedShort() & 0x0fff); buf.readUnsignedShort(); // old sensor state (& 0x0fff) diff --git a/src/org/traccar/protocol/MtxProtocolDecoder.java b/src/org/traccar/protocol/MtxProtocolDecoder.java index 1d32e83f6..0151e9a8c 100644 --- a/src/org/traccar/protocol/MtxProtocolDecoder.java +++ b/src/org/traccar/protocol/MtxProtocolDecoder.java @@ -103,8 +103,8 @@ public class MtxProtocolDecoder extends BaseProtocolDecoder { 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++)); + position.set(Event.PREFIX_ADC + 1, parser.group(index++)); + position.set(Event.PREFIX_ADC + 2, parser.group(index++)); return position; } diff --git a/src/org/traccar/protocol/NavisProtocolDecoder.java b/src/org/traccar/protocol/NavisProtocolDecoder.java index 8b142ce2e..125559aab 100644 --- a/src/org/traccar/protocol/NavisProtocolDecoder.java +++ b/src/org/traccar/protocol/NavisProtocolDecoder.java @@ -140,12 +140,12 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder { // Temperature if (isFormat(format, F10, F20, F30)) { - position.set(Event.KEY_TEMPERATURE, buf.readShort()); + position.set(Event.PREFIX_TEMP + 1, buf.readShort()); } if (isFormat(format, F10, F20, F50, F52)) { - position.set("adc1", buf.readUnsignedShort()); - position.set("adc2", buf.readUnsignedShort()); + position.set(Event.PREFIX_ADC + 1, buf.readUnsignedShort()); + position.set(Event.PREFIX_ADC + 2, buf.readUnsignedShort()); } if (isFormat(format, F20, F50, F51, F52)) { diff --git a/src/org/traccar/protocol/NoranProtocolDecoder.java b/src/org/traccar/protocol/NoranProtocolDecoder.java index e43f47999..ff35a287a 100644 --- a/src/org/traccar/protocol/NoranProtocolDecoder.java +++ b/src/org/traccar/protocol/NoranProtocolDecoder.java @@ -113,7 +113,7 @@ public class NoranProtocolDecoder extends BaseProtocolDecoder { position.setDeviceId(getDeviceId()); // IO status - position.set("io", buf.readUnsignedByte()); + position.set(Event.PREFIX_IO + 1, buf.readUnsignedByte()); // Fuel position.set(Event.KEY_FUEL, buf.readUnsignedByte()); diff --git a/src/org/traccar/protocol/ProgressProtocolDecoder.java b/src/org/traccar/protocol/ProgressProtocolDecoder.java index a4231448f..f2bf41398 100644 --- a/src/org/traccar/protocol/ProgressProtocolDecoder.java +++ b/src/org/traccar/protocol/ProgressProtocolDecoder.java @@ -175,9 +175,8 @@ public class ProgressProtocolDecoder extends BaseProtocolDecoder { if ((extraFlags & 0x1) == 0x1) { int count = buf.readUnsignedShort(); for (int i = 1; i <= count; i++) { - position.set("adc" + i, buf.readUnsignedShort()); + position.set(Event.PREFIX_ADC + i, buf.readUnsignedShort()); } - } // CAN adapter diff --git a/src/org/traccar/protocol/RuptelaProtocolDecoder.java b/src/org/traccar/protocol/RuptelaProtocolDecoder.java index 0cca3de26..d14fc6d15 100644 --- a/src/org/traccar/protocol/RuptelaProtocolDecoder.java +++ b/src/org/traccar/protocol/RuptelaProtocolDecoder.java @@ -89,25 +89,25 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder { // Read 1 byte data int cnt = buf.readUnsignedByte(); for (int j = 0; j < cnt; j++) { - position.set("io" + buf.readUnsignedByte(), buf.readUnsignedByte()); + position.set(Event.PREFIX_IO + buf.readUnsignedByte(), buf.readUnsignedByte()); } // Read 2 byte data cnt = buf.readUnsignedByte(); for (int j = 0; j < cnt; j++) { - position.set("io" + buf.readUnsignedByte(), buf.readUnsignedShort()); + position.set(Event.PREFIX_IO + buf.readUnsignedByte(), buf.readUnsignedShort()); } // Read 4 byte data cnt = buf.readUnsignedByte(); for (int j = 0; j < cnt; j++) { - position.set("io" + buf.readUnsignedByte(), buf.readUnsignedInt()); + position.set(Event.PREFIX_IO + buf.readUnsignedByte(), buf.readUnsignedInt()); } // Read 8 byte data cnt = buf.readUnsignedByte(); for (int j = 0; j < cnt; j++) { - position.set("io" + buf.readUnsignedByte(), buf.readLong()); + position.set(Event.PREFIX_IO + buf.readUnsignedByte(), buf.readLong()); } positions.add(position); } diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java index 85d1b939d..d2f77549c 100644 --- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java +++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java @@ -160,7 +160,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { if (id == 1) { position.set(Event.KEY_POWER, buf.readUnsignedByte()); } else { - position.set("io" + id, buf.readUnsignedByte()); + position.set(Event.PREFIX_IO + id, buf.readUnsignedByte()); } } } @@ -170,7 +170,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { if (checkBit(globalMask, 2)) { int cnt = buf.readUnsignedByte(); for (int j = 0; j < cnt; j++) { - position.set("io" + buf.readUnsignedByte(), buf.readUnsignedShort()); + position.set(Event.PREFIX_IO + buf.readUnsignedByte(), buf.readUnsignedShort()); } } @@ -178,7 +178,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { if (checkBit(globalMask, 3)) { int cnt = buf.readUnsignedByte(); for (int j = 0; j < cnt; j++) { - position.set("io" + buf.readUnsignedByte(), buf.readUnsignedInt()); + position.set(Event.PREFIX_IO + buf.readUnsignedByte(), buf.readUnsignedInt()); } } @@ -186,7 +186,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { if (codec == CODEC_FM4X00) { int cnt = buf.readUnsignedByte(); for (int j = 0; j < cnt; j++) { - position.set("io" + buf.readUnsignedByte(), buf.readLong()); + position.set(Event.PREFIX_IO + buf.readUnsignedByte(), buf.readLong()); } } positions.add(position); diff --git a/src/org/traccar/protocol/TotemProtocolDecoder.java b/src/org/traccar/protocol/TotemProtocolDecoder.java index fe39a6344..cf4eaf9af 100644 --- a/src/org/traccar/protocol/TotemProtocolDecoder.java +++ b/src/org/traccar/protocol/TotemProtocolDecoder.java @@ -231,20 +231,20 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { position.set(Event.KEY_HDOP, parser.group(index++)); // IO Status - position.set("io", parser.group(index++)); + position.set(Event.PREFIX_IO + 1, parser.group(index++)); // Power 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++)); + position.set(Event.PREFIX_ADC + 1, parser.group(index++)); // Location Code position.set(Event.KEY_LAC, parser.group(index++)); // Temperature - position.set(Event.KEY_TEMPERATURE, parser.group(index++)); + position.set(Event.PREFIX_TEMP + 1, parser.group(index++)); // Odometer position.set(Event.KEY_ODOMETER, parser.group(index++)); @@ -263,19 +263,19 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { position.setTime(time.getTime()); // IO Status - position.set("io", parser.group(index++)); + position.set(Event.PREFIX_IO + 1, parser.group(index++)); // Power 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++)); - position.set("adc2", parser.group(index++)); + position.set(Event.PREFIX_ADC + 1, parser.group(index++)); + position.set(Event.PREFIX_ADC + 2, parser.group(index++)); // Temperature - position.set("temperature1", parser.group(index++)); - position.set("temperature2", parser.group(index++)); + position.set(Event.PREFIX_TEMP + 1, parser.group(index++)); + position.set(Event.PREFIX_TEMP + 2, parser.group(index++)); // Location Code position.set(Event.KEY_LAC, parser.group(index++)); diff --git a/src/org/traccar/protocol/Tr900ProtocolDecoder.java b/src/org/traccar/protocol/Tr900ProtocolDecoder.java index 67783049d..8839f230b 100644 --- a/src/org/traccar/protocol/Tr900ProtocolDecoder.java +++ b/src/org/traccar/protocol/Tr900ProtocolDecoder.java @@ -115,7 +115,7 @@ public class Tr900ProtocolDecoder extends BaseProtocolDecoder { // Other 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(Event.PREFIX_ADC + 1, Integer.valueOf(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++)); diff --git a/src/org/traccar/protocol/TytanProtocolDecoder.java b/src/org/traccar/protocol/TytanProtocolDecoder.java index 6b08c3762..390f0b596 100644 --- a/src/org/traccar/protocol/TytanProtocolDecoder.java +++ b/src/org/traccar/protocol/TytanProtocolDecoder.java @@ -108,7 +108,7 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder { break; case 6: buf.readUnsignedShort(); - position.set("adc", buf.readFloat()); + position.set(Event.PREFIX_ADC + 1, buf.readFloat()); break; case 7: position.set(Event.KEY_ALARM, buf.readUnsignedShort()); @@ -124,7 +124,7 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder { break; case 24: buf.readUnsignedByte(); - position.set(Event.KEY_TEMPERATURE, buf.readUnsignedByte()); + position.set(Event.PREFIX_TEMP + 1, buf.readUnsignedByte()); break; case 25: buf.readUnsignedByte(); diff --git a/src/org/traccar/protocol/WialonProtocolDecoder.java b/src/org/traccar/protocol/WialonProtocolDecoder.java index 3dc282846..0bd793365 100644 --- a/src/org/traccar/protocol/WialonProtocolDecoder.java +++ b/src/org/traccar/protocol/WialonProtocolDecoder.java @@ -133,15 +133,15 @@ public class WialonProtocolDecoder extends BaseProtocolDecoder { // Other position.set(Event.KEY_HDOP, parser.group(index++)); - position.set("inputs", parser.group(index++)); - position.set("outputs", parser.group(index++)); + position.set(Event.KEY_INPUT, parser.group(index++)); + position.set(Event.KEY_OUTPUT, parser.group(index++)); // ADC String adc = parser.group(index++); if (adc != null) { String[] values = adc.split(","); for (int i = 0; i < values.length; i++) { - position.set("adc" + (i + 1), values[i]); + position.set(Event.PREFIX_ADC + (i + 1), values[i]); } } diff --git a/src/org/traccar/protocol/WondexProtocolDecoder.java b/src/org/traccar/protocol/WondexProtocolDecoder.java index 1eb727fc6..556e1b2ad 100644 --- a/src/org/traccar/protocol/WondexProtocolDecoder.java +++ b/src/org/traccar/protocol/WondexProtocolDecoder.java @@ -110,8 +110,8 @@ public class WondexProtocolDecoder extends BaseProtocolDecoder { position.set(Event.KEY_INPUT, parser.group(index++)); // ADC - position.set("adc1", parser.group(index++)); - position.set("adc2", parser.group(index++)); + position.set(Event.PREFIX_ADC + 1, parser.group(index++)); + position.set(Event.PREFIX_ADC + 2, parser.group(index++)); // Output position.set(Event.KEY_OUTPUT, parser.group(index++)); -- cgit v1.2.3