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/org') 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