softphone-vendor-headsets 2.5.2-dev-mergeback.1 → 2.5.2-develop.56

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 (26) hide show
  1. package/dist/cjs/src/library/services/headset.js +3 -0
  2. package/dist/cjs/src/library/services/headset.js.map +1 -1
  3. package/dist/cjs/src/library/services/headset.test.js +17 -0
  4. package/dist/cjs/src/library/services/headset.test.js.map +1 -1
  5. package/dist/cjs/src/library/services/vendor-implementations/sennheiser/sennheiser.test.js +21 -0
  6. package/dist/cjs/src/library/services/vendor-implementations/sennheiser/sennheiser.test.js.map +1 -1
  7. package/dist/cjs/src/library/services/vendor-implementations/vbet/vbet.d.ts +6 -14
  8. package/dist/cjs/src/library/services/vendor-implementations/vbet/vbet.js +109 -303
  9. package/dist/cjs/src/library/services/vendor-implementations/vbet/vbet.js.map +1 -1
  10. package/dist/cjs/src/library/services/vendor-implementations/vbet/vbet.test.js +820 -476
  11. package/dist/cjs/src/library/services/vendor-implementations/vbet/vbet.test.js.map +1 -1
  12. package/dist/deploy-info.json +3 -3
  13. package/dist/es/src/library/services/headset.js +3 -0
  14. package/dist/es/src/library/services/headset.js.map +1 -1
  15. package/dist/es/src/library/services/headset.test.js +17 -0
  16. package/dist/es/src/library/services/headset.test.js.map +1 -1
  17. package/dist/es/src/library/services/vendor-implementations/sennheiser/sennheiser.test.js +21 -0
  18. package/dist/es/src/library/services/vendor-implementations/sennheiser/sennheiser.test.js.map +1 -1
  19. package/dist/es/src/library/services/vendor-implementations/vbet/vbet.d.ts +6 -14
  20. package/dist/es/src/library/services/vendor-implementations/vbet/vbet.js +109 -303
  21. package/dist/es/src/library/services/vendor-implementations/vbet/vbet.js.map +1 -1
  22. package/dist/es/src/library/services/vendor-implementations/vbet/vbet.test.js +820 -476
  23. package/dist/es/src/library/services/vendor-implementations/vbet/vbet.test.js.map +1 -1
  24. package/dist/softhphone-vendor-headsets.js +3 -3
  25. package/dist/softhphone-vendor-headsets.js.map +1 -1
  26. package/package.json +2 -1
@@ -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,748 @@ 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
+ },
165
477
  {
166
- reportId: 0x05,
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
+ },
708
+ {
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
+ }
172
774
  ];
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
775
  describe('VBetservice', () => {
193
776
  let vbetService;
194
777
  let mockDeviceList = mockDeviceList0;
@@ -199,7 +782,7 @@ describe('VBetservice', () => {
199
782
  return mockDeviceList;
200
783
  },
201
784
  requestDevice: () => {
202
- mockDeviceList = mockReqDeviceList;
785
+ return mockReqDeviceList;
203
786
  },
204
787
  }),
205
788
  });
