aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r--src/main/java/org/traccar/protocol/DmtHttpProtocolDecoder.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/DmtHttpProtocolDecoder.java b/src/main/java/org/traccar/protocol/DmtHttpProtocolDecoder.java
index cffc1f3eb..8283ab643 100644
--- a/src/main/java/org/traccar/protocol/DmtHttpProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/DmtHttpProtocolDecoder.java
@@ -184,6 +184,25 @@ public class DmtHttpProtocolDecoder extends BaseHttpProtocolDecoder {
position.set(Position.KEY_OUTPUT, root.getInt("outputs"));
position.set(Position.KEY_STATUS, root.getInt("status"));
+ if (root.containsKey("counters")) {
+ JsonArray counters = root.getJsonArray("counters");
+ for (int i = 0; i < counters.size(); i++) {
+ JsonObject counter = counters.getJsonObject(i);
+ switch (counter.getInt("id")) {
+ case 0:
+ position.set(Position.KEY_BATTERY, counter.getInt("val") * 0.001);
+ break;
+ case 1:
+ position.set(Position.KEY_BATTERY_LEVEL, counter.getInt("val") * 0.01);
+ break;
+ default:
+ position.set("counter" + counter.getInt("id"), counter.getInt("val"));
+ break;
+ }
+
+ }
+ }
+
return position;
}