aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/Tk103ProtocolDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol/Tk103ProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/Tk103ProtocolDecoder.java24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/org/traccar/protocol/Tk103ProtocolDecoder.java b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
index 64314f6c8..baaa6c6fe 100644
--- a/src/org/traccar/protocol/Tk103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
@@ -140,12 +140,12 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
getLastLocation(position, parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS));
- int battery = parser.nextInt();
+ int battery = parser.nextInt(0);
if (battery != 65535) {
position.set(Position.KEY_BATTERY, battery * 0.01);
}
- int power = parser.nextInt();
+ int power = parser.nextInt(0);
if (power != 65535) {
position.set(Position.KEY_POWER, power * 0.1);
}
@@ -164,7 +164,7 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
getLastLocation(position, null);
position.setNetwork(new Network(CellTower.from(
- parser.nextInt(), parser.nextInt(), parser.nextInt(16), parser.nextInt(16))));
+ parser.nextInt(0), parser.nextInt(0), parser.nextHexInt(0), parser.nextHexInt(0))));
return position;
}
@@ -187,9 +187,9 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
DateBuilder dateBuilder = new DateBuilder();
if (parser.next() == null) {
- dateBuilder.setDate(parser.nextInt(), parser.nextInt(), parser.nextInt());
+ dateBuilder.setDate(parser.nextInt(0), parser.nextInt(0), parser.nextInt(0));
} else {
- dateBuilder.setDateReverse(parser.nextInt(), parser.nextInt(), parser.nextInt());
+ dateBuilder.setDateReverse(parser.nextInt(0), parser.nextInt(0), parser.nextInt(0));
}
position.setValid(parser.next().equals("A"));
@@ -198,20 +198,20 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
switch (Context.getConfig().getString(getProtocolName() + ".speed", "kmh")) {
case "kn":
- position.setSpeed(parser.nextDouble());
+ position.setSpeed(parser.nextDouble(0));
break;
case "mph":
- position.setSpeed(UnitsConverter.knotsFromMph(parser.nextDouble()));
+ position.setSpeed(UnitsConverter.knotsFromMph(parser.nextDouble(0)));
break;
default:
- position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble()));
+ position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble(0)));
break;
}
- dateBuilder.setTime(parser.nextInt(), parser.nextInt(), parser.nextInt());
+ dateBuilder.setTime(parser.nextInt(0), parser.nextInt(0), parser.nextInt(0));
position.setTime(dateBuilder.getDate());
- position.setCourse(parser.nextDouble());
+ position.setCourse(parser.nextDouble(0));
String status = parser.next();
if (status != null) {
@@ -224,11 +224,11 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_STATUS, parser.next()); // hex status
if (parser.hasNext()) {
- position.set(Position.KEY_ODOMETER, parser.nextLong(16));
+ position.set(Position.KEY_ODOMETER, parser.nextLong(16, 0));
}
if (parser.hasNext()) {
- position.set(Position.PREFIX_TEMP + 1, parser.nextDouble());
+ position.set(Position.PREFIX_TEMP + 1, parser.nextDouble(0));
}
return position;