-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
43 lines (31 loc) · 1.1 KB
/
main.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
var logger = require('./logger');
logger.setup();
logger.log('info','LOADING...');
var Beacon = require('./beacon'),
fs = require('fs'),
csv = require('csv'),
Environment = require('./environment'),
Router = require('./router'),
Guide = require('./guide'),
Sensor = require('./sensor'),
Destinations = require('./destinations'),
winston = require('winston');
csv()
.from.path('./calibration.csv', { comment: '#', delimiter: ',', escape: '"' })
.to.array(function(data){
data.forEach(function(row){
if(row[0]=='1'){
beacon = new Beacon(row[1],row[2],row[3],row[4]);
beacon.calibrate(row[5],row[6]);
beacon.calibrate(row[7],row[8]);
Environment.addBeacon(beacon);
}
});
Destinations.loadLocations();
Router.loadPaths();
Environment.startListening();
Sensor.startSensing();
Guide.speak('Waiting for sensors to get active.');
if(process.argv[2])
Router.setDestinationBeaconMacAddress(process.argv[2]);
} );