diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-12-16 14:38:38 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-12-16 14:38:38 +1300 |
commit | b0151a400565a0affab756ff02e183d269220be9 (patch) | |
tree | 68e3a2f4280f249e1df110873312b2b1908e99cc /src/org/traccar/protocol | |
parent | b3e1a81f722ddf93ba70f16686301022bfe2454e (diff) | |
download | traccar-server-b0151a400565a0affab756ff02e183d269220be9.tar.gz traccar-server-b0151a400565a0affab756ff02e183d269220be9.tar.bz2 traccar-server-b0151a400565a0affab756ff02e183d269220be9.zip |
Handle short Totem messages
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r-- | src/org/traccar/protocol/TotemFrameDecoder.java | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/TotemFrameDecoder.java b/src/org/traccar/protocol/TotemFrameDecoder.java index 6c9b14559..70dc5db3b 100644 --- a/src/org/traccar/protocol/TotemFrameDecoder.java +++ b/src/org/traccar/protocol/TotemFrameDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 Anton Tananaev (anton@traccar.org) + * Copyright 2013 - 2017 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,8 +42,7 @@ public class TotemFrameDecoder extends FrameDecoder { int length; - int separatorIndex = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) '|'); - if (separatorIndex > 0 && separatorIndex - beginIndex > 19) { + if (buf.getByte(buf.readerIndex() + 2) == (byte) '0') { length = Integer.parseInt(buf.toString(buf.readerIndex() + 2, 4, StandardCharsets.US_ASCII)); } else { length = Integer.parseInt(buf.toString(buf.readerIndex() + 2, 2, StandardCharsets.US_ASCII), 16); |