softphone-vendor-headsets 2.5.1 → 2.5.2-develop.55

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.
Files changed (22) hide show
  1. package/dist/cjs/src/library/services/headset.js +3 -1
  2. package/dist/cjs/src/library/services/headset.js.map +1 -1
  3. package/dist/cjs/src/library/services/vendor-implementations/sennheiser/sennheiser.test.js +21 -0
  4. package/dist/cjs/src/library/services/vendor-implementations/sennheiser/sennheiser.test.js.map +1 -1
  5. package/dist/cjs/src/library/services/vendor-implementations/vbet/vbet.d.ts +6 -14
  6. package/dist/cjs/src/library/services/vendor-implementations/vbet/vbet.js +109 -303
  7. package/dist/cjs/src/library/services/vendor-implementations/vbet/vbet.js.map +1 -1
  8. package/dist/cjs/src/library/services/vendor-implementations/vbet/vbet.test.js +818 -473
  9. package/dist/cjs/src/library/services/vendor-implementations/vbet/vbet.test.js.map +1 -1
  10. package/dist/deploy-info.json +3 -3
  11. package/dist/es/src/library/services/headset.js +3 -1
  12. package/dist/es/src/library/services/headset.js.map +1 -1
  13. package/dist/es/src/library/services/vendor-implementations/sennheiser/sennheiser.test.js +21 -0
  14. package/dist/es/src/library/services/vendor-implementations/sennheiser/sennheiser.test.js.map +1 -1
  15. package/dist/es/src/library/services/vendor-implementations/vbet/vbet.d.ts +6 -14
  16. package/dist/es/src/library/services/vendor-implementations/vbet/vbet.js +109 -303
  17. package/dist/es/src/library/services/vendor-implementations/vbet/vbet.js.map +1 -1
  18. package/dist/es/src/library/services/vendor-implementations/vbet/vbet.test.js +820 -475
  19. package/dist/es/src/library/services/vendor-implementations/vbet/vbet.test.js.map +1 -1
  20. package/dist/softhphone-vendor-headsets.js +3 -3
  21. package/dist/softhphone-vendor-headsets.js.map +1 -1
  22. package/package.json +82 -79
@@ -12,8 +12,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
+ const webhid_sdk_1 = require("@vbet/webhid-sdk");
15
16
  const vbet_1 = __importDefault(require("./vbet"));
16
- const mockTestDevName = 'Test VBet Dev';
17
+ const mockTestDevName = 'VT Lync (340b:0020)';
17
18
  const mockDeviceList0 = [];
18
19
  const mockDeviceList1 = [
19
20
  {
@@ -29,166 +30,749 @@ const mockDeviceList1 = [
29
30
  });
30
31
  }),
31
32
  productName: mockTestDevName,
