diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2021-10-12 10:12:31 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-12 10:12:31 -0700 |
commit | c5a9f663f56c13274b263ef040d2b622f22bce4b (patch) | |
tree | 6b83fa4c5f7f1226e7eb454eb31f0433af9dd4f7 /src/main/java/org/traccar | |
parent | 1696a32c40dc4c54b8e895ad91af0bed5340b16a (diff) | |
parent | 1bf9940a5f6abed56afa4e90ed20d1dfdff17cc2 (diff) | |
download | trackermap-server-c5a9f663f56c13274b263ef040d2b622f22bce4b.tar.gz trackermap-server-c5a9f663f56c13274b263ef040d2b622f22bce4b.tar.bz2 trackermap-server-c5a9f663f56c13274b263ef040d2b622f22bce4b.zip |
Merge pull request #4756 from jinzo/master
Response should always be AA
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r-- | src/main/java/org/traccar/protocol/TotemProtocolDecoder.java | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/main/java/org/traccar/protocol/TotemProtocolDecoder.java b/src/main/java/org/traccar/protocol/TotemProtocolDecoder.java index b5398116d..90a3db4c0 100644 --- a/src/main/java/org/traccar/protocol/TotemProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/TotemProtocolDecoder.java @@ -461,10 +461,8 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { Position position = new Position(getProtocolName()); - String type = null; if (pattern == PATTERN4) { - type = parser.next(); - position.set(Position.KEY_ALARM, decodeAlarm4(Integer.parseInt(type, 16))); + position.set(Position.KEY_ALARM, decodeAlarm4(parser.nextHexInt())); } DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next()); @@ -485,8 +483,8 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { } if (channel != null) { - if (type != null) { - String response = "$$0014" + type + sentence.substring(sentence.length() - 6, sentence.length() - 2); + if (pattern == PATTERN4) { + String response = "$$0014AA" + sentence.substring(sentence.length() - 6, sentence.length() - 2); response += String.format("%02X", Checksum.xor(response)).toUpperCase(); channel.writeAndFlush(new NetworkMessage(response, remoteAddress)); } else { |