@neurodevs/node-lsl 17.1.0 → 18.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/.claude/settings.local.json +10 -0
- package/.regressionproof.json +7 -0
- package/.vscode/launch.json +3 -2
- package/README.md +9 -35
- package/build/.spruce/settings.json +5 -1
- package/build/__tests__/AbstractPackageTest.d.ts +4 -4
- package/build/__tests__/AbstractPackageTest.js +9 -11
- package/build/__tests__/AbstractPackageTest.js.map +1 -1
- package/build/__tests__/impl/LslBackpressureMonitor.test.d.ts +7 -0
- package/build/__tests__/impl/LslBackpressureMonitor.test.js +26 -0
- package/build/__tests__/impl/LslBackpressureMonitor.test.js.map +1 -0
- package/build/__tests__/impl/LslEventMarkerEmitter.test.d.ts +34 -0
- package/build/__tests__/impl/LslEventMarkerEmitter.test.js +243 -0
- package/build/__tests__/impl/LslEventMarkerEmitter.test.js.map +1 -0
- package/build/__tests__/impl/LslStreamInfo.test.d.ts +0 -3
- package/build/__tests__/impl/LslStreamInfo.test.js +2 -27
- package/build/__tests__/impl/LslStreamInfo.test.js.map +1 -1
- package/build/__tests__/impl/LslStreamInlet.test.d.ts +22 -8
- package/build/__tests__/impl/LslStreamInlet.test.js +240 -66
- package/build/__tests__/impl/LslStreamInlet.test.js.map +1 -1
- package/build/__tests__/impl/LslStreamOutlet.test.d.ts +3 -7
- package/build/__tests__/impl/LslStreamOutlet.test.js +36 -46
- package/build/__tests__/impl/LslStreamOutlet.test.js.map +1 -1
- package/build/__tests__/impl/LslWebSocketBridge.test.js +16 -17
- package/build/__tests__/impl/LslWebSocketBridge.test.js.map +1 -1
- package/build/assertions.d.ts +1 -1
- package/build/assertions.js.map +1 -1
- package/build/impl/LslBackpressureMonitor.d.ts +8 -0
- package/build/impl/LslBackpressureMonitor.js +8 -0
- package/build/impl/LslBackpressureMonitor.js.map +1 -0
- package/build/impl/LslEventMarkerEmitter.d.ts +35 -0
- package/build/impl/LslEventMarkerEmitter.js +86 -0
- package/build/impl/LslEventMarkerEmitter.js.map +1 -0
- package/build/impl/LslStreamInfo.d.ts +4 -8
- package/build/impl/LslStreamInfo.js +8 -21
- package/build/impl/LslStreamInfo.js.map +1 -1
- package/build/impl/LslStreamInlet.d.ts +31 -47
- package/build/impl/LslStreamInlet.js +82 -143
- package/build/impl/LslStreamInlet.js.map +1 -1
- package/build/impl/LslStreamOutlet.d.ts +15 -18
- package/build/impl/LslStreamOutlet.js +39 -47
- package/build/impl/LslStreamOutlet.js.map +1 -1
- package/build/impl/LslWebSocketBridge.d.ts +4 -5
- package/build/impl/LslWebSocketBridge.js +8 -8
- package/build/impl/LslWebSocketBridge.js.map +1 -1
- package/build/impl/workers/inlet/LslStreamInlet.worker.d.ts +22 -0
- package/build/impl/workers/inlet/LslStreamInlet.worker.js +42 -0
- package/build/impl/workers/inlet/LslStreamInlet.worker.js.map +1 -0
- package/build/impl/workers/inlet/StreamInletWorker.d.ts +73 -0
- package/build/impl/workers/inlet/StreamInletWorker.js +253 -0
- package/build/impl/workers/inlet/StreamInletWorker.js.map +1 -0
- package/build/impl/workers/outlet/LslStreamOutlet.worker.d.ts +32 -0
- package/build/impl/workers/outlet/LslStreamOutlet.worker.js +82 -0
- package/build/impl/workers/outlet/LslStreamOutlet.worker.js.map +1 -0
- package/build/index.d.ts +12 -14
- package/build/index.js +14 -16
- package/build/index.js.map +1 -1
- package/build/scripts/finalizeHandles.d.ts +2 -0
- package/build/scripts/finalizeHandles.js +48 -0
- package/build/scripts/finalizeHandles.js.map +1 -0
- package/build/scripts/runLslEventMarkerEmitter.js +11 -0
- package/build/scripts/runLslEventMarkerEmitter.js.map +1 -0
- package/build/scripts/runOutletToInlet.js +7 -6
- package/build/scripts/runOutletToInlet.js.map +1 -1
- package/build/scripts/testDestroyOutlet.d.ts +1 -0
- package/build/scripts/testDestroyOutlet.js +4 -0
- package/build/scripts/testDestroyOutlet.js.map +1 -0
- package/build/testDoubles/BackpressureMonitor/FakeBackpressureMonitor.d.ts +6 -0
- package/build/testDoubles/BackpressureMonitor/FakeBackpressureMonitor.js +10 -0
- package/build/testDoubles/BackpressureMonitor/FakeBackpressureMonitor.js.map +1 -0
- package/build/testDoubles/EventMarkerEmitter/FakeEventMarkerEmitter.d.ts +17 -0
- package/build/testDoubles/EventMarkerEmitter/FakeEventMarkerEmitter.js +30 -0
- package/build/testDoubles/EventMarkerEmitter/FakeEventMarkerEmitter.js.map +1 -0
- package/build/testDoubles/EventMarkerEmitter/SpyEventMarkerEmitter.d.ts +10 -0
- package/build/testDoubles/EventMarkerEmitter/SpyEventMarkerEmitter.js +23 -0
- package/build/testDoubles/EventMarkerEmitter/SpyEventMarkerEmitter.js.map +1 -0
- package/build/testDoubles/EventMarkerEmitter/ThrowingEventMarkerEmitter.d.ts +9 -0
- package/build/testDoubles/EventMarkerEmitter/ThrowingEventMarkerEmitter.js +19 -0
- package/build/testDoubles/EventMarkerEmitter/ThrowingEventMarkerEmitter.js.map +1 -0
- package/build/testDoubles/StreamInfo/FakeStreamInfo.d.ts +3 -3
- package/build/testDoubles/StreamInfo/FakeStreamInfo.js +3 -3
- package/build/testDoubles/StreamInfo/FakeStreamInfo.js.map +1 -1
- package/build/testDoubles/StreamInlet/FakeStreamInlet.d.ts +8 -10
- package/build/testDoubles/StreamInlet/FakeStreamInlet.js +6 -7
- package/build/testDoubles/StreamInlet/FakeStreamInlet.js.map +1 -1
- package/build/testDoubles/StreamInlet/SpyStreamInlet.d.ts +2 -5
- package/build/testDoubles/StreamInlet/SpyStreamInlet.js +2 -8
- package/build/testDoubles/StreamInlet/SpyStreamInlet.js.map +1 -1
- package/build/testDoubles/StreamOutlet/FakeStreamOutlet.d.ts +7 -9
- package/build/testDoubles/StreamOutlet/FakeStreamOutlet.js +5 -8
- package/build/testDoubles/StreamOutlet/FakeStreamOutlet.js.map +1 -1
- package/build/testDoubles/WebSocketBridge/FakeWebSocketBridge.d.ts +1 -1
- package/build/testDoubles/WebSocketBridge/FakeWebSocketBridge.js +1 -1
- package/build/testDoubles/WebSocketBridge/FakeWebSocketBridge.js.map +1 -1
- package/build/testDoubles/WorkerThreads/FakeWorker.d.ts +27 -0
- package/build/testDoubles/WorkerThreads/FakeWorker.js +67 -0
- package/build/testDoubles/WorkerThreads/FakeWorker.js.map +1 -0
- package/build/validations.js +0 -2
- package/build/validations.js.map +1 -1
- package/package.json +24 -8
- package/src/.spruce/settings.json +5 -1
- package/src/__tests__/AbstractPackageTest.ts +13 -15
- package/src/__tests__/impl/LslBackpressureMonitor.test.ts +25 -0
- package/src/__tests__/impl/LslEventMarkerEmitter.test.ts +322 -0
- package/src/__tests__/impl/LslStreamInfo.test.ts +3 -40
- package/src/__tests__/impl/LslStreamInlet.test.ts +366 -95
- package/src/__tests__/impl/LslStreamOutlet.test.ts +61 -69
- package/src/__tests__/impl/LslWebSocketBridge.test.ts +18 -18
- package/src/assertions.ts +2 -1
- package/src/impl/LslBackpressureMonitor.ts +13 -0
- package/src/impl/LslEventMarkerEmitter.ts +133 -0
- package/src/impl/LslStreamInfo.ts +17 -29
- package/src/impl/LslStreamInlet.ts +105 -208
- package/src/impl/LslStreamOutlet.ts +54 -78
- package/src/impl/LslWebSocketBridge.ts +12 -12
- package/src/impl/workers/inlet/LslStreamInlet.worker.ts +74 -0
- package/src/impl/workers/inlet/StreamInletWorker.ts +348 -0
- package/src/impl/workers/outlet/LslStreamOutlet.worker.ts +144 -0
- package/src/index.ts +14 -17
- package/src/scripts/finalizeHandles.ts +63 -0
- package/src/scripts/runLslEventMarkerEmitter.ts +15 -0
- package/src/scripts/runOutletToInlet.ts +10 -8
- package/src/scripts/testDestroyOutlet.ts +5 -0
- package/src/testDoubles/BackpressureMonitor/FakeBackpressureMonitor.ts +13 -0
- package/src/testDoubles/EventMarkerEmitter/FakeEventMarkerEmitter.ts +46 -0
- package/src/testDoubles/EventMarkerEmitter/SpyEventMarkerEmitter.ts +31 -0
- package/src/testDoubles/EventMarkerEmitter/ThrowingEventMarkerEmitter.ts +29 -0
- package/src/testDoubles/StreamInfo/FakeStreamInfo.ts +4 -4
- package/src/testDoubles/StreamInlet/FakeStreamInlet.ts +11 -17
- package/src/testDoubles/StreamInlet/SpyStreamInlet.ts +3 -16
- package/src/testDoubles/StreamOutlet/FakeStreamOutlet.ts +12 -15
- package/src/testDoubles/WebSocketBridge/FakeWebSocketBridge.ts +1 -1
- package/src/testDoubles/WorkerThreads/FakeWorker.ts +99 -0
- package/src/validations.ts +0 -2
- package/build/__tests__/impl/LiblslAdapter.test.d.ts +0 -79
- package/build/__tests__/impl/LiblslAdapter.test.js +0 -688
- package/build/__tests__/impl/LiblslAdapter.test.js.map +0 -1
- package/build/__tests__/impl/LslEventMarkerOutlet.test.d.ts +0 -21
- package/build/__tests__/impl/LslEventMarkerOutlet.test.js +0 -160
- package/build/__tests__/impl/LslEventMarkerOutlet.test.js.map +0 -1
- package/build/handleError.d.ts +0 -8
- package/build/handleError.js +0 -25
- package/build/handleError.js.map +0 -1
- package/build/impl/LiblslAdapter.d.ts +0 -159
- package/build/impl/LiblslAdapter.js +0 -317
- package/build/impl/LiblslAdapter.js.map +0 -1
- package/build/impl/LslEventMarkerOutlet.d.ts +0 -28
- package/build/impl/LslEventMarkerOutlet.js +0 -63
- package/build/impl/LslEventMarkerOutlet.js.map +0 -1
- package/build/scripts/runLslEventMarkerOutlet.js +0 -18
- package/build/scripts/runLslEventMarkerOutlet.js.map +0 -1
- package/build/testDoubles/EventMarkerOutlet/FakeEventMarkerOutlet.d.ts +0 -13
- package/build/testDoubles/EventMarkerOutlet/FakeEventMarkerOutlet.js +0 -26
- package/build/testDoubles/EventMarkerOutlet/FakeEventMarkerOutlet.js.map +0 -1
- package/build/testDoubles/EventMarkerOutlet/MockEventMarkerOutlet.d.ts +0 -17
- package/build/testDoubles/EventMarkerOutlet/MockEventMarkerOutlet.js +0 -46
- package/build/testDoubles/EventMarkerOutlet/MockEventMarkerOutlet.js.map +0 -1
- package/build/testDoubles/EventMarkerOutlet/SpyEventMarkerOutlet.d.ts +0 -9
- package/build/testDoubles/EventMarkerOutlet/SpyEventMarkerOutlet.js +0 -19
- package/build/testDoubles/EventMarkerOutlet/SpyEventMarkerOutlet.js.map +0 -1
- package/build/testDoubles/EventMarkerOutlet/ThrowingEventMarkerOutlet.d.ts +0 -9
- package/build/testDoubles/EventMarkerOutlet/ThrowingEventMarkerOutlet.js +0 -19
- package/build/testDoubles/EventMarkerOutlet/ThrowingEventMarkerOutlet.js.map +0 -1
- package/build/testDoubles/Liblsl/FakeLiblsl.d.ts +0 -50
- package/build/testDoubles/Liblsl/FakeLiblsl.js +0 -126
- package/build/testDoubles/Liblsl/FakeLiblsl.js.map +0 -1
- package/src/__tests__/impl/LiblslAdapter.test.ts +0 -817
- package/src/__tests__/impl/LslEventMarkerOutlet.test.ts +0 -195
- package/src/handleError.ts +0 -24
- package/src/impl/LiblslAdapter.ts +0 -548
- package/src/impl/LslEventMarkerOutlet.ts +0 -97
- package/src/scripts/runLslEventMarkerOutlet.ts +0 -23
- package/src/testDoubles/EventMarkerOutlet/FakeEventMarkerOutlet.ts +0 -36
- package/src/testDoubles/EventMarkerOutlet/MockEventMarkerOutlet.ts +0 -75
- package/src/testDoubles/EventMarkerOutlet/SpyEventMarkerOutlet.ts +0 -24
- package/src/testDoubles/EventMarkerOutlet/ThrowingEventMarkerOutlet.ts +0 -28
- package/src/testDoubles/Liblsl/FakeLiblsl.ts +0 -182
- /package/build/scripts/{runLslEventMarkerOutlet.d.ts → runLslEventMarkerEmitter.d.ts} +0 -0
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { assert } from '@neurodevs/node-tdd'
|
|
2
|
-
|
|
3
|
-
import { LslSample } from 'impl/LiblslAdapter.js'
|
|
4
|
-
import {
|
|
5
|
-
DurationMarker,
|
|
6
|
-
EventMarkerOutlet,
|
|
7
|
-
} from '../../impl/LslEventMarkerOutlet.js'
|
|
8
|
-
|
|
9
|
-
export default class MockEventMarkerOutlet implements EventMarkerOutlet {
|
|
10
|
-
private didPushMarkers = false
|
|
11
|
-
private pushedMarkers?: DurationMarker[]
|
|
12
|
-
private didPushSamples = false
|
|
13
|
-
private pushedSamples?: LslSample[]
|
|
14
|
-
|
|
15
|
-
public stop() {
|
|
16
|
-
throw new Error('Method not implemented.')
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
public destroy() {
|
|
20
|
-
throw new Error('Method not implemented.')
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
public pushMarker(_markerName: string) {
|
|
24
|
-
throw new Error('Method not implemented.')
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
public pushSample(sample: LslSample) {
|
|
28
|
-
if (!this.didPushSamples) {
|
|
29
|
-
this.didPushSamples = true
|
|
30
|
-
this.pushedSamples = []
|
|
31
|
-
}
|
|
32
|
-
this.pushedSamples?.push(sample)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
public async pushMarkers(markers: DurationMarker[]) {
|
|
36
|
-
this.didPushMarkers = true
|
|
37
|
-
this.pushedMarkers = markers
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
public assertDidPushSamples(samples?: LslSample[]) {
|
|
41
|
-
assert.isTrue(
|
|
42
|
-
this.didPushSamples,
|
|
43
|
-
`Expected to have pushed samples but didn't. Try 'outlet.pushSample(...)'`
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
if (samples) {
|
|
47
|
-
assert.isEqualDeep(this.pushedSamples, samples)
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
public assertDidNotPushSamples() {
|
|
52
|
-
assert.isFalse(
|
|
53
|
-
this.didPushSamples,
|
|
54
|
-
`Expected to NOT have pushed samples but did. Try 'outlet.pushSample(...)'`
|
|
55
|
-
)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
public assertDidPushMarkers(markers?: DurationMarker[]) {
|
|
59
|
-
assert.isTrue(
|
|
60
|
-
this.didPushMarkers,
|
|
61
|
-
`Expected to have pushed markers but didn't. Try 'outlet.pushMarkers(...)'`
|
|
62
|
-
)
|
|
63
|
-
|
|
64
|
-
if (markers) {
|
|
65
|
-
assert.isEqualDeep(this.pushedMarkers, markers)
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
public assertDidNotPushMarkers() {
|
|
70
|
-
assert.isFalse(
|
|
71
|
-
this.didPushMarkers,
|
|
72
|
-
`Expected to NOT have pushed markers but did. Try 'outlet.pushMarkers(...)'`
|
|
73
|
-
)
|
|
74
|
-
}
|
|
75
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import LslEventMarkerOutlet from '../../impl/LslEventMarkerOutlet.js'
|
|
2
|
-
import { StreamOutlet } from '../../impl/LslStreamOutlet.js'
|
|
3
|
-
|
|
4
|
-
export default class SpyEventMarkerOutlet extends LslEventMarkerOutlet {
|
|
5
|
-
public totalWaitTimeMs: number
|
|
6
|
-
|
|
7
|
-
public constructor(outlet: StreamOutlet) {
|
|
8
|
-
super(outlet)
|
|
9
|
-
this.totalWaitTimeMs = 0
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
public async wait(durationMs: number) {
|
|
13
|
-
this.totalWaitTimeMs += durationMs
|
|
14
|
-
return Promise.resolve()
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
public getStreamOutlet() {
|
|
18
|
-
return this.outlet
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public resetTestDouble() {
|
|
22
|
-
this.totalWaitTimeMs = 0
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DurationMarker,
|
|
3
|
-
EventMarkerOutlet,
|
|
4
|
-
} from '../../impl/LslEventMarkerOutlet.js'
|
|
5
|
-
|
|
6
|
-
export default class ThrowingEventMarkerOutlet implements EventMarkerOutlet {
|
|
7
|
-
private errorMsg = 'Intentional throwing: '
|
|
8
|
-
|
|
9
|
-
public constructor() {
|
|
10
|
-
throw new Error(this.errorMsg + 'constructor')
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
public async pushMarker(_markerName: string) {
|
|
14
|
-
throw new Error(this.errorMsg + 'pushMarker')
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
public async pushMarkers(_markers: DurationMarker[]) {
|
|
18
|
-
throw new Error(this.errorMsg + 'pushMarkers')
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public stop() {
|
|
22
|
-
throw new Error(this.errorMsg + 'stop')
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
public destroy() {
|
|
26
|
-
throw new Error(this.errorMsg + 'destroy')
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import generateId from '@neurodevs/generate-id'
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
BoundOutlet,
|
|
5
|
-
BoundStreamInfo,
|
|
6
|
-
CreateStreamInfoOptions,
|
|
7
|
-
AppendChannelsToStreamInfoOptions,
|
|
8
|
-
CreateOutletOptions,
|
|
9
|
-
PushSampleFloatTimestampOptions,
|
|
10
|
-
PushSampleStringTimestampOptions,
|
|
11
|
-
Liblsl,
|
|
12
|
-
CreateInletOptions,
|
|
13
|
-
DestroyInletOptions,
|
|
14
|
-
BoundInlet,
|
|
15
|
-
FlushInletOptions,
|
|
16
|
-
PullChunkOptions,
|
|
17
|
-
PullSampleOptions,
|
|
18
|
-
DestroyStreamInfoOptions,
|
|
19
|
-
ResolveByPropOptions,
|
|
20
|
-
DestroyOutletOptions,
|
|
21
|
-
} from 'impl/LiblslAdapter.js'
|
|
22
|
-
|
|
23
|
-
export default class FakeLiblsl implements Liblsl {
|
|
24
|
-
public static fakeStreamInfoHandles: BoundStreamInfo[] = []
|
|
25
|
-
|
|
26
|
-
public static fakeSamples: Float32Array[] = [
|
|
27
|
-
new Float32Array([1, 2, 3]),
|
|
28
|
-
new Float32Array([4, 5, 6]),
|
|
29
|
-
]
|
|
30
|
-
|
|
31
|
-
public static fakeChunks: Float32Array[] = [
|
|
32
|
-
new Float32Array([1, 2, 3, 4, 5, 6]),
|
|
33
|
-
new Float32Array([1, 2, 3, 4, 5, 6]),
|
|
34
|
-
]
|
|
35
|
-
|
|
36
|
-
public static fakeTimestamps: Float64Array[] = [
|
|
37
|
-
new Float64Array([7, 8]),
|
|
38
|
-
new Float64Array([7, 8]),
|
|
39
|
-
]
|
|
40
|
-
|
|
41
|
-
public static fakeErrorCode = 0
|
|
42
|
-
|
|
43
|
-
public liblslPath: string = generateId()
|
|
44
|
-
|
|
45
|
-
public fakeSamples = FakeLiblsl.fakeSamples.slice()
|
|
46
|
-
public fakeChunks = FakeLiblsl.fakeChunks.slice()
|
|
47
|
-
public fakeTimestamps = FakeLiblsl.fakeTimestamps.slice()
|
|
48
|
-
|
|
49
|
-
public outlet: BoundOutlet = {} as BoundOutlet
|
|
50
|
-
public streamInfo: BoundStreamInfo = {} as BoundStreamInfo
|
|
51
|
-
|
|
52
|
-
public lastCreateStreamInfoOptions?: CreateStreamInfoOptions
|
|
53
|
-
public lastAppendChannelsToStreamInfoOptions?: AppendChannelsToStreamInfoOptions
|
|
54
|
-
public lastDestroyStreamInfoOptions?: DestroyStreamInfoOptions
|
|
55
|
-
public lastResolveByPropOptions?: ResolveByPropOptions
|
|
56
|
-
public lastCreateOutletOptions?: CreateOutletOptions
|
|
57
|
-
public lastPushSampleFloatTimestampOptions?: PushSampleFloatTimestampOptions
|
|
58
|
-
public lastPushSampleStringTimestampOptions?: PushSampleStringTimestampOptions
|
|
59
|
-
public lastCreateInletOptions?: CreateInletOptions
|
|
60
|
-
public lastDestroyOutletOptions?: DestroyOutletOptions
|
|
61
|
-
public lastPullSampleOptions?: PullSampleOptions
|
|
62
|
-
public lastPullChunkOptions?: PullChunkOptions
|
|
63
|
-
public lastFlushInletOptions?: FlushInletOptions
|
|
64
|
-
public lastDestroyInletOptions?: DestroyInletOptions
|
|
65
|
-
|
|
66
|
-
public createStreamInfoHitCount = 0
|
|
67
|
-
public createOutletHitCount = 0
|
|
68
|
-
public destroyOutletHitCount = 0
|
|
69
|
-
public createInletHitCount = 0
|
|
70
|
-
public flushInletHitCount = 0
|
|
71
|
-
public destroyInletHitCount = 0
|
|
72
|
-
public localClockHitCount = 0
|
|
73
|
-
public pushSampleStringTimestampHitCount = 0
|
|
74
|
-
|
|
75
|
-
public createStreamInfo(options: CreateStreamInfoOptions) {
|
|
76
|
-
this.createStreamInfoHitCount++
|
|
77
|
-
this.lastCreateStreamInfoOptions = options
|
|
78
|
-
return this.streamInfo
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
public appendChannelsToStreamInfo(
|
|
82
|
-
options: AppendChannelsToStreamInfoOptions
|
|
83
|
-
) {
|
|
84
|
-
this.lastAppendChannelsToStreamInfoOptions = options
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
public destroyStreamInfo(options: DestroyStreamInfoOptions) {
|
|
88
|
-
this.lastDestroyStreamInfoOptions = options
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
public async resolveByProp(options: ResolveByPropOptions) {
|
|
92
|
-
this.lastResolveByPropOptions = options
|
|
93
|
-
return FakeLiblsl.fakeStreamInfoHandles as bigint[]
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
public pushSampleFloatTimestamp(options: PushSampleFloatTimestampOptions) {
|
|
97
|
-
this.lastPushSampleFloatTimestampOptions = options
|
|
98
|
-
return FakeLiblsl.fakeErrorCode
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
public pushSampleStringTimestamp(
|
|
102
|
-
options: PushSampleStringTimestampOptions
|
|
103
|
-
) {
|
|
104
|
-
this.lastPushSampleStringTimestampOptions = options
|
|
105
|
-
this.pushSampleStringTimestampHitCount++
|
|
106
|
-
return FakeLiblsl.fakeErrorCode
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
public createOutlet(options: CreateOutletOptions) {
|
|
110
|
-
this.createOutletHitCount++
|
|
111
|
-
this.lastCreateOutletOptions = options
|
|
112
|
-
return this.outlet
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
public destroyOutlet(options: DestroyOutletOptions) {
|
|
116
|
-
this.destroyOutletHitCount++
|
|
117
|
-
this.lastDestroyOutletOptions = options
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
public createInlet(options: CreateInletOptions) {
|
|
121
|
-
this.createInletHitCount++
|
|
122
|
-
this.lastCreateInletOptions = options
|
|
123
|
-
return {} as BoundInlet
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
public pullSample(options: PullSampleOptions) {
|
|
127
|
-
this.lastPullSampleOptions = options
|
|
128
|
-
|
|
129
|
-
const sample = this.fakeSamples.shift()
|
|
130
|
-
|
|
131
|
-
if (sample) {
|
|
132
|
-
return 1
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
return 0
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
public pullChunk(options: PullChunkOptions) {
|
|
139
|
-
this.lastPullChunkOptions = options
|
|
140
|
-
|
|
141
|
-
const chunk = this.fakeChunks.shift()
|
|
142
|
-
const timestamps = this.fakeTimestamps.shift()
|
|
143
|
-
|
|
144
|
-
if (chunk && timestamps) {
|
|
145
|
-
return 1
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return 0
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
public flushInlet(options: FlushInletOptions) {
|
|
152
|
-
this.flushInletHitCount++
|
|
153
|
-
this.lastFlushInletOptions = options
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
public destroyInlet(options: DestroyInletOptions) {
|
|
157
|
-
this.destroyInletHitCount++
|
|
158
|
-
this.lastDestroyInletOptions = options
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
public localClock() {
|
|
162
|
-
this.localClockHitCount++
|
|
163
|
-
return new Date().getTime()
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
public resetTestDouble() {
|
|
167
|
-
this.lastCreateStreamInfoOptions = undefined
|
|
168
|
-
this.lastAppendChannelsToStreamInfoOptions = undefined
|
|
169
|
-
this.lastCreateOutletOptions = undefined
|
|
170
|
-
this.lastPushSampleFloatTimestampOptions = undefined
|
|
171
|
-
this.lastPushSampleStringTimestampOptions = undefined
|
|
172
|
-
|
|
173
|
-
this.createStreamInfoHitCount = 0
|
|
174
|
-
this.destroyOutletHitCount = 0
|
|
175
|
-
this.localClockHitCount = 0
|
|
176
|
-
this.pushSampleStringTimestampHitCount = 0
|
|
177
|
-
|
|
178
|
-
this.fakeSamples = FakeLiblsl.fakeSamples.slice()
|
|
179
|
-
this.fakeChunks = FakeLiblsl.fakeChunks.slice()
|
|
180
|
-
this.fakeTimestamps = FakeLiblsl.fakeTimestamps.slice()
|
|
181
|
-
}
|
|
182
|
-
}
|
|
File without changes
|