diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2013-10-11 23:32:43 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2013-10-11 23:32:43 +1300 |
commit | d97f71973d3e0dd3571a05f8a938813795f5aced (patch) | |
tree | 738e552031a06310123bac14be040a42d9e30f9e /src | |
parent | 6f177f5ceb8c8ce9af7be71effd1855dc764507a (diff) | |
download | traccar-server-d97f71973d3e0dd3571a05f8a938813795f5aced.tar.gz traccar-server-d97f71973d3e0dd3571a05f8a938813795f5aced.tar.bz2 traccar-server-d97f71973d3e0dd3571a05f8a938813795f5aced.zip |
Support SendLocation app
Diffstat (limited to 'src')
-rw-r--r-- | src/org/traccar/protocol/OsmAndProtocolDecoder.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/OsmAndProtocolDecoder.java b/src/org/traccar/protocol/OsmAndProtocolDecoder.java index dba5e003b..50903f52a 100644 --- a/src/org/traccar/protocol/OsmAndProtocolDecoder.java +++ b/src/org/traccar/protocol/OsmAndProtocolDecoder.java @@ -53,7 +53,7 @@ public class OsmAndProtocolDecoder extends BaseProtocolDecoder { ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("osmand"); // Identification - String id = params.get("id").get(0); + String id = params.get(params.containsKey("id") ? "id" : "deviceid").get(0); try { position.setDeviceId(getDataManager().getDeviceByImei(id).getId()); } catch(Exception error) { @@ -62,7 +62,11 @@ public class OsmAndProtocolDecoder extends BaseProtocolDecoder { // Decode position position.setValid(true); - position.setTime(new Date(Long.valueOf(params.get("timestamp").get(0)) * 1000)); + if (params.containsKey("timestamp")) { + position.setTime(new Date(Long.valueOf(params.get("timestamp").get(0)) * 1000)); + } else { + position.setTime(new Date()); + } position.setLatitude(Double.valueOf(params.get("lat").get(0))); position.setLongitude(Double.valueOf(params.get("lon").get(0))); @@ -74,6 +78,8 @@ public class OsmAndProtocolDecoder extends BaseProtocolDecoder { } if (params.containsKey("bearing")) { position.setCourse(Double.valueOf(params.get("bearing").get(0))); + } else if (params.containsKey("heading")) { + position.setCourse(Double.valueOf(params.get("heading").get(0))); } else { position.setCourse(0.0); } @@ -85,6 +91,12 @@ public class OsmAndProtocolDecoder extends BaseProtocolDecoder { if (params.containsKey("hdop")) { extendedInfo.set("hdop", params.get("hdop").get(0)); } + if (params.containsKey("vacc")) { + extendedInfo.set("vacc", params.get("vacc").get(0)); + } + if (params.containsKey("hacc")) { + extendedInfo.set("hacc", params.get("hacc").get(0)); + } position.setExtendedInfo(extendedInfo.toString()); |