aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/H02FrameDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-01-12 02:07:56 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2017-01-12 01:07:56 +1300
commite54122e22725bae7a962d58e06a497526aed46cb (patch)
tree2a69b6f039103564252ebf42df618353898e681f /src/org/traccar/protocol/H02FrameDecoder.java
parentafa6bfcef49c7152b3292010f43075356b9c9727 (diff)
downloadtrackermap-server-e54122e22725bae7a962d58e06a497526aed46cb.tar.gz
trackermap-server-e54122e22725bae7a962d58e06a497526aed46cb.tar.bz2
trackermap-server-e54122e22725bae7a962d58e06a497526aed46cb.zip
Better handle H02 X mode (fix #2780)
Diffstat (limited to 'src/org/traccar/protocol/H02FrameDecoder.java')
-rw-r--r--src/org/traccar/protocol/H02FrameDecoder.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/H02FrameDecoder.java b/src/org/traccar/protocol/H02FrameDecoder.java
index a22252a57..b2da64847 100644
--- a/src/org/traccar/protocol/H02FrameDecoder.java
+++ b/src/org/traccar/protocol/H02FrameDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 - 2016 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.
@@ -37,7 +37,7 @@ public class H02FrameDecoder extends FrameDecoder {
char marker = (char) buf.getByte(buf.readerIndex());
- while (marker != '*' && marker != '$' && buf.readableBytes() > 0) {
+ while (marker != '*' && marker != '$' && marker != 'X' && buf.readableBytes() > 0) {
buf.skipBytes(1);
if (buf.readableBytes() > 0) {
marker = (char) buf.getByte(buf.readerIndex());
@@ -66,6 +66,12 @@ public class H02FrameDecoder extends FrameDecoder {
return buf.readBytes(messageLength);
}
+ } else if (marker == 'X') {
+
+ if (buf.readableBytes() >= MESSAGE_SHORT) {
+ return buf.readBytes(MESSAGE_SHORT);
+ }
+
}
return null;