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.
@@ -105,7 +105,14 @@ export class MockCaller implements NativeCaller {
105
105
  }
106
106
 
107
107
  async registerEvent(evName: string, handler: (args: any) => Promise<void>): Promise<any> {
108
- return this.emitter.addListener(evName, handler);
108
+ // Wrap handler to catch and log errors
109
+ const wrappedHandler = (event: any) => {
110
+ const promise = handler(event);
111
+ promise.catch((error) => {
112
+ console.error(`Error in event handler for '${evName}':`, error);
113
+ });
114
+ };
115
+ return this.emitter.addListener(evName, wrappedHandler);
109
116
  }
110
117
 
111
118
  async unregisterEvent(evName: string, subscription: any): Promise<void> {
@@ -1,7 +1,7 @@
1
1
  import { DataCaptureContext } from "../context";
2
2
  import { FrameSource, FrameSourceListener, FrameSourceState } from "../frame";
3
3
  import { DefaultSerializeable } from "../serializable";
4
- import { CameraController } from "./CameraController";
4
+ import { CameraController } from "./controller/CameraController";
5
5
  import { TorchState } from "./TorchState";
6
6
  import { CameraPosition } from "../camerahelpers/CameraPosition";
7
7
  import { CameraSettings } from "./CameraSettings";
@@ -0,0 +1,18 @@
1
+ import { Camera } from "../Camera";
2
+ import { FrameSourceState } from "../../frame";
3
+ import { BaseController } from "../../controllers/BaseController";
4
+ import { CoreProxy } from "../../generated";
5
+ export declare class CameraController extends BaseController<CoreProxy> {
6
+ private camera;
7
+ private adapter;
8
+ constructor(camera: Camera);
9
+ private get privateCamera();
10
+ getCurrentState(): Promise<FrameSourceState>;
11
+ getIsTorchAvailable(): Promise<boolean>;
12
+ switchCameraToDesiredState(desiredState: FrameSourceState): Promise<void>;
13
+ subscribeListener(): Promise<void>;
14
+ unsubscribeListener(): Promise<void>;
15
+ dispose(): void;
16
+ private handleDidChangeStateEvent;
17
+ private handleDidChangeStateEventWrapper;
18
+ }
@@ -0,0 +1,9 @@
1
+ import { BaseController } from '../../controllers/BaseController';
2
+ import { FrameData } from '../../frame';
3
+ import { CoreProxy } from '../../generated';
4
+ export declare class FrameDataController extends BaseController<CoreProxy> {
5
+ private adapter;
6
+ constructor();
7
+ getFrame(frameId: string): Promise<FrameData>;
8
+ getFrameOrNull(frameId: string): Promise<FrameData | null>;
9
+ }
@@ -2,7 +2,8 @@ export * from "./FocusGesture";
2
2
  export * from "./TapToFocus";
3
3
  export * from "./PrivateFocusGestureDeserializer";
4
4
  export * from "./ZoomGesture";
5
- export * from "./CameraController";
5
+ export * from "./controller/CameraController";
6
+ export * from "./controller/FrameDataController";
6
7
  export * from "./Camera";
7
8
  export * from "./ZoomSwitchControl";
8
9
  export * from "./TorchSwitchControl";
@@ -1,33 +1,11 @@
1
1
  import { DataCaptureContext } from '../DataCaptureContext';
2
2
  import { DataCaptureMode } from '../DataCaptureMode';
3
3
  import { OpenSourceSoftwareLicenseInfo } from '../OpenSourceSoftwareLicenseInfo';
4
- import { NativeCallResult } from '../../common';
5
4
  import { BaseController } from '../../controllers/BaseController';
6
- import { BaseProxy } from '../../proxies/BaseProxy';
7
- export interface DataCaptureContextProxy extends BaseProxy {
5
+ import { CoreProxy } from '../../generated';
6
+ export interface DataCaptureContextProxy extends CoreProxy {
8
7
  get framework(): string;
9
8
  get frameworkVersion(): string;
10
- $contextFromJSON({ contextJson }: {
11
- contextJson: string;
12
- }): Promise<NativeCallResult>;
13
- $updateContextFromJSON({ contextJson }: {
14
- contextJson: string;
15
- }): Promise<void>;
16
- /**
17
- * Subscribe to context events with persistent listener.
18
- * Uses `$$` prefix for automatic Cordova event registration detection.
19
- */
20
- $$subscribeContextListener(): Promise<void>;
21
- $unsubscribeContextListener(): Promise<void>;
22
- $addModeToContext({ modeJson }: {
23
- modeJson: string;
24
- }): Promise<void>;
25
- $removeModeFromContext({ modeJson }: {
26
- modeJson: string;
27
- }): Promise<void>;
28
- $removeAllModes(): Promise<void>;
29
- $getOpenSourceSoftwareLicenseInfo(): Promise<NativeCallResult>;
30
- $disposeContext(): Promise<void>;
31
9
  }
32
10
  export declare enum DataCaptureContextEvents {
33
11
  didChangeStatus = "DataCaptureContextListener.onStatusChanged",
@@ -36,6 +14,7 @@ export declare enum DataCaptureContextEvents {
36
14
  export declare class DataCaptureContextController extends BaseController<DataCaptureContextProxy> {
37
15
  private context;
38
16
  private _listenerRegistered;
17
+ private adapter;
39
18
  get framework(): string;
40
19
  get frameworkVersion(): string;
41
20
  private get privateContext();
@@ -1,2 +1,3 @@
1
1
  export { CoreDefaults } from "./CoreDefaults";
2
2
  export { getCoreDefaults } from "./getCoreDefaults";
3
+ export { setCoreDefaultsLoader, ensureCoreDefaults } from "./loadCoreDefaults";
@@ -1 +1,4 @@
1
+ import { CoreDefaults } from "./CoreDefaults";
2
+ export declare function setCoreDefaultsLoader(loader: () => void): void;
3
+ export declare function ensureCoreDefaults(): CoreDefaults;
1
4
  export declare function loadCoreDefaults(jsonDefaults: unknown): void;
@@ -1,13 +1,9 @@
1
1
  import { BaseController } from '../controllers/BaseController';
2
2
  import { Feedback } from './Feedback';
3
- import { BaseProxy } from '../proxies/BaseProxy';
4
- export interface FeedbackProxy extends BaseProxy {
5
- $emitFeedback(args: {
6
- feedbackJson: string;
7
- }): Promise<void>;
8
- }
9
- export declare class FeedbackController extends BaseController<FeedbackProxy> {
3
+ import { CoreProxy } from '../generated';
4
+ export declare class FeedbackController extends BaseController<CoreProxy> {
10
5
  private feedback;
6
+ private adapter;
11
7
  static forFeedback(feedback: Feedback): FeedbackController;
12
8
  constructor(feedback: Feedback);
13
9
  emit(): void;
@@ -2,7 +2,6 @@ export { Vibration, WaveFormVibration } from "./Vibration";
2
2
  export { VibrationType } from "./VibrationType";
3
3
  export { Sound } from "./Sound";
4
4
  export { Feedback } from "./Feedback";
5
- export { FeedbackProxy } from "./FeedbackController";
6
5
  export { VibrationJSON, PrivateVibration } from "./Vibration";
7
6
  export { SoundJSON, PrivateSound } from "./Sound";
8
7
  export { FeedbackJSON, PrivateFeedback } from "./Feedback";
@@ -1,21 +1,10 @@
1
- import { FrameSourceState } from "./FrameSourceState";
2
- import { ImageFrameSource } from "./ImageFrameSource";
3
- import { CameraPosition } from "../camerahelpers/CameraPosition";
4
- import { NativeCallResult } from "../common";
5
- import { BaseController } from "../controllers/BaseController";
6
- import { BaseProxy } from "../proxies";
7
- export interface ImageFrameSourceProxy extends BaseProxy {
8
- $getCurrentCameraState({ position }: {
9
- position: CameraPosition;
10
- }): Promise<NativeCallResult>;
11
- $switchCameraToDesiredState({ desiredStateJson }: {
12
- desiredStateJson: string;
13
- }): Promise<void>;
14
- $$registerListenerForCameraEvents(): Promise<void>;
15
- $unregisterListenerForCameraEvents(): Promise<void>;
16
- }
17
- export declare class ImageFrameSourceController extends BaseController<ImageFrameSourceProxy> {
1
+ import { FrameSourceState } from './FrameSourceState';
2
+ import { ImageFrameSource } from './ImageFrameSource';
3
+ import { BaseController } from '../controllers/BaseController';
4
+ import { CoreProxy } from '../generated';
5
+ export declare class ImageFrameSourceController extends BaseController<CoreProxy> {
18
6
  private imageFrameSource;
7
+ private adapter;
19
8
  constructor(imageFrameSource: ImageFrameSource);
20
9
  private get privateImageFrameSource();
21
10
  getCurrentState(): Promise<FrameSourceState>;
@@ -6,6 +6,5 @@ export { ImageBuffer } from "./ImageBuffer";
6
6
  export { FrameDataSettings } from "./FrameDataSettings";
7
7
  export { FrameDataSettingsBuilder } from "./FrameDataSettingsBuilder";
8
8
  export { ImageFrameSource } from "./ImageFrameSource";
9
- export { ImageFrameSourceProxy, } from "./ImageFrameSourceController";
10
9
  export { PrivateImageBuffer, ImageBufferJSON } from "./ImageBuffer";
11
10
  export { PrivateFrameData, FrameDataJSON } from "./FrameData";
@@ -0,0 +1,30 @@
1
+ import { BaseProxy } from '../proxies/BaseProxy';
2
+ /**
3
+ * The datacapture core module
4
+ * Generated from schema definition.
5
+ *
6
+ * Single entry point interface - all operations go through $executeCore.
7
+ * The CoreController handles method-specific logic and calls this proxy.
8
+ * The NativeProxy automatically handles the `$` prefix for native method calls.
9
+ */
10
+ export interface CoreProxy extends BaseProxy {
11
+ /**
12
+ * Single entry point for all Core operations.
13
+ * Routes to appropriate native command based on moduleName and methodName.
14
+ *
15
+ * @param params Object containing:
16
+ * - moduleName: The name of the module to execute against
17
+ * - methodName: The name of the method to execute
18
+ * - ...other parameters specific to the method
19
+ *
20
+ * @returns Promise resolving to the result (type depends on methodName)
21
+ *
22
+ * Note: This method is called with the `$` prefix ($executeCore) which is
23
+ * automatically handled by NativeProxy to route to native implementation.
24
+ */
25
+ $executeCore(params: {
26
+ moduleName: string;
27
+ methodName: string;
28
+ [key: string]: any;
29
+ }): Promise<any>;
30
+ }
@@ -0,0 +1,148 @@
1
+ import { CoreProxy } from './CoreProxy';
2
+ import { FrameSourceState } from '../frame';
3
+ /**
4
+ * Adapter class for Core operations.
5
+ * Provides typed methods that internally call $executeCore.
6
+ * Generated from schema definition to ensure parameter and method name consistency.
7
+ */
8
+ export declare class CoreProxyAdapter {
9
+ private proxy;
10
+ constructor(proxy: CoreProxy);
11
+ /**
12
+ * Gets the camera state for a given position
13
+ * @param cameraPosition Camera position as JSON string
14
+ */
15
+ getCameraState({ cameraPosition }: {
16
+ cameraPosition: string;
17
+ }): Promise<FrameSourceState>;
18
+ /**
19
+ * Switches the camera to the desired state
20
+ * @param stateJson Desired camera state as JSON string
21
+ */
22
+ switchCameraToDesiredState({ stateJson }: {
23
+ stateJson: string;
24
+ }): Promise<void>;
25
+ /**
26
+ * Checks if torch is available for the given camera position
27
+ * @param cameraPosition Camera position as JSON string
28
+ */
29
+ isTorchAvailable({ cameraPosition }: {
30
+ cameraPosition: string;
31
+ }): Promise<boolean>;
32
+ /**
33
+ * Registers a persistent listener for frame source state change events
34
+ */
35
+ registerFrameSourceListener(): Promise<void>;
36
+ /**
37
+ * Unregisters the frame source event listener
38
+ */
39
+ unregisterFrameSourceListener(): Promise<void>;
40
+ /**
41
+ * Gets the last frame data by frame ID as JSON
42
+ * @param frameId Unique frame identifier
43
+ */
44
+ getLastFrameAsJson({ frameId }: {
45
+ frameId: string;
46
+ }): Promise<string>;
47
+ /**
48
+ * Gets the last frame data by frame ID as JSON, or null if not found
49
+ * @param frameId Unique frame identifier
50
+ */
51
+ getLastFrameOrNullAsJson({ frameId }: {
52
+ frameId: string;
53
+ }): Promise<string | null>;
54
+ /**
55
+ * Creates a DataCaptureContext from JSON
56
+ * @param contextJson DataCaptureContext configuration as JSON string
57
+ */
58
+ createContextFromJson({ contextJson }: {
59
+ contextJson: string;
60
+ }): Promise<void>;
61
+ /**
62
+ * Updates a DataCaptureContext from JSON
63
+ * @param contextJson Updated DataCaptureContext configuration as JSON string
64
+ */
65
+ updateContextFromJson({ contextJson }: {
66
+ contextJson: string;
67
+ }): Promise<void>;
68
+ /**
69
+ * Subscribes to context events with persistent listener
70
+ */
71
+ subscribeContextListener(): Promise<void>;
72
+ /**
73
+ * Unsubscribes from context events
74
+ */
75
+ unsubscribeContextListener(): Promise<void>;
76
+ /**
77
+ * Adds a mode to the DataCaptureContext
78
+ * @param modeJson Mode configuration as JSON string
79
+ */
80
+ addModeToContext({ modeJson }: {
81
+ modeJson: string;
82
+ }): Promise<void>;
83
+ /**
84
+ * Removes a mode from the DataCaptureContext
85
+ * @param modeJson Mode configuration as JSON string
86
+ */
87
+ removeModeFromContext({ modeJson }: {
88
+ modeJson: string;
89
+ }): Promise<void>;
90
+ /**
91
+ * Removes all modes from the DataCaptureContext
92
+ */
93
+ removeAllModes(): Promise<void>;
94
+ /**
95
+ * Gets open source software license information
96
+ */
97
+ getOpenSourceSoftwareLicenseInfo(): Promise<string>;
98
+ /**
99
+ * Disposes the DataCaptureContext and releases resources
100
+ */
101
+ disposeContext(): Promise<void>;
102
+ /**
103
+ * Converts a point from frame coordinates to view coordinates
104
+ * @param viewId View identifier
105
+ * @param pointJson Point in frame coordinates as JSON string
106
+ */
107
+ viewPointForFramePoint({ viewId, pointJson }: {
108
+ viewId: number;
109
+ pointJson: string;
110
+ }): Promise<string>;
111
+ /**
112
+ * Converts a quadrilateral from frame coordinates to view coordinates
113
+ * @param viewId View identifier
114
+ * @param quadrilateralJson Quadrilateral in frame coordinates as JSON string
115
+ */
116
+ viewQuadrilateralForFrameQuadrilateral({ viewId, quadrilateralJson, }: {
117
+ viewId: number;
118
+ quadrilateralJson: string;
119
+ }): Promise<string>;
120
+ /**
121
+ * Registers persistent event listener for view events
122
+ * @param viewId View identifier
123
+ */
124
+ registerListenerForViewEvents({ viewId }: {
125
+ viewId: number;
126
+ }): Promise<void>;
127
+ /**
128
+ * Unregisters the view event listener
129
+ * @param viewId View identifier
130
+ */
131
+ unregisterListenerForViewEvents({ viewId }: {
132
+ viewId: number;
133
+ }): Promise<void>;
134
+ /**
135
+ * Updates the DataCaptureView configuration
136
+ * @param viewJson Updated view configuration as JSON string
137
+ */
138
+ updateDataCaptureView({ viewJson }: {
139
+ viewJson: object | string;
140
+ }): Promise<void>;
141
+ /**
142
+ * Emits haptic/audio feedback
143
+ * @param feedbackJson Feedback configuration as JSON string
144
+ */
145
+ emitFeedback({ feedbackJson }: {
146
+ feedbackJson: string;
147
+ }): Promise<void>;
148
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Generated exports for Core module.
3
+ * Exports all generated proxy interfaces and adapters.
4
+ */
5
+ export * from './CoreProxy';
6
+ export * from './CoreProxyAdapter';
@@ -19,3 +19,4 @@ export { FactoryMaker } from "./FactoryMaker";
19
19
  export * from "./proxy-types";
20
20
  export * from "./proxy-registration";
21
21
  export * from "./helpers";
22
+ export * from "./generated";
@@ -1,5 +1,5 @@
1
1
  import { NativeCallerProvider } from './proxies/ProxyRegistration';
2
- export declare const CORE_PROXY_TYPE_NAMES: readonly ["DataCaptureViewProxy", "DataCaptureContextProxy", "CameraProxy", "ImageFrameSourceProxy", "FeedbackProxy"];
2
+ export declare const CORE_PROXY_TYPE_NAMES: readonly ["CoreProxy", "DataCaptureViewProxy", "DataCaptureContextProxy"];
3
3
  export type CoreProxyType = typeof CORE_PROXY_TYPE_NAMES[number];
4
4
  export interface CoreNativeCallerProvider extends NativeCallerProvider<CoreProxyType> {
5
5
  }
@@ -60,6 +60,7 @@ export declare class BaseDataCaptureView extends DefaultSerializeable {
60
60
  removeControl(control: Control): void;
61
61
  controlUpdated(): Promise<void>;
62
62
  createNativeView(viewId: number): Promise<void>;
63
+ private notifyOverlaysOfViewIdChange;
63
64
  removeNativeView(): Promise<void>;
64
65
  dispose(): void;
65
66
  setFrame(frame: Rect, isUnderContent?: boolean): Promise<void>;
@@ -1,33 +1,8 @@
1
- import { NativeCallResult, Point, Quadrilateral } from "../common";
1
+ import { Point, Quadrilateral } from "../common";
2
2
  import { BaseDataCaptureView } from "./DataCaptureView";
3
3
  import { BaseController } from "../controllers/BaseController";
4
- import { BaseProxy } from "../proxies/BaseProxy";
5
- export interface DataCaptureViewProxy extends BaseProxy {
6
- $viewPointForFramePoint({ viewId, pointJson }: {
7
- viewId: number;
8
- pointJson: string;
9
- }): Promise<NativeCallResult>;
10
- $viewQuadrilateralForFrameQuadrilateral({ viewId, quadrilateralJson }: {
11
- viewId: number;
12
- quadrilateralJson: string;
13
- }): Promise<NativeCallResult>;
14
- /**
15
- * Register persistent event listener for view events.
16
- * Uses `$$` prefix for automatic Cordova event registration detection.
17
- */
18
- $$registerListenerForViewEvents({ viewId }: {
19
- viewId: number;
20
- }): Promise<void>;
21
- $unregisterListenerForViewEvents({ viewId }: {
22
- viewId: number;
23
- }): Promise<void>;
24
- $setDataCaptureViewPositionAndSize({ top, left, width, height, shouldBeUnderWebView }: {
25
- top: number;
26
- left: number;
27
- width: number;
28
- height: number;
29
- shouldBeUnderWebView: boolean;
30
- }): Promise<void>;
4
+ import { CoreProxy } from "../generated";
5
+ export interface DataCaptureViewProxy extends CoreProxy {
31
6
  $showDataCaptureView({ viewId }: {
32
7
  viewId: number;
33
8
  }): Promise<void>;
@@ -37,12 +12,16 @@ export interface DataCaptureViewProxy extends BaseProxy {
37
12
  $createDataCaptureView({ viewJson }: {
38
13
  viewJson: string;
39
14
  }): Promise<void>;
40
- $updateDataCaptureView({ viewJson }: {
41
- viewJson: string;
42
- }): Promise<void>;
43
15
  $removeDataCaptureView({ viewId }: {
44
16
  viewId: number;
45
17
  }): Promise<void>;
18
+ $setDataCaptureViewPositionAndSize({ top, left, width, height, shouldBeUnderWebView }: {
19
+ top: number;
20
+ left: number;
21
+ width: number;
22
+ height: number;
23
+ shouldBeUnderWebView: boolean;
24
+ }): Promise<void>;
46
25
  }
47
26
  export declare enum DataCaptureViewEvents {
48
27
  didChangeSize = "DataCaptureViewListener.onSizeChanged"
@@ -50,6 +29,7 @@ export declare enum DataCaptureViewEvents {
50
29
  export declare class DataCaptureViewController extends BaseController<DataCaptureViewProxy> {
51
30
  private view;
52
31
  private _listenerRegistered;
32
+ private adapter;
53
33
  constructor(view: BaseDataCaptureView);
54
34
  viewPointForFramePoint(point: Point): Promise<Point>;
55
35
  viewQuadrilateralForFrameQuadrilateral(quadrilateral: Quadrilateral): Promise<Quadrilateral>;