diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-04-18 02:10:53 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-04-18 11:11:31 +1200 |
commit | efaeab48fc6256f39625683a1f7c09745bac9f6f (patch) | |
tree | 19d02975726b0157bfde4c90132c6e7836d99d4b | |
parent | 546d09f050c4ccfe5021a31e480bad9e57006ecf (diff) | |
download | trackermap-server-efaeab48fc6256f39625683a1f7c09745bac9f6f.tar.gz trackermap-server-efaeab48fc6256f39625683a1f7c09745bac9f6f.tar.bz2 trackermap-server-efaeab48fc6256f39625683a1f7c09745bac9f6f.zip |
Use attribute lookup method
-rw-r--r-- | src/org/traccar/protocol/Gt06ProtocolEncoder.java | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/org/traccar/protocol/Gt06ProtocolEncoder.java b/src/org/traccar/protocol/Gt06ProtocolEncoder.java index 8e00522a7..c20e1108f 100644 --- a/src/org/traccar/protocol/Gt06ProtocolEncoder.java +++ b/src/org/traccar/protocol/Gt06ProtocolEncoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 - 2016 Anton Tananaev (anton@traccar.org) + * Copyright 2015 - 2017 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,13 +56,8 @@ public class Gt06ProtocolEncoder extends BaseProtocolEncoder { @Override protected Object encodeCommand(Command command) { - boolean alternative; - Device device = Context.getIdentityManager().getDeviceById(command.getDeviceId()); - if (device.getAttributes().containsKey("gt06.alternative")) { - alternative = device.getBoolean("gt06.alternative"); - } else { - alternative = Context.getConfig().getBoolean("gt06.alternative"); - } + boolean alternative = Context.getDeviceManager().lookupAttributeBoolean( + command.getDeviceId(), "gt06.alternative", false, true); switch (command.getType()) { case Command.TYPE_ENGINE_STOP: |