diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2020-04-24 22:35:00 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2020-04-24 22:35:00 -0700 |
commit | bedbcdf270a9565a9013dfb2af9ef596e61a0574 (patch) | |
tree | df008a7d39c5e3ebb81826c3500c513402fee4bc /src/main/java/org/traccar/protocol/FlespiProtocolDecoder.java | |
parent | 2f062e12746c48fe6262736b08e5e15f033447e4 (diff) | |
download | trackermap-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/FlespiProtocolDecoder.java')
-rw-r--r-- | src/main/java/org/traccar/protocol/FlespiProtocolDecoder.java | 12 |
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); |