-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
48 lines (37 loc) · 1.13 KB
/
index.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
'use strict'
import { constants } from './constants'
import express from 'express'
import http from 'http'
import SocketIO from 'socket.io'
import { Utils } from './utils'
import { Connectors } from './connectors'
import { Providers } from './providers'
import { Modules } from './modules'
let app = express()
let server = http.Server(app)
let io = new SocketIO(server)
let port = process.env.PORT || constants.sockets.port || 3000
const Connector = new Connectors.Serialport({
// debug: true,
verbose: true,
simulatorInjectLineNoise: '50Hz' // 'none' '50Hz' '60Hz'
})
const Signal = new Providers.Signal({io})
const Motion = new Providers.Motion({io})
const Raw = new Providers.Raw({io})
server.listen(port, () => {
console.log('[INFO] Listening on *:' + port)
})
Connector.start().then(() => {
const TimeSeries = new Modules.TimeSeries({Signal})
const FFT = new Modules.FFT({Signal})
const Topo = new Modules.Topo({Signal})
const RawData = new Modules.RawData({Raw})
})
Connector.stream((data) => {
Signal.buffer(data)
Motion.capture(data)
Raw.capture(data)
})
console.log('[INFO] Server start...')
// Connector.stop()