@neurodevs/node-lsl 17.0.0 → 17.1.1
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 +2 -0
- package/build/__tests__/AbstractPackageTest.js +2 -6
- package/build/__tests__/AbstractPackageTest.js.map +1 -1
- package/build/__tests__/impl/LslStreamInfo.test.d.ts +3 -3
- package/build/__tests__/impl/LslStreamInfo.test.js +12 -12
- package/build/__tests__/impl/LslStreamInfo.test.js.map +1 -1
- package/build/__tests__/impl/LslStreamInlet.test.d.ts +2 -3
- package/build/__tests__/impl/LslStreamInlet.test.js +20 -27
- package/build/__tests__/impl/LslStreamInlet.test.js.map +1 -1
- package/build/__tests__/impl/LslWebSocketBridge.test.js +6 -3
- package/build/__tests__/impl/LslWebSocketBridge.test.js.map +1 -1
- package/build/impl/LiblslAdapter.d.ts +1 -6
- package/build/impl/LiblslAdapter.js +3 -3
- package/build/impl/LiblslAdapter.js.map +1 -1
- package/build/impl/LslStreamInfo.d.ts +3 -9
- package/build/impl/LslStreamInfo.js +6 -16
- package/build/impl/LslStreamInfo.js.map +1 -1
- package/build/impl/LslStreamInlet.d.ts +7 -5
- package/build/impl/LslStreamInlet.js +20 -24
- package/build/impl/LslStreamInlet.js.map +1 -1
- package/build/impl/LslStreamOutlet.d.ts +3 -3
- package/build/impl/LslStreamOutlet.js +5 -8
- package/build/impl/LslStreamOutlet.js.map +1 -1
- package/build/impl/LslWebSocketBridge.d.ts +2 -1
- package/build/impl/LslWebSocketBridge.js +1 -1
- package/build/impl/LslWebSocketBridge.js.map +1 -1
- package/build/scripts/runLslStreamOutlet.js +15 -10
- package/build/scripts/runLslStreamOutlet.js.map +1 -1
- package/build/scripts/runOutletToInlet.js +1 -6
- package/build/scripts/runOutletToInlet.js.map +1 -1
- package/build/testDoubles/Liblsl/FakeLiblsl.d.ts +1 -1
- package/build/testDoubles/Liblsl/FakeLiblsl.js +1 -1
- package/build/testDoubles/Liblsl/FakeLiblsl.js.map +1 -1
- package/build/testDoubles/StreamInfo/FakeStreamInfo.d.ts +4 -4
- package/build/testDoubles/StreamInfo/FakeStreamInfo.js +3 -3
- package/build/testDoubles/StreamInfo/FakeStreamInfo.js.map +1 -1
- package/build/testDoubles/StreamInfo/SpyStreamInfo.d.ts +0 -1
- package/build/testDoubles/StreamInfo/SpyStreamInfo.js +0 -3
- package/build/testDoubles/StreamInfo/SpyStreamInfo.js.map +1 -1
- package/build/testDoubles/StreamInlet/FakeStreamInlet.d.ts +3 -3
- package/build/testDoubles/StreamInlet/FakeStreamInlet.js.map +1 -1
- package/build/testDoubles/StreamInlet/SpyStreamInlet.d.ts +2 -2
- package/build/testDoubles/StreamInlet/SpyStreamInlet.js.map +1 -1
- package/build/testDoubles/StreamOutlet/FakeStreamOutlet.d.ts +1 -0
- package/build/testDoubles/StreamOutlet/FakeStreamOutlet.js +3 -0
- package/build/testDoubles/StreamOutlet/FakeStreamOutlet.js.map +1 -1
- package/package.json +12 -12
- package/src/__tests__/AbstractPackageTest.ts +4 -8
- package/src/__tests__/impl/LslStreamInfo.test.ts +10 -10
- package/src/__tests__/impl/LslStreamInlet.test.ts +26 -36
- package/src/__tests__/impl/LslWebSocketBridge.test.ts +7 -5
- package/src/impl/LiblslAdapter.ts +4 -9
- package/src/impl/LslStreamInfo.ts +13 -27
- package/src/impl/LslStreamInlet.ts +35 -39
- package/src/impl/LslStreamOutlet.ts +6 -9
- package/src/impl/LslWebSocketBridge.ts +4 -4
- package/src/scripts/runLslStreamOutlet.ts +16 -10
- package/src/scripts/runOutletToInlet.ts +1 -6
- package/src/testDoubles/Liblsl/FakeLiblsl.ts +1 -1
- package/src/testDoubles/StreamInfo/FakeStreamInfo.ts +5 -5
- package/src/testDoubles/StreamInfo/SpyStreamInfo.ts +0 -4
- package/src/testDoubles/StreamInlet/FakeStreamInlet.ts +6 -3
- package/src/testDoubles/StreamInlet/SpyStreamInlet.ts +2 -2
- package/src/testDoubles/StreamOutlet/FakeStreamOutlet.ts +4 -0
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
import LslStreamOutlet from '../impl/LslStreamOutlet.js'
|
|
2
2
|
|
|
3
3
|
async function main() {
|
|
4
|
-
const
|
|
5
|
-
name: '
|
|
6
|
-
type: '
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
const outlet = await LslStreamOutlet.Create({
|
|
5
|
+
name: '10 Hz Pulse',
|
|
6
|
+
type: 'HZ',
|
|
7
|
+
sourceId: '10-hz-pulse',
|
|
8
|
+
channelNames: ['Ch1', 'Ch2', 'Ch3'],
|
|
9
9
|
channelFormat: 'float32',
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
units: 'microvolt',
|
|
13
|
-
chunkSize: 12,
|
|
10
|
+
sampleRateHz: 10,
|
|
11
|
+
chunkSize: 1,
|
|
14
12
|
})
|
|
15
13
|
|
|
16
|
-
|
|
14
|
+
for (let i = 0; i < 100; i++) {
|
|
15
|
+
await new Promise((resolve) => setTimeout(resolve, 100))
|
|
16
|
+
|
|
17
|
+
outlet.pushSample([
|
|
18
|
+
Math.random() * 100,
|
|
19
|
+
Math.random() * 100,
|
|
20
|
+
Math.random() * 100,
|
|
21
|
+
])
|
|
22
|
+
}
|
|
17
23
|
}
|
|
18
24
|
|
|
19
25
|
main().catch((error) => {
|
|
@@ -17,12 +17,7 @@ const outlet = await LslStreamOutlet.Create({
|
|
|
17
17
|
console.log('Creating inlet...')
|
|
18
18
|
|
|
19
19
|
const inletOptions = {
|
|
20
|
-
|
|
21
|
-
type: 'TEST',
|
|
22
|
-
sourceId: 'TestOutletID',
|
|
23
|
-
sampleRateHz: 100,
|
|
24
|
-
channelNames: ['Ch1', 'Ch2', 'Ch3'],
|
|
25
|
-
channelFormat: 'float32' as const,
|
|
20
|
+
info: outlet.info,
|
|
26
21
|
chunkSize: 1,
|
|
27
22
|
}
|
|
28
23
|
|
|
@@ -56,8 +56,8 @@ export default class FakeLiblsl implements Liblsl {
|
|
|
56
56
|
public lastCreateOutletOptions?: CreateOutletOptions
|
|
57
57
|
public lastPushSampleFloatTimestampOptions?: PushSampleFloatTimestampOptions
|
|
58
58
|
public lastPushSampleStringTimestampOptions?: PushSampleStringTimestampOptions
|
|
59
|
-
public lastCreateInletOptions?: CreateInletOptions
|
|
60
59
|
public lastDestroyOutletOptions?: DestroyOutletOptions
|
|
60
|
+
public lastCreateInletOptions?: CreateInletOptions
|
|
61
61
|
public lastPullSampleOptions?: PullSampleOptions
|
|
62
62
|
public lastPullChunkOptions?: PullChunkOptions
|
|
63
63
|
public lastFlushInletOptions?: FlushInletOptions
|
|
@@ -4,10 +4,10 @@ import { BoundStreamInfo } from 'impl/LiblslAdapter.js'
|
|
|
4
4
|
import { StreamInfo, StreamInfoOptions } from '../../impl/LslStreamInfo.js'
|
|
5
5
|
|
|
6
6
|
export default class FakeStreamInfo implements StreamInfo {
|
|
7
|
-
public static callsToConstructor: StreamInfoOptions[] = []
|
|
7
|
+
public static callsToConstructor: (StreamInfoOptions | undefined)[] = []
|
|
8
8
|
public static numCallsToDestroy = 0
|
|
9
9
|
|
|
10
|
-
public static
|
|
10
|
+
public static boundInfo = {} as BoundStreamInfo
|
|
11
11
|
|
|
12
12
|
public name = generateId()
|
|
13
13
|
public type = generateId()
|
|
@@ -17,7 +17,7 @@ export default class FakeStreamInfo implements StreamInfo {
|
|
|
17
17
|
public sampleRateHz = 0
|
|
18
18
|
public units = 'N/A'
|
|
19
19
|
|
|
20
|
-
public constructor(options
|
|
20
|
+
public constructor(options?: StreamInfoOptions) {
|
|
21
21
|
FakeStreamInfo.callsToConstructor.push(options)
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -29,8 +29,8 @@ export default class FakeStreamInfo implements StreamInfo {
|
|
|
29
29
|
return this.channelNames.length
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
public get
|
|
33
|
-
return FakeStreamInfo.
|
|
32
|
+
public get boundInfo() {
|
|
33
|
+
return FakeStreamInfo.boundInfo
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
public static resetTestDouble() {
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { StreamInfo } from '../../impl/LslStreamInfo.js'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
StreamInlet,
|
|
4
|
+
StreamInletConstructorOptions,
|
|
5
|
+
} from '../../impl/LslStreamInlet.js'
|
|
3
6
|
|
|
4
7
|
export default class FakeStreamInlet implements StreamInlet {
|
|
5
8
|
public static callsToConstructor: {
|
|
6
9
|
info?: StreamInfo
|
|
7
|
-
options?:
|
|
10
|
+
options?: StreamInletConstructorOptions
|
|
8
11
|
onData?: (samples: Float32Array, timestamps: Float64Array) => void
|
|
9
12
|
}[] = []
|
|
10
13
|
|
|
@@ -19,7 +22,7 @@ export default class FakeStreamInlet implements StreamInlet {
|
|
|
19
22
|
|
|
20
23
|
public constructor(
|
|
21
24
|
info?: StreamInfo,
|
|
22
|
-
options?:
|
|
25
|
+
options?: StreamInletConstructorOptions,
|
|
23
26
|
onData?: (samples: Float32Array, timestamps: Float64Array) => void
|
|
24
27
|
) {
|
|
25
28
|
this.onData = onData ?? (() => {})
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { StreamInfo } from '../../impl/LslStreamInfo.js'
|
|
2
2
|
import LslStreamInlet, {
|
|
3
3
|
OnDataCallback,
|
|
4
|
-
|
|
4
|
+
StreamInletConstructorOptions,
|
|
5
5
|
} from '../../impl/LslStreamInlet.js'
|
|
6
6
|
|
|
7
7
|
export class SpyStreamInlet extends LslStreamInlet {
|
|
8
8
|
public constructor(
|
|
9
9
|
info: StreamInfo,
|
|
10
|
-
options:
|
|
10
|
+
options: StreamInletConstructorOptions,
|
|
11
11
|
onData: OnDataCallback
|
|
12
12
|
) {
|
|
13
13
|
super(info, options, onData)
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
StreamOutlet,
|
|
8
8
|
StreamOutletOptions,
|
|
9
9
|
} from '../../impl/LslStreamOutlet.js'
|
|
10
|
+
import FakeStreamInfo from '../StreamInfo/FakeStreamInfo.js'
|
|
10
11
|
|
|
11
12
|
export default class FakeStreamOutlet implements StreamOutlet {
|
|
12
13
|
public static callsToConstructor: {
|
|
@@ -17,10 +18,13 @@ export default class FakeStreamOutlet implements StreamOutlet {
|
|
|
17
18
|
public static callsToPushSample: LslSample[] = []
|
|
18
19
|
public static numCallsToDestroy = 0
|
|
19
20
|
|
|
21
|
+
public info: StreamInfo
|
|
20
22
|
public options?: StreamOutletOptions
|
|
21
23
|
|
|
22
24
|
public constructor(info?: StreamInfo, options?: StreamOutletOptions) {
|
|
23
25
|
FakeStreamOutlet.callsToConstructor.push({ info, options })
|
|
26
|
+
|
|
27
|
+
this.info = info ?? new FakeStreamInfo()
|
|
24
28
|
this.options = options
|
|
25
29
|
}
|
|
26
30
|
|