diff options
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/traccar/api/resource/SupportedCommandResource.java | 6 | ||||
-rw-r--r-- | src/org/traccar/database/DataManager.java | 6 |
2 files changed, 3 insertions, 9 deletions
diff --git a/src/org/traccar/api/resource/SupportedCommandResource.java b/src/org/traccar/api/resource/SupportedCommandResource.java index 849447060..bf4fd4969 100644 --- a/src/org/traccar/api/resource/SupportedCommandResource.java +++ b/src/org/traccar/api/resource/SupportedCommandResource.java @@ -34,9 +34,9 @@ public class SupportedCommandResource extends BaseResource { @GET public Collection<SupportedCommand> get(@QueryParam("deviceId") long deviceId) throws SQLException { Context.getPermissionsManager().checkDevice(getUserId(), deviceId); - Position latestPosition = Context.getDataManager().getLatestPosition(deviceId); - if (latestPosition != null) { - return Context.getServerManager().getProtocolSuppportedCommands(latestPosition.getProtocol()); + Position lastPosition = Context.getConnectionManager().getLastPosition(deviceId); + if (lastPosition != null) { + return Context.getServerManager().getProtocolSuppportedCommands(lastPosition.getProtocol()); } else { return Collections.EMPTY_LIST; } diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java index 3dba215f6..3732c82eb 100644 --- a/src/org/traccar/database/DataManager.java +++ b/src/org/traccar/database/DataManager.java @@ -472,12 +472,6 @@ public class DataManager implements IdentityManager { .executeQuery(Position.class); } - public Position getLatestPosition(long deviceId) throws SQLException { - return QueryBuilder.create(dataSource, getQuery("database.selectLatestPosition")) - .setLong("deviceId", deviceId) - .executeQuerySingle(Position.class); - } - public Server getServer() throws SQLException { return QueryBuilder.create(dataSource, getQuery("database.selectServers")) .executeQuerySingle(Server.class); |