aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/FlespiProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-03-27 09:19:53 -0700
committerAnton Tananaev <anton@traccar.org>2023-03-27 09:19:53 -0700
commit7aa7d2d98e2fd7fb36c50711bf6e547c829d6d58 (patch)
treebc2d2e82d64a8f2fc6f866ba2b6426f84c247e29 /src/main/java/org/traccar/protocol/FlespiProtocolDecoder.java
parenta5a2a3f69fd76602f5577354cde653915e8d8ad4 (diff)
downloadtrackermap-server-7aa7d2d98e2fd7fb36c50711bf6e547c829d6d58.tar.gz
trackermap-server-7aa7d2d98e2fd7fb36c50711bf6e547c829d6d58.tar.bz2
trackermap-server-7aa7d2d98e2fd7fb36c50711bf6e547c829d6d58.zip
Flespi battery level support
Diffstat (limited to 'src/main/java/org/traccar/protocol/FlespiProtocolDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/FlespiProtocolDecoder.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/main/java/org/traccar/protocol/FlespiProtocolDecoder.java b/src/main/java/org/traccar/protocol/FlespiProtocolDecoder.java
index 6e6f9c700..a7f6c284a 100644
--- a/src/main/java/org/traccar/protocol/FlespiProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/FlespiProtocolDecoder.java
@@ -125,12 +125,10 @@ public class FlespiProtocolDecoder extends BaseHttpProtocolDecoder {
position.set(Position.KEY_PDOP, ((JsonNumber) value).doubleValue());
return true;
case "din":
+ position.set(Position.KEY_INPUT, ((JsonNumber) value).intValue());
+ return true;
case "dout":
- if (name.equals("din")) {
- position.set(Position.KEY_INPUT, ((JsonNumber) value).intValue());
- } else {
- position.set(Position.KEY_OUTPUT, ((JsonNumber) value).intValue());
- }
+ position.set(Position.KEY_OUTPUT, ((JsonNumber) value).intValue());
return true;
case "gps.vehicle.mileage":
position.set(Position.KEY_ODOMETER, ((JsonNumber) value).doubleValue());
@@ -141,6 +139,9 @@ public class FlespiProtocolDecoder extends BaseHttpProtocolDecoder {
case "battery.voltage":
position.set(Position.KEY_BATTERY, ((JsonNumber) value).doubleValue());
return true;
+ case "battery.level":
+ position.set(Position.KEY_BATTERY_LEVEL, ((JsonNumber) value).intValue());
+ return true;
case "fuel.level":
case "can.fuel.level":
position.set(Position.KEY_FUEL_LEVEL, ((JsonNumber) value).doubleValue());