32
- productId: 0x0001,
33
+ productId: 13323,
33
34
  collections: [
34
35
  {
35
- usage: 0x0005,
36
- usagePage: 0x000b,
36
+ children: [],
37
+ featureReports: [],
37
38
  inputReports: [
38
39
  {
39
- reportId: 0x08,
40
+ items: [
41
+ {
42
+ hasNull: false,
43
+ hasPreferredState: true,
44
+ isAbsolute: true,
45
+ isArray: false,
46
+ isBufferedBytes: false,
47
+ isConstant: false,
48
+ isLinear: true,
49
+ isRange: false,
50
+ isVolatile: false,
51
+ logicalMaximum: 0,
52
+ logicalMinimum: 0,
53
+ physicalMaximum: 0,
54
+ physicalMinimum: 0,
55
+ reportCount: 1,
56
+ reportSize: 1,
57
+ unitExponent: 0,
58
+ unitFactorCurrentExponent: 0,
59
+ unitFactorLengthExponent: 0,
60
+ unitFactorLuminousIntensityExponent: 0,
61
+ unitFactorMassExponent: 0,
62
+ unitFactorTemperatureExponent: 0,
63
+ unitFactorTimeExponent: 0,
64
+ unitSystem: 'none',
65
+ usages: [786665],
66
+ wrap: false,
67
+ },
68
+ {
69
+ hasNull: false,
70
+ hasPreferredState: true,
71
+ isAbsolute: true,
72
+ isArray: false,
73
+ isBufferedBytes: false,
74
+ isConstant: false,
75
+ isLinear: true,
76
+ isRange: false,
77
+ isVolatile: false,
78
+ logicalMaximum: 0,
79
+ logicalMinimum: 0,
80
+ physicalMaximum: 0,
81
+ physicalMinimum: 0,
82
+ reportCount: 1,
83
+ reportSize: 1,
84
+ unitExponent: 0,
85
+ unitFactorCurrentExponent: 0,
86
+ unitFactorLengthExponent: 0,
87
+ unitFactorLuminousIntensityExponent: 0,
88
+ unitFactorMassExponent: 0,
89
+ unitFactorTemperatureExponent: 0,
90
+ unitFactorTimeExponent: 0,
91
+ unitSystem: 'none',
92
+ usages: [786666],
93
+ wrap: false,
94
+ },
95
+ {
96
+ hasNull: false,
97
+ hasPreferredState: true,
98
+ isAbsolute: false,
99
+ isArray: false,
100
+ isBufferedBytes: false,
101
+ isConstant: false,
102
+ isLinear: true,
103
+ isRange: false,
104
+ isVolatile: false,
105
+ logicalMaximum: 0,
106
+ logicalMinimum: 0,
107
+ physicalMaximum: 0,
108
+ physicalMinimum: 0,
109
+ reportCount: 6,
110
+ reportSize: 1,
111
+ unitExponent: 0,
112
+ unitFactorCurrentExponent: 0,
113
+ unitFactorLengthExponent: 0,
114
+ unitFactorLuminousIntensityExponent: 0,
115
+ unitFactorMassExponent: 0,
116
+ unitFactorTemperatureExponent: 0,
117
+ unitFactorTimeExponent: 0,
118
+ unitSystem: 'none',
119
+ usages: [786432],
120
+ wrap: false,
121
+ },
122
+ {
123
+ hasNull: false,
124
+ hasPreferredState: true,
125
+ isAbsolute: true,
126
+ isArray: true,
127
+ isBufferedBytes: false,
128
+ isConstant: true,
129
+ isLinear: true,
130
+ isRange: false,
131
+ isVolatile: false,
132
+ logicalMaximum: 0,
133
+ logicalMinimum: 0,
134
+ physicalMaximum: 0,
135
+ physicalMinimum: 0,
136
+ reportCount: 1,
137
+ reportSize: 112,
138
+ unitExponent: 0,
139
+ unitFactorCurrentExponent: 0,
140
+ unitFactorLengthExponent: 0,
141
+ unitFactorLuminousIntensityExponent: 0,
142
+ unitFactorMassExponent: 0,
143
+ unitFactorTemperatureExponent: 0,
144
+ unitFactorTimeExponent: 0,
145
+ unitSystem: 'none',
146
+ usages: [],
147
+ wrap: false,
148
+ },
149
+ ],
150
+ reportId: 5,
40
151
  },
41
152
  ],
42
- },
43
- ],
44
- },
45
- ];
46
- const mockDeviceList2 = [
47
- {
48
- open: jest.fn(),
49
- close: jest.fn(),
50
- addEventListener: jest.fn((name, callback) => {
51
- callback({
52
- reportId: 0x01,
53
- data: {
54
- getUint8: jest.fn(),
55
- },
56
- });
57
- }),
58
- productName: mockTestDevName,
59
- collections: [
60
- {
61
- usage: 0,
62
- usagePage: 0,
63
- },
64
- ],
65
- },
66
- ];
67
- const mockDeviceList3 = [
68
- {
69
- open: jest.fn(),
70
- close: jest.fn(),
71
- addEventListener: jest.fn((name, callback) => {
72
- callback({
73
- reportId: 0x01,
74
- data: {
75
- getUint8: jest.fn(),
76
- },
77
- });
78
- }),
79
- productName: mockTestDevName,
80
- collections: [
81
- {
82
- usage: 0x0005,
83
- usagePage: 0x000b,
84
- inputReports: [],
85
- },
86
- ],
87
- },
88
- ];
89
- const mockDeviceList5 = [
90
- {
91
- open: jest.fn(),
92
- close: jest.fn(),
93
- sendReport: jest.fn(),
94
- addEventListener: jest.fn((name, callback) => {
95
- callback({
96
- reportId: 0x01,
97
- data: {
98
- getUint8: jest.fn(),
99
- },
100
- });
101
- }),
102
- productName: mockTestDevName,
103
- productId: 0x0020,
104
- collections: [
105
- {
106
- usage: 0x0005,
107
- usagePage: 0x000b,
108
- inputReports: [
153
+ outputReports: [
109
154
  {
110
- reportId: 0x01,
155
+ items: [
156
+ {
157
+ hasNull: false,
158
+ hasPreferredState: true,
159
+ isAbsolute: true,
160
+ isArray: false,
161
+ isBufferedBytes: false,
162
+ isConstant: false,
163
+ isLinear: true,
164
+ isRange: false,
165
+ isVolatile: false,
166
+ logicalMaximum: -1,
167
+ logicalMinimum: 0,
168
+ physicalMaximum: 0,
169
+ physicalMinimum: 0,
170
+ reportCount: 15,
171
+ reportSize: 8,
172
+ unitExponent: 0,
173
+ unitFactorCurrentExponent: 0,
174
+ unitFactorLengthExponent: 0,
175
+ unitFactorLuminousIntensityExponent: 0,
176
+ unitFactorMassExponent: 0,
177
+ unitFactorTemperatureExponent: 0,
178
+ unitFactorTimeExponent: 0,
179
+ unitSystem: 'none',
180
+ usages: [786432],
181
+ wrap: false,
182
+ },
183
+ ],
184
+ reportId: 5,
111
185
  },
112
186
  ],
187
+ type: 0,
188
+ usage: 1,
189
+ usagePage: 12,
113
190
  },
114
- ],
115
- },
116
- ];
117
- const mockDeviceList6 = [
118
- {
119
- open: jest.fn(),
120
- close: jest.fn(),
121
- sendReport: jest.fn(),
122
- addEventListener: jest.fn((name, callback) => {
123
- callback({
124
- reportId: 0x01,
125
- data: {
126
- getUint8: jest.fn(),
127
- },
128
- });
129
- }),
130
- productName: mockTestDevName,
131
- productId: 0x0014,
132
- collections: [
133
191
  {
134
- usage: 0x0005,
135
- usagePage: 0x000b,
192
+ children: [],
193
+ featureReports: [],
136
194
  inputReports: [
137
195
  {
138
- reportId: 0x01,
196
+ items: [
197
+ {
198
+ hasNull: false,
199
+ hasPreferredState: true,
200
+ isAbsolute: true,
201
+ isArray: false,
202
+ isBufferedBytes: false,
203
+ isConstant: false,
204
+ isLinear: true,
205
+ isRange: false,
206
+ isVolatile: false,
207
+ logicalMaximum: 0,
208
+ logicalMinimum: 0,
209
+ physicalMaximum: 0,
210
+ physicalMinimum: 0,
211
+ reportCount: 1,
212
+ reportSize: 1,
213
+ unitExponent: 0,
214
+ unitFactorCurrentExponent: 0,
215
+ unitFactorLengthExponent: 0,
216
+ unitFactorLuminousIntensityExponent: 0,
217
+ unitFactorMassExponent: 0,
218
+ unitFactorTemperatureExponent: 0,
219
+ unitFactorTimeExponent: 0,
220
+ unitSystem: 'none',
221
+ usages: [720935],
222
+ wrap: false,
223
+ },
224
+ {
225
+ hasNull: false,
226
+ hasPreferredState: true,
227
+ isAbsolute: false,
228
+ isArray: false,
229
+ isBufferedBytes: false,
230
+ isConstant: false,
231
+ isLinear: true,
232
+ isRange: false,
233
+ isVolatile: false,
234
+ logicalMaximum: 0,
235
+ logicalMinimum: 0,
236
+ physicalMaximum: 0,
237
+ physicalMinimum: 0,
238
+ reportCount: 1,
239
+ reportSize: 1,
240
+ unitExponent: 0,
241
+ unitFactorCurrentExponent: 0,
242
+ unitFactorLengthExponent: 0,
243
+ unitFactorLuminousIntensityExponent: 0,
244
+ unitFactorMassExponent: 0,
245
+ unitFactorTemperatureExponent: 0,
246
+ unitFactorTimeExponent: 0,
247
+ unitSystem: 'none',
248
+ usages: [720931],
249
+ wrap: false,
250
+ },
251
+ {
252
+ hasNull: false,
253
+ hasPreferredState: true,
254
+ isAbsolute: true,
255
+ isArray: false,
256
+ isBufferedBytes: false,
257
+ isConstant: false,
258
+ isLinear: true,
259
+ isRange: false,
260
+ isVolatile: false,
261
+ logicalMaximum: 0,
262
+ logicalMinimum: 0,
263
+ physicalMaximum: 0,
264
+ physicalMinimum: 0,
265
+ reportCount: 1,
266
+ reportSize: 1,
267
+ unitExponent: 0,
268
+ unitFactorCurrentExponent: 0,
269
+ unitFactorLengthExponent: 0,
270
+ unitFactorLuminousIntensityExponent: 0,
271
+ unitFactorMassExponent: 0,
272
+ unitFactorTemperatureExponent: 0,
273
+ unitFactorTimeExponent: 0,
274
+ unitSystem: 'none',
275
+ usages: [720928],
276
+ wrap: false,
277
+ },
278
+ {
279
+ hasNull: false,
280
+ hasPreferredState: true,
281
+ isAbsolute: false,
282
+ isArray: false,
283
+ isBufferedBytes: false,
284
+ isConstant: false,
285
+ isLinear: true,
286
+ isRange: false,
287
+ isVolatile: false,
288
+ logicalMaximum: 0,
289
+ logicalMinimum: 0,
290
+ physicalMaximum: 0,
291
+ physicalMinimum: 0,
292
+ reportCount: 1,
293
+ reportSize: 1,
294
+ unitExponent: 0,
295
+ unitFactorCurrentExponent: 0,
296
+ unitFactorLengthExponent: 0,
297
+ unitFactorLuminousIntensityExponent: 0,
298
+ unitFactorMassExponent: 0,
299
+ unitFactorTemperatureExponent: 0,
300
+ unitFactorTimeExponent: 0,
301
+ unitSystem: 'none',
302
+ usages: [720943],
303
+ wrap: false,
304
+ },
305
+ {
306
+ hasNull: false,
307
+ hasPreferredState: true,
308
+ isAbsolute: true,
309
+ isArray: false,
310
+ isBufferedBytes: false,
311
+ isConstant: false,
312
+ isLinear: true,
313
+ isRange: false,
314
+ isVolatile: false,
315
+ logicalMaximum: 0,
316
+ logicalMinimum: 0,
317
+ physicalMaximum: 0,
318
+ physicalMinimum: 0,
319
+ reportCount: 1,
320
+ reportSize: 1,
321
+ unitExponent: 0,
322
+ unitFactorCurrentExponent: 0,
323
+ unitFactorLengthExponent: 0,
324
+ unitFactorLuminousIntensityExponent: 0,
325
+ unitFactorMassExponent: 0,
326
+ unitFactorTemperatureExponent: 0,
327
+ unitFactorTimeExponent: 0,
328
+ unitSystem: 'none',
329
+ usages: [721047],
330
+ wrap: false,
331
+ },
332
+ {
333
+ hasNull: false,
334
+ hasPreferredState: true,
335
+ isAbsolute: true,
336
+ isArray: false,
337
+ isBufferedBytes: false,
338
+ isConstant: false,
339
+ isLinear: true,
340
+ isRange: false,
341
+ isVolatile: false,
342
+ logicalMaximum: 0,
343
+ logicalMinimum: 0,
344
+ physicalMaximum: 0,
345
+ physicalMinimum: 0,
346
+ reportCount: 1,
347
+ reportSize: 1,
348
+ unitExponent: 0,
349
+ unitFactorCurrentExponent: 0,
350
+ unitFactorLengthExponent: 0,
351
+ unitFactorLuminousIntensityExponent: 0,
352
+ unitFactorMassExponent: 0,
353
+ unitFactorTemperatureExponent: 0,
354
+ unitFactorTimeExponent: 0,
355
+ unitSystem: 'none',
356
+ usages: [589831],
357
+ wrap: false,
358
+ },
359
+ {
360
+ hasNull: false,
361
+ hasPreferredState: true,
362
+ isAbsolute: true,
363
+ isArray: false,
364
+ isBufferedBytes: false,
365
+ isConstant: false,
366
+ isLinear: true,
367
+ isRange: false,
368
+ isVolatile: false,
369
+ logicalMaximum: 0,
370
+ logicalMinimum: 0,
371
+ physicalMaximum: 0,
372
+ physicalMinimum: 0,
373
+ reportCount: 1,
374
+ reportSize: 1,
375
+ unitExponent: 0,
376
+ unitFactorCurrentExponent: 0,
377
+ unitFactorLengthExponent: 0,
378
+ unitFactorLuminousIntensityExponent: 0,
379
+ unitFactorMassExponent: 0,
380
+ unitFactorTemperatureExponent: 0,
381
+ unitFactorTimeExponent: 0,
382
+ unitSystem: 'none',
383
+ usages: [720929],
384
+ wrap: false,
385
+ },
386
+ {
387
+ hasNull: false,
388
+ hasPreferredState: true,
389
+ isAbsolute: true,
390
+ isArray: false,
391
+ isBufferedBytes: false,
392
+ isConstant: false,
393
+ isLinear: true,
394
+ isRange: false,
395
+ isVolatile: false,
396
+ logicalMaximum: 0,
397
+ logicalMinimum: 0,
398
+ physicalMaximum: 0,
399
+ physicalMinimum: 0,
400
+ reportCount: 1,
401
+ reportSize: 1,
402
+ unitExponent: 0,
403
+ unitFactorCurrentExponent: 0,
404
+ unitFactorLengthExponent: 0,
405
+ unitFactorLuminousIntensityExponent: 0,
406
+ unitFactorMassExponent: 0,
407
+ unitFactorTemperatureExponent: 0,
408
+ unitFactorTimeExponent: 0,
409
+ unitSystem: 'none',
410
+ usages: [720896],
411
+ wrap: false,
412
+ },
413
+ {
414
+ hasNull: false,
415
+ hasPreferredState: true,
416
+ isAbsolute: false,
417
+ isArray: false,
418
+ isBufferedBytes: false,
419
+ isConstant: false,
420
+ isLinear: true,
421
+ isRange: false,
422
+ isVolatile: false,
423
+ logicalMaximum: 1,
424
+ logicalMinimum: 0,
425
+ physicalMaximum: 0,
426
+ physicalMinimum: 0,
427
+ reportCount: 14,
428
+ reportSize: 8,
429
+ unitExponent: 0,
430
+ unitFactorCurrentExponent: 0,
431
+ unitFactorLengthExponent: 0,
432
+ unitFactorLuminousIntensityExponent: 0,
433
+ unitFactorMassExponent: 0,
434
+ unitFactorTemperatureExponent: 0,
435
+ unitFactorTimeExponent: 0,
436
+ unitSystem: 'none',
437
+ usages: [720896],
438
+ wrap: false,
439
+ },
440
+ ],
441
+ reportId: 1,
139
442
  },
140
443
  ],
141
- },
142
- ],
143
- },
144
- ];
145
- const mockDeviceList7 = [
146
- {
147
- open: jest.fn(),
148
- close: jest.fn(),
149
- sendReport: jest.fn(),
150
- addEventListener: jest.fn((name, callback) => {
151
- callback({
152
- reportId: 0x05,
153
- data: {
154
- getUint8: jest.fn(),
155
- },
156
- });
157
- }),
158
- productName: mockTestDevName,
159
- productId: 0x0040,
160
- collections: [
161
- {
162
- usage: 0x0005,
163
- usagePage: 0x000b,
164
- inputReports: [
444
+ outputReports: [
445
+ {
446
+ items: [
447
+ {
448
+ hasNull: false,
449
+ hasPreferredState: true,
450
+ isAbsolute: true,
451
+ isArray: false,
452
+ isBufferedBytes: false,
453
+ isConstant: false,
454
+ isLinear: true,
455
+ isRange: false,
456
+ isVolatile: false,
457
+ logicalMaximum: 1,
458
+ logicalMinimum: 0,
459
+ physicalMaximum: 0,
460
+ physicalMinimum: 0,
461
+ reportCount: 15,
462
+ reportSize: 8,
463
+ unitExponent: 0,
464
+ unitFactorCurrentExponent: 0,
465
+ unitFactorLengthExponent: 0,
466
+ unitFactorLuminousIntensityExponent: 0,
467
+ unitFactorMassExponent: 0,
468
+ unitFactorTemperatureExponent: 0,
469
+ unitFactorTimeExponent: 0,
470
+ unitSystem: 'none',
471
+ usages: [134152192],
472
+ wrap: false,
473
+ },
474
+ ],
475
+ reportId: 1,
476
+ },
477
+ {
478
+ items: [
479
+ {
480
+ hasNull: false,
481
+ hasPreferredState: false,
482
+ isAbsolute: true,
483
+ isArray: false,
484
+ isBufferedBytes: false,
485
+ isConstant: false,
486
+ isLinear: true,
487
+ isRange: false,
488
+ isVolatile: false,
489
+ logicalMaximum: 0,
490
+ logicalMinimum: 0,
491
+ physicalMaximum: 0,
492
+ physicalMinimum: 0,
493
+ reportCount: 1,
494
+ reportSize: 1,
495
+ unitExponent: 0,
496
+ unitFactorCurrentExponent: 0,
497
+ unitFactorLengthExponent: 0,
498
+ unitFactorLuminousIntensityExponent: 0,
499
+ unitFactorMassExponent: 0,
500
+ unitFactorTemperatureExponent: 0,
501
+ unitFactorTimeExponent: 0,
502
+ unitSystem: 'none',
503
+ usages: [524311],
504
+ wrap: false,
505
+ },
506
+ {
507
+ hasNull: false,
508
+ hasPreferredState: false,
509
+ isAbsolute: true,
510
+ isArray: false,
511
+ isBufferedBytes: false,
512
+ isConstant: false,
513
+ isLinear: true,
514
+ isRange: false,
515
+ isVolatile: false,
516
+ logicalMaximum: 0,
517
+ logicalMinimum: 0,
518
+ physicalMaximum: 0,
519
+ physicalMinimum: 0,
520
+ reportCount: 1,
521
+ reportSize: 1,
522
+ unitExponent: 0,
523
+ unitFactorCurrentExponent: 0,
524
+ unitFactorLengthExponent: 0,
525
+ unitFactorLuminousIntensityExponent: 0,
526
+ unitFactorMassExponent: 0,
527
+ unitFactorTemperatureExponent: 0,
528
+ unitFactorTimeExponent: 0,
529
+ unitSystem: 'none',
530
+ usages: [524320],
531
+ wrap: false,
532
+ },
533
+ {
534
+ hasNull: false,
535
+ hasPreferredState: false,
536
+ isAbsolute: true,
537
+ isArray: false,
538
+ isBufferedBytes: false,
539
+ isConstant: false,
540
+ isLinear: true,
541
+ isRange: false,
542
+ isVolatile: false,
543
+ logicalMaximum: 0,
544
+ logicalMinimum: 0,
545
+ physicalMaximum: 0,
546
+ physicalMinimum: 0,
547
+ reportCount: 1,
548
+ reportSize: 1,
549
+ unitExponent: 0,
550
+ unitFactorCurrentExponent: 0,
551
+ unitFactorLengthExponent: 0,
552
+ unitFactorLuminousIntensityExponent: 0,
553
+ unitFactorMassExponent: 0,
554
+ unitFactorTemperatureExponent: 0,
555
+ unitFactorTimeExponent: 0,
556
+ unitSystem: 'none',
557
+ usages: [524321],
558
+ wrap: false,
559
+ },
560
+ {
561
+ hasNull: false,
562
+ hasPreferredState: true,
563
+ isAbsolute: true,
564
+ isArray: true,
565
+ isBufferedBytes: false,
566
+ isConstant: true,
567
+ isLinear: true,
568
+ isRange: false,
569
+ isVolatile: false,
570
+ logicalMaximum: 0,
571
+ logicalMinimum: 0,
572
+ physicalMaximum: 0,
573
+ physicalMinimum: 0,
574
+ reportCount: 1,
575
+ reportSize: 117,
576
+ unitExponent: 0,
577
+ unitFactorCurrentExponent: 0,
578
+ unitFactorLengthExponent: 0,
579
+ unitFactorLuminousIntensityExponent: 0,
580
+ unitFactorMassExponent: 0,
581
+ unitFactorTemperatureExponent: 0,
582
+ unitFactorTimeExponent: 0,
583
+ unitSystem: 'none',
584
+ usages: [],
585
+ wrap: false,
586
+ },
587
+ ],
588
+ reportId: 2,
589
+ },
590
+ {
591
+ items: [
592
+ {
593
+ hasNull: false,
594
+ hasPreferredState: true,
595
+ isAbsolute: true,
596
+ isArray: false,
597
+ isBufferedBytes: false,
598
+ isConstant: false,
599
+ isLinear: true,
600
+ isRange: false,
601
+ isVolatile: false,
602
+ logicalMaximum: 0,
603
+ logicalMinimum: 0,
604
+ physicalMaximum: 0,
605
+ physicalMinimum: 0,
606
+ reportCount: 1,
607
+ reportSize: 1,
608
+ unitExponent: 0,
609
+ unitFactorCurrentExponent: 0,
610
+ unitFactorLengthExponent: 0,
611
+ unitFactorLuminousIntensityExponent: 0,
612
+ unitFactorMassExponent: 0,
613
+ unitFactorTemperatureExponent: 0,
614
+ unitFactorTimeExponent: 0,
615
+ unitSystem: 'none',
616
+ usages: [524297],
617
+ wrap: false,
618
+ },
619
+ {
620
+ hasNull: false,
621
+ hasPreferredState: true,
622
+ isAbsolute: true,
623
+ isArray: true,
624
+ isBufferedBytes: false,
625
+ isConstant: true,
626
+ isLinear: true,
627
+ isRange: false,
628
+ isVolatile: false,
629
+ logicalMaximum: 0,
630
+ logicalMinimum: 0,
631
+ physicalMaximum: 0,
632
+ physicalMinimum: 0,
633
+ reportCount: 1,
634
+ reportSize: 119,
635
+ unitExponent: 0,
636
+ unitFactorCurrentExponent: 0,
637
+ unitFactorLengthExponent: 0,
638
+ unitFactorLuminousIntensityExponent: 0,
639
+ unitFactorMassExponent: 0,
640
+ unitFactorTemperatureExponent: 0,
641
+ unitFactorTimeExponent: 0,
642
+ unitSystem: 'none',
643
+ usages: [],
644
+ wrap: false,
645
+ },
646
+ ],
647
+ reportId: 3,
648
+ },
649
+ {
650
+ items: [
651
+ {
652
+ hasNull: false,
653
+ hasPreferredState: true,
654
+ isAbsolute: true,
655
+ isArray: false,
656
+ isBufferedBytes: false,
657
+ isConstant: false,
658
+ isLinear: true,
659
+ isRange: false,
660
+ isVolatile: false,
661
+ logicalMaximum: 0,
662
+ logicalMinimum: 0,
663
+ physicalMaximum: 0,
664
+ physicalMinimum: 0,
665
+ reportCount: 1,
666
+ reportSize: 1,
667
+ unitExponent: 0,
668
+ unitFactorCurrentExponent: 0,
669
+ unitFactorLengthExponent: 0,
670
+ unitFactorLuminousIntensityExponent: 0,
671
+ unitFactorMassExponent: 0,
672
+ unitFactorTemperatureExponent: 0,
673
+ unitFactorTimeExponent: 0,
674
+ unitSystem: 'none',
675
+ usages: [524312],
676
+ wrap: false,
677
+ },
678
+ {
679
+ hasNull: false,
680
+ hasPreferredState: true,
681
+ isAbsolute: true,
682
+ isArray: true,
683
+ isBufferedBytes: false,
684
+ isConstant: true,
685
+ isLinear: true,
686
+ isRange: false,
687
+ isVolatile: false,
688
+ logicalMaximum: 0,
689
+ logicalMinimum: 0,
690
+ physicalMaximum: 0,
691
+ physicalMinimum: 0,
692
+ reportCount: 1,
693
+ reportSize: 119,
694
+ unitExponent: 0,
695
+ unitFactorCurrentExponent: 0,
696
+ unitFactorLengthExponent: 0,
697
+ unitFactorLuminousIntensityExponent: 0,
698
+ unitFactorMassExponent: 0,
699
+ unitFactorTemperatureExponent: 0,
700
+ unitFactorTimeExponent: 0,
701
+ unitSystem: 'none',
702
+ usages: [],
703
+ wrap: false,
704
+ },
705
+ ],
706
+ reportId: 4,
707
+ },
165
708
  {
166
- reportId: 0x05,
709
+ items: [
710
+ {
711
+ hasNull: false,
712
+ hasPreferredState: true,
713
+ isAbsolute: true,
714
+ isArray: false,
715
+ isBufferedBytes: false,
716
+ isConstant: false,
717
+ isLinear: true,
718
+ isRange: false,
719
+ isVolatile: false,
720
+ logicalMaximum: 0,
721
+ logicalMinimum: 0,
722
+ physicalMaximum: 0,
723
+ physicalMinimum: 0,
724
+ reportCount: 1,
725
+ reportSize: 1,
726
+ unitExponent: 0,
727
+ unitFactorCurrentExponent: 0,
728
+ unitFactorLengthExponent: 0,
729
+ unitFactorLuminousIntensityExponent: 0,
730
+ unitFactorMassExponent: 0,
731
+ unitFactorTemperatureExponent: 0,
732
+ unitFactorTimeExponent: 0,
733
+ unitSystem: 'none',
734
+ usages: [524358],
735
+ wrap: false,
736
+ },
737
+ {
738
+ hasNull: false,
739
+ hasPreferredState: true,
740
+ isAbsolute: true,
741
+ isArray: true,
742
+ isBufferedBytes: false,
743
+ isConstant: true,
744
+ isLinear: true,
745
+ isRange: false,
746
+ isVolatile: false,
747
+ logicalMaximum: 0,
748
+ logicalMinimum: 0,
749
+ physicalMaximum: 0,
750
+ physicalMinimum: 0,
751
+ reportCount: 1,
752
+ reportSize: 119,
753
+ unitExponent: 0,
754
+ unitFactorCurrentExponent: 0,
755
+ unitFactorLengthExponent: 0,
756
+ unitFactorLuminousIntensityExponent: 0,
757
+ unitFactorMassExponent: 0,
758
+ unitFactorTemperatureExponent: 0,
759
+ unitFactorTimeExponent: 0,
760
+ unitSystem: 'none',
761
+ usages: [],
762
+ wrap: false,
763
+ },
764
+ ],
765
+ reportId: 6,
167
766
  },
168
767
  ],
768
+ type: 0,
769
+ usage: 5,
770
+ usagePage: 11,
169
771
  },
170
772
  ],
171
773
  },
774
+ {}
172
775
  ];
173
- const mockOffhookFlag = {
174
- BT100USeries: 0x04,
175
- CMEDIASeries: 0x01,
176
- DECTSeries: 0x02,
177
- ACTIONSeries: 0x20,
178
- };
179
- const mockOnhookFlag = {
180
- BT100USeries: 0x00,
181
- CMEDIASeries: 0x00,
182
- DECTSeries: 0x00,
183
- ACTIONSeries: 0x00,
184
- };
185
- const mockMuteFlag = {
186
- BT100USeries: 0x0c,
187
- CMEDIASeries: 0x14,
188
- DECTSeries: [0x03, 0x04],
189
- ACTIONSeries: [0x05, 0x01],
190
- };
191
- const mockReject = { BT100USeries: 0x10, ACTIONSeries: 0x08 };
192
776
  describe('VBetservice', () => {
193
777
  let vbetService;
194
778
  let mockDeviceList = mockDeviceList0;
@@ -199,7 +783,7 @@ describe('VBetservice', () => {
199
783
  return mockDeviceList;
200
784
  },
201
785
  requestDevice: () => {
202
- mockDeviceList = mockReqDeviceList;
786
+ return mockReqDeviceList;
203
787
  },
204
788
  }),
205
789
  });
@@ -245,51 +829,6 @@ describe('VBetservice', () => {
245
829
  afterEach(() => {
246
830
  vbetService.disconnect();
247
831
  });
248
- it('should connect with previouslyConnectedDevice', () => __awaiter(void 0, void 0, void 0, function* () {
249
- const statusChangeSpy = jest.spyOn(vbetService, 'changeConnectionStatus');
250
- mockDeviceList = mockDeviceList1;
251
- yield vbetService.connect(mockTestDevName);
252
- const devName = vbetService.deviceInfo;
253
- expect(devName.ProductName).toBe(mockTestDevName);
254
- expect(statusChangeSpy).toHaveBeenCalledWith({ isConnected: true, isConnecting: false });
255
- }));
256
- it('already have active device', () => __awaiter(void 0, void 0, void 0, function* () {
257
- const statusChangeSpy = jest.spyOn(vbetService, 'changeConnectionStatus');
258
- mockDeviceList = mockDeviceList1;
259
- yield vbetService.connect(mockTestDevName);
260
- yield vbetService.connect(mockTestDevName);
261
- expect(statusChangeSpy).toHaveBeenCalledWith({ isConnected: true, isConnecting: false });
262
- }));
263
- it('device usage not match', () => __awaiter(void 0, void 0, void 0, function* () {
264
- const statusChangeSpy = jest.spyOn(vbetService, 'changeConnectionStatus');
265
- vbetService.requestWebHidPermissions = jest.fn((callback) => {
266
- mockReqDeviceList = mockDeviceList0;
267
- callback();
268
- });
269
- mockDeviceList = mockDeviceList2;
270
- yield vbetService.connect(mockTestDevName);
271
- expect(statusChangeSpy).toHaveBeenCalledWith({ isConnected: false, isConnecting: false });
272
- }));
273
- it('device inputReports is empty', () => __awaiter(void 0, void 0, void 0, function* () {
274
- vbetService.requestWebHidPermissions = jest.fn((callback) => {
275
- mockReqDeviceList = mockDeviceList0;
276
- callback();
277
- });
278
- mockDeviceList = mockDeviceList3;
279
- yield vbetService.connect(mockTestDevName);
280
- expect(vbetService.isConnected).toBe(true);
281
- expect(vbetService.isConnecting).toBe(false);
282
- }));
283
- it('previouslyConnectedDevice not have device', () => __awaiter(void 0, void 0, void 0, function* () {
284
- const statusChangeSpy = jest.spyOn(vbetService, 'changeConnectionStatus');
285
- vbetService.requestWebHidPermissions = jest.fn((callback) => {
286
- mockReqDeviceList = mockDeviceList0;
287
- callback();
288
- });
289
- mockDeviceList = mockDeviceList1;
290
- yield vbetService.connect('test');
291
- expect(statusChangeSpy).toHaveBeenCalledWith({ isConnected: false, isConnecting: false });
292
- }));
293
832
  it('webhidRequest, 30s timeout, failed to connect', () => __awaiter(void 0, void 0, void 0, function* () {
294
833
  const statusChangeSpy = jest.spyOn(vbetService, 'changeConnectionStatus');
295
834
  jest.useFakeTimers();
@@ -302,53 +841,55 @@ describe('VBetservice', () => {
302
841
  jest.clearAllTimers();
303
842
  jest.useRealTimers();
304
843
  }));
305
- it('webhidRequest, connect success', () => __awaiter(void 0, void 0, void 0, function* () {
844
+ it('webhidRequest, connect with previously connected device', () => __awaiter(void 0, void 0, void 0, function* () {
306
845
  const statusChangeSpy = jest.spyOn(vbetService, 'changeConnectionStatus');
307
- const requestSpy = (vbetService.requestWebHidPermissions = jest.fn((callback) => {
308
- mockReqDeviceList = mockDeviceList1;
309
- callback();
310
- }));
846
+ const requestSpy = (vbetService.requestWebHidPermissions = jest.fn());
847
+ mockDeviceList = mockDeviceList1;
311
848
  yield vbetService.connect(mockTestDevName);
312
- expect(requestSpy).toHaveBeenCalled();
849
+ const devName = vbetService.deviceInfo;
850
+ expect(devName.ProductName).toBe(mockTestDevName);
851
+ expect(requestSpy).not.toHaveBeenCalled();
313
852
  expect(statusChangeSpy).toHaveBeenCalledWith({ isConnected: true, isConnecting: false });
314
853
  }));
315
- it('webhidRequest, connect fail', () => __awaiter(void 0, void 0, void 0, function* () {
854
+ it('webhidRequest, connect with previously connected device but label not matched', () => __awaiter(void 0, void 0, void 0, function* () {
316
855
  const statusChangeSpy = jest.spyOn(vbetService, 'changeConnectionStatus');
317
856
  const requestSpy = (vbetService.requestWebHidPermissions = jest.fn((callback) => {
857
+ mockReqDeviceList = mockDeviceList1;
318
858
  callback();
319
859
  }));
320
- yield vbetService.connect(mockTestDevName);
860
+ mockDeviceList = mockDeviceList1;
861
+ yield vbetService.connect('random name');
862
+ const devName = vbetService.deviceInfo;
863
+ expect(devName.ProductName).toBe(mockTestDevName);
321
864
  expect(requestSpy).toHaveBeenCalled();
322
- expect(statusChangeSpy).toHaveBeenCalledWith({ isConnected: false, isConnecting: false });
865
+ expect(statusChangeSpy).toHaveBeenCalledWith({ isConnected: true, isConnecting: false });
323
866
  }));
324
- it('webhidRequest, connect fail, device name error', () => __awaiter(void 0, void 0, void 0, function* () {
867
+ it('webhidRequest, let users select from dev list if label not matched', () => __awaiter(void 0, void 0, void 0, function* () {
325
868
  const statusChangeSpy = jest.spyOn(vbetService, 'changeConnectionStatus');
326
869
  const requestSpy = (vbetService.requestWebHidPermissions = jest.fn((callback) => {
327
870
  mockReqDeviceList = mockDeviceList1;
328
871
  callback();
329
872
  }));
330
- yield vbetService.connect('test');
873
+ yield vbetService.connect('random name');
331
874
  expect(requestSpy).toHaveBeenCalled();
332
- expect(statusChangeSpy).toHaveBeenCalledWith({ isConnected: false, isConnecting: false });
875
+ expect(statusChangeSpy).toHaveBeenCalledWith({ isConnected: true, isConnecting: false });
333
876
  }));
334
- it('webhidRequest, connect fail, device usage error', () => __awaiter(void 0, void 0, void 0, function* () {
877
+ it('webhidRequest, let users select from dev list if label matched', () => __awaiter(void 0, void 0, void 0, function* () {
335
878
  const statusChangeSpy = jest.spyOn(vbetService, 'changeConnectionStatus');
336
879
  const requestSpy = (vbetService.requestWebHidPermissions = jest.fn((callback) => {
337
- mockReqDeviceList = mockDeviceList2;
880
+ mockReqDeviceList = mockDeviceList1;
338
881
  callback();
339
882
  }));
340
883
  yield vbetService.connect(mockTestDevName);
341
884
  expect(requestSpy).toHaveBeenCalled();
342
- expect(statusChangeSpy).toHaveBeenCalledWith({ isConnected: false, isConnecting: false });
885
+ expect(statusChangeSpy).toHaveBeenCalledWith({ isConnected: true, isConnecting: false });
343
886
  }));
344
- it('webhidRequest, device inputReports is empty', () => __awaiter(void 0, void 0, void 0, function* () {
345
- vbetService.requestWebHidPermissions = jest.fn((callback) => {
346
- mockReqDeviceList = mockDeviceList3;
347
- callback();
348
- });
887
+ it('webhidRequest, connect fail', () => __awaiter(void 0, void 0, void 0, function* () {
888
+ const statusChangeSpy = jest.spyOn(vbetService, 'changeConnectionStatus');
889
+ const requestSpy = (vbetService.requestWebHidPermissions = jest.fn((callback) => callback()));
349
890
  yield vbetService.connect(mockTestDevName);
350
- expect(vbetService.isConnected).toBe(true);
351
- expect(vbetService.isConnecting).toBe(false);
891
+ expect(requestSpy).toHaveBeenCalled();
892
+ expect(statusChangeSpy).toHaveBeenCalledWith({ isConnected: false, isConnecting: false });
352
893
  }));
353
894
  });
354
895
  describe('disconnect', () => {
@@ -361,7 +902,7 @@ describe('VBetservice', () => {
361
902
  expect(vbetService.isConnected).toBe(false);
362
903
  }));
363
904
  });
364
- describe('processBtnPress BT100USeries', () => {
905
+ describe('telephoney control', () => {
365
906
  beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
366
907
  mockDeviceList = mockDeviceList1;
367
908
  yield vbetService.connect(mockTestDevName);
@@ -370,309 +911,113 @@ describe('VBetservice', () => {
370
911
  yield vbetService.endAllCalls();
371
912
  yield vbetService.disconnect();
372
913
  }));
373
- it('activeDevice is null', () => __awaiter(void 0, void 0, void 0, function* () {
374
- const ansFun = jest.spyOn(vbetService, 'answerCall');
375
- yield vbetService.disconnect();
376
- yield vbetService.processBtnPress(mockOffhookFlag.BT100USeries);
377
- expect(ansFun).not.toHaveBeenCalled();
378
- }));
379
- it('test offhook', () => __awaiter(void 0, void 0, void 0, function* () {
914
+ it('accept inbound call', () => __awaiter(void 0, void 0, void 0, function* () {
380
915
  const ansFun = jest.spyOn(vbetService, 'answerCall');
381
916
  const devAnsFun = jest.spyOn(vbetService, 'deviceAnsweredCall');
382
917
  yield vbetService.incomingCall({ conversationId: 'id' });
383
- yield vbetService.processBtnPress(mockOffhookFlag.BT100USeries);
918
+ vbetService.processBtnPress(webhid_sdk_1.DeviceSignalType.ACCEPT_CALL);
384
919
  expect(ansFun).toHaveBeenCalled();
385
920
  expect(devAnsFun).toHaveBeenCalled();
386
921
  }));
387
- it('test offhook but no active conversion id', () => __awaiter(void 0, void 0, void 0, function* () {
388
- const ansFun = jest.spyOn(vbetService, 'sendOpToDevice');
389
- const devAnsFun = jest.spyOn(vbetService, 'deviceAnsweredCall');
390
- yield vbetService.processBtnPress(mockOffhookFlag.BT100USeries);
391
- expect(ansFun).not.toHaveBeenCalledWith('offHook');
392
- expect(devAnsFun).not.toHaveBeenCalled();
393
- }));
394
- it('test onhook', () => __awaiter(void 0, void 0, void 0, function* () {
395
- const ansFun = jest.spyOn(vbetService, 'endCallFromDevice');
396
- const devAnsFun = jest.spyOn(vbetService, 'deviceEndedCall');
397
- yield vbetService.incomingCall({ conversationId: 'id' });
398
- yield vbetService.processBtnPress(mockOffhookFlag.BT100USeries);
399
- yield vbetService.processBtnPress(mockOnhookFlag.BT100USeries);
400
- expect(ansFun).toHaveBeenCalled();
401
- expect(devAnsFun).toHaveBeenCalled();
402
- }));
403
- it('test onhook but no active conversion id', () => __awaiter(void 0, void 0, void 0, function* () {
404
- const ansFun = jest.spyOn(vbetService, 'sendOpToDevice');
405
- const devAnsFun = jest.spyOn(vbetService, 'deviceEndedCall');
406
- yield vbetService.incomingCall({ conversationId: 'id' });
407
- yield vbetService.processBtnPress(mockOffhookFlag.BT100USeries);
408
- vbetService.activeConversationId = null;
409
- yield vbetService.processBtnPress(mockOnhookFlag.BT100USeries);
410
- expect(ansFun).not.toHaveBeenCalledWith('onHook');
411
- expect(devAnsFun).not.toHaveBeenCalled();
412
- }));
413
- it('test mute', () => __awaiter(void 0, void 0, void 0, function* () {
414
- const setMuteFun = jest.spyOn(vbetService, 'setMute');
415
- const devMuteFun = jest.spyOn(vbetService, 'deviceMuteChanged');
416
- yield vbetService.incomingCall({ conversationId: 'id' });
417
- yield vbetService.processBtnPress(mockOffhookFlag.BT100USeries);
418
- yield vbetService.processBtnPress(mockMuteFlag.BT100USeries);
419
- expect(setMuteFun).toHaveBeenCalledWith(true);
420
- expect(devMuteFun).toHaveBeenCalledWith({
421
- isMuted: true,
422
- name: 'CallMuted',
423
- conversationId: 'id',
424
- });
425
- }));
426
- it('test unmute', () => __awaiter(void 0, void 0, void 0, function* () {
427
- const setMuteFun = jest.spyOn(vbetService, 'setMute');
428
- const devMuteFun = jest.spyOn(vbetService, 'deviceMuteChanged');
922
+ it('reject inbound call', () => __awaiter(void 0, void 0, void 0, function* () {
923
+ const rejFun = jest.spyOn(vbetService, 'rejectCall');
924
+ const devRejFun = jest.spyOn(vbetService, 'deviceRejectedCall');
429
925
  yield vbetService.incomingCall({ conversationId: 'id' });
430
- yield vbetService.processBtnPress(mockOffhookFlag.BT100USeries);
431
- yield vbetService.processBtnPress(mockMuteFlag.BT100USeries);
432
- yield vbetService.processBtnPress(mockMuteFlag.BT100USeries);
433
- expect(setMuteFun).toHaveBeenCalledTimes(2);
434
- expect(devMuteFun).toHaveBeenCalledTimes(2);
926
+ vbetService.processBtnPress(webhid_sdk_1.DeviceSignalType.REJECT_CALL);
927
+ expect(rejFun).toHaveBeenCalled();
928
+ expect(devRejFun).toHaveBeenCalled();
435
929
  }));
436
- it('test rejectCall', () => __awaiter(void 0, void 0, void 0, function* () {
437
- const devRejectFun = jest.spyOn(vbetService, 'deviceRejectedCall');
438
- const setRejectFun = jest.spyOn(vbetService, 'rejectCall');
439
- yield vbetService.incomingCall({ conversationId: 'id' });
440
- yield vbetService.processBtnPress(mockReject.BT100USeries);
441
- expect(devRejectFun).toHaveBeenCalledWith({ name: 'Reject', conversationId: 'id' });
442
- expect(setRejectFun).toHaveBeenCalled();
443
- }));
444
- it('test outgoing call', () => __awaiter(void 0, void 0, void 0, function* () {
445
- const ansFun = jest.spyOn(vbetService, 'endCallFromDevice');
446
- const devAnsFun = jest.spyOn(vbetService, 'deviceEndedCall');
930
+ it('end current call', () => __awaiter(void 0, void 0, void 0, function* () {
931
+ const endFun = jest.spyOn(vbetService, 'endCall');
932
+ const devEndFun = jest.spyOn(vbetService, 'deviceEndedCall');
447
933
  yield vbetService.outgoingCall({ conversationId: 'id' });
448
- yield vbetService.processBtnPress(mockOnhookFlag.BT100USeries);
449
- expect(ansFun).toHaveBeenCalled();
450
- expect(devAnsFun).toHaveBeenCalled();
451
- }));
452
- it('test auto answer call', () => __awaiter(void 0, void 0, void 0, function* () {
453
- const ansFun = jest.spyOn(vbetService, 'sendOpToDevice');
454
- yield vbetService.answerCall('id', true);
455
- expect(ansFun).toHaveBeenCalledWith('ring');
456
- expect(ansFun).toHaveBeenCalledWith('offHook');
457
- }));
458
- });
459
- describe('processBtnPress CMEDIASeries', () => {
460
- beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
461
- mockDeviceList = mockDeviceList5;
462
- yield vbetService.connect(mockTestDevName);
463
- }));
464
- afterEach(() => __awaiter(void 0, void 0, void 0, function* () {
465
- yield vbetService.endAllCalls();
466
- yield vbetService.disconnect();
934
+ vbetService.processBtnPress(webhid_sdk_1.DeviceSignalType.END_CALL);
935
+ expect(endFun).toHaveBeenCalled();
936
+ expect(devEndFun).toHaveBeenCalled();
467
937
  }));
468
- it('activeDevice is null', () => __awaiter(void 0, void 0, void 0, function* () {
469
- yield vbetService.disconnect();
470
- const ansFun = jest.spyOn(vbetService, 'answerCall');
471
- yield vbetService.processBtnPress(mockOffhookFlag.CMEDIASeries);
472
- expect(ansFun).not.toHaveBeenCalled();
473
- }));
474
- it('test offhook', () => __awaiter(void 0, void 0, void 0, function* () {
475
- const ansFun = jest.spyOn(vbetService, 'answerCall');
476
- const devAnsFun = jest.spyOn(vbetService, 'deviceAnsweredCall');
477
- yield vbetService.incomingCall({ conversationId: 'id' });
478
- yield vbetService.processBtnPress(mockOffhookFlag.CMEDIASeries);
479
- expect(ansFun).toHaveBeenCalled();
480
- expect(devAnsFun).toHaveBeenCalled();
481
- }));
482
- it('test mute', () => __awaiter(void 0, void 0, void 0, function* () {
483
- const setMuteFun = jest.spyOn(vbetService, 'setMute');
938
+ it('mute/unmute current call', () => __awaiter(void 0, void 0, void 0, function* () {
939
+ const muteFun = jest.spyOn(vbetService, 'setMute');
484
940
  const devMuteFun = jest.spyOn(vbetService, 'deviceMuteChanged');
485
- yield vbetService.incomingCall({ conversationId: 'id' });
486
- yield vbetService.processBtnPress(mockOffhookFlag.CMEDIASeries);
487
- yield vbetService.processBtnPress(mockMuteFlag.CMEDIASeries);
488
- expect(setMuteFun).toHaveBeenCalledWith(true);
941
+ yield vbetService.outgoingCall({ conversationId: 'id' });
942
+ vbetService.processBtnPress(webhid_sdk_1.DeviceSignalType.MUTE_CALL);
943
+ vbetService.processBtnPress(webhid_sdk_1.DeviceSignalType.UNMUTE_CALL);
944
+ expect(muteFun).toHaveBeenCalledTimes(2);
945
+ expect(devMuteFun).toHaveBeenCalledTimes(2);
946
+ expect(muteFun).toHaveBeenCalledWith(true);
489
947
  expect(devMuteFun).toHaveBeenCalledWith({
490
948
  isMuted: true,
491
949
  name: 'CallMuted',
492
950
  conversationId: 'id',
493
951
  });
494
- }));
495
- it('test mute', () => __awaiter(void 0, void 0, void 0, function* () {
496
- const setMuteFun = jest.spyOn(vbetService, 'setMute');
497
- const devMuteFun = jest.spyOn(vbetService, 'deviceMuteChanged');
498
- yield vbetService.incomingCall({ conversationId: 'id' });
499
- yield vbetService.processBtnPress(mockOffhookFlag.CMEDIASeries);
500
- yield vbetService.processBtnPress(0x08);
501
- yield vbetService.processBtnPress(0x00);
502
- expect(setMuteFun).toHaveBeenCalledWith(true);
952
+ expect(muteFun).toHaveBeenCalledWith(false);
503
953
  expect(devMuteFun).toHaveBeenCalledWith({
504
- isMuted: true,
505
- name: 'CallMuted',
954
+ isMuted: false,
955
+ name: 'CallUnmuted',
506
956
  conversationId: 'id',
507
957
  });
508
958
  }));
509
- it('test outgoing call', () => __awaiter(void 0, void 0, void 0, function* () {
510
- const ansFun = jest.spyOn(vbetService, 'endCallFromDevice');
511
- const devAnsFun = jest.spyOn(vbetService, 'deviceEndedCall');
512
- yield vbetService.outgoingCall({ conversationId: 'id' });
513
- yield vbetService.processBtnPress(mockOnhookFlag.CMEDIASeries);
514
- expect(ansFun).toHaveBeenCalled();
515
- expect(devAnsFun).toHaveBeenCalled();
516
- }));
517
- });
518
- describe('processBtnPress DECTSeries', () => {
519
- beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
520
- mockDeviceList = mockDeviceList6;
521
- yield vbetService.connect(mockTestDevName);
522
- }));
523
- afterEach(() => __awaiter(void 0, void 0, void 0, function* () {
524
- yield vbetService.endAllCalls();
525
- yield vbetService.disconnect();
526
- }));
527
- it('activeDevice is null', () => __awaiter(void 0, void 0, void 0, function* () {
528
- yield vbetService.disconnect();
529
- const ansFun = jest.spyOn(vbetService, 'answerCall');
530
- yield vbetService.processBtnPress(mockOffhookFlag.DECTSeries);
531
- expect(ansFun).not.toHaveBeenCalled();
532
- }));
533
- it('test offhook', () => __awaiter(void 0, void 0, void 0, function* () {
959
+ it('answer inbound call but no id', () => __awaiter(void 0, void 0, void 0, function* () {
534
960
  const ansFun = jest.spyOn(vbetService, 'answerCall');
535
961
  const devAnsFun = jest.spyOn(vbetService, 'deviceAnsweredCall');
536
- yield vbetService.incomingCall({ conversationId: 'id' });
537
- yield vbetService.processBtnPress(mockOffhookFlag.DECTSeries);
538
- expect(ansFun).toHaveBeenCalled();
539
- expect(devAnsFun).toHaveBeenCalled();
962
+ yield vbetService.incomingCall({ conversationId: '' });
963
+ vbetService.processBtnPress(webhid_sdk_1.DeviceSignalType.ACCEPT_CALL);
964
+ expect(ansFun).not.toHaveBeenCalled();
965
+ expect(devAnsFun).not.toHaveBeenCalled();
540
966
  }));
541
- it('test mute', () => __awaiter(void 0, void 0, void 0, function* () {
542
- const setMuteFun = jest.spyOn(vbetService, 'setMute');
543
- const devMuteFun = jest.spyOn(vbetService, 'deviceMuteChanged');
544
- yield vbetService.incomingCall({ conversationId: 'id' });
545
- yield vbetService.processBtnPress(mockOffhookFlag.DECTSeries);
546
- yield vbetService.processBtnPress(mockMuteFlag.DECTSeries[0]);
547
- expect(setMuteFun).toHaveBeenCalledWith(true);
548
- expect(devMuteFun).toHaveBeenCalledWith({
549
- isMuted: true,
550
- name: 'CallMuted',
551
- conversationId: 'id',
552
- });
967
+ it('end call but no id', () => __awaiter(void 0, void 0, void 0, function* () {
968
+ const endFun = jest.spyOn(vbetService, 'endCall');
969
+ const devEndFun = jest.spyOn(vbetService, 'deviceEndedCall');
970
+ yield vbetService.outgoingCall({ conversationId: 'id' });
971
+ yield vbetService.endCall('id');
972
+ vbetService.processBtnPress(webhid_sdk_1.DeviceSignalType.END_CALL);
973
+ expect(endFun).toHaveBeenCalledTimes(1);
974
+ expect(devEndFun).not.toHaveBeenCalled();
553
975
  }));
554
- it('test unmute', () => __awaiter(void 0, void 0, void 0, function* () {
555
- const setMuteFun = jest.spyOn(vbetService, 'setMute');
976
+ it('mute call but no id', () => __awaiter(void 0, void 0, void 0, function* () {
977
+ const muteFun = jest.spyOn(vbetService, 'setMute');
556
978
  const devMuteFun = jest.spyOn(vbetService, 'deviceMuteChanged');
557
- yield vbetService.incomingCall({ conversationId: 'id' });
558
- yield vbetService.processBtnPress(mockOffhookFlag.DECTSeries);
559
- yield vbetService.processBtnPress(mockMuteFlag.DECTSeries[1]);
560
- expect(setMuteFun).toHaveBeenCalledWith(false);
561
- expect(devMuteFun).toHaveBeenCalledWith({
562
- isMuted: false,
563
- name: 'CallUnmuted',
564
- conversationId: 'id',
565
- });
566
- }));
567
- it('test outgoing call', () => __awaiter(void 0, void 0, void 0, function* () {
568
- const ansFun = jest.spyOn(vbetService, 'endCallFromDevice');
569
- const devAnsFun = jest.spyOn(vbetService, 'deviceEndedCall');
570
979
  yield vbetService.outgoingCall({ conversationId: 'id' });
571
- yield vbetService.processBtnPress(mockOnhookFlag.DECTSeries);
572
- expect(ansFun).toHaveBeenCalled();
573
- expect(devAnsFun).toHaveBeenCalled();
980
+ vbetService.processBtnPress(webhid_sdk_1.DeviceSignalType.MUTE_CALL);
981
+ yield vbetService.endCall('id');
982
+ vbetService.processBtnPress(webhid_sdk_1.DeviceSignalType.MUTE_CALL);
983
+ expect(muteFun).toHaveBeenCalledTimes(1);
984
+ expect(devMuteFun).toHaveBeenCalledTimes(1);
574
985
  }));
575
- });
576
- describe('processBtnPress ACTIONSeries', () => {
577
- beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
578
- mockDeviceList = mockDeviceList7;
579
- yield vbetService.connect(mockTestDevName);
580
- }));
581
- afterEach(() => __awaiter(void 0, void 0, void 0, function* () {
986
+ it('reject call but no id', () => __awaiter(void 0, void 0, void 0, function* () {
987
+ const rejectFun = jest.spyOn(vbetService, 'rejectCall');
988
+ const devRejectFun = jest.spyOn(vbetService, 'deviceRejectedCall');
989
+ yield vbetService.incomingCall({ conversationId: 'id' });
582
990
  yield vbetService.endAllCalls();
583
- yield vbetService.disconnect();
584
- }));
585
- it('activeDevice is null', () => __awaiter(void 0, void 0, void 0, function* () {
586
- yield vbetService.disconnect();
587
- const ansFun = jest.spyOn(vbetService, 'answerCall');
588
- yield vbetService.processBtnPress(mockOffhookFlag.ACTIONSeries);
589
- expect(ansFun).not.toHaveBeenCalled();
991
+ vbetService.processBtnPress(webhid_sdk_1.DeviceSignalType.REJECT_CALL);
992
+ expect(rejectFun).not.toHaveBeenCalled();
993
+ expect(devRejectFun).not.toHaveBeenCalled();
590
994
  }));
591
- it('test offhook', () => __awaiter(void 0, void 0, void 0, function* () {
995
+ it('answer inbound call from ui but no id', () => __awaiter(void 0, void 0, void 0, function* () {
592
996
  const ansFun = jest.spyOn(vbetService, 'answerCall');
593
997
  const devAnsFun = jest.spyOn(vbetService, 'deviceAnsweredCall');
594
998
  yield vbetService.incomingCall({ conversationId: 'id' });
595
- yield vbetService.processBtnPress(mockOffhookFlag.ACTIONSeries);
999
+ vbetService.processBtnPress(webhid_sdk_1.DeviceSignalType.ACCEPT_CALL);
1000
+ vbetService.answerCall('id');
596
1001
  expect(ansFun).toHaveBeenCalled();
597
1002
  expect(devAnsFun).toHaveBeenCalled();
598
1003
  }));
599
- it('test reject', () => __awaiter(void 0, void 0, void 0, function* () {
600
- const ansFun = jest.spyOn(vbetService, 'rejectCall');
601
- const devAnsFun = jest.spyOn(vbetService, 'deviceRejectedCall');
602
- yield vbetService.incomingCall({ conversationId: 'id' });
603
- yield vbetService.processBtnPress(mockReject.ACTIONSeries);
604
- expect(ansFun).toHaveBeenCalled();
605
- expect(devAnsFun).toHaveBeenCalled();
606
- }));
607
- it('test mute', () => __awaiter(void 0, void 0, void 0, function* () {
608
- const setMuteFun = jest.spyOn(vbetService, 'setMute');
609
- const devMuteFun = jest.spyOn(vbetService, 'deviceMuteChanged');
610
- yield vbetService.incomingCall({ conversationId: 'id' });
611
- yield vbetService.processBtnPress(mockOffhookFlag.ACTIONSeries);
612
- yield vbetService.processBtnPress(mockMuteFlag.ACTIONSeries[0]);
613
- expect(setMuteFun).toHaveBeenCalledWith(true);
614
- expect(devMuteFun).toHaveBeenCalledWith({
615
- isMuted: true,
616
- name: 'CallMuted',
617
- conversationId: 'id',
618
- });
619
- }));
620
- it('test unmute', () => __awaiter(void 0, void 0, void 0, function* () {
621
- const setMuteFun = jest.spyOn(vbetService, 'setMute');
622
- const devMuteFun = jest.spyOn(vbetService, 'deviceMuteChanged');
1004
+ it('reject call from ui but no id', () => __awaiter(void 0, void 0, void 0, function* () {
1005
+ const rejectFun = jest.spyOn(vbetService, 'rejectCall');
1006
+ const devRejectFun = jest.spyOn(vbetService, 'deviceRejectedCall');
623
1007
  yield vbetService.incomingCall({ conversationId: 'id' });
624
- yield vbetService.processBtnPress(mockOffhookFlag.ACTIONSeries);
625
- yield vbetService.processBtnPress(mockMuteFlag.ACTIONSeries[1]);
626
- expect(setMuteFun).toHaveBeenCalledWith(false);
627
- expect(devMuteFun).toHaveBeenCalledWith({
628
- isMuted: false,
629
- name: 'CallUnmuted',
630
- conversationId: 'id',
631
- });
1008
+ vbetService.processBtnPress(webhid_sdk_1.DeviceSignalType.REJECT_CALL);
1009
+ vbetService.rejectCall('id');
1010
+ expect(rejectFun).toHaveBeenCalled();
1011
+ expect(devRejectFun).toHaveBeenCalled();
632
1012
  }));
633
- it('test outgoing call', () => __awaiter(void 0, void 0, void 0, function* () {
634
- const ansFun = jest.spyOn(vbetService, 'endCallFromDevice');
635
- const devAnsFun = jest.spyOn(vbetService, 'deviceEndedCall');
1013
+ it('end call from ui but no id', () => __awaiter(void 0, void 0, void 0, function* () {
1014
+ const endFun = jest.spyOn(vbetService, 'endCall');
1015
+ const devEndFun = jest.spyOn(vbetService, 'deviceEndedCall');
636
1016
  yield vbetService.outgoingCall({ conversationId: 'id' });
637
- yield vbetService.processBtnPress(mockOnhookFlag.ACTIONSeries);
638
- expect(ansFun).toHaveBeenCalled();
639
- expect(devAnsFun).toHaveBeenCalled();
640
- }));
641
- });
642
- describe('endcall from user interface', () => {
643
- beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
644
- mockDeviceList = mockDeviceList1;
645
- yield vbetService.connect(mockTestDevName);
646
- }));
647
- afterEach(() => __awaiter(void 0, void 0, void 0, function* () {
648
- yield vbetService.disconnect();
649
- }));
650
- it('test onhook', () => __awaiter(void 0, void 0, void 0, function* () {
651
- const ansFun = jest.spyOn(vbetService, 'sendOpToDevice');
652
- yield vbetService.incomingCall({ conversationId: 'id' });
653
- yield vbetService.processBtnPress(mockOffhookFlag.BT100USeries);
654
- yield vbetService.endCall('id', false);
655
- expect(ansFun).toHaveBeenCalledWith('onHook');
656
- }));
657
- it('test onhook with other active calls', () => __awaiter(void 0, void 0, void 0, function* () {
658
- const ansFun = jest.spyOn(vbetService, 'sendOpToDevice');
659
- yield vbetService.incomingCall({ conversationId: 'id' });
660
- yield vbetService.processBtnPress(mockOffhookFlag.BT100USeries);
661
- yield vbetService.endCall('id', true);
662
- expect(ansFun).not.toHaveBeenCalledWith('onHook');
663
- }));
664
- it('test onhook but no matching conversion id', () => __awaiter(void 0, void 0, void 0, function* () {
665
- const ansFun = jest.spyOn(vbetService, 'sendOpToDevice');
666
- yield vbetService.incomingCall({ conversationId: 'id' });
667
- yield vbetService.processBtnPress(mockOffhookFlag.BT100USeries);
668
- yield vbetService.endCall('dif', false);
669
- expect(ansFun).not.toHaveBeenCalledWith('onHook');
670
- }));
671
- it('test reject call but no pending conversion id', () => __awaiter(void 0, void 0, void 0, function* () {
672
- const ansFun = jest.spyOn(vbetService, 'sendOpToDevice');
673
- yield vbetService.incomingCall({ conversationId: '' });
674
- yield vbetService.rejectCall();
675
- expect(ansFun).not.toHaveBeenCalledWith('onHook');
1017
+ vbetService.processBtnPress(webhid_sdk_1.DeviceSignalType.END_CALL);
1018
+ vbetService.endCall('id');
1019
+ expect(endFun).toHaveBeenCalled();
1020
+ expect(devEndFun).toHaveBeenCalled();
676
1021
  }));
677
1022
  });
678
1023
  });