@neurodevs/node-lsl 19.0.0 → 20.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/__tests__/AbstractPackageTest.d.ts +11 -11
- package/build/__tests__/AbstractPackageTest.js +26 -30
- package/build/__tests__/AbstractPackageTest.js.map +1 -1
- package/build/__tests__/impl/BleDeviceController.test.d.ts +1 -1
- package/build/__tests__/impl/BleDeviceController.test.js +8 -10
- package/build/__tests__/impl/BleDeviceController.test.js.map +1 -1
- package/build/__tests__/impl/LslEventMarkerEmitter.test.js +13 -13
- package/build/__tests__/impl/LslEventMarkerEmitter.test.js.map +1 -1
- package/build/__tests__/impl/LslStreamInfo.test.js +2 -2
- package/build/__tests__/impl/LslStreamInfo.test.js.map +1 -1
- package/build/__tests__/impl/LslStreamInlet.test.d.ts +3 -5
- package/build/__tests__/impl/LslStreamInlet.test.js +13 -46
- package/build/__tests__/impl/LslStreamInlet.test.js.map +1 -1
- package/build/__tests__/impl/LslStreamOutlet.test.js +7 -12
- package/build/__tests__/impl/LslStreamOutlet.test.js.map +1 -1
- package/build/__tests__/impl/LslWebSocketBridge.test.js +9 -10
- package/build/__tests__/impl/LslWebSocketBridge.test.js.map +1 -1
- package/build/__tests__/impl/WindowedClockRegressor.test.js +1 -1
- package/build/__tests__/impl/WindowedClockRegressor.test.js.map +1 -1
- package/build/assertions.js +1 -1
- package/build/assertions.js.map +1 -1
- package/build/impl/LslEventMarkerEmitter.d.ts +12 -12
- package/build/impl/LslEventMarkerEmitter.js.map +1 -1
- package/build/impl/LslStreamInfo.d.ts +7 -7
- package/build/impl/LslStreamInfo.js.map +1 -1
- package/build/impl/LslStreamInlet.d.ts +63 -21
- package/build/impl/LslStreamInlet.js +221 -65
- package/build/impl/LslStreamInlet.js.map +1 -1
- package/build/impl/LslStreamOutlet.d.ts +15 -14
- package/build/impl/LslStreamOutlet.js +32 -36
- package/build/impl/LslStreamOutlet.js.map +1 -1
- package/build/impl/LslWebSocketBridge.d.ts +10 -10
- package/build/impl/LslWebSocketBridge.js.map +1 -1
- package/build/impl/clocks/WindowedClockRegressor.js.map +1 -0
- package/build/impl/controllers/BleDeviceController.d.ts +1 -1
- package/build/impl/controllers/BleDeviceController.js +1 -1
- package/build/impl/controllers/BleDeviceController.js.map +1 -1
- package/build/index.d.ts +27 -23
- package/build/index.js +32 -29
- package/build/index.js.map +1 -1
- package/build/scripts/{runLslEventMarkerEmitter.js → runLslEmitter.js} +5 -4
- package/build/scripts/runLslEmitter.js.map +1 -0
- package/build/scripts/{runLslStreamOutlet.js → runLslOutlet.js} +1 -1
- package/build/scripts/runLslOutlet.js.map +1 -0
- package/build/scripts/runMuse.js +1 -1
- package/build/scripts/runMuse.js.map +1 -1
- package/build/testDoubles/ClockRegressor/FakeClockRegressor.d.ts +1 -1
- package/build/testDoubles/{EventMarkerEmitter/FakeEventMarkerEmitter.d.ts → LslEmitter/FakeLslEmitter.d.ts} +4 -4
- package/build/testDoubles/{EventMarkerEmitter/FakeEventMarkerEmitter.js → LslEmitter/FakeLslEmitter.js} +7 -7
- package/build/testDoubles/LslEmitter/FakeLslEmitter.js.map +1 -0
- package/build/testDoubles/{EventMarkerEmitter/SpyEventMarkerEmitter.d.ts → LslEmitter/SpyLslEmitter.d.ts} +4 -4
- package/build/testDoubles/{EventMarkerEmitter/SpyEventMarkerEmitter.js → LslEmitter/SpyLslEmitter.js} +3 -3
- package/build/testDoubles/LslEmitter/SpyLslEmitter.js.map +1 -0
- package/build/testDoubles/LslEmitter/ThrowingLslEmitter.d.ts +9 -0
- package/build/testDoubles/{EventMarkerEmitter/ThrowingEventMarkerEmitter.js → LslEmitter/ThrowingLslEmitter.js} +2 -2
- package/build/testDoubles/LslEmitter/ThrowingLslEmitter.js.map +1 -0
- package/build/testDoubles/{StreamInfo/FakeStreamInfo.d.ts → LslInfo/FakeLslInfo.d.ts} +4 -4
- package/build/testDoubles/{StreamInfo/FakeStreamInfo.js → LslInfo/FakeLslInfo.js} +7 -7
- package/build/testDoubles/LslInfo/FakeLslInfo.js.map +1 -0
- package/build/testDoubles/LslInfo/SpyLslInfo.d.ts +10 -0
- package/build/testDoubles/{StreamInfo/SpyStreamInfo.js → LslInfo/SpyLslInfo.js} +4 -4
- package/build/testDoubles/LslInfo/SpyLslInfo.js.map +1 -0
- package/build/testDoubles/{StreamInlet/FakeStreamInlet.d.ts → LslInlet/FakeLslInlet.d.ts} +4 -4
- package/build/testDoubles/{StreamInlet/FakeStreamInlet.js → LslInlet/FakeLslInlet.js} +12 -11
- package/build/testDoubles/LslInlet/FakeLslInlet.js.map +1 -0
- package/build/testDoubles/LslInlet/SpyLslInlet.d.ts +4 -0
- package/build/testDoubles/{StreamInlet/SpyStreamInlet.js → LslInlet/SpyLslInlet.js} +2 -2
- package/build/testDoubles/LslInlet/SpyLslInlet.js.map +1 -0
- package/build/testDoubles/{StreamOutlet/FakeStreamOutlet.d.ts → LslOutlet/FakeLslOutlet.d.ts} +5 -5
- package/build/testDoubles/{StreamOutlet/FakeStreamOutlet.js → LslOutlet/FakeLslOutlet.js} +8 -8
- package/build/testDoubles/LslOutlet/FakeLslOutlet.js.map +1 -0
- package/build/testDoubles/LslWsBridge/FakeLslWsBridge.d.ts +14 -0
- package/build/testDoubles/{WebSocketBridge/FakeWebSocketBridge.js → LslWsBridge/FakeLslWsBridge.js} +14 -14
- package/build/testDoubles/LslWsBridge/FakeLslWsBridge.js.map +1 -0
- package/build/testDoubles/LslWsBridge/SpyLslWsBridge.d.ts +4 -0
- package/build/testDoubles/{WebSocketBridge/SpyLslWebSocketBridge.js → LslWsBridge/SpyLslWsBridge.js} +2 -2
- package/build/testDoubles/LslWsBridge/SpyLslWsBridge.js.map +1 -0
- package/build/testDoubles/consts.d.ts +2 -12
- package/build/testDoubles/consts.js +0 -20
- package/build/testDoubles/consts.js.map +1 -1
- package/build/testDoubles/generateRandomOutletOptions.d.ts +2 -2
- package/build/testDoubles/generateRandomOutletOptions.js.map +1 -1
- package/package.json +4 -3
- package/src/__tests__/AbstractPackageTest.ts +29 -38
- package/src/__tests__/impl/BleDeviceController.test.ts +8 -10
- package/src/__tests__/impl/LslEventMarkerEmitter.test.ts +19 -24
- package/src/__tests__/impl/LslStreamInfo.test.ts +8 -8
- package/src/__tests__/impl/LslStreamInlet.test.ts +21 -78
- package/src/__tests__/impl/LslStreamOutlet.test.ts +17 -24
- package/src/__tests__/impl/LslWebSocketBridge.test.ts +15 -18
- package/src/__tests__/impl/WindowedClockRegressor.test.ts +1 -1
- package/src/assertions.ts +1 -2
- package/src/impl/LslEventMarkerEmitter.ts +15 -17
- package/src/impl/LslStreamInfo.ts +7 -9
- package/src/impl/LslStreamInlet.ts +305 -81
- package/src/impl/LslStreamOutlet.ts +57 -56
- package/src/impl/LslWebSocketBridge.ts +15 -18
- package/src/impl/controllers/BleDeviceController.ts +1 -1
- package/src/index.ts +38 -34
- package/src/scripts/{runLslEventMarkerEmitter.ts → runLslEmitter.ts} +4 -3
- package/src/scripts/runMuse.ts +1 -1
- package/src/testDoubles/ClockRegressor/FakeClockRegressor.ts +1 -1
- package/src/testDoubles/{EventMarkerEmitter/FakeEventMarkerEmitter.ts → LslEmitter/FakeLslEmitter.ts} +10 -10
- package/src/testDoubles/{EventMarkerEmitter/SpyEventMarkerEmitter.ts → LslEmitter/SpyLslEmitter.ts} +4 -4
- package/src/testDoubles/{EventMarkerEmitter/ThrowingEventMarkerEmitter.ts → LslEmitter/ThrowingLslEmitter.ts} +4 -4
- package/src/testDoubles/{StreamInfo/FakeStreamInfo.ts → LslInfo/FakeLslInfo.ts} +9 -9
- package/src/testDoubles/{StreamInfo/SpyStreamInfo.ts → LslInfo/SpyLslInfo.ts} +5 -5
- package/src/testDoubles/{StreamInlet/FakeStreamInlet.ts → LslInlet/FakeLslInlet.ts} +15 -14
- package/src/testDoubles/LslInlet/SpyLslInlet.ts +10 -0
- package/src/testDoubles/{StreamOutlet/FakeStreamOutlet.ts → LslOutlet/FakeLslOutlet.ts} +11 -14
- package/src/testDoubles/{WebSocketBridge/FakeWebSocketBridge.ts → LslWsBridge/FakeLslWsBridge.ts} +19 -19
- package/src/testDoubles/LslWsBridge/SpyLslWsBridge.ts +9 -0
- package/src/testDoubles/consts.ts +3 -23
- package/src/testDoubles/generateRandomOutletOptions.ts +2 -2
- package/build/consts.d.ts +0 -11
- package/build/consts.js +0 -21
- package/build/consts.js.map +0 -1
- package/build/impl/WindowedClockRegressor.js.map +0 -1
- package/build/impl/workers/inlet/LslStreamInlet.worker.d.ts +0 -22
- package/build/impl/workers/inlet/LslStreamInlet.worker.js +0 -42
- package/build/impl/workers/inlet/LslStreamInlet.worker.js.map +0 -1
- package/build/impl/workers/inlet/StreamInletWorker.d.ts +0 -73
- package/build/impl/workers/inlet/StreamInletWorker.js +0 -253
- package/build/impl/workers/inlet/StreamInletWorker.js.map +0 -1
- package/build/impl/workers/outlet/LslStreamOutlet.worker.d.ts +0 -32
- package/build/impl/workers/outlet/LslStreamOutlet.worker.js +0 -82
- package/build/impl/workers/outlet/LslStreamOutlet.worker.js.map +0 -1
- package/build/scripts/discoverMuse.js +0 -40
- package/build/scripts/discoverMuse.js.map +0 -1
- package/build/scripts/runLslEventMarkerEmitter.js.map +0 -1
- package/build/scripts/runLslStreamOutlet.d.ts +0 -1
- package/build/scripts/runLslStreamOutlet.js.map +0 -1
- package/build/scripts/testDestroyOutlet.d.ts +0 -1
- package/build/scripts/testDestroyOutlet.js +0 -4
- package/build/scripts/testDestroyOutlet.js.map +0 -1
- package/build/testDoubles/EventMarkerEmitter/FakeEventMarkerEmitter.js.map +0 -1
- package/build/testDoubles/EventMarkerEmitter/SpyEventMarkerEmitter.js.map +0 -1
- package/build/testDoubles/EventMarkerEmitter/ThrowingEventMarkerEmitter.d.ts +0 -9
- package/build/testDoubles/EventMarkerEmitter/ThrowingEventMarkerEmitter.js.map +0 -1
- package/build/testDoubles/StreamInfo/FakeStreamInfo.js.map +0 -1
- package/build/testDoubles/StreamInfo/SpyStreamInfo.d.ts +0 -10
- package/build/testDoubles/StreamInfo/SpyStreamInfo.js.map +0 -1
- package/build/testDoubles/StreamInlet/FakeStreamInlet.js.map +0 -1
- package/build/testDoubles/StreamInlet/SpyStreamInlet.d.ts +0 -4
- package/build/testDoubles/StreamInlet/SpyStreamInlet.js.map +0 -1
- package/build/testDoubles/StreamOutlet/FakeStreamOutlet.js.map +0 -1
- package/build/testDoubles/WebSocketBridge/FakeWebSocketBridge.d.ts +0 -14
- package/build/testDoubles/WebSocketBridge/FakeWebSocketBridge.js.map +0 -1
- package/build/testDoubles/WebSocketBridge/SpyLslWebSocketBridge.d.ts +0 -4
- package/build/testDoubles/WebSocketBridge/SpyLslWebSocketBridge.js.map +0 -1
- package/build/testDoubles/WorkerThreads/FakeWorker.d.ts +0 -27
- package/build/testDoubles/WorkerThreads/FakeWorker.js +0 -67
- package/build/testDoubles/WorkerThreads/FakeWorker.js.map +0 -1
- package/src/consts.ts +0 -21
- package/src/impl/workers/inlet/LslStreamInlet.worker.ts +0 -74
- package/src/impl/workers/inlet/StreamInletWorker.ts +0 -348
- package/src/impl/workers/outlet/LslStreamOutlet.worker.ts +0 -144
- package/src/scripts/discoverMuse.ts +0 -50
- package/src/scripts/testDestroyOutlet.ts +0 -5
- package/src/testDoubles/StreamInlet/SpyStreamInlet.ts +0 -10
- package/src/testDoubles/WebSocketBridge/SpyLslWebSocketBridge.ts +0 -9
- package/src/testDoubles/WorkerThreads/FakeWorker.ts +0 -99
- /package/build/impl/{WindowedClockRegressor.d.ts → clocks/WindowedClockRegressor.d.ts} +0 -0
- /package/build/impl/{WindowedClockRegressor.js → clocks/WindowedClockRegressor.js} +0 -0
- /package/build/scripts/{discoverMuse.d.ts → runLslEmitter.d.ts} +0 -0
- /package/build/scripts/{runLslEventMarkerEmitter.d.ts → runLslOutlet.d.ts} +0 -0
- /package/src/impl/{WindowedClockRegressor.ts → clocks/WindowedClockRegressor.ts} +0 -0
- /package/src/scripts/{runLslStreamOutlet.ts → runLslOutlet.ts} +0 -0
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
import WebSocket, { WebSocketServer } from 'ws'
|
|
2
2
|
|
|
3
|
-
import LslStreamInlet, {
|
|
4
|
-
StreamInlet,
|
|
5
|
-
StreamInletOptions,
|
|
6
|
-
} from './LslStreamInlet.js'
|
|
3
|
+
import LslStreamInlet, { LslInlet, LslInletOptions } from './LslStreamInlet.js'
|
|
7
4
|
|
|
8
|
-
export default class LslWebSocketBridge implements
|
|
9
|
-
public static Class?:
|
|
5
|
+
export default class LslWebSocketBridge implements LslWsBridge {
|
|
6
|
+
public static Class?: LslWsBridgeConstructor
|
|
10
7
|
public static WS = WebSocket
|
|
11
8
|
public static WSS = WebSocketServer
|
|
12
9
|
|
|
13
|
-
private inlet:
|
|
10
|
+
private inlet: LslInlet
|
|
14
11
|
private localServer?: WebSocketServer
|
|
15
12
|
private remoteSockets?: WebSocket[]
|
|
16
13
|
|
|
17
14
|
private isDestroyed = false
|
|
18
15
|
|
|
19
|
-
protected constructor(options:
|
|
16
|
+
protected constructor(options: LslWsBridgeConstructorOptions) {
|
|
20
17
|
const { inlet, localServer, remoteSockets } = options
|
|
21
18
|
|
|
22
19
|
this.inlet = inlet
|
|
@@ -26,9 +23,9 @@ export default class LslWebSocketBridge implements WebSocketBridge {
|
|
|
26
23
|
this.throwIfNoLocalServerOrRemoteSockets()
|
|
27
24
|
}
|
|
28
25
|
|
|
29
|
-
public static async Create(options:
|
|
26
|
+
public static async Create(options: LslWsBridgeOptions) {
|
|
30
27
|
const { listenPort, connectUrls, ...rest } = options
|
|
31
|
-
const inletOptions:
|
|
28
|
+
const inletOptions: LslInletOptions = rest
|
|
32
29
|
|
|
33
30
|
const localServer = this.WebSocketServer(listenPort)
|
|
34
31
|
const remoteSockets = this.createSocketsFrom(connectUrls)
|
|
@@ -155,7 +152,7 @@ export default class LslWebSocketBridge implements WebSocketBridge {
|
|
|
155
152
|
}
|
|
156
153
|
|
|
157
154
|
private static async LslStreamInlet(
|
|
158
|
-
options:
|
|
155
|
+
options: LslInletOptions,
|
|
159
156
|
localServer?: WebSocketServer,
|
|
160
157
|
remoteSockets?: WebSocket[]
|
|
161
158
|
) {
|
|
@@ -164,25 +161,25 @@ export default class LslWebSocketBridge implements WebSocketBridge {
|
|
|
164
161
|
}
|
|
165
162
|
}
|
|
166
163
|
|
|
167
|
-
export interface
|
|
164
|
+
export interface LslWsBridge {
|
|
168
165
|
activate(): Promise<void>
|
|
169
166
|
deactivate(): void
|
|
170
167
|
destroy(): void
|
|
171
168
|
}
|
|
172
169
|
|
|
173
|
-
export type
|
|
174
|
-
options:
|
|
175
|
-
) =>
|
|
170
|
+
export type LslWsBridgeConstructor = new (
|
|
171
|
+
options: LslWsBridgeConstructorOptions
|
|
172
|
+
) => LslWsBridge
|
|
176
173
|
|
|
177
|
-
export interface
|
|
174
|
+
export interface LslWsBridgeOptions {
|
|
178
175
|
sourceId: string
|
|
179
176
|
chunkSize: number
|
|
180
177
|
listenPort?: number
|
|
181
178
|
connectUrls?: string | string[]
|
|
182
179
|
}
|
|
183
180
|
|
|
184
|
-
export interface
|
|
185
|
-
inlet:
|
|
181
|
+
export interface LslWsBridgeConstructorOptions extends LslWsBridgeOptions {
|
|
182
|
+
inlet: LslInlet
|
|
186
183
|
localServer?: WebSocketServer
|
|
187
184
|
remoteSockets?: WebSocket[]
|
|
188
185
|
}
|
|
@@ -44,7 +44,7 @@ export default class BleDeviceController implements BleController {
|
|
|
44
44
|
this.rssiIntervalMs = rssiIntervalMs
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
public static
|
|
47
|
+
public static Create(options: BleControllerOptions) {
|
|
48
48
|
return new (this.Class ?? this)(options)
|
|
49
49
|
}
|
|
50
50
|
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// ClockRegressor
|
|
2
2
|
|
|
3
|
-
export { default as WindowedClockRegressor } from './impl/WindowedClockRegressor.js'
|
|
4
|
-
export * from './impl/WindowedClockRegressor.js'
|
|
3
|
+
export { default as WindowedClockRegressor } from './impl/clocks/WindowedClockRegressor.js'
|
|
4
|
+
export * from './impl/clocks/WindowedClockRegressor.js'
|
|
5
5
|
|
|
6
6
|
export { default as FakeClockRegressor } from './testDoubles/ClockRegressor/FakeClockRegressor.js'
|
|
7
7
|
export * from './testDoubles/ClockRegressor/FakeClockRegressor.js'
|
|
@@ -11,52 +11,68 @@ export * from './testDoubles/ClockRegressor/FakeClockRegressor.js'
|
|
|
11
11
|
export { default as BleDeviceController } from './impl/controllers/BleDeviceController.js'
|
|
12
12
|
export * from './impl/controllers/BleDeviceController.js'
|
|
13
13
|
|
|
14
|
+
export { default as SpyBleController } from './testDoubles/BleController/SpyBleController.js'
|
|
15
|
+
export * from './testDoubles/BleController/SpyBleController.js'
|
|
16
|
+
|
|
14
17
|
export { default as FakeBleController } from './testDoubles/BleController/FakeBleController.js'
|
|
15
18
|
export * from './testDoubles/BleController/FakeBleController.js'
|
|
16
19
|
|
|
17
|
-
|
|
18
|
-
export * from './testDoubles/BleController/SpyBleController.js'
|
|
20
|
+
// LslWsBridge
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
export { default as LslWebSocketBridge } from './impl/LslWebSocketBridge.js'
|
|
23
|
+
export * from './impl/LslWebSocketBridge.js'
|
|
24
|
+
|
|
25
|
+
export { default as SpyLslWsBridge } from './testDoubles/LslWsBridge/SpyLslWsBridge.js'
|
|
26
|
+
export * from './testDoubles/LslWsBridge/SpyLslWsBridge.js'
|
|
27
|
+
|
|
28
|
+
export { default as FakeLslWsBridge } from './testDoubles/LslWsBridge/FakeLslWsBridge.js'
|
|
29
|
+
export * from './testDoubles/LslWsBridge/FakeLslWsBridge.js'
|
|
30
|
+
|
|
31
|
+
// LslEmitter
|
|
21
32
|
|
|
22
33
|
export { default as LslEventMarkerEmitter } from './impl/LslEventMarkerEmitter.js'
|
|
23
34
|
export * from './impl/LslEventMarkerEmitter.js'
|
|
24
35
|
|
|
25
|
-
export { default as
|
|
26
|
-
export * from './testDoubles/
|
|
36
|
+
export { default as SpyLslEmitter } from './testDoubles/LslEmitter/SpyLslEmitter.js'
|
|
37
|
+
export * from './testDoubles/LslEmitter/SpyLslEmitter.js'
|
|
27
38
|
|
|
28
|
-
export { default as
|
|
29
|
-
export * from './testDoubles/
|
|
39
|
+
export { default as FakeLslEmitter } from './testDoubles/LslEmitter/FakeLslEmitter.js'
|
|
40
|
+
export * from './testDoubles/LslEmitter/FakeLslEmitter.js'
|
|
30
41
|
|
|
31
|
-
export { default as
|
|
32
|
-
export * from './testDoubles/
|
|
42
|
+
export { default as ThrowingLslEmitter } from './testDoubles/LslEmitter/ThrowingLslEmitter.js'
|
|
43
|
+
export * from './testDoubles/LslEmitter/ThrowingLslEmitter.js'
|
|
33
44
|
|
|
34
|
-
//
|
|
45
|
+
// LslInfo
|
|
35
46
|
|
|
36
47
|
export { default as LslStreamInfo } from './impl/LslStreamInfo.js'
|
|
37
48
|
export * from './impl/LslStreamInfo.js'
|
|
38
49
|
|
|
39
|
-
export { default as
|
|
40
|
-
export * from './testDoubles/
|
|
50
|
+
export { default as SpyLslInfo } from './testDoubles/LslInfo/SpyLslInfo.js'
|
|
51
|
+
export * from './testDoubles/LslInfo/SpyLslInfo.js'
|
|
41
52
|
|
|
42
|
-
export { default as
|
|
43
|
-
export * from './testDoubles/
|
|
53
|
+
export { default as FakeLslInfo } from './testDoubles/LslInfo/FakeLslInfo.js'
|
|
54
|
+
export * from './testDoubles/LslInfo/FakeLslInfo.js'
|
|
44
55
|
|
|
45
|
-
//
|
|
56
|
+
// LslInlet
|
|
46
57
|
|
|
47
58
|
export { default as LslStreamInlet } from './impl/LslStreamInlet.js'
|
|
48
59
|
export * from './impl/LslStreamInlet.js'
|
|
49
60
|
|
|
50
|
-
export { default as
|
|
51
|
-
export * from './testDoubles/
|
|
61
|
+
export { default as SpyLslInlet } from './testDoubles/LslInlet/SpyLslInlet.js'
|
|
62
|
+
export * from './testDoubles/LslInlet/SpyLslInlet.js'
|
|
63
|
+
|
|
64
|
+
export { default as FakeLslInlet } from './testDoubles/LslInlet/FakeLslInlet.js'
|
|
65
|
+
export * from './testDoubles/LslInlet/FakeLslInlet.js'
|
|
52
66
|
|
|
53
|
-
//
|
|
67
|
+
// LslOutlet
|
|
54
68
|
|
|
55
69
|
export { default as LslStreamOutlet } from './impl/LslStreamOutlet.js'
|
|
56
70
|
export * from './impl/LslStreamOutlet.js'
|
|
57
71
|
|
|
58
|
-
export { default as
|
|
59
|
-
export * from './testDoubles/
|
|
72
|
+
export { default as FakeLslOutlet } from './testDoubles/LslOutlet/FakeLslOutlet.js'
|
|
73
|
+
export * from './testDoubles/LslOutlet/FakeLslOutlet.js'
|
|
74
|
+
|
|
75
|
+
export { default as generateRandomOutletOptions } from './testDoubles/generateRandomOutletOptions.js'
|
|
60
76
|
|
|
61
77
|
// UsbController
|
|
62
78
|
|
|
@@ -66,18 +82,6 @@ export * from './impl/controllers/UsbDeviceController.js'
|
|
|
66
82
|
export { default as FakeUsbController } from './testDoubles/UsbController/FakeUsbController.js'
|
|
67
83
|
export * from './testDoubles/UsbController/FakeUsbController.js'
|
|
68
84
|
|
|
69
|
-
// WebSocketBridge
|
|
70
|
-
|
|
71
|
-
export { default as LslWebSocketBridge } from './impl/LslWebSocketBridge.js'
|
|
72
|
-
export * from './impl/LslWebSocketBridge.js'
|
|
73
|
-
|
|
74
|
-
export { default as FakeWebSocketBridge } from './testDoubles/WebSocketBridge/FakeWebSocketBridge.js'
|
|
75
|
-
export * from './testDoubles/WebSocketBridge/FakeWebSocketBridge.js'
|
|
76
|
-
|
|
77
|
-
// Utils
|
|
78
|
-
|
|
79
|
-
export { default as generateRandomOutletOptions } from './testDoubles/generateRandomOutletOptions.js'
|
|
80
|
-
|
|
81
85
|
// WebSockets
|
|
82
86
|
|
|
83
87
|
export { default as FakeWebSocket } from './testDoubles/WebSockets/FakeWebSocket.js'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import LslEventMarkerEmitter from '../impl/LslEventMarkerEmitter.js'
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const emitter = await LslEventMarkerEmitter.Create()
|
|
4
4
|
|
|
5
5
|
const markers = [
|
|
6
6
|
{ name: 'phase-1-begin', waitAfterMs: 100 },
|
|
@@ -8,8 +8,9 @@ const markers = [
|
|
|
8
8
|
{ name: 'never-reached-marker', waitAfterMs: 100 },
|
|
9
9
|
]
|
|
10
10
|
|
|
11
|
-
void
|
|
11
|
+
void emitter.emitMany(markers)
|
|
12
12
|
|
|
13
13
|
await new Promise((resolve) => setTimeout(resolve, 250))
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
emitter.interrupt()
|
|
16
|
+
emitter.destroy()
|
package/src/scripts/runMuse.ts
CHANGED
|
@@ -32,7 +32,7 @@ const charCallbacks = Object.entries(MUSE_CHARACTERISTIC_UUIDS).map(
|
|
|
32
32
|
}
|
|
33
33
|
)
|
|
34
34
|
|
|
35
|
-
const muse =
|
|
35
|
+
const muse = BleDeviceController.Create({
|
|
36
36
|
deviceUuid: 'CA6A61B7-B7A8-AF24-3C9E-04A6A5012554',
|
|
37
37
|
charCallbacks,
|
|
38
38
|
rssiIntervalMs: 1000,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ClockRegressor,
|
|
3
3
|
WindowedClockRegressorOptions,
|
|
4
|
-
} from '../../impl/WindowedClockRegressor.js'
|
|
4
|
+
} from '../../impl/clocks/WindowedClockRegressor.js'
|
|
5
5
|
|
|
6
6
|
export default class FakeClockRegressor implements ClockRegressor {
|
|
7
7
|
public static callsToConstructor: {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
LslEmitter,
|
|
3
|
+
EmitOptions,
|
|
4
4
|
TimedEventMarker,
|
|
5
5
|
} from '../../impl/LslEventMarkerEmitter.js'
|
|
6
6
|
|
|
7
|
-
export default class
|
|
7
|
+
export default class FakeLslEmitter implements LslEmitter {
|
|
8
8
|
public static numCallsToConstructor = 0
|
|
9
9
|
|
|
10
10
|
public static callsToEmit: {
|
|
11
11
|
markerName: string
|
|
12
|
-
options?:
|
|
12
|
+
options?: EmitOptions
|
|
13
13
|
}[] = []
|
|
14
14
|
|
|
15
15
|
public static callsToEmitMany: TimedEventMarker[][] = []
|
|
@@ -17,23 +17,23 @@ export default class FakeEventMarkerEmitter implements EventMarkerEmitter {
|
|
|
17
17
|
public static numCallsToDestroy = 0
|
|
18
18
|
|
|
19
19
|
public constructor() {
|
|
20
|
-
|
|
20
|
+
FakeLslEmitter.numCallsToConstructor++
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
public async emit(markerName: string, options?:
|
|
24
|
-
|
|
23
|
+
public async emit(markerName: string, options?: EmitOptions) {
|
|
24
|
+
FakeLslEmitter.callsToEmit.push({ markerName, options })
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
public async emitMany(markers: TimedEventMarker[]) {
|
|
28
|
-
|
|
28
|
+
FakeLslEmitter.callsToEmitMany.push(markers)
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
public interrupt() {
|
|
32
|
-
|
|
32
|
+
FakeLslEmitter.numCallsToInterrupt++
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
public destroy() {
|
|
36
|
-
|
|
36
|
+
FakeLslEmitter.numCallsToDestroy++
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
public static resetTestDouble() {
|
package/src/testDoubles/{EventMarkerEmitter/SpyEventMarkerEmitter.ts → LslEmitter/SpyLslEmitter.ts}
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import LslEventMarkerEmitter from '../../impl/LslEventMarkerEmitter.js'
|
|
2
|
-
import {
|
|
2
|
+
import { LslOutlet } from '../../impl/LslStreamOutlet.js'
|
|
3
3
|
|
|
4
|
-
export default class
|
|
4
|
+
export default class SpyLslEmitter extends LslEventMarkerEmitter {
|
|
5
5
|
public static shouldCallWaitOnSuper = false
|
|
6
6
|
|
|
7
7
|
public totalwaitAfterMs: number
|
|
8
8
|
|
|
9
|
-
public constructor(outlet:
|
|
9
|
+
public constructor(outlet: LslOutlet) {
|
|
10
10
|
super(outlet)
|
|
11
11
|
|
|
12
12
|
this.totalwaitAfterMs = 0
|
|
@@ -15,7 +15,7 @@ export default class SpyEventMarkerEmitter extends LslEventMarkerEmitter {
|
|
|
15
15
|
public async wait(waitAfterMs: number) {
|
|
16
16
|
this.totalwaitAfterMs += waitAfterMs
|
|
17
17
|
|
|
18
|
-
if (
|
|
18
|
+
if (SpyLslEmitter.shouldCallWaitOnSuper) {
|
|
19
19
|
return super.wait(waitAfterMs)
|
|
20
20
|
}
|
|
21
21
|
return Promise.resolve()
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
LslEmitter,
|
|
3
|
+
EmitOptions,
|
|
4
4
|
TimedEventMarker,
|
|
5
5
|
} from '../../impl/LslEventMarkerEmitter.js'
|
|
6
6
|
|
|
7
|
-
export default class
|
|
7
|
+
export default class ThrowingLslEmitter implements LslEmitter {
|
|
8
8
|
private errorMsg = 'Intentional throwing: '
|
|
9
9
|
|
|
10
10
|
public constructor() {
|
|
11
11
|
throw new Error(this.errorMsg + 'constructor')
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
public async emit(_markerName: string, _options?:
|
|
14
|
+
public async emit(_markerName: string, _options?: EmitOptions) {
|
|
15
15
|
throw new Error(this.errorMsg + 'emit')
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import generateId from '@neurodevs/generate-id'
|
|
2
2
|
import { InfoHandle } from '@neurodevs/ndx-native'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { LslInfo, LslInfoOptions } from '../../impl/LslStreamInfo.js'
|
|
5
5
|
|
|
6
|
-
export default class
|
|
7
|
-
public static callsToConstructor: (
|
|
6
|
+
export default class FakeLslInfo implements LslInfo {
|
|
7
|
+
public static callsToConstructor: (LslInfoOptions | undefined)[] = []
|
|
8
8
|
public static numCallsToDestroy = 0
|
|
9
9
|
|
|
10
10
|
public static infoHandle = {} as InfoHandle
|
|
@@ -17,12 +17,12 @@ export default class FakeStreamInfo implements StreamInfo {
|
|
|
17
17
|
public sampleRateHz = 0
|
|
18
18
|
public units = 'N/A'
|
|
19
19
|
|
|
20
|
-
public constructor(options?:
|
|
21
|
-
|
|
20
|
+
public constructor(options?: LslInfoOptions) {
|
|
21
|
+
FakeLslInfo.callsToConstructor.push(options)
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
public destroy() {
|
|
25
|
-
|
|
25
|
+
FakeLslInfo.numCallsToDestroy++
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
public get channelCount() {
|
|
@@ -30,11 +30,11 @@ export default class FakeStreamInfo implements StreamInfo {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
public get infoHandle() {
|
|
33
|
-
return
|
|
33
|
+
return FakeLslInfo.infoHandle
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
public static resetTestDouble() {
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
FakeLslInfo.callsToConstructor = []
|
|
38
|
+
FakeLslInfo.numCallsToDestroy = 0
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import LslStreamInfo, {
|
|
1
|
+
import LslStreamInfo, { LslInfoOptions } from '../../impl/LslStreamInfo.js'
|
|
2
2
|
|
|
3
|
-
export default class
|
|
3
|
+
export default class SpyLslInfo extends LslStreamInfo {
|
|
4
4
|
public static numCallsToConstructor = 0
|
|
5
5
|
|
|
6
|
-
public constructor(options:
|
|
6
|
+
public constructor(options: LslInfoOptions) {
|
|
7
7
|
super(options)
|
|
8
|
-
|
|
8
|
+
SpyLslInfo.numCallsToConstructor++
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
public getName() {
|
|
@@ -25,6 +25,6 @@ export default class SpyStreamInfo extends LslStreamInfo {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
public static resetTestDouble() {
|
|
28
|
-
|
|
28
|
+
SpyLslInfo.numCallsToConstructor = 0
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OnDataCallback,
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
LslInlet,
|
|
4
|
+
LslInletOptions,
|
|
5
5
|
} from '../../impl/LslStreamInlet.js'
|
|
6
6
|
|
|
7
|
-
export default class
|
|
7
|
+
export default class FakeLslInlet implements LslInlet {
|
|
8
8
|
public static callsToConstructor: {
|
|
9
|
-
options?:
|
|
9
|
+
options?: LslInletOptions
|
|
10
10
|
onData?: OnDataCallback
|
|
11
11
|
}[] = []
|
|
12
12
|
|
|
@@ -19,37 +19,38 @@ export default class FakeStreamInlet implements StreamInlet {
|
|
|
19
19
|
|
|
20
20
|
protected onData!: OnDataCallback
|
|
21
21
|
|
|
22
|
-
public constructor(options?:
|
|
22
|
+
public constructor(options?: LslInletOptions, onData?: OnDataCallback) {
|
|
23
23
|
this.onData = onData ?? (() => {})
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
FakeLslInlet.callsToConstructor.push({
|
|
26
26
|
options,
|
|
27
27
|
onData: this.onData,
|
|
28
28
|
})
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
public async startPulling() {
|
|
32
|
-
|
|
32
|
+
FakeLslInlet.numCallsToStartPulling++
|
|
33
33
|
this.isRunning = true
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
public stopPulling() {
|
|
37
|
-
|
|
37
|
+
FakeLslInlet.numCallsToStopPulling++
|
|
38
38
|
this.isRunning = false
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
public flushInlet() {
|
|
42
|
-
|
|
42
|
+
FakeLslInlet.numCallsToFlushInlet++
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
public destroy() {
|
|
46
|
-
|
|
46
|
+
FakeLslInlet.numCallsToDestroy++
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
public static resetTestDouble() {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
this.callsToConstructor = []
|
|
51
|
+
this.numCallsToStartPulling = 0
|
|
52
|
+
this.numCallsToStopPulling = 0
|
|
53
|
+
this.numCallsToFlushInlet = 0
|
|
54
|
+
this.numCallsToDestroy = 0
|
|
54
55
|
}
|
|
55
56
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import LslStreamInlet, {
|
|
2
|
+
OnDataCallback,
|
|
3
|
+
LslInletOptions,
|
|
4
|
+
} from '../../impl/LslStreamInlet.js'
|
|
5
|
+
|
|
6
|
+
export default class SpyLslInlet extends LslStreamInlet {
|
|
7
|
+
public constructor(options: LslInletOptions, onData: OnDataCallback) {
|
|
8
|
+
super(options, onData)
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -3,13 +3,10 @@ import { randomInt } from 'node:crypto'
|
|
|
3
3
|
import generateId from '@neurodevs/generate-id'
|
|
4
4
|
import { LslSample } from '@neurodevs/ndx-native'
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
StreamOutlet,
|
|
8
|
-
StreamOutletOptions,
|
|
9
|
-
} from '../../impl/LslStreamOutlet.js'
|
|
6
|
+
import { LslOutlet, LslOutletOptions } from '../../impl/LslStreamOutlet.js'
|
|
10
7
|
|
|
11
|
-
export default class
|
|
12
|
-
public static callsToConstructor: (
|
|
8
|
+
export default class FakeLslOutlet implements LslOutlet {
|
|
9
|
+
public static callsToConstructor: (LslOutletOptions | undefined)[] = []
|
|
13
10
|
|
|
14
11
|
public static callsToPushSample: {
|
|
15
12
|
sample: LslSample
|
|
@@ -18,19 +15,19 @@ export default class FakeStreamOutlet implements StreamOutlet {
|
|
|
18
15
|
|
|
19
16
|
public static numCallsToDestroy = 0
|
|
20
17
|
|
|
21
|
-
public options?:
|
|
18
|
+
public options?: LslOutletOptions
|
|
22
19
|
|
|
23
|
-
public constructor(options?:
|
|
24
|
-
|
|
20
|
+
public constructor(options?: LslOutletOptions) {
|
|
21
|
+
FakeLslOutlet.callsToConstructor.push(options)
|
|
25
22
|
this.options = options
|
|
26
23
|
}
|
|
27
24
|
|
|
28
25
|
public destroy() {
|
|
29
|
-
|
|
26
|
+
FakeLslOutlet.numCallsToDestroy++
|
|
30
27
|
}
|
|
31
28
|
|
|
32
29
|
public pushSample(sample: LslSample, timestampSec?: number) {
|
|
33
|
-
|
|
30
|
+
FakeLslOutlet.callsToPushSample.push({
|
|
34
31
|
sample,
|
|
35
32
|
timestampSec,
|
|
36
33
|
})
|
|
@@ -81,8 +78,8 @@ export default class FakeStreamOutlet implements StreamOutlet {
|
|
|
81
78
|
}
|
|
82
79
|
|
|
83
80
|
public static resetTestDouble() {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
81
|
+
FakeLslOutlet.callsToConstructor = []
|
|
82
|
+
FakeLslOutlet.callsToPushSample = []
|
|
83
|
+
FakeLslOutlet.numCallsToDestroy = 0
|
|
87
84
|
}
|
|
88
85
|
}
|
package/src/testDoubles/{WebSocketBridge/FakeWebSocketBridge.ts → LslWsBridge/FakeLslWsBridge.ts}
RENAMED
|
@@ -1,44 +1,34 @@
|
|
|
1
1
|
import WebSocket, { WebSocketServer } from 'ws'
|
|
2
2
|
import LslWebSocketBridge, {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
LslWsBridge,
|
|
4
|
+
LslWsBridgeConstructorOptions,
|
|
5
5
|
} from '../../impl/LslWebSocketBridge.js'
|
|
6
6
|
import FakeWebSocket from '../WebSockets/FakeWebSocket.js'
|
|
7
7
|
import FakeWebSocketServer from '../WebSockets/FakeWebSocketServer.js'
|
|
8
8
|
|
|
9
|
-
export default class
|
|
9
|
+
export default class FakeLslWsBridge implements LslWsBridge {
|
|
10
10
|
public static callsToConstructor: (
|
|
11
|
-
|
|
11
|
+
LslWsBridgeConstructorOptions | undefined
|
|
12
12
|
)[] = []
|
|
13
13
|
|
|
14
14
|
public static numCallsToActivate = 0
|
|
15
15
|
public static numCallsToDeactivate = 0
|
|
16
16
|
public static numCallsToDestroy = 0
|
|
17
17
|
|
|
18
|
-
public constructor(options?:
|
|
19
|
-
|
|
18
|
+
public constructor(options?: LslWsBridgeConstructorOptions) {
|
|
19
|
+
FakeLslWsBridge.callsToConstructor.push(options)
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
public async activate() {
|
|
23
|
-
|
|
23
|
+
FakeLslWsBridge.numCallsToActivate++
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
public deactivate() {
|
|
27
|
-
|
|
27
|
+
FakeLslWsBridge.numCallsToDeactivate++
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
public destroy() {
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
public static resetTestDouble() {
|
|
35
|
-
this.callsToConstructor = []
|
|
36
|
-
this.numCallsToActivate = 0
|
|
37
|
-
this.numCallsToDeactivate = 0
|
|
38
|
-
this.numCallsToDestroy = 0
|
|
39
|
-
|
|
40
|
-
this.setFakeWebSocket()
|
|
41
|
-
this.setFakeWebSocketServer()
|
|
31
|
+
FakeLslWsBridge.numCallsToDestroy++
|
|
42
32
|
}
|
|
43
33
|
|
|
44
34
|
private static setFakeWebSocket() {
|
|
@@ -51,4 +41,14 @@ export default class FakeWebSocketBridge implements WebSocketBridge {
|
|
|
51
41
|
FakeWebSocketServer as unknown as typeof WebSocketServer
|
|
52
42
|
FakeWebSocketServer.resetTestDouble()
|
|
53
43
|
}
|
|
44
|
+
|
|
45
|
+
public static resetTestDouble() {
|
|
46
|
+
this.callsToConstructor = []
|
|
47
|
+
this.numCallsToActivate = 0
|
|
48
|
+
this.numCallsToDeactivate = 0
|
|
49
|
+
this.numCallsToDestroy = 0
|
|
50
|
+
|
|
51
|
+
this.setFakeWebSocket()
|
|
52
|
+
this.setFakeWebSocketServer()
|
|
53
|
+
}
|
|
54
54
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ChannelFormat } from '@neurodevs/ndx-native'
|
|
2
|
+
|
|
1
3
|
export const TEST_SUPPORTED_CHANNEL_FORMATS = ['float32', 'string'] as const
|
|
2
4
|
|
|
3
5
|
export const TEST_UNSUPPORTED_CHANNEL_FORMATS = [
|
|
@@ -9,26 +11,4 @@ export const TEST_UNSUPPORTED_CHANNEL_FORMATS = [
|
|
|
9
11
|
'int64',
|
|
10
12
|
] as const
|
|
11
13
|
|
|
12
|
-
export
|
|
13
|
-
'undefined',
|
|
14
|
-
'float32',
|
|
15
|
-
'double64',
|
|
16
|
-
'string',
|
|
17
|
-
'int32',
|
|
18
|
-
'int16',
|
|
19
|
-
'int8',
|
|
20
|
-
'int64',
|
|
21
|
-
] as const
|
|
22
|
-
|
|
23
|
-
export const TEST_CHANNEL_FORMATS_MAP = {
|
|
24
|
-
undefined: 0,
|
|
25
|
-
float32: 1,
|
|
26
|
-
double64: 2,
|
|
27
|
-
string: 3,
|
|
28
|
-
int32: 4,
|
|
29
|
-
int16: 5,
|
|
30
|
-
int8: 6,
|
|
31
|
-
int64: 7,
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export type TestChannelFormat = (typeof TEST_CHANNEL_FORMATS)[number]
|
|
14
|
+
export type TestChannelFormat = ChannelFormat
|