diff options
author | Anton Tananaev <atananaev@lyft.com> | 2020-12-29 13:05:07 -0800 |
---|---|---|
committer | Anton Tananaev <atananaev@lyft.com> | 2020-12-29 13:05:07 -0800 |
commit | f94951e7e78956b2bbd438665ff290a472afde76 (patch) | |
tree | 21ae964507b4e4e3a3c7f657e9057375c35701d1 /src/main/java/org/traccar/protocol/AtrackProtocolDecoder.java | |
parent | 152d8fe43e4e7c15308ea39a19ac6c10da871ef7 (diff) | |
download | trackermap-server-f94951e7e78956b2bbd438665ff290a472afde76.tar.gz trackermap-server-f94951e7e78956b2bbd438665ff290a472afde76.tar.bz2 trackermap-server-f94951e7e78956b2bbd438665ff290a472afde76.zip |
Migrate more boolean keys
Diffstat (limited to 'src/main/java/org/traccar/protocol/AtrackProtocolDecoder.java')
-rw-r--r-- | src/main/java/org/traccar/protocol/AtrackProtocolDecoder.java | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/main/java/org/traccar/protocol/AtrackProtocolDecoder.java b/src/main/java/org/traccar/protocol/AtrackProtocolDecoder.java index 56c00c7c1..ff7ef6c4a 100644 --- a/src/main/java/org/traccar/protocol/AtrackProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/AtrackProtocolDecoder.java @@ -23,6 +23,7 @@ import org.traccar.Context; import org.traccar.DeviceSession; import org.traccar.NetworkMessage; import org.traccar.Protocol; +import org.traccar.config.Keys; import org.traccar.helper.DateBuilder; import org.traccar.helper.Parser; import org.traccar.helper.PatternBuilder; @@ -61,19 +62,23 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder { public AtrackProtocolDecoder(Protocol protocol) { super(protocol); - longDate = Context.getConfig().getBoolean(getProtocolName() + ".longDate"); - decimalFuel = Context.getConfig().getBoolean(getProtocolName() + ".decimalFuel"); + longDate = Context.getConfig().getBoolean(Keys.PROTOCOL_LONG_DATE.withPrefix(getProtocolName())); + decimalFuel = Context.getConfig().getBoolean(Keys.PROTOCOL_DECIMAL_FUEL.withPrefix(getProtocolName())); - custom = Context.getConfig().getBoolean(getProtocolName() + ".custom"); - form = Context.getConfig().getString(getProtocolName() + ".form"); + custom = Context.getConfig().getBoolean(Keys.PROTOCOL_CUSTOM.withPrefix(getProtocolName())); + form = Context.getConfig().getString(Keys.PROTOCOL_FORM.withPrefix(getProtocolName())); if (form != null) { custom = true; } - for (String pair : Context.getConfig().getString(getProtocolName() + ".alarmMap", "").split(",")) { - if (!pair.isEmpty()) { - alarmMap.put( - Integer.parseInt(pair.substring(0, pair.indexOf('='))), pair.substring(pair.indexOf('=') + 1)); + String alarmMapString = Context.getConfig().getString(Keys.PROTOCOL_ALARM_MAP.withPrefix(getProtocolName())); + if (alarmMapString != null) { + for (String pair : alarmMapString.split(",")) { + if (!pair.isEmpty()) { + alarmMap.put( + Integer.parseInt(pair.substring(0, pair.indexOf('='))), + pair.substring(pair.indexOf('=') + 1)); + } } } } |