diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-03-09 15:25:30 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2018-03-09 15:25:30 +1300 |
commit | 0c5fa5cc8ea437db3c449b158310c5783aaea3ef (patch) | |
tree | f0315a517f8234dc61ac9b167f15037ac8b1d739 /src | |
parent | 7831801c2d3d4d425659f985a53dbc1eaef6b5fb (diff) | |
download | trackermap-server-0c5fa5cc8ea437db3c449b158310c5783aaea3ef.tar.gz trackermap-server-0c5fa5cc8ea437db3c449b158310c5783aaea3ef.tar.bz2 trackermap-server-0c5fa5cc8ea437db3c449b158310c5783aaea3ef.zip |
Fix Watch protocol decoding
Diffstat (limited to 'src')
-rw-r--r-- | src/org/traccar/protocol/WatchProtocolDecoder.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/WatchProtocolDecoder.java b/src/org/traccar/protocol/WatchProtocolDecoder.java index 6adcb34f2..1dd07a3f7 100644 --- a/src/org/traccar/protocol/WatchProtocolDecoder.java +++ b/src/org/traccar/protocol/WatchProtocolDecoder.java @@ -48,7 +48,7 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder { .expression("([NS]),") .number(" *(-?d+.d+),") // longitude .expression("([EW])?,") - .number("(d+.d+),") // speed + .number("(d+.?d*),") // speed .number("(d+.?d*),") // course .number("(d+.?d*),") // altitude .number("(d+),") // satellites @@ -139,7 +139,7 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder { String manufacturer = buf.readBytes(2).toString(StandardCharsets.US_ASCII); buf.skipBytes(1); // delimiter - int idLength = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) '*'); + int idLength = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) '*') - buf.readerIndex(); String id = buf.readBytes(idLength).toString(StandardCharsets.US_ASCII); DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, id); if (deviceSession == null) { @@ -150,7 +150,7 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder { String index = null; if (idLength > 10) { - int indexLength = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) '*'); + int indexLength = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) '*') - buf.readerIndex(); index = buf.readBytes(indexLength).toString(StandardCharsets.US_ASCII); buf.skipBytes(1); // delimiter } |