diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-10-21 11:30:35 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-10-21 11:30:35 +1300 |
commit | 6b5c8006f27153886618e091466073dbb9983c0f (patch) | |
tree | fca1fbe090eb839ee783d4461ccd9f6e977c5ed9 | |
parent | 0bf2902297a5f48019675790df60353a27ad80d3 (diff) | |
download | traccar-server-6b5c8006f27153886618e091466073dbb9983c0f.tar.gz traccar-server-6b5c8006f27153886618e091466073dbb9983c0f.tar.bz2 traccar-server-6b5c8006f27153886618e091466073dbb9983c0f.zip |
Allow per-device configuration
-rw-r--r-- | src/org/traccar/protocol/T55ProtocolDecoder.java | 10 |
1 files changed, 5 insertions, 5 deletions
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); |