softphone-vendor-headsets 2.5.2-dev-mergeback.1 → 2.5.2-develop.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/src/library/services/vendor-implementations/sennheiser/sennheiser.test.js +21 -0
- package/dist/cjs/src/library/services/vendor-implementations/sennheiser/sennheiser.test.js.map +1 -1
- package/dist/cjs/src/library/services/vendor-implementations/vbet/vbet.d.ts +6 -14
- package/dist/cjs/src/library/services/vendor-implementations/vbet/vbet.js +109 -303
- package/dist/cjs/src/library/services/vendor-implementations/vbet/vbet.js.map +1 -1
- package/dist/cjs/src/library/services/vendor-implementations/vbet/vbet.test.js +818 -473
- package/dist/cjs/src/library/services/vendor-implementations/vbet/vbet.test.js.map +1 -1
- package/dist/deploy-info.json +3 -3
- package/dist/es/src/library/services/vendor-implementations/sennheiser/sennheiser.test.js +21 -0
- package/dist/es/src/library/services/vendor-implementations/sennheiser/sennheiser.test.js.map +1 -1
- package/dist/es/src/library/services/vendor-implementations/vbet/vbet.d.ts +6 -14
- package/dist/es/src/library/services/vendor-implementations/vbet/vbet.js +109 -303
- package/dist/es/src/library/services/vendor-implementations/vbet/vbet.js.map +1 -1
- package/dist/es/src/library/services/vendor-implementations/vbet/vbet.test.js +820 -475
- package/dist/es/src/library/services/vendor-implementations/vbet/vbet.test.js.map +1 -1
- package/dist/softhphone-vendor-headsets.js +3 -3
- package/dist/softhphone-vendor-headsets.js.map +1 -1
- 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 = '
|
|
12
|
+
const mockTestDevName = 'VT Lync (340b:0020)';
|
|
12
13
|
const mockDeviceList0 = [];
|
|
13
14
|
const mockDeviceList1 = [
|
|
14
15
|
{
|
|
@@ -24,166 +25,749 @@ const mockDeviceList1 = [
|
|
|
24
25
|
});
|
|
25
26
|
}),
|
|
26
27
|
productName: mockTestDevName,
|
|
27
|
-
productId:
|
|
28
|
+
productId: 13323,
|
|
28
29
|
collections: [
|
|
29
30
|
{
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
children: [],
|
|
32
|
+
featureReports: [],
|
|
32
33
|
inputReports: [
|
|
33
34
|
{
|
|
34
|
-
|
|
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
|
-
|
|
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
|
-
|
|
130
|
-
|
|
187
|
+
children: [],
|
|
188
|
+
featureReports: [],
|
|
131
189
|
inputReports: [
|
|
132
190
|
{
|
|
133
|
-
|
|
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
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
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
|
+
},
|
|
472
|
+
{
|
|
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
|
+
},
|
|
160
703
|
{
|
|
161
|
-
|
|
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
|
},
|
|
769
|
+
{}
|
|
167
770
|
];
|
|
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
771
|
describe('VBetservice', () => {
|
|
188
772
|
let vbetService;
|
|
189
773
|
let mockDeviceList = mockDeviceList0;
|
|
@@ -194,7 +778,7 @@ describe('VBetservice', () => {
|
|
|
194
778
|
return mockDeviceList;
|
|
195
779
|
},
|
|
196
780
|
requestDevice: () => {
|
|
197
|
-
|
|
781
|
+
return mockReqDeviceList;
|
|
198
782
|
},
|
|
199
783
|
}),
|
|
200
784
|
});
|
|
@@ -240,51 +824,6 @@ describe('VBetservice', () => {
|
|
|
240
824
|
afterEach(() => {
|
|
241
825
|
vbetService.disconnect();
|
|
242
826
|
});
|
|
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
827
|
it('webhidRequest, 30s timeout, failed to connect', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
289
828
|
const statusChangeSpy = jest.spyOn(vbetService, 'changeConnectionStatus');
|
|
290
829
|
jest.useFakeTimers();
|
|
@@ -297,53 +836,55 @@ describe('VBetservice', () => {
|
|
|
297
836
|
jest.clearAllTimers();
|
|
298
837
|
jest.useRealTimers();
|
|
299
838
|
}));
|
|
300
|
-
it('webhidRequest, connect
|
|
839
|
+
it('webhidRequest, connect with previously connected device', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
301
840
|
const statusChangeSpy = jest.spyOn(vbetService, 'changeConnectionStatus');
|
|
302
|
-
const requestSpy = (vbetService.requestWebHidPermissions = jest.fn(
|
|
303
|
-
|
|
304
|
-
callback();
|
|
305
|
-
}));
|
|
841
|
+
const requestSpy = (vbetService.requestWebHidPermissions = jest.fn());
|
|
842
|
+
mockDeviceList = mockDeviceList1;
|
|
306
843
|
yield vbetService.connect(mockTestDevName);
|
|
307
|
-
|
|
844
|
+
const devName = vbetService.deviceInfo;
|
|
845
|
+
expect(devName.ProductName).toBe(mockTestDevName);
|
|
846
|
+
expect(requestSpy).not.toHaveBeenCalled();
|
|
308
847
|
expect(statusChangeSpy).toHaveBeenCalledWith({ isConnected: true, isConnecting: false });
|
|
309
848
|
}));
|
|
310
|
-
it('webhidRequest, connect
|
|
849
|
+
it('webhidRequest, connect with previously connected device but label not matched', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
311
850
|
const statusChangeSpy = jest.spyOn(vbetService, 'changeConnectionStatus');
|
|
312
851
|
const requestSpy = (vbetService.requestWebHidPermissions = jest.fn((callback) => {
|
|
852
|
+
mockReqDeviceList = mockDeviceList1;
|
|
313
853
|
callback();
|
|
314
854
|
}));
|
|
315
|
-
|
|
855
|
+
mockDeviceList = mockDeviceList1;
|
|
856
|
+
yield vbetService.connect('random name');
|
|
857
|
+
const devName = vbetService.deviceInfo;
|
|
858
|
+
expect(devName.ProductName).toBe(mockTestDevName);
|
|
316
859
|
expect(requestSpy).toHaveBeenCalled();
|
|
317
|
-
expect(statusChangeSpy).toHaveBeenCalledWith({ isConnected:
|
|
860
|
+
expect(statusChangeSpy).toHaveBeenCalledWith({ isConnected: true, isConnecting: false });
|
|
318
861
|
}));
|
|
319
|
-
it('webhidRequest,
|
|
862
|
+
it('webhidRequest, let users select from dev list if label not matched', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
320
863
|
const statusChangeSpy = jest.spyOn(vbetService, 'changeConnectionStatus');
|
|
321
864
|
const requestSpy = (vbetService.requestWebHidPermissions = jest.fn((callback) => {
|
|
322
865
|
mockReqDeviceList = mockDeviceList1;
|
|
323
866
|
callback();
|
|
324
867
|
}));
|
|
325
|
-
yield vbetService.connect('
|
|
868
|
+
yield vbetService.connect('random name');
|
|
326
869
|
expect(requestSpy).toHaveBeenCalled();
|
|
327
|
-
expect(statusChangeSpy).toHaveBeenCalledWith({ isConnected:
|
|
870
|
+
expect(statusChangeSpy).toHaveBeenCalledWith({ isConnected: true, isConnecting: false });
|
|
328
871
|
}));
|
|
329
|
-
it('webhidRequest,
|
|
872
|
+
it('webhidRequest, let users select from dev list if label matched', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
330
873
|
const statusChangeSpy = jest.spyOn(vbetService, 'changeConnectionStatus');
|
|
331
874
|
const requestSpy = (vbetService.requestWebHidPermissions = jest.fn((callback) => {
|
|
332
|
-
mockReqDeviceList =
|
|
875
|
+
mockReqDeviceList = mockDeviceList1;
|
|
333
876
|
callback();
|
|
334
877
|
}));
|
|
335
878
|
yield vbetService.connect(mockTestDevName);
|
|
336
879
|
expect(requestSpy).toHaveBeenCalled();
|
|
337
|
-
expect(statusChangeSpy).toHaveBeenCalledWith({ isConnected:
|
|
880
|
+
expect(statusChangeSpy).toHaveBeenCalledWith({ isConnected: true, isConnecting: false });
|
|
338
881
|
}));
|
|
339
|
-
it('webhidRequest,
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
callback();
|
|
343
|
-
});
|
|
882
|
+
it('webhidRequest, connect fail', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
883
|
+
const statusChangeSpy = jest.spyOn(vbetService, 'changeConnectionStatus');
|
|
884
|
+
const requestSpy = (vbetService.requestWebHidPermissions = jest.fn((callback) => callback()));
|
|
344
885
|
yield vbetService.connect(mockTestDevName);
|
|
345
|
-
expect(
|
|
346
|
-
expect(
|
|
886
|
+
expect(requestSpy).toHaveBeenCalled();
|
|
887
|
+
expect(statusChangeSpy).toHaveBeenCalledWith({ isConnected: false, isConnecting: false });
|
|
347
888
|
}));
|
|
348
889
|
});
|
|
349
890
|
describe('disconnect', () => {
|
|
@@ -356,7 +897,7 @@ describe('VBetservice', () => {
|
|
|
356
897
|
expect(vbetService.isConnected).toBe(false);
|
|
357
898
|
}));
|
|
358
899
|
});
|
|
359
|
-
describe('
|
|
900
|
+
describe('telephoney control', () => {
|
|
360
901
|
beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
361
902
|
mockDeviceList = mockDeviceList1;
|
|
362
903
|
yield vbetService.connect(mockTestDevName);
|
|
@@ -365,309 +906,113 @@ describe('VBetservice', () => {
|
|
|
365
906
|
yield vbetService.endAllCalls();
|
|
366
907
|
yield vbetService.disconnect();
|
|
367
908
|
}));
|
|
368
|
-
it('
|
|
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* () {
|
|
909
|
+
it('accept inbound call', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
375
910
|
const ansFun = jest.spyOn(vbetService, 'answerCall');
|
|
376
911
|
const devAnsFun = jest.spyOn(vbetService, 'deviceAnsweredCall');
|
|
377
912
|
yield vbetService.incomingCall({ conversationId: 'id' });
|
|
378
|
-
|
|
913
|
+
vbetService.processBtnPress(DeviceSignalType.ACCEPT_CALL);
|
|
379
914
|
expect(ansFun).toHaveBeenCalled();
|
|
380
915
|
expect(devAnsFun).toHaveBeenCalled();
|
|
381
916
|
}));
|
|
382
|
-
it('
|
|
383
|
-
const
|
|
384
|
-
const
|
|
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');
|
|
917
|
+
it('reject inbound call', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
918
|
+
const rejFun = jest.spyOn(vbetService, 'rejectCall');
|
|
919
|
+
const devRejFun = jest.spyOn(vbetService, 'deviceRejectedCall');
|
|
424
920
|
yield vbetService.incomingCall({ conversationId: 'id' });
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
expect(setMuteFun).toHaveBeenCalledTimes(2);
|
|
429
|
-
expect(devMuteFun).toHaveBeenCalledTimes(2);
|
|
921
|
+
vbetService.processBtnPress(DeviceSignalType.REJECT_CALL);
|
|
922
|
+
expect(rejFun).toHaveBeenCalled();
|
|
923
|
+
expect(devRejFun).toHaveBeenCalled();
|
|
430
924
|
}));
|
|
431
|
-
it('
|
|
432
|
-
const
|
|
433
|
-
const
|
|
434
|
-
yield vbetService.incomingCall({ conversationId: 'id' });
|
|
435
|
-
yield vbetService.processBtnPress(mockReject.BT100USeries);
|
|
436
|
-
expect(devRejectFun).toHaveBeenCalledWith({ name: 'Reject', conversationId: 'id' });
|
|
437
|
-
expect(setRejectFun).toHaveBeenCalled();
|
|
438
|
-
}));
|
|
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');
|
|
925
|
+
it('end current call', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
926
|
+
const endFun = jest.spyOn(vbetService, 'endCall');
|
|
927
|
+
const devEndFun = jest.spyOn(vbetService, 'deviceEndedCall');
|
|
442
928
|
yield vbetService.outgoingCall({ conversationId: 'id' });
|
|
443
|
-
|
|
444
|
-
expect(
|
|
445
|
-
expect(
|
|
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');
|
|
452
|
-
}));
|
|
453
|
-
});
|
|
454
|
-
describe('processBtnPress CMEDIASeries', () => {
|
|
455
|
-
beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
456
|
-
mockDeviceList = mockDeviceList5;
|
|
457
|
-
yield vbetService.connect(mockTestDevName);
|
|
929
|
+
vbetService.processBtnPress(DeviceSignalType.END_CALL);
|
|
930
|
+
expect(endFun).toHaveBeenCalled();
|
|
931
|
+
expect(devEndFun).toHaveBeenCalled();
|
|
458
932
|
}));
|
|
459
|
-
|
|
460
|
-
|
|
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');
|
|
933
|
+
it('mute/unmute current call', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
934
|
+
const muteFun = jest.spyOn(vbetService, 'setMute');
|
|
479
935
|
const devMuteFun = jest.spyOn(vbetService, 'deviceMuteChanged');
|
|
480
|
-
yield vbetService.
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
expect(
|
|
936
|
+
yield vbetService.outgoingCall({ conversationId: 'id' });
|
|
937
|
+
vbetService.processBtnPress(DeviceSignalType.MUTE_CALL);
|
|
938
|
+
vbetService.processBtnPress(DeviceSignalType.UNMUTE_CALL);
|
|
939
|
+
expect(muteFun).toHaveBeenCalledTimes(2);
|
|
940
|
+
expect(devMuteFun).toHaveBeenCalledTimes(2);
|
|
941
|
+
expect(muteFun).toHaveBeenCalledWith(true);
|
|
484
942
|
expect(devMuteFun).toHaveBeenCalledWith({
|
|
485
943
|
isMuted: true,
|
|
486
944
|
name: 'CallMuted',
|
|
487
945
|
conversationId: 'id',
|
|
488
946
|
});
|
|
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);
|
|
947
|
+
expect(muteFun).toHaveBeenCalledWith(false);
|
|
498
948
|
expect(devMuteFun).toHaveBeenCalledWith({
|
|
499
|
-
isMuted:
|
|
500
|
-
name: '
|
|
949
|
+
isMuted: false,
|
|
950
|
+
name: 'CallUnmuted',
|
|
501
951
|
conversationId: 'id',
|
|
502
952
|
});
|
|
503
953
|
}));
|
|
504
|
-
it('
|
|
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* () {
|
|
954
|
+
it('answer inbound call but no id', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
529
955
|
const ansFun = jest.spyOn(vbetService, 'answerCall');
|
|
530
956
|
const devAnsFun = jest.spyOn(vbetService, 'deviceAnsweredCall');
|
|
531
|
-
yield vbetService.incomingCall({ conversationId: '
|
|
532
|
-
|
|
533
|
-
expect(ansFun).toHaveBeenCalled();
|
|
534
|
-
expect(devAnsFun).toHaveBeenCalled();
|
|
957
|
+
yield vbetService.incomingCall({ conversationId: '' });
|
|
958
|
+
vbetService.processBtnPress(DeviceSignalType.ACCEPT_CALL);
|
|
959
|
+
expect(ansFun).not.toHaveBeenCalled();
|
|
960
|
+
expect(devAnsFun).not.toHaveBeenCalled();
|
|
535
961
|
}));
|
|
536
|
-
it('
|
|
537
|
-
const
|
|
538
|
-
const
|
|
539
|
-
yield vbetService.
|
|
540
|
-
yield vbetService.
|
|
541
|
-
|
|
542
|
-
expect(
|
|
543
|
-
expect(
|
|
544
|
-
isMuted: true,
|
|
545
|
-
name: 'CallMuted',
|
|
546
|
-
conversationId: 'id',
|
|
547
|
-
});
|
|
962
|
+
it('end call but no id', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
963
|
+
const endFun = jest.spyOn(vbetService, 'endCall');
|
|
964
|
+
const devEndFun = jest.spyOn(vbetService, 'deviceEndedCall');
|
|
965
|
+
yield vbetService.outgoingCall({ conversationId: 'id' });
|
|
966
|
+
yield vbetService.endCall('id');
|
|
967
|
+
vbetService.processBtnPress(DeviceSignalType.END_CALL);
|
|
968
|
+
expect(endFun).toHaveBeenCalledTimes(1);
|
|
969
|
+
expect(devEndFun).not.toHaveBeenCalled();
|
|
548
970
|
}));
|
|
549
|
-
it('
|
|
550
|
-
const
|
|
971
|
+
it('mute call but no id', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
972
|
+
const muteFun = jest.spyOn(vbetService, 'setMute');
|
|
551
973
|
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
974
|
yield vbetService.outgoingCall({ conversationId: 'id' });
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
afterEach(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
975
|
+
vbetService.processBtnPress(DeviceSignalType.MUTE_CALL);
|
|
976
|
+
yield vbetService.endCall('id');
|
|
977
|
+
vbetService.processBtnPress(DeviceSignalType.MUTE_CALL);
|
|
978
|
+
expect(muteFun).toHaveBeenCalledTimes(1);
|
|
979
|
+
expect(devMuteFun).toHaveBeenCalledTimes(1);
|
|
980
|
+
}));
|
|
981
|
+
it('reject call but no id', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
982
|
+
const rejectFun = jest.spyOn(vbetService, 'rejectCall');
|
|
983
|
+
const devRejectFun = jest.spyOn(vbetService, 'deviceRejectedCall');
|
|
984
|
+
yield vbetService.incomingCall({ conversationId: 'id' });
|
|
577
985
|
yield vbetService.endAllCalls();
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
yield vbetService.disconnect();
|
|
582
|
-
const ansFun = jest.spyOn(vbetService, 'answerCall');
|
|
583
|
-
yield vbetService.processBtnPress(mockOffhookFlag.ACTIONSeries);
|
|
584
|
-
expect(ansFun).not.toHaveBeenCalled();
|
|
986
|
+
vbetService.processBtnPress(DeviceSignalType.REJECT_CALL);
|
|
987
|
+
expect(rejectFun).not.toHaveBeenCalled();
|
|
988
|
+
expect(devRejectFun).not.toHaveBeenCalled();
|
|
585
989
|
}));
|
|
586
|
-
it('
|
|
990
|
+
it('answer inbound call from ui but no id', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
587
991
|
const ansFun = jest.spyOn(vbetService, 'answerCall');
|
|
588
992
|
const devAnsFun = jest.spyOn(vbetService, 'deviceAnsweredCall');
|
|
589
993
|
yield vbetService.incomingCall({ conversationId: 'id' });
|
|
590
|
-
|
|
994
|
+
vbetService.processBtnPress(DeviceSignalType.ACCEPT_CALL);
|
|
995
|
+
vbetService.answerCall('id');
|
|
591
996
|
expect(ansFun).toHaveBeenCalled();
|
|
592
997
|
expect(devAnsFun).toHaveBeenCalled();
|
|
593
998
|
}));
|
|
594
|
-
it('
|
|
595
|
-
const
|
|
596
|
-
const
|
|
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');
|
|
999
|
+
it('reject call from ui but no id', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1000
|
+
const rejectFun = jest.spyOn(vbetService, 'rejectCall');
|
|
1001
|
+
const devRejectFun = jest.spyOn(vbetService, 'deviceRejectedCall');
|
|
618
1002
|
yield vbetService.incomingCall({ conversationId: 'id' });
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
expect(
|
|
622
|
-
expect(
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
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');
|
|
1003
|
+
vbetService.processBtnPress(DeviceSignalType.REJECT_CALL);
|
|
1004
|
+
vbetService.rejectCall('id');
|
|
1005
|
+
expect(rejectFun).toHaveBeenCalled();
|
|
1006
|
+
expect(devRejectFun).toHaveBeenCalled();
|
|
1007
|
+
}));
|
|
1008
|
+
it('end call from ui but no id', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1009
|
+
const endFun = jest.spyOn(vbetService, 'endCall');
|
|
1010
|
+
const devEndFun = jest.spyOn(vbetService, 'deviceEndedCall');
|
|
631
1011
|
yield vbetService.outgoingCall({ conversationId: 'id' });
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
expect(
|
|
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');
|
|
1012
|
+
vbetService.processBtnPress(DeviceSignalType.END_CALL);
|
|
1013
|
+
vbetService.endCall('id');
|
|
1014
|
+
expect(endFun).toHaveBeenCalled();
|
|
1015
|
+
expect(devEndFun).toHaveBeenCalled();
|
|
671
1016
|
}));
|
|
672
1017
|
});
|
|
673
1018
|
});
|