diff options
author | Oliver Schramm <oliver.schramm97@gmail.com> | 2021-06-24 19:39:18 +0200 |
---|---|---|
committer | Oliver Schramm <oliver.schramm97@gmail.com> | 2021-06-24 19:39:18 +0200 |
commit | c10c4b985002d9b39213f6a4e33466212705f66d (patch) | |
tree | 14a9c21c2c5674a8cd0c5d89cfc2e6d1c6614aed /src/main/java/org/traccar/protocol/MegastekFrameDecoder.java | |
parent | 48670633fd49e3ec2bd781f858b11ccd2083878d (diff) | |
download | trackermap-server-c10c4b985002d9b39213f6a4e33466212705f66d.tar.gz trackermap-server-c10c4b985002d9b39213f6a4e33466212705f66d.tar.bz2 trackermap-server-c10c4b985002d9b39213f6a4e33466212705f66d.zip |
Improve compatibility with megastek devices
Megastek devices send some data which either is not
fully compliant with the megastek protocol (by omitting
some data) or which is (for our purposes) garbage data,
which is only delimited with a single LF (0x0A).
Diffstat (limited to 'src/main/java/org/traccar/protocol/MegastekFrameDecoder.java')
-rw-r--r-- | src/main/java/org/traccar/protocol/MegastekFrameDecoder.java | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/MegastekFrameDecoder.java b/src/main/java/org/traccar/protocol/MegastekFrameDecoder.java index 347fa24b1..a4091436c 100644 --- a/src/main/java/org/traccar/protocol/MegastekFrameDecoder.java +++ b/src/main/java/org/traccar/protocol/MegastekFrameDecoder.java @@ -46,6 +46,9 @@ public class MegastekFrameDecoder extends BaseFrameDecoder { if (delimiter == -1) { delimiter = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) '!'); } + if (delimiter == -1) { + delimiter = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) '\n'); + } if (delimiter != -1) { ByteBuf result = buf.readRetainedSlice(delimiter - buf.readerIndex()); buf.skipBytes(1); |