aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol
diff options
context:
space:
mode:
authorMatjaž Črnko <m.crnko@txt.si>2021-10-12 19:07:54 +0200
committerMatjaž Črnko <m.crnko@txt.si>2021-10-12 19:07:54 +0200
commit1bf9940a5f6abed56afa4e90ed20d1dfdff17cc2 (patch)
tree6b83fa4c5f7f1226e7eb454eb31f0433af9dd4f7 /src/main/java/org/traccar/protocol
parent1696a32c40dc4c54b8e895ad91af0bed5340b16a (diff)
downloadtrackermap-server-1bf9940a5f6abed56afa4e90ed20d1dfdff17cc2.tar.gz
trackermap-server-1bf9940a5f6abed56afa4e90ed20d1dfdff17cc2.tar.bz2
trackermap-server-1bf9940a5f6abed56afa4e90ed20d1dfdff17cc2.zip
fix: Totem - Per documentation the response DataType should always be AA. Partially reverts commit ebd0688, fixes #4755
Diffstat (limited to 'src/main/java/org/traccar/protocol')
-rw-r--r--src/main/java/org/traccar/protocol/TotemProtocolDecoder.java8
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 {