@@ -245,51 +828,6 @@ describe('VBetservice', () => {
245
828
  afterEach(() => {
246
829
  vbetService.disconnect();
247
830
  });
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
831
  it('webhidRequest, 30s timeout, failed to connect', () => __awaiter(void 0, void 0, void 0, function* () {
294
832
  const statusChangeSpy = jest.spyOn(vbetService, 'changeConnectionStatus');
295
833
  jest.useFakeTimers();
@@ -302,53 +840,55 @@ describe('VBetservice', () => {
302
840
  jest.clearAllTimers();
303
841
  jest.useRealTimers();
304
842
  }));
305
- it('webhidRequest, connect success', () => __awaiter(void 0, void 0, void 0, function* () {
843
+ it('webhidRequest, connect with previously connected device', () => __awaiter(void 0, void 0, void 0, function* () {
306
844
  const statusChangeSpy = jest.spyOn(vbetService, 'changeConnectionStatus');
307
- const requestSpy = (vbetService.requestWebHidPermissions = jest.fn((callback) => {
308
- mockReqDeviceList = mockDeviceList1;
309
- callback();
310
- }));
845
+ const requestSpy = (vbetService.requestWebHidPermissions = jest.fn());
846
+ mockDeviceList = mockDeviceList1;
311
847
  yield vbetService.connect(mockTestDevName);
312
- expect(requestSpy).toHaveBeenCalled();
848
+ const devName = vbetService.deviceInfo;
849
+ expect(devName.ProductName).toBe(mockTestDevName);
850
+ expect(requestSpy).not.toHaveBeenCalled();
313
851
  expect(statusChangeSpy).toHaveBeenCalledWith({ isConnected: true, isConnecting: false });
314
852
  }));
315
- it('webhidRequest, connect fail', () => __awaiter(void 0, void 0, void 0, function* () {
853
+ it('webhidRequest, let users select from dev list if label not matched', () => __awaiter(void 0, void 0, void 0, function* () {
316
854
  const statusChangeSpy = jest.spyOn(vbetService, 'changeConnectionStatus');
317
855
  const requestSpy = (vbetService.requestWebHidPermissions = jest.fn((callback) => {
856
+ mockReqDeviceList = mockDeviceList1;
318
857
  callback();
319
858
  }));
320
- yield vbetService.connect(mockTestDevName);
859
+ yield vbetService.connect('random name');
321
860
  expect(requestSpy).toHaveBeenCalled();
322
- expect(statusChangeSpy).toHaveBeenCalledWith({ isConnected: false, isConnecting: false });
861
+ expect(statusChangeSpy).toHaveBeenCalledWith({ isConnected: true, isConnecting: false });
323
862
  }));
324
- it('webhidRequest, connect fail, device name error', () => __awaiter(void 0, void 0, void 0, function* () {
863
+ it('webhidRequest, connect with previously connected device but label not matched', () => __awaiter(void 0, void 0, void 0, function* () {
325
864
  const statusChangeSpy = jest.spyOn(vbetService, 'changeConnectionStatus');
326
865
  const requestSpy = (vbetService.requestWebHidPermissions = jest.fn((callback) => {
327
866
  mockReqDeviceList = mockDeviceList1;
328
867
  callback();
329
868
  }));
330
- yield vbetService.connect('test');
869
+ mockDeviceList = mockDeviceList1;
870
+ yield vbetService.connect('random name');
871
+ const devName = vbetService.deviceInfo;
872
+ expect(devName.ProductName).toBe(mockTestDevName);
331
873
  expect(requestSpy).toHaveBeenCalled();
332
- expect(statusChangeSpy).toHaveBeenCalledWith({ isConnected: false, isConnecting: false });
874
+ expect(statusChangeSpy).toHaveBeenCalledWith({ isConnected: true, isConnecting: false });
333
875
  }));
334
- it('webhidRequest, connect fail, device usage error', () => __awaiter(void 0, void 0, void 0, function* () {
876
+ it('webhidRequest, let users select from dev list if label matched', () => __awaiter(void 0, void 0, void 0, function* () {
335
877
  const statusChangeSpy = jest.spyOn(vbetService, 'changeConnectionStatus');
336
878
  const requestSpy = (vbetService.requestWebHidPermissions = jest.fn((callback) => {
337
- mockReqDeviceList = mockDeviceList2;
879
+ mockReqDeviceList = mockDeviceList1;
338
880
  callback();
339
881
  }));
340
882
  yield vbetService.connect(mockTestDevName);
341
883
  expect(requestSpy).toHaveBeenCalled();
342
- expect(statusChangeSpy).toHaveBeenCalledWith({ isConnected: false, isConnecting: false });
884
+ expect(statusChangeSpy).toHaveBeenCalledWith({ isConnected: true, isConnecting: false });
343
885
  }));
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
- });
886
+ it('webhidRequest, connect fail', () => __awaiter(void 0, void 0, void 0, function* () {
887
+ const statusChangeSpy = jest.spyOn(vbetService, 'changeConnectionStatus');
888
+ const requestSpy = (vbetService.requestWebHidPermissions = jest.fn((callback) => callback()));
349
889
  yield vbetService.connect(mockTestDevName);
350
- expect(vbetService.isConnected).toBe(true);
351
- expect(vbetService.isConnecting).toBe(false);
890
+ expect(requestSpy).toHaveBeenCalled();
891
+ expect(statusChangeSpy).toHaveBeenCalledWith({ isConnected: false, isConnecting: false });
352
892
  }));
353
893
  });
354
894
  describe('disconnect', () => {
@@ -361,7 +901,7 @@ describe('VBetservice', () => {
361
901
  expect(vbetService.isConnected).toBe(false);
362
902
  }));
363
903
  });
364
- describe('processBtnPress BT100USeries', () => {
904
+ describe('telephoney control', () => {
365
905
  beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
366
906
  mockDeviceList = mockDeviceList1;
367
907
  yield vbetService.connect(mockTestDevName);
@@ -370,309 +910,113 @@ describe('VBetservice', () => {
370
910
  yield vbetService.endAllCalls();
371
911
  yield vbetService.disconnect();
372
912
  }));
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* () {
913
+ it('accept inbound call', () => __awaiter(void 0, void 0, void 0, function* () {
380
914
  const ansFun = jest.spyOn(vbetService, 'answerCall');
381
915
  const devAnsFun = jest.spyOn(vbetService, 'deviceAnsweredCall');
382
916
  yield vbetService.incomingCall({ conversationId: 'id' });
383
- yield vbetService.processBtnPress(mockOffhookFlag.BT100USeries);
917
+ vbetService.processBtnPress(webhid_sdk_1.DeviceSignalType.ACCEPT_CALL);
384
918
  expect(ansFun).toHaveBeenCalled();
385
919
  expect(devAnsFun).toHaveBeenCalled();
386
920
  }));
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');
429
- 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);
435
- }));
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');
921
+ it('reject inbound call', () => __awaiter(void 0, void 0, void 0, function* () {
922
+ const rejFun = jest.spyOn(vbetService, 'rejectCall');
923
+ const devRejFun = jest.spyOn(vbetService, 'deviceRejectedCall');
439
924
  yield vbetService.incomingCall({ conversationId: 'id' });
440
- yield vbetService.processBtnPress(mockReject.BT100USeries);
441
- expect(devRejectFun).toHaveBeenCalledWith({ name: 'Reject', conversationId: 'id' });
442
- expect(setRejectFun).toHaveBeenCalled();
925
+ vbetService.processBtnPress(webhid_sdk_1.DeviceSignalType.REJECT_CALL);
926
+ expect(rejFun).toHaveBeenCalled();
927
+ expect(devRejFun).toHaveBeenCalled();
443
928
  }));
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');
929
+ it('end current call', () => __awaiter(void 0, void 0, void 0, function* () {
930
+ const endFun = jest.spyOn(vbetService, 'endCall');
931
+ const devEndFun = jest.spyOn(vbetService, 'deviceEndedCall');
447
932
  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');
933
+ vbetService.processBtnPress(webhid_sdk_1.DeviceSignalType.END_CALL);
934
+ expect(endFun).toHaveBeenCalled();
935
+ expect(devEndFun).toHaveBeenCalled();
457
936
  }));
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();
467
- }));
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');
937
+ it('mute/unmute current call', () => __awaiter(void 0, void 0, void 0, function* () {
938
+ const muteFun = jest.spyOn(vbetService, 'setMute');
484
939
  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);
940
+ yield vbetService.outgoingCall({ conversationId: 'id' });
941
+ vbetService.processBtnPress(webhid_sdk_1.DeviceSignalType.MUTE_CALL);
942
+ vbetService.processBtnPress(webhid_sdk_1.DeviceSignalType.UNMUTE_CALL);
943
+ expect(muteFun).toHaveBeenCalledTimes(2);
944
+ expect(devMuteFun).toHaveBeenCalledTimes(2);
945
+ expect(muteFun).toHaveBeenCalledWith(true);
489
946
  expect(devMuteFun).toHaveBeenCalledWith({
490
947
  isMuted: true,
491
948
  name: 'CallMuted',
492
949
  conversationId: 'id',
493
950
  });
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);
951
+ expect(muteFun).toHaveBeenCalledWith(false);
503
952
  expect(devMuteFun).toHaveBeenCalledWith({
504
- isMuted: true,
505
- name: 'CallMuted',
953
+ isMuted: false,
954
+ name: 'CallUnmuted',
506
955
  conversationId: 'id',
507
956
  });
508
957
  }));
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* () {
958
+ it('answer inbound call but no id', () => __awaiter(void 0, void 0, void 0, function* () {
534
959
  const ansFun = jest.spyOn(vbetService, 'answerCall');
535
960
  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();
961
+ yield vbetService.incomingCall({ conversationId: '' });
962
+ vbetService.processBtnPress(webhid_sdk_1.DeviceSignalType.ACCEPT_CALL);
963
+ expect(ansFun).not.toHaveBeenCalled();
964
+ expect(devAnsFun).not.toHaveBeenCalled();
540
965
  }));
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
- });
966
+ it('end call but no id', () => __awaiter(void 0, void 0, void 0, function* () {
967
+ const endFun = jest.spyOn(vbetService, 'endCall');
968
+ const devEndFun = jest.spyOn(vbetService, 'deviceEndedCall');
969
+ yield vbetService.outgoingCall({ conversationId: 'id' });
970
+ yield vbetService.endCall('id');
971
+ vbetService.processBtnPress(webhid_sdk_1.DeviceSignalType.END_CALL);
972
+ expect(endFun).toHaveBeenCalledTimes(1);
973
+ expect(devEndFun).not.toHaveBeenCalled();
553
974
  }));
554
- it('test unmute', () => __awaiter(void 0, void 0, void 0, function* () {
555
- const setMuteFun = jest.spyOn(vbetService, 'setMute');
975
+ it('mute call but no id', () => __awaiter(void 0, void 0, void 0, function* () {
976
+ const muteFun = jest.spyOn(vbetService, 'setMute');
556
977
  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
978
  yield vbetService.outgoingCall({ conversationId: 'id' });
571
- yield vbetService.processBtnPress(mockOnhookFlag.DECTSeries);
572
- expect(ansFun).toHaveBeenCalled();
573
- expect(devAnsFun).toHaveBeenCalled();
574
- }));
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* () {
979
+ vbetService.processBtnPress(webhid_sdk_1.DeviceSignalType.MUTE_CALL);
980
+ yield vbetService.endCall('id');
981
+ vbetService.processBtnPress(webhid_sdk_1.DeviceSignalType.MUTE_CALL);
982
+ expect(muteFun).toHaveBeenCalledTimes(1);
983
+ expect(devMuteFun).toHaveBeenCalledTimes(1);
984
+ }));
985
+ it('reject call but no id', () => __awaiter(void 0, void 0, void 0, function* () {
986
+ const rejectFun = jest.spyOn(vbetService, 'rejectCall');
987
+ const devRejectFun = jest.spyOn(vbetService, 'deviceRejectedCall');
988
+ yield vbetService.incomingCall({ conversationId: 'id' });
582
989
  yield vbetService.endAllCalls();
583
- yield vbetService.disconnect();
990
+ vbetService.processBtnPress(webhid_sdk_1.DeviceSignalType.REJECT_CALL);
991
+ expect(rejectFun).not.toHaveBeenCalled();
992
+ expect(devRejectFun).not.toHaveBeenCalled();
584
993
  }));
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();
590
- }));
591
- it('test offhook', () => __awaiter(void 0, void 0, void 0, function* () {
994
+ it('answer inbound call from ui but no id', () => __awaiter(void 0, void 0, void 0, function* () {
592
995
  const ansFun = jest.spyOn(vbetService, 'answerCall');
593
996
  const devAnsFun = jest.spyOn(vbetService, 'deviceAnsweredCall');
594
997
  yield vbetService.incomingCall({ conversationId: 'id' });
595
- yield vbetService.processBtnPress(mockOffhookFlag.ACTIONSeries);
998
+ vbetService.processBtnPress(webhid_sdk_1.DeviceSignalType.ACCEPT_CALL);
999
+ vbetService.answerCall('id');
596
1000
  expect(ansFun).toHaveBeenCalled();
597
1001
  expect(devAnsFun).toHaveBeenCalled();
598
1002
  }));
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');
1003
+ it('reject call from ui but no id', () => __awaiter(void 0, void 0, void 0, function* () {
1004
+ const rejectFun = jest.spyOn(vbetService, 'rejectCall');
1005
+ const devRejectFun = jest.spyOn(vbetService, 'deviceRejectedCall');
623
1006
  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
- });
632
- }));
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');
1007
+ vbetService.processBtnPress(webhid_sdk_1.DeviceSignalType.REJECT_CALL);
1008
+ vbetService.rejectCall('id');
1009
+ expect(rejectFun).toHaveBeenCalled();
1010
+ expect(devRejectFun).toHaveBeenCalled();
1011
+ }));
1012
+ it('end call from ui but no id', () => __awaiter(void 0, void 0, void 0, function* () {
1013
+ const endFun = jest.spyOn(vbetService, 'endCall');
1014
+ const devEndFun = jest.spyOn(vbetService, 'deviceEndedCall');
636
1015
  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');
1016
+ vbetService.processBtnPress(webhid_sdk_1.DeviceSignalType.END_CALL);
1017
+ vbetService.endCall('id');
1018
+ expect(endFun).toHaveBeenCalled();
1019
+ expect(devEndFun).toHaveBeenCalled();
676
1020
  }));
677
1021
  });
678
1022
  });