From 44a6a0ac96d4925eb0c29bcbcd1807d9176dfa04 Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Sat, 25 Feb 2017 19:17:00 -0500 Subject: Fixed typo; --- src/org/traccar/protocol/MeiligaoProtocolDecoder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java index 9f05bfa6b..de739d0a4 100644 --- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java +++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java @@ -295,7 +295,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder { position.set("engineLoad", parser.nextDouble()); position.set(Position.PREFIX_TEMP + 1, parser.nextInt()); position.set(Position.KEY_FUEL_CONSUMPTION, parser.nextDouble()); - position.set("averageFuelConsumition", parser.nextDouble()); + position.set("averageFuelConsumption", parser.nextDouble()); position.set("drivingRange", parser.nextDouble()); position.set(Position.KEY_ODOMETER, parser.nextDouble()); position.set("singleFuelConsumption", parser.nextDouble()); -- cgit v1.2.3 From 96ad8262428107025ff3f5cde165cc53117acca4 Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Sat, 25 Feb 2017 20:50:12 -0500 Subject: Updated protocols to record additional information as reported in comments and confirmed in available documentation; --- src/org/traccar/protocol/AdmProtocolDecoder.java | 4 ++-- .../traccar/protocol/AplicomProtocolDecoder.java | 6 ++--- .../traccar/protocol/ArknavX8ProtocolDecoder.java | 2 +- src/org/traccar/protocol/AstraProtocolDecoder.java | 4 ++-- .../traccar/protocol/AtrackProtocolDecoder.java | 8 +++---- .../traccar/protocol/AutoFonProtocolDecoder.java | 2 +- .../traccar/protocol/CarcellProtocolDecoder.java | 8 +++---- .../traccar/protocol/CastelProtocolDecoder.java | 10 ++++---- .../protocol/CellocatorProtocolDecoder.java | 22 ++++++++--------- .../traccar/protocol/EelinkProtocolDecoder.java | 2 +- .../traccar/protocol/FifotrackProtocolDecoder.java | 2 +- src/org/traccar/protocol/IdplProtocolDecoder.java | 6 ++--- src/org/traccar/protocol/Jt600ProtocolDecoder.java | 3 +++ src/org/traccar/protocol/Mta6ProtocolDecoder.java | 8 +++---- src/org/traccar/protocol/MxtProtocolDecoder.java | 2 +- .../traccar/protocol/NavigilProtocolDecoder.java | 28 ++++++++++++---------- .../traccar/protocol/PricolProtocolDecoder.java | 14 +++++------ .../traccar/protocol/RaveonProtocolDecoder.java | 2 +- .../traccar/protocol/SkypatrolProtocolDecoder.java | 10 ++++---- .../traccar/protocol/SmokeyProtocolDecoder.java | 4 ++-- .../traccar/protocol/TrakMateProtocolDecoder.java | 12 +++++----- .../traccar/protocol/TramigoProtocolDecoder.java | 10 ++++---- src/org/traccar/protocol/TzoneProtocolDecoder.java | 9 ++++--- .../traccar/protocol/UlbotechProtocolDecoder.java | 2 +- 24 files changed, 96 insertions(+), 84 deletions(-) (limited to 'src') diff --git a/src/org/traccar/protocol/AdmProtocolDecoder.java b/src/org/traccar/protocol/AdmProtocolDecoder.java index 72a6e5bce..a69743222 100644 --- a/src/org/traccar/protocol/AdmProtocolDecoder.java +++ b/src/org/traccar/protocol/AdmProtocolDecoder.java @@ -66,7 +66,7 @@ public class AdmProtocolDecoder extends BaseProtocolDecoder { position.setProtocol(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); - buf.readUnsignedByte(); // firmware version + position.set(Position.KEY_VERSION_FW, buf.readUnsignedByte()); // firmware version buf.readUnsignedShort(); // index position.set(Position.KEY_STATUS, buf.readUnsignedShort()); @@ -77,7 +77,7 @@ public class AdmProtocolDecoder extends BaseProtocolDecoder { position.setCourse(buf.readUnsignedShort() * 0.1); position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShort() * 0.1)); - buf.readUnsignedByte(); // acceleration + position.set(Position.KEY_ACCELERATION, buf.readUnsignedByte()); // acceleration position.setAltitude(buf.readUnsignedShort()); diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java index fbd868b86..33e882cee 100644 --- a/src/org/traccar/protocol/AplicomProtocolDecoder.java +++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java @@ -120,7 +120,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { private void decodeCanData(ChannelBuffer buf, Position position) { buf.readUnsignedMedium(); // packet identifier - buf.readUnsignedByte(); // version + position.set(Position.KEY_VERSION_FW, buf.readUnsignedByte()); // version int count = buf.readUnsignedByte(); buf.readUnsignedByte(); // batch count buf.readUnsignedShort(); // selector bit @@ -218,7 +218,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { if ((selector & 0x0010) != 0) { position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedByte())); - buf.readUnsignedByte(); // maximum speed + position.set("maximumSpeed", buf.readUnsignedByte()); // maximum speed position.setCourse(buf.readUnsignedByte() * 2.0); } @@ -436,7 +436,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { return; } - buf.readUnsignedByte(); // version + position.set(Position.KEY_VERSION_FW, buf.readUnsignedByte()); // version buf.readUnsignedShort(); // event buf.readUnsignedByte(); // data validity buf.readUnsignedByte(); // towed diff --git a/src/org/traccar/protocol/ArknavX8ProtocolDecoder.java b/src/org/traccar/protocol/ArknavX8ProtocolDecoder.java index 214ccfae2..33d204de1 100644 --- a/src/org/traccar/protocol/ArknavX8ProtocolDecoder.java +++ b/src/org/traccar/protocol/ArknavX8ProtocolDecoder.java @@ -70,7 +70,7 @@ public class ArknavX8ProtocolDecoder extends BaseProtocolDecoder { position.setProtocol(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); - parser.next(); // type + position.set(Position.KEY_TYPE, parser.next()); // type DateBuilder dateBuilder = new DateBuilder() .setDate(parser.nextInt(), parser.nextInt(), parser.nextInt()) diff --git a/src/org/traccar/protocol/AstraProtocolDecoder.java b/src/org/traccar/protocol/AstraProtocolDecoder.java index 71f2080bb..215ef6650 100644 --- a/src/org/traccar/protocol/AstraProtocolDecoder.java +++ b/src/org/traccar/protocol/AstraProtocolDecoder.java @@ -93,7 +93,7 @@ public class AstraProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedByte(); // max journey speed buf.skipBytes(6); // accelerometer - buf.readUnsignedShort(); // journey distance + position.set(Position.KEY_TRIP_ODOMETER, buf.readUnsignedShort()); // journey distance buf.readUnsignedShort(); // journey idle time position.setAltitude(buf.readUnsignedByte() * 20); @@ -109,7 +109,7 @@ public class AstraProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_RFID, buf.readBytes(7).toString(StandardCharsets.US_ASCII)); position.set(Position.KEY_ODOMETER, buf.readUnsignedMedium() * 1000); - buf.readUnsignedShort(); // engine time + position.set(Position.KEY_HOURS, buf.readUnsignedShort()); // engine time } diff --git a/src/org/traccar/protocol/AtrackProtocolDecoder.java b/src/org/traccar/protocol/AtrackProtocolDecoder.java index c4b9d512e..e395f376d 100644 --- a/src/org/traccar/protocol/AtrackProtocolDecoder.java +++ b/src/org/traccar/protocol/AtrackProtocolDecoder.java @@ -113,7 +113,7 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedByte(); // rxlev break; case "PC": - buf.readUnsignedInt(); // pulse count + position.set(Position.PREFIX_COUNT + 1, buf.readUnsignedInt()); // pulse count break; case "AT": position.setAltitude(buf.readUnsignedInt()); @@ -122,7 +122,7 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_RPM, buf.readUnsignedShort()); break; case "GS": - buf.readUnsignedByte(); // gsm status + position.set(Position.KEY_RSSI, buf.readUnsignedByte()); // gsm status break; case "DT": position.set(Position.KEY_ARCHIVE, buf.readUnsignedByte() == 1); @@ -140,7 +140,7 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_THROTTLE, buf.readUnsignedByte()); break; case "ET": - buf.readUnsignedShort(); // engine coolant temp + position.set(Position.PREFIX_TEMP + 1, buf.readUnsignedShort()); // engine coolant temp break; case "FL": position.set(Position.KEY_FUEL, buf.readUnsignedByte()); @@ -149,7 +149,7 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedByte(); // mil status break; case "FC": - buf.readUnsignedInt(); // fuel used + position.set(Position.KEY_FUEL_CONSUMPTION, buf.readUnsignedInt()); // fuel used break; case "CI": readString(buf); // format string diff --git a/src/org/traccar/protocol/AutoFonProtocolDecoder.java b/src/org/traccar/protocol/AutoFonProtocolDecoder.java index 1087c8c43..9a62a353e 100644 --- a/src/org/traccar/protocol/AutoFonProtocolDecoder.java +++ b/src/org/traccar/protocol/AutoFonProtocolDecoder.java @@ -70,7 +70,7 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedByte(); // interval buf.skipBytes(8); // settings } - buf.readUnsignedByte(); // status + position.set(Position.KEY_STATUS, buf.readUnsignedByte()); // status if (!history) { buf.readUnsignedShort(); } diff --git a/src/org/traccar/protocol/CarcellProtocolDecoder.java b/src/org/traccar/protocol/CarcellProtocolDecoder.java index 615115147..feec7a83c 100644 --- a/src/org/traccar/protocol/CarcellProtocolDecoder.java +++ b/src/org/traccar/protocol/CarcellProtocolDecoder.java @@ -127,7 +127,7 @@ public class CarcellProtocolDecoder extends BaseProtocolDecoder { position.set("jamming", parser.next().equals("1")); position.set(Position.KEY_GPS, parser.nextInt()); - parser.next(); // clock type + position.set("clockType", parser.next()); // clock type DateBuilder dateBuilder = new DateBuilder(). setDateReverse(parser.nextInt(), parser.nextInt(), parser.nextInt()) @@ -140,7 +140,7 @@ public class CarcellProtocolDecoder extends BaseProtocolDecoder { if (parser.hasNext(4)) { position.set("cloned", parser.next().equals("1")); - parser.next(); // panic button status + position.set(Position.KEY_ALARM, parser.next()); // panic button status String painelStatus = parser.next(); if (painelStatus.equals("1")) { @@ -154,8 +154,8 @@ public class CarcellProtocolDecoder extends BaseProtocolDecoder { if (parser.hasNext(5)) { position.set("timeUntilDelivery", parser.nextInt()); - parser.next(); // panic button status - parser.next(); // aux + position.set(Position.KEY_ALARM, parser.next()); // panic button status + position.set(Position.KEY_INPUT, parser.next()); // aux Double mainVoltage = parser.nextDouble() / 100d; position.set(Position.KEY_POWER, mainVoltage); diff --git a/src/org/traccar/protocol/CastelProtocolDecoder.java b/src/org/traccar/protocol/CastelProtocolDecoder.java index 07d26f2b1..f61c76f9f 100644 --- a/src/org/traccar/protocol/CastelProtocolDecoder.java +++ b/src/org/traccar/protocol/CastelProtocolDecoder.java @@ -178,8 +178,8 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedInt(); // ACC ON time buf.readUnsignedInt(); // UTC time position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); - buf.readUnsignedInt(); // trip odometer - buf.readUnsignedInt(); // total fuel consumption + position.set(Position.KEY_TRIP_ODOMETER, buf.readUnsignedInt()); // trip odometer + position.set(Position.KEY_FUEL_CONSUMPTION, buf.readUnsignedInt()); // total fuel consumption buf.readUnsignedShort(); // current fuel consumption position.set(Position.KEY_STATUS, buf.readUnsignedInt()); buf.skipBytes(8); @@ -263,8 +263,8 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedInt(); // ACC ON time buf.readUnsignedInt(); // UTC time long odometer = buf.readUnsignedInt(); - buf.readUnsignedInt(); // trip odometer - buf.readUnsignedInt(); // total fuel consumption + long tripOdometer = buf.readUnsignedInt(); // trip odometer + long fuelConsumption = buf.readUnsignedInt(); // total fuel consumption buf.readUnsignedShort(); // current fuel consumption long status = buf.readUnsignedInt(); buf.skipBytes(8); @@ -276,6 +276,8 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder { for (int i = 0; i < count; i++) { Position position = readPosition(deviceSession, buf); position.set(Position.KEY_ODOMETER, odometer); + position.set(Position.KEY_TRIP_ODOMETER, tripOdometer); + position.set(Position.KEY_FUEL_CONSUMPTION, fuelConsumption); position.set(Position.KEY_STATUS, status); positions.add(position); } diff --git a/src/org/traccar/protocol/CellocatorProtocolDecoder.java b/src/org/traccar/protocol/CellocatorProtocolDecoder.java index 655fadfbd..c0f871f80 100644 --- a/src/org/traccar/protocol/CellocatorProtocolDecoder.java +++ b/src/org/traccar/protocol/CellocatorProtocolDecoder.java @@ -109,9 +109,9 @@ public class CellocatorProtocolDecoder extends BaseProtocolDecoder { } position.setDeviceId(deviceSession.getDeviceId()); - buf.readUnsignedByte(); // hardware version - buf.readUnsignedByte(); // software version - buf.readUnsignedByte(); // protocol version + position.set(Position.KEY_VERSION_HW, buf.readUnsignedByte()); // hardware version + position.set(Position.KEY_VERSION_FW, buf.readUnsignedByte()); // software version + position.set("protocolVersion", buf.readUnsignedByte()); // protocol version position.set(Position.KEY_STATUS, buf.getUnsignedByte(buf.readerIndex()) & 0x0f); @@ -121,21 +121,21 @@ public class CellocatorProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedByte(); // reason data position.set(Position.KEY_ALARM, decodeAlarm(buf.readUnsignedByte())); - buf.readUnsignedByte(); // mode - buf.readUnsignedInt(); // io + position.set("mode", buf.readUnsignedByte()); // mode + position.set(Position.PREFIX_IO + 1, buf.readUnsignedInt()); // IO operator <<= 8; operator += buf.readUnsignedByte(); position.set("operator", operator); - buf.readUnsignedInt(); // adc - buf.readUnsignedMedium(); // odometer + position.set(Position.PREFIX_ADC + 1, buf.readUnsignedInt()); // ADC + position.set(Position.KEY_ODOMETER, buf.readUnsignedMedium()); // Odometer buf.skipBytes(6); // multi-purpose data - buf.readUnsignedShort(); // gps fix - buf.readUnsignedByte(); // location status - buf.readUnsignedByte(); // mode 1 - buf.readUnsignedByte(); // mode 2 + position.set(Position.KEY_GPS, buf.readUnsignedShort()); // gps fix + position.set("locationStatus", buf.readUnsignedByte()); // location status + position.set("mode1", buf.readUnsignedByte()); // mode 1 + position.set("mode2", buf.readUnsignedByte()); // mode 2 position.set(Position.KEY_SATELLITES, buf.readUnsignedByte()); diff --git a/src/org/traccar/protocol/EelinkProtocolDecoder.java b/src/org/traccar/protocol/EelinkProtocolDecoder.java index 4b77b1ff6..30ed5e2ef 100644 --- a/src/org/traccar/protocol/EelinkProtocolDecoder.java +++ b/src/org/traccar/protocol/EelinkProtocolDecoder.java @@ -132,7 +132,7 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_BATTERY, buf.readUnsignedShort() + "mV"); - buf.readUnsignedShort(); // signal strength + position.set(Position.KEY_RSSI, buf.readUnsignedShort()); // signal strength position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort()); position.set(Position.PREFIX_ADC + 2, buf.readUnsignedShort()); diff --git a/src/org/traccar/protocol/FifotrackProtocolDecoder.java b/src/org/traccar/protocol/FifotrackProtocolDecoder.java index 9ccc34384..d140e991f 100644 --- a/src/org/traccar/protocol/FifotrackProtocolDecoder.java +++ b/src/org/traccar/protocol/FifotrackProtocolDecoder.java @@ -83,7 +83,7 @@ public class FifotrackProtocolDecoder extends BaseProtocolDecoder { position.setProtocol(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); - parser.next(); // alarm + position.set(Position.KEY_ALARM, parser.next()); // alarm DateBuilder dateBuilder = new DateBuilder() .setDate(parser.nextInt(), parser.nextInt(), parser.nextInt()) diff --git a/src/org/traccar/protocol/IdplProtocolDecoder.java b/src/org/traccar/protocol/IdplProtocolDecoder.java index 719314f28..afc56a18d 100644 --- a/src/org/traccar/protocol/IdplProtocolDecoder.java +++ b/src/org/traccar/protocol/IdplProtocolDecoder.java @@ -94,14 +94,14 @@ public class IdplProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_SATELLITES, parser.nextInt()); position.set(Position.KEY_RSSI, parser.nextInt()); - parser.next(); // vehicle status + position.set("vehicleStatus", parser.next()); // vehicle status position.set(Position.KEY_POWER, parser.nextInt()); position.set(Position.KEY_BATTERY, parser.nextDouble()); if (parser.nextInt() == 1) { position.set(Position.KEY_ALARM, Position.ALARM_SOS); } - parser.nextInt(); // body tamper - parser.nextInt(); // ac status + position.set("bodyTamper", parser.nextInt()); // body tamper + position.set("acStatus", parser.nextInt()); // ac status position.set(Position.KEY_IGNITION, parser.nextInt() == 1); position.set(Position.KEY_OUTPUT, parser.nextInt()); position.set(Position.PREFIX_ADC + 1, parser.nextInt()); diff --git a/src/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/org/traccar/protocol/Jt600ProtocolDecoder.java index e632b32d8..8eef2e700 100644 --- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java +++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.java @@ -201,6 +201,9 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { position.setCourse(parser.nextDouble()); position.set(Position.KEY_POWER, parser.nextDouble()); + position.set(Position.KEY_GPS, parser.nextInt()); + position.set(Position.KEY_RSSI, parser.nextInt()); + position.set("alertType", parser.nextInt()); return position; } diff --git a/src/org/traccar/protocol/Mta6ProtocolDecoder.java b/src/org/traccar/protocol/Mta6ProtocolDecoder.java index 2a3d84a2c..f8a316931 100644 --- a/src/org/traccar/protocol/Mta6ProtocolDecoder.java +++ b/src/org/traccar/protocol/Mta6ProtocolDecoder.java @@ -182,7 +182,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder { if (BitUtil.check(flags, 7)) { position.set(Position.KEY_BATTERY, buf.getUnsignedByte(buf.readerIndex()) >> 2); position.set(Position.KEY_POWER, buf.readUnsignedShort() & 0x03ff); - buf.readByte(); // microcontroller temperature + position.set("microcontrollerTemperature", buf.readByte()); // microcontroller temperature position.set(Position.KEY_RSSI, (buf.getUnsignedByte(buf.readerIndex()) >> 4) & 0x07); @@ -222,7 +222,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder { position.setLongitude(new FloatReader().readFloat(buf) / Math.PI * 180); position.setTime(new TimeReader().readTime(buf)); - buf.readUnsignedByte(); // status + position.set(Position.KEY_STATUS, buf.readUnsignedByte()); // status if (BitUtil.check(flags, 0)) { position.setAltitude(buf.readUnsignedShort()); @@ -241,7 +241,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder { position.set("engine", buf.readUnsignedShort() * 0.125); position.set("pedals", buf.readUnsignedByte()); position.set(Position.PREFIX_TEMP + 1, buf.readUnsignedByte() - 40); - buf.readUnsignedShort(); // service odometer + position.set("serviceOdometer", buf.readUnsignedShort()); // service odometer } if (BitUtil.check(flags, 3)) { @@ -261,7 +261,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder { if (BitUtil.check(flags, 5)) { position.set(Position.KEY_BATTERY, buf.getUnsignedByte(buf.readerIndex()) >> 2); position.set(Position.KEY_POWER, buf.readUnsignedShort() & 0x03ff); - buf.readByte(); // microcontroller temperature + position.set("microcontrollerTemperature", buf.readByte()); // microcontroller temperature position.set(Position.KEY_RSSI, buf.getUnsignedByte(buf.readerIndex()) >> 5); diff --git a/src/org/traccar/protocol/MxtProtocolDecoder.java b/src/org/traccar/protocol/MxtProtocolDecoder.java index bf1d3b342..b0b587be3 100644 --- a/src/org/traccar/protocol/MxtProtocolDecoder.java +++ b/src/org/traccar/protocol/MxtProtocolDecoder.java @@ -137,7 +137,7 @@ public class MxtProtocolDecoder extends BaseProtocolDecoder { position.setAccuracy(buf.readUnsignedByte()); position.set(Position.KEY_RSSI, buf.readUnsignedByte()); buf.readUnsignedShort(); // time since boot - buf.readUnsignedByte(); // input voltage + position.set(Position.KEY_POWER, buf.readUnsignedByte()); // input voltage position.set(Position.PREFIX_TEMP + 1, buf.readByte()); } diff --git a/src/org/traccar/protocol/NavigilProtocolDecoder.java b/src/org/traccar/protocol/NavigilProtocolDecoder.java index 263e5fc2b..1aecdee55 100644 --- a/src/org/traccar/protocol/NavigilProtocolDecoder.java +++ b/src/org/traccar/protocol/NavigilProtocolDecoder.java @@ -89,7 +89,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { position.setDeviceId(deviceSession.getDeviceId()); buf.readUnsignedShort(); // report trigger - buf.readUnsignedShort(); // flags + position.set(Position.KEY_FLAGS, buf.readUnsignedShort()); // flags position.setLatitude(buf.readInt() * 0.0000001); position.setLongitude(buf.readInt() * 0.0000001); @@ -97,12 +97,12 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_SATELLITES, buf.readUnsignedShort()); // satellites in fix position.set(Position.KEY_SATELLITES_VISIBLE, buf.readUnsignedShort()); // satellites in track - buf.readUnsignedShort(); // GPS antenna state + position.set("gpsAntennaState", buf.readUnsignedShort()); // GPS antenna state position.setSpeed(buf.readUnsignedShort() * 0.194384); position.setCourse(buf.readUnsignedShort()); - buf.readUnsignedInt(); // distance + position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); // distance buf.readUnsignedInt(); // delta distance position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001); @@ -139,13 +139,14 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { position.setSpeed(buf.readUnsignedShort() * 0.194384); position.setCourse(buf.readUnsignedShort()); - buf.readUnsignedInt(); // distance + position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); // distance buf.readUnsignedShort(); // maximum speed buf.readUnsignedShort(); // minimum speed - buf.readUnsignedShort(); // VSAUT1 voltage - buf.readUnsignedShort(); // VSAUT2 voltage - buf.readUnsignedShort(); // solar voltage + position.set(Position.PREFIX_IO + 1, buf.readUnsignedShort()); // VSAUT1 voltage + position.set(Position.PREFIX_IO + 2, buf.readUnsignedShort()); // VSAUT2 voltage + position.set(Position.PREFIX_IO + 3, buf.readUnsignedShort()); // solar voltage + position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001); return position; @@ -170,6 +171,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { position.setValid((flags & 0x80) == 0x80 && (flags & 0x40) == 0x40); buf.readUnsignedByte(); // reserved + return position; } @@ -193,7 +195,8 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { position.setValid((flags & 0x80) == 0x80 && (flags & 0x40) == 0x40); position.set(Position.KEY_SATELLITES, buf.readUnsignedByte()); - buf.readUnsignedInt(); // distance + position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); // distance + return position; } @@ -227,10 +230,10 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedByte(); // maximum speed buf.readUnsignedByte(); // minimum speed - buf.readUnsignedInt(); // distance + position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); // distance - buf.readUnsignedByte(); // supply voltage 1 - buf.readUnsignedByte(); // supply voltage 2 + position.set(Position.PREFIX_IO + 1, buf.readUnsignedByte()); // supply voltage 1 + position.set(Position.PREFIX_IO + 2, buf.readUnsignedByte()); // supply voltage 2 position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001); return position; @@ -262,7 +265,8 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001); - buf.readUnsignedInt(); // distance + position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); // distance + return position; } diff --git a/src/org/traccar/protocol/PricolProtocolDecoder.java b/src/org/traccar/protocol/PricolProtocolDecoder.java index 3313afa22..6d275d4c0 100644 --- a/src/org/traccar/protocol/PricolProtocolDecoder.java +++ b/src/org/traccar/protocol/PricolProtocolDecoder.java @@ -51,11 +51,11 @@ public class PricolProtocolDecoder extends BaseProtocolDecoder { position.setProtocol(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); - buf.readUnsignedByte(); // event type - buf.readUnsignedByte(); // packet version - buf.readUnsignedByte(); // device status - buf.readUnsignedByte(); // gsm status - buf.readUnsignedByte(); // gps status + position.set("eventType", buf.readUnsignedByte()); // event type + position.set("packetVersion", buf.readUnsignedByte()); // packet version + position.set(Position.KEY_STATUS, buf.readUnsignedByte()); // device status + position.set(Position.KEY_RSSI, buf.readUnsignedByte()); // gsm status + position.set(Position.KEY_GPS, buf.readUnsignedByte()); // gps status position.setTime(new DateBuilder() .setDateReverse(buf.readUnsignedByte(), buf.readUnsignedByte(), buf.readUnsignedByte()) @@ -76,8 +76,8 @@ public class PricolProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_INPUT, buf.readUnsignedShort()); position.set(Position.KEY_OUTPUT, buf.readUnsignedByte()); - buf.readUnsignedByte(); // analog alerts - buf.readUnsignedShort(); // custom alert types + position.set("analogAlerts", buf.readUnsignedByte()); // analog alerts + position.set("customAlertTypes", buf.readUnsignedShort()); // custom alert types for (int i = 1; i <= 5; i++) { position.set(Position.PREFIX_ADC + i, buf.readUnsignedShort()); diff --git a/src/org/traccar/protocol/RaveonProtocolDecoder.java b/src/org/traccar/protocol/RaveonProtocolDecoder.java index 847bc4fb6..5b6e4f0ac 100644 --- a/src/org/traccar/protocol/RaveonProtocolDecoder.java +++ b/src/org/traccar/protocol/RaveonProtocolDecoder.java @@ -95,7 +95,7 @@ public class RaveonProtocolDecoder extends BaseProtocolDecoder { position.setSpeed(UnitsConverter.knotsFromKph(parser.nextInt())); position.setCourse(parser.nextInt()); - parser.next(); // alerts + position.set(Position.KEY_ALARM, parser.next()); // alerts return position; } diff --git a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java index dfe87caf5..915426f15 100644 --- a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java +++ b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java @@ -92,15 +92,15 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder { position.setDeviceId(deviceSession.getDeviceId()); if (BitUtil.check(mask, 3)) { - buf.readUnsignedShort(); // io data + position.set(Position.PREFIX_IO + 1, buf.readUnsignedShort()); // io data } if (BitUtil.check(mask, 4)) { - buf.readUnsignedShort(); // adc 1 + position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort()); // adc 1 } if (BitUtil.check(mask, 5)) { - buf.readUnsignedShort(); // adc 2 + position.set(Position.PREFIX_ADC + 2, buf.readUnsignedShort()); // adc 2 } if (BitUtil.check(mask, 7)) { @@ -150,11 +150,11 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder { } if (BitUtil.check(mask, 17)) { - buf.readUnsignedShort(); // battery percentage + position.set(Position.KEY_BATTERY, buf.readUnsignedShort()); // battery percentage } if (BitUtil.check(mask, 20)) { - position.set("trip", buf.readUnsignedInt()); + position.set(Position.KEY_TRIP_ODOMETER, buf.readUnsignedInt()); } if (BitUtil.check(mask, 21)) { diff --git a/src/org/traccar/protocol/SmokeyProtocolDecoder.java b/src/org/traccar/protocol/SmokeyProtocolDecoder.java index 37010d281..6ac92f158 100644 --- a/src/org/traccar/protocol/SmokeyProtocolDecoder.java +++ b/src/org/traccar/protocol/SmokeyProtocolDecoder.java @@ -84,12 +84,12 @@ public class SmokeyProtocolDecoder extends BaseProtocolDecoder { if (type == MSG_DATE_RECORD) { - buf.readUnsignedShort(); // firmware version - Position position = new Position(); position.setProtocol(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); + position.set(Position.KEY_VERSION_FW, buf.readUnsignedShort()); // firmware version + int status = buf.readUnsignedShort(); position.set(Position.KEY_STATUS, status); diff --git a/src/org/traccar/protocol/TrakMateProtocolDecoder.java b/src/org/traccar/protocol/TrakMateProtocolDecoder.java index d1bd1398b..c9aa9ea42 100644 --- a/src/org/traccar/protocol/TrakMateProtocolDecoder.java +++ b/src/org/traccar/protocol/TrakMateProtocolDecoder.java @@ -126,7 +126,7 @@ public class TrakMateProtocolDecoder extends BaseProtocolDecoder { position.setTime(dateBuilder.getDate()); position.set(Position.KEY_VERSION_FW, parser.next()); - parser.next(); // hardware version + position.set(Position.KEY_VERSION_HW, parser.next()); // hardware version return position; } @@ -195,13 +195,13 @@ public class TrakMateProtocolDecoder extends BaseProtocolDecoder { position.setCourse(parser.nextDouble()); position.set(Position.KEY_IGNITION, parser.nextInt() == 1); - parser.next(); // dop1 - parser.next(); // dop2 - parser.next(); // analog input + position.set("dop1", parser.next()); // dop1 + position.set("dop2", parser.next()); // dop2 + position.set(Position.KEY_INPUT, parser.next()); // analog input position.set(Position.KEY_BATTERY, parser.nextDouble()); // device battery voltage - parser.next(); // vehicle internal voltage + position.set(Position.KEY_POWER, parser.next()); // vehicle internal voltage position.set(Position.KEY_ODOMETER, parser.nextDouble()); // gps odometer - parser.next(); // pulse odometer + position.set("pulseOdometer", parser.next()); // pulse odometer position.set(Position.KEY_STATUS, parser.nextInt()); position.setValid(parser.nextInt() != 0); diff --git a/src/org/traccar/protocol/TramigoProtocolDecoder.java b/src/org/traccar/protocol/TramigoProtocolDecoder.java index 73356ccfc..8e14debd4 100644 --- a/src/org/traccar/protocol/TramigoProtocolDecoder.java +++ b/src/org/traccar/protocol/TramigoProtocolDecoder.java @@ -82,15 +82,15 @@ public class TramigoProtocolDecoder extends BaseProtocolDecoder { position.setLatitude(buf.readUnsignedInt() * 0.0000001); position.setLongitude(buf.readUnsignedInt() * 0.0000001); - position.set(Position.KEY_RSSI, buf.readUnsignedShort()); - position.set(Position.KEY_SATELLITES, buf.readUnsignedShort()); - position.set(Position.KEY_SATELLITES_VISIBLE, buf.readUnsignedShort()); - buf.readUnsignedShort(); // gps antenna state + position.set(Position.KEY_RSSI, buf.readUnsignedShort()); // GSM signal quality + position.set(Position.KEY_SATELLITES, buf.readUnsignedShort()); // satellites in fix + position.set(Position.KEY_SATELLITES_VISIBLE, buf.readUnsignedShort()); // satellites in track + position.set("gpsAntennaStatus", buf.readUnsignedShort()); // GPS antenna state position.setSpeed(buf.readUnsignedShort() * 0.194384); position.setCourse((double) buf.readUnsignedShort()); - buf.readUnsignedInt(); // distance + position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); // distance position.set(Position.KEY_BATTERY, buf.readUnsignedShort()); diff --git a/src/org/traccar/protocol/TzoneProtocolDecoder.java b/src/org/traccar/protocol/TzoneProtocolDecoder.java index 0fc93a03c..7dc158579 100644 --- a/src/org/traccar/protocol/TzoneProtocolDecoder.java +++ b/src/org/traccar/protocol/TzoneProtocolDecoder.java @@ -120,7 +120,7 @@ public class TzoneProtocolDecoder extends BaseProtocolDecoder { return null; } int hardware = buf.readUnsignedShort(); // model - buf.readUnsignedInt(); // firmware + long firmware = buf.readUnsignedInt(); // firmware String imei = ChannelBuffers.hexDump(buf.readBytes(8)).substring(1); DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, imei); @@ -132,6 +132,9 @@ public class TzoneProtocolDecoder extends BaseProtocolDecoder { position.setProtocol(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); + position.set(Position.KEY_VERSION_HW, hardware); + position.set(Position.KEY_VERSION_FW, firmware); + position.setDeviceTime(new DateBuilder() .setDate(buf.readUnsignedByte(), buf.readUnsignedByte(), buf.readUnsignedByte()) .setTime(buf.readUnsignedByte(), buf.readUnsignedByte(), buf.readUnsignedByte()).getDate()); @@ -199,10 +202,10 @@ public class TzoneProtocolDecoder extends BaseProtocolDecoder { if (blockLength >= 13) { position.set(Position.KEY_ALARM, decodeAlarm(buf.readUnsignedByte())); - buf.readUnsignedByte(); // terminal info + position.set("terminalInfo", buf.readUnsignedByte()); // terminal info position.set(Position.PREFIX_IO + 1, buf.readUnsignedShort()); position.set(Position.KEY_RSSI, buf.readUnsignedByte()); - buf.readUnsignedByte(); // GSM status + position.set("gsmStatus", buf.readUnsignedByte()); // GSM status position.set(Position.KEY_BATTERY, buf.readUnsignedShort()); position.set(Position.KEY_POWER, buf.readUnsignedShort()); position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort()); diff --git a/src/org/traccar/protocol/UlbotechProtocolDecoder.java b/src/org/traccar/protocol/UlbotechProtocolDecoder.java index ec45be3d1..19e9cd5e9 100644 --- a/src/org/traccar/protocol/UlbotechProtocolDecoder.java +++ b/src/org/traccar/protocol/UlbotechProtocolDecoder.java @@ -248,7 +248,7 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder { break; case DATA_FUEL: - position.set("fuelConsumption", buf.readUnsignedInt() / 10000.0); + position.set(Position.KEY_FUEL_CONSUMPTION, buf.readUnsignedInt() / 10000.0); break; case DATA_OBD2_ALARM: -- cgit v1.2.3 From 2df0487ffaac8afe4f338bcf2f04dd4dfaa86c4b Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Sat, 25 Feb 2017 20:58:03 -0500 Subject: Updated protocols that used hardcoded strings where there are predefined KEYS; --- src/org/traccar/protocol/AplicomProtocolDecoder.java | 4 ++-- src/org/traccar/protocol/Mta6ProtocolDecoder.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java index 33e882cee..f6b97435b 100644 --- a/src/org/traccar/protocol/AplicomProtocolDecoder.java +++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java @@ -463,8 +463,8 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { position.set("brakeLining", buf.readUnsignedByte() * 0.4); position.set("brakeTemperature", buf.readUnsignedByte() * 10); } else if (type == 0x06) { - position.set("totalDistance", buf.readUnsignedInt() * 5); - position.set("tripDistance", buf.readUnsignedInt() * 5); + position.set(Position.KEY_ODOMETER, buf.readUnsignedInt() * 5); + position.set(Position.KEY_TRIP_ODOMETER, buf.readUnsignedInt() * 5); position.set("serviceDistance", (buf.readUnsignedInt() - 2105540607) * 5); } else if (type == 0x0A) { ChannelBuffer brakeData = buf.readBytes(length); diff --git a/src/org/traccar/protocol/Mta6ProtocolDecoder.java b/src/org/traccar/protocol/Mta6ProtocolDecoder.java index f8a316931..63266b193 100644 --- a/src/org/traccar/protocol/Mta6ProtocolDecoder.java +++ b/src/org/traccar/protocol/Mta6ProtocolDecoder.java @@ -233,7 +233,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder { if (BitUtil.check(flags, 1)) { position.set(Position.KEY_FUEL_CONSUMPTION, new FloatReader().readFloat(buf)); - position.set("hours", new FloatReader().readFloat(buf)); + position.set(Position.KEY_HOURS, new FloatReader().readFloat(buf)); position.set("tank", buf.readUnsignedByte() * 0.4); } -- cgit v1.2.3 From 2d6adb7ba45ae0668e0084e85441ad275ebfb7eb Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Sat, 25 Feb 2017 21:01:18 -0500 Subject: Added Position.KEY_OPERATOR and updated protocols accordingly; --- src/org/traccar/model/Position.java | 1 + src/org/traccar/protocol/CellocatorProtocolDecoder.java | 2 +- src/org/traccar/protocol/TeltonikaProtocolDecoder.java | 2 +- src/org/traccar/protocol/TmgProtocolDecoder.java | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java index 96dc1d2ad..54c97c373 100644 --- a/src/org/traccar/model/Position.java +++ b/src/org/traccar/model/Position.java @@ -61,6 +61,7 @@ public class Position extends Message { public static final String KEY_GEOFENCE = "geofence"; public static final String KEY_ACCELERATION = "acceleration"; public static final String KEY_DEVICE_TEMP = "deviceTemp"; + public static final String KEY_OPERATOR = "operator"; public static final String KEY_DTCS = "dtcs"; public static final String KEY_OBD_SPEED = "obdSpeed"; diff --git a/src/org/traccar/protocol/CellocatorProtocolDecoder.java b/src/org/traccar/protocol/CellocatorProtocolDecoder.java index c0f871f80..ce43cce37 100644 --- a/src/org/traccar/protocol/CellocatorProtocolDecoder.java +++ b/src/org/traccar/protocol/CellocatorProtocolDecoder.java @@ -126,7 +126,7 @@ public class CellocatorProtocolDecoder extends BaseProtocolDecoder { operator <<= 8; operator += buf.readUnsignedByte(); - position.set("operator", operator); + position.set(Position.KEY_OPERATOR, operator); position.set(Position.PREFIX_ADC + 1, buf.readUnsignedInt()); // ADC position.set(Position.KEY_ODOMETER, buf.readUnsignedMedium()); // Odometer diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java index a9679f764..77211b7ab 100644 --- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java +++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java @@ -178,7 +178,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { } if (BitUtil.check(locationMask, 7)) { - position.set("operator", buf.readUnsignedInt()); + position.set(Position.KEY_OPERATOR, buf.readUnsignedInt()); } } else { diff --git a/src/org/traccar/protocol/TmgProtocolDecoder.java b/src/org/traccar/protocol/TmgProtocolDecoder.java index 40ce04c5b..a0459a161 100644 --- a/src/org/traccar/protocol/TmgProtocolDecoder.java +++ b/src/org/traccar/protocol/TmgProtocolDecoder.java @@ -129,7 +129,7 @@ public class TmgProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_HDOP, parser.nextDouble()); position.set(Position.KEY_SATELLITES, parser.nextInt()); position.set(Position.KEY_SATELLITES_VISIBLE, parser.nextInt()); - position.set("operator", parser.next()); + position.set(Position.KEY_OPERATOR, parser.next()); position.set(Position.KEY_RSSI, parser.nextInt()); position.set(Position.KEY_IGNITION, parser.nextInt() == 1); position.set(Position.KEY_BATTERY, parser.nextDouble()); -- cgit v1.2.3 From e849902d7a5aa564bd930465f04f6d4b8498ddf2 Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Sat, 25 Feb 2017 21:02:31 -0500 Subject: Renamed Position.KEY_TRIP_ODOMETER to Position.KEY_ODOMETER_TRIP; --- src/org/traccar/model/Position.java | 2 +- src/org/traccar/protocol/AplicomProtocolDecoder.java | 4 ++-- src/org/traccar/protocol/AstraProtocolDecoder.java | 2 +- src/org/traccar/protocol/CastelProtocolDecoder.java | 4 ++-- src/org/traccar/protocol/RitiProtocolDecoder.java | 2 +- src/org/traccar/protocol/SkypatrolProtocolDecoder.java | 2 +- src/org/traccar/protocol/TytanProtocolDecoder.java | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java index 54c97c373..9083f070d 100644 --- a/src/org/traccar/model/Position.java +++ b/src/org/traccar/model/Position.java @@ -32,7 +32,7 @@ public class Position extends Message { public static final String KEY_ALARM = "alarm"; public static final String KEY_STATUS = "status"; public static final String KEY_ODOMETER = "odometer"; // meters - public static final String KEY_TRIP_ODOMETER = "tripOdometer"; + public static final String KEY_ODOMETER_TRIP = "tripOdometer"; public static final String KEY_HOURS = "hours"; public static final String KEY_INPUT = "input"; public static final String KEY_OUTPUT = "output"; diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java index f6b97435b..d5779a8d8 100644 --- a/src/org/traccar/protocol/AplicomProtocolDecoder.java +++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java @@ -332,7 +332,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { } if ((selector & 0x0100) != 0) { - position.set(Position.KEY_TRIP_ODOMETER, buf.readUnsignedInt() * 5); + position.set(Position.KEY_ODOMETER_TRIP, buf.readUnsignedInt() * 5); } if ((selector & 0x8000) != 0) { @@ -464,7 +464,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { position.set("brakeTemperature", buf.readUnsignedByte() * 10); } else if (type == 0x06) { position.set(Position.KEY_ODOMETER, buf.readUnsignedInt() * 5); - position.set(Position.KEY_TRIP_ODOMETER, buf.readUnsignedInt() * 5); + position.set(Position.KEY_ODOMETER_TRIP, buf.readUnsignedInt() * 5); position.set("serviceDistance", (buf.readUnsignedInt() - 2105540607) * 5); } else if (type == 0x0A) { ChannelBuffer brakeData = buf.readBytes(length); diff --git a/src/org/traccar/protocol/AstraProtocolDecoder.java b/src/org/traccar/protocol/AstraProtocolDecoder.java index 215ef6650..fc70aebb3 100644 --- a/src/org/traccar/protocol/AstraProtocolDecoder.java +++ b/src/org/traccar/protocol/AstraProtocolDecoder.java @@ -93,7 +93,7 @@ public class AstraProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedByte(); // max journey speed buf.skipBytes(6); // accelerometer - position.set(Position.KEY_TRIP_ODOMETER, buf.readUnsignedShort()); // journey distance + position.set(Position.KEY_ODOMETER_TRIP, buf.readUnsignedShort()); // journey distance buf.readUnsignedShort(); // journey idle time position.setAltitude(buf.readUnsignedByte() * 20); diff --git a/src/org/traccar/protocol/CastelProtocolDecoder.java b/src/org/traccar/protocol/CastelProtocolDecoder.java index f61c76f9f..52d7f4edb 100644 --- a/src/org/traccar/protocol/CastelProtocolDecoder.java +++ b/src/org/traccar/protocol/CastelProtocolDecoder.java @@ -178,7 +178,7 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedInt(); // ACC ON time buf.readUnsignedInt(); // UTC time position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); - position.set(Position.KEY_TRIP_ODOMETER, buf.readUnsignedInt()); // trip odometer + position.set(Position.KEY_ODOMETER_TRIP, buf.readUnsignedInt()); // trip odometer position.set(Position.KEY_FUEL_CONSUMPTION, buf.readUnsignedInt()); // total fuel consumption buf.readUnsignedShort(); // current fuel consumption position.set(Position.KEY_STATUS, buf.readUnsignedInt()); @@ -276,7 +276,7 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder { for (int i = 0; i < count; i++) { Position position = readPosition(deviceSession, buf); position.set(Position.KEY_ODOMETER, odometer); - position.set(Position.KEY_TRIP_ODOMETER, tripOdometer); + position.set(Position.KEY_ODOMETER_TRIP, tripOdometer); position.set(Position.KEY_FUEL_CONSUMPTION, fuelConsumption); position.set(Position.KEY_STATUS, status); positions.add(position); diff --git a/src/org/traccar/protocol/RitiProtocolDecoder.java b/src/org/traccar/protocol/RitiProtocolDecoder.java index 1ca517057..087d4e63b 100644 --- a/src/org/traccar/protocol/RitiProtocolDecoder.java +++ b/src/org/traccar/protocol/RitiProtocolDecoder.java @@ -74,7 +74,7 @@ public class RitiProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedShort(); position.set(Position.KEY_DISTANCE, buf.readUnsignedInt()); - position.set(Position.KEY_TRIP_ODOMETER, buf.readUnsignedInt()); + position.set(Position.KEY_ODOMETER_TRIP, buf.readUnsignedInt()); // Parse GPRMC int end = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) '*'); diff --git a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java index 915426f15..56b53cb38 100644 --- a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java +++ b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java @@ -154,7 +154,7 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder { } if (BitUtil.check(mask, 20)) { - position.set(Position.KEY_TRIP_ODOMETER, buf.readUnsignedInt()); + position.set(Position.KEY_ODOMETER_TRIP, buf.readUnsignedInt()); } if (BitUtil.check(mask, 21)) { diff --git a/src/org/traccar/protocol/TytanProtocolDecoder.java b/src/org/traccar/protocol/TytanProtocolDecoder.java index 429479de0..f7d69bfd0 100644 --- a/src/org/traccar/protocol/TytanProtocolDecoder.java +++ b/src/org/traccar/protocol/TytanProtocolDecoder.java @@ -49,7 +49,7 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder { switch (type) { case 2: - position.set(Position.KEY_TRIP_ODOMETER, buf.readUnsignedMedium()); + position.set(Position.KEY_ODOMETER_TRIP, buf.readUnsignedMedium()); break; case 5: position.set(Position.KEY_INPUT, buf.readUnsignedByte()); -- cgit v1.2.3 From 9d6871fecda9458a8fbf4b9f2a8b2859ae0f2ecf Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Sat, 25 Feb 2017 21:04:33 -0500 Subject: Renamed Position.KEY_FUEL to Position.KEY_FUEL_LEVEL; --- src/org/traccar/helper/ObdDecoder.java | 2 +- src/org/traccar/model/Position.java | 2 +- src/org/traccar/protocol/AplicomProtocolDecoder.java | 2 +- src/org/traccar/protocol/AquilaProtocolDecoder.java | 2 +- src/org/traccar/protocol/AtrackProtocolDecoder.java | 2 +- src/org/traccar/protocol/FoxProtocolDecoder.java | 2 +- src/org/traccar/protocol/GalileoProtocolDecoder.java | 2 +- src/org/traccar/protocol/Gl200ProtocolDecoder.java | 4 ++-- src/org/traccar/protocol/IntellitracProtocolDecoder.java | 2 +- src/org/traccar/protocol/Jt600ProtocolDecoder.java | 2 +- src/org/traccar/protocol/KhdProtocolDecoder.java | 2 +- src/org/traccar/protocol/MeitrackProtocolDecoder.java | 2 +- src/org/traccar/protocol/Mta6ProtocolDecoder.java | 2 +- src/org/traccar/protocol/NoranProtocolDecoder.java | 2 +- src/org/traccar/protocol/Stl060ProtocolDecoder.java | 4 ++-- src/org/traccar/protocol/T55ProtocolDecoder.java | 2 +- src/org/traccar/protocol/TytanProtocolDecoder.java | 6 +++--- src/org/traccar/reports/ReportUtils.java | 10 ++++++---- test/org/traccar/reports/ReportUtilsTest.java | 4 ++-- 19 files changed, 29 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/org/traccar/helper/ObdDecoder.java b/src/org/traccar/helper/ObdDecoder.java index aea23ca60..f2c269f47 100644 --- a/src/org/traccar/helper/ObdDecoder.java +++ b/src/org/traccar/helper/ObdDecoder.java @@ -99,7 +99,7 @@ public final class ObdDecoder { case PID_MIL_DISTANCE: return createEntry("milDistance", value); case PID_FUEL_LEVEL: - return createEntry(Position.KEY_FUEL, convert ? value * 100 / 255 : value); + return createEntry(Position.KEY_FUEL_LEVEL, convert ? value * 100 / 255 : value); case PID_DISTANCE_CLEARED: return createEntry("clearedDistance", value); default: diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java index 9083f070d..ff3ebff22 100644 --- a/src/org/traccar/model/Position.java +++ b/src/org/traccar/model/Position.java @@ -38,7 +38,7 @@ public class Position extends Message { 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_FUEL = "fuel"; + public static final String KEY_FUEL_LEVEL = "fuel"; public static final String KEY_FUEL_CONSUMPTION = "fuelConsumption"; public static final String KEY_RFID = "rfid"; public static final String KEY_VERSION_FW = "versionFw"; diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java index d5779a8d8..24716071c 100644 --- a/src/org/traccar/protocol/AplicomProtocolDecoder.java +++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java @@ -528,7 +528,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { position.set("serviceDistance", buf.readInt()); buf.readUnsignedByte(); // driver activity position.set(Position.KEY_THROTTLE, buf.readUnsignedByte()); - position.set(Position.KEY_FUEL, buf.readUnsignedByte()); + position.set(Position.KEY_FUEL_LEVEL, buf.readUnsignedByte()); } if ((selector & 0x0040) != 0) { diff --git a/src/org/traccar/protocol/AquilaProtocolDecoder.java b/src/org/traccar/protocol/AquilaProtocolDecoder.java index 11ab15c86..2bc3b3a09 100644 --- a/src/org/traccar/protocol/AquilaProtocolDecoder.java +++ b/src/org/traccar/protocol/AquilaProtocolDecoder.java @@ -136,7 +136,7 @@ public class AquilaProtocolDecoder extends BaseProtocolDecoder { if (parser.hasNext(9)) { - position.set(Position.KEY_FUEL, parser.next()); + position.set(Position.KEY_FUEL_LEVEL, parser.next()); position.set(Position.PREFIX_IO + 1, parser.next()); position.set(Position.KEY_CHARGE, parser.next()); position.set(Position.PREFIX_IO + 2, parser.next()); diff --git a/src/org/traccar/protocol/AtrackProtocolDecoder.java b/src/org/traccar/protocol/AtrackProtocolDecoder.java index e395f376d..8e9d051f4 100644 --- a/src/org/traccar/protocol/AtrackProtocolDecoder.java +++ b/src/org/traccar/protocol/AtrackProtocolDecoder.java @@ -143,7 +143,7 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder { position.set(Position.PREFIX_TEMP + 1, buf.readUnsignedShort()); // engine coolant temp break; case "FL": - position.set(Position.KEY_FUEL, buf.readUnsignedByte()); + position.set(Position.KEY_FUEL_LEVEL, buf.readUnsignedByte()); break; case "ML": buf.readUnsignedByte(); // mil status diff --git a/src/org/traccar/protocol/FoxProtocolDecoder.java b/src/org/traccar/protocol/FoxProtocolDecoder.java index cf1e4f1f2..e01c3aae3 100644 --- a/src/org/traccar/protocol/FoxProtocolDecoder.java +++ b/src/org/traccar/protocol/FoxProtocolDecoder.java @@ -111,7 +111,7 @@ public class FoxProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_POWER, parser.nextDouble() / 10); position.set(Position.PREFIX_TEMP + 1, parser.nextInt()); position.set(Position.KEY_RPM, parser.nextInt()); - position.set(Position.KEY_FUEL, parser.nextInt()); + position.set(Position.KEY_FUEL_LEVEL, parser.nextInt()); position.set(Position.PREFIX_ADC + 1, parser.nextInt()); position.set(Position.PREFIX_ADC + 2, parser.nextInt()); position.set(Position.KEY_OUTPUT, parser.nextInt(2)); diff --git a/src/org/traccar/protocol/GalileoProtocolDecoder.java b/src/org/traccar/protocol/GalileoProtocolDecoder.java index a3f99c674..64bfdd270 100644 --- a/src/org/traccar/protocol/GalileoProtocolDecoder.java +++ b/src/org/traccar/protocol/GalileoProtocolDecoder.java @@ -185,7 +185,7 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); break; case 0xc1: - position.set(Position.KEY_FUEL, buf.readUnsignedByte() * 0.4); + position.set(Position.KEY_FUEL_LEVEL, buf.readUnsignedByte() * 0.4); position.set(Position.PREFIX_TEMP + 1, buf.readUnsignedByte() - 40); position.set(Position.KEY_RPM, buf.readUnsignedShort() * 0.125); break; diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java index 4103ebba6..74a734143 100644 --- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java @@ -455,7 +455,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { position.set("dtcsNumber", parser.next()); position.set("dtcsCodes", parser.next()); position.set(Position.KEY_THROTTLE, parser.next()); - position.set(Position.KEY_FUEL, parser.next()); + position.set(Position.KEY_FUEL_LEVEL, parser.next()); position.set(Position.KEY_OBD_ODOMETER, parser.nextInt() * 1000); decodeLocation(position, parser); @@ -533,7 +533,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { } position.set(Position.KEY_RPM, parser.next()); - position.set(Position.KEY_FUEL, parser.next()); + position.set(Position.KEY_FUEL_LEVEL, parser.next()); // workaround for wrong location time if (parser.hasNext(6)) { diff --git a/src/org/traccar/protocol/IntellitracProtocolDecoder.java b/src/org/traccar/protocol/IntellitracProtocolDecoder.java index a2720028f..70251fc51 100644 --- a/src/org/traccar/protocol/IntellitracProtocolDecoder.java +++ b/src/org/traccar/protocol/IntellitracProtocolDecoder.java @@ -108,7 +108,7 @@ public class IntellitracProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_OBD_SPEED, parser.next()); position.set(Position.KEY_RPM, parser.next()); position.set("coolant", parser.next()); - position.set(Position.KEY_FUEL, parser.next()); + position.set(Position.KEY_FUEL_LEVEL, parser.next()); position.set(Position.KEY_FUEL_CONSUMPTION, parser.next()); position.set(Position.PREFIX_TEMP + 1, parser.next()); position.set(Position.KEY_CHARGE, parser.next()); diff --git a/src/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/org/traccar/protocol/Jt600ProtocolDecoder.java index 8eef2e700..c8e41b03f 100644 --- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java +++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.java @@ -145,7 +145,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_ODOMETER, buf.readUnsignedInt() * 1000); fuel += buf.readUnsignedByte(); - position.set(Position.KEY_FUEL, fuel); + position.set(Position.KEY_FUEL_LEVEL, fuel); } diff --git a/src/org/traccar/protocol/KhdProtocolDecoder.java b/src/org/traccar/protocol/KhdProtocolDecoder.java index 1c88a8b9d..d63219736 100644 --- a/src/org/traccar/protocol/KhdProtocolDecoder.java +++ b/src/org/traccar/protocol/KhdProtocolDecoder.java @@ -115,7 +115,7 @@ public class KhdProtocolDecoder extends BaseProtocolDecoder { switch (dataType) { case 0x01: - position.set(Position.KEY_FUEL, + position.set(Position.KEY_FUEL_LEVEL, buf.readUnsignedByte() * 100 + buf.readUnsignedByte()); break; case 0x02: diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java index f5253566b..a4a0d2d42 100644 --- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java +++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java @@ -155,7 +155,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { if (parser.hasNext()) { String fuel = parser.next(); - position.set(Position.KEY_FUEL, + position.set(Position.KEY_FUEL_LEVEL, Integer.parseInt(fuel.substring(0, 2), 16) + Integer.parseInt(fuel.substring(2), 16) * 0.01); } diff --git a/src/org/traccar/protocol/Mta6ProtocolDecoder.java b/src/org/traccar/protocol/Mta6ProtocolDecoder.java index 63266b193..504539c4c 100644 --- a/src/org/traccar/protocol/Mta6ProtocolDecoder.java +++ b/src/org/traccar/protocol/Mta6ProtocolDecoder.java @@ -245,7 +245,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder { } if (BitUtil.check(flags, 3)) { - position.set(Position.KEY_FUEL, buf.readUnsignedShort()); + position.set(Position.KEY_FUEL_LEVEL, buf.readUnsignedShort()); position.set(Position.PREFIX_ADC + 2, buf.readUnsignedShort()); position.set(Position.PREFIX_ADC + 3, buf.readUnsignedShort()); position.set(Position.PREFIX_ADC + 4, buf.readUnsignedShort()); diff --git a/src/org/traccar/protocol/NoranProtocolDecoder.java b/src/org/traccar/protocol/NoranProtocolDecoder.java index ebeacc659..990f50484 100644 --- a/src/org/traccar/protocol/NoranProtocolDecoder.java +++ b/src/org/traccar/protocol/NoranProtocolDecoder.java @@ -151,7 +151,7 @@ public class NoranProtocolDecoder extends BaseProtocolDecoder { if (!newFormat) { position.set(Position.PREFIX_IO + 1, buf.readUnsignedByte()); - position.set(Position.KEY_FUEL, buf.readUnsignedByte()); + position.set(Position.KEY_FUEL_LEVEL, buf.readUnsignedByte()); } else if (type == MSG_UPLOAD_POSITION_NEW) { position.set(Position.PREFIX_TEMP + 1, buf.readShort()); position.set(Position.KEY_ODOMETER, buf.readFloat()); diff --git a/src/org/traccar/protocol/Stl060ProtocolDecoder.java b/src/org/traccar/protocol/Stl060ProtocolDecoder.java index 87e55ea86..9f7980032 100644 --- a/src/org/traccar/protocol/Stl060ProtocolDecoder.java +++ b/src/org/traccar/protocol/Stl060ProtocolDecoder.java @@ -100,7 +100,7 @@ public class Stl060ProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_ODOMETER, parser.nextInt()); position.set(Position.KEY_IGNITION, parser.nextInt() == 1); position.set(Position.KEY_INPUT, parser.nextInt() + parser.nextInt() << 1); - position.set(Position.KEY_FUEL, parser.nextInt()); + position.set(Position.KEY_FUEL_LEVEL, parser.nextInt()); } // New format @@ -111,7 +111,7 @@ public class Stl060ProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_RFID, parser.next()); position.set(Position.KEY_ODOMETER, parser.nextInt()); position.set(Position.PREFIX_TEMP + 1, parser.nextInt()); - position.set(Position.KEY_FUEL, parser.nextInt()); + position.set(Position.KEY_FUEL_LEVEL, parser.nextInt()); position.set(Position.KEY_ACCELERATION, parser.nextInt() == 1); position.set(Position.KEY_OUTPUT, parser.nextInt() + parser.nextInt() << 1); } diff --git a/src/org/traccar/protocol/T55ProtocolDecoder.java b/src/org/traccar/protocol/T55ProtocolDecoder.java index a41da427a..cd50a99ff 100644 --- a/src/org/traccar/protocol/T55ProtocolDecoder.java +++ b/src/org/traccar/protocol/T55ProtocolDecoder.java @@ -136,7 +136,7 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder { position.setDeviceId(deviceSession.getDeviceId()); position.set(Position.KEY_IGNITION, parser.hasNext() && parser.next().equals("1")); - position.set(Position.KEY_FUEL, parser.nextInt()); + position.set(Position.KEY_FUEL_LEVEL, parser.nextInt()); position.set(Position.KEY_BATTERY, parser.nextInt()); } diff --git a/src/org/traccar/protocol/TytanProtocolDecoder.java b/src/org/traccar/protocol/TytanProtocolDecoder.java index f7d69bfd0..e358e60b1 100644 --- a/src/org/traccar/protocol/TytanProtocolDecoder.java +++ b/src/org/traccar/protocol/TytanProtocolDecoder.java @@ -100,11 +100,11 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder { int fuel = buf.readUnsignedShort(); int fuelFormat = fuel >> 14; if (fuelFormat == 1) { - position.set(Position.KEY_FUEL, (fuel & 0x3fff) * 0.4 + "%"); + position.set(Position.KEY_FUEL_LEVEL, (fuel & 0x3fff) * 0.4 + "%"); } else if (fuelFormat == 2) { - position.set(Position.KEY_FUEL, (fuel & 0x3fff) * 0.5 + " l"); + position.set(Position.KEY_FUEL_LEVEL, (fuel & 0x3fff) * 0.5 + " l"); } else if (fuelFormat == 3) { - position.set(Position.KEY_FUEL, (fuel & 0x3fff) * -0.5 + " l"); + position.set(Position.KEY_FUEL_LEVEL, (fuel & 0x3fff) * -0.5 + " l"); } break; case 108: diff --git a/src/org/traccar/reports/ReportUtils.java b/src/org/traccar/reports/ReportUtils.java index 032925a4a..9541e1027 100644 --- a/src/org/traccar/reports/ReportUtils.java +++ b/src/org/traccar/reports/ReportUtils.java @@ -78,15 +78,17 @@ public final class ReportUtils { public static String calculateFuel(Position firstPosition, Position lastPosition) { - if (firstPosition.getAttributes().get(Position.KEY_FUEL) != null - && lastPosition.getAttributes().get(Position.KEY_FUEL) != null) { + if (firstPosition.getAttributes().get(Position.KEY_FUEL_LEVEL) != null + && lastPosition.getAttributes().get(Position.KEY_FUEL_LEVEL) != null) { try { switch (firstPosition.getProtocol()) { case "meitrack": case "galileo": case "noran": - BigDecimal v = new BigDecimal(firstPosition.getAttributes().get(Position.KEY_FUEL).toString()); - v = v.subtract(new BigDecimal(lastPosition.getAttributes().get(Position.KEY_FUEL).toString())); + BigDecimal v = new BigDecimal(firstPosition.getAttributes() + .get(Position.KEY_FUEL_LEVEL).toString()); + v = v.subtract(new BigDecimal(lastPosition.getAttributes() + .get(Position.KEY_FUEL_LEVEL).toString())); return v.setScale(2, RoundingMode.HALF_EVEN).toString() + " %"; default: break; diff --git a/test/org/traccar/reports/ReportUtilsTest.java b/test/org/traccar/reports/ReportUtilsTest.java index 9a30ce3a7..f4dd88cba 100644 --- a/test/org/traccar/reports/ReportUtilsTest.java +++ b/test/org/traccar/reports/ReportUtilsTest.java @@ -24,8 +24,8 @@ public class ReportUtilsTest { Position endPosition = new Position(); Assert.assertEquals(ReportUtils.calculateFuel(startPosition, endPosition), "-"); startPosition.setProtocol("meitrack"); - startPosition.set(Position.KEY_FUEL, 0.07); - endPosition.set(Position.KEY_FUEL, 0.05); + startPosition.set(Position.KEY_FUEL_LEVEL, 0.07); + endPosition.set(Position.KEY_FUEL_LEVEL, 0.05); Assert.assertEquals(ReportUtils.calculateFuel(startPosition, endPosition), "0.02 %"); startPosition.setProtocol("galileo"); Assert.assertEquals(ReportUtils.calculateFuel(startPosition, endPosition), "0.02 %"); -- cgit v1.2.3 From e46acd56d4db57dfd8010c320cf26bef1f8666c7 Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Sat, 25 Feb 2017 21:08:14 -0500 Subject: Removed unused Position.KEY_ACCURACY; --- src/org/traccar/model/Position.java | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java index ff3ebff22..1749431a9 100644 --- a/src/org/traccar/model/Position.java +++ b/src/org/traccar/model/Position.java @@ -57,7 +57,6 @@ public class Position extends Message { public static final String KEY_THROTTLE = "throttle"; public static final String KEY_MOTION = "motion"; public static final String KEY_ARMED = "armed"; - public static final String KEY_ACCURACY = "accuracy"; public static final String KEY_GEOFENCE = "geofence"; public static final String KEY_ACCELERATION = "acceleration"; public static final String KEY_DEVICE_TEMP = "deviceTemp"; -- cgit v1.2.3 From 149317fd5d53566f0902ff627ca3810f2130bbca Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Sat, 25 Feb 2017 21:26:17 -0500 Subject: Added Position.KEY_ODOMETER_SERVICE; --- src/org/traccar/model/Position.java | 1 + src/org/traccar/protocol/AplicomProtocolDecoder.java | 2 +- src/org/traccar/protocol/Mta6ProtocolDecoder.java | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java index 1749431a9..409b49ccb 100644 --- a/src/org/traccar/model/Position.java +++ b/src/org/traccar/model/Position.java @@ -32,6 +32,7 @@ public class Position extends Message { public static final String KEY_ALARM = "alarm"; public static final String KEY_STATUS = "status"; public static final String KEY_ODOMETER = "odometer"; // meters + public static final String KEY_ODOMETER_SERVICE = "serviceOdometer"; public static final String KEY_ODOMETER_TRIP = "tripOdometer"; public static final String KEY_HOURS = "hours"; public static final String KEY_INPUT = "input"; diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java index 24716071c..d80c0337e 100644 --- a/src/org/traccar/protocol/AplicomProtocolDecoder.java +++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java @@ -465,7 +465,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { } else if (type == 0x06) { position.set(Position.KEY_ODOMETER, buf.readUnsignedInt() * 5); position.set(Position.KEY_ODOMETER_TRIP, buf.readUnsignedInt() * 5); - position.set("serviceDistance", (buf.readUnsignedInt() - 2105540607) * 5); + position.set(Position.KEY_ODOMETER_SERVICE, (buf.readUnsignedInt() - 2105540607) * 5); } else if (type == 0x0A) { ChannelBuffer brakeData = buf.readBytes(length); position.set("absStatusCounter", brakeData.readUnsignedShort()); diff --git a/src/org/traccar/protocol/Mta6ProtocolDecoder.java b/src/org/traccar/protocol/Mta6ProtocolDecoder.java index 504539c4c..35695e177 100644 --- a/src/org/traccar/protocol/Mta6ProtocolDecoder.java +++ b/src/org/traccar/protocol/Mta6ProtocolDecoder.java @@ -241,7 +241,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder { position.set("engine", buf.readUnsignedShort() * 0.125); position.set("pedals", buf.readUnsignedByte()); position.set(Position.PREFIX_TEMP + 1, buf.readUnsignedByte() - 40); - position.set("serviceOdometer", buf.readUnsignedShort()); // service odometer + position.set(Position.KEY_ODOMETER_SERVICE, buf.readUnsignedShort()); // service odometer } if (BitUtil.check(flags, 3)) { -- cgit v1.2.3 From c952212547f3975fed5fef9b8ccc8bef9f6b3297 Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Sat, 25 Feb 2017 21:49:06 -0500 Subject: Replace Position.KEY_DISTANCE with Position.KEY_ODOMETER_TRIP as per Section 3.1.1 in the documentation, v1.5; --- src/org/traccar/protocol/BoxProtocolDecoder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/org/traccar/protocol/BoxProtocolDecoder.java b/src/org/traccar/protocol/BoxProtocolDecoder.java index b1fe55e5e..e4dcd6ad7 100644 --- a/src/org/traccar/protocol/BoxProtocolDecoder.java +++ b/src/org/traccar/protocol/BoxProtocolDecoder.java @@ -92,7 +92,7 @@ public class BoxProtocolDecoder extends BaseProtocolDecoder { position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble())); position.setCourse(parser.nextDouble()); - position.set(Position.KEY_DISTANCE, parser.nextDouble() * 1000); + position.set(Position.KEY_ODOMETER_TRIP, parser.nextDouble() * 1000); position.set(Position.KEY_EVENT, parser.next()); int status = parser.nextInt(); -- cgit v1.2.3 From c5053137dddb66661a783be68bbc3f69471df4f4 Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Sat, 25 Feb 2017 21:56:47 -0500 Subject: Replaced Position.KEY_SATELLITES with Position.KEY_SATELLITES_VISIBLE as per section 2.3 in the documentation, Aplicom D v6.1.0; --- src/org/traccar/protocol/AplicomProtocolDecoder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java index d80c0337e..d7f77a40e 100644 --- a/src/org/traccar/protocol/AplicomProtocolDecoder.java +++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java @@ -213,7 +213,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(Position.KEY_SATELLITES, buf.readUnsignedByte()); + position.set(Position.KEY_SATELLITES_VISIBLE, buf.readUnsignedByte()); } if ((selector & 0x0010) != 0) { -- cgit v1.2.3 From 78139d12edc233faed0867b653bd0d2af5b49806 Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Sat, 25 Feb 2017 22:04:22 -0500 Subject: Added comments as per the documentation; --- src/org/traccar/protocol/RitiProtocolDecoder.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/org/traccar/protocol/RitiProtocolDecoder.java b/src/org/traccar/protocol/RitiProtocolDecoder.java index 087d4e63b..26aeb40f3 100644 --- a/src/org/traccar/protocol/RitiProtocolDecoder.java +++ b/src/org/traccar/protocol/RitiProtocolDecoder.java @@ -67,14 +67,14 @@ public class RitiProtocolDecoder extends BaseProtocolDecoder { position.set("mode", buf.readUnsignedByte()); position.set("command", buf.readUnsignedByte()); - position.set(Position.KEY_POWER, buf.readUnsignedShort()); + position.set(Position.KEY_POWER, buf.readUnsignedShort()); // mV - buf.skipBytes(5); - buf.readUnsignedShort(); - buf.readUnsignedShort(); + buf.skipBytes(5); // status + buf.readUnsignedShort(); // idleCount + buf.readUnsignedShort(); // idleTime in seconds - position.set(Position.KEY_DISTANCE, buf.readUnsignedInt()); - position.set(Position.KEY_ODOMETER_TRIP, buf.readUnsignedInt()); + position.set(Position.KEY_DISTANCE, buf.readUnsignedInt()); // meters + position.set(Position.KEY_ODOMETER_TRIP, buf.readUnsignedInt()); // meters // Parse GPRMC int end = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) '*'); -- cgit v1.2.3 From 64b173bbd5d8eb001bcf70ad3a5b469d57e7bba7 Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Sat, 25 Feb 2017 22:05:15 -0500 Subject: Recorded additional information in NavigilProtocol; --- src/org/traccar/protocol/NavigilProtocolDecoder.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/org/traccar/protocol/NavigilProtocolDecoder.java b/src/org/traccar/protocol/NavigilProtocolDecoder.java index 1aecdee55..e0db3d92b 100644 --- a/src/org/traccar/protocol/NavigilProtocolDecoder.java +++ b/src/org/traccar/protocol/NavigilProtocolDecoder.java @@ -102,8 +102,8 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { position.setSpeed(buf.readUnsignedShort() * 0.194384); position.setCourse(buf.readUnsignedShort()); - position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); // distance - buf.readUnsignedInt(); // delta distance + position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); // distance in meters + position.set(Position.KEY_DISTANCE, buf.readUnsignedInt()); // delta distance in meters position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001); @@ -140,8 +140,8 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { position.setCourse(buf.readUnsignedShort()); position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); // distance - buf.readUnsignedShort(); // maximum speed - buf.readUnsignedShort(); // minimum speed + position.set("maximumSpeed", buf.readUnsignedShort()); // maximum speed + position.set("minimumSpeed", buf.readUnsignedShort()); // minimum speed position.set(Position.PREFIX_IO + 1, buf.readUnsignedShort()); // VSAUT1 voltage position.set(Position.PREFIX_IO + 2, buf.readUnsignedShort()); // VSAUT2 voltage @@ -228,8 +228,8 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { position.setSpeed(buf.readUnsignedShort() * 0.194384); position.setCourse(buf.readUnsignedShort() * 0.1); - buf.readUnsignedByte(); // maximum speed - buf.readUnsignedByte(); // minimum speed + position.set("maximumSpeed", buf.readUnsignedByte()); // maximum speed + position.set("minimumSpeed", buf.readUnsignedByte()); // minimum speed position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); // distance position.set(Position.PREFIX_IO + 1, buf.readUnsignedByte()); // supply voltage 1 -- cgit v1.2.3 From 942a6e42ab3c86b95df64f7c6d4884f4a308bff1 Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Sat, 4 Mar 2017 16:37:49 -0500 Subject: Replaced hardcoded "pdop" with Position.KEY_PDOP; --- src/org/traccar/protocol/GranitProtocolDecoder.java | 2 +- src/org/traccar/protocol/TotemProtocolDecoder.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/org/traccar/protocol/GranitProtocolDecoder.java b/src/org/traccar/protocol/GranitProtocolDecoder.java index 6e8bc24bf..7518eee1f 100644 --- a/src/org/traccar/protocol/GranitProtocolDecoder.java +++ b/src/org/traccar/protocol/GranitProtocolDecoder.java @@ -89,7 +89,7 @@ public class GranitProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_SATELLITES, BitUtil.from(satDel, 4)); int pdop = BitUtil.to(satDel, 4); - position.set("pdop", pdop); + position.set(Position.KEY_PDOP, pdop); int lonDegrees = buf.readUnsignedByte(); int latDegrees = buf.readUnsignedByte(); diff --git a/src/org/traccar/protocol/TotemProtocolDecoder.java b/src/org/traccar/protocol/TotemProtocolDecoder.java index f36ef8143..67a1d1213 100644 --- a/src/org/traccar/protocol/TotemProtocolDecoder.java +++ b/src/org/traccar/protocol/TotemProtocolDecoder.java @@ -289,7 +289,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_SATELLITES, parser.next()); position.setCourse(parser.nextDouble()); position.setSpeed(parser.nextDouble()); - position.set("pdop", parser.next()); + position.set(Position.KEY_PDOP, parser.next()); position.set(Position.KEY_ODOMETER, parser.nextInt() * 1000); position.setLatitude(parser.nextCoordinate()); -- cgit v1.2.3 From aa1668df74c2d3c9a5d624d571f95bc110ad5414 Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Sat, 4 Mar 2017 16:51:03 -0500 Subject: Recorded additional information in Aplicom protocol; --- src/org/traccar/protocol/AplicomProtocolDecoder.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java index d7f77a40e..f98ca61a9 100644 --- a/src/org/traccar/protocol/AplicomProtocolDecoder.java +++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java @@ -437,13 +437,13 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { } position.set(Position.KEY_VERSION_FW, buf.readUnsignedByte()); // version - buf.readUnsignedShort(); // event - buf.readUnsignedByte(); // data validity - buf.readUnsignedByte(); // towed + position.set(Position.KEY_EVENT, buf.readUnsignedShort()); // event + position.set("dataValidity", buf.readUnsignedByte()); // data validity + position.set("towed", buf.readUnsignedByte()); // towed buf.readUnsignedShort(); // length while (buf.readableBytes() > 0) { - buf.readUnsignedByte(); // towed position + position.set("towedPosition", buf.readUnsignedByte()); int type = buf.readUnsignedByte(); int length = buf.readUnsignedByte(); @@ -526,7 +526,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { if ((selector & 0x0020) != 0) { position.set(Position.KEY_HOURS, buf.readUnsignedInt()); position.set("serviceDistance", buf.readInt()); - buf.readUnsignedByte(); // driver activity + position.set("driverActivity", buf.readUnsignedByte()); position.set(Position.KEY_THROTTLE, buf.readUnsignedByte()); position.set(Position.KEY_FUEL_LEVEL, buf.readUnsignedByte()); } @@ -547,10 +547,10 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { } if ((selector & 0x0200) != 0) { - buf.readUnsignedByte(); // tachograph based speed - buf.readUnsignedByte(); // driver 1 state - buf.readUnsignedByte(); // driver 2 state - buf.readUnsignedByte(); // tachograph status + position.set("tachographSpeed", buf.readUnsignedByte()); + position.set("driver1State", buf.readUnsignedByte()); + position.set("driver2State", buf.readUnsignedByte()); + position.set("tachographStatus", buf.readUnsignedByte()); position.set("overspeedCount", buf.readUnsignedByte()); } -- cgit v1.2.3 From 525db3566a9e17f626d34e498c85e02d382d6655 Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Sat, 4 Mar 2017 17:15:40 -0500 Subject: Added Position.KEY_COMMAND; --- src/org/traccar/model/Position.java | 1 + src/org/traccar/protocol/CarTrackProtocolDecoder.java | 2 +- src/org/traccar/protocol/EasyTrackProtocolDecoder.java | 2 +- src/org/traccar/protocol/Gt06ProtocolDecoder.java | 3 ++- src/org/traccar/protocol/RitiProtocolDecoder.java | 2 +- src/org/traccar/protocol/SupermateProtocolDecoder.java | 2 +- src/org/traccar/protocol/TeltonikaProtocolDecoder.java | 2 +- 7 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java index 409b49ccb..218b8a4e8 100644 --- a/src/org/traccar/model/Position.java +++ b/src/org/traccar/model/Position.java @@ -62,6 +62,7 @@ public class Position extends Message { public static final String KEY_ACCELERATION = "acceleration"; public static final String KEY_DEVICE_TEMP = "deviceTemp"; public static final String KEY_OPERATOR = "operator"; + public static final String KEY_COMMAND = "command"; public static final String KEY_DTCS = "dtcs"; public static final String KEY_OBD_SPEED = "obdSpeed"; diff --git a/src/org/traccar/protocol/CarTrackProtocolDecoder.java b/src/org/traccar/protocol/CarTrackProtocolDecoder.java index 94f5d208b..0952a0978 100644 --- a/src/org/traccar/protocol/CarTrackProtocolDecoder.java +++ b/src/org/traccar/protocol/CarTrackProtocolDecoder.java @@ -74,7 +74,7 @@ public class CarTrackProtocolDecoder extends BaseProtocolDecoder { } position.setDeviceId(deviceSession.getDeviceId()); - position.set("command", parser.next()); + position.set(Position.KEY_COMMAND, parser.next()); DateBuilder dateBuilder = new DateBuilder() .setTime(parser.nextInt(), parser.nextInt(), parser.nextInt(), parser.nextInt()); diff --git a/src/org/traccar/protocol/EasyTrackProtocolDecoder.java b/src/org/traccar/protocol/EasyTrackProtocolDecoder.java index 688629063..c4baad5ab 100644 --- a/src/org/traccar/protocol/EasyTrackProtocolDecoder.java +++ b/src/org/traccar/protocol/EasyTrackProtocolDecoder.java @@ -77,7 +77,7 @@ public class EasyTrackProtocolDecoder extends BaseProtocolDecoder { } position.setDeviceId(deviceSession.getDeviceId()); - position.set("command", parser.next()); + position.set(Position.KEY_COMMAND, parser.next()); position.setValid(parser.next().equals("A")); diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java index 356097fb2..bbba639c1 100644 --- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -264,7 +264,8 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { if (commandLength > 0) { buf.readUnsignedByte(); // server flag (reserved) - position.set("command", buf.readBytes(commandLength - 1).toString(StandardCharsets.US_ASCII)); + position.set(Position.KEY_COMMAND, + buf.readBytes(commandLength - 1).toString(StandardCharsets.US_ASCII)); } } else if (isSupported(type)) { diff --git a/src/org/traccar/protocol/RitiProtocolDecoder.java b/src/org/traccar/protocol/RitiProtocolDecoder.java index 26aeb40f3..7f81ef09c 100644 --- a/src/org/traccar/protocol/RitiProtocolDecoder.java +++ b/src/org/traccar/protocol/RitiProtocolDecoder.java @@ -66,7 +66,7 @@ public class RitiProtocolDecoder extends BaseProtocolDecoder { position.setDeviceId(deviceSession.getDeviceId()); position.set("mode", buf.readUnsignedByte()); - position.set("command", buf.readUnsignedByte()); + position.set(Position.KEY_COMMAND, buf.readUnsignedByte()); position.set(Position.KEY_POWER, buf.readUnsignedShort()); // mV buf.skipBytes(5); // status diff --git a/src/org/traccar/protocol/SupermateProtocolDecoder.java b/src/org/traccar/protocol/SupermateProtocolDecoder.java index 7f12121bb..5e6615e9f 100755 --- a/src/org/traccar/protocol/SupermateProtocolDecoder.java +++ b/src/org/traccar/protocol/SupermateProtocolDecoder.java @@ -82,7 +82,7 @@ public class SupermateProtocolDecoder extends BaseProtocolDecoder { position.setDeviceId(deviceSession.getDeviceId()); position.set("commandId", parser.next()); - position.set("command", parser.next()); + position.set(Position.KEY_COMMAND, parser.next()); position.setValid(parser.next().equals("A")); diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java index 77211b7ab..e55d354cf 100644 --- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java +++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java @@ -67,7 +67,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_TYPE, buf.readUnsignedByte()); - position.set("command", buf.readBytes(buf.readInt()).toString(StandardCharsets.US_ASCII)); + position.set(Position.KEY_COMMAND, buf.readBytes(buf.readInt()).toString(StandardCharsets.US_ASCII)); } -- cgit v1.2.3 From f7da653ee14f471cf3d482690e7c659297514ab9 Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Sat, 4 Mar 2017 22:42:20 -0500 Subject: Removed old comments that have been made redundant, as requested; --- src/org/traccar/protocol/AdmProtocolDecoder.java | 4 +-- .../traccar/protocol/AplicomProtocolDecoder.java | 10 +++--- .../traccar/protocol/ArknavX8ProtocolDecoder.java | 2 +- .../traccar/protocol/AtrackProtocolDecoder.java | 4 +-- .../traccar/protocol/AutoFonProtocolDecoder.java | 2 +- .../traccar/protocol/CarcellProtocolDecoder.java | 6 ++-- .../traccar/protocol/CastelProtocolDecoder.java | 8 ++--- .../protocol/CellocatorProtocolDecoder.java | 22 ++++++------ .../traccar/protocol/EelinkProtocolDecoder.java | 2 +- .../traccar/protocol/FifotrackProtocolDecoder.java | 2 +- src/org/traccar/protocol/IdplProtocolDecoder.java | 6 ++-- src/org/traccar/protocol/Mta6ProtocolDecoder.java | 2 +- src/org/traccar/protocol/MxtProtocolDecoder.java | 2 +- .../traccar/protocol/NavigilProtocolDecoder.java | 42 +++++++++++----------- .../traccar/protocol/PricolProtocolDecoder.java | 14 ++++---- src/org/traccar/protocol/RitiProtocolDecoder.java | 6 ++-- .../traccar/protocol/SkypatrolProtocolDecoder.java | 8 ++--- .../traccar/protocol/SmokeyProtocolDecoder.java | 2 +- .../traccar/protocol/TrakMateProtocolDecoder.java | 16 ++++----- .../traccar/protocol/TramigoProtocolDecoder.java | 12 +++---- src/org/traccar/protocol/TzoneProtocolDecoder.java | 8 ++--- 21 files changed, 89 insertions(+), 91 deletions(-) (limited to 'src') diff --git a/src/org/traccar/protocol/AdmProtocolDecoder.java b/src/org/traccar/protocol/AdmProtocolDecoder.java index a69743222..f4a21cad0 100644 --- a/src/org/traccar/protocol/AdmProtocolDecoder.java +++ b/src/org/traccar/protocol/AdmProtocolDecoder.java @@ -66,7 +66,7 @@ public class AdmProtocolDecoder extends BaseProtocolDecoder { position.setProtocol(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); - position.set(Position.KEY_VERSION_FW, buf.readUnsignedByte()); // firmware version + position.set(Position.KEY_VERSION_FW, buf.readUnsignedByte()); buf.readUnsignedShort(); // index position.set(Position.KEY_STATUS, buf.readUnsignedShort()); @@ -77,7 +77,7 @@ public class AdmProtocolDecoder extends BaseProtocolDecoder { position.setCourse(buf.readUnsignedShort() * 0.1); position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShort() * 0.1)); - position.set(Position.KEY_ACCELERATION, buf.readUnsignedByte()); // acceleration + position.set(Position.KEY_ACCELERATION, buf.readUnsignedByte()); position.setAltitude(buf.readUnsignedShort()); diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java index f98ca61a9..93882cd4a 100644 --- a/src/org/traccar/protocol/AplicomProtocolDecoder.java +++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java @@ -120,7 +120,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { private void decodeCanData(ChannelBuffer buf, Position position) { buf.readUnsignedMedium(); // packet identifier - position.set(Position.KEY_VERSION_FW, buf.readUnsignedByte()); // version + position.set(Position.KEY_VERSION_FW, buf.readUnsignedByte()); int count = buf.readUnsignedByte(); buf.readUnsignedByte(); // batch count buf.readUnsignedShort(); // selector bit @@ -436,10 +436,10 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { return; } - position.set(Position.KEY_VERSION_FW, buf.readUnsignedByte()); // version - position.set(Position.KEY_EVENT, buf.readUnsignedShort()); // event - position.set("dataValidity", buf.readUnsignedByte()); // data validity - position.set("towed", buf.readUnsignedByte()); // towed + position.set(Position.KEY_VERSION_FW, buf.readUnsignedByte()); + position.set(Position.KEY_EVENT, buf.readUnsignedShort()); + position.set("dataValidity", buf.readUnsignedByte()); + position.set("towed", buf.readUnsignedByte()); buf.readUnsignedShort(); // length while (buf.readableBytes() > 0) { diff --git a/src/org/traccar/protocol/ArknavX8ProtocolDecoder.java b/src/org/traccar/protocol/ArknavX8ProtocolDecoder.java index 33d204de1..24c155c84 100644 --- a/src/org/traccar/protocol/ArknavX8ProtocolDecoder.java +++ b/src/org/traccar/protocol/ArknavX8ProtocolDecoder.java @@ -70,7 +70,7 @@ public class ArknavX8ProtocolDecoder extends BaseProtocolDecoder { position.setProtocol(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); - position.set(Position.KEY_TYPE, parser.next()); // type + position.set(Position.KEY_TYPE, parser.next()); DateBuilder dateBuilder = new DateBuilder() .setDate(parser.nextInt(), parser.nextInt(), parser.nextInt()) diff --git a/src/org/traccar/protocol/AtrackProtocolDecoder.java b/src/org/traccar/protocol/AtrackProtocolDecoder.java index 8e9d051f4..8e444102e 100644 --- a/src/org/traccar/protocol/AtrackProtocolDecoder.java +++ b/src/org/traccar/protocol/AtrackProtocolDecoder.java @@ -122,7 +122,7 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_RPM, buf.readUnsignedShort()); break; case "GS": - position.set(Position.KEY_RSSI, buf.readUnsignedByte()); // gsm status + position.set(Position.KEY_RSSI, buf.readUnsignedByte()); break; case "DT": position.set(Position.KEY_ARCHIVE, buf.readUnsignedByte() == 1); @@ -149,7 +149,7 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedByte(); // mil status break; case "FC": - position.set(Position.KEY_FUEL_CONSUMPTION, buf.readUnsignedInt()); // fuel used + position.set(Position.KEY_FUEL_CONSUMPTION, buf.readUnsignedInt()); break; case "CI": readString(buf); // format string diff --git a/src/org/traccar/protocol/AutoFonProtocolDecoder.java b/src/org/traccar/protocol/AutoFonProtocolDecoder.java index 9a62a353e..32b4bfa74 100644 --- a/src/org/traccar/protocol/AutoFonProtocolDecoder.java +++ b/src/org/traccar/protocol/AutoFonProtocolDecoder.java @@ -70,7 +70,7 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedByte(); // interval buf.skipBytes(8); // settings } - position.set(Position.KEY_STATUS, buf.readUnsignedByte()); // status + position.set(Position.KEY_STATUS, buf.readUnsignedByte()); if (!history) { buf.readUnsignedShort(); } diff --git a/src/org/traccar/protocol/CarcellProtocolDecoder.java b/src/org/traccar/protocol/CarcellProtocolDecoder.java index feec7a83c..70e99558e 100644 --- a/src/org/traccar/protocol/CarcellProtocolDecoder.java +++ b/src/org/traccar/protocol/CarcellProtocolDecoder.java @@ -127,7 +127,7 @@ public class CarcellProtocolDecoder extends BaseProtocolDecoder { position.set("jamming", parser.next().equals("1")); position.set(Position.KEY_GPS, parser.nextInt()); - position.set("clockType", parser.next()); // clock type + position.set("clockType", parser.next()); DateBuilder dateBuilder = new DateBuilder(). setDateReverse(parser.nextInt(), parser.nextInt(), parser.nextInt()) @@ -140,7 +140,7 @@ public class CarcellProtocolDecoder extends BaseProtocolDecoder { if (parser.hasNext(4)) { position.set("cloned", parser.next().equals("1")); - position.set(Position.KEY_ALARM, parser.next()); // panic button status + position.set(Position.KEY_ALARM, parser.next()); String painelStatus = parser.next(); if (painelStatus.equals("1")) { @@ -154,7 +154,7 @@ public class CarcellProtocolDecoder extends BaseProtocolDecoder { if (parser.hasNext(5)) { position.set("timeUntilDelivery", parser.nextInt()); - position.set(Position.KEY_ALARM, parser.next()); // panic button status + position.set(Position.KEY_ALARM, parser.next()); position.set(Position.KEY_INPUT, parser.next()); // aux Double mainVoltage = parser.nextDouble() / 100d; diff --git a/src/org/traccar/protocol/CastelProtocolDecoder.java b/src/org/traccar/protocol/CastelProtocolDecoder.java index 52d7f4edb..83664fa5a 100644 --- a/src/org/traccar/protocol/CastelProtocolDecoder.java +++ b/src/org/traccar/protocol/CastelProtocolDecoder.java @@ -178,8 +178,8 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedInt(); // ACC ON time buf.readUnsignedInt(); // UTC time position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); - position.set(Position.KEY_ODOMETER_TRIP, buf.readUnsignedInt()); // trip odometer - position.set(Position.KEY_FUEL_CONSUMPTION, buf.readUnsignedInt()); // total fuel consumption + position.set(Position.KEY_ODOMETER_TRIP, buf.readUnsignedInt()); + position.set(Position.KEY_FUEL_CONSUMPTION, buf.readUnsignedInt()); buf.readUnsignedShort(); // current fuel consumption position.set(Position.KEY_STATUS, buf.readUnsignedInt()); buf.skipBytes(8); @@ -263,8 +263,8 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedInt(); // ACC ON time buf.readUnsignedInt(); // UTC time long odometer = buf.readUnsignedInt(); - long tripOdometer = buf.readUnsignedInt(); // trip odometer - long fuelConsumption = buf.readUnsignedInt(); // total fuel consumption + long tripOdometer = buf.readUnsignedInt(); + long fuelConsumption = buf.readUnsignedInt(); buf.readUnsignedShort(); // current fuel consumption long status = buf.readUnsignedInt(); buf.skipBytes(8); diff --git a/src/org/traccar/protocol/CellocatorProtocolDecoder.java b/src/org/traccar/protocol/CellocatorProtocolDecoder.java index ce43cce37..2b4fa9fb6 100644 --- a/src/org/traccar/protocol/CellocatorProtocolDecoder.java +++ b/src/org/traccar/protocol/CellocatorProtocolDecoder.java @@ -109,9 +109,9 @@ public class CellocatorProtocolDecoder extends BaseProtocolDecoder { } position.setDeviceId(deviceSession.getDeviceId()); - position.set(Position.KEY_VERSION_HW, buf.readUnsignedByte()); // hardware version - position.set(Position.KEY_VERSION_FW, buf.readUnsignedByte()); // software version - position.set("protocolVersion", buf.readUnsignedByte()); // protocol version + position.set(Position.KEY_VERSION_HW, buf.readUnsignedByte()); + position.set(Position.KEY_VERSION_FW, buf.readUnsignedByte()); + position.set("protocolVersion", buf.readUnsignedByte()); position.set(Position.KEY_STATUS, buf.getUnsignedByte(buf.readerIndex()) & 0x0f); @@ -121,21 +121,21 @@ public class CellocatorProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedByte(); // reason data position.set(Position.KEY_ALARM, decodeAlarm(buf.readUnsignedByte())); - position.set("mode", buf.readUnsignedByte()); // mode - position.set(Position.PREFIX_IO + 1, buf.readUnsignedInt()); // IO + position.set("mode", buf.readUnsignedByte()); + position.set(Position.PREFIX_IO + 1, buf.readUnsignedInt()); operator <<= 8; operator += buf.readUnsignedByte(); position.set(Position.KEY_OPERATOR, operator); - position.set(Position.PREFIX_ADC + 1, buf.readUnsignedInt()); // ADC - position.set(Position.KEY_ODOMETER, buf.readUnsignedMedium()); // Odometer + position.set(Position.PREFIX_ADC + 1, buf.readUnsignedInt()); + position.set(Position.KEY_ODOMETER, buf.readUnsignedMedium()); buf.skipBytes(6); // multi-purpose data - position.set(Position.KEY_GPS, buf.readUnsignedShort()); // gps fix - position.set("locationStatus", buf.readUnsignedByte()); // location status - position.set("mode1", buf.readUnsignedByte()); // mode 1 - position.set("mode2", buf.readUnsignedByte()); // mode 2 + position.set(Position.KEY_GPS, buf.readUnsignedShort()); + position.set("locationStatus", buf.readUnsignedByte()); + position.set("mode1", buf.readUnsignedByte()); + position.set("mode2", buf.readUnsignedByte()); position.set(Position.KEY_SATELLITES, buf.readUnsignedByte()); diff --git a/src/org/traccar/protocol/EelinkProtocolDecoder.java b/src/org/traccar/protocol/EelinkProtocolDecoder.java index 30ed5e2ef..0296d22fe 100644 --- a/src/org/traccar/protocol/EelinkProtocolDecoder.java +++ b/src/org/traccar/protocol/EelinkProtocolDecoder.java @@ -132,7 +132,7 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_BATTERY, buf.readUnsignedShort() + "mV"); - position.set(Position.KEY_RSSI, buf.readUnsignedShort()); // signal strength + position.set(Position.KEY_RSSI, buf.readUnsignedShort()); position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort()); position.set(Position.PREFIX_ADC + 2, buf.readUnsignedShort()); diff --git a/src/org/traccar/protocol/FifotrackProtocolDecoder.java b/src/org/traccar/protocol/FifotrackProtocolDecoder.java index d140e991f..995722fa7 100644 --- a/src/org/traccar/protocol/FifotrackProtocolDecoder.java +++ b/src/org/traccar/protocol/FifotrackProtocolDecoder.java @@ -83,7 +83,7 @@ public class FifotrackProtocolDecoder extends BaseProtocolDecoder { position.setProtocol(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); - position.set(Position.KEY_ALARM, parser.next()); // alarm + position.set(Position.KEY_ALARM, parser.next()); DateBuilder dateBuilder = new DateBuilder() .setDate(parser.nextInt(), parser.nextInt(), parser.nextInt()) diff --git a/src/org/traccar/protocol/IdplProtocolDecoder.java b/src/org/traccar/protocol/IdplProtocolDecoder.java index afc56a18d..6200f6131 100644 --- a/src/org/traccar/protocol/IdplProtocolDecoder.java +++ b/src/org/traccar/protocol/IdplProtocolDecoder.java @@ -94,14 +94,14 @@ public class IdplProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_SATELLITES, parser.nextInt()); position.set(Position.KEY_RSSI, parser.nextInt()); - position.set("vehicleStatus", parser.next()); // vehicle status + position.set("vehicleStatus", parser.next()); position.set(Position.KEY_POWER, parser.nextInt()); position.set(Position.KEY_BATTERY, parser.nextDouble()); if (parser.nextInt() == 1) { position.set(Position.KEY_ALARM, Position.ALARM_SOS); } - position.set("bodyTamper", parser.nextInt()); // body tamper - position.set("acStatus", parser.nextInt()); // ac status + position.set("bodyTamper", parser.nextInt()); + position.set("acStatus", parser.nextInt()); position.set(Position.KEY_IGNITION, parser.nextInt() == 1); position.set(Position.KEY_OUTPUT, parser.nextInt()); position.set(Position.PREFIX_ADC + 1, parser.nextInt()); diff --git a/src/org/traccar/protocol/Mta6ProtocolDecoder.java b/src/org/traccar/protocol/Mta6ProtocolDecoder.java index 35695e177..7f547f648 100644 --- a/src/org/traccar/protocol/Mta6ProtocolDecoder.java +++ b/src/org/traccar/protocol/Mta6ProtocolDecoder.java @@ -182,7 +182,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder { if (BitUtil.check(flags, 7)) { position.set(Position.KEY_BATTERY, buf.getUnsignedByte(buf.readerIndex()) >> 2); position.set(Position.KEY_POWER, buf.readUnsignedShort() & 0x03ff); - position.set("microcontrollerTemperature", buf.readByte()); // microcontroller temperature + position.set("microcontrollerTemperature", buf.readByte()); position.set(Position.KEY_RSSI, (buf.getUnsignedByte(buf.readerIndex()) >> 4) & 0x07); diff --git a/src/org/traccar/protocol/MxtProtocolDecoder.java b/src/org/traccar/protocol/MxtProtocolDecoder.java index b0b587be3..49987ce57 100644 --- a/src/org/traccar/protocol/MxtProtocolDecoder.java +++ b/src/org/traccar/protocol/MxtProtocolDecoder.java @@ -137,7 +137,7 @@ public class MxtProtocolDecoder extends BaseProtocolDecoder { position.setAccuracy(buf.readUnsignedByte()); position.set(Position.KEY_RSSI, buf.readUnsignedByte()); buf.readUnsignedShort(); // time since boot - position.set(Position.KEY_POWER, buf.readUnsignedByte()); // input voltage + position.set(Position.KEY_POWER, buf.readUnsignedByte()); position.set(Position.PREFIX_TEMP + 1, buf.readByte()); } diff --git a/src/org/traccar/protocol/NavigilProtocolDecoder.java b/src/org/traccar/protocol/NavigilProtocolDecoder.java index e0db3d92b..360b9c81c 100644 --- a/src/org/traccar/protocol/NavigilProtocolDecoder.java +++ b/src/org/traccar/protocol/NavigilProtocolDecoder.java @@ -89,25 +89,25 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { position.setDeviceId(deviceSession.getDeviceId()); buf.readUnsignedShort(); // report trigger - position.set(Position.KEY_FLAGS, buf.readUnsignedShort()); // flags + position.set(Position.KEY_FLAGS, buf.readUnsignedShort()); position.setLatitude(buf.readInt() * 0.0000001); position.setLongitude(buf.readInt() * 0.0000001); position.setAltitude(buf.readUnsignedShort()); - position.set(Position.KEY_SATELLITES, buf.readUnsignedShort()); // satellites in fix - position.set(Position.KEY_SATELLITES_VISIBLE, buf.readUnsignedShort()); // satellites in track - position.set("gpsAntennaState", buf.readUnsignedShort()); // GPS antenna state + position.set(Position.KEY_SATELLITES, buf.readUnsignedShort()); + position.set(Position.KEY_SATELLITES_VISIBLE, buf.readUnsignedShort()); + position.set("gpsAntennaState", buf.readUnsignedShort()); position.setSpeed(buf.readUnsignedShort() * 0.194384); position.setCourse(buf.readUnsignedShort()); - position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); // distance in meters - position.set(Position.KEY_DISTANCE, buf.readUnsignedInt()); // delta distance in meters + position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); + position.set(Position.KEY_DISTANCE, buf.readUnsignedInt()); position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001); - position.set(Position.KEY_CHARGE, buf.readUnsignedShort()); // battery charger status + position.set(Position.KEY_CHARGE, buf.readUnsignedShort()); position.setTime(convertTimestamp(buf.readUnsignedInt())); @@ -133,15 +133,15 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { position.setLongitude(buf.readInt() * 0.0000001); position.setAltitude(buf.readUnsignedShort()); - position.set(Position.KEY_SATELLITES, buf.readUnsignedByte()); // satellites in fix - position.set(Position.KEY_SATELLITES_VISIBLE, buf.readUnsignedByte()); // satellites in track + position.set(Position.KEY_SATELLITES, buf.readUnsignedByte()); + position.set(Position.KEY_SATELLITES_VISIBLE, buf.readUnsignedByte()); position.setSpeed(buf.readUnsignedShort() * 0.194384); position.setCourse(buf.readUnsignedShort()); - position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); // distance - position.set("maximumSpeed", buf.readUnsignedShort()); // maximum speed - position.set("minimumSpeed", buf.readUnsignedShort()); // minimum speed + position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); + position.set("maximumSpeed", buf.readUnsignedShort()); + position.set("minimumSpeed", buf.readUnsignedShort()); position.set(Position.PREFIX_IO + 1, buf.readUnsignedShort()); // VSAUT1 voltage position.set(Position.PREFIX_IO + 2, buf.readUnsignedShort()); // VSAUT2 voltage @@ -195,7 +195,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { position.setValid((flags & 0x80) == 0x80 && (flags & 0x40) == 0x40); position.set(Position.KEY_SATELLITES, buf.readUnsignedByte()); - position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); // distance + position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); return position; } @@ -222,15 +222,15 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { position.setLongitude(buf.readInt() * 0.0000001); position.setAltitude(buf.readUnsignedShort()); - position.set(Position.KEY_SATELLITES, buf.readUnsignedByte()); // satellites in fix - position.set(Position.KEY_SATELLITES_VISIBLE, buf.readUnsignedByte()); // satellites in track + position.set(Position.KEY_SATELLITES, buf.readUnsignedByte()); + position.set(Position.KEY_SATELLITES_VISIBLE, buf.readUnsignedByte()); position.setSpeed(buf.readUnsignedShort() * 0.194384); position.setCourse(buf.readUnsignedShort() * 0.1); - position.set("maximumSpeed", buf.readUnsignedByte()); // maximum speed - position.set("minimumSpeed", buf.readUnsignedByte()); // minimum speed - position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); // distance + position.set("maximumSpeed", buf.readUnsignedByte()); + position.set("minimumSpeed", buf.readUnsignedByte()); + position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); position.set(Position.PREFIX_IO + 1, buf.readUnsignedByte()); // supply voltage 1 position.set(Position.PREFIX_IO + 2, buf.readUnsignedByte()); // supply voltage 2 @@ -261,11 +261,9 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedByte())); position.setCourse(buf.readUnsignedByte() * 2.0); - position.set(Position.KEY_SATELLITES, buf.readUnsignedByte()); // satellites in fix - + position.set(Position.KEY_SATELLITES, buf.readUnsignedByte()); position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001); - - position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); // distance + position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); return position; } diff --git a/src/org/traccar/protocol/PricolProtocolDecoder.java b/src/org/traccar/protocol/PricolProtocolDecoder.java index 6d275d4c0..a33e19b90 100644 --- a/src/org/traccar/protocol/PricolProtocolDecoder.java +++ b/src/org/traccar/protocol/PricolProtocolDecoder.java @@ -51,11 +51,11 @@ public class PricolProtocolDecoder extends BaseProtocolDecoder { position.setProtocol(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); - position.set("eventType", buf.readUnsignedByte()); // event type - position.set("packetVersion", buf.readUnsignedByte()); // packet version - position.set(Position.KEY_STATUS, buf.readUnsignedByte()); // device status - position.set(Position.KEY_RSSI, buf.readUnsignedByte()); // gsm status - position.set(Position.KEY_GPS, buf.readUnsignedByte()); // gps status + position.set("eventType", buf.readUnsignedByte()); + position.set("packetVersion", buf.readUnsignedByte()); + position.set(Position.KEY_STATUS, buf.readUnsignedByte()); + position.set(Position.KEY_RSSI, buf.readUnsignedByte()); + position.set(Position.KEY_GPS, buf.readUnsignedByte()); position.setTime(new DateBuilder() .setDateReverse(buf.readUnsignedByte(), buf.readUnsignedByte(), buf.readUnsignedByte()) @@ -76,8 +76,8 @@ public class PricolProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_INPUT, buf.readUnsignedShort()); position.set(Position.KEY_OUTPUT, buf.readUnsignedByte()); - position.set("analogAlerts", buf.readUnsignedByte()); // analog alerts - position.set("customAlertTypes", buf.readUnsignedShort()); // custom alert types + position.set("analogAlerts", buf.readUnsignedByte()); + position.set("customAlertTypes", buf.readUnsignedShort()); for (int i = 1; i <= 5; i++) { position.set(Position.PREFIX_ADC + i, buf.readUnsignedShort()); diff --git a/src/org/traccar/protocol/RitiProtocolDecoder.java b/src/org/traccar/protocol/RitiProtocolDecoder.java index 7f81ef09c..bbd176b38 100644 --- a/src/org/traccar/protocol/RitiProtocolDecoder.java +++ b/src/org/traccar/protocol/RitiProtocolDecoder.java @@ -67,14 +67,14 @@ public class RitiProtocolDecoder extends BaseProtocolDecoder { position.set("mode", buf.readUnsignedByte()); position.set(Position.KEY_COMMAND, buf.readUnsignedByte()); - position.set(Position.KEY_POWER, buf.readUnsignedShort()); // mV + position.set(Position.KEY_POWER, buf.readUnsignedShort()); buf.skipBytes(5); // status buf.readUnsignedShort(); // idleCount buf.readUnsignedShort(); // idleTime in seconds - position.set(Position.KEY_DISTANCE, buf.readUnsignedInt()); // meters - position.set(Position.KEY_ODOMETER_TRIP, buf.readUnsignedInt()); // meters + position.set(Position.KEY_DISTANCE, buf.readUnsignedInt()); + position.set(Position.KEY_ODOMETER_TRIP, buf.readUnsignedInt()); // Parse GPRMC int end = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) '*'); diff --git a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java index 56b53cb38..345c1aea3 100644 --- a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java +++ b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java @@ -92,15 +92,15 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder { position.setDeviceId(deviceSession.getDeviceId()); if (BitUtil.check(mask, 3)) { - position.set(Position.PREFIX_IO + 1, buf.readUnsignedShort()); // io data + position.set(Position.PREFIX_IO + 1, buf.readUnsignedShort()); } if (BitUtil.check(mask, 4)) { - position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort()); // adc 1 + position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort()); } if (BitUtil.check(mask, 5)) { - position.set(Position.PREFIX_ADC + 2, buf.readUnsignedShort()); // adc 2 + position.set(Position.PREFIX_ADC + 2, buf.readUnsignedShort()); } if (BitUtil.check(mask, 7)) { @@ -150,7 +150,7 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder { } if (BitUtil.check(mask, 17)) { - position.set(Position.KEY_BATTERY, buf.readUnsignedShort()); // battery percentage + position.set(Position.KEY_BATTERY, buf.readUnsignedShort()); } if (BitUtil.check(mask, 20)) { diff --git a/src/org/traccar/protocol/SmokeyProtocolDecoder.java b/src/org/traccar/protocol/SmokeyProtocolDecoder.java index 6ac92f158..2dcfeb86f 100644 --- a/src/org/traccar/protocol/SmokeyProtocolDecoder.java +++ b/src/org/traccar/protocol/SmokeyProtocolDecoder.java @@ -88,7 +88,7 @@ public class SmokeyProtocolDecoder extends BaseProtocolDecoder { position.setProtocol(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); - position.set(Position.KEY_VERSION_FW, buf.readUnsignedShort()); // firmware version + position.set(Position.KEY_VERSION_FW, buf.readUnsignedShort()); int status = buf.readUnsignedShort(); position.set(Position.KEY_STATUS, status); diff --git a/src/org/traccar/protocol/TrakMateProtocolDecoder.java b/src/org/traccar/protocol/TrakMateProtocolDecoder.java index c9aa9ea42..95eef67c8 100644 --- a/src/org/traccar/protocol/TrakMateProtocolDecoder.java +++ b/src/org/traccar/protocol/TrakMateProtocolDecoder.java @@ -126,7 +126,7 @@ public class TrakMateProtocolDecoder extends BaseProtocolDecoder { position.setTime(dateBuilder.getDate()); position.set(Position.KEY_VERSION_FW, parser.next()); - position.set(Position.KEY_VERSION_HW, parser.next()); // hardware version + position.set(Position.KEY_VERSION_HW, parser.next()); return position; } @@ -195,13 +195,13 @@ public class TrakMateProtocolDecoder extends BaseProtocolDecoder { position.setCourse(parser.nextDouble()); position.set(Position.KEY_IGNITION, parser.nextInt() == 1); - position.set("dop1", parser.next()); // dop1 - position.set("dop2", parser.next()); // dop2 - position.set(Position.KEY_INPUT, parser.next()); // analog input - position.set(Position.KEY_BATTERY, parser.nextDouble()); // device battery voltage - position.set(Position.KEY_POWER, parser.next()); // vehicle internal voltage - position.set(Position.KEY_ODOMETER, parser.nextDouble()); // gps odometer - position.set("pulseOdometer", parser.next()); // pulse odometer + position.set("dop1", parser.next()); + position.set("dop2", parser.next()); + position.set(Position.KEY_INPUT, parser.next()); + position.set(Position.KEY_BATTERY, parser.nextDouble()); + position.set(Position.KEY_POWER, parser.next()); + position.set(Position.KEY_ODOMETER, parser.nextDouble()); + position.set("pulseOdometer", parser.next()); position.set(Position.KEY_STATUS, parser.nextInt()); position.setValid(parser.nextInt() != 0); diff --git a/src/org/traccar/protocol/TramigoProtocolDecoder.java b/src/org/traccar/protocol/TramigoProtocolDecoder.java index 8e14debd4..8a6f49ef0 100644 --- a/src/org/traccar/protocol/TramigoProtocolDecoder.java +++ b/src/org/traccar/protocol/TramigoProtocolDecoder.java @@ -82,19 +82,19 @@ public class TramigoProtocolDecoder extends BaseProtocolDecoder { position.setLatitude(buf.readUnsignedInt() * 0.0000001); position.setLongitude(buf.readUnsignedInt() * 0.0000001); - position.set(Position.KEY_RSSI, buf.readUnsignedShort()); // GSM signal quality - position.set(Position.KEY_SATELLITES, buf.readUnsignedShort()); // satellites in fix - position.set(Position.KEY_SATELLITES_VISIBLE, buf.readUnsignedShort()); // satellites in track - position.set("gpsAntennaStatus", buf.readUnsignedShort()); // GPS antenna state + position.set(Position.KEY_RSSI, buf.readUnsignedShort()); + position.set(Position.KEY_SATELLITES, buf.readUnsignedShort()); + position.set(Position.KEY_SATELLITES_VISIBLE, buf.readUnsignedShort()); + position.set("gpsAntennaStatus", buf.readUnsignedShort()); position.setSpeed(buf.readUnsignedShort() * 0.194384); position.setCourse((double) buf.readUnsignedShort()); - position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); // distance + position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); position.set(Position.KEY_BATTERY, buf.readUnsignedShort()); - position.set(Position.KEY_CHARGE, buf.readUnsignedShort()); // battery charger status + position.set(Position.KEY_CHARGE, buf.readUnsignedShort()); position.setTime(new Date(buf.readUnsignedInt() * 1000)); diff --git a/src/org/traccar/protocol/TzoneProtocolDecoder.java b/src/org/traccar/protocol/TzoneProtocolDecoder.java index 7dc158579..69aa916df 100644 --- a/src/org/traccar/protocol/TzoneProtocolDecoder.java +++ b/src/org/traccar/protocol/TzoneProtocolDecoder.java @@ -119,8 +119,8 @@ public class TzoneProtocolDecoder extends BaseProtocolDecoder { if (buf.readUnsignedShort() != 0x2424) { return null; } - int hardware = buf.readUnsignedShort(); // model - long firmware = buf.readUnsignedInt(); // firmware + int hardware = buf.readUnsignedShort(); + long firmware = buf.readUnsignedInt(); String imei = ChannelBuffers.hexDump(buf.readBytes(8)).substring(1); DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, imei); @@ -202,10 +202,10 @@ public class TzoneProtocolDecoder extends BaseProtocolDecoder { if (blockLength >= 13) { position.set(Position.KEY_ALARM, decodeAlarm(buf.readUnsignedByte())); - position.set("terminalInfo", buf.readUnsignedByte()); // terminal info + position.set("terminalInfo", buf.readUnsignedByte()); position.set(Position.PREFIX_IO + 1, buf.readUnsignedShort()); position.set(Position.KEY_RSSI, buf.readUnsignedByte()); - position.set("gsmStatus", buf.readUnsignedByte()); // GSM status + position.set("gsmStatus", buf.readUnsignedByte()); position.set(Position.KEY_BATTERY, buf.readUnsignedShort()); position.set(Position.KEY_POWER, buf.readUnsignedShort()); position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort()); -- cgit v1.2.3 From 43e94cb2c59fb57a1eef5e9cbc63cd702a8dfab3 Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Sat, 4 Mar 2017 22:59:00 -0500 Subject: Reverted processing of panic button status in CarcellProtocol; --- src/org/traccar/protocol/CarcellProtocolDecoder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/org/traccar/protocol/CarcellProtocolDecoder.java b/src/org/traccar/protocol/CarcellProtocolDecoder.java index 70e99558e..3d1ceff2c 100644 --- a/src/org/traccar/protocol/CarcellProtocolDecoder.java +++ b/src/org/traccar/protocol/CarcellProtocolDecoder.java @@ -140,7 +140,7 @@ public class CarcellProtocolDecoder extends BaseProtocolDecoder { if (parser.hasNext(4)) { position.set("cloned", parser.next().equals("1")); - position.set(Position.KEY_ALARM, parser.next()); + parser.next(); // panic button status String painelStatus = parser.next(); if (painelStatus.equals("1")) { @@ -154,7 +154,7 @@ public class CarcellProtocolDecoder extends BaseProtocolDecoder { if (parser.hasNext(5)) { position.set("timeUntilDelivery", parser.nextInt()); - position.set(Position.KEY_ALARM, parser.next()); + parser.next(); // panic button status position.set(Position.KEY_INPUT, parser.next()); // aux Double mainVoltage = parser.nextDouble() / 100d; -- cgit v1.2.3 From 55dfb77d4e9fdf749d5310531d9ec44711048c34 Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Sat, 4 Mar 2017 23:09:13 -0500 Subject: Reverted code for "body tamper" in IdplProtocol; --- src/org/traccar/protocol/IdplProtocolDecoder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/org/traccar/protocol/IdplProtocolDecoder.java b/src/org/traccar/protocol/IdplProtocolDecoder.java index 6200f6131..5e3638d8e 100644 --- a/src/org/traccar/protocol/IdplProtocolDecoder.java +++ b/src/org/traccar/protocol/IdplProtocolDecoder.java @@ -100,7 +100,7 @@ public class IdplProtocolDecoder extends BaseProtocolDecoder { if (parser.nextInt() == 1) { position.set(Position.KEY_ALARM, Position.ALARM_SOS); } - position.set("bodyTamper", parser.nextInt()); + parser.nextInt(); // body tamper position.set("acStatus", parser.nextInt()); position.set(Position.KEY_IGNITION, parser.nextInt() == 1); position.set(Position.KEY_OUTPUT, parser.nextInt()); -- cgit v1.2.3 From 8f61aa2b61b96ff3feee9390be54de4d609051e7 Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Sat, 4 Mar 2017 23:13:37 -0500 Subject: Replaced hardcoded string with Position.KEY_DEVICE_TEMP in Mta6Protocol; --- src/org/traccar/protocol/Mta6ProtocolDecoder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/org/traccar/protocol/Mta6ProtocolDecoder.java b/src/org/traccar/protocol/Mta6ProtocolDecoder.java index 7f547f648..da25f9c0d 100644 --- a/src/org/traccar/protocol/Mta6ProtocolDecoder.java +++ b/src/org/traccar/protocol/Mta6ProtocolDecoder.java @@ -182,7 +182,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder { if (BitUtil.check(flags, 7)) { position.set(Position.KEY_BATTERY, buf.getUnsignedByte(buf.readerIndex()) >> 2); position.set(Position.KEY_POWER, buf.readUnsignedShort() & 0x03ff); - position.set("microcontrollerTemperature", buf.readByte()); + position.set(Position.KEY_DEVICE_TEMP, buf.readByte()); position.set(Position.KEY_RSSI, (buf.getUnsignedByte(buf.readerIndex()) >> 4) & 0x07); @@ -261,7 +261,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder { if (BitUtil.check(flags, 5)) { position.set(Position.KEY_BATTERY, buf.getUnsignedByte(buf.readerIndex()) >> 2); position.set(Position.KEY_POWER, buf.readUnsignedShort() & 0x03ff); - position.set("microcontrollerTemperature", buf.readByte()); // microcontroller temperature + position.set(Position.KEY_DEVICE_TEMP, buf.readByte()); position.set(Position.KEY_RSSI, buf.getUnsignedByte(buf.readerIndex()) >> 5); -- cgit v1.2.3 From 2132438607f4bd8c88fbf89d9e9150fe1b90cd0f Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Sun, 5 Mar 2017 00:18:36 -0500 Subject: Added "mV" to Position.KEY_POWER; --- src/org/traccar/protocol/RitiProtocolDecoder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/org/traccar/protocol/RitiProtocolDecoder.java b/src/org/traccar/protocol/RitiProtocolDecoder.java index bbd176b38..8ff72a9c1 100644 --- a/src/org/traccar/protocol/RitiProtocolDecoder.java +++ b/src/org/traccar/protocol/RitiProtocolDecoder.java @@ -67,7 +67,7 @@ public class RitiProtocolDecoder extends BaseProtocolDecoder { position.set("mode", buf.readUnsignedByte()); position.set(Position.KEY_COMMAND, buf.readUnsignedByte()); - position.set(Position.KEY_POWER, buf.readUnsignedShort()); + position.set(Position.KEY_POWER, buf.readUnsignedShort() + "mV"); buf.skipBytes(5); // status buf.readUnsignedShort(); // idleCount -- cgit v1.2.3 From 26af00beda91becae8370c6edc4761340323b1ea Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Sun, 5 Mar 2017 00:38:54 -0500 Subject: Added units of measure as comments to specific keys; --- src/org/traccar/model/Position.java | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java index 218b8a4e8..1d6439c8f 100644 --- a/src/org/traccar/model/Position.java +++ b/src/org/traccar/model/Position.java @@ -31,16 +31,16 @@ public class Position extends Message { 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"; // meters - public static final String KEY_ODOMETER_SERVICE = "serviceOdometer"; - public static final String KEY_ODOMETER_TRIP = "tripOdometer"; - public static final String KEY_HOURS = "hours"; + public static final String KEY_ODOMETER = "odometer"; // kilometers + public static final String KEY_ODOMETER_SERVICE = "serviceOdometer"; // kilometers + public static final String KEY_ODOMETER_TRIP = "tripOdometer"; // kilometers + public static final String KEY_HOURS = "hours"; // decimal hours public static final String KEY_INPUT = "input"; public static final String KEY_OUTPUT = "output"; - public static final String KEY_POWER = "power"; - public static final String KEY_BATTERY = "battery"; - public static final String KEY_FUEL_LEVEL = "fuel"; - public static final String KEY_FUEL_CONSUMPTION = "fuelConsumption"; + public static final String KEY_POWER = "power"; // volts + public static final String KEY_BATTERY = "battery"; // volts + public static final String KEY_FUEL_LEVEL = "fuel"; // liters + public static final String KEY_FUEL_CONSUMPTION = "fuelConsumption"; // liter/hour public static final String KEY_RFID = "rfid"; public static final String KEY_VERSION_FW = "versionFw"; public static final String KEY_VERSION_HW = "versionHw"; @@ -50,8 +50,8 @@ public class Position extends Message { public static final String KEY_CHARGE = "charge"; public static final String KEY_IP = "ip"; public static final String KEY_ARCHIVE = "archive"; - public static final String KEY_DISTANCE = "distance"; // meters - public static final String KEY_TOTAL_DISTANCE = "totalDistance"; + public static final String KEY_DISTANCE = "distance"; // kilometers + public static final String KEY_TOTAL_DISTANCE = "totalDistance"; // kilometers public static final String KEY_RPM = "rpm"; public static final String KEY_VIN = "vin"; public static final String KEY_APPROXIMATE = "approximate"; @@ -60,13 +60,13 @@ public class Position extends Message { public static final String KEY_ARMED = "armed"; public static final String KEY_GEOFENCE = "geofence"; public static final String KEY_ACCELERATION = "acceleration"; - public static final String KEY_DEVICE_TEMP = "deviceTemp"; + public static final String KEY_DEVICE_TEMP = "deviceTemp"; // celsius public static final String KEY_OPERATOR = "operator"; public static final String KEY_COMMAND = "command"; public static final String KEY_DTCS = "dtcs"; - public static final String KEY_OBD_SPEED = "obdSpeed"; - public static final String KEY_OBD_ODOMETER = "obdOdometer"; + public static final String KEY_OBD_SPEED = "obdSpeed"; // meters/second + public static final String KEY_OBD_ODOMETER = "obdOdometer"; // kilometers public static final String KEY_RESULT = "result"; -- cgit v1.2.3 From 7eb264775a5415260443db91cd5f1c1e7548324d Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Sun, 5 Mar 2017 00:42:01 -0500 Subject: Fixed bug in recording KEY_BATTERY in AplicomProtocol; --- src/org/traccar/protocol/AplicomProtocolDecoder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java index 93882cd4a..39f5fbc24 100644 --- a/src/org/traccar/protocol/AplicomProtocolDecoder.java +++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java @@ -234,8 +234,8 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { } if ((selector & 0x8000) != 0) { - position.set(Position.KEY_POWER, buf.readUnsignedShort() / 1000.0); - position.set(Position.KEY_BATTERY, buf.readUnsignedShort()); + position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.001); + position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001); } // Pulse rate 1 -- cgit v1.2.3 From c62fa33fb0748f44d9584970924c90c70f4f976a Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Sun, 5 Mar 2017 00:44:48 -0500 Subject: Converted all KEY_POWER and KEY_BATTERY to volts; Removed string "mV"; --- src/org/traccar/protocol/At2000ProtocolDecoder.java | 2 +- src/org/traccar/protocol/EelinkProtocolDecoder.java | 2 +- src/org/traccar/protocol/OigoProtocolDecoder.java | 6 +++--- src/org/traccar/protocol/RitiProtocolDecoder.java | 2 +- src/org/traccar/protocol/TeltonikaProtocolDecoder.java | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/org/traccar/protocol/At2000ProtocolDecoder.java b/src/org/traccar/protocol/At2000ProtocolDecoder.java index 182066629..70840c37d 100644 --- a/src/org/traccar/protocol/At2000ProtocolDecoder.java +++ b/src/org/traccar/protocol/At2000ProtocolDecoder.java @@ -140,7 +140,7 @@ public class At2000ProtocolDecoder extends BaseProtocolDecoder { position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort()); position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort()); - position.set(Position.KEY_POWER, buf.readUnsignedShort() + "mV"); + position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.001); buf.readUnsignedShort(); // cid position.set(Position.KEY_RSSI, buf.readUnsignedByte()); diff --git a/src/org/traccar/protocol/EelinkProtocolDecoder.java b/src/org/traccar/protocol/EelinkProtocolDecoder.java index 0296d22fe..0f6551cc3 100644 --- a/src/org/traccar/protocol/EelinkProtocolDecoder.java +++ b/src/org/traccar/protocol/EelinkProtocolDecoder.java @@ -130,7 +130,7 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder { } position.set(Position.KEY_STATUS, status); - position.set(Position.KEY_BATTERY, buf.readUnsignedShort() + "mV"); + position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001); position.set(Position.KEY_RSSI, buf.readUnsignedShort()); diff --git a/src/org/traccar/protocol/OigoProtocolDecoder.java b/src/org/traccar/protocol/OigoProtocolDecoder.java index 9538053b6..54360c932 100644 --- a/src/org/traccar/protocol/OigoProtocolDecoder.java +++ b/src/org/traccar/protocol/OigoProtocolDecoder.java @@ -121,11 +121,11 @@ public class OigoProtocolDecoder extends BaseProtocolDecoder { } if (BitUtil.check(mask, 9)) { - position.set(Position.KEY_POWER, buf.readUnsignedShort() + "mV"); + position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.001); } if (BitUtil.check(mask, 10)) { - position.set(Position.KEY_BATTERY, buf.readUnsignedShort() + "mV"); + position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001); } if (BitUtil.check(mask, 11)) { @@ -198,7 +198,7 @@ public class OigoProtocolDecoder extends BaseProtocolDecoder { position.setCourse(buf.readUnsignedShort()); position.setSpeed(UnitsConverter.knotsFromMph(buf.readUnsignedByte())); - position.set(Position.KEY_POWER, buf.readUnsignedByte() * 100 + "mV"); + position.set(Position.KEY_POWER, buf.readUnsignedByte() * 0.1); position.set(Position.PREFIX_IO + 1, buf.readUnsignedByte()); dateBuilder.setSecond(buf.readUnsignedByte()); diff --git a/src/org/traccar/protocol/RitiProtocolDecoder.java b/src/org/traccar/protocol/RitiProtocolDecoder.java index 8ff72a9c1..a879633c2 100644 --- a/src/org/traccar/protocol/RitiProtocolDecoder.java +++ b/src/org/traccar/protocol/RitiProtocolDecoder.java @@ -67,7 +67,7 @@ public class RitiProtocolDecoder extends BaseProtocolDecoder { position.set("mode", buf.readUnsignedByte()); position.set(Position.KEY_COMMAND, buf.readUnsignedByte()); - position.set(Position.KEY_POWER, buf.readUnsignedShort() + "mV"); + position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.001); buf.skipBytes(5); // status buf.readUnsignedShort(); // idleCount diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java index e55d354cf..30a3f4cda 100644 --- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java +++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java @@ -96,10 +96,10 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { position.set(Position.PREFIX_ADC + 1, readValue(buf, length, false)); break; case 66: - position.set(Position.KEY_POWER, readValue(buf, length, false) + "mV"); + position.set(Position.KEY_POWER, readValue(buf, length, false) * 0.001); break; case 67: - position.set(Position.KEY_BATTERY, readValue(buf, length, false) + "mV"); + position.set(Position.KEY_BATTERY, readValue(buf, length, false) * 0.001); break; case 70: position.set(Position.KEY_DEVICE_TEMP, readValue(buf, length, true) * 0.1); -- cgit v1.2.3 From 0ba3f3ba0fc3ab04cfbbc860afcb736d838a7057 Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Sun, 5 Mar 2017 00:45:41 -0500 Subject: Performed all KEY_POWER and KEY_BATTERY conversions using multiplication versus division; --- src/org/traccar/protocol/FoxProtocolDecoder.java | 2 +- src/org/traccar/protocol/GatorProtocolDecoder.java | 2 +- src/org/traccar/protocol/HaicomProtocolDecoder.java | 2 +- src/org/traccar/protocol/SkypatrolProtocolDecoder.java | 2 +- src/org/traccar/protocol/TotemProtocolDecoder.java | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/org/traccar/protocol/FoxProtocolDecoder.java b/src/org/traccar/protocol/FoxProtocolDecoder.java index e01c3aae3..e48b13cb7 100644 --- a/src/org/traccar/protocol/FoxProtocolDecoder.java +++ b/src/org/traccar/protocol/FoxProtocolDecoder.java @@ -108,7 +108,7 @@ public class FoxProtocolDecoder extends BaseProtocolDecoder { position.setCourse(parser.nextDouble()); position.set(Position.KEY_INPUT, parser.nextInt(2)); - position.set(Position.KEY_POWER, parser.nextDouble() / 10); + position.set(Position.KEY_POWER, parser.nextDouble() * 0.1); position.set(Position.PREFIX_TEMP + 1, parser.nextInt()); position.set(Position.KEY_RPM, parser.nextInt()); position.set(Position.KEY_FUEL_LEVEL, parser.nextInt()); diff --git a/src/org/traccar/protocol/GatorProtocolDecoder.java b/src/org/traccar/protocol/GatorProtocolDecoder.java index f01efb9d8..2ad4be3d3 100644 --- a/src/org/traccar/protocol/GatorProtocolDecoder.java +++ b/src/org/traccar/protocol/GatorProtocolDecoder.java @@ -120,7 +120,7 @@ public class GatorProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_STATUS, buf.readUnsignedByte()); position.set("key", buf.readUnsignedByte()); position.set("oil", buf.readUnsignedShort() / 10.0); - position.set(Position.KEY_POWER, buf.readUnsignedByte() + buf.readUnsignedByte() / 100.0); + position.set(Position.KEY_POWER, buf.readUnsignedByte() + buf.readUnsignedByte() * 0.01); position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); return position; diff --git a/src/org/traccar/protocol/HaicomProtocolDecoder.java b/src/org/traccar/protocol/HaicomProtocolDecoder.java index 97e980290..db26db820 100644 --- a/src/org/traccar/protocol/HaicomProtocolDecoder.java +++ b/src/org/traccar/protocol/HaicomProtocolDecoder.java @@ -105,7 +105,7 @@ public class HaicomProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_GPS, parser.next()); position.set(Position.KEY_INPUT, parser.next()); position.set(Position.KEY_OUTPUT, parser.next()); - position.set(Position.KEY_BATTERY, parser.nextDouble() / 10); + position.set(Position.KEY_BATTERY, parser.nextDouble() * 0.1); return position; } diff --git a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java index 345c1aea3..f4dded972 100644 --- a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java +++ b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java @@ -166,7 +166,7 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder { } if (BitUtil.check(mask, 24)) { - position.set(Position.KEY_POWER, buf.readUnsignedShort() / 1000.0); + position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.001); } if (BitUtil.check(mask, 25)) { diff --git a/src/org/traccar/protocol/TotemProtocolDecoder.java b/src/org/traccar/protocol/TotemProtocolDecoder.java index 67a1d1213..c7dc9e6c1 100644 --- a/src/org/traccar/protocol/TotemProtocolDecoder.java +++ b/src/org/traccar/protocol/TotemProtocolDecoder.java @@ -275,7 +275,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { position.setTime(dateBuilder.getDate()); position.set(Position.PREFIX_IO + 1, parser.next()); - position.set(Position.KEY_BATTERY, parser.nextDouble() / 10); + position.set(Position.KEY_BATTERY, parser.nextDouble() * 0.1); position.set(Position.KEY_POWER, parser.nextDouble()); position.set(Position.PREFIX_ADC + 1, parser.next()); position.set(Position.PREFIX_ADC + 2, parser.next()); @@ -303,7 +303,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { .setTime(parser.nextInt(), parser.nextInt(), parser.nextInt()); position.setTime(dateBuilder.getDate()); - position.set(Position.KEY_BATTERY, parser.nextDouble() / 10); + position.set(Position.KEY_BATTERY, parser.nextDouble() * 0.1); position.set(Position.KEY_POWER, parser.nextDouble()); position.set(Position.PREFIX_ADC + 1, parser.next()); -- cgit v1.2.3 From 24d3a3e1d2abf5870ea34769a687cd49075d2ccc Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Sun, 5 Mar 2017 00:56:12 -0500 Subject: Updated units of measure comments in Position.java; --- src/org/traccar/model/Position.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java index 1d6439c8f..8600b5dd0 100644 --- a/src/org/traccar/model/Position.java +++ b/src/org/traccar/model/Position.java @@ -34,7 +34,7 @@ public class Position extends Message { public static final String KEY_ODOMETER = "odometer"; // kilometers public static final String KEY_ODOMETER_SERVICE = "serviceOdometer"; // kilometers public static final String KEY_ODOMETER_TRIP = "tripOdometer"; // kilometers - public static final String KEY_HOURS = "hours"; // decimal hours + public static final String KEY_HOURS = "hours"; // hours public static final String KEY_INPUT = "input"; public static final String KEY_OUTPUT = "output"; public static final String KEY_POWER = "power"; // volts @@ -65,7 +65,7 @@ public class Position extends Message { public static final String KEY_COMMAND = "command"; public static final String KEY_DTCS = "dtcs"; - public static final String KEY_OBD_SPEED = "obdSpeed"; // meters/second + public static final String KEY_OBD_SPEED = "obdSpeed"; // knots public static final String KEY_OBD_ODOMETER = "obdOdometer"; // kilometers public static final String KEY_RESULT = "result"; @@ -217,7 +217,7 @@ public class Position extends Message { this.longitude = longitude; } - private double altitude; + private double altitude; // value in meters public double getAltitude() { return altitude; -- cgit v1.2.3 From fa6706cab7b7f4448e9a0cc67bd5d1a880497c02 Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Sun, 5 Mar 2017 09:21:37 -0500 Subject: Updated comments in Position.java; --- src/org/traccar/model/Position.java | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java index 8600b5dd0..82b7e03ce 100644 --- a/src/org/traccar/model/Position.java +++ b/src/org/traccar/model/Position.java @@ -31,16 +31,20 @@ public class Position extends Message { 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"; // kilometers - public static final String KEY_ODOMETER_SERVICE = "serviceOdometer"; // kilometers - public static final String KEY_ODOMETER_TRIP = "tripOdometer"; // kilometers - public static final String KEY_HOURS = "hours"; // hours + public static final String KEY_ODOMETER = "odometer"; // meters + public static final String KEY_ODOMETER_SERVICE = "serviceOdometer"; // meters + public static final String KEY_ODOMETER_TRIP = "tripOdometer"; // meters + public static final String KEY_HOURS = "hours"; public static final String KEY_INPUT = "input"; public static final String KEY_OUTPUT = "output"; + + // The units for the below four KEYs currently vary. + // The preferred units of measure are specified in the comment for each. public static final String KEY_POWER = "power"; // volts - public static final String KEY_BATTERY = "battery"; // volts + public static final String KEY_BATTERY = "battery"; // volts (or percentage appending '%') public static final String KEY_FUEL_LEVEL = "fuel"; // liters - public static final String KEY_FUEL_CONSUMPTION = "fuelConsumption"; // liter/hour + public static final String KEY_FUEL_CONSUMPTION = "fuelConsumption"; // liters/hour + public static final String KEY_RFID = "rfid"; public static final String KEY_VERSION_FW = "versionFw"; public static final String KEY_VERSION_HW = "versionHw"; @@ -50,8 +54,8 @@ public class Position extends Message { public static final String KEY_CHARGE = "charge"; public static final String KEY_IP = "ip"; public static final String KEY_ARCHIVE = "archive"; - public static final String KEY_DISTANCE = "distance"; // kilometers - public static final String KEY_TOTAL_DISTANCE = "totalDistance"; // kilometers + public static final String KEY_DISTANCE = "distance"; // meters + public static final String KEY_TOTAL_DISTANCE = "totalDistance"; // meters public static final String KEY_RPM = "rpm"; public static final String KEY_VIN = "vin"; public static final String KEY_APPROXIMATE = "approximate"; @@ -66,7 +70,7 @@ public class Position extends Message { public static final String KEY_DTCS = "dtcs"; public static final String KEY_OBD_SPEED = "obdSpeed"; // knots - public static final String KEY_OBD_ODOMETER = "obdOdometer"; // kilometers + public static final String KEY_OBD_ODOMETER = "obdOdometer"; // meters public static final String KEY_RESULT = "result"; @@ -217,7 +221,7 @@ public class Position extends Message { this.longitude = longitude; } - private double altitude; // value in meters + private double altitude; // value in meters public double getAltitude() { return altitude; -- cgit v1.2.3 From f94613b97cf80af64154ae571920a273771fa1d3 Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Tue, 7 Mar 2017 19:19:07 -0500 Subject: Removed unnecessary comments; --- src/org/traccar/protocol/AplicomProtocolDecoder.java | 2 +- src/org/traccar/protocol/AstraProtocolDecoder.java | 7 ++----- src/org/traccar/protocol/AtrackProtocolDecoder.java | 4 ++-- src/org/traccar/protocol/CarcellProtocolDecoder.java | 2 +- src/org/traccar/protocol/Mta6ProtocolDecoder.java | 4 ++-- src/org/traccar/protocol/RaveonProtocolDecoder.java | 2 +- 6 files changed, 9 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java index 39f5fbc24..c07a656b3 100644 --- a/src/org/traccar/protocol/AplicomProtocolDecoder.java +++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java @@ -218,7 +218,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { if ((selector & 0x0010) != 0) { position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedByte())); - position.set("maximumSpeed", buf.readUnsignedByte()); // maximum speed + position.set("maximumSpeed", buf.readUnsignedByte()); position.setCourse(buf.readUnsignedByte() * 2.0); } diff --git a/src/org/traccar/protocol/AstraProtocolDecoder.java b/src/org/traccar/protocol/AstraProtocolDecoder.java index fc70aebb3..ea6aa7b30 100644 --- a/src/org/traccar/protocol/AstraProtocolDecoder.java +++ b/src/org/traccar/protocol/AstraProtocolDecoder.java @@ -93,7 +93,7 @@ public class AstraProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedByte(); // max journey speed buf.skipBytes(6); // accelerometer - position.set(Position.KEY_ODOMETER_TRIP, buf.readUnsignedShort()); // journey distance + position.set(Position.KEY_ODOMETER_TRIP, buf.readUnsignedShort()); buf.readUnsignedShort(); // journey idle time position.setAltitude(buf.readUnsignedByte() * 20); @@ -105,12 +105,9 @@ public class AstraProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedByte(); // geofence events if (BitUtil.check(status, 8)) { - position.set(Position.KEY_RFID, buf.readBytes(7).toString(StandardCharsets.US_ASCII)); position.set(Position.KEY_ODOMETER, buf.readUnsignedMedium() * 1000); - - position.set(Position.KEY_HOURS, buf.readUnsignedShort()); // engine time - + position.set(Position.KEY_HOURS, buf.readUnsignedShort()); } if (BitUtil.check(status, 6)) { diff --git a/src/org/traccar/protocol/AtrackProtocolDecoder.java b/src/org/traccar/protocol/AtrackProtocolDecoder.java index 8e444102e..bbc7c4479 100644 --- a/src/org/traccar/protocol/AtrackProtocolDecoder.java +++ b/src/org/traccar/protocol/AtrackProtocolDecoder.java @@ -113,7 +113,7 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedByte(); // rxlev break; case "PC": - position.set(Position.PREFIX_COUNT + 1, buf.readUnsignedInt()); // pulse count + position.set(Position.PREFIX_COUNT + 1, buf.readUnsignedInt()); break; case "AT": position.setAltitude(buf.readUnsignedInt()); @@ -140,7 +140,7 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_THROTTLE, buf.readUnsignedByte()); break; case "ET": - position.set(Position.PREFIX_TEMP + 1, buf.readUnsignedShort()); // engine coolant temp + position.set(Position.PREFIX_TEMP + 1, buf.readUnsignedShort()); break; case "FL": position.set(Position.KEY_FUEL_LEVEL, buf.readUnsignedByte()); diff --git a/src/org/traccar/protocol/CarcellProtocolDecoder.java b/src/org/traccar/protocol/CarcellProtocolDecoder.java index 3d1ceff2c..b41f14ad5 100644 --- a/src/org/traccar/protocol/CarcellProtocolDecoder.java +++ b/src/org/traccar/protocol/CarcellProtocolDecoder.java @@ -155,7 +155,7 @@ public class CarcellProtocolDecoder extends BaseProtocolDecoder { if (parser.hasNext(5)) { position.set("timeUntilDelivery", parser.nextInt()); parser.next(); // panic button status - position.set(Position.KEY_INPUT, parser.next()); // aux + position.set(Position.KEY_INPUT, parser.next()); Double mainVoltage = parser.nextDouble() / 100d; position.set(Position.KEY_POWER, mainVoltage); diff --git a/src/org/traccar/protocol/Mta6ProtocolDecoder.java b/src/org/traccar/protocol/Mta6ProtocolDecoder.java index da25f9c0d..0fda94eef 100644 --- a/src/org/traccar/protocol/Mta6ProtocolDecoder.java +++ b/src/org/traccar/protocol/Mta6ProtocolDecoder.java @@ -222,7 +222,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder { position.setLongitude(new FloatReader().readFloat(buf) / Math.PI * 180); position.setTime(new TimeReader().readTime(buf)); - position.set(Position.KEY_STATUS, buf.readUnsignedByte()); // status + position.set(Position.KEY_STATUS, buf.readUnsignedByte()); if (BitUtil.check(flags, 0)) { position.setAltitude(buf.readUnsignedShort()); @@ -241,7 +241,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder { position.set("engine", buf.readUnsignedShort() * 0.125); position.set("pedals", buf.readUnsignedByte()); position.set(Position.PREFIX_TEMP + 1, buf.readUnsignedByte() - 40); - position.set(Position.KEY_ODOMETER_SERVICE, buf.readUnsignedShort()); // service odometer + position.set(Position.KEY_ODOMETER_SERVICE, buf.readUnsignedShort()); } if (BitUtil.check(flags, 3)) { diff --git a/src/org/traccar/protocol/RaveonProtocolDecoder.java b/src/org/traccar/protocol/RaveonProtocolDecoder.java index 5b6e4f0ac..1fd3d4cd7 100644 --- a/src/org/traccar/protocol/RaveonProtocolDecoder.java +++ b/src/org/traccar/protocol/RaveonProtocolDecoder.java @@ -95,7 +95,7 @@ public class RaveonProtocolDecoder extends BaseProtocolDecoder { position.setSpeed(UnitsConverter.knotsFromKph(parser.nextInt())); position.setCourse(parser.nextInt()); - position.set(Position.KEY_ALARM, parser.next()); // alerts + position.set(Position.KEY_ALARM, parser.next()); return position; } -- cgit v1.2.3