aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-26 12:42:05 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-26 12:42:05 +1300
commitfbcc3d200aaf25bbe1a6cf30274dd169ecaa8b40 (patch)
treeea36d6d1f64f9cbd26a68cb56aef23a5b1cb25a8 /src/org/traccar/protocol
parent0d064e99c1078fe9deb1658d1daa6802ff4685e5 (diff)
downloadtrackermap-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.java11
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());
}