From 6b5c8006f27153886618e091466073dbb9983c0f Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 21 Oct 2017 11:30:35 +1300 Subject: Allow per-device configuration --- src/org/traccar/protocol/T55ProtocolDecoder.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/org/traccar/protocol') diff --git a/src/org/traccar/protocol/T55ProtocolDecoder.java b/src/org/traccar/protocol/T55ProtocolDecoder.java index 43e1a57f7..6b4ee6ebd 100644 --- a/src/org/traccar/protocol/T55ProtocolDecoder.java +++ b/src/org/traccar/protocol/T55ProtocolDecoder.java @@ -31,11 +31,8 @@ import java.util.regex.Pattern; public class T55ProtocolDecoder extends BaseProtocolDecoder { - private final boolean ack; - public T55ProtocolDecoder(T55Protocol protocol) { super(protocol); - ack = Context.getConfig().getBoolean(getProtocolName() + ".ack"); } private static final Pattern PATTERN_GPRMC = new PatternBuilder() @@ -102,8 +99,11 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder { private Position decodeGprmc( DeviceSession deviceSession, String sentence, SocketAddress remoteAddress, Channel channel) { - if (ack && channel != null && !(channel instanceof DatagramChannel)) { - channel.write("OK1\r\n"); + if (deviceSession != null && channel != null && !(channel instanceof DatagramChannel)) { + if (Context.getIdentityManager().lookupAttributeBoolean( + deviceSession.getDeviceId(), getProtocolName() + ".ack", false, true)) { + channel.write("OK1\r\n"); + } } Parser parser = new Parser(PATTERN_GPRMC, sentence); -- cgit v1.2.3