-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
23 lines (21 loc) · 840 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
'use strict';
var configs = require('./configs')(require('path').join(__dirname, 'configs/configs.json'));
var store = require('epfl-enac-gilliarddb')(configs.db);
var acquisition = require('./acquisition')(configs.logging);
var fs = require('fs');
configs.acquisitionSys.boards.map(function (board) {
acquisition.listen(board, function (acquisitionData) {
//Add AcquSysId to AcquData for the npm module
acquisitionData.acquisitionSysId = configs.acquisitionSys.secret;
try {
store.repository.insertSensorValue({
models: store.models,
configs: configs,
acquisitionData: acquisitionData,
currentBoard: board
});
} catch (error) {
fs.appendFile('./logs/insertDbErrors.log', error);
}
});
});