-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
31 lines (26 loc) · 1.07 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
/*eslint-disable unknown-require */
const trackerConfig = require('./tracker_configuration.json');
const Promise = require('bluebird');
const admin = require('firebase-admin');
const serviceAccount = require('./serviceAccountKey.json');
const googleMapsClient = require('@google/maps').createClient({
key: trackerConfig.mapsApiKey,
Promise
});
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: trackerConfig.databaseURL
});
// Database references
const panelsRef = admin.database().ref('panels');
const timeRef = admin.database().ref('current-time');
// const GpsRef = admin.database().ref('e-shuttle-gps-data');
const RawGpsRef = admin.database().ref('e-shuttle-raw-gps');
const SnappedGpsRef = admin.database().ref('e-shuttle-snapped-gps');
// Library classes
const {HeartBeat} = require('./heart_beat.js');
const {ReadData} = require('./read_data.js');
const {snapToRoad} = require('./snap_to_road.js');
new HeartBeat(timeRef, trackerConfig.simulation);
new snapToRoad(RawGpsRef, SnappedGpsRef, googleMapsClient);
new ReadData(RawGpsRef);