aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/WatchProtocolDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol/WatchProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/WatchProtocolDecoder.java6
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
}