aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-02-10 17:49:45 -0800
committerAnton Tananaev <anton@traccar.org>2023-02-10 17:49:45 -0800
commit514582dd83c4520948c03eb3fc84444e0d7f5a49 (patch)
tree4a0b1f2a2643bcb011a68973d8b6914e6612d914
parent3ba077b0002481bf262a59ff2ad266b04a07c589 (diff)
downloadtrackermap-server-514582dd83c4520948c03eb3fc84444e0d7f5a49.tar.gz
trackermap-server-514582dd83c4520948c03eb3fc84444e0d7f5a49.tar.bz2
trackermap-server-514582dd83c4520948c03eb3fc84444e0d7f5a49.zip
Tramigo T24 frame decoder
-rw-r--r--src/main/java/org/traccar/protocol/TramigoFrameDecoder.java4
-rw-r--r--src/test/java/org/traccar/protocol/TramigoFrameDecoderTest.java4
2 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 e4c94dc77..4b0fe52b3 100644
--- a/src/main/java/org/traccar/protocol/TramigoFrameDecoder.java
+++ b/src/main/java/org/traccar/protocol/TramigoFrameDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2023 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.
@@ -33,7 +33,7 @@ public class TramigoFrameDecoder extends BaseFrameDecoder {
if (buf.getUnsignedByte(buf.readerIndex()) == 0x80) {
length = buf.getUnsignedShortLE(buf.readerIndex() + 6);
} else {
- length = buf.getUnsignedShort(buf.readerIndex() + 6);
+ length = buf.getUnsignedShortLE(buf.readerIndex() + 1);
}
if (length <= buf.readableBytes()) {
diff --git a/src/test/java/org/traccar/protocol/TramigoFrameDecoderTest.java b/src/test/java/org/traccar/protocol/TramigoFrameDecoderTest.java
index a093d94e9..cf997c237 100644
--- a/src/test/java/org/traccar/protocol/TramigoFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TramigoFrameDecoderTest.java
@@ -11,6 +11,10 @@ public class TramigoFrameDecoderTest extends ProtocolTest {
var decoder = inject(new TramigoFrameDecoder());
verifyFrame(
+ binary("0480001df35b1b69101a023ef34f0090436d38003200380e0000850081c0e4ff6d542f00000015000000050000000000007600a20100008f436d3800014400000000000000000021000a0006005a574a6169726f7320486972692043656e747265205072696d617279205363686f6f6c536f7574686572746f6e486172617265"),
+ decoder.decode(null, null, binary("0480001df35b1b69101a023ef34f0090436d38003200380e0000850081c0e4ff6d542f00000015000000050000000000007600a20100008f436d3800014400000000000000000021000a0006005a574a6169726f7320486972692043656e747265205072696d617279205363686f6f6c536f7574686572746f6e486172617265")));
+
+ verifyFrame(
binary("8000ed2bb0009c000101bee000050b09633d925b5472616d69676f3a205472697020737461727465642c2053686f636b2053656e736f722c206174204b696e6720437265656b20526f61642d46726565746f776e205374726565742c20506f727420486172636f7572742c205269766572732c204e472c20342e37363336312c20372e30313836382c2030373a31383a333620536570203320454f46"),
decoder.decode(null, null, binary("8000ed2bb0009c000101bee000050b09633d925b5472616d69676f3a205472697020737461727465642c2053686f636b2053656e736f722c206174204b696e6720437265656b20526f61642d46726565746f776e205374726565742c20506f727420486172636f7572742c205269766572732c204e472c20342e37363336312c20372e30313836382c2030373a31383a333620536570203320454f46")));