-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.js
71 lines (66 loc) · 2.03 KB
/
config.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
const utils = require('./lib/utils');
const config = {
port: 5552,
ble_throttle: 200,
// Tora nRF52840 d2:be:73:87:70:db
// Tora Nut gris 71:bc:23:4c:72:5b
beacons: [
{
name: 'Tora_Nut',
mac: '71:bc:23:4c:72:5b',
reference: {
distance: 1,
rssi: { pi1: -66, pi2: -60, pi3: -75}
},
aggregate: { strategy: 'continuous' },
pair: {
service: '0000ff0000001000800000805f9b34fb',
characteristic: '0000ff0100001000800000805f9b34fb',
enable: characteristic => characteristic.writeAsync(Buffer.from('03', 'hex'), false),
disable: characteristic => characteristic.writeAsync(Buffer.from('03', 'hex'), false)
}
}
],
// Default aggregate values for beacons
aggregate: {
timeout: 15000, // Maximum time we wait all ap measures in 'when_available' strategy
interval: 12000, // Time between each position event in 'continuous' strategy
// 'when_available' will process position when all ap has responded
// 'continuous' will process position every 'interval' time
strategy: 'continuous',
// Will set a value when one AP is missing
approximate: [
{ missing: 'pi3', rssi: -92 },
]
},
accessPoints: {
pi1: {
master: true,
url: 'pimaster',
x: 0.5,
y: 8
},
pi2: { x: 0, y: 0 },
pi3: { x: 7.5, y: 9 },
pi4: { x: 4, y: 8 },
},
runawayBounds: [
[[-Infinity, -Infinity], [-1, 8]],
],
runawayCondition: pool => pool.pi2 > -95 && pool.pi3 > -95,
dashboard: {
autosaveInterval: 900 * 1000,
port: 5553,
base: '/home/pi/tracking/'
}
};
config.beacons.map((beacon) => {
beacon.mac = utils.standardizeMac(beacon.mac);
});
config.beaconsMac = config.beacons.map((beacon) => beacon.mac);
config.mastersName = Object.keys(config.accessPoints).find(apName => config.accessPoints[apName].url);
config.masterIp = config.accessPoints[config.mastersName].url;
if (!config.masterIp) {
utils.exit(`Cannot find master url un accessPoint definition`);
}
module.exports = config;