diff options
author | Abyss777 <abyss@fox5.ru> | 2018-05-29 17:44:01 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2018-05-29 17:45:48 +0500 |
commit | 0e9f1f9bd0df2bc6771f3f5819eb6dbe8c3ce191 (patch) | |
tree | 7701691c0e9669cdffcce3bd511edf850f8dc41e /src/org/traccar | |
parent | c71701136245a63ea82a8a595dd51cc011ab2c35 (diff) | |
download | traccar-server-0e9f1f9bd0df2bc6771f3f5819eb6dbe8c3ce191.tar.gz traccar-server-0e9f1f9bd0df2bc6771f3f5819eb6dbe8c3ce191.tar.bz2 traccar-server-0e9f1f9bd0df2bc6771f3f5819eb6dbe8c3ce191.zip |
Make function name shorter
Diffstat (limited to 'src/org/traccar')
9 files changed, 10 insertions, 12 deletions
diff --git a/src/org/traccar/helper/UnitsConverter.java b/src/org/traccar/helper/UnitsConverter.java index 7519879c0..74f5a90e6 100644 --- a/src/org/traccar/helper/UnitsConverter.java +++ b/src/org/traccar/helper/UnitsConverter.java @@ -72,11 +72,11 @@ public final class UnitsConverter { return value * METERS_TO_MILE_RATIO; } - public static long millisecondsFromHours(int value) { + public static long msFromHours(long value) { return value * MILLISECONDS_TO_HOURS_RATIO; } - public static long millisecondsFromHours(double value) { + public static long msFromHours(double value) { return (long) (value * MILLISECONDS_TO_HOURS_RATIO); } diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java index adfa88f71..e649b52a6 100644 --- a/src/org/traccar/protocol/AplicomProtocolDecoder.java +++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java @@ -549,7 +549,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { } if ((selector & 0x0020) != 0) { - position.set(Position.KEY_HOURS, UnitsConverter.millisecondsFromHours(buf.readUnsignedInt())); + position.set(Position.KEY_HOURS, UnitsConverter.msFromHours(buf.readUnsignedInt())); position.set("serviceDistance", buf.readInt()); position.set("driverActivity", buf.readUnsignedByte()); position.set(Position.KEY_THROTTLE, buf.readUnsignedByte()); diff --git a/src/org/traccar/protocol/AstraProtocolDecoder.java b/src/org/traccar/protocol/AstraProtocolDecoder.java index 44547e3cd..7f247251d 100644 --- a/src/org/traccar/protocol/AstraProtocolDecoder.java +++ b/src/org/traccar/protocol/AstraProtocolDecoder.java @@ -106,7 +106,7 @@ public class AstraProtocolDecoder extends BaseProtocolDecoder { if (BitUtil.check(status, 8)) { position.set(Position.KEY_DRIVER_UNIQUE_ID, buf.readBytes(7).toString(StandardCharsets.US_ASCII)); position.set(Position.KEY_ODOMETER, buf.readUnsignedMedium() * 1000); - position.set(Position.KEY_HOURS, UnitsConverter.millisecondsFromHours(buf.readUnsignedShort())); + position.set(Position.KEY_HOURS, UnitsConverter.msFromHours(buf.readUnsignedShort())); } if (BitUtil.check(status, 6)) { diff --git a/src/org/traccar/protocol/ContinentalProtocolDecoder.java b/src/org/traccar/protocol/ContinentalProtocolDecoder.java index 186b2235e..5ea1d3246 100644 --- a/src/org/traccar/protocol/ContinentalProtocolDecoder.java +++ b/src/org/traccar/protocol/ContinentalProtocolDecoder.java @@ -94,7 +94,7 @@ public class ContinentalProtocolDecoder extends BaseProtocolDecoder { } if (buf.readableBytes() > 4) { - position.set(Position.KEY_HOURS, UnitsConverter.millisecondsFromHours(buf.readUnsignedInt())); + position.set(Position.KEY_HOURS, UnitsConverter.msFromHours(buf.readUnsignedInt())); } return position; diff --git a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java index 7342b1263..1c7fe4688 100644 --- a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java +++ b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java @@ -609,8 +609,7 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_THROTTLE, Integer.parseInt(values[index - 1])); } if (BitUtil.check(reportMask, 11)) { - position.set( - Position.KEY_HOURS, UnitsConverter.millisecondsFromHours(Double.parseDouble(values[index++]))); + position.set(Position.KEY_HOURS, UnitsConverter.msFromHours(Double.parseDouble(values[index++]))); } if (BitUtil.check(reportMask, 12)) { position.set("drivingHours", Double.parseDouble(values[index++])); diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java index 3575d423e..3d31326ae 100644 --- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java @@ -256,7 +256,7 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_FUEL_CONSUMPTION, parser.nextDouble(0)); Integer hours = parser.nextInt(); if (hours != null) { - position.set(Position.KEY_HOURS, UnitsConverter.millisecondsFromHours(hours)); + position.set(Position.KEY_HOURS, UnitsConverter.msFromHours(hours)); } position.set(Position.KEY_OBD_SPEED, parser.nextInt(0)); position.set(Position.KEY_ENGINE_LOAD, parser.next()); diff --git a/src/org/traccar/protocol/Mta6ProtocolDecoder.java b/src/org/traccar/protocol/Mta6ProtocolDecoder.java index 6ec5faea8..13b187e80 100644 --- a/src/org/traccar/protocol/Mta6ProtocolDecoder.java +++ b/src/org/traccar/protocol/Mta6ProtocolDecoder.java @@ -232,8 +232,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder { if (BitUtil.check(flags, 1)) { position.set(Position.KEY_FUEL_CONSUMPTION, new FloatReader().readFloat(buf)); - position.set( - Position.KEY_HOURS, UnitsConverter.millisecondsFromHours(new FloatReader().readFloat(buf))); + position.set(Position.KEY_HOURS, UnitsConverter.msFromHours(new FloatReader().readFloat(buf))); position.set("tank", buf.readUnsignedByte() * 0.4); } diff --git a/src/org/traccar/protocol/VtfmsProtocolDecoder.java b/src/org/traccar/protocol/VtfmsProtocolDecoder.java index 76fcf69fa..736a27a64 100644 --- a/src/org/traccar/protocol/VtfmsProtocolDecoder.java +++ b/src/org/traccar/protocol/VtfmsProtocolDecoder.java @@ -133,7 +133,7 @@ public class VtfmsProtocolDecoder extends BaseProtocolDecoder { position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble(0))); - position.set(Position.KEY_HOURS, UnitsConverter.millisecondsFromHours(parser.nextInt())); + position.set(Position.KEY_HOURS, UnitsConverter.msFromHours(parser.nextInt())); position.set("idleHours", parser.nextInt()); position.set(Position.KEY_ODOMETER, parser.nextInt() * 100); position.set(Position.KEY_CHARGE, parser.next().equals("1")); diff --git a/src/org/traccar/protocol/XirgoProtocolDecoder.java b/src/org/traccar/protocol/XirgoProtocolDecoder.java index 828893d62..5cda4aed3 100644 --- a/src/org/traccar/protocol/XirgoProtocolDecoder.java +++ b/src/org/traccar/protocol/XirgoProtocolDecoder.java @@ -232,7 +232,7 @@ public class XirgoProtocolDecoder extends BaseProtocolDecoder { position.set(Position.PREFIX_OUT + 1, parser.nextInt()); position.set(Position.PREFIX_ADC + 1, parser.nextDouble()); position.set(Position.KEY_FUEL_LEVEL, parser.nextDouble()); - position.set(Position.KEY_HOURS, UnitsConverter.millisecondsFromHours(parser.nextInt())); + position.set(Position.KEY_HOURS, UnitsConverter.msFromHours(parser.nextInt())); position.set("oilPressure", parser.nextInt()); position.set("oilLevel", parser.nextInt()); position.set("oilTemp", parser.nextInt()); |