diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-04-17 16:32:02 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-04-17 16:32:02 +1200 |
commit | 1c756c57653b72a656407da9c53ac292c5551cdb (patch) | |
tree | 69e88e24aae184508ab51932ef2692ae9515eef2 /src/org/traccar/protocol/CarcellProtocolDecoder.java | |
parent | 4ab007201bd177a2fbf46a90b7b73262c5792caf (diff) | |
download | trackermap-server-1c756c57653b72a656407da9c53ac292c5551cdb.tar.gz trackermap-server-1c756c57653b72a656407da9c53ac292c5551cdb.tar.bz2 trackermap-server-1c756c57653b72a656407da9c53ac292c5551cdb.zip |
Allow optional primitives
Diffstat (limited to 'src/org/traccar/protocol/CarcellProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/CarcellProtocolDecoder.java | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/org/traccar/protocol/CarcellProtocolDecoder.java b/src/org/traccar/protocol/CarcellProtocolDecoder.java index 40e40a40f..fedc65168 100644 --- a/src/org/traccar/protocol/CarcellProtocolDecoder.java +++ b/src/org/traccar/protocol/CarcellProtocolDecoder.java @@ -107,24 +107,24 @@ public class CarcellProtocolDecoder extends BaseProtocolDecoder { position.setLongitude(parser.nextCoordinate(CoordinateFormat.HEM_DEG)); } - position.setSpeed(UnitsConverter.knotsFromKph(parser.nextInt())); - position.setCourse(parser.nextInt()); + position.setSpeed(UnitsConverter.knotsFromKph(parser.nextInt(0))); + position.setCourse(parser.nextInt(0)); if (parser.hasNext(3)) { - position.set("x", parser.nextInt()); - position.set("y", parser.nextInt()); - position.set("z", parser.nextInt()); + position.set("x", parser.nextInt(0)); + position.set("y", parser.nextInt(0)); + position.set("z", parser.nextInt(0)); } if (parser.hasNext(1)) { - position.set(Position.KEY_ACCELERATION, parser.nextInt()); + position.set(Position.KEY_ACCELERATION, parser.nextInt(0)); } - Double internalBattery = (parser.nextDouble() + 100d) * 0.0294d; + Double internalBattery = (parser.nextDouble(0) + 100d) * 0.0294d; position.set(Position.KEY_BATTERY, internalBattery); - position.set(Position.KEY_RSSI, parser.nextInt()); + position.set(Position.KEY_RSSI, parser.nextInt(0)); position.set("jamming", parser.next().equals("1")); - position.set(Position.KEY_GPS, parser.nextInt()); + position.set(Position.KEY_GPS, parser.nextInt(0)); position.set("clockType", parser.next()); @@ -144,16 +144,16 @@ public class CarcellProtocolDecoder extends BaseProtocolDecoder { } position.set("painel", painelStatus.equals("2")); - Double mainVoltage = parser.nextDouble() / 100d; + Double mainVoltage = parser.nextDouble(0) / 100d; position.set(Position.KEY_POWER, mainVoltage); } if (parser.hasNext(5)) { - position.set("timeUntilDelivery", parser.nextInt()); + position.set("timeUntilDelivery", parser.nextInt(0)); parser.next(); // panic button status position.set(Position.KEY_INPUT, parser.next()); - Double mainVoltage = parser.nextDouble() / 100d; + Double mainVoltage = parser.nextDouble(0) / 100d; position.set(Position.KEY_POWER, mainVoltage); position.set("iccid", parser.next()); |