diff options
-rw-r--r-- | src/org/traccar/protocol/TytanProtocolDecoder.java | 12 | ||||
-rw-r--r-- | test/org/traccar/protocol/TytanProtocolDecoderTest.java | 9 |
2 files changed, 11 insertions, 10 deletions
diff --git a/src/org/traccar/protocol/TytanProtocolDecoder.java b/src/org/traccar/protocol/TytanProtocolDecoder.java index b0c1d243b..4cc84d2c3 100644 --- a/src/org/traccar/protocol/TytanProtocolDecoder.java +++ b/src/org/traccar/protocol/TytanProtocolDecoder.java @@ -81,16 +81,8 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder { position.set("authorized", ChannelBuffers.hexDump(buf.readBytes(8))); break; case 24: - Set<Integer> temps = new LinkedHashSet<>(); - int temp = buf.readUnsignedByte(); - for (int i = 3; i >= 0; i--) { - n = (temp >> (2 * i)) & 0x03; - if (!temps.contains(n)) { - temps.add(n); - } - } - for (int i : temps) { - position.set(Event.PREFIX_TEMP + i, buf.readUnsignedByte()); + for (int i = 0; i < length / 2; i++) { + position.set(Event.PREFIX_TEMP + buf.readUnsignedByte(), buf.readByte()); } break; case 28: diff --git a/test/org/traccar/protocol/TytanProtocolDecoderTest.java b/test/org/traccar/protocol/TytanProtocolDecoderTest.java index d291baa6e..bfbc01f52 100644 --- a/test/org/traccar/protocol/TytanProtocolDecoderTest.java +++ b/test/org/traccar/protocol/TytanProtocolDecoderTest.java @@ -13,6 +13,15 @@ public class TytanProtocolDecoderTest extends ProtocolDecoderTest { TytanProtocolDecoder decoder = new TytanProtocolDecoder(new TytanProtocol()); verifyPositions(decoder, binary( + "B500192000001405125652CA9B1A325FC98D11A9990018020118FC0D")); + + verifyPositions(decoder, binary( + "B500197800007422125652D7AC32325FD08D11A69900180200188280")); + + verifyPositions(decoder, binary( + "B500181000001405115652DEEB2A325FC68D11A7D00005012A2AE1")); + + verifyPositions(decoder, binary( "B5005690000068494F561CEAE932325FD28D11A299000702000063045532030066013567018768014B6901286B0240396C04030785986D013E7F040000A7CE81040000A76C82027EAB83080FA01068FFFF0F3C880202583156")); verifyPositions(decoder, binary( |