From 27055e0bf5f544552c227da10badff34a71cfb70 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 27 Apr 2015 12:18:31 +1200 Subject: Remove unnecessary type casts --- src/org/traccar/protocol/ApelProtocolDecoder.java | 2 +- src/org/traccar/protocol/AplicomProtocolDecoder.java | 2 +- src/org/traccar/protocol/AtrackProtocolDecoder.java | 2 +- src/org/traccar/protocol/AutoFon45ProtocolDecoder.java | 4 ++-- src/org/traccar/protocol/AutoFonProtocolDecoder.java | 4 ++-- src/org/traccar/protocol/Avl301ProtocolDecoder.java | 2 +- src/org/traccar/protocol/BceProtocolDecoder.java | 10 +++++----- src/org/traccar/protocol/CalAmpProtocolDecoder.java | 2 +- src/org/traccar/protocol/EelinkProtocolDecoder.java | 6 +++--- src/org/traccar/protocol/GalileoProtocolDecoder.java | 2 +- src/org/traccar/protocol/GatorProtocolDecoder.java | 2 +- src/org/traccar/protocol/Gt02ProtocolDecoder.java | 4 ++-- src/org/traccar/protocol/Gt06ProtocolDecoder.java | 2 +- src/org/traccar/protocol/H02ProtocolDecoder.java | 2 +- src/org/traccar/protocol/Jt600ProtocolDecoder.java | 4 ++-- src/org/traccar/protocol/KhdProtocolDecoder.java | 2 +- src/org/traccar/protocol/M2mProtocolDecoder.java | 2 +- src/org/traccar/protocol/MeitrackProtocolDecoder.java | 4 ++-- src/org/traccar/protocol/Mta6ProtocolDecoder.java | 12 ++++++------ src/org/traccar/protocol/NavigilProtocolDecoder.java | 10 +++++----- src/org/traccar/protocol/NavisProtocolDecoder.java | 4 ++-- src/org/traccar/protocol/NoranProtocolDecoder.java | 8 ++++---- src/org/traccar/protocol/OrionProtocolDecoder.java | 2 +- src/org/traccar/protocol/PiligrimProtocolDecoder.java | 2 +- src/org/traccar/protocol/ProgressProtocolDecoder.java | 10 +++++----- src/org/traccar/protocol/SkypatrolProtocolDecoder.java | 2 +- src/org/traccar/protocol/TeltonikaProtocolDecoder.java | 6 +++--- src/org/traccar/protocol/TytanProtocolDecoder.java | 2 +- src/org/traccar/protocol/UlbotechProtocolDecoder.java | 2 +- 29 files changed, 59 insertions(+), 59 deletions(-) (limited to 'src') diff --git a/src/org/traccar/protocol/ApelProtocolDecoder.java b/src/org/traccar/protocol/ApelProtocolDecoder.java index 619831f0f..4184172fa 100644 --- a/src/org/traccar/protocol/ApelProtocolDecoder.java +++ b/src/org/traccar/protocol/ApelProtocolDecoder.java @@ -208,7 +208,7 @@ public class ApelProtocolDecoder extends BaseProtocolDecoder { position.setCourse(buf.readShort() / 100.0); // Altitude - position.setAltitude((double) buf.readShort()); + position.setAltitude(buf.readShort()); if (subtype == MSG_TYPE_STATE_FULL_INFO_T104) { diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java index 2092fee3d..d29548088 100644 --- a/src/org/traccar/protocol/AplicomProtocolDecoder.java +++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java @@ -222,7 +222,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { // Altitude if ((selector & 0x0800) != 0) { - position.setAltitude((double) buf.readShort()); + position.setAltitude(buf.readShort()); } position.setExtendedInfo(extendedInfo.toString()); diff --git a/src/org/traccar/protocol/AtrackProtocolDecoder.java b/src/org/traccar/protocol/AtrackProtocolDecoder.java index 0c6aa566d..29070f6e1 100644 --- a/src/org/traccar/protocol/AtrackProtocolDecoder.java +++ b/src/org/traccar/protocol/AtrackProtocolDecoder.java @@ -119,7 +119,7 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder { position.setLatitude(buf.readInt() * 0.000001); // Course - position.setCourse((double) buf.readUnsignedShort()); + position.setCourse(buf.readUnsignedShort()); // Report type extendedInfo.set("type", buf.readUnsignedByte()); diff --git a/src/org/traccar/protocol/AutoFon45ProtocolDecoder.java b/src/org/traccar/protocol/AutoFon45ProtocolDecoder.java index c2b675194..967799f95 100644 --- a/src/org/traccar/protocol/AutoFon45ProtocolDecoder.java +++ b/src/org/traccar/protocol/AutoFon45ProtocolDecoder.java @@ -108,8 +108,8 @@ public class AutoFon45ProtocolDecoder extends BaseProtocolDecoder { // Location position.setLatitude(convertCoordinate(buf.readUnsignedByte(), buf.readUnsignedByte() << 16 | buf.readUnsignedByte() << 8 | buf.readUnsignedByte())); position.setLongitude(convertCoordinate(buf.readUnsignedByte(), buf.readUnsignedByte() << 16 | buf.readUnsignedByte() << 8 | buf.readUnsignedByte())); - position.setSpeed((double) buf.readUnsignedByte()); - position.setCourse((double) (buf.readUnsignedByte() << 8 | buf.readUnsignedByte())); + position.setSpeed(buf.readUnsignedByte()); + position.setCourse(buf.readUnsignedByte() << 8 | buf.readUnsignedByte()); buf.readUnsignedByte(); // checksum diff --git a/src/org/traccar/protocol/AutoFonProtocolDecoder.java b/src/org/traccar/protocol/AutoFonProtocolDecoder.java index 2c563d6d2..48e30b72b 100644 --- a/src/org/traccar/protocol/AutoFonProtocolDecoder.java +++ b/src/org/traccar/protocol/AutoFonProtocolDecoder.java @@ -97,8 +97,8 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder { // Location position.setLatitude(convertCoordinate(buf.readInt())); position.setLongitude(convertCoordinate(buf.readInt())); - position.setAltitude((double) buf.readShort()); - position.setSpeed((double) buf.readUnsignedByte()); + position.setAltitude(buf.readShort()); + position.setSpeed(buf.readUnsignedByte()); position.setCourse(buf.readUnsignedByte() * 2.0); extendedInfo.set("hdop", buf.readUnsignedShort()); diff --git a/src/org/traccar/protocol/Avl301ProtocolDecoder.java b/src/org/traccar/protocol/Avl301ProtocolDecoder.java index 2281bfed0..66db5b55a 100644 --- a/src/org/traccar/protocol/Avl301ProtocolDecoder.java +++ b/src/org/traccar/protocol/Avl301ProtocolDecoder.java @@ -113,7 +113,7 @@ public class Avl301ProtocolDecoder extends BaseProtocolDecoder { // Course and flags int union = buf.readUnsignedShort(); - position.setCourse((double) (union & 0x03FF)); + position.setCourse(union & 0x03FF); position.setValid((union & 0x1000) != 0); if ((union & 0x0400) != 0) latitude = -latitude; if ((union & 0x0800) != 0) longitude = -longitude; diff --git a/src/org/traccar/protocol/BceProtocolDecoder.java b/src/org/traccar/protocol/BceProtocolDecoder.java index ac8e257e3..365d51cb3 100644 --- a/src/org/traccar/protocol/BceProtocolDecoder.java +++ b/src/org/traccar/protocol/BceProtocolDecoder.java @@ -96,16 +96,16 @@ public class BceProtocolDecoder extends BaseProtocolDecoder { if (checkBit(mask, 0)) { position.setValid(true); - position.setLongitude((double) buf.readFloat()); - position.setLatitude((double) buf.readFloat()); - position.setSpeed((double) buf.readUnsignedByte()); + position.setLongitude(buf.readFloat()); + position.setLatitude(buf.readFloat()); + position.setSpeed(buf.readUnsignedByte()); int gps = buf.readUnsignedByte(); extendedInfo.set("satellites", gps & 0xf); extendedInfo.set("hdop", gps >> 4); - position.setCourse((double) buf.readUnsignedByte()); - position.setAltitude((double) buf.readUnsignedShort()); + position.setCourse(buf.readUnsignedByte()); + position.setAltitude(buf.readUnsignedShort()); extendedInfo.set("milage", buf.readUnsignedInt()); diff --git a/src/org/traccar/protocol/CalAmpProtocolDecoder.java b/src/org/traccar/protocol/CalAmpProtocolDecoder.java index f24ae01c0..786ec22f6 100644 --- a/src/org/traccar/protocol/CalAmpProtocolDecoder.java +++ b/src/org/traccar/protocol/CalAmpProtocolDecoder.java @@ -174,7 +174,7 @@ public class CalAmpProtocolDecoder extends BaseProtocolDecoder { position.setAltitude(buf.readInt() * 0.01); position.setSpeed(buf.readUnsignedInt() * 0.0194384449); // cm/s } - position.setCourse((double) buf.readShort()); + position.setCourse(buf.readShort()); if (type == MSG_MINI_EVENT_REPORT) { position.setSpeed(buf.readUnsignedByte() * 0.539957); // km/h } diff --git a/src/org/traccar/protocol/EelinkProtocolDecoder.java b/src/org/traccar/protocol/EelinkProtocolDecoder.java index b18dd3970..3dde4513c 100644 --- a/src/org/traccar/protocol/EelinkProtocolDecoder.java +++ b/src/org/traccar/protocol/EelinkProtocolDecoder.java @@ -110,7 +110,7 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder { position.setLatitude(buf.readInt() / 1800000.0); position.setLongitude(buf.readInt() / 1800000.0); position.setSpeed(buf.readUnsignedByte() * 0.539957); - position.setCourse((double) buf.readUnsignedShort()); + position.setCourse(buf.readUnsignedShort()); // Cell extendedInfo.set("cell", ChannelBufferTools.readHexString(buf, 18)); @@ -170,10 +170,10 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder { double longitude = buf.readUnsignedInt() / (60.0 * 30000.0); // Speed - position.setSpeed((double) buf.readUnsignedByte()); + position.setSpeed(buf.readUnsignedByte()); // Course - position.setCourse((double) buf.readUnsignedShort()); + position.setCourse(buf.readUnsignedShort()); buf.skipBytes(3); // reserved diff --git a/src/org/traccar/protocol/GalileoProtocolDecoder.java b/src/org/traccar/protocol/GalileoProtocolDecoder.java index e30eaf914..3af06441e 100644 --- a/src/org/traccar/protocol/GalileoProtocolDecoder.java +++ b/src/org/traccar/protocol/GalileoProtocolDecoder.java @@ -135,7 +135,7 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder { break; case TAG_ALTITUDE: - position.setAltitude((double) buf.readShort()); + position.setAltitude(buf.readShort()); break; case TAG_STATUS: diff --git a/src/org/traccar/protocol/GatorProtocolDecoder.java b/src/org/traccar/protocol/GatorProtocolDecoder.java index 42dbb8cc9..df92f96cb 100644 --- a/src/org/traccar/protocol/GatorProtocolDecoder.java +++ b/src/org/traccar/protocol/GatorProtocolDecoder.java @@ -95,7 +95,7 @@ public class GatorProtocolDecoder extends BaseProtocolDecoder { position.setLatitude(ChannelBufferTools.readCoordinate(buf)); position.setLongitude(ChannelBufferTools.readCoordinate(buf)); position.setSpeed(ChannelBufferTools.readHexInteger(buf, 4) * 0.539957); - position.setCourse((double) ChannelBufferTools.readHexInteger(buf, 4)); + position.setCourse(ChannelBufferTools.readHexInteger(buf, 4)); // Flags int flags = buf.readUnsignedByte(); diff --git a/src/org/traccar/protocol/Gt02ProtocolDecoder.java b/src/org/traccar/protocol/Gt02ProtocolDecoder.java index 857330e23..5d2c9eb06 100644 --- a/src/org/traccar/protocol/Gt02ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gt02ProtocolDecoder.java @@ -107,10 +107,10 @@ public class Gt02ProtocolDecoder extends BaseProtocolDecoder { double longitude = buf.readUnsignedInt() / (60.0 * 30000.0); // Speed - position.setSpeed((double) buf.readUnsignedByte()); + position.setSpeed(buf.readUnsignedByte()); // Course - position.setCourse((double) buf.readUnsignedShort()); + position.setCourse(buf.readUnsignedShort()); buf.skipBytes(3); // reserved diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java index f3795a8dd..73c3f6004 100644 --- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -174,7 +174,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { // Course and flags int union = buf.readUnsignedShort(); - position.setCourse((double) (union & 0x03FF)); + position.setCourse(union & 0x03FF); position.setValid((union & 0x1000) != 0); if ((union & 0x0400) == 0) latitude = -latitude; if ((union & 0x0800) != 0) longitude = -longitude; diff --git a/src/org/traccar/protocol/H02ProtocolDecoder.java b/src/org/traccar/protocol/H02ProtocolDecoder.java index 2cf5c0f16..c4e8c232d 100644 --- a/src/org/traccar/protocol/H02ProtocolDecoder.java +++ b/src/org/traccar/protocol/H02ProtocolDecoder.java @@ -95,7 +95,7 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder { position.setLongitude(longitude); // Speed and course - position.setSpeed((double) ChannelBufferTools.readHexInteger(buf, 3)); + position.setSpeed(ChannelBufferTools.readHexInteger(buf, 3)); position.setCourse((buf.readUnsignedByte() & 0x0f) * 100.0 + ChannelBufferTools.readHexInteger(buf, 2)); // Status diff --git a/src/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/org/traccar/protocol/Jt600ProtocolDecoder.java index a1eb67993..e840db8b8 100644 --- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java +++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.java @@ -89,7 +89,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { position.setLongitude(longitude); // Speed - position.setSpeed((double) ChannelBufferTools.readHexInteger(buf, 2)); + position.setSpeed(ChannelBufferTools.readHexInteger(buf, 2)); // Course position.setCourse(buf.readUnsignedByte() * 2.0); @@ -104,7 +104,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { buf.readByte(); // other flags and sensors // Altitude - position.setAltitude((double) buf.readUnsignedShort()); + position.setAltitude(buf.readUnsignedShort()); extendedInfo.set("cell", buf.readUnsignedShort()); extendedInfo.set("lac", buf.readUnsignedShort()); diff --git a/src/org/traccar/protocol/KhdProtocolDecoder.java b/src/org/traccar/protocol/KhdProtocolDecoder.java index 74a68e34f..39164c2ca 100644 --- a/src/org/traccar/protocol/KhdProtocolDecoder.java +++ b/src/org/traccar/protocol/KhdProtocolDecoder.java @@ -99,7 +99,7 @@ public class KhdProtocolDecoder extends BaseProtocolDecoder { position.setLatitude(ChannelBufferTools.readCoordinate(buf)); position.setLongitude(ChannelBufferTools.readCoordinate(buf)); position.setSpeed(ChannelBufferTools.readHexInteger(buf, 4) * 0.539957); - position.setCourse((double) ChannelBufferTools.readHexInteger(buf, 4)); + position.setCourse(ChannelBufferTools.readHexInteger(buf, 4)); // Flags int flags = buf.readUnsignedByte(); diff --git a/src/org/traccar/protocol/M2mProtocolDecoder.java b/src/org/traccar/protocol/M2mProtocolDecoder.java index d67e78003..606f3b8ab 100644 --- a/src/org/traccar/protocol/M2mProtocolDecoder.java +++ b/src/org/traccar/protocol/M2mProtocolDecoder.java @@ -113,7 +113,7 @@ public class M2mProtocolDecoder extends BaseProtocolDecoder { position.setLatitude(latitude); position.setLongitude(longitude); - position.setSpeed((double) buf.readUnsignedByte()); + position.setSpeed(buf.readUnsignedByte()); // Satellites int satellites = buf.readUnsignedByte(); diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java index e213b7ddb..25a86552c 100644 --- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java +++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java @@ -224,13 +224,13 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { position.setSpeed(buf.readUnsignedShort() * 0.539957); // Course - position.setCourse((double) buf.readUnsignedShort()); + position.setCourse(buf.readUnsignedShort()); // HDOP extendedInfo.set("hdop", buf.readUnsignedShort() * 0.1); // Altitude - position.setAltitude((double) buf.readUnsignedShort()); + position.setAltitude(buf.readUnsignedShort()); // Other extendedInfo.set("milage", buf.readUnsignedInt()); diff --git a/src/org/traccar/protocol/Mta6ProtocolDecoder.java b/src/org/traccar/protocol/Mta6ProtocolDecoder.java index f09cf32f1..72c23637e 100644 --- a/src/org/traccar/protocol/Mta6ProtocolDecoder.java +++ b/src/org/traccar/protocol/Mta6ProtocolDecoder.java @@ -157,12 +157,12 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder { } if (checkBit(flags, 1)) { - position.setAltitude((double) buf.readUnsignedShort()); + position.setAltitude(buf.readUnsignedShort()); } if (checkBit(flags, 2)) { - position.setSpeed((double) (buf.readUnsignedShort() & 0x03ff)); - position.setCourse((double) buf.readUnsignedByte()); + position.setSpeed(buf.readUnsignedShort() & 0x03ff); + position.setCourse(buf.readUnsignedByte()); } if (checkBit(flags, 3)) { @@ -237,9 +237,9 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedByte(); // status if (checkBit(flags, 0)) { - position.setAltitude((double) buf.readUnsignedShort()); - position.setSpeed((double) buf.readUnsignedByte()); - position.setCourse((double) buf.readByte()); + position.setAltitude(buf.readUnsignedShort()); + position.setSpeed(buf.readUnsignedByte()); + position.setCourse(buf.readByte()); extendedInfo.set("milage", new FloatReader().readFloat(buf)); } diff --git a/src/org/traccar/protocol/NavigilProtocolDecoder.java b/src/org/traccar/protocol/NavigilProtocolDecoder.java index 9722e98a2..501f1bb39 100644 --- a/src/org/traccar/protocol/NavigilProtocolDecoder.java +++ b/src/org/traccar/protocol/NavigilProtocolDecoder.java @@ -94,14 +94,14 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { position.setLatitude(buf.readInt() * 0.0000001); position.setLongitude(buf.readInt() * 0.0000001); - position.setAltitude((double) buf.readUnsignedShort()); + position.setAltitude( buf.readUnsignedShort()); buf.readUnsignedShort(); // satellites in fix buf.readUnsignedShort(); // satellites in track buf.readUnsignedShort(); // GPS antenna state position.setSpeed(buf.readUnsignedShort() * 0.194384); - position.setCourse((double) buf.readUnsignedShort()); + position.setCourse(buf.readUnsignedShort()); buf.readUnsignedInt(); // distance buf.readUnsignedInt(); // delta distance @@ -134,13 +134,13 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { position.setLatitude(buf.readInt() * 0.0000001); position.setLongitude(buf.readInt() * 0.0000001); - position.setAltitude((double) buf.readUnsignedShort()); + position.setAltitude(buf.readUnsignedShort()); buf.readUnsignedByte(); // satellites in fix buf.readUnsignedByte(); // satellites in track position.setSpeed(buf.readUnsignedShort() * 0.194384); - position.setCourse((double) buf.readUnsignedShort()); + position.setCourse(buf.readUnsignedShort()); buf.readUnsignedInt(); // distance buf.readUnsignedShort(); // maximum speed @@ -224,7 +224,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { position.setLatitude(buf.readInt() * 0.0000001); position.setLongitude(buf.readInt() * 0.0000001); - position.setAltitude((double) buf.readUnsignedShort()); + position.setAltitude(buf.readUnsignedShort()); buf.readUnsignedByte(); // satellites in fix buf.readUnsignedByte(); // satellites in track diff --git a/src/org/traccar/protocol/NavisProtocolDecoder.java b/src/org/traccar/protocol/NavisProtocolDecoder.java index 7e3dc9728..e98b8d15a 100644 --- a/src/org/traccar/protocol/NavisProtocolDecoder.java +++ b/src/org/traccar/protocol/NavisProtocolDecoder.java @@ -172,8 +172,8 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder { // Location data position.setLatitude(buf.readFloat() / Math.PI * 180); position.setLongitude(buf.readFloat() / Math.PI * 180); - position.setSpeed((double) buf.readFloat()); - position.setCourse((double) buf.readUnsignedShort()); + position.setSpeed(buf.readFloat()); + position.setCourse(buf.readUnsignedShort()); // Milage extendedInfo.set("milage", buf.readFloat()); diff --git a/src/org/traccar/protocol/NoranProtocolDecoder.java b/src/org/traccar/protocol/NoranProtocolDecoder.java index b212eace9..5021f6cd4 100644 --- a/src/org/traccar/protocol/NoranProtocolDecoder.java +++ b/src/org/traccar/protocol/NoranProtocolDecoder.java @@ -91,10 +91,10 @@ public class NoranProtocolDecoder extends BaseProtocolDecoder { extendedInfo.set("alarm", buf.readUnsignedByte()); // Location - position.setSpeed((double) buf.readUnsignedByte()); - position.setCourse((double) buf.readUnsignedShort()); - position.setLongitude((double) buf.readFloat()); - position.setLatitude((double) buf.readFloat()); + position.setSpeed(buf.readUnsignedByte()); + position.setCourse(buf.readUnsignedShort()); + position.setLongitude(buf.readFloat()); + position.setLatitude(buf.readFloat()); // Time long timeValue = buf.readUnsignedInt(); diff --git a/src/org/traccar/protocol/OrionProtocolDecoder.java b/src/org/traccar/protocol/OrionProtocolDecoder.java index 3b4b598b1..fdcbe23b6 100644 --- a/src/org/traccar/protocol/OrionProtocolDecoder.java +++ b/src/org/traccar/protocol/OrionProtocolDecoder.java @@ -97,7 +97,7 @@ public class OrionProtocolDecoder extends BaseProtocolDecoder { position.setLatitude(convertCoordinate(buf.readInt())); position.setLongitude(convertCoordinate(buf.readInt())); position.setAltitude(buf.readShort()/ 10.0); - position.setCourse((double) buf.readUnsignedShort()); + position.setCourse(buf.readUnsignedShort()); position.setSpeed(buf.readUnsignedShort() * 0.0539957); // Date and time diff --git a/src/org/traccar/protocol/PiligrimProtocolDecoder.java b/src/org/traccar/protocol/PiligrimProtocolDecoder.java index 0190ec076..652b2cd37 100644 --- a/src/org/traccar/protocol/PiligrimProtocolDecoder.java +++ b/src/org/traccar/protocol/PiligrimProtocolDecoder.java @@ -141,7 +141,7 @@ public class PiligrimProtocolDecoder extends BaseProtocolDecoder { position.setValid(satellites >= 3); // Speed - position.setSpeed((double) buf.readUnsignedByte()); + position.setSpeed(buf.readUnsignedByte()); // Course double course = buf.readUnsignedByte() << 1; diff --git a/src/org/traccar/protocol/ProgressProtocolDecoder.java b/src/org/traccar/protocol/ProgressProtocolDecoder.java index 04584b884..95fda1f48 100644 --- a/src/org/traccar/protocol/ProgressProtocolDecoder.java +++ b/src/org/traccar/protocol/ProgressProtocolDecoder.java @@ -145,19 +145,19 @@ public class ProgressProtocolDecoder extends BaseProtocolDecoder { position.setTime(time.getTime()); // Latitude - position.setLatitude(((double) buf.readInt()) / 0x7FFFFFFF * 180.0); + position.setLatitude(buf.readInt() * 180.0 / 0x7FFFFFFF); // Longitude - position.setLongitude(((double) buf.readInt()) / 0x7FFFFFFF * 180.0); + position.setLongitude(buf.readInt() * 180.0 / 0x7FFFFFFF); // Speed - position.setSpeed(((double) buf.readUnsignedInt()) / 100); + position.setSpeed(buf.readUnsignedInt() / 100); // Course - position.setCourse(((double) buf.readUnsignedShort()) / 100); + position.setCourse(buf.readUnsignedShort() / 100); // Altitude - position.setAltitude(((double) buf.readUnsignedShort()) / 100); + position.setAltitude(buf.readUnsignedShort() / 100); // Satellites int satellitesNumber = buf.readUnsignedByte(); diff --git a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java index 51150a8e9..6fdacb871 100644 --- a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java +++ b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java @@ -169,7 +169,7 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder { // Altitude if (checkBit(mask, 15)) { - position.setAltitude((double) buf.readMedium()); + position.setAltitude(buf.readMedium()); } // Satellites diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java index f39a81fbc..6a4a35b20 100644 --- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java +++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java @@ -104,7 +104,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { } if (checkBit(locationMask, 1)) { - position.setAltitude((double) buf.readUnsignedShort()); + position.setAltitude(buf.readUnsignedShort()); } if (checkBit(locationMask, 2)) { @@ -142,8 +142,8 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { position.setLongitude(buf.readInt() / 10000000.0); position.setLatitude(buf.readInt() / 10000000.0); - position.setAltitude((double) buf.readShort()); - position.setCourse((double) buf.readUnsignedShort()); + position.setAltitude(buf.readShort()); + position.setCourse(buf.readUnsignedShort()); int satellites = buf.readUnsignedByte(); extendedInfo.set("satellites", satellites); diff --git a/src/org/traccar/protocol/TytanProtocolDecoder.java b/src/org/traccar/protocol/TytanProtocolDecoder.java index b52e83852..d86e5872e 100644 --- a/src/org/traccar/protocol/TytanProtocolDecoder.java +++ b/src/org/traccar/protocol/TytanProtocolDecoder.java @@ -87,7 +87,7 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder { // Course int course = (buf.readUnsignedByte() >> 5) * 45; course = (course + 180) % 360; - position.setCourse((double) course); + position.setCourse(course); // Speed int speed = buf.readUnsignedByte(); diff --git a/src/org/traccar/protocol/UlbotechProtocolDecoder.java b/src/org/traccar/protocol/UlbotechProtocolDecoder.java index 0872f6238..42cda7bad 100644 --- a/src/org/traccar/protocol/UlbotechProtocolDecoder.java +++ b/src/org/traccar/protocol/UlbotechProtocolDecoder.java @@ -85,7 +85,7 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder { position.setLatitude(buf.readInt() / 1000000.0); position.setLongitude(buf.readInt() / 1000000.0); position.setSpeed(buf.readUnsignedShort() * 0.539957); - position.setCourse((double) buf.readUnsignedShort()); + position.setCourse(buf.readUnsignedShort()); extendedInfo.set("hdop", buf.readUnsignedShort()); break; -- cgit v1.2.3