From 3aaaa1de76612e26c6d25f930d94fdf4ee810d7d Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 18 Apr 2017 02:28:16 +1200 Subject: Fix GT06 encoder unit test --- src/org/traccar/database/DataManager.java | 1 + src/org/traccar/database/IdentityManager.java | 8 ++++++++ src/org/traccar/protocol/Gt06ProtocolEncoder.java | 3 +-- 3 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java index 8337762f7..0c5f458a2 100644 --- a/src/org/traccar/database/DataManager.java +++ b/src/org/traccar/database/DataManager.java @@ -547,4 +547,5 @@ public class DataManager { .setLong("managedUserId", managedUserId) .executeUpdate(); } + } diff --git a/src/org/traccar/database/IdentityManager.java b/src/org/traccar/database/IdentityManager.java index db8e9c1c7..c8c593a54 100644 --- a/src/org/traccar/database/IdentityManager.java +++ b/src/org/traccar/database/IdentityManager.java @@ -28,4 +28,12 @@ public interface IdentityManager { boolean isLatestPosition(Position position); + boolean lookupAttributeBoolean(long deviceId, String attributeName, boolean defaultValue, boolean lookupConfig); + + String lookupAttributeString(long deviceId, String attributeName, String defaultValue, boolean lookupConfig); + + int lookupAttributeInteger(long deviceId, String attributeName, int defaultValue, boolean lookupConfig); + + long lookupAttributeLong(long deviceId, String attributeName, long defaultValue, boolean lookupConfig); + } diff --git a/src/org/traccar/protocol/Gt06ProtocolEncoder.java b/src/org/traccar/protocol/Gt06ProtocolEncoder.java index c20e1108f..7298f0ff6 100644 --- a/src/org/traccar/protocol/Gt06ProtocolEncoder.java +++ b/src/org/traccar/protocol/Gt06ProtocolEncoder.java @@ -22,7 +22,6 @@ import org.traccar.Context; import org.traccar.helper.Checksum; import org.traccar.helper.Log; import org.traccar.model.Command; -import org.traccar.model.Device; import java.nio.charset.StandardCharsets; @@ -56,7 +55,7 @@ public class Gt06ProtocolEncoder extends BaseProtocolEncoder { @Override protected Object encodeCommand(Command command) { - boolean alternative = Context.getDeviceManager().lookupAttributeBoolean( + boolean alternative = Context.getIdentityManager().lookupAttributeBoolean( command.getDeviceId(), "gt06.alternative", false, true); switch (command.getType()) { -- cgit v1.2.3