aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/WatchFrameDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-02-18 13:18:28 -0800
committerGitHub <noreply@github.com>2019-02-18 13:18:28 -0800
commit0e209e80f03e72095e5b449679925066b01403d2 (patch)
tree881ab37ce5867fd8358d4bdf0195824c47e26be2 /src/org/traccar/protocol/WatchFrameDecoder.java
parent774d560ecb5f8da9e64059a4d25622c4fba55bf2 (diff)
parentc82be0541481955a0832948574244f31757f7067 (diff)
downloadtrackermap-server-0e209e80f03e72095e5b449679925066b01403d2.tar.gz
trackermap-server-0e209e80f03e72095e5b449679925066b01403d2.tar.bz2
trackermap-server-0e209e80f03e72095e5b449679925066b01403d2.zip
Merge pull request #4221 from flocsy/8bit-voice-message
Fixed 8bit voice message
Diffstat (limited to 'src/org/traccar/protocol/WatchFrameDecoder.java')
-rw-r--r--src/org/traccar/protocol/WatchFrameDecoder.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/WatchFrameDecoder.java b/src/org/traccar/protocol/WatchFrameDecoder.java
index b2ac5b4f7..f99bd52e2 100644
--- a/src/org/traccar/protocol/WatchFrameDecoder.java
+++ b/src/org/traccar/protocol/WatchFrameDecoder.java
@@ -31,9 +31,10 @@ public class WatchFrameDecoder extends BaseFrameDecoder {
if (endIndex > 0) {
ByteBuf frame = Unpooled.buffer();
while (buf.readerIndex() < endIndex) {
- byte b = buf.readByte();
- if (b == '}') {
- switch (buf.readByte()) {
+ byte b1 = buf.readByte();
+ if (b1 == '}') {
+ byte b2 = buf.readByte();
+ switch (b2) {
case 0x01:
frame.writeByte('}');
break;
@@ -50,10 +51,11 @@ public class WatchFrameDecoder extends BaseFrameDecoder {
frame.writeByte('*');
break;
default:
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(String.format(
+ "unexpected byte at %d: 0x%02x", buf.readerIndex() - 1, b2));
}
} else {
- frame.writeByte(b);
+ frame.writeByte(b1);
}
}
return frame;