diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2022-01-11 23:36:47 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2022-01-11 23:36:47 -0800 |
commit | ad102cd882dd9ec6f7e4ffedad34c793184ea23b (patch) | |
tree | 9193cf47b6e9ad8d41e9bf5c31e6602ab90a5384 /src/main/java/org/traccar | |
parent | 7b2e47a143a34cb97cb8b52c00081e36898db346 (diff) | |
download | trackermap-server-ad102cd882dd9ec6f7e4ffedad34c793184ea23b.tar.gz trackermap-server-ad102cd882dd9ec6f7e4ffedad34c793184ea23b.tar.bz2 trackermap-server-ad102cd882dd9ec6f7e4ffedad34c793184ea23b.zip |
Add FlexAPI motion decoding
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r-- | src/main/java/org/traccar/protocol/FlexApiProtocolDecoder.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/FlexApiProtocolDecoder.java b/src/main/java/org/traccar/protocol/FlexApiProtocolDecoder.java index d4d539a9e..3dfcd459b 100644 --- a/src/main/java/org/traccar/protocol/FlexApiProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/FlexApiProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Anton Tananaev (anton@traccar.org) + * Copyright 2021 - 2022 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. @@ -89,6 +89,17 @@ public class FlexApiProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_VIN, payload.getString("obd.vin")); } + } else if (topic.contains("motion")) { + + getLastLocation(position, new Date(payload.getInt("motion.ts") * 1000L)); + + position.set("ax", payload.getJsonNumber("motion.ax").doubleValue()); + position.set("ay", payload.getJsonNumber("motion.ay").doubleValue()); + position.set("az", payload.getJsonNumber("motion.az").doubleValue()); + position.set("gx", payload.getJsonNumber("motion.gx").doubleValue()); + position.set("gy", payload.getJsonNumber("motion.gy").doubleValue()); + position.set("gz", payload.getJsonNumber("motion.gz").doubleValue()); + } else { return null; |