aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/T55ProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-18 10:27:24 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-18 10:27:24 -0700
commit97a189c51817a6b1d7a86aece8a91ff378488799 (patch)
tree9f47127dafa956ae6a8f98c818a9fbcef5432a5b /src/main/java/org/traccar/protocol/T55ProtocolDecoder.java
parent22bd8bcc80b850dc2308be50cf2886c39b0655da (diff)
downloadtrackermap-server-97a189c51817a6b1d7a86aece8a91ff378488799.tar.gz
trackermap-server-97a189c51817a6b1d7a86aece8a91ff378488799.tar.bz2
trackermap-server-97a189c51817a6b1d7a86aece8a91ff378488799.zip
Refactor attribute lookup
Diffstat (limited to 'src/main/java/org/traccar/protocol/T55ProtocolDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/T55ProtocolDecoder.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/protocol/T55ProtocolDecoder.java b/src/main/java/org/traccar/protocol/T55ProtocolDecoder.java
index 3d892c021..409c7e768 100644
--- a/src/main/java/org/traccar/protocol/T55ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/T55ProtocolDecoder.java
@@ -17,6 +17,8 @@ package org.traccar.protocol;
import io.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.config.Keys;
+import org.traccar.helper.model.AttributeUtil;
import org.traccar.session.DeviceSession;
import org.traccar.NetworkMessage;
import org.traccar.Protocol;
@@ -128,10 +130,12 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder {
private Position decodeGprmc(
DeviceSession deviceSession, String sentence, SocketAddress remoteAddress, Channel channel) {
- if (deviceSession != null && channel != null && !(channel instanceof DatagramChannel)
- && getIdentityManager().lookupAttributeBoolean(
- deviceSession.getDeviceId(), getProtocolName() + ".ack", false, false, true)) {
- channel.writeAndFlush(new NetworkMessage("OK1\r\n", remoteAddress));
+ if (deviceSession != null && channel != null && !(channel instanceof DatagramChannel)) {
+ boolean ack = AttributeUtil.lookup(
+ getCacheManager(), Keys.PROTOCOL_ACK.withPrefix(getProtocolName()), deviceSession.getDeviceId());
+ if (ack) {
+ channel.writeAndFlush(new NetworkMessage("OK1\r\n", remoteAddress));
+ }
}
Parser parser = new Parser(PATTERN_GPRMC, sentence);