diff options
author | Anton Tananaev <anton@traccar.org> | 2022-03-01 22:48:56 -0800 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-03-01 22:48:56 -0800 |
commit | a28e97150614a23e8a492e9379a579aa7240a0cd (patch) | |
tree | a1d170dcd74a5bed920ddb76f9e8024d731d3d32 /src/main/java | |
parent | 90e50e3aafbbcdf3f2ac5698302b939c7149c578 (diff) | |
download | trackermap-server-a28e97150614a23e8a492e9379a579aa7240a0cd.tar.gz trackermap-server-a28e97150614a23e8a492e9379a579aa7240a0cd.tar.bz2 trackermap-server-a28e97150614a23e8a492e9379a579aa7240a0cd.zip |
Additional FlexAPI attributes
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/traccar/protocol/FlexApiProtocolDecoder.java | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/protocol/FlexApiProtocolDecoder.java b/src/main/java/org/traccar/protocol/FlexApiProtocolDecoder.java index 20ff78c21..bcfbdd7da 100644 --- a/src/main/java/org/traccar/protocol/FlexApiProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/FlexApiProtocolDecoder.java @@ -68,11 +68,13 @@ public class FlexApiProtocolDecoder extends BaseProtocolDecoder { position.setLongitude(payload.getJsonNumber("gnss.longitude").doubleValue()); } + position.setValid(payload.getInt("gnss.fix") > 0); position.setAltitude(payload.getJsonNumber("gnss.altitude").doubleValue()); position.setSpeed(payload.getJsonNumber("gnss.speed").doubleValue()); position.setCourse(payload.getJsonNumber("gnss.heading").doubleValue()); position.set(Position.KEY_SATELLITES, payload.getInt("gnss.num_sv")); + position.set(Position.KEY_HDOP, payload.getJsonNumber("gnss.hdop").doubleValue()); } else if (topic.contains("/cellular1/")) { @@ -84,12 +86,26 @@ public class FlexApiProtocolDecoder extends BaseProtocolDecoder { String operator = payload.getString("modem1.operator"); if (!operator.isEmpty()) { - position.setNetwork(new Network(CellTower.from( + CellTower cellTower = CellTower.from( Integer.parseInt(operator.substring(0, 3)), Integer.parseInt(operator.substring(3)), Integer.parseInt(payload.getString("modem1.lac"), 16), Integer.parseInt(payload.getString("modem1.cell_id"), 16), - payload.getInt("modem1.rssi")))); + payload.getInt("modem1.rssi")); + switch (payload.getInt("modem1.network")) { + case 1: + cellTower.setRadioType("gsm"); + break; + case 2: + cellTower.setRadioType("wcdma"); + break; + case 3: + cellTower.setRadioType("lte"); + break; + default: + break; + } + position.setNetwork(new Network(cellTower)); } } else if (topic.contains("/obd/")) { @@ -124,8 +140,8 @@ public class FlexApiProtocolDecoder extends BaseProtocolDecoder { getLastLocation(position, new Date(payload.getInt("io.ts") * 1000L)); - if (payload.containsKey("io.IGN")) { - position.set(Position.KEY_IGNITION, payload.getInt("io.IGN") > 0); + if (payload.containsKey("io.IGT")) { + position.set(Position.KEY_IGNITION, payload.getInt("io.IGT") > 0); } for (String key : payload.keySet()) { |