aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/ServerManager.java10
-rw-r--r--src/org/traccar/api/resource/SupportedCommandResource.java3
-rw-r--r--src/org/traccar/model/SupportedCommand.java29
3 files changed, 38 insertions, 4 deletions
diff --git a/src/org/traccar/ServerManager.java b/src/org/traccar/ServerManager.java
index 59bb88829..f79d543ff 100644
--- a/src/org/traccar/ServerManager.java
+++ b/src/org/traccar/ServerManager.java
@@ -15,6 +15,8 @@
*/
package org.traccar;
+import org.traccar.model.SupportedCommand;
+
import java.io.File;
import java.net.URI;
import java.net.URL;
@@ -96,13 +98,15 @@ public class ServerManager {
}
}
- public Collection<String> getProtocolSuppportedCommands(String protocol) {
- List<String> result = new ArrayList<>();
+ public Collection<SupportedCommand> getProtocolSuppportedCommands(String protocol) {
+ List<SupportedCommand> result = new ArrayList<>();
if (protocol != null) {
BaseProtocol baseProtocol = protocols.get(protocol);
for (String commandKey : baseProtocol.getSupportedCommands()) {
- result.add(commandKey);
+ SupportedCommand supportedCommand = new SupportedCommand();
+ supportedCommand.setKey(commandKey);
+ result.add(supportedCommand);
}
}
diff --git a/src/org/traccar/api/resource/SupportedCommandResource.java b/src/org/traccar/api/resource/SupportedCommandResource.java
index 393588d9b..1d5ce8595 100644
--- a/src/org/traccar/api/resource/SupportedCommandResource.java
+++ b/src/org/traccar/api/resource/SupportedCommandResource.java
@@ -18,6 +18,7 @@ package org.traccar.api.resource;
import org.traccar.Context;
import org.traccar.api.BaseResource;
import org.traccar.model.Position;
+import org.traccar.model.SupportedCommand;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
@@ -35,7 +36,7 @@ import java.util.Collections;
public class SupportedCommandResource extends BaseResource {
@GET
- public Collection<String> get(@QueryParam("deviceId") long deviceId) throws SQLException {
+ public Collection<SupportedCommand> get(@QueryParam("deviceId") long deviceId) throws SQLException {
Context.getPermissionsManager().checkDevice(getUserId(), deviceId);
Position lastPosition = Context.getConnectionManager().getLastPosition(deviceId);
if (lastPosition != null) {
diff --git a/src/org/traccar/model/SupportedCommand.java b/src/org/traccar/model/SupportedCommand.java
new file mode 100644
index 000000000..59a24d033
--- /dev/null
+++ b/src/org/traccar/model/SupportedCommand.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2016 Gabor Somogyi (gabor.g.somogyi@gmail.com)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.traccar.model;
+
+public class SupportedCommand {
+
+ private String key;
+
+ public String getKey() {
+ return key;
+ }
+
+ public void setKey(String key) {
+ this.key = key;
+ }
+}