diff options
author | Gábor Somogyi <gabor.g.somogyi@gmail.com> | 2016-04-27 22:22:08 +0200 |
---|---|---|
committer | Gábor Somogyi <gabor.g.somogyi@gmail.com> | 2016-04-27 22:34:17 +0200 |
commit | bf68718e05f811ffeb2b4b57acab56dca3e7de56 (patch) | |
tree | 5853e81ae5d08e996d1600504027c7a870202643 /src/org/traccar/api/resource | |
parent | 44f026f881efa6207ab79fb5bada20ab67f018a0 (diff) | |
download | traccar-server-bf68718e05f811ffeb2b4b57acab56dca3e7de56.tar.gz traccar-server-bf68718e05f811ffeb2b4b57acab56dca3e7de56.tar.bz2 traccar-server-bf68718e05f811ffeb2b4b57acab56dca3e7de56.zip |
Command framework ugly hack version
Diffstat (limited to 'src/org/traccar/api/resource')
-rw-r--r-- | src/org/traccar/api/resource/DeviceResource.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/org/traccar/api/resource/DeviceResource.java b/src/org/traccar/api/resource/DeviceResource.java index a4bfc1030..90d3ef675 100644 --- a/src/org/traccar/api/resource/DeviceResource.java +++ b/src/org/traccar/api/resource/DeviceResource.java @@ -19,6 +19,7 @@ import org.traccar.Context; import org.traccar.api.BaseResource; import java.sql.SQLException; +import java.util.ArrayList; import java.util.Collection; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -31,7 +32,12 @@ import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; + +import org.traccar.helper.Log; +import org.traccar.model.Command; import org.traccar.model.Device; +import org.traccar.model.Position; +import org.traccar.model.SupportedCommand; @Path("devices") @Produces(MediaType.APPLICATION_JSON) @@ -81,4 +87,11 @@ public class DeviceResource extends BaseResource { return Response.noContent().build(); } + @Path("{id}/supportedcommands") + @GET + public Collection<SupportedCommand> get(@PathParam("id") long id) throws SQLException { + Context.getPermissionsManager().checkDevice(getUserId(), id); + Position latestPosition = Context.getDataManager().getLatestPosition(id); + return Context.getServerManager().getProtocolSuppportedCommands(latestPosition.getProtocol()); + } } |