diff options
author | Anton Tananaev <anton@traccar.org> | 2022-06-18 10:27:24 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-06-18 10:27:24 -0700 |
commit | 97a189c51817a6b1d7a86aece8a91ff378488799 (patch) | |
tree | 9f47127dafa956ae6a8f98c818a9fbcef5432a5b /src/main/java/org/traccar/protocol/Gt06ProtocolEncoder.java | |
parent | 22bd8bcc80b850dc2308be50cf2886c39b0655da (diff) | |
download | trackermap-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/Gt06ProtocolEncoder.java')
-rw-r--r-- | src/main/java/org/traccar/protocol/Gt06ProtocolEncoder.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/protocol/Gt06ProtocolEncoder.java b/src/main/java/org/traccar/protocol/Gt06ProtocolEncoder.java index 569f4a809..e1c17710b 100644 --- a/src/main/java/org/traccar/protocol/Gt06ProtocolEncoder.java +++ b/src/main/java/org/traccar/protocol/Gt06ProtocolEncoder.java @@ -19,6 +19,7 @@ import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import org.traccar.BaseProtocolEncoder; import org.traccar.Protocol; +import org.traccar.config.Keys; import org.traccar.helper.Checksum; import org.traccar.helper.model.AttributeUtil; import org.traccar.model.Command; @@ -33,8 +34,8 @@ public class Gt06ProtocolEncoder extends BaseProtocolEncoder { private ByteBuf encodeContent(long deviceId, String content) { - boolean language = getIdentityManager() - .lookupAttributeBoolean(deviceId, getProtocolName() + ".language", false, false, true); + boolean language = AttributeUtil.lookup( + getCacheManager(), Keys.PROTOCOL_LANGUAGE.withPrefix(getProtocolName()), deviceId); ByteBuf buf = Unpooled.buffer(); @@ -66,8 +67,8 @@ public class Gt06ProtocolEncoder extends BaseProtocolEncoder { @Override protected Object encodeCommand(Command command) { - boolean alternative = getIdentityManager().lookupAttributeBoolean( - command.getDeviceId(), getProtocolName() + ".alternative", false, false, true); + boolean alternative = AttributeUtil.lookup( + getCacheManager(), Keys.PROTOCOL_ALTERNATIVE.withPrefix(getProtocolName()), command.getDeviceId()); String password = AttributeUtil.getDevicePassword( getCacheManager(), command.getDeviceId(), getProtocolName(), "123456"); |