aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/TmgProtocolDecoder.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/TmgProtocolDecoder.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/TmgProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/TmgProtocolDecoder.java30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/org/traccar/protocol/TmgProtocolDecoder.java b/src/org/traccar/protocol/TmgProtocolDecoder.java
index 223f1e419..c10523117 100644
--- a/src/org/traccar/protocol/TmgProtocolDecoder.java
+++ b/src/org/traccar/protocol/TmgProtocolDecoder.java
@@ -115,24 +115,24 @@ public class TmgProtocolDecoder extends BaseProtocolDecoder {
position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS));
- position.setValid(parser.nextInt() > 0);
+ position.setValid(parser.nextInt(0) > 0);
position.setLatitude(parser.nextCoordinate());
position.setLongitude(parser.nextCoordinate());
- position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble()));
- position.setCourse(parser.nextDouble());
- position.setAltitude(parser.nextDouble());
+ position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble(0)));
+ position.setCourse(parser.nextDouble(0));
+ position.setAltitude(parser.nextDouble(0));
- position.set(Position.KEY_HDOP, parser.nextDouble());
- position.set(Position.KEY_SATELLITES, parser.nextInt());
- position.set(Position.KEY_SATELLITES_VISIBLE, parser.nextInt());
+ position.set(Position.KEY_HDOP, parser.nextDouble(0));
+ position.set(Position.KEY_SATELLITES, parser.nextInt(0));
+ position.set(Position.KEY_SATELLITES_VISIBLE, parser.nextInt(0));
position.set(Position.KEY_OPERATOR, parser.next());
- position.set(Position.KEY_RSSI, parser.nextInt());
- position.set(Position.KEY_IGNITION, parser.nextInt() == 1);
- position.set(Position.KEY_BATTERY, parser.nextDouble());
- position.set(Position.KEY_POWER, parser.nextDouble());
+ position.set(Position.KEY_RSSI, parser.nextInt(0));
+ position.set(Position.KEY_IGNITION, parser.nextInt(0) == 1);
+ position.set(Position.KEY_BATTERY, parser.nextDouble(0));
+ position.set(Position.KEY_POWER, parser.nextDouble(0));
- int input = parser.nextInt(2);
- int output = parser.nextInt(2);
+ int input = parser.nextBinInt(0);
+ int output = parser.nextBinInt(0);
if (!BitUtil.check(input, 0)) {
position.set(Position.KEY_ALARM, Position.ALARM_SOS);
@@ -141,8 +141,8 @@ public class TmgProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_INPUT, input);
position.set(Position.KEY_OUTPUT, output);
- position.set(Position.PREFIX_ADC + 1, parser.nextDouble());
- position.set(Position.PREFIX_ADC + 2, parser.nextDouble());
+ position.set(Position.PREFIX_ADC + 1, parser.nextDouble(0));
+ position.set(Position.PREFIX_ADC + 2, parser.nextDouble(0));
position.set(Position.KEY_VERSION_FW, parser.next());
position.set(Position.KEY_RFID, parser.next());