diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-26 12:42:05 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-26 12:42:05 +1300 |
commit | fbcc3d200aaf25bbe1a6cf30274dd169ecaa8b40 (patch) | |
tree | ea36d6d1f64f9cbd26a68cb56aef23a5b1cb25a8 /src/org/traccar/protocol | |
parent | 0d064e99c1078fe9deb1658d1daa6802ff4685e5 (diff) | |
download | trackermap-server-fbcc3d200aaf25bbe1a6cf30274dd169ecaa8b40.tar.gz trackermap-server-fbcc3d200aaf25bbe1a6cf30274dd169ecaa8b40.tar.bz2 trackermap-server-fbcc3d200aaf25bbe1a6cf30274dd169ecaa8b40.zip |
Modify STL060 frame decoder
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r-- | src/org/traccar/protocol/Stl060FrameDecoder.java | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/org/traccar/protocol/Stl060FrameDecoder.java b/src/org/traccar/protocol/Stl060FrameDecoder.java index 119abfbe3..32ff5135b 100644 --- a/src/org/traccar/protocol/Stl060FrameDecoder.java +++ b/src/org/traccar/protocol/Stl060FrameDecoder.java @@ -29,20 +29,17 @@ public class Stl060FrameDecoder extends CharacterDelimiterFrameDecoder { @Override protected Object decode( - ChannelHandlerContext ctx, - Channel channel, - ChannelBuffer buf) throws Exception { + ChannelHandlerContext ctx, Channel channel, ChannelBuffer buf) throws Exception { ChannelBuffer result = (ChannelBuffer) super.decode(ctx, channel, buf); if (result != null) { - Integer beginIndex = ChannelBufferTools.find( - result, 0, result.readableBytes(), "$"); - if (beginIndex == null) { + int index = result.indexOf(result.readerIndex(), result.writerIndex(), (byte) '$'); + if (index == -1) { return result; } else { - result.skipBytes(beginIndex); + result.skipBytes(index); return result.readBytes(result.readableBytes()); } |