aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-11-27 20:11:47 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2017-11-27 20:11:47 +1300
commit4f772b76b08d7515cf27c7bfda819612aeea26f9 (patch)
tree9cf7d3434d543bf323eefed615a0b44d5f3ec34f /src/org/traccar
parentcef10080c6012f42823d616b55c6b24215cd9253 (diff)
downloadtrackermap-server-4f772b76b08d7515cf27c7bfda819612aeea26f9.tar.gz
trackermap-server-4f772b76b08d7515cf27c7bfda819612aeea26f9.tar.bz2
trackermap-server-4f772b76b08d7515cf27c7bfda819612aeea26f9.zip
Handle invalid battery level
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/protocol/TmgProtocolDecoder.java5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/TmgProtocolDecoder.java b/src/org/traccar/protocol/TmgProtocolDecoder.java
index a7ca35f70..5e852aff2 100644
--- a/src/org/traccar/protocol/TmgProtocolDecoder.java
+++ b/src/org/traccar/protocol/TmgProtocolDecoder.java
@@ -70,7 +70,7 @@ public class TmgProtocolDecoder extends BaseProtocolDecoder {
.number("[^,]*,") // cid
.number("(d+),") // rssi
.number("(d+),") // satellites
- .number("(d+),") // battery level
+ .number("[^,]*,") // battery level
.expression("([01]),") // ignition
.expression("[LH]{4},") // input
.expression("[NT]{4},") // tamper status
@@ -166,11 +166,10 @@ public class TmgProtocolDecoder extends BaseProtocolDecoder {
}
- if (parser.hasNext()) {
+ if (parser.hasNext(6)) {
position.set(Position.KEY_RSSI, parser.nextInt());
position.set(Position.KEY_SATELLITES, parser.nextInt());
- position.set(Position.KEY_BATTERY_LEVEL, parser.nextInt());
position.set(Position.KEY_IGNITION, parser.nextInt() == 1);
position.set(Position.PREFIX_ADC + 1, parser.nextDouble());
position.set(Position.PREFIX_ADC + 2, parser.nextDouble());