aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-04-17 16:32:02 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2017-04-17 16:32:02 +1200
commit1c756c57653b72a656407da9c53ac292c5551cdb (patch)
tree69e88e24aae184508ab51932ef2692ae9515eef2 /src/org/traccar/protocol/MeiligaoProtocolDecoder.java
parent4ab007201bd177a2fbf46a90b7b73262c5792caf (diff)
downloadtrackermap-server-1c756c57653b72a656407da9c53ac292c5551cdb.tar.gz
trackermap-server-1c756c57653b72a656407da9c53ac292c5551cdb.tar.bz2
trackermap-server-1c756c57653b72a656407da9c53ac292c5551cdb.zip
Allow optional primitives
Diffstat (limited to 'src/org/traccar/protocol/MeiligaoProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/MeiligaoProtocolDecoder.java68
1 files changed, 34 insertions, 34 deletions
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
index af0b356a6..b947b2855 100644
--- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
@@ -210,50 +210,50 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
}
DateBuilder dateBuilder = new DateBuilder()
- .setTime(parser.nextInt(), parser.nextInt(), parser.nextInt());
+ .setTime(parser.nextInt(0), parser.nextInt(0), parser.nextInt(0));
position.setValid(parser.next().equals("A"));
position.setLatitude(parser.nextCoordinate());
position.setLongitude(parser.nextCoordinate());
if (parser.hasNext()) {
- position.setSpeed(parser.nextDouble());
+ position.setSpeed(parser.nextDouble(0));
}
if (parser.hasNext()) {
- position.setCourse(parser.nextDouble());
+ position.setCourse(parser.nextDouble(0));
}
- dateBuilder.setDateReverse(parser.nextInt(), parser.nextInt(), parser.nextInt());
+ dateBuilder.setDateReverse(parser.nextInt(0), parser.nextInt(0), parser.nextInt(0));
position.setTime(dateBuilder.getDate());
position.set(Position.KEY_HDOP, parser.next());
if (parser.hasNext()) {
- position.setAltitude(parser.nextDouble());
+ position.setAltitude(parser.nextDouble(0));
}
position.set(Position.KEY_STATUS, parser.next());
for (int i = 1; i <= 8; i++) {
if (parser.hasNext()) {
- position.set(Position.PREFIX_ADC + i, parser.nextInt(16));
+ position.set(Position.PREFIX_ADC + i, parser.nextHexInt(0));
}
}
if (parser.hasNext()) {
- position.set(Position.KEY_RSSI, parser.nextInt(16));
+ position.set(Position.KEY_RSSI, parser.nextHexInt(0));
}
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.KEY_ODOMETER, parser.nextLong(16));
+ position.set(Position.KEY_ODOMETER, parser.nextLong(16, 0));
}
if (parser.hasNext()) {
- position.set(Position.KEY_RFID, parser.nextInt(16));
+ position.set(Position.KEY_RFID, parser.nextHexInt(0));
}
return position;
@@ -282,21 +282,21 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
getLastLocation(position, null);
- position.set(Position.KEY_BATTERY, parser.nextDouble());
- position.set(Position.KEY_RPM, parser.nextInt());
- position.set(Position.KEY_OBD_SPEED, parser.nextInt());
- position.set(Position.KEY_THROTTLE, parser.nextDouble());
- position.set("engineLoad", parser.nextDouble());
- position.set(Position.PREFIX_TEMP + 1, parser.nextInt());
- position.set(Position.KEY_FUEL_CONSUMPTION, parser.nextDouble());
- position.set("averageFuelConsumption", parser.nextDouble());
- position.set("drivingRange", parser.nextDouble());
- position.set(Position.KEY_ODOMETER, parser.nextDouble());
- position.set("singleFuelConsumption", parser.nextDouble());
- position.set("totalFuelConsumption", parser.nextDouble());
- position.set(Position.KEY_DTCS, parser.nextInt());
- position.set("harshAcelerationNo", parser.nextInt());
- position.set("harshBreakerNo", parser.nextInt());
+ position.set(Position.KEY_BATTERY, parser.nextDouble(0));
+ position.set(Position.KEY_RPM, parser.nextInt(0));
+ position.set(Position.KEY_OBD_SPEED, parser.nextInt(0));
+ position.set(Position.KEY_THROTTLE, parser.nextDouble(0));
+ position.set("engineLoad", parser.nextDouble(0));
+ position.set(Position.PREFIX_TEMP + 1, parser.nextInt(0));
+ position.set(Position.KEY_FUEL_CONSUMPTION, parser.nextDouble(0));
+ position.set("averageFuelConsumption", parser.nextDouble(0));
+ position.set("drivingRange", parser.nextDouble(0));
+ position.set(Position.KEY_ODOMETER, parser.nextDouble(0));
+ position.set("singleFuelConsumption", parser.nextDouble(0));
+ position.set("totalFuelConsumption", parser.nextDouble(0));
+ position.set(Position.KEY_DTCS, parser.nextInt(0));
+ position.set("harshAcelerationNo", parser.nextInt(0));
+ position.set("harshBreakerNo", parser.nextInt(0));
return position;
}
@@ -309,15 +309,15 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
getLastLocation(position, null);
- position.set("totalIgnitionNo", parser.nextInt());
- position.set("totalDrivingTime", parser.nextDouble());
- position.set("totalIdlingTime", parser.nextDouble());
- position.set("averageHotStartTime", parser.nextInt());
- position.set("averageSpeed", parser.nextInt());
- position.set("historyHighestSpeed", parser.nextInt());
- position.set("historyHighestRpm", parser.nextInt());
- position.set("totalHarshAccerleration", parser.nextInt());
- position.set("totalHarshBrake", parser.nextInt());
+ position.set("totalIgnitionNo", parser.nextInt(0));
+ position.set("totalDrivingTime", parser.nextDouble(0));
+ position.set("totalIdlingTime", parser.nextDouble(0));
+ position.set("averageHotStartTime", parser.nextInt(0));
+ position.set("averageSpeed", parser.nextInt(0));
+ position.set("historyHighestSpeed", parser.nextInt(0));
+ position.set("historyHighestRpm", parser.nextInt(0));
+ position.set("totalHarshAccerleration", parser.nextInt(0));
+ position.set("totalHarshBrake", parser.nextInt(0));
return position;
}