aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-01-16 13:51:40 +0500
committerAbyss777 <abyss@fox5.ru>2017-01-16 13:51:40 +0500
commitb5eb48cbba215ca55c1a5e5ae5fae5b375243247 (patch)
tree64a25006deb6635853c0cc727db201f088566347 /tools
parentcffbce4b3bc5ef817c4063a74f148a2a5986d58a (diff)
parent00caa503748a1dad3349bfb8444ef766efd60633 (diff)
downloadtrackermap-server-b5eb48cbba215ca55c1a5e5ae5fae5b375243247.tar.gz
trackermap-server-b5eb48cbba215ca55c1a5e5ae5fae5b375243247.tar.bz2
trackermap-server-b5eb48cbba215ca55c1a5e5ae5fae5b375243247.zip
Merge remote-tracking branch 'upstream/master' into manager
# Conflicts: # setup/default.xml
Diffstat (limited to 'tools')
-rwxr-xr-xtools/test-generator.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/tools/test-generator.py b/tools/test-generator.py
index a23e2576e..7f8916f4d 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 accuracy:
+ 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