aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-04-17 16:59:36 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2017-04-17 16:59:36 +1200
commit57941c8095839951caf868368963ba13e8fc3da3 (patch)
tree8e3e4290a47d0ad61c2cab291a74bba7e0e00057 /tools
parentd643e9a75f1c6580d098b68cffc2c709db611d8e (diff)
downloadtrackermap-server-57941c8095839951caf868368963ba13e8fc3da3.tar.gz
trackermap-server-57941c8095839951caf868368963ba13e8fc3da3.tar.bz2
trackermap-server-57941c8095839951caf868368963ba13e8fc3da3.zip
Decode numeric OsmAnd parameters
Diffstat (limited to 'tools')
-rwxr-xr-xtools/test-generator.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/test-generator.py b/tools/test-generator.py
index 7f8916f4d..9e9cf892e 100755
--- a/tools/test-generator.py
+++ b/tools/test-generator.py
@@ -5,6 +5,7 @@ import math
import urllib
import httplib
import time
+import random
id = '123456789012345'
server = 'localhost:5055'
@@ -33,7 +34,7 @@ for i in range(0, len(waypoints)):
lon = lon1 + (lon2 - lon1) * j / count
points.append((lat, lon))
-def send(conn, lat, lon, course, speed, alarm, ignition, accuracy):
+def send(conn, lat, lon, course, speed, alarm, ignition, accuracy, rpm, fuel):
params = (('id', id), ('timestamp', int(time.time())), ('lat', lat), ('lon', lon), ('bearing', course), ('speed', speed))
if alarm:
params = params + (('alarm', 'sos'),)
@@ -41,6 +42,10 @@ def send(conn, lat, lon, course, speed, alarm, ignition, accuracy):
params = params + (('ignition', 'true'),)
if accuracy:
params = params + (('accuracy', accuracy),)
+ if rpm:
+ params = params + (('rpm', rpm),)
+ if fuel:
+ params = params + (('fuel', fuel),)
conn.request('GET', '?' + urllib.urlencode(params))
conn.getresponse().read()
@@ -64,6 +69,8 @@ while True:
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)
+ rpm = random.randint(500, 4000)
+ fuel = random.randint(0, 80)
+ send(conn, lat1, lon1, course(lat1, lon1, lat2, lon2), speed, alarm, ignition, accuracy, rpm, fuel)
time.sleep(period)
index += 1