-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdummy.js
43 lines (37 loc) · 1022 Bytes
/
dummy.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
module.exports = {
kpyt: function(){
var provider = getProvider();
var latlng = getLatLng();
var fixdate = getFixdate();
var speed = getSpeed();
var bearing = getBearing();
var accuracy = 10;
return '$KPYT,DEVICE_ID,'
+ provider + ','
+ accuracy + ','
+ latlng + ','
+ fixdate + ','
+ speed + ','
+ bearing;
}
}
function getRandomInRange(a, b, fixed) {
return (Math.random() * (b - a) + a).toFixed(fixed) * 1;
}
var providers = ['fused:root', 'gps:root', 'network:root'];
function getProvider(){
return providers[Math.floor(Math.random() * providers.length)];
}
function getBearing(){
return Math.random()*100;
}
function getSpeed(){
return Math.random()*100;
}
function getFixdate(){
return Math.floor(Date.now() / 1000);
}
function getLatLng(){
return getRandomInRange(-180, 180, 3) + ',' +
getRandomInRange(-180, 180, 3);
}