scandit-datacapture-frameworks-core 8.1.1 → 8.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__mocks__/ScanditDataCaptureCore.ts +8 -1
- package/dist/dts/camera/Camera.d.ts +1 -1
- package/dist/dts/camera/controller/CameraController.d.ts +18 -0
- package/dist/dts/camera/controller/FrameDataController.d.ts +9 -0
- package/dist/dts/camera/index.d.ts +2 -1
- package/dist/dts/context/controller/DataCaptureContextController.d.ts +3 -24
- package/dist/dts/defaults/index.d.ts +1 -0
- package/dist/dts/defaults/loadCoreDefaults.d.ts +3 -0
- package/dist/dts/feedback/FeedbackController.d.ts +3 -7
- package/dist/dts/feedback/index.d.ts +0 -1
- package/dist/dts/frame/ImageFrameSourceController.d.ts +6 -17
- package/dist/dts/frame/index.d.ts +0 -1
- package/dist/dts/generated/CoreProxy.d.ts +30 -0
- package/dist/dts/generated/CoreProxyAdapter.d.ts +148 -0
- package/dist/dts/generated/index.d.ts +6 -0
- package/dist/dts/index.d.ts +1 -0
- package/dist/dts/proxy-types.d.ts +1 -1
- package/dist/dts/view/DataCaptureView.d.ts +1 -0
- package/dist/dts/view/DataCaptureViewController.d.ts +11 -31
- package/dist/index.js +473 -102
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/test/Camera.test.ts +66 -73
- package/test/generated/CoreProxyAdapter.test.ts +407 -0
- package/dist/dts/camera/CameraController.d.ts +0 -45
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of the Scandit Data Capture SDK
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2025- Scandit AG. All rights reserved.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { describe, it, expect, jest, beforeEach } from '@jest/globals';
|
|
8
|
+
import { CoreProxyAdapter } from '../../src/generated/CoreProxyAdapter';
|
|
9
|
+
import { CoreProxy } from '../../src/generated/CoreProxy';
|
|
10
|
+
import { NativeCallResult } from '../../src/common';
|
|
11
|
+
import { FrameSourceState } from '../../src/frame';
|
|
12
|
+
|
|
13
|
+
describe('CameraProxyAdapter', () => {
|
|
14
|
+
let mockProxy: jest.Mocked<CoreProxy>;
|
|
15
|
+
let adapter: CoreProxyAdapter;
|
|
16
|
+
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
mockProxy = {
|
|
19
|
+
$executeCore: jest.fn(),
|
|
20
|
+
} as unknown as jest.Mocked<CoreProxy>;
|
|
21
|
+
|
|
22
|
+
adapter = new CoreProxyAdapter(mockProxy);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
describe('getCameraState', () => {
|
|
26
|
+
it('should call $executeCore with correct parameters', async () => {
|
|
27
|
+
const cameraPosition = '{"position":"worldFacing"}';
|
|
28
|
+
const mockResult: NativeCallResult = {
|
|
29
|
+
data: JSON.stringify({ state: FrameSourceState.On }),
|
|
30
|
+
};
|
|
31
|
+
mockProxy.$executeCore.mockResolvedValue(mockResult);
|
|
32
|
+
|
|
33
|
+
await adapter.getCameraState({ cameraPosition });
|
|
34
|
+
|
|
35
|
+
expect(mockProxy.$executeCore).toHaveBeenCalledWith({
|
|
36
|
+
moduleName: 'CoreModule',
|
|
37
|
+
methodName: 'getCameraState',
|
|
38
|
+
isEventRegistration: false,
|
|
39
|
+
cameraPosition,
|
|
40
|
+
});
|
|
41
|
+
expect(mockProxy.$executeCore).toHaveBeenCalledTimes(1);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('should parse JSON result to FrameSourceState', async () => {
|
|
45
|
+
const mockResult: NativeCallResult = {
|
|
46
|
+
data: JSON.stringify({ state: FrameSourceState.On }),
|
|
47
|
+
};
|
|
48
|
+
mockProxy.$executeCore.mockResolvedValue(mockResult);
|
|
49
|
+
|
|
50
|
+
const result = await adapter.getCameraState({
|
|
51
|
+
cameraPosition: '{"position":"worldFacing"}',
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
expect(result).toEqual({ state: FrameSourceState.On });
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('should validate parameter is passed correctly', async () => {
|
|
58
|
+
const cameraPosition = '{"position":"userFacing"}';
|
|
59
|
+
const mockResult: NativeCallResult = {
|
|
60
|
+
data: JSON.stringify({ state: FrameSourceState.Off }),
|
|
61
|
+
};
|
|
62
|
+
mockProxy.$executeCore.mockResolvedValue(mockResult);
|
|
63
|
+
|
|
64
|
+
await adapter.getCameraState({ cameraPosition });
|
|
65
|
+
|
|
66
|
+
const call = mockProxy.$executeCore.mock.calls[0][0];
|
|
67
|
+
expect(call.cameraPosition).toBe(cameraPosition);
|
|
68
|
+
expect(call.methodName).toBe('getCameraState');
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
describe('switchCameraToDesiredState', () => {
|
|
73
|
+
it('should call $executeCore with correct parameters', async () => {
|
|
74
|
+
const stateJson = '{"state":"on"}';
|
|
75
|
+
mockProxy.$executeCore.mockResolvedValue(undefined);
|
|
76
|
+
|
|
77
|
+
await adapter.switchCameraToDesiredState({ stateJson });
|
|
78
|
+
|
|
79
|
+
expect(mockProxy.$executeCore).toHaveBeenCalledWith({
|
|
80
|
+
moduleName: 'CoreModule',
|
|
81
|
+
methodName: 'switchCameraToDesiredState',
|
|
82
|
+
isEventRegistration: false,
|
|
83
|
+
stateJson,
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('should return void', async () => {
|
|
88
|
+
mockProxy.$executeCore.mockResolvedValue(undefined);
|
|
89
|
+
|
|
90
|
+
const result = await adapter.switchCameraToDesiredState({
|
|
91
|
+
stateJson: '{"state":"on"}',
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
expect(result).toBeUndefined();
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('should validate stateJson parameter', async () => {
|
|
98
|
+
const stateJson = '{"state":"off"}';
|
|
99
|
+
mockProxy.$executeCore.mockResolvedValue(undefined);
|
|
100
|
+
|
|
101
|
+
await adapter.switchCameraToDesiredState({ stateJson });
|
|
102
|
+
|
|
103
|
+
const call = mockProxy.$executeCore.mock.calls[0][0];
|
|
104
|
+
expect(call.stateJson).toBe(stateJson);
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
describe('isTorchAvailable', () => {
|
|
109
|
+
it('should call $executeCore with correct parameters', async () => {
|
|
110
|
+
const cameraPosition = '{"position":"worldFacing"}';
|
|
111
|
+
const mockResult: NativeCallResult = { data: 'true' };
|
|
112
|
+
mockProxy.$executeCore.mockResolvedValue(mockResult);
|
|
113
|
+
|
|
114
|
+
await adapter.isTorchAvailable({ cameraPosition });
|
|
115
|
+
|
|
116
|
+
expect(mockProxy.$executeCore).toHaveBeenCalledWith({
|
|
117
|
+
moduleName: 'CoreModule',
|
|
118
|
+
methodName: 'isTorchAvailable',
|
|
119
|
+
isEventRegistration: false,
|
|
120
|
+
cameraPosition,
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it('should parse "true" string to boolean true', async () => {
|
|
125
|
+
const mockResult: NativeCallResult = { data: 'true' };
|
|
126
|
+
mockProxy.$executeCore.mockResolvedValue(mockResult);
|
|
127
|
+
|
|
128
|
+
const result = await adapter.isTorchAvailable({
|
|
129
|
+
cameraPosition: '{"position":"worldFacing"}',
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
expect(result).toBe(true);
|
|
133
|
+
expect(typeof result).toBe('boolean');
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
it('should parse "false" string to boolean false', async () => {
|
|
137
|
+
const mockResult: NativeCallResult = { data: 'false' };
|
|
138
|
+
mockProxy.$executeCore.mockResolvedValue(mockResult);
|
|
139
|
+
|
|
140
|
+
const result = await adapter.isTorchAvailable({
|
|
141
|
+
cameraPosition: '{"position":"userFacing"}',
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
expect(result).toBe(false);
|
|
145
|
+
expect(typeof result).toBe('boolean');
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it('should handle any non-"true" string as false', async () => {
|
|
149
|
+
const mockResult: NativeCallResult = { data: 'anything' };
|
|
150
|
+
mockProxy.$executeCore.mockResolvedValue(mockResult);
|
|
151
|
+
|
|
152
|
+
const result = await adapter.isTorchAvailable({
|
|
153
|
+
cameraPosition: '{"position":"worldFacing"}',
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
expect(result).toBe(false);
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
describe('registerFrameSourceListener', () => {
|
|
161
|
+
it('should call $executeCore with correct method name', async () => {
|
|
162
|
+
mockProxy.$executeCore.mockResolvedValue(undefined);
|
|
163
|
+
|
|
164
|
+
await adapter.registerFrameSourceListener();
|
|
165
|
+
|
|
166
|
+
expect(mockProxy.$executeCore).toHaveBeenCalledWith({
|
|
167
|
+
moduleName: 'CoreModule',
|
|
168
|
+
methodName: 'registerFrameSourceListener',
|
|
169
|
+
isEventRegistration: true,
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
it('should not pass any additional parameters', async () => {
|
|
174
|
+
mockProxy.$executeCore.mockResolvedValue(undefined);
|
|
175
|
+
|
|
176
|
+
await adapter.registerFrameSourceListener();
|
|
177
|
+
|
|
178
|
+
const call = mockProxy.$executeCore.mock.calls[0][0];
|
|
179
|
+
expect(Object.keys(call)).toEqual(['moduleName', 'methodName', 'isEventRegistration']);
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
it('should return void', async () => {
|
|
183
|
+
mockProxy.$executeCore.mockResolvedValue(undefined);
|
|
184
|
+
|
|
185
|
+
const result = await adapter.registerFrameSourceListener();
|
|
186
|
+
|
|
187
|
+
expect(result).toBeUndefined();
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
describe('unregisterFrameSourceListener', () => {
|
|
192
|
+
it('should call $executeCore with correct method name', async () => {
|
|
193
|
+
mockProxy.$executeCore.mockResolvedValue(undefined);
|
|
194
|
+
|
|
195
|
+
await adapter.unregisterFrameSourceListener();
|
|
196
|
+
|
|
197
|
+
expect(mockProxy.$executeCore).toHaveBeenCalledWith({
|
|
198
|
+
moduleName: 'CoreModule',
|
|
199
|
+
methodName: 'unregisterFrameSourceListener',
|
|
200
|
+
isEventRegistration: false,
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
it('should not pass any additional parameters', async () => {
|
|
205
|
+
mockProxy.$executeCore.mockResolvedValue(undefined);
|
|
206
|
+
|
|
207
|
+
await adapter.unregisterFrameSourceListener();
|
|
208
|
+
|
|
209
|
+
const call = mockProxy.$executeCore.mock.calls[0][0];
|
|
210
|
+
expect(Object.keys(call)).toEqual(['moduleName', 'methodName', 'isEventRegistration']);
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
it('should return void', async () => {
|
|
214
|
+
mockProxy.$executeCore.mockResolvedValue(undefined);
|
|
215
|
+
|
|
216
|
+
const result = await adapter.unregisterFrameSourceListener();
|
|
217
|
+
|
|
218
|
+
expect(result).toBeUndefined();
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
describe('getLastFrameAsJson', () => {
|
|
223
|
+
it('should call $executeCore with correct parameters', async () => {
|
|
224
|
+
const frameId = 'frame-123';
|
|
225
|
+
const mockResult: NativeCallResult = {
|
|
226
|
+
data: '{"frameId":"frame-123","data":"..."}',
|
|
227
|
+
};
|
|
228
|
+
mockProxy.$executeCore.mockResolvedValue(mockResult);
|
|
229
|
+
|
|
230
|
+
await adapter.getLastFrameAsJson({ frameId });
|
|
231
|
+
|
|
232
|
+
expect(mockProxy.$executeCore).toHaveBeenCalledWith({
|
|
233
|
+
moduleName: 'CoreModule',
|
|
234
|
+
methodName: 'getLastFrameAsJson',
|
|
235
|
+
isEventRegistration: false,
|
|
236
|
+
frameId,
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
it('should return string result directly', async () => {
|
|
241
|
+
const expectedJson = '{"frameId":"frame-123","timestamp":1234567890}';
|
|
242
|
+
const mockResult: NativeCallResult = { data: expectedJson };
|
|
243
|
+
mockProxy.$executeCore.mockResolvedValue(mockResult);
|
|
244
|
+
|
|
245
|
+
const result = await adapter.getLastFrameAsJson({ frameId: 'frame-123' });
|
|
246
|
+
|
|
247
|
+
expect(result).toBe(expectedJson);
|
|
248
|
+
expect(typeof result).toBe('string');
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
it('should handle special characters in frameId', async () => {
|
|
252
|
+
const frameId = 'frame-123-abc_!@#';
|
|
253
|
+
const mockResult: NativeCallResult = { data: '{"frameId":"frame-123-abc_!@#"}' };
|
|
254
|
+
mockProxy.$executeCore.mockResolvedValue(mockResult);
|
|
255
|
+
|
|
256
|
+
await adapter.getLastFrameAsJson({ frameId });
|
|
257
|
+
|
|
258
|
+
const call = mockProxy.$executeCore.mock.calls[0][0];
|
|
259
|
+
expect(call.frameId).toBe(frameId);
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
describe('getLastFrameOrNullAsJson', () => {
|
|
264
|
+
it('should call $executeCore with correct parameters', async () => {
|
|
265
|
+
const frameId = 'frame-456';
|
|
266
|
+
const mockResult: NativeCallResult = { data: '{"frameId":"frame-456"}' };
|
|
267
|
+
mockProxy.$executeCore.mockResolvedValue(mockResult);
|
|
268
|
+
|
|
269
|
+
await adapter.getLastFrameOrNullAsJson({ frameId });
|
|
270
|
+
|
|
271
|
+
expect(mockProxy.$executeCore).toHaveBeenCalledWith({
|
|
272
|
+
moduleName: 'CoreModule',
|
|
273
|
+
methodName: 'getLastFrameOrNullAsJson',
|
|
274
|
+
isEventRegistration: false,
|
|
275
|
+
frameId,
|
|
276
|
+
});
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
it('should return string result when frame exists', async () => {
|
|
280
|
+
const expectedJson = '{"frameId":"frame-456","timestamp":1234567890}';
|
|
281
|
+
const mockResult: NativeCallResult = { data: expectedJson };
|
|
282
|
+
mockProxy.$executeCore.mockResolvedValue(mockResult);
|
|
283
|
+
|
|
284
|
+
const result = await adapter.getLastFrameOrNullAsJson({ frameId: 'frame-456' });
|
|
285
|
+
|
|
286
|
+
expect(result).toBe(expectedJson);
|
|
287
|
+
expect(typeof result).toBe('string');
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
it('should return null when frame does not exist', async () => {
|
|
291
|
+
const mockResult: NativeCallResult | null = null;
|
|
292
|
+
mockProxy.$executeCore.mockResolvedValue(mockResult);
|
|
293
|
+
|
|
294
|
+
const result = await adapter.getLastFrameOrNullAsJson({ frameId: 'non-existent' });
|
|
295
|
+
|
|
296
|
+
expect(result).toBeNull();
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
it('should handle nullable return type correctly', async () => {
|
|
300
|
+
const mockResult: NativeCallResult | null = null;
|
|
301
|
+
mockProxy.$executeCore.mockResolvedValue(mockResult);
|
|
302
|
+
|
|
303
|
+
const result = await adapter.getLastFrameOrNullAsJson({ frameId: 'test' });
|
|
304
|
+
|
|
305
|
+
expect(result).toBeNull();
|
|
306
|
+
});
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
describe('Error Handling', () => {
|
|
310
|
+
it('should propagate errors from proxy', async () => {
|
|
311
|
+
const error = new Error('Native error');
|
|
312
|
+
mockProxy.$executeCore.mockRejectedValue(error);
|
|
313
|
+
|
|
314
|
+
await expect(
|
|
315
|
+
adapter.getCameraState({ cameraPosition: '{"position":"worldFacing"}' })
|
|
316
|
+
).rejects.toThrow('Native error');
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
it('should handle JSON parse errors in getCameraState', async () => {
|
|
320
|
+
const mockResult: NativeCallResult = { data: 'invalid json{' };
|
|
321
|
+
mockProxy.$executeCore.mockResolvedValue(mockResult);
|
|
322
|
+
|
|
323
|
+
await expect(
|
|
324
|
+
adapter.getCameraState({ cameraPosition: '{"position":"worldFacing"}' })
|
|
325
|
+
).rejects.toThrow();
|
|
326
|
+
});
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
describe('Type Safety', () => {
|
|
330
|
+
it('getCameraState should return FrameSourceState type', async () => {
|
|
331
|
+
const mockResult: NativeCallResult = {
|
|
332
|
+
data: JSON.stringify({ state: FrameSourceState.On }),
|
|
333
|
+
};
|
|
334
|
+
mockProxy.$executeCore.mockResolvedValue(mockResult);
|
|
335
|
+
|
|
336
|
+
const result = await adapter.getCameraState({
|
|
337
|
+
cameraPosition: '{"position":"worldFacing"}',
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
// Type assertion check - this will fail at compile time if types don't match
|
|
341
|
+
const _typeCheck: FrameSourceState = result;
|
|
342
|
+
expect(_typeCheck).toBeDefined();
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
it('isTorchAvailable should return boolean type', async () => {
|
|
346
|
+
const mockResult: NativeCallResult = { data: 'true' };
|
|
347
|
+
mockProxy.$executeCore.mockResolvedValue(mockResult);
|
|
348
|
+
|
|
349
|
+
const result = await adapter.isTorchAvailable({
|
|
350
|
+
cameraPosition: '{"position":"worldFacing"}',
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
// Type assertion check
|
|
354
|
+
const _typeCheck: boolean = result;
|
|
355
|
+
expect(_typeCheck).toBeDefined();
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
it('getLastFrameAsJson should return string type', async () => {
|
|
359
|
+
const mockResult: NativeCallResult = { data: '{"test":"data"}' };
|
|
360
|
+
mockProxy.$executeCore.mockResolvedValue(mockResult);
|
|
361
|
+
|
|
362
|
+
const result = await adapter.getLastFrameAsJson({ frameId: 'test' });
|
|
363
|
+
|
|
364
|
+
// Type assertion check
|
|
365
|
+
const _typeCheck: string = result;
|
|
366
|
+
expect(_typeCheck).toBeDefined();
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
it('getLastFrameOrNullAsJson should return string | null type', async () => {
|
|
370
|
+
const mockResult: NativeCallResult | null = null;
|
|
371
|
+
mockProxy.$executeCore.mockResolvedValue(mockResult);
|
|
372
|
+
|
|
373
|
+
const result = await adapter.getLastFrameOrNullAsJson({ frameId: 'test' });
|
|
374
|
+
|
|
375
|
+
// Type assertion check
|
|
376
|
+
const _typeCheck: string | null = result;
|
|
377
|
+
expect(_typeCheck).toBeNull();
|
|
378
|
+
});
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
describe('Method Call Verification', () => {
|
|
382
|
+
it('should call all methods exactly once per invocation', async () => {
|
|
383
|
+
const mockResult: NativeCallResult = { data: 'test' };
|
|
384
|
+
mockProxy.$executeCore.mockResolvedValue(mockResult);
|
|
385
|
+
|
|
386
|
+
await adapter.getLastFrameAsJson({ frameId: 'test' });
|
|
387
|
+
await adapter.getLastFrameAsJson({ frameId: 'test2' });
|
|
388
|
+
|
|
389
|
+
expect(mockProxy.$executeCore).toHaveBeenCalledTimes(2);
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
it('should pass parameters in correct object structure', async () => {
|
|
393
|
+
mockProxy.$executeCore.mockResolvedValue(undefined);
|
|
394
|
+
|
|
395
|
+
await adapter.switchCameraToDesiredState({ stateJson: '{"state":"on"}' });
|
|
396
|
+
|
|
397
|
+
expect(mockProxy.$executeCore).toHaveBeenCalledWith(
|
|
398
|
+
expect.objectContaining({
|
|
399
|
+
moduleName: expect.any(String),
|
|
400
|
+
methodName: expect.any(String),
|
|
401
|
+
stateJson: expect.any(String),
|
|
402
|
+
})
|
|
403
|
+
);
|
|
404
|
+
});
|
|
405
|
+
});
|
|
406
|
+
});
|
|
407
|
+
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { Camera } from "./Camera";
|
|
2
|
-
import { FrameData, FrameSourceState } from "../frame";
|
|
3
|
-
import { CameraPosition } from "../camerahelpers";
|
|
4
|
-
import { NativeCallResult } from "../common";
|
|
5
|
-
import { BaseController } from "../controllers/BaseController";
|
|
6
|
-
import { BaseProxy } from "../proxies/BaseProxy";
|
|
7
|
-
export interface CameraProxy extends BaseProxy {
|
|
8
|
-
$getCurrentCameraState({ position }: {
|
|
9
|
-
position: CameraPosition;
|
|
10
|
-
}): Promise<NativeCallResult>;
|
|
11
|
-
$switchCameraToDesiredState({ desiredStateJson }: {
|
|
12
|
-
desiredStateJson: string;
|
|
13
|
-
}): Promise<void>;
|
|
14
|
-
$isTorchAvailable({ position }: {
|
|
15
|
-
position: CameraPosition;
|
|
16
|
-
}): Promise<NativeCallResult>;
|
|
17
|
-
/**
|
|
18
|
-
* Register persistent event listener for camera state changes.
|
|
19
|
-
*
|
|
20
|
-
* Uses `$$` prefix to indicate this is an event registration method that establishes
|
|
21
|
-
* a persistent listener (uses callbackContext.successAndKeepCallback() on native side).
|
|
22
|
-
* This prefix enables automatic detection in Cordova without manual event configuration.
|
|
23
|
-
*/
|
|
24
|
-
$$registerListenerForCameraEvents(): Promise<void>;
|
|
25
|
-
$unregisterListenerForCameraEvents(): Promise<void>;
|
|
26
|
-
$getFrame({ frameId }: {
|
|
27
|
-
frameId: string;
|
|
28
|
-
}): Promise<NativeCallResult | null>;
|
|
29
|
-
}
|
|
30
|
-
export declare class CameraController extends BaseController<CameraProxy> {
|
|
31
|
-
private camera;
|
|
32
|
-
private static get _proxy();
|
|
33
|
-
static getFrame(frameId: string): Promise<FrameData>;
|
|
34
|
-
static getFrameOrNull(frameId: string): Promise<FrameData | null>;
|
|
35
|
-
constructor(camera: Camera);
|
|
36
|
-
private get privateCamera();
|
|
37
|
-
getCurrentState(): Promise<FrameSourceState>;
|
|
38
|
-
getIsTorchAvailable(): Promise<boolean>;
|
|
39
|
-
switchCameraToDesiredState(desiredState: FrameSourceState): Promise<void>;
|
|
40
|
-
subscribeListener(): Promise<void>;
|
|
41
|
-
unsubscribeListener(): Promise<void>;
|
|
42
|
-
dispose(): void;
|
|
43
|
-
private handleDidChangeStateEvent;
|
|
44
|
-
private handleDidChangeStateEventWrapper;
|
|
45
|
-
}
|