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