From 57941c8095839951caf868368963ba13e8fc3da3 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 17 Apr 2017 16:59:36 +1200 Subject: Decode numeric OsmAnd parameters --- tools/test-generator.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'tools') 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 -- cgit v1.2.3