From efaeab48fc6256f39625683a1f7c09745bac9f6f Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 18 Apr 2017 02:10:53 +1200 Subject: Use attribute lookup method --- src/org/traccar/protocol/Gt06ProtocolEncoder.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src') 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: -- cgit v1.2.3