aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/test-generator.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/test-generator.py b/tools/test-generator.py
index 0b8e4113c..a23e2576e 100755
--- a/tools/test-generator.py
+++ b/tools/test-generator.py
@@ -10,6 +10,7 @@ id = '123456789012345'
server = 'localhost:5055'
period = 1
step = 0.001
+device_speed = 40
waypoints = [
(40.722412, -74.006288),
@@ -32,12 +33,13 @@ 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):
+def send(conn, lat, lon, course, alarm, ignition, speed):
params = (('id', id), ('timestamp', int(time.time())), ('lat', lat), ('lon', lon), ('bearing', course))
if alarm:
params = params + (('alarm', 'sos'),)
if ignition:
params = params + (('ignition', 'true'),)
+ params = params + (('speed', speed),)
conn.request('GET', '?' + urllib.urlencode(params))
conn.getresponse().read()
@@ -59,6 +61,10 @@ while True:
(lat2, lon2) = points[(index + 1) % len(points)]
alarm = ((index % 10) == 0)
ignition = ((index % len(points)) != 0)
- send(conn, lat1, lon1, course(lat1, lon1, lat2, lon2), alarm, ignition)
+ if (index % len(points)) != 0:
+ speed = device_speed
+ else:
+ speed = 0
+ send(conn, lat1, lon1, course(lat1, lon1, lat2, lon2), alarm, ignition, speed)
time.sleep(period)
index += 1