@neurodevs/node-lsl 1.1.0 → 2.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/LslOutlet.d.ts +2 -1
- package/build/LslOutlet.js +19 -14
- package/build/LslOutlet.js.map +1 -1
- package/build/__tests__/behavioral/LslOutlet.test.d.ts +3 -2
- package/build/__tests__/behavioral/LslOutlet.test.js +34 -13
- package/build/__tests__/behavioral/LslOutlet.test.js.map +1 -1
- package/package.json +1 -1
- package/src/LslOutlet.ts +44 -33
- package/src/__tests__/behavioral/LslOutlet.test.ts +43 -12
package/build/LslOutlet.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { LslSample } from './Liblsl';
|
|
|
2
2
|
export default class LslOutletImpl implements LslOutlet {
|
|
3
3
|
private outletOptions;
|
|
4
4
|
static Class?: new (options: LslOutletOptions) => LslOutlet;
|
|
5
|
+
private streamInfo;
|
|
5
6
|
protected constructor(options: LslOutletOptions);
|
|
6
7
|
static Outlet(options: LslOutletOptions): LslOutlet;
|
|
7
8
|
private assertValidMaxBufferred;
|
|
@@ -20,7 +21,7 @@ export type ChannelFormat = (typeof CHANNEL_FORMATS)[number];
|
|
|
20
21
|
export interface LslOutletOptions {
|
|
21
22
|
name: string;
|
|
22
23
|
type: string;
|
|
23
|
-
|
|
24
|
+
channelLabels: string[];
|
|
24
25
|
sampleRate: number;
|
|
25
26
|
channelFormat: ChannelFormat;
|
|
26
27
|
sourceId: string;
|
package/build/LslOutlet.js
CHANGED
|
@@ -18,10 +18,10 @@ const schema_1 = require("@sprucelabs/schema");
|
|
|
18
18
|
const Liblsl_1 = __importDefault(require("./Liblsl"));
|
|
19
19
|
class LslOutletImpl {
|
|
20
20
|
constructor(options) {
|
|
21
|
-
const {
|
|
21
|
+
const { sampleRate, channelFormat } = (0, schema_1.assertOptions)(options, [
|
|
22
22
|
'name',
|
|
23
23
|
'type',
|
|
24
|
-
'
|
|
24
|
+
'channelLabels',
|
|
25
25
|
'sampleRate',
|
|
26
26
|
'channelFormat',
|
|
27
27
|
'sourceId',
|
|
@@ -30,12 +30,22 @@ class LslOutletImpl {
|
|
|
30
30
|
'chunkSize',
|
|
31
31
|
'maxBuffered',
|
|
32
32
|
]);
|
|
33
|
-
this.
|
|
33
|
+
this.outletOptions = options;
|
|
34
|
+
const _a = this
|
|
35
|
+
.outletOptions, { chunkSize, maxBuffered, channelLabels } = _a, streamInfoOptions = __rest(_a, ["chunkSize", "maxBuffered", "channelLabels"]);
|
|
36
|
+
this.assertValidChannelCount(channelLabels.length);
|
|
34
37
|
this.assertValidSampleRate(sampleRate);
|
|
35
38
|
this.assertValidChannelFormat(channelFormat);
|
|
36
39
|
this.assertValidChunkSize(chunkSize);
|
|
37
40
|
this.assertValidMaxBufferred(maxBuffered);
|
|
38
|
-
|
|
41
|
+
delete streamInfoOptions.manufacturer;
|
|
42
|
+
delete streamInfoOptions.unit;
|
|
43
|
+
this.streamInfo = this.lsl.createStreamInfo(Object.assign(Object.assign({}, streamInfoOptions), { channelCount: channelLabels.length, channelFormat: CHANNEL_FORMATS.indexOf(this.outletOptions.channelFormat) }));
|
|
44
|
+
this.lsl.appendChannelsToStreamInfo(this.streamInfo, channelLabels.map((label) => ({
|
|
45
|
+
label,
|
|
46
|
+
unit: this.outletOptions.unit,
|
|
47
|
+
type: this.outletOptions.type,
|
|
48
|
+
})));
|
|
39
49
|
}
|
|
40
50
|
static Outlet(options) {
|
|
41
51
|
var _a;
|
|
@@ -82,8 +92,8 @@ class LslOutletImpl {
|
|
|
82
92
|
if (!this.isPositiveInteger(channelCount)) {
|
|
83
93
|
throw new schema_1.SchemaError({
|
|
84
94
|
code: 'INVALID_PARAMETERS',
|
|
85
|
-
parameters: ['
|
|
86
|
-
friendlyMessage: '
|
|
95
|
+
parameters: ['channelLabels'],
|
|
96
|
+
friendlyMessage: 'channelLabels must have 1 or more labels.',
|
|
87
97
|
});
|
|
88
98
|
}
|
|
89
99
|
}
|
|
@@ -100,15 +110,10 @@ class LslOutletImpl {
|
|
|
100
110
|
return Liblsl_1.default.getInstance();
|
|
101
111
|
}
|
|
102
112
|
pushSample(sample) {
|
|
103
|
-
const _a = this
|
|
104
|
-
.outletOptions, { chunkSize, maxBuffered } = _a, streamInfoOptions = __rest(_a, ["chunkSize", "maxBuffered"]);
|
|
105
|
-
delete streamInfoOptions.manufacturer;
|
|
106
|
-
delete streamInfoOptions.unit;
|
|
107
|
-
const info = this.lsl.createStreamInfo(Object.assign(Object.assign({}, streamInfoOptions), { channelFormat: CHANNEL_FORMATS.indexOf(this.outletOptions.channelFormat) }));
|
|
108
113
|
this.lsl.pushSample(this.lsl.createOutlet({
|
|
109
|
-
info,
|
|
110
|
-
chunkSize,
|
|
111
|
-
maxBuffered,
|
|
114
|
+
info: this.streamInfo,
|
|
115
|
+
chunkSize: this.outletOptions.chunkSize,
|
|
116
|
+
maxBuffered: this.outletOptions.maxBuffered,
|
|
112
117
|
}), sample);
|
|
113
118
|
}
|
|
114
119
|
}
|
package/build/LslOutlet.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LslOutlet.js","sourceRoot":"","sources":["../src/LslOutlet.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA+D;AAC/D,
|
|
1
|
+
{"version":3,"file":"LslOutlet.js","sourceRoot":"","sources":["../src/LslOutlet.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA+D;AAC/D,sDAAuE;AAEvE,MAAqB,aAAa;IAKjC,YAAsB,OAAyB;QAC9C,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,GAAG,IAAA,sBAAa,EAAC,OAAO,EAAE;YAC5D,MAAM;YACN,MAAM;YACN,eAAe;YACf,YAAY;YACZ,eAAe;YACf,UAAU;YACV,cAAc;YACd,MAAM;YACN,WAAW;YACX,aAAa;SACb,CAAC,CAAA;QAEF,IAAI,CAAC,aAAa,GAAG,OAAO,CAAA;QAE5B,MAAM,KA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CAAC;IAEO,uBAAuB,CAAC,KAAa;QAC5C,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAA;IAC7C,CAAC;IAEO,iBAAiB,CAAC,KAAa;QACtC,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAA;IAC5C,CAAC;IAED,IAAY,GAAG;QACd,OAAO,gBAAU,CAAC,WAAW,EAAE,CAAA;IAChC,CAAC;IAEM,UAAU,CAAC,MAAiB;QAClC,IAAI,CAAC,GAAG,CAAC,UAAU,CAClB,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC;YACrB,IAAI,EAAE,IAAI,CAAC,UAAU;YACrB,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,SAAS;YACvC,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC,WAAW;SAC3C,CAAC,EACF,MAAM,CACN,CAAA;IACF,CAAC;CACD;AAnID,gCAmIC;AAED,MAAM,eAAe,GAAG;IACvB,WAAW;IACX,SAAS;IACT,UAAU;IACV,QAAQ;IACR,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;CACE,CAAA"}
|
|
@@ -15,13 +15,14 @@ export default class LslOutletTest extends AbstractSpruceTest {
|
|
|
15
15
|
protected static throwWithInvalidChunkSize(): Promise<void>;
|
|
16
16
|
protected static throwsWithInvalidMaxBuffered(): Promise<void>;
|
|
17
17
|
protected static pushingSampleSendsToLsl(sample: LslSample): Promise<void>;
|
|
18
|
-
protected static
|
|
18
|
+
protected static constructionPassesCorrectOptionsToCreateStreamInfo(): Promise<void>;
|
|
19
19
|
protected static canOverrideClasInstantiatedInFactory(): Promise<void>;
|
|
20
|
+
protected static appendsChannelsBasedOnCount(labels: string[]): Promise<void>;
|
|
20
21
|
private static pushSample;
|
|
21
22
|
private static assertThrowsInvalidMaxBuffered;
|
|
22
23
|
private static assertThrowsInvalidChunkSize;
|
|
23
24
|
private static assertThrowsInvalidSampleRate;
|
|
24
|
-
private static
|
|
25
|
+
private static assertThrowsInvalidChannelLabels;
|
|
25
26
|
private static assertDoesThrowInvalidParameters;
|
|
26
27
|
private static Outlet;
|
|
27
28
|
}
|
|
@@ -61,11 +61,12 @@ exports.CHANNEL_FORMATS = [
|
|
|
61
61
|
class LslOutletTest extends test_utils_1.default {
|
|
62
62
|
static async beforeEach() {
|
|
63
63
|
await super.beforeEach();
|
|
64
|
+
delete LslOutlet_1.default.Class;
|
|
64
65
|
this.channelIdx = (0, crypto_1.randomInt)(7);
|
|
65
66
|
this.randomOutletOptions = {
|
|
66
67
|
name: (0, test_utils_1.generateId)(),
|
|
67
68
|
type: (0, test_utils_1.generateId)(),
|
|
68
|
-
|
|
69
|
+
channelLabels: new Array((0, crypto_1.randomInt)(1, 10)).fill((0, test_utils_1.generateId)()),
|
|
69
70
|
sampleRate: Math.random() * 10,
|
|
70
71
|
channelFormat: exports.CHANNEL_FORMATS[this.channelIdx],
|
|
71
72
|
sourceId: (0, test_utils_1.generateId)(),
|
|
@@ -84,7 +85,7 @@ class LslOutletTest extends test_utils_1.default {
|
|
|
84
85
|
parameters: [
|
|
85
86
|
'name',
|
|
86
87
|
'type',
|
|
87
|
-
'
|
|
88
|
+
'channelLabels',
|
|
88
89
|
'sampleRate',
|
|
89
90
|
'channelFormat',
|
|
90
91
|
'sourceId',
|
|
@@ -99,9 +100,7 @@ class LslOutletTest extends test_utils_1.default {
|
|
|
99
100
|
this.Outlet();
|
|
100
101
|
}
|
|
101
102
|
static async throwsWithInvalidChannelCount() {
|
|
102
|
-
this.
|
|
103
|
-
this.assertThrowsInvalidChannelCount(-1);
|
|
104
|
-
this.assertThrowsInvalidChannelCount(1.5);
|
|
103
|
+
this.assertThrowsInvalidChannelLabels(0);
|
|
105
104
|
}
|
|
106
105
|
static async throwsWithInvalidSampleRate() {
|
|
107
106
|
this.assertThrowsInvalidSampleRate(0);
|
|
@@ -142,13 +141,15 @@ class LslOutletTest extends test_utils_1.default {
|
|
|
142
141
|
maxBuffered: this.randomOutletOptions.maxBuffered,
|
|
143
142
|
});
|
|
144
143
|
}
|
|
145
|
-
static async
|
|
146
|
-
this.
|
|
144
|
+
static async constructionPassesCorrectOptionsToCreateStreamInfo() {
|
|
145
|
+
this.Outlet();
|
|
147
146
|
const options = __rest(this.randomOutletOptions, []);
|
|
147
|
+
options.channelCount = options.channelLabels.length;
|
|
148
148
|
delete options.manufacturer;
|
|
149
149
|
delete options.unit;
|
|
150
150
|
delete options.chunkSize;
|
|
151
151
|
delete options.maxBuffered;
|
|
152
|
+
delete options.channelLabels;
|
|
152
153
|
test_utils_1.assert.isEqualDeep(this.spyLsl.lastStreamInfoOptions, Object.assign(Object.assign({}, options), { channelFormat: this.channelIdx }));
|
|
153
154
|
}
|
|
154
155
|
static async canOverrideClasInstantiatedInFactory() {
|
|
@@ -156,6 +157,19 @@ class LslOutletTest extends test_utils_1.default {
|
|
|
156
157
|
const instance = this.Outlet();
|
|
157
158
|
test_utils_1.assert.isInstanceOf(instance, CheckingOutlet);
|
|
158
159
|
}
|
|
160
|
+
static async appendsChannelsBasedOnCount(labels) {
|
|
161
|
+
const type = (0, test_utils_1.generateId)();
|
|
162
|
+
const unit = (0, test_utils_1.generateId)();
|
|
163
|
+
this.Outlet({ channelLabels: labels, type, unit });
|
|
164
|
+
test_utils_1.assert.isEqualDeep(this.spyLsl.lastAppendChannelsToStreamInfo, {
|
|
165
|
+
info: this.spyLsl.streamInfo,
|
|
166
|
+
channels: labels.map((label) => ({
|
|
167
|
+
label,
|
|
168
|
+
type,
|
|
169
|
+
unit,
|
|
170
|
+
})),
|
|
171
|
+
});
|
|
172
|
+
}
|
|
159
173
|
static pushSample(sample) {
|
|
160
174
|
const outlet = this.Outlet();
|
|
161
175
|
outlet.pushSample(sample);
|
|
@@ -169,10 +183,8 @@ class LslOutletTest extends test_utils_1.default {
|
|
|
169
183
|
static assertThrowsInvalidSampleRate(sampleRate) {
|
|
170
184
|
this.assertDoesThrowInvalidParameters({ sampleRate }, ['sampleRate']);
|
|
171
185
|
}
|
|
172
|
-
static
|
|
173
|
-
this.assertDoesThrowInvalidParameters({
|
|
174
|
-
'channelCount',
|
|
175
|
-
]);
|
|
186
|
+
static assertThrowsInvalidChannelLabels(count) {
|
|
187
|
+
this.assertDoesThrowInvalidParameters({ channelLabels: new Array(count).fill((0, test_utils_1.generateId)()) }, ['channelLabels']);
|
|
176
188
|
}
|
|
177
189
|
static assertDoesThrowInvalidParameters(options, parameters) {
|
|
178
190
|
const err = test_utils_1.assert.doesThrow(() => this.Outlet(options));
|
|
@@ -215,10 +227,14 @@ __decorate([
|
|
|
215
227
|
], LslOutletTest, "pushingSampleSendsToLsl", null);
|
|
216
228
|
__decorate([
|
|
217
229
|
(0, test_utils_1.test)()
|
|
218
|
-
], LslOutletTest, "
|
|
230
|
+
], LslOutletTest, "constructionPassesCorrectOptionsToCreateStreamInfo", null);
|
|
219
231
|
__decorate([
|
|
220
232
|
(0, test_utils_1.test)()
|
|
221
233
|
], LslOutletTest, "canOverrideClasInstantiatedInFactory", null);
|
|
234
|
+
__decorate([
|
|
235
|
+
(0, test_utils_1.test)('can add one label', [(0, test_utils_1.generateId)()]),
|
|
236
|
+
(0, test_utils_1.test)('can add two labels', [(0, test_utils_1.generateId)(), (0, test_utils_1.generateId)()])
|
|
237
|
+
], LslOutletTest, "appendsChannelsBasedOnCount", null);
|
|
222
238
|
class SpyLiblsl {
|
|
223
239
|
constructor() {
|
|
224
240
|
this.outlet = {};
|
|
@@ -228,7 +244,12 @@ class SpyLiblsl {
|
|
|
228
244
|
this.lastStreamInfoOptions = options;
|
|
229
245
|
return this.streamInfo;
|
|
230
246
|
}
|
|
231
|
-
appendChannelsToStreamInfo(info, channels) {
|
|
247
|
+
appendChannelsToStreamInfo(info, channels) {
|
|
248
|
+
this.lastAppendChannelsToStreamInfo = {
|
|
249
|
+
info,
|
|
250
|
+
channels,
|
|
251
|
+
};
|
|
252
|
+
}
|
|
232
253
|
createOutlet(options) {
|
|
233
254
|
this.lastOutletOptions = options;
|
|
234
255
|
return this.outlet;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LslOutlet.test.js","sourceRoot":"","sources":["../../../src/__tests__/behavioral/LslOutlet.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAkC;AAClC,qEAK+B;AAC/B,0DAQqB;AACrB,gEAA4E;AAE/D,QAAA,eAAe,GAAG;IAC9B,WAAW;IACX,SAAS;IACT,UAAU;IACV,QAAQ;IACR,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;CACE,CAAA;AAEV,MAAqB,aAAc,SAAQ,oBAAkB;IAKlD,MAAM,CAAC,KAAK,CAAC,UAAU;QAChC,MAAM,KAAK,CAAC,UAAU,EAAE,CAAA;QACxB,IAAI,CAAC,UAAU,GAAG,IAAA,kBAAS,EAAC,CAAC,CAAC,CAAA;QAC9B,IAAI,CAAC,mBAAmB,GAAG;YAC1B,IAAI,EAAE,IAAA,uBAAU,GAAE;YAClB,IAAI,EAAE,IAAA,uBAAU,GAAE;YAClB,
|
|
1
|
+
{"version":3,"file":"LslOutlet.test.js","sourceRoot":"","sources":["../../../src/__tests__/behavioral/LslOutlet.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAkC;AAClC,qEAK+B;AAC/B,0DAQqB;AACrB,gEAA4E;AAE/D,QAAA,eAAe,GAAG;IAC9B,WAAW;IACX,SAAS;IACT,UAAU;IACV,QAAQ;IACR,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;CACE,CAAA;AAEV,MAAqB,aAAc,SAAQ,oBAAkB;IAKlD,MAAM,CAAC,KAAK,CAAC,UAAU;QAChC,MAAM,KAAK,CAAC,UAAU,EAAE,CAAA;QACxB,OAAO,mBAAS,CAAC,KAAK,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,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ADtB,IAAA,iBAAI,GAAE;+DAKN;AAIsB;IAFtB,IAAA,iBAAI,EAAC,mBAAmB,EAAE,CAAC,IAAA,uBAAU,GAAE,CAAC,CAAC;IACzC,IAAA,iBAAI,EAAC,oBAAoB,EAAE,CAAC,IAAA,uBAAU,GAAE,EAAE,IAAA,uBAAU,GAAE,CAAC,CAAC;sDAexD;AA4CF,MAAM,SAAS;IAAf;QAKQ,WAAM,GAAsB,EAAuB,CAAA;QACnD,eAAU,GAA0B,EAA2B,CAAA;IA8BvE,CAAC;IAxBO,gBAAgB,CACtB,OAAgC;QAEhC,IAAI,CAAC,qBAAqB,GAAG,OAAO,CAAA;QACpC,OAAO,IAAI,CAAC,UAAU,CAAA;IACvB,CAAC;IACM,0BAA0B,CAChC,IAA2B,EAC3B,QAAsB;QAEtB,IAAI,CAAC,8BAA8B,GAAG;YACrC,IAAI;YACJ,QAAQ;SACR,CAAA;IACF,CAAC;IAEM,YAAY,CAAC,OAA4B;QAC/C,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAA;QAChC,OAAO,IAAI,CAAC,MAAM,CAAA;IACnB,CAAC;IACM,UAAU,CAAC,MAAyB,EAAE,MAAiB;QAC7D,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAA;QAC9B,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAA;IAC/B,CAAC;CACD;AAED,MAAM,cAAe,SAAQ,mBAAS;IACrC,YAAmB,OAAyB;QAC3C,KAAK,CAAC,OAAO,CAAC,CAAA;IACf,CAAC;CACD"}
|
package/package.json
CHANGED
package/src/LslOutlet.ts
CHANGED
|
@@ -1,32 +1,53 @@
|
|
|
1
1
|
import { SchemaError, assertOptions } from '@sprucelabs/schema'
|
|
2
|
-
import LiblslImpl, { LslSample } from './Liblsl'
|
|
2
|
+
import LiblslImpl, { LslBindingsStreamInfo, LslSample } from './Liblsl'
|
|
3
3
|
|
|
4
4
|
export default class LslOutletImpl implements LslOutlet {
|
|
5
5
|
private outletOptions: LslOutletOptions
|
|
6
6
|
public static Class?: new (options: LslOutletOptions) => LslOutlet
|
|
7
|
+
private streamInfo: LslBindingsStreamInfo
|
|
7
8
|
|
|
8
9
|
protected constructor(options: LslOutletOptions) {
|
|
9
|
-
const {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
const { sampleRate, channelFormat } = assertOptions(options, [
|
|
11
|
+
'name',
|
|
12
|
+
'type',
|
|
13
|
+
'channelLabels',
|
|
14
|
+
'sampleRate',
|
|
15
|
+
'channelFormat',
|
|
16
|
+
'sourceId',
|
|
17
|
+
'manufacturer',
|
|
18
|
+
'unit',
|
|
19
|
+
'chunkSize',
|
|
20
|
+
'maxBuffered',
|
|
21
|
+
])
|
|
22
|
+
|
|
23
|
+
this.outletOptions = options
|
|
24
|
+
|
|
25
|
+
const { chunkSize, maxBuffered, channelLabels, ...streamInfoOptions } = this
|
|
26
|
+
.outletOptions as any
|
|
27
|
+
|
|
28
|
+
this.assertValidChannelCount(channelLabels.length)
|
|
24
29
|
this.assertValidSampleRate(sampleRate)
|
|
25
30
|
this.assertValidChannelFormat(channelFormat)
|
|
26
31
|
this.assertValidChunkSize(chunkSize)
|
|
27
32
|
this.assertValidMaxBufferred(maxBuffered)
|
|
28
33
|
|
|
29
|
-
|
|
34
|
+
delete streamInfoOptions.manufacturer
|
|
35
|
+
delete streamInfoOptions.unit
|
|
36
|
+
|
|
37
|
+
this.streamInfo = this.lsl.createStreamInfo({
|
|
38
|
+
...streamInfoOptions,
|
|
39
|
+
channelCount: channelLabels.length,
|
|
40
|
+
channelFormat: CHANNEL_FORMATS.indexOf(this.outletOptions.channelFormat),
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
this.lsl.appendChannelsToStreamInfo(
|
|
44
|
+
this.streamInfo,
|
|
45
|
+
channelLabels.map((label: string) => ({
|
|
46
|
+
label,
|
|
47
|
+
unit: this.outletOptions.unit,
|
|
48
|
+
type: this.outletOptions.type,
|
|
49
|
+
}))
|
|
50
|
+
)
|
|
30
51
|
}
|
|
31
52
|
|
|
32
53
|
public static Outlet(options: LslOutletOptions) {
|
|
@@ -79,8 +100,8 @@ export default class LslOutletImpl implements LslOutlet {
|
|
|
79
100
|
if (!this.isPositiveInteger(channelCount)) {
|
|
80
101
|
throw new SchemaError({
|
|
81
102
|
code: 'INVALID_PARAMETERS',
|
|
82
|
-
parameters: ['
|
|
83
|
-
friendlyMessage: '
|
|
103
|
+
parameters: ['channelLabels'],
|
|
104
|
+
friendlyMessage: 'channelLabels must have 1 or more labels.',
|
|
84
105
|
})
|
|
85
106
|
}
|
|
86
107
|
}
|
|
@@ -102,21 +123,11 @@ export default class LslOutletImpl implements LslOutlet {
|
|
|
102
123
|
}
|
|
103
124
|
|
|
104
125
|
public pushSample(sample: LslSample) {
|
|
105
|
-
const { chunkSize, maxBuffered, ...streamInfoOptions } = this
|
|
106
|
-
.outletOptions as any
|
|
107
|
-
|
|
108
|
-
delete streamInfoOptions.manufacturer
|
|
109
|
-
delete streamInfoOptions.unit
|
|
110
|
-
|
|
111
|
-
const info = this.lsl.createStreamInfo({
|
|
112
|
-
...streamInfoOptions,
|
|
113
|
-
channelFormat: CHANNEL_FORMATS.indexOf(this.outletOptions.channelFormat),
|
|
114
|
-
})
|
|
115
126
|
this.lsl.pushSample(
|
|
116
127
|
this.lsl.createOutlet({
|
|
117
|
-
info,
|
|
118
|
-
chunkSize,
|
|
119
|
-
maxBuffered,
|
|
128
|
+
info: this.streamInfo,
|
|
129
|
+
chunkSize: this.outletOptions.chunkSize,
|
|
130
|
+
maxBuffered: this.outletOptions.maxBuffered,
|
|
120
131
|
}),
|
|
121
132
|
sample
|
|
122
133
|
)
|
|
@@ -138,7 +149,7 @@ export type ChannelFormat = (typeof CHANNEL_FORMATS)[number]
|
|
|
138
149
|
export interface LslOutletOptions {
|
|
139
150
|
name: string
|
|
140
151
|
type: string
|
|
141
|
-
|
|
152
|
+
channelLabels: string[]
|
|
142
153
|
sampleRate: number
|
|
143
154
|
channelFormat: ChannelFormat
|
|
144
155
|
sourceId: string
|
|
@@ -34,11 +34,12 @@ export default class LslOutletTest extends AbstractSpruceTest {
|
|
|
34
34
|
|
|
35
35
|
protected static async beforeEach() {
|
|
36
36
|
await super.beforeEach()
|
|
37
|
+
delete LslOutlet.Class
|
|
37
38
|
this.channelIdx = randomInt(7)
|
|
38
39
|
this.randomOutletOptions = {
|
|
39
40
|
name: generateId(),
|
|
40
41
|
type: generateId(),
|
|
41
|
-
|
|
42
|
+
channelLabels: new Array(randomInt(1, 10)).fill(generateId()),
|
|
42
43
|
sampleRate: Math.random() * 10,
|
|
43
44
|
channelFormat: CHANNEL_FORMATS[this.channelIdx],
|
|
44
45
|
sourceId: generateId(),
|
|
@@ -60,7 +61,7 @@ export default class LslOutletTest extends AbstractSpruceTest {
|
|
|
60
61
|
parameters: [
|
|
61
62
|
'name',
|
|
62
63
|
'type',
|
|
63
|
-
'
|
|
64
|
+
'channelLabels',
|
|
64
65
|
'sampleRate',
|
|
65
66
|
'channelFormat',
|
|
66
67
|
'sourceId',
|
|
@@ -79,9 +80,7 @@ export default class LslOutletTest extends AbstractSpruceTest {
|
|
|
79
80
|
|
|
80
81
|
@test()
|
|
81
82
|
protected static async throwsWithInvalidChannelCount() {
|
|
82
|
-
this.
|
|
83
|
-
this.assertThrowsInvalidChannelCount(-1)
|
|
84
|
-
this.assertThrowsInvalidChannelCount(1.5)
|
|
83
|
+
this.assertThrowsInvalidChannelLabels(0)
|
|
85
84
|
}
|
|
86
85
|
|
|
87
86
|
@test()
|
|
@@ -137,14 +136,18 @@ export default class LslOutletTest extends AbstractSpruceTest {
|
|
|
137
136
|
}
|
|
138
137
|
|
|
139
138
|
@test()
|
|
140
|
-
protected static async
|
|
141
|
-
this.
|
|
139
|
+
protected static async constructionPassesCorrectOptionsToCreateStreamInfo() {
|
|
140
|
+
this.Outlet()
|
|
141
|
+
|
|
142
142
|
const { ...options } = this.randomOutletOptions as any
|
|
143
143
|
|
|
144
|
+
options.channelCount = options.channelLabels.length
|
|
145
|
+
|
|
144
146
|
delete options.manufacturer
|
|
145
147
|
delete options.unit
|
|
146
148
|
delete options.chunkSize
|
|
147
149
|
delete options.maxBuffered
|
|
150
|
+
delete options.channelLabels
|
|
148
151
|
|
|
149
152
|
assert.isEqualDeep(this.spyLsl.lastStreamInfoOptions, {
|
|
150
153
|
...options,
|
|
@@ -159,6 +162,24 @@ export default class LslOutletTest extends AbstractSpruceTest {
|
|
|
159
162
|
assert.isInstanceOf(instance, CheckingOutlet)
|
|
160
163
|
}
|
|
161
164
|
|
|
165
|
+
@test('can add one label', [generateId()])
|
|
166
|
+
@test('can add two labels', [generateId(), generateId()])
|
|
167
|
+
protected static async appendsChannelsBasedOnCount(labels: string[]) {
|
|
168
|
+
const type = generateId()
|
|
169
|
+
const unit = generateId()
|
|
170
|
+
|
|
171
|
+
this.Outlet({ channelLabels: labels, type, unit })
|
|
172
|
+
|
|
173
|
+
assert.isEqualDeep(this.spyLsl.lastAppendChannelsToStreamInfo, {
|
|
174
|
+
info: this.spyLsl.streamInfo,
|
|
175
|
+
channels: labels.map((label) => ({
|
|
176
|
+
label,
|
|
177
|
+
type,
|
|
178
|
+
unit,
|
|
179
|
+
})),
|
|
180
|
+
})
|
|
181
|
+
}
|
|
182
|
+
|
|
162
183
|
private static pushSample(sample: LslSample) {
|
|
163
184
|
const outlet = this.Outlet()
|
|
164
185
|
outlet.pushSample(sample)
|
|
@@ -176,10 +197,11 @@ export default class LslOutletTest extends AbstractSpruceTest {
|
|
|
176
197
|
this.assertDoesThrowInvalidParameters({ sampleRate }, ['sampleRate'])
|
|
177
198
|
}
|
|
178
199
|
|
|
179
|
-
private static
|
|
180
|
-
this.assertDoesThrowInvalidParameters(
|
|
181
|
-
|
|
182
|
-
|
|
200
|
+
private static assertThrowsInvalidChannelLabels(count: number) {
|
|
201
|
+
this.assertDoesThrowInvalidParameters(
|
|
202
|
+
{ channelLabels: new Array(count).fill(generateId()) },
|
|
203
|
+
['channelLabels']
|
|
204
|
+
)
|
|
183
205
|
}
|
|
184
206
|
|
|
185
207
|
private static assertDoesThrowInvalidParameters(
|
|
@@ -207,6 +229,10 @@ class SpyLiblsl implements Liblsl {
|
|
|
207
229
|
public lastStreamInfoOptions?: CreateStreamInfoOptions
|
|
208
230
|
public outlet: LslBindingsOutlet = {} as LslBindingsOutlet
|
|
209
231
|
public streamInfo: LslBindingsStreamInfo = {} as LslBindingsStreamInfo
|
|
232
|
+
public lastAppendChannelsToStreamInfo?: {
|
|
233
|
+
info: LslBindingsStreamInfo
|
|
234
|
+
channels: LslChannel[]
|
|
235
|
+
}
|
|
210
236
|
|
|
211
237
|
public createStreamInfo(
|
|
212
238
|
options: CreateStreamInfoOptions
|
|
@@ -217,7 +243,12 @@ class SpyLiblsl implements Liblsl {
|
|
|
217
243
|
public appendChannelsToStreamInfo(
|
|
218
244
|
info: LslBindingsStreamInfo,
|
|
219
245
|
channels: LslChannel[]
|
|
220
|
-
): void {
|
|
246
|
+
): void {
|
|
247
|
+
this.lastAppendChannelsToStreamInfo = {
|
|
248
|
+
info,
|
|
249
|
+
channels,
|
|
250
|
+
}
|
|
251
|
+
}
|
|
221
252
|
|
|
222
253
|
public createOutlet(options: CreateOutletOptions): LslBindingsOutlet {
|
|
223
254
|
this.lastOutletOptions = options
|