@neurodevs/node-lsl 3.3.0 → 4.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/Liblsl.d.ts +15 -4
- package/build/Liblsl.js +21 -4
- package/build/Liblsl.js.map +1 -1
- package/build/LslOutlet.d.ts +1 -1
- package/build/LslOutlet.js +24 -7
- package/build/LslOutlet.js.map +1 -1
- package/build/__tests__/behavioral/LslOutlet.test.d.ts +6 -2
- package/build/__tests__/behavioral/LslOutlet.test.js +63 -15
- package/build/__tests__/behavioral/LslOutlet.test.js.map +1 -1
- package/build/__tests__/behavioral/TimeMarkerOutlet.test.js +3 -3
- package/build/__tests__/behavioral/TimeMarkerOutlet.test.js.map +1 -1
- package/build/__tests__/implementation/Liblsl.test.d.ts +8 -4
- package/build/__tests__/implementation/Liblsl.test.js +93 -60
- package/build/__tests__/implementation/Liblsl.test.js.map +1 -1
- package/build/__tests__/support/SpyLiblsl.d.ts +9 -5
- package/build/__tests__/support/SpyLiblsl.js +10 -2
- package/build/__tests__/support/SpyLiblsl.js.map +1 -1
- package/package.json +5 -2
- package/src/Liblsl.ts +44 -11
- package/src/LslOutlet.ts +44 -21
- package/src/__tests__/behavioral/LslOutlet.test.ts +70 -13
- package/src/__tests__/behavioral/TimeMarkerOutlet.test.ts +4 -4
- package/src/__tests__/implementation/Liblsl.test.ts +88 -71
- package/src/__tests__/support/SpyLiblsl.ts +22 -9
|
@@ -90,21 +90,55 @@ export default class LslOutletTest extends AbstractSpruceTest {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
@test('pushing [1, 2] sample sends to LSL', [1, 2])
|
|
94
|
-
@test('pushing [1] sample sends to LSL', [1])
|
|
95
|
-
protected static async
|
|
96
|
-
this.
|
|
93
|
+
@test('pushing [1, 2] sample sends to LSL', [1.0, 2.0])
|
|
94
|
+
@test('pushing [1] sample sends to LSL', [1.0])
|
|
95
|
+
protected static async canPushFloatSampleToLsl(sample: LslSample) {
|
|
96
|
+
const outlet = this.FloatOutlet()
|
|
97
|
+
outlet.pushSample(sample)
|
|
97
98
|
|
|
98
99
|
assert.isEqual(
|
|
99
|
-
this.spyLiblsl.
|
|
100
|
+
this.spyLiblsl.lastPushSampleFtOptions?.outlet,
|
|
100
101
|
this.spyLiblsl.outlet
|
|
101
102
|
)
|
|
102
|
-
assert.isEqualDeep(this.spyLiblsl.
|
|
103
|
+
assert.isEqualDeep(this.spyLiblsl.lastPushSampleFtOptions?.sample, sample)
|
|
103
104
|
assert.isEqualDeep(this.spyLiblsl.lastCreateOutletOptions, {
|
|
104
105
|
info: this.spyLiblsl.streamInfo,
|
|
105
106
|
chunkSize: this.randomOutletOptions.chunkSize,
|
|
106
107
|
maxBuffered: this.randomOutletOptions.maxBuffered,
|
|
107
108
|
})
|
|
109
|
+
assert.isNumber(this.spyLiblsl.lastPushSampleFtOptions?.timestamp)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
@test()
|
|
113
|
+
protected static async canPushStringSampleToLsl() {
|
|
114
|
+
const sample = [generateId()]
|
|
115
|
+
const outlet = this.StringOutlet()
|
|
116
|
+
|
|
117
|
+
outlet.pushSample(sample)
|
|
118
|
+
|
|
119
|
+
assert.isEqual(
|
|
120
|
+
this.spyLiblsl.lastPushSampleStrtOptions?.outlet,
|
|
121
|
+
this.spyLiblsl.outlet
|
|
122
|
+
)
|
|
123
|
+
assert.isEqualDeep(this.spyLiblsl.lastPushSampleStrtOptions?.sample, sample)
|
|
124
|
+
assert.isNumber(this.spyLiblsl.lastPushSampleStrtOptions?.timestamp)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
@test()
|
|
128
|
+
protected static async pushingStringTwiceGivesDifferentTimestamps() {
|
|
129
|
+
const outlet = this.StringOutlet()
|
|
130
|
+
const sample = [generateId()]
|
|
131
|
+
|
|
132
|
+
outlet.pushSample(sample)
|
|
133
|
+
const t1 = this.spyLiblsl.lastPushSampleStrtOptions?.timestamp
|
|
134
|
+
|
|
135
|
+
await this.wait(10)
|
|
136
|
+
|
|
137
|
+
outlet.pushSample(sample)
|
|
138
|
+
const t2 = this.spyLiblsl.lastPushSampleStrtOptions?.timestamp
|
|
139
|
+
|
|
140
|
+
assert.isNotEqual(t1, t2)
|
|
141
|
+
assert.isEqual(this.spyLiblsl.localClockHitCount, 2)
|
|
108
142
|
}
|
|
109
143
|
|
|
110
144
|
@test()
|
|
@@ -163,17 +197,32 @@ export default class LslOutletTest extends AbstractSpruceTest {
|
|
|
163
197
|
|
|
164
198
|
@test()
|
|
165
199
|
protected static async pushSampleShouldNotCreateMultipleOutlets() {
|
|
166
|
-
const outlet = this.
|
|
167
|
-
outlet.pushSample([1])
|
|
168
|
-
outlet.pushSample([2])
|
|
169
|
-
outlet.pushSample([3])
|
|
200
|
+
const outlet = this.FloatOutlet()
|
|
201
|
+
outlet.pushSample([1.0])
|
|
202
|
+
outlet.pushSample([2.0])
|
|
203
|
+
outlet.pushSample([3.0])
|
|
170
204
|
|
|
171
205
|
assert.isEqual(this.spyLiblsl.createStreamInfoHitCount, 1)
|
|
172
206
|
}
|
|
173
207
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
208
|
+
@test()
|
|
209
|
+
protected static async pushSampleThrowsWithUnsupportedType() {
|
|
210
|
+
const unsupportedTypes = [
|
|
211
|
+
'undefined',
|
|
212
|
+
'double64',
|
|
213
|
+
'int32',
|
|
214
|
+
'int16',
|
|
215
|
+
'int8',
|
|
216
|
+
'int64',
|
|
217
|
+
] as const
|
|
218
|
+
|
|
219
|
+
for (let unsupportedType of unsupportedTypes) {
|
|
220
|
+
const outlet = this.Outlet({ channelFormat: unsupportedType })
|
|
221
|
+
assert.doesThrow(
|
|
222
|
+
() => outlet.pushSample([]),
|
|
223
|
+
`This method currently does not support the ${unsupportedType} type! Please implement it.`
|
|
224
|
+
)
|
|
225
|
+
}
|
|
177
226
|
}
|
|
178
227
|
|
|
179
228
|
private static assertThrowsInvalidMaxBuffered(maxBuffered: number) {
|
|
@@ -211,6 +260,14 @@ export default class LslOutletTest extends AbstractSpruceTest {
|
|
|
211
260
|
...options,
|
|
212
261
|
})
|
|
213
262
|
}
|
|
263
|
+
|
|
264
|
+
private static StringOutlet() {
|
|
265
|
+
return this.Outlet({ channelFormat: 'string' })
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
private static FloatOutlet() {
|
|
269
|
+
return this.Outlet({ channelFormat: 'float32' })
|
|
270
|
+
}
|
|
214
271
|
}
|
|
215
272
|
|
|
216
273
|
class CheckingOutlet extends LslOutlet {
|
|
@@ -19,7 +19,7 @@ export default class TimeMarkerOutletTest extends AbstractSpruceTest {
|
|
|
19
19
|
@test()
|
|
20
20
|
protected static async loadsWithTimeMarkerSpecificOptions() {
|
|
21
21
|
const outlet = this.Outlet()
|
|
22
|
-
assert.isEqualDeep(outlet.
|
|
22
|
+
assert.isEqualDeep(outlet.spyOptions, {
|
|
23
23
|
name: 'Time markers',
|
|
24
24
|
type: 'Markers',
|
|
25
25
|
channelNames: ['Markers'],
|
|
@@ -37,7 +37,7 @@ export default class TimeMarkerOutletTest extends AbstractSpruceTest {
|
|
|
37
37
|
protected static async canOverrideDefaultOptions() {
|
|
38
38
|
const options = generateRandomOutletOptions(randomInt(8))
|
|
39
39
|
const outlet = this.Outlet(options)
|
|
40
|
-
assert.isEqualDeep(outlet.
|
|
40
|
+
assert.isEqualDeep(outlet.spyOptions, options)
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
private static Outlet(options?: Partial<LslOutletOptions>) {
|
|
@@ -46,9 +46,9 @@ export default class TimeMarkerOutletTest extends AbstractSpruceTest {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
class SpyTimeMarkerOutlet extends TimeMarkerOutlet {
|
|
49
|
-
public
|
|
49
|
+
public spyOptions: LslOutletOptions
|
|
50
50
|
public constructor(options: LslOutletOptions) {
|
|
51
51
|
super(options)
|
|
52
|
-
this.
|
|
52
|
+
this.spyOptions = options
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -10,17 +10,13 @@ import ref from 'ref-napi'
|
|
|
10
10
|
import LiblslImpl, {
|
|
11
11
|
Liblsl,
|
|
12
12
|
LiblslBindings,
|
|
13
|
-
CreateStreamInfoOptions,
|
|
14
|
-
AppendChannelsToStreamInfoOptions,
|
|
15
|
-
CreateOutletOptions,
|
|
16
|
-
DestroyOutletOptions,
|
|
17
|
-
PushSampleOptions,
|
|
18
13
|
LslChannel,
|
|
19
14
|
BoundOutlet,
|
|
20
15
|
BoundStreamInfo,
|
|
21
16
|
BoundDesc,
|
|
22
17
|
BoundChild,
|
|
23
18
|
} from '../../Liblsl'
|
|
19
|
+
import { SpyLiblsl } from '../support/SpyLiblsl'
|
|
24
20
|
|
|
25
21
|
export default class LiblslTest extends AbstractSpruceTest {
|
|
26
22
|
private static lsl: Liblsl
|
|
@@ -35,9 +31,9 @@ export default class LiblslTest extends AbstractSpruceTest {
|
|
|
35
31
|
private static appendChildParams: any[] = []
|
|
36
32
|
private static createOutletParams?: any[]
|
|
37
33
|
private static destroyOutletParams?: any[]
|
|
38
|
-
private static
|
|
34
|
+
private static pushSampleFtParams?: any[]
|
|
35
|
+
private static pushSampleStrtParams?: any[]
|
|
39
36
|
private static appendChildValueParams: any[]
|
|
40
|
-
private static localClock: number
|
|
41
37
|
private static shouldThrowWhenCreatingBindings: boolean
|
|
42
38
|
private static getDescriptionParams?: [BoundStreamInfo]
|
|
43
39
|
private static fakeChildNamedChannel: BoundChild
|
|
@@ -51,7 +47,7 @@ export default class LiblslTest extends AbstractSpruceTest {
|
|
|
51
47
|
delete this.createStreamInfoParams
|
|
52
48
|
delete this.createOutletParams
|
|
53
49
|
delete this.destroyOutletParams
|
|
54
|
-
delete this.
|
|
50
|
+
delete this.pushSampleFtParams
|
|
55
51
|
delete this.getDescriptionParams
|
|
56
52
|
this.appendChildParams = []
|
|
57
53
|
this.appendChildValueParams = []
|
|
@@ -63,54 +59,19 @@ export default class LiblslTest extends AbstractSpruceTest {
|
|
|
63
59
|
this.fakeOutlet = {}
|
|
64
60
|
this.fakeChildNamedChannels = {}
|
|
65
61
|
this.fakeChildNamedChannel = {}
|
|
62
|
+
this.fakeBindings = this.FakeBindings()
|
|
66
63
|
|
|
67
|
-
this.localClock = new Date().getTime()
|
|
68
64
|
this.shouldThrowWhenCreatingBindings = false
|
|
69
65
|
|
|
70
66
|
this.appendChildHitCount = 0
|
|
71
67
|
|
|
72
|
-
this.fakeBindings = {
|
|
73
|
-
lsl_create_streaminfo: (...params: any[]) => {
|
|
74
|
-
this.createStreamInfoParams = params
|
|
75
|
-
return this.fakeStreamInfo
|
|
76
|
-
},
|
|
77
|
-
lsl_create_outlet: (...params: any[]) => {
|
|
78
|
-
this.createOutletParams = params
|
|
79
|
-
return this.fakeOutlet
|
|
80
|
-
},
|
|
81
|
-
lsl_destroy_outlet: (...params: any[]) => {
|
|
82
|
-
this.destroyOutletParams = params
|
|
83
|
-
return
|
|
84
|
-
},
|
|
85
|
-
lsl_push_sample_ft: (...params: any[]) => {
|
|
86
|
-
this.pushSampleParams = params
|
|
87
|
-
return 0
|
|
88
|
-
},
|
|
89
|
-
lsl_local_clock: () => this.localClock,
|
|
90
|
-
lsl_get_desc: (info: BoundStreamInfo) => {
|
|
91
|
-
this.getDescriptionParams = [info]
|
|
92
|
-
return this.fakeDesc
|
|
93
|
-
},
|
|
94
|
-
lsl_append_child: (...params: any) => {
|
|
95
|
-
this.appendChildParams.push(params)
|
|
96
|
-
if (this.appendChildHitCount === 0) {
|
|
97
|
-
this.appendChildHitCount++
|
|
98
|
-
return this.fakeChildNamedChannels
|
|
99
|
-
}
|
|
100
|
-
return this.fakeChildNamedChannel
|
|
101
|
-
},
|
|
102
|
-
lsl_append_child_value: (...params: any[]) => {
|
|
103
|
-
this.appendChildValueParams.push(params)
|
|
104
|
-
},
|
|
105
|
-
}
|
|
106
|
-
|
|
107
68
|
LiblslImpl.ffi = {
|
|
108
69
|
//@ts-ignore
|
|
109
70
|
Library: (path: string, options: Record<string, any>) => {
|
|
110
71
|
this.libraryPath = path
|
|
111
72
|
this.libraryOptions = options
|
|
112
73
|
if (this.shouldThrowWhenCreatingBindings) {
|
|
113
|
-
throw new Error('Failed to create bindings')
|
|
74
|
+
throw new Error('Failed to create bindings!')
|
|
114
75
|
}
|
|
115
76
|
return this.fakeBindings
|
|
116
77
|
},
|
|
@@ -173,11 +134,20 @@ export default class LiblslTest extends AbstractSpruceTest {
|
|
|
173
134
|
}
|
|
174
135
|
|
|
175
136
|
@test()
|
|
176
|
-
protected static async
|
|
137
|
+
protected static async throwsWhenPushSampleFtIsMissingRequiredParams() {
|
|
177
138
|
//@ts-ignore
|
|
178
|
-
const err = assert.doesThrow(() => this.lsl.
|
|
139
|
+
const err = assert.doesThrow(() => this.lsl.pushSampleFt())
|
|
179
140
|
errorAssert.assertError(err, 'MISSING_PARAMETERS', {
|
|
180
|
-
parameters: ['outlet', 'sample'],
|
|
141
|
+
parameters: ['outlet', 'sample', 'timestamp'],
|
|
142
|
+
})
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@test()
|
|
146
|
+
protected static async throwsWhenPushSampleStrtIsMissingRequiredParams() {
|
|
147
|
+
//@ts-ignore
|
|
148
|
+
const err = assert.doesThrow(() => this.lsl.pushSampleFt())
|
|
149
|
+
errorAssert.assertError(err, 'MISSING_PARAMETERS', {
|
|
150
|
+
parameters: ['outlet', 'sample', 'timestamp'],
|
|
181
151
|
})
|
|
182
152
|
}
|
|
183
153
|
|
|
@@ -194,7 +164,7 @@ export default class LiblslTest extends AbstractSpruceTest {
|
|
|
194
164
|
|
|
195
165
|
@test()
|
|
196
166
|
protected static canSetInstance() {
|
|
197
|
-
const fake = new
|
|
167
|
+
const fake = new SpyLiblsl()
|
|
198
168
|
LiblslImpl.setInstance(fake)
|
|
199
169
|
assert.isEqual(LiblslImpl.getInstance(), fake)
|
|
200
170
|
}
|
|
@@ -213,6 +183,7 @@ export default class LiblslTest extends AbstractSpruceTest {
|
|
|
213
183
|
lsl_destroy_outlet: ['void', [outletType]],
|
|
214
184
|
lsl_local_clock: ['double', []],
|
|
215
185
|
lsl_push_sample_ft: ['void', [outletType, FloatArray, 'double']],
|
|
186
|
+
lsl_push_sample_strt: ['void', [outletType, StringArray, 'double']],
|
|
216
187
|
lsl_get_desc: [xmlPtr, [streamInfo]],
|
|
217
188
|
lsl_append_child: [xmlPtr, [xmlPtr, 'string']],
|
|
218
189
|
lsl_append_child_value: [xmlPtr, [xmlPtr, 'string', 'string']],
|
|
@@ -240,16 +211,33 @@ export default class LiblslTest extends AbstractSpruceTest {
|
|
|
240
211
|
}
|
|
241
212
|
|
|
242
213
|
@test()
|
|
243
|
-
protected static async
|
|
244
|
-
const expected = [1, 2, 3]
|
|
214
|
+
protected static async canPushFloatSample() {
|
|
215
|
+
const expected = [1.0, 2.0, 3.0]
|
|
216
|
+
const timestamp = randomInt(100)
|
|
245
217
|
const options = {
|
|
246
218
|
outlet: this.fakeOutlet,
|
|
247
219
|
sample: expected,
|
|
220
|
+
timestamp,
|
|
248
221
|
}
|
|
249
|
-
this.lsl.
|
|
250
|
-
assert.isEqual(this.
|
|
251
|
-
assert.isEqual(this.
|
|
252
|
-
assert.isEqual(this.
|
|
222
|
+
this.lsl.pushSampleFt(options)
|
|
223
|
+
assert.isEqual(this.pushSampleFtParams?.[0], this.fakeOutlet)
|
|
224
|
+
assert.isEqual(this.pushSampleFtParams?.[1], expected)
|
|
225
|
+
assert.isEqual(this.pushSampleFtParams?.[2], timestamp)
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
@test()
|
|
229
|
+
protected static async canPushStringSample() {
|
|
230
|
+
const expected = [generateId()]
|
|
231
|
+
const timestamp = randomInt(100)
|
|
232
|
+
const options = {
|
|
233
|
+
outlet: this.fakeOutlet,
|
|
234
|
+
sample: expected,
|
|
235
|
+
timestamp,
|
|
236
|
+
}
|
|
237
|
+
this.lsl.pushSampleStrt(options)
|
|
238
|
+
assert.isEqual(this.pushSampleStrtParams?.[0], this.fakeOutlet)
|
|
239
|
+
assert.isEqualDeep(this.pushSampleStrtParams?.[1], expected)
|
|
240
|
+
assert.isEqual(this.pushSampleStrtParams?.[2], timestamp)
|
|
253
241
|
}
|
|
254
242
|
|
|
255
243
|
@test()
|
|
@@ -313,6 +301,14 @@ export default class LiblslTest extends AbstractSpruceTest {
|
|
|
313
301
|
assert.isEqualDeep(this.destroyOutletParams, Object.values(options))
|
|
314
302
|
}
|
|
315
303
|
|
|
304
|
+
@test()
|
|
305
|
+
protected static async callingLocalClockTwiceReturnsDifferentTimestamps() {
|
|
306
|
+
const t1 = this.lsl.localClock()
|
|
307
|
+
await this.wait(10)
|
|
308
|
+
const t2 = this.lsl.localClock()
|
|
309
|
+
assert.isNotEqual(t1, t2)
|
|
310
|
+
}
|
|
311
|
+
|
|
316
312
|
private static createRandomStreamInfo() {
|
|
317
313
|
return this.lsl.createStreamInfo(
|
|
318
314
|
this.generateRandomCreateStreamInfoOptions()
|
|
@@ -348,27 +344,48 @@ export default class LiblslTest extends AbstractSpruceTest {
|
|
|
348
344
|
sourceId: generateId(),
|
|
349
345
|
}
|
|
350
346
|
}
|
|
351
|
-
}
|
|
352
347
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
348
|
+
private static FakeBindings(): LiblslBindings {
|
|
349
|
+
return {
|
|
350
|
+
lsl_create_streaminfo: (...params: any[]) => {
|
|
351
|
+
this.createStreamInfoParams = params
|
|
352
|
+
return this.fakeStreamInfo
|
|
353
|
+
},
|
|
354
|
+
lsl_create_outlet: (...params: any[]) => {
|
|
355
|
+
this.createOutletParams = params
|
|
356
|
+
return this.fakeOutlet
|
|
357
|
+
},
|
|
358
|
+
lsl_destroy_outlet: (...params: any[]) => {
|
|
359
|
+
this.destroyOutletParams = params
|
|
360
|
+
},
|
|
361
|
+
lsl_push_sample_ft: (...params: any[]) => {
|
|
362
|
+
this.pushSampleFtParams = params
|
|
363
|
+
},
|
|
364
|
+
lsl_push_sample_strt: (...params: any[]) => {
|
|
365
|
+
this.pushSampleStrtParams = params
|
|
366
|
+
},
|
|
367
|
+
lsl_local_clock: () => new Date().getTime(),
|
|
368
|
+
lsl_get_desc: (info: BoundStreamInfo) => {
|
|
369
|
+
this.getDescriptionParams = [info]
|
|
370
|
+
return this.fakeDesc
|
|
371
|
+
},
|
|
372
|
+
lsl_append_child: (...params: any) => {
|
|
373
|
+
this.appendChildParams.push(params)
|
|
374
|
+
if (this.appendChildHitCount === 0) {
|
|
375
|
+
this.appendChildHitCount++
|
|
376
|
+
return this.fakeChildNamedChannels
|
|
377
|
+
}
|
|
378
|
+
return this.fakeChildNamedChannel
|
|
379
|
+
},
|
|
380
|
+
lsl_append_child_value: (...params: any[]) => {
|
|
381
|
+
this.appendChildValueParams.push(params)
|
|
382
|
+
},
|
|
383
|
+
}
|
|
364
384
|
}
|
|
365
|
-
|
|
366
|
-
public destroyOutlet(_options: DestroyOutletOptions): void {}
|
|
367
|
-
|
|
368
|
-
public pushSample(_options: PushSampleOptions): void {}
|
|
369
385
|
}
|
|
370
386
|
|
|
371
387
|
const streamInfo = ref.refType(ref.types.void)
|
|
372
388
|
const outletType = ref.refType(ref.types.void)
|
|
373
389
|
const FloatArray = ArrayType(ref.types.float)
|
|
390
|
+
const StringArray = ArrayType(ref.types.CString)
|
|
374
391
|
const xmlPtr = ref.refType(ref.types.void)
|
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
|
-
CreateOutletOptions,
|
|
3
|
-
CreateStreamInfoOptions,
|
|
4
2
|
Liblsl,
|
|
5
3
|
BoundOutlet,
|
|
6
4
|
BoundStreamInfo,
|
|
5
|
+
CreateStreamInfoOptions,
|
|
7
6
|
AppendChannelsToStreamInfoOptions,
|
|
8
|
-
|
|
7
|
+
CreateOutletOptions,
|
|
8
|
+
PushSampleFtOptions as PushSampleFtOptions,
|
|
9
|
+
PushSampleStrtOptions,
|
|
9
10
|
} from '../../Liblsl'
|
|
10
11
|
|
|
11
12
|
export class SpyLiblsl implements Liblsl {
|
|
13
|
+
public outlet: BoundOutlet = {} as BoundOutlet
|
|
14
|
+
public streamInfo: BoundStreamInfo = {} as BoundStreamInfo
|
|
15
|
+
|
|
12
16
|
public lastCreateStreamInfoOptions?: CreateStreamInfoOptions
|
|
13
17
|
public lastAppendChannelsToStreamInfoOptions?: AppendChannelsToStreamInfoOptions
|
|
14
18
|
public lastCreateOutletOptions?: CreateOutletOptions
|
|
15
|
-
public
|
|
19
|
+
public lastPushSampleFtOptions?: PushSampleFtOptions
|
|
20
|
+
public lastPushSampleStrtOptions?: PushSampleStrtOptions
|
|
16
21
|
|
|
17
|
-
public outlet: BoundOutlet = {} as BoundOutlet
|
|
18
|
-
public streamInfo: BoundStreamInfo = {} as BoundStreamInfo
|
|
19
22
|
public createStreamInfoHitCount = 0
|
|
20
23
|
public destroyOutletHitCount = 0
|
|
24
|
+
public localClockHitCount = 0
|
|
21
25
|
|
|
22
26
|
public createStreamInfo(options: CreateStreamInfoOptions): BoundStreamInfo {
|
|
23
27
|
this.createStreamInfoHitCount++
|
|
@@ -27,7 +31,7 @@ export class SpyLiblsl implements Liblsl {
|
|
|
27
31
|
|
|
28
32
|
public appendChannelsToStreamInfo(
|
|
29
33
|
options: AppendChannelsToStreamInfoOptions
|
|
30
|
-
)
|
|
34
|
+
) {
|
|
31
35
|
this.lastAppendChannelsToStreamInfoOptions = options
|
|
32
36
|
}
|
|
33
37
|
|
|
@@ -40,7 +44,16 @@ export class SpyLiblsl implements Liblsl {
|
|
|
40
44
|
this.destroyOutletHitCount++
|
|
41
45
|
}
|
|
42
46
|
|
|
43
|
-
public
|
|
44
|
-
this.
|
|
47
|
+
public pushSampleFt(options: PushSampleFtOptions) {
|
|
48
|
+
this.lastPushSampleFtOptions = options
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public pushSampleStrt(options: PushSampleStrtOptions) {
|
|
52
|
+
this.lastPushSampleStrtOptions = options
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public localClock() {
|
|
56
|
+
this.localClockHitCount++
|
|
57
|
+
return new Date().getTime()
|
|
45
58
|
}
|
|
46
59
|
}
|