From f5868e7cd0e40706c19c5a5f28490b8968a50b88 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 17 Apr 2017 15:52:01 +1200 Subject: Normalize RPM values --- src/org/traccar/protocol/Gl200ProtocolDecoder.java | 20 ++++++++-------- .../traccar/protocol/Gps103ProtocolDecoder.java | 14 +++++------ .../protocol/IntellitracProtocolDecoder.java | 28 +++++++++++----------- 3 files changed, 31 insertions(+), 31 deletions(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java index fc0bbd5ff..f8ad60d4d 100644 --- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java @@ -473,16 +473,16 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { return null; } - position.set(Position.KEY_RPM, parser.next()); - position.set(Position.KEY_OBD_SPEED, parser.next()); - position.set(Position.PREFIX_TEMP + 1, parser.next()); + position.set(Position.KEY_RPM, parser.nextInt()); + position.set(Position.KEY_OBD_SPEED, parser.nextInt()); + position.set(Position.PREFIX_TEMP + 1, parser.nextInt()); position.set(Position.KEY_FUEL_CONSUMPTION, parser.next()); - position.set("dtcsClearedDistance", parser.next()); - position.set("odbConnect", parser.next()); - position.set("dtcsNumber", parser.next()); + position.set("dtcsClearedDistance", parser.nextInt()); + position.set("odbConnect", parser.nextInt() == 1); + position.set("dtcsNumber", parser.nextInt()); position.set("dtcsCodes", parser.next()); - position.set(Position.KEY_THROTTLE, parser.next()); - position.set(Position.KEY_FUEL_LEVEL, parser.next()); + position.set(Position.KEY_THROTTLE, parser.nextInt()); + position.set(Position.KEY_FUEL_LEVEL, parser.nextInt()); position.set(Position.KEY_OBD_ODOMETER, parser.nextInt() * 1000); decodeLocation(position, parser); @@ -556,8 +556,8 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { decodeStatus(position, parser); - position.set(Position.KEY_RPM, parser.next()); - position.set(Position.KEY_FUEL_LEVEL, parser.next()); + position.set(Position.KEY_RPM, parser.nextInt()); + position.set(Position.KEY_FUEL_LEVEL, parser.nextInt()); decodeDeviceTime(position, parser); diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java index 49f1a2049..890465ab9 100644 --- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java @@ -207,14 +207,14 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder { getLastLocation(position, parser.nextDateTime()); position.set(Position.KEY_ODOMETER, parser.nextInt()); - parser.next(); // instant fuel consumption - position.set(Position.KEY_FUEL_CONSUMPTION, parser.next()); - position.set(Position.KEY_HOURS, parser.next()); - position.set(Position.KEY_OBD_SPEED, parser.next()); - position.set(Position.PREFIX_TEMP + 1, parser.next()); + parser.nextDouble(); // instant fuel consumption + position.set(Position.KEY_FUEL_CONSUMPTION, parser.nextDouble()); + position.set(Position.KEY_HOURS, parser.nextInt()); + position.set(Position.KEY_OBD_SPEED, parser.nextInt()); + position.set(Position.PREFIX_TEMP + 1, parser.nextInt()); position.set(Position.KEY_THROTTLE, parser.next()); - position.set(Position.KEY_RPM, parser.next()); - position.set(Position.KEY_BATTERY, parser.next()); + position.set(Position.KEY_RPM, parser.nextInt()); + position.set(Position.KEY_BATTERY, parser.nextDouble()); position.set(Position.KEY_DTCS, parser.next().replace(',', ' ').trim()); return position; diff --git a/src/org/traccar/protocol/IntellitracProtocolDecoder.java b/src/org/traccar/protocol/IntellitracProtocolDecoder.java index 0f69101aa..f43fa4aac 100644 --- a/src/org/traccar/protocol/IntellitracProtocolDecoder.java +++ b/src/org/traccar/protocol/IntellitracProtocolDecoder.java @@ -94,23 +94,23 @@ public class IntellitracProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_SATELLITES, satellites); position.set(Position.KEY_INDEX, parser.nextLong()); - position.set(Position.KEY_INPUT, parser.next()); - position.set(Position.KEY_OUTPUT, parser.next()); + position.set(Position.KEY_INPUT, parser.nextInt()); + position.set(Position.KEY_OUTPUT, parser.nextInt()); - position.set(Position.PREFIX_ADC + 1, parser.next()); - position.set(Position.PREFIX_ADC + 2, parser.next()); + position.set(Position.PREFIX_ADC + 1, parser.nextDouble()); + position.set(Position.PREFIX_ADC + 2, parser.nextDouble()); // J1939 data - 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_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()); - position.set("tpl", parser.next()); - position.set("axle", parser.next()); - position.set(Position.KEY_OBD_ODOMETER, parser.next()); + position.set(Position.KEY_OBD_SPEED, parser.nextInt()); + position.set(Position.KEY_RPM, parser.nextInt()); + position.set("coolant", parser.nextInt()); + position.set(Position.KEY_FUEL_LEVEL, parser.nextInt()); + position.set(Position.KEY_FUEL_CONSUMPTION, parser.nextInt()); + position.set(Position.PREFIX_TEMP + 1, parser.nextInt()); + position.set(Position.KEY_CHARGE, parser.nextInt()); + position.set("tpl", parser.nextInt()); + position.set("axle", parser.nextInt()); + position.set(Position.KEY_OBD_ODOMETER, parser.nextInt()); return position; } -- cgit v1.2.3