aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/TramigoFrameDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-02-11 09:50:21 -0800
committerAnton Tananaev <anton@traccar.org>2023-02-11 09:50:21 -0800
commitb2824862bb72e7521a61d047235d2dc8ac4c52cd (patch)
tree2a5e12ae5379866d9053b9739239b8d660a0aaba /src/main/java/org/traccar/protocol/TramigoFrameDecoder.java
parent514582dd83c4520948c03eb3fc84444e0d7f5a49 (diff)
downloadtrackermap-server-b2824862bb72e7521a61d047235d2dc8ac4c52cd.tar.gz
trackermap-server-b2824862bb72e7521a61d047235d2dc8ac4c52cd.tar.bz2
trackermap-server-b2824862bb72e7521a61d047235d2dc8ac4c52cd.zip
Refactor Tramigo decoder
Diffstat (limited to 'src/main/java/org/traccar/protocol/TramigoFrameDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/TramigoFrameDecoder.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/TramigoFrameDecoder.java b/src/main/java/org/traccar/protocol/TramigoFrameDecoder.java
index 4b0fe52b3..72cadf21a 100644
--- a/src/main/java/org/traccar/protocol/TramigoFrameDecoder.java
+++ b/src/main/java/org/traccar/protocol/TramigoFrameDecoder.java
@@ -29,11 +29,15 @@ public class TramigoFrameDecoder extends BaseFrameDecoder {
return null;
}
+ int protocol = buf.getUnsignedByte(buf.readerIndex());
+
int length;
- if (buf.getUnsignedByte(buf.readerIndex()) == 0x80) {
+ if (protocol == 0x80) {
length = buf.getUnsignedShortLE(buf.readerIndex() + 6);
- } else {
+ } else if (protocol == 0x02 || protocol == 0x04) {
length = buf.getUnsignedShortLE(buf.readerIndex() + 1);
+ } else {
+ length = buf.getUnsignedShort(buf.readerIndex() + 6);
}
if (length <= buf.readableBytes()) {