aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/OsmAndProtocolDecoder.java3
-rwxr-xr-xtools/test-generator.py19
2 files changed, 12 insertions, 10 deletions
diff --git a/src/org/traccar/protocol/OsmAndProtocolDecoder.java b/src/org/traccar/protocol/OsmAndProtocolDecoder.java
index 5508cad92..382865e8f 100644
--- a/src/org/traccar/protocol/OsmAndProtocolDecoder.java
+++ b/src/org/traccar/protocol/OsmAndProtocolDecoder.java
@@ -119,6 +119,9 @@ public class OsmAndProtocolDecoder extends BaseProtocolDecoder {
case "altitude":
position.setAltitude(Double.parseDouble(value));
break;
+ case "accuracy":
+ position.setAccuracy(Double.parseDouble(value));
+ break;
case "hdop":
position.set(Position.KEY_HDOP, Double.parseDouble(value));
break;
diff --git a/tools/test-generator.py b/tools/test-generator.py
index a23e2576e..1a50c5c61 100755
--- a/tools/test-generator.py
+++ b/tools/test-generator.py
@@ -33,13 +33,14 @@ for i in range(0, len(waypoints)):
lon = lon1 + (lon2 - lon1) * j / count
points.append((lat, lon))
-def send(conn, lat, lon, course, alarm, ignition, speed):
- params = (('id', id), ('timestamp', int(time.time())), ('lat', lat), ('lon', lon), ('bearing', course))
+def send(conn, lat, lon, course, speed, alarm, ignition, accuracy):
+ params = (('id', id), ('timestamp', int(time.time())), ('lat', lat), ('lon', lon), ('bearing', course), ('speed', speed))
if alarm:
params = params + (('alarm', 'sos'),)
if ignition:
params = params + (('ignition', 'true'),)
- params = params + (('speed', speed),)
+ if ignition:
+ params = params + (('accuracy', accuracy),)
conn.request('GET', '?' + urllib.urlencode(params))
conn.getresponse().read()
@@ -59,12 +60,10 @@ conn = httplib.HTTPConnection(server)
while True:
(lat1, lon1) = points[index % len(points)]
(lat2, lon2) = points[(index + 1) % len(points)]
- alarm = ((index % 10) == 0)
- ignition = ((index % len(points)) != 0)
- if (index % len(points)) != 0:
- speed = device_speed
- else:
- speed = 0
- send(conn, lat1, lon1, course(lat1, lon1, lat2, lon2), alarm, ignition, speed)
+ speed = device_speed if (index % len(points)) != 0 else 0
+ alarm = (index % 10) == 0
+ ignition = (index % len(points)) != 0
+ accuracy = 100 if (index % 10) == 0 else 0
+ send(conn, lat1, lon1, course(lat1, lon1, lat2, lon2), speed, alarm, ignition, accuracy)
time.sleep(period)
index += 1