diff options
author | Iván Ávalos <avalos@disroot.org> | 2021-12-27 20:48:47 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2021-12-27 20:48:47 -0600 |
commit | aa59b968c7d6a89b8e6285647ab2e6e62f02cf7f (patch) | |
tree | e74474e6b6bd75a71ac79bdbd31b9237a7b3c2d6 /src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java | |
parent | f03b999d6d17e53c1c1e1aa2f9271d03f12f2264 (diff) | |
download | traccar-server-aa59b968c7d6a89b8e6285647ab2e6e62f02cf7f.tar.gz traccar-server-aa59b968c7d6a89b8e6285647ab2e6e62f02cf7f.tar.bz2 traccar-server-aa59b968c7d6a89b8e6285647ab2e6e62f02cf7f.zip |
Revert "Merge branch 'master' into suntech-fixes"
This reverts commit f03b999d6d17e53c1c1e1aa2f9271d03f12f2264, reversing
changes made to 3a528ddc88f72f39ff9566cf5e0f54938b1584ef.
Diffstat (limited to 'src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java')
-rw-r--r-- | src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java index dc4bd3486..d745153a4 100644 --- a/src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 - 2021 Anton Tananaev (anton@traccar.org) + * Copyright 2012 - 2019 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. @@ -87,7 +87,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { } static boolean isLongFormat(ByteBuf buf, int flagIndex) { - return buf.getUnsignedByte(flagIndex) >> 4 >= 7; + return buf.getUnsignedByte(flagIndex) >> 4 == 0x7; } static void decodeBinaryLocation(ByteBuf buf, Position position) { @@ -141,8 +141,6 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { int version = BitUtil.from(buf.readUnsignedByte(), 4); buf.readUnsignedShort(); // length - boolean responseRequired = false; - while (buf.readableBytes() > 1) { Position position = new Position(getProtocolName()); @@ -162,9 +160,6 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_ALARM, BitUtil.check(status, 2) ? Position.ALARM_GEOFENCE_EXIT : null); position.set(Position.KEY_ALARM, BitUtil.check(status, 3) ? Position.ALARM_POWER_CUT : null); position.set(Position.KEY_ALARM, BitUtil.check(status, 4) ? Position.ALARM_VIBRATION : null); - if (BitUtil.check(status, 5)) { - responseRequired = true; - } position.set(Position.KEY_BLOCKED, BitUtil.check(status, 7)); position.set(Position.KEY_ALARM, BitUtil.check(status, 8 + 3) ? Position.ALARM_LOW_BATTERY : null); position.set(Position.KEY_ALARM, BitUtil.check(status, 8 + 6) ? Position.ALARM_FAULT : null); @@ -181,7 +176,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { cellTower.setSignalStrength((int) buf.readUnsignedByte()); position.setNetwork(new Network(cellTower)); - if (protocolVersion == 0x17 || protocolVersion == 0x19) { + if (protocolVersion == 0x17) { buf.readUnsignedByte(); // geofence id buf.skipBytes(3); // reserved buf.skipBytes(buf.readableBytes() - 1); @@ -237,15 +232,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { } - int index = buf.readUnsignedByte(); - - if (channel != null && responseRequired) { - if (protocolVersion < 0x19) { - channel.writeAndFlush(new NetworkMessage("(P35)", remoteAddress)); - } else { - channel.writeAndFlush(new NetworkMessage("(P69,0," + index + ")", remoteAddress)); - } - } + buf.readUnsignedByte(); // index return positions; } |