aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-04-24 22:35:00 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-04-24 22:35:00 -0700
commitbedbcdf270a9565a9013dfb2af9ef596e61a0574 (patch)
treedf008a7d39c5e3ebb81826c3500c513402fee4bc /src/main/java/org/traccar/protocol
parent2f062e12746c48fe6262736b08e5e15f033447e4 (diff)
downloadtrackermap-server-bedbcdf270a9565a9013dfb2af9ef596e61a0574.tar.gz
trackermap-server-bedbcdf270a9565a9013dfb2af9ef596e61a0574.tar.bz2
trackermap-server-bedbcdf270a9565a9013dfb2af9ef596e61a0574.zip
Update Flespi decoder
Diffstat (limited to 'src/main/java/org/traccar/protocol')
-rw-r--r--src/main/java/org/traccar/protocol/FlespiProtocolDecoder.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/protocol/FlespiProtocolDecoder.java b/src/main/java/org/traccar/protocol/FlespiProtocolDecoder.java
index 7405fb6ef..0a0d04db0 100644
--- a/src/main/java/org/traccar/protocol/FlespiProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/FlespiProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 - 2020 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -64,6 +64,7 @@ public class FlespiProtocolDecoder extends BaseHttpProtocolDecoder {
}
Position position = new Position(getProtocolName());
position.setDeviceId(deviceSession.getDeviceId());
+ position.setValid(true);
decodePosition(message, position);
positions.add(position);
}
@@ -125,8 +126,11 @@ public class FlespiProtocolDecoder extends BaseHttpProtocolDecoder {
return true;
case "din":
case "dout":
- position.set(name.equals("din") ? Position.KEY_INPUT : Position.KEY_OUTPUT,
- ((JsonNumber) value).intValue());
+ if (name.equals("din")) {
+ position.set(Position.KEY_INPUT, ((JsonNumber) value).intValue());
+ } else {
+ position.set(Position.KEY_OUTPUT, ((JsonNumber) value).intValue());
+ }
return true;
case "gps.vehicle.mileage":
position.set(Position.KEY_ODOMETER, ((JsonNumber) value).doubleValue());
@@ -146,7 +150,7 @@ public class FlespiProtocolDecoder extends BaseHttpProtocolDecoder {
position.set(Position.KEY_RPM, ((JsonNumber) value).doubleValue());
return true;
case "can.engine.temperature":
- position.set(Position.PREFIX_TEMP + (index > 0 ? index : 0), ((JsonNumber) value).doubleValue());
+ position.set(Position.PREFIX_TEMP + Math.max(index, 0), ((JsonNumber) value).doubleValue());
return true;
case "engine.ignition.status":
position.set(Position.KEY_IGNITION, value == JsonValue.TRUE);