scandit-react-native-datacapture-core 8.4.1 → 8.5.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/THIRD_PARTY.txt +0 -5
- package/android/build.gradle +3 -3
- package/android/generated/jni/CMakeLists.txt +21 -1
- package/dist/core.js +1581 -1545
- package/dist/core.js.map +1 -1
- package/dist/dts/hooks/ScanditProvider.d.ts +46 -0
- package/dist/dts/hooks/index.d.ts +5 -0
- package/dist/dts/hooks/useCameraPermission.d.ts +28 -0
- package/dist/dts/hooks/useIsForeground.d.ts +11 -0
- package/dist/dts/hooks/useScanditContext.d.ts +21 -0
- package/dist/dts/index.d.ts +4 -0
- package/dist/dts/native/ScanditNativeModule.d.ts +1 -1
- package/dist/dts/private/hooks/useMode.d.ts +49 -0
- package/dist/dts/private/hooks/useModeListener.d.ts +40 -0
- package/dist/dts/private/hooks/useNativeControl.d.ts +14 -0
- package/dist/dts/private/hooks/useOverlay.d.ts +68 -0
- package/dist/dts/private/hooks/useStableProp.d.ts +22 -0
- package/dist/dts/private/hooks/useViewHandle.d.ts +41 -0
- package/dist/dts/private/index.d.ts +11 -0
- package/dist/index.js +737 -6
- package/dist/index.js.flow +4 -0
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/scandit-react-native-datacapture-core.podspec +1 -1
- package/specs/NativeScanditDataCaptureCore.ts +2 -3
- package/specs/RNTDataCaptureViewNativeComponent.ts +1 -4
- package/THIRD_PARTY_ID.txt +0 -545
package/dist/core.js
CHANGED
|
@@ -391,11 +391,6 @@ class FactoryMaker {
|
|
|
391
391
|
}
|
|
392
392
|
FactoryMaker.instances = new Map();
|
|
393
393
|
|
|
394
|
-
var FocusGestureListenerEvents;
|
|
395
|
-
(function (FocusGestureListenerEvents) {
|
|
396
|
-
FocusGestureListenerEvents["onFocusGesture"] = "FocusGestureListener.onFocusGesture";
|
|
397
|
-
})(FocusGestureListenerEvents || (FocusGestureListenerEvents = {}));
|
|
398
|
-
|
|
399
394
|
/******************************************************************************
|
|
400
395
|
Copyright (c) Microsoft Corporation.
|
|
401
396
|
|
|
@@ -493,7 +488,7 @@ class DefaultSerializeable {
|
|
|
493
488
|
}
|
|
494
489
|
// Serialize the array if the elements are serializeable
|
|
495
490
|
if (Array.isArray(value)) {
|
|
496
|
-
value = value.map(e => e.toJSON ? e.toJSON() : e);
|
|
491
|
+
value = value.map(e => (e.toJSON ? e.toJSON() : e));
|
|
497
492
|
}
|
|
498
493
|
const propertyName = customPropertyNames[property] || property;
|
|
499
494
|
json[propertyName] = value;
|
|
@@ -673,119 +668,6 @@ class PrivateZoomGestureDeserializer {
|
|
|
673
668
|
}
|
|
674
669
|
}
|
|
675
670
|
|
|
676
|
-
var ZoomGestureListenerEvents;
|
|
677
|
-
(function (ZoomGestureListenerEvents) {
|
|
678
|
-
ZoomGestureListenerEvents["onZoomInGesture"] = "ZoomGestureListener.onZoomInGesture";
|
|
679
|
-
ZoomGestureListenerEvents["onZoomOutGesture"] = "ZoomGestureListener.onZoomOutGesture";
|
|
680
|
-
})(ZoomGestureListenerEvents || (ZoomGestureListenerEvents = {}));
|
|
681
|
-
|
|
682
|
-
var CameraPosition;
|
|
683
|
-
(function (CameraPosition) {
|
|
684
|
-
CameraPosition["WorldFacing"] = "worldFacing";
|
|
685
|
-
CameraPosition["UserFacing"] = "userFacing";
|
|
686
|
-
CameraPosition["Unspecified"] = "unspecified";
|
|
687
|
-
})(CameraPosition || (CameraPosition = {}));
|
|
688
|
-
|
|
689
|
-
var FrameSourceListenerEvents;
|
|
690
|
-
(function (FrameSourceListenerEvents) {
|
|
691
|
-
FrameSourceListenerEvents["didChangeState"] = "FrameSourceListener.onStateChanged";
|
|
692
|
-
})(FrameSourceListenerEvents || (FrameSourceListenerEvents = {}));
|
|
693
|
-
|
|
694
|
-
var TorchListenerEvents;
|
|
695
|
-
(function (TorchListenerEvents) {
|
|
696
|
-
TorchListenerEvents["didChangeTorchToState"] = "TorchListener.onTorchStateChanged";
|
|
697
|
-
})(TorchListenerEvents || (TorchListenerEvents = {}));
|
|
698
|
-
|
|
699
|
-
var MacroModeListenerEvents;
|
|
700
|
-
(function (MacroModeListenerEvents) {
|
|
701
|
-
MacroModeListenerEvents["didChangeMacroMode"] = "MacroModeListener.onMacroModeChanged";
|
|
702
|
-
})(MacroModeListenerEvents || (MacroModeListenerEvents = {}));
|
|
703
|
-
|
|
704
|
-
var FrameSourceState;
|
|
705
|
-
(function (FrameSourceState) {
|
|
706
|
-
FrameSourceState["On"] = "on";
|
|
707
|
-
FrameSourceState["Off"] = "off";
|
|
708
|
-
FrameSourceState["Starting"] = "starting";
|
|
709
|
-
FrameSourceState["Stopping"] = "stopping";
|
|
710
|
-
FrameSourceState["Standby"] = "standby";
|
|
711
|
-
FrameSourceState["BootingUp"] = "bootingUp";
|
|
712
|
-
FrameSourceState["WakingUp"] = "wakingUp";
|
|
713
|
-
FrameSourceState["GoingToSleep"] = "goingToSleep";
|
|
714
|
-
FrameSourceState["ShuttingDown"] = "shuttingDown";
|
|
715
|
-
})(FrameSourceState || (FrameSourceState = {}));
|
|
716
|
-
|
|
717
|
-
class ImageBuffer {
|
|
718
|
-
get width() {
|
|
719
|
-
return this._width;
|
|
720
|
-
}
|
|
721
|
-
get height() {
|
|
722
|
-
return this._height;
|
|
723
|
-
}
|
|
724
|
-
get data() {
|
|
725
|
-
return this._data;
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
class FrameDataSettings extends DefaultSerializeable {
|
|
730
|
-
constructor() {
|
|
731
|
-
super();
|
|
732
|
-
// Enables the file system cache for the frame.
|
|
733
|
-
this._isFileSystemCacheEnabled = false;
|
|
734
|
-
// The quality of the image. 0-100.
|
|
735
|
-
this._imageQuality = 100;
|
|
736
|
-
// Enables the auto-rotation of the frame.
|
|
737
|
-
this._isAutoRotateEnabled = false;
|
|
738
|
-
}
|
|
739
|
-
get isFileSystemCacheEnabled() {
|
|
740
|
-
return this._isFileSystemCacheEnabled;
|
|
741
|
-
}
|
|
742
|
-
set isFileSystemCacheEnabled(enabled) {
|
|
743
|
-
this._isFileSystemCacheEnabled = enabled;
|
|
744
|
-
}
|
|
745
|
-
get imageQuality() {
|
|
746
|
-
return this._imageQuality;
|
|
747
|
-
}
|
|
748
|
-
set imageQuality(quality) {
|
|
749
|
-
if (quality < 0 || quality > 100) {
|
|
750
|
-
throw new Error('Image quality must be between 0 and 100');
|
|
751
|
-
}
|
|
752
|
-
this._imageQuality = quality;
|
|
753
|
-
}
|
|
754
|
-
get isAutoRotateEnabled() {
|
|
755
|
-
return this._isAutoRotateEnabled;
|
|
756
|
-
}
|
|
757
|
-
set isAutoRotateEnabled(enabled) {
|
|
758
|
-
this._isAutoRotateEnabled = enabled;
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
__decorate([
|
|
762
|
-
nameForSerialization('sc_frame_isFileSystemCacheEnabled')
|
|
763
|
-
], FrameDataSettings.prototype, "_isFileSystemCacheEnabled", void 0);
|
|
764
|
-
__decorate([
|
|
765
|
-
nameForSerialization('sc_frame_imageQuality')
|
|
766
|
-
], FrameDataSettings.prototype, "_imageQuality", void 0);
|
|
767
|
-
__decorate([
|
|
768
|
-
nameForSerialization('sc_frame_autoRotate')
|
|
769
|
-
], FrameDataSettings.prototype, "_isAutoRotateEnabled", void 0);
|
|
770
|
-
|
|
771
|
-
class FrameDataSettingsBuilder {
|
|
772
|
-
constructor(settings) {
|
|
773
|
-
this.settings = settings;
|
|
774
|
-
}
|
|
775
|
-
enableFileSystemCache(enabled) {
|
|
776
|
-
this.settings.isFileSystemCacheEnabled = enabled;
|
|
777
|
-
return this;
|
|
778
|
-
}
|
|
779
|
-
setImageQuality(quality) {
|
|
780
|
-
this.settings.imageQuality = quality;
|
|
781
|
-
return this;
|
|
782
|
-
}
|
|
783
|
-
enableAutoRotate(enabled) {
|
|
784
|
-
this.settings.isAutoRotateEnabled = enabled;
|
|
785
|
-
return this;
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
|
|
789
671
|
var FontFamily;
|
|
790
672
|
(function (FontFamily) {
|
|
791
673
|
FontFamily["SystemDefault"] = "systemDefault";
|
|
@@ -1087,6 +969,10 @@ var ScanditIconType;
|
|
|
1087
969
|
ScanditIconType["InspectItem"] = "inspectItem";
|
|
1088
970
|
ScanditIconType["StarOutlined"] = "starOutlined";
|
|
1089
971
|
ScanditIconType["Print"] = "print";
|
|
972
|
+
ScanditIconType["Plus"] = "plus";
|
|
973
|
+
ScanditIconType["Minus"] = "minus";
|
|
974
|
+
ScanditIconType["Delete"] = "delete";
|
|
975
|
+
ScanditIconType["Slash"] = "slash";
|
|
1090
976
|
})(ScanditIconType || (ScanditIconType = {}));
|
|
1091
977
|
|
|
1092
978
|
class Size extends DefaultSerializeable {
|
|
@@ -1452,9 +1338,19 @@ var ScanIntention;
|
|
|
1452
1338
|
(function (ScanIntention) {
|
|
1453
1339
|
ScanIntention["Manual"] = "manual";
|
|
1454
1340
|
ScanIntention["Smart"] = "smart";
|
|
1341
|
+
/**
|
|
1342
|
+
* @deprecated Use SelectionMode.Auto instead. Will be removed in 9.0.
|
|
1343
|
+
*/
|
|
1455
1344
|
ScanIntention["SmartSelection"] = "smartSelection";
|
|
1456
1345
|
})(ScanIntention || (ScanIntention = {}));
|
|
1457
1346
|
|
|
1347
|
+
var SelectionMode;
|
|
1348
|
+
(function (SelectionMode) {
|
|
1349
|
+
SelectionMode["Off"] = "off";
|
|
1350
|
+
SelectionMode["On"] = "on";
|
|
1351
|
+
SelectionMode["Auto"] = "auto";
|
|
1352
|
+
})(SelectionMode || (SelectionMode = {}));
|
|
1353
|
+
|
|
1458
1354
|
/**
|
|
1459
1355
|
* Symbol returned by parseIfShouldHandle when an event should be skipped
|
|
1460
1356
|
* (filtered out based on viewId/modeId mismatch).
|
|
@@ -1574,57 +1470,299 @@ class HTMLElementState {
|
|
|
1574
1470
|
this.shouldBeUnderContent = false;
|
|
1575
1471
|
}
|
|
1576
1472
|
get isValid() {
|
|
1577
|
-
return this.isShown !== undefined &&
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1473
|
+
return (this.isShown !== undefined &&
|
|
1474
|
+
this.isShown !== null &&
|
|
1475
|
+
this.position !== undefined &&
|
|
1476
|
+
this.position !== null &&
|
|
1477
|
+
this.size !== undefined &&
|
|
1478
|
+
this.size !== null &&
|
|
1479
|
+
this.shouldBeUnderContent !== undefined &&
|
|
1480
|
+
this.shouldBeUnderContent !== null);
|
|
1581
1481
|
}
|
|
1582
1482
|
didChangeComparedTo(other) {
|
|
1583
1483
|
var _a, _b, _c, _d;
|
|
1584
1484
|
if (!other)
|
|
1585
1485
|
return true;
|
|
1586
|
-
const positionChanged = (_b = (_a = this.position) === null || _a === void 0 ? void 0 : _a.didChangeComparedTo(other.position)) !== null && _b !== void 0 ? _b :
|
|
1587
|
-
const sizeChanged = (_d = (_c = this.size) === null || _c === void 0 ? void 0 : _c.didChangeComparedTo(other.size)) !== null && _d !== void 0 ? _d :
|
|
1486
|
+
const positionChanged = (_b = (_a = this.position) === null || _a === void 0 ? void 0 : _a.didChangeComparedTo(other.position)) !== null && _b !== void 0 ? _b : this.position !== other.position;
|
|
1487
|
+
const sizeChanged = (_d = (_c = this.size) === null || _c === void 0 ? void 0 : _c.didChangeComparedTo(other.size)) !== null && _d !== void 0 ? _d : this.size !== other.size;
|
|
1588
1488
|
return positionChanged || sizeChanged || this.shouldBeUnderContent !== other.shouldBeUnderContent;
|
|
1589
1489
|
}
|
|
1590
1490
|
}
|
|
1591
1491
|
|
|
1592
|
-
class
|
|
1593
|
-
|
|
1594
|
-
|
|
1492
|
+
class RectangularViewfinderAnimation extends DefaultSerializeable {
|
|
1493
|
+
static fromJSON(json) {
|
|
1494
|
+
if (json === null) {
|
|
1495
|
+
return null;
|
|
1496
|
+
}
|
|
1497
|
+
return new RectangularViewfinderAnimation(json.looping);
|
|
1595
1498
|
}
|
|
1596
|
-
|
|
1597
|
-
this.
|
|
1499
|
+
get isLooping() {
|
|
1500
|
+
return this._isLooping;
|
|
1501
|
+
}
|
|
1502
|
+
constructor(isLooping) {
|
|
1503
|
+
super();
|
|
1504
|
+
this._isLooping = false;
|
|
1505
|
+
this._isLooping = isLooping;
|
|
1598
1506
|
}
|
|
1599
1507
|
}
|
|
1508
|
+
__decorate([
|
|
1509
|
+
nameForSerialization('isLooping')
|
|
1510
|
+
], RectangularViewfinderAnimation.prototype, "_isLooping", void 0);
|
|
1600
1511
|
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1512
|
+
// Capacitor returns nested values as already-parsed objects; other bridges (Cordova, RN) return JSON strings.
|
|
1513
|
+
function parseOrUse(value) {
|
|
1514
|
+
return typeof value === 'string' ? JSON.parse(value) : value;
|
|
1515
|
+
}
|
|
1516
|
+
function parseDefaults(jsonDefaults) {
|
|
1517
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
1518
|
+
const coreDefaults = {
|
|
1519
|
+
Camera: {
|
|
1520
|
+
Settings: {
|
|
1521
|
+
preferredResolution: jsonDefaults.Camera.Settings.preferredResolution,
|
|
1522
|
+
zoomFactor: jsonDefaults.Camera.Settings.zoomFactor,
|
|
1523
|
+
focusRange: jsonDefaults.Camera.Settings.focusRange,
|
|
1524
|
+
zoomGestureZoomFactor: jsonDefaults.Camera.Settings.zoomGestureZoomFactor,
|
|
1525
|
+
zoomLevels: (_a = jsonDefaults.Camera.Settings.zoomLevels) !== null && _a !== void 0 ? _a : [1, 2],
|
|
1526
|
+
focusGestureStrategy: jsonDefaults.Camera.Settings.focusGestureStrategy,
|
|
1527
|
+
shouldPreferSmoothAutoFocus: jsonDefaults.Camera.Settings.shouldPreferSmoothAutoFocus,
|
|
1528
|
+
torchLevel: (_b = jsonDefaults.Camera.Settings.torchLevel) !== null && _b !== void 0 ? _b : 1.0,
|
|
1529
|
+
macroMode: ((_c = jsonDefaults.Camera.Settings.macroMode) !== null && _c !== void 0 ? _c : 'auto'),
|
|
1530
|
+
adaptiveExposure: (_d = jsonDefaults.Camera.Settings.adaptiveExposure) !== null && _d !== void 0 ? _d : false,
|
|
1531
|
+
manualLensPosition: (_e = jsonDefaults.Camera.Settings.manualLensPosition) !== null && _e !== void 0 ? _e : 0,
|
|
1532
|
+
focusStrategy: (_f = jsonDefaults.Camera.Settings.focusStrategy) !== null && _f !== void 0 ? _f : 'auto',
|
|
1533
|
+
properties: jsonDefaults.Camera.Settings.properties,
|
|
1534
|
+
},
|
|
1535
|
+
defaultPosition: (jsonDefaults.Camera.defaultPosition || null),
|
|
1536
|
+
availablePositions: jsonDefaults.Camera.availablePositions,
|
|
1537
|
+
},
|
|
1538
|
+
ZoomSwitchControl: {
|
|
1539
|
+
orientation: ((_h = (_g = jsonDefaults.ZoomSwitchControl) === null || _g === void 0 ? void 0 : _g.orientation) !== null && _h !== void 0 ? _h : 'horizontal'),
|
|
1540
|
+
isAlwaysExpanded: (_k = (_j = jsonDefaults.ZoomSwitchControl) === null || _j === void 0 ? void 0 : _j.isAlwaysExpanded) !== null && _k !== void 0 ? _k : false,
|
|
1541
|
+
isExpanded: (_m = (_l = jsonDefaults.ZoomSwitchControl) === null || _l === void 0 ? void 0 : _l.isExpanded) !== null && _m !== void 0 ? _m : false,
|
|
1542
|
+
accessibilityLabel: (_p = (_o = jsonDefaults.ZoomSwitchControl) === null || _o === void 0 ? void 0 : _o.accessibilityLabel) !== null && _p !== void 0 ? _p : 'Zoom <level>',
|
|
1543
|
+
accessibilityHint: (_r = (_q = jsonDefaults.ZoomSwitchControl) === null || _q === void 0 ? void 0 : _q.accessibilityHint) !== null && _r !== void 0 ? _r : 'Adjusts the camera zoom level',
|
|
1544
|
+
},
|
|
1545
|
+
DataCaptureView: {
|
|
1546
|
+
scanAreaMargins: MarginsWithUnit['fromJSON'](parseOrUse(jsonDefaults.DataCaptureView.scanAreaMargins)),
|
|
1547
|
+
pointOfInterest: PointWithUnit['fromJSON'](parseOrUse(jsonDefaults.DataCaptureView.pointOfInterest)),
|
|
1548
|
+
logoAnchor: jsonDefaults.DataCaptureView.logoAnchor,
|
|
1549
|
+
logoOffset: PointWithUnit['fromJSON'](parseOrUse(jsonDefaults.DataCaptureView.logoOffset)),
|
|
1550
|
+
focusGesture: PrivateFocusGestureDeserializer['fromJSON'](parseOrUse(jsonDefaults.DataCaptureView.focusGesture)),
|
|
1551
|
+
zoomGesture: PrivateZoomGestureDeserializer['fromJSON'](parseOrUse(jsonDefaults.DataCaptureView.zoomGesture)),
|
|
1552
|
+
zoomGestures: jsonDefaults.DataCaptureView.zoomGestures
|
|
1553
|
+
? PrivateZoomGestureDeserializer['fromJSONArray'](parseOrUse(jsonDefaults.DataCaptureView.zoomGestures).map(parseOrUse))
|
|
1554
|
+
: PrivateZoomGestureDeserializer['fromJSON'](parseOrUse(jsonDefaults.DataCaptureView.zoomGesture)) != null
|
|
1555
|
+
? [PrivateZoomGestureDeserializer['fromJSON'](parseOrUse(jsonDefaults.DataCaptureView.zoomGesture))]
|
|
1556
|
+
: [],
|
|
1557
|
+
logoStyle: jsonDefaults.DataCaptureView.logoStyle,
|
|
1558
|
+
shouldShowZoomNotification: jsonDefaults.DataCaptureView.shouldShowZoomNotification,
|
|
1559
|
+
},
|
|
1560
|
+
RectangularViewfinder: Object.keys(jsonDefaults.RectangularViewfinder.styles).reduce((acc, key) => {
|
|
1561
|
+
const viewfinder = jsonDefaults.RectangularViewfinder.styles[key];
|
|
1562
|
+
acc.styles[key] = {
|
|
1563
|
+
size: SizeWithUnitAndAspect['fromJSON'](parseOrUse(viewfinder.size)),
|
|
1564
|
+
color: Color['fromJSON'](viewfinder.color),
|
|
1565
|
+
disabledColor: Color['fromJSON'](viewfinder.disabledColor),
|
|
1566
|
+
style: viewfinder.style,
|
|
1567
|
+
lineStyle: viewfinder.lineStyle,
|
|
1568
|
+
dimming: viewfinder.dimming,
|
|
1569
|
+
disabledDimming: viewfinder.disabledDimming,
|
|
1570
|
+
animation: RectangularViewfinderAnimation['fromJSON'](parseOrUse(viewfinder.animation)),
|
|
1571
|
+
};
|
|
1572
|
+
return acc;
|
|
1573
|
+
}, { defaultStyle: jsonDefaults.RectangularViewfinder.defaultStyle, styles: {} }),
|
|
1574
|
+
AimerViewfinder: {
|
|
1575
|
+
frameColor: Color['fromJSON'](jsonDefaults.AimerViewfinder.frameColor),
|
|
1576
|
+
dotColor: Color['fromJSON'](jsonDefaults.AimerViewfinder.dotColor),
|
|
1577
|
+
},
|
|
1578
|
+
Brush: new Brush(Color['fromJSON'](jsonDefaults.Brush.fillColor), Color['fromJSON'](jsonDefaults.Brush.strokeColor), jsonDefaults.Brush.strokeWidth),
|
|
1579
|
+
LaserlineViewfinder: {
|
|
1580
|
+
width: NumberWithUnit['fromJSON'](parseOrUse(jsonDefaults.LaserlineViewfinder.width)),
|
|
1581
|
+
enabledColor: Color['fromJSON'](jsonDefaults.LaserlineViewfinder.enabledColor),
|
|
1582
|
+
disabledColor: Color['fromJSON'](jsonDefaults.LaserlineViewfinder.disabledColor),
|
|
1583
|
+
},
|
|
1584
|
+
deviceID: jsonDefaults.deviceID,
|
|
1585
|
+
};
|
|
1586
|
+
// Inject defaults to avoid a circular dependency between these classes and the defaults
|
|
1587
|
+
Brush['defaults'] = coreDefaults.Brush;
|
|
1588
|
+
return coreDefaults;
|
|
1589
|
+
}
|
|
1590
|
+
|
|
1591
|
+
let coreDefaultsLoader;
|
|
1592
|
+
function setCoreDefaultsLoader(loader) {
|
|
1593
|
+
coreDefaultsLoader = loader;
|
|
1594
|
+
}
|
|
1595
|
+
function ensureCoreDefaults() {
|
|
1596
|
+
var _a, _b;
|
|
1597
|
+
const existing = (_a = FactoryMaker.instances.get('CoreDefaults')) === null || _a === void 0 ? void 0 : _a.instance;
|
|
1598
|
+
if (existing) {
|
|
1599
|
+
return existing;
|
|
1614
1600
|
}
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1601
|
+
coreDefaultsLoader === null || coreDefaultsLoader === void 0 ? void 0 : coreDefaultsLoader();
|
|
1602
|
+
const reloaded = (_b = FactoryMaker.instances.get('CoreDefaults')) === null || _b === void 0 ? void 0 : _b.instance;
|
|
1603
|
+
if (reloaded) {
|
|
1604
|
+
return reloaded;
|
|
1605
|
+
}
|
|
1606
|
+
throw new Error('CoreDefaults missing and re-init failed');
|
|
1607
|
+
}
|
|
1608
|
+
function loadCoreDefaults(jsonDefaults) {
|
|
1609
|
+
const coreDefaults = parseDefaults(jsonDefaults);
|
|
1610
|
+
FactoryMaker.bindInstanceIfNotExists('CoreDefaults', coreDefaults);
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
function getCoreDefaults() {
|
|
1614
|
+
return ensureCoreDefaults();
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1617
|
+
class ContextStatus {
|
|
1618
|
+
static fromJSON(json) {
|
|
1619
|
+
const status = new ContextStatus();
|
|
1620
|
+
status._code = json.code;
|
|
1621
|
+
status._message = json.message;
|
|
1622
|
+
status._isValid = json.isValid;
|
|
1623
|
+
return status;
|
|
1624
|
+
}
|
|
1625
|
+
get message() {
|
|
1626
|
+
return this._message;
|
|
1627
|
+
}
|
|
1628
|
+
get code() {
|
|
1629
|
+
return this._code;
|
|
1630
|
+
}
|
|
1631
|
+
get isValid() {
|
|
1632
|
+
return this._isValid;
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
class FrameDataSettings extends DefaultSerializeable {
|
|
1637
|
+
constructor() {
|
|
1638
|
+
super();
|
|
1639
|
+
// Enables the file system cache for the frame.
|
|
1640
|
+
this._isFileSystemCacheEnabled = false;
|
|
1641
|
+
// The quality of the image. 0-100.
|
|
1642
|
+
this._imageQuality = 100;
|
|
1643
|
+
// Enables the auto-rotation of the frame.
|
|
1644
|
+
this._isAutoRotateEnabled = false;
|
|
1645
|
+
}
|
|
1646
|
+
get isFileSystemCacheEnabled() {
|
|
1647
|
+
return this._isFileSystemCacheEnabled;
|
|
1648
|
+
}
|
|
1649
|
+
set isFileSystemCacheEnabled(enabled) {
|
|
1650
|
+
this._isFileSystemCacheEnabled = enabled;
|
|
1651
|
+
}
|
|
1652
|
+
get imageQuality() {
|
|
1653
|
+
return this._imageQuality;
|
|
1654
|
+
}
|
|
1655
|
+
set imageQuality(quality) {
|
|
1656
|
+
if (quality < 0 || quality > 100) {
|
|
1657
|
+
throw new Error('Image quality must be between 0 and 100');
|
|
1658
|
+
}
|
|
1659
|
+
this._imageQuality = quality;
|
|
1660
|
+
}
|
|
1661
|
+
get isAutoRotateEnabled() {
|
|
1662
|
+
return this._isAutoRotateEnabled;
|
|
1663
|
+
}
|
|
1664
|
+
set isAutoRotateEnabled(enabled) {
|
|
1665
|
+
this._isAutoRotateEnabled = enabled;
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
__decorate([
|
|
1669
|
+
nameForSerialization('sc_frame_isFileSystemCacheEnabled')
|
|
1670
|
+
], FrameDataSettings.prototype, "_isFileSystemCacheEnabled", void 0);
|
|
1671
|
+
__decorate([
|
|
1672
|
+
nameForSerialization('sc_frame_imageQuality')
|
|
1673
|
+
], FrameDataSettings.prototype, "_imageQuality", void 0);
|
|
1674
|
+
__decorate([
|
|
1675
|
+
nameForSerialization('sc_frame_autoRotate')
|
|
1676
|
+
], FrameDataSettings.prototype, "_isAutoRotateEnabled", void 0);
|
|
1677
|
+
|
|
1678
|
+
class FrameDataSettingsBuilder {
|
|
1679
|
+
constructor(settings) {
|
|
1680
|
+
this.settings = settings;
|
|
1681
|
+
}
|
|
1682
|
+
enableFileSystemCache(enabled) {
|
|
1683
|
+
this.settings.isFileSystemCacheEnabled = enabled;
|
|
1684
|
+
return this;
|
|
1685
|
+
}
|
|
1686
|
+
setImageQuality(quality) {
|
|
1687
|
+
this.settings.imageQuality = quality;
|
|
1688
|
+
return this;
|
|
1689
|
+
}
|
|
1690
|
+
enableAutoRotate(enabled) {
|
|
1691
|
+
this.settings.isAutoRotateEnabled = enabled;
|
|
1692
|
+
return this;
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1696
|
+
class DataCaptureContextSettings extends DefaultSerializeable {
|
|
1697
|
+
constructor() {
|
|
1698
|
+
super();
|
|
1699
|
+
this._frameSettings = new FrameDataSettings();
|
|
1700
|
+
}
|
|
1701
|
+
get frameDataSettings() {
|
|
1702
|
+
return this._frameSettings;
|
|
1703
|
+
}
|
|
1704
|
+
set frameDataSettings(settings) {
|
|
1705
|
+
this._frameSettings = settings;
|
|
1706
|
+
}
|
|
1707
|
+
frameDataSettingsBuilder() {
|
|
1708
|
+
return new FrameDataSettingsBuilder(this._frameSettings);
|
|
1709
|
+
}
|
|
1710
|
+
setProperty(name, value) {
|
|
1711
|
+
this[name] = value;
|
|
1712
|
+
}
|
|
1713
|
+
getProperty(name) {
|
|
1714
|
+
return this[name];
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
__decorate([
|
|
1718
|
+
nameForSerialization('frameDataSettings')
|
|
1719
|
+
], DataCaptureContextSettings.prototype, "_frameSettings", void 0);
|
|
1720
|
+
|
|
1721
|
+
class OpenSourceSoftwareLicenseInfo {
|
|
1722
|
+
constructor(licenseText) {
|
|
1723
|
+
this._licenseText = licenseText;
|
|
1724
|
+
}
|
|
1725
|
+
get licenseText() {
|
|
1726
|
+
return this._licenseText;
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
class BaseController {
|
|
1731
|
+
get _proxy() {
|
|
1732
|
+
return this._cachedProxy;
|
|
1733
|
+
}
|
|
1734
|
+
constructor(proxyName) {
|
|
1735
|
+
this._cachedProxy = FactoryMaker.createInstance(proxyName);
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1739
|
+
/*
|
|
1740
|
+
* This file is part of the Scandit Data Capture SDK
|
|
1741
|
+
*
|
|
1742
|
+
* Copyright (C) 2025- Scandit AG. All rights reserved.
|
|
1743
|
+
*/
|
|
1744
|
+
/**
|
|
1745
|
+
* Adapter class for Core operations.
|
|
1746
|
+
* Provides typed methods that internally call $executeCore.
|
|
1747
|
+
* Generated from schema definition to ensure parameter and method name consistency.
|
|
1748
|
+
*/
|
|
1749
|
+
class CoreProxyAdapter {
|
|
1750
|
+
constructor(proxy) {
|
|
1751
|
+
this.proxy = proxy;
|
|
1752
|
+
}
|
|
1753
|
+
/**
|
|
1754
|
+
* Gets the camera state for a given position
|
|
1755
|
+
* @param cameraPosition Camera position as JSON string
|
|
1756
|
+
*/
|
|
1757
|
+
getCameraState(_a) {
|
|
1758
|
+
return __awaiter(this, arguments, void 0, function* ({ cameraPosition }) {
|
|
1759
|
+
const result = yield this.proxy.$executeCore({
|
|
1760
|
+
moduleName: 'CoreModule',
|
|
1761
|
+
methodName: 'getCameraState',
|
|
1762
|
+
isEventRegistration: false,
|
|
1763
|
+
cameraPosition,
|
|
1764
|
+
});
|
|
1765
|
+
return JSON.parse(result.data);
|
|
1628
1766
|
});
|
|
1629
1767
|
}
|
|
1630
1768
|
/**
|
|
@@ -2151,885 +2289,523 @@ class CoreProxyAdapter {
|
|
|
2151
2289
|
}
|
|
2152
2290
|
}
|
|
2153
2291
|
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
void this.subscribeListener();
|
|
2292
|
+
var DataCaptureContextEvents;
|
|
2293
|
+
(function (DataCaptureContextEvents) {
|
|
2294
|
+
DataCaptureContextEvents["didChangeStatus"] = "DataCaptureContextListener.onStatusChanged";
|
|
2295
|
+
DataCaptureContextEvents["didStartObservingContext"] = "DataCaptureContextListener.onObservationStarted";
|
|
2296
|
+
})(DataCaptureContextEvents || (DataCaptureContextEvents = {}));
|
|
2297
|
+
class DataCaptureContextController extends BaseController {
|
|
2298
|
+
get framework() {
|
|
2299
|
+
return this._proxy.framework;
|
|
2163
2300
|
}
|
|
2164
|
-
get
|
|
2165
|
-
return this.
|
|
2301
|
+
get frameworkVersion() {
|
|
2302
|
+
return this._proxy.frameworkVersion;
|
|
2166
2303
|
}
|
|
2167
|
-
|
|
2168
|
-
return
|
|
2169
|
-
return yield this.adapter.getCameraState({
|
|
2170
|
-
cameraPosition: JSON.stringify(this.privateImageFrameSource.position),
|
|
2171
|
-
});
|
|
2172
|
-
});
|
|
2304
|
+
get privateContext() {
|
|
2305
|
+
return this.context;
|
|
2173
2306
|
}
|
|
2174
|
-
|
|
2307
|
+
static forDataCaptureContext(context) {
|
|
2308
|
+
return new DataCaptureContextController(context);
|
|
2309
|
+
}
|
|
2310
|
+
static getOpenSourceSoftwareLicenseInfo() {
|
|
2175
2311
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2312
|
+
const proxy = FactoryMaker.getInstance('CoreProxy');
|
|
2313
|
+
if (!proxy) {
|
|
2314
|
+
return new OpenSourceSoftwareLicenseInfo('Unable to load the open source software license info.');
|
|
2315
|
+
}
|
|
2316
|
+
const adapter = new CoreProxyAdapter(proxy);
|
|
2317
|
+
const result = yield adapter.getOpenSourceSoftwareLicenseInfo();
|
|
2318
|
+
return new OpenSourceSoftwareLicenseInfo(result);
|
|
2179
2319
|
});
|
|
2180
2320
|
}
|
|
2321
|
+
constructor(context) {
|
|
2322
|
+
super('DataCaptureContextProxy');
|
|
2323
|
+
this._listenerRegistered = false;
|
|
2324
|
+
this.adapter = new CoreProxyAdapter(this._proxy);
|
|
2325
|
+
this.context = context;
|
|
2326
|
+
}
|
|
2181
2327
|
subscribeListener() {
|
|
2182
2328
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2329
|
+
if (this._listenerRegistered) {
|
|
2330
|
+
return;
|
|
2331
|
+
}
|
|
2332
|
+
yield this.adapter.subscribeContextListener();
|
|
2333
|
+
this._proxy.subscribeForEvents(Object.values(DataCaptureContextEvents));
|
|
2334
|
+
this._proxy.eventEmitter.on(DataCaptureContextEvents.didChangeStatus, this.handleDidChangeStatusEvent.bind(this));
|
|
2335
|
+
this._proxy.eventEmitter.on(DataCaptureContextEvents.didStartObservingContext, this.handleDidStartObservingContextEvent.bind(this));
|
|
2336
|
+
this._listenerRegistered = true;
|
|
2186
2337
|
});
|
|
2187
2338
|
}
|
|
2188
|
-
|
|
2339
|
+
updateContextFromJSON() {
|
|
2189
2340
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2341
|
+
try {
|
|
2342
|
+
yield this.adapter.updateContextFromJson({ contextJson: JSON.stringify(this.context.toJSON()) });
|
|
2343
|
+
}
|
|
2344
|
+
catch (error) {
|
|
2345
|
+
this.notifyListenersOfDeserializationError(error);
|
|
2346
|
+
throw error;
|
|
2347
|
+
}
|
|
2193
2348
|
});
|
|
2194
2349
|
}
|
|
2350
|
+
addModeToContext(mode) {
|
|
2351
|
+
return this.adapter.addModeToContext({ modeJson: JSON.stringify(mode.toJSON()) });
|
|
2352
|
+
}
|
|
2353
|
+
removeModeFromContext(mode) {
|
|
2354
|
+
return this.adapter.removeModeFromContext({ modeJson: JSON.stringify(mode.toJSON()) });
|
|
2355
|
+
}
|
|
2356
|
+
removeAllModesFromContext() {
|
|
2357
|
+
return this.adapter.removeAllModes();
|
|
2358
|
+
}
|
|
2195
2359
|
dispose() {
|
|
2196
2360
|
void this.unsubscribeListener();
|
|
2361
|
+
void this.adapter.disposeContext();
|
|
2197
2362
|
this._proxy.dispose();
|
|
2198
2363
|
}
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
}
|
|
2204
|
-
if (event === null) {
|
|
2205
|
-
console.error('ImageFrameSourceController didChangeState payload is null');
|
|
2206
|
-
return;
|
|
2207
|
-
}
|
|
2208
|
-
const newState = event.state;
|
|
2209
|
-
this.privateImageFrameSource.listeners.forEach(listener => {
|
|
2210
|
-
if (listener.didChangeState) {
|
|
2211
|
-
listener.didChangeState(this.imageFrameSource, newState);
|
|
2364
|
+
unsubscribeListener() {
|
|
2365
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2366
|
+
if (!this._listenerRegistered) {
|
|
2367
|
+
return;
|
|
2212
2368
|
}
|
|
2369
|
+
yield this.adapter.unsubscribeContextListener();
|
|
2370
|
+
this._proxy.unsubscribeFromEvents(Object.values(DataCaptureContextEvents));
|
|
2371
|
+
this._proxy.eventEmitter.off(DataCaptureContextEvents.didChangeStatus, this.handleDidChangeStatusEvent.bind(this));
|
|
2372
|
+
this._proxy.eventEmitter.off(DataCaptureContextEvents.didStartObservingContext, this.handleDidStartObservingContextEvent.bind(this));
|
|
2373
|
+
this._listenerRegistered = false;
|
|
2213
2374
|
});
|
|
2214
2375
|
}
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
class ImageFrameSource extends DefaultSerializeable {
|
|
2218
|
-
set context(newContext) {
|
|
2219
|
-
if (newContext == null) {
|
|
2220
|
-
void this.controller.unsubscribeListener();
|
|
2221
|
-
}
|
|
2222
|
-
else if (this._context == null) {
|
|
2223
|
-
void this.controller.subscribeListener();
|
|
2224
|
-
}
|
|
2225
|
-
this._context = newContext;
|
|
2226
|
-
}
|
|
2227
|
-
get context() {
|
|
2228
|
-
return this._context;
|
|
2229
|
-
}
|
|
2230
|
-
get desiredState() {
|
|
2231
|
-
return this._desiredState;
|
|
2232
|
-
}
|
|
2233
|
-
static create(image) {
|
|
2234
|
-
const imageFrameSource = new ImageFrameSource();
|
|
2235
|
-
imageFrameSource.image = image;
|
|
2236
|
-
return imageFrameSource;
|
|
2237
|
-
}
|
|
2238
|
-
static fromJSON(json) {
|
|
2239
|
-
return ImageFrameSource.create(json.image);
|
|
2240
|
-
}
|
|
2241
|
-
constructor() {
|
|
2242
|
-
super();
|
|
2243
|
-
this.type = 'image';
|
|
2244
|
-
this.image = '';
|
|
2245
|
-
this._id = `${Date.now()}`;
|
|
2246
|
-
this._desiredState = FrameSourceState.Off;
|
|
2247
|
-
this.listeners = [];
|
|
2248
|
-
this._context = null;
|
|
2249
|
-
this.controller = new ImageFrameSourceController(this);
|
|
2250
|
-
}
|
|
2251
|
-
switchToDesiredState(state) {
|
|
2252
|
-
this._desiredState = state;
|
|
2253
|
-
return this.controller.switchCameraToDesiredState(state);
|
|
2376
|
+
initialize() {
|
|
2377
|
+
return this.initializeContextFromJSON();
|
|
2254
2378
|
}
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2379
|
+
initializeContextFromJSON() {
|
|
2380
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2381
|
+
try {
|
|
2382
|
+
yield this.adapter.createContextFromJson({ contextJson: JSON.stringify(this.context.toJSON()) });
|
|
2383
|
+
}
|
|
2384
|
+
catch (error) {
|
|
2385
|
+
this.notifyListenersOfDeserializationError(error);
|
|
2386
|
+
throw error;
|
|
2387
|
+
}
|
|
2388
|
+
});
|
|
2263
2389
|
}
|
|
2264
|
-
|
|
2265
|
-
|
|
2390
|
+
handleDidChangeStatusEvent(eventPayload) {
|
|
2391
|
+
const event = EventDataParser.parseIfShouldHandle(eventPayload, {});
|
|
2392
|
+
if (event === SKIP) {
|
|
2266
2393
|
return;
|
|
2267
2394
|
}
|
|
2268
|
-
if (
|
|
2395
|
+
if (event === null) {
|
|
2396
|
+
console.error('DataCaptureContextController didChangeStatus payload is null');
|
|
2269
2397
|
return;
|
|
2270
2398
|
}
|
|
2271
|
-
|
|
2399
|
+
const contextStatus = ContextStatus['fromJSON'](JSON.parse(event.status));
|
|
2400
|
+
this.notifyListenersOfDidChangeStatus(contextStatus);
|
|
2272
2401
|
}
|
|
2273
|
-
|
|
2274
|
-
|
|
2402
|
+
handleDidStartObservingContextEvent() {
|
|
2403
|
+
this.privateContext.listeners.forEach(listener => {
|
|
2404
|
+
var _a;
|
|
2405
|
+
(_a = listener.didStartObservingContext) === null || _a === void 0 ? void 0 : _a.call(listener, this.context);
|
|
2406
|
+
});
|
|
2275
2407
|
}
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2408
|
+
notifyListenersOfDeserializationError(error) {
|
|
2409
|
+
const contextStatus = ContextStatus['fromJSON']({
|
|
2410
|
+
message: error,
|
|
2411
|
+
code: -1,
|
|
2412
|
+
isValid: true,
|
|
2413
|
+
});
|
|
2414
|
+
this.notifyListenersOfDidChangeStatus(contextStatus);
|
|
2283
2415
|
}
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2416
|
+
notifyListenersOfDidChangeStatus(contextStatus) {
|
|
2417
|
+
this.privateContext.listeners.forEach(listener => {
|
|
2418
|
+
if (listener.didChangeStatus) {
|
|
2419
|
+
listener.didChangeStatus(this.context, contextStatus);
|
|
2420
|
+
}
|
|
2421
|
+
});
|
|
2289
2422
|
}
|
|
2290
2423
|
}
|
|
2291
|
-
__decorate([
|
|
2292
|
-
nameForSerialization('id')
|
|
2293
|
-
], ImageFrameSource.prototype, "_id", void 0);
|
|
2294
|
-
__decorate([
|
|
2295
|
-
nameForSerialization('desiredState')
|
|
2296
|
-
], ImageFrameSource.prototype, "_desiredState", void 0);
|
|
2297
|
-
__decorate([
|
|
2298
|
-
ignoreFromSerialization
|
|
2299
|
-
], ImageFrameSource.prototype, "listeners", void 0);
|
|
2300
|
-
__decorate([
|
|
2301
|
-
ignoreFromSerialization
|
|
2302
|
-
], ImageFrameSource.prototype, "_context", void 0);
|
|
2303
|
-
__decorate([
|
|
2304
|
-
ignoreFromSerialization
|
|
2305
|
-
], ImageFrameSource.prototype, "controller", void 0);
|
|
2306
2424
|
|
|
2307
|
-
class
|
|
2308
|
-
get
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
return
|
|
2313
|
-
}
|
|
2314
|
-
get orientation() {
|
|
2315
|
-
return this._orientation;
|
|
2316
|
-
}
|
|
2317
|
-
get timestamp() {
|
|
2318
|
-
return this._timestamp;
|
|
2425
|
+
class DataCaptureContext extends DefaultSerializeable {
|
|
2426
|
+
static get sharedInstance() {
|
|
2427
|
+
if (DataCaptureContext._instance == null) {
|
|
2428
|
+
DataCaptureContext._instance = new DataCaptureContext('', '', null);
|
|
2429
|
+
}
|
|
2430
|
+
return DataCaptureContext._instance;
|
|
2319
2431
|
}
|
|
2320
|
-
static
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
frameData._imageBuffers = json.imageBuffers.map((imageBufferJSON) => {
|
|
2324
|
-
const imageBuffer = new ImageBuffer();
|
|
2325
|
-
imageBuffer._width = imageBufferJSON.width;
|
|
2326
|
-
imageBuffer._height = imageBufferJSON.height;
|
|
2327
|
-
imageBuffer._data = imageBufferJSON.data;
|
|
2328
|
-
return imageBuffer;
|
|
2432
|
+
static getOpenSourceSoftwareLicenseInfo() {
|
|
2433
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2434
|
+
return DataCaptureContextController.getOpenSourceSoftwareLicenseInfo();
|
|
2329
2435
|
});
|
|
2330
|
-
frameData._orientation = json.orientation;
|
|
2331
|
-
frameData._timestamp = (_a = json.timestamp) !== null && _a !== void 0 ? _a : -1;
|
|
2332
|
-
return frameData;
|
|
2333
|
-
}
|
|
2334
|
-
static empty() {
|
|
2335
|
-
const frameData = new PrivateFrameData();
|
|
2336
|
-
frameData._imageBuffers = [];
|
|
2337
|
-
frameData._orientation = 90;
|
|
2338
|
-
frameData._timestamp = -1;
|
|
2339
|
-
return frameData;
|
|
2340
2436
|
}
|
|
2341
|
-
}
|
|
2342
|
-
|
|
2343
|
-
var TorchState;
|
|
2344
|
-
(function (TorchState) {
|
|
2345
|
-
TorchState["On"] = "on";
|
|
2346
|
-
TorchState["Off"] = "off";
|
|
2347
|
-
TorchState["Auto"] = "auto";
|
|
2348
|
-
})(TorchState || (TorchState = {}));
|
|
2349
|
-
|
|
2350
|
-
/**
|
|
2351
|
-
* Camera lifecycle and operation handling:
|
|
2352
|
-
*
|
|
2353
|
-
* Phase 1 - Initial State (before native creation starts):
|
|
2354
|
-
* - Camera object exists in TypeScript but not yet being created on native side
|
|
2355
|
-
* - State changes (torch, desired state, settings) only update TypeScript properties
|
|
2356
|
-
* - No native calls are triggered
|
|
2357
|
-
*
|
|
2358
|
-
* Phase 2 - Native Creation In Progress (after setFrameSource, before context set):
|
|
2359
|
-
* - setFrameSource() called on DataCaptureContext, triggering setNativeFrameSourceIsBeingCreated()
|
|
2360
|
-
* - A promise is created that will resolve when the native camera is ready
|
|
2361
|
-
* - State changes during this phase await the native ready promise before executing
|
|
2362
|
-
* - Native camera is created asynchronously
|
|
2363
|
-
*
|
|
2364
|
-
* Phase 3 - Active State (after context set):
|
|
2365
|
-
* - Native camera is ready and available
|
|
2366
|
-
* - The native ready promise is resolved
|
|
2367
|
-
* - All state changes execute immediately on native side
|
|
2368
|
-
*/
|
|
2369
|
-
class Camera extends DefaultSerializeable {
|
|
2370
2437
|
static get coreDefaults() {
|
|
2371
2438
|
return getCoreDefaults();
|
|
2372
2439
|
}
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
if (!cameraPosition) {
|
|
2376
|
-
return null;
|
|
2377
|
-
}
|
|
2378
|
-
const existingCamera = Camera._cameraInstances.get(cameraPosition);
|
|
2379
|
-
if (existingCamera) {
|
|
2380
|
-
existingCamera.resetPhaseState();
|
|
2381
|
-
if (settings !== undefined) {
|
|
2382
|
-
existingCamera.settings = settings;
|
|
2383
|
-
}
|
|
2384
|
-
if (desiredTorchState !== undefined) {
|
|
2385
|
-
existingCamera._desiredTorchState = desiredTorchState;
|
|
2386
|
-
void existingCamera.didChange();
|
|
2387
|
-
}
|
|
2388
|
-
if (desiredState !== undefined) {
|
|
2389
|
-
existingCamera._desiredState = desiredState;
|
|
2390
|
-
void existingCamera.controller.switchCameraToDesiredState(desiredState);
|
|
2391
|
-
}
|
|
2392
|
-
return existingCamera;
|
|
2393
|
-
}
|
|
2394
|
-
if (!Camera.coreDefaults.Camera.availablePositions.includes(cameraPosition)) {
|
|
2395
|
-
return null;
|
|
2396
|
-
}
|
|
2397
|
-
const camera = new Camera(cameraPosition, settings, desiredTorchState, desiredState);
|
|
2398
|
-
Camera._cameraInstances.set(cameraPosition, camera);
|
|
2399
|
-
return camera;
|
|
2440
|
+
get frameSource() {
|
|
2441
|
+
return this._frameSource;
|
|
2400
2442
|
}
|
|
2401
|
-
static
|
|
2402
|
-
return
|
|
2443
|
+
static get deviceID() {
|
|
2444
|
+
return DataCaptureContext.coreDefaults.deviceID;
|
|
2403
2445
|
}
|
|
2404
|
-
static
|
|
2405
|
-
|
|
2446
|
+
static forLicenseKey(licenseKey) {
|
|
2447
|
+
const instance = DataCaptureContext.create(licenseKey, null, null);
|
|
2448
|
+
// Call initialize to ensure the shared instance is updated.
|
|
2449
|
+
void instance.controller.initialize();
|
|
2450
|
+
return instance;
|
|
2406
2451
|
}
|
|
2407
|
-
static
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
if (existingCamera) {
|
|
2413
|
-
return existingCamera;
|
|
2414
|
-
}
|
|
2415
|
-
return Camera.create(cameraPosition);
|
|
2452
|
+
static forLicenseKeyWithSettings(licenseKey, settings) {
|
|
2453
|
+
const instance = DataCaptureContext.create(licenseKey, null, settings);
|
|
2454
|
+
// Call initialize to ensure the shared instance is updated.
|
|
2455
|
+
void instance.controller.initialize();
|
|
2456
|
+
return instance;
|
|
2416
2457
|
}
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2458
|
+
static forLicenseKeyWithOptions(licenseKey, options) {
|
|
2459
|
+
const instance = DataCaptureContext.create(licenseKey, options, null);
|
|
2460
|
+
// Call initialize to ensure the shared instance is updated.
|
|
2461
|
+
void instance.controller.initialize();
|
|
2462
|
+
return instance;
|
|
2463
|
+
}
|
|
2464
|
+
static initialize(licenseKey, options = null, settings = null) {
|
|
2465
|
+
DataCaptureContext.create(licenseKey, options, settings);
|
|
2466
|
+
void DataCaptureContext.sharedInstance.controller.initialize();
|
|
2467
|
+
return DataCaptureContext.sharedInstance;
|
|
2468
|
+
}
|
|
2469
|
+
static create(licenseKey, options, settings) {
|
|
2470
|
+
DataCaptureContext.sharedInstance.licenseKey = licenseKey;
|
|
2471
|
+
DataCaptureContext.sharedInstance.deviceName = (options === null || options === void 0 ? void 0 : options.deviceName) || '';
|
|
2472
|
+
DataCaptureContext.sharedInstance.settings = settings || new DataCaptureContextSettings();
|
|
2473
|
+
return DataCaptureContext.sharedInstance;
|
|
2474
|
+
}
|
|
2475
|
+
constructor(licenseKey, deviceName, settings) {
|
|
2476
|
+
super();
|
|
2477
|
+
this.licenseKey = licenseKey;
|
|
2478
|
+
this.deviceName = deviceName;
|
|
2479
|
+
this._framework = 'unknown';
|
|
2480
|
+
this._frameworkVersion = 'unknown';
|
|
2481
|
+
this.settings = new DataCaptureContextSettings();
|
|
2482
|
+
this._frameSource = null;
|
|
2483
|
+
this.view = null;
|
|
2484
|
+
this.modes = [];
|
|
2426
2485
|
this.listeners = [];
|
|
2427
|
-
this.
|
|
2428
|
-
this.
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
this.
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
this.settings = settings || null;
|
|
2438
|
-
this._desiredTorchState = desiredTorchState || TorchState.Off;
|
|
2439
|
-
this._desiredState = desiredState || FrameSourceState.Off;
|
|
2440
|
-
this.controller = new CameraController(this);
|
|
2486
|
+
this.licenseKey = licenseKey;
|
|
2487
|
+
this.deviceName = deviceName;
|
|
2488
|
+
if (settings) {
|
|
2489
|
+
this.settings = settings;
|
|
2490
|
+
}
|
|
2491
|
+
if (this.controller == null) {
|
|
2492
|
+
this.controller = DataCaptureContextController.forDataCaptureContext(this);
|
|
2493
|
+
this._framework = this.controller.framework;
|
|
2494
|
+
this._frameworkVersion = this.controller.frameworkVersion;
|
|
2495
|
+
}
|
|
2441
2496
|
}
|
|
2442
|
-
|
|
2497
|
+
setFrameSource(frameSource) {
|
|
2443
2498
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2444
|
-
this.
|
|
2445
|
-
|
|
2446
|
-
// Phase 2: Wait for native camera to be ready, then switch state
|
|
2447
|
-
yield this.nativeReadyPromise;
|
|
2448
|
-
yield this.controller.switchCameraToDesiredState(state);
|
|
2449
|
-
return;
|
|
2499
|
+
if (this._frameSource) {
|
|
2500
|
+
this._frameSource.context = null;
|
|
2450
2501
|
}
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2502
|
+
this._frameSource = frameSource;
|
|
2503
|
+
if (frameSource) {
|
|
2504
|
+
// Set the flag to indicate that the native frame source is being created
|
|
2505
|
+
frameSource.setNativeFrameSourceIsBeingCreated();
|
|
2506
|
+
}
|
|
2507
|
+
yield this.update();
|
|
2508
|
+
// Make camera active once the set on native side is complete
|
|
2509
|
+
if (frameSource) {
|
|
2510
|
+
frameSource.context = this;
|
|
2455
2511
|
}
|
|
2456
|
-
// Phase 3: Execute immediately
|
|
2457
|
-
yield this.controller.switchCameraToDesiredState(state);
|
|
2458
2512
|
});
|
|
2459
2513
|
}
|
|
2460
|
-
getCurrentState() {
|
|
2461
|
-
return Promise.resolve(this.currentCameraState);
|
|
2462
|
-
}
|
|
2463
|
-
getIsTorchAvailable() {
|
|
2464
|
-
return this.controller.getIsTorchAvailable();
|
|
2465
|
-
}
|
|
2466
2514
|
addListener(listener) {
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2515
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2516
|
+
if (this.listeners.length === 0) {
|
|
2517
|
+
yield this.controller.subscribeListener();
|
|
2518
|
+
}
|
|
2519
|
+
if (this.listeners.includes(listener)) {
|
|
2520
|
+
return;
|
|
2521
|
+
}
|
|
2522
|
+
this.listeners.push(listener);
|
|
2523
|
+
});
|
|
2474
2524
|
}
|
|
2475
2525
|
removeListener(listener) {
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2526
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2527
|
+
if (!this.listeners.includes(listener)) {
|
|
2528
|
+
return;
|
|
2529
|
+
}
|
|
2530
|
+
this.listeners.splice(this.listeners.indexOf(listener), 1);
|
|
2531
|
+
if (this.listeners.length === 0) {
|
|
2532
|
+
return this.controller.unsubscribeListener();
|
|
2533
|
+
}
|
|
2534
|
+
});
|
|
2483
2535
|
}
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
}
|
|
2488
|
-
this.torchListeners.push(listener);
|
|
2489
|
-
this._hasTorchStateListeners = this.torchListeners.length > 0;
|
|
2490
|
-
if (this.torchListeners.length === 1) {
|
|
2491
|
-
void this.controller.subscribeTorchListener();
|
|
2492
|
-
}
|
|
2493
|
-
if (this.isActiveCamera) {
|
|
2494
|
-
void this.didChange();
|
|
2495
|
-
}
|
|
2536
|
+
addMode(mode) {
|
|
2537
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2538
|
+
yield this.addModeInternal(mode);
|
|
2539
|
+
});
|
|
2496
2540
|
}
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
this._hasTorchStateListeners = this.torchListeners.length > 0;
|
|
2503
|
-
if (this.torchListeners.length === 0) {
|
|
2504
|
-
void this.controller.unsubscribeTorchListener();
|
|
2505
|
-
}
|
|
2506
|
-
if (this.isActiveCamera) {
|
|
2507
|
-
void this.didChange();
|
|
2508
|
-
}
|
|
2541
|
+
setMode(mode) {
|
|
2542
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2543
|
+
yield this.removeAllModes();
|
|
2544
|
+
yield this.addModeInternal(mode);
|
|
2545
|
+
});
|
|
2509
2546
|
}
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
void this.didChange();
|
|
2521
|
-
}
|
|
2547
|
+
removeCurrentMode() {
|
|
2548
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2549
|
+
if (this.modes.length === 0) {
|
|
2550
|
+
return;
|
|
2551
|
+
}
|
|
2552
|
+
if (this.modes.length > 1) {
|
|
2553
|
+
console.warn('removeCurrentMode() called with multiple modes active. Consider using removeMode() for specific mode removal. Only the first mode will be removed.');
|
|
2554
|
+
}
|
|
2555
|
+
yield this.removeModeInternal(this.modes[0]);
|
|
2556
|
+
});
|
|
2522
2557
|
}
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
}
|
|
2527
|
-
this.macroModeListeners.splice(this.macroModeListeners.indexOf(listener), 1);
|
|
2528
|
-
this._hasMacroModeListeners = this.macroModeListeners.length > 0;
|
|
2529
|
-
if (this.macroModeListeners.length === 0) {
|
|
2530
|
-
void this.controller.unsubscribeMacroModeListener();
|
|
2531
|
-
}
|
|
2532
|
-
if (this.isActiveCamera) {
|
|
2533
|
-
void this.didChange();
|
|
2534
|
-
}
|
|
2558
|
+
removeMode(mode) {
|
|
2559
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2560
|
+
yield this.removeModeInternal(mode);
|
|
2561
|
+
});
|
|
2535
2562
|
}
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
}
|
|
2563
|
+
removeAllModes() {
|
|
2564
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2565
|
+
if (this.modes.length === 0) {
|
|
2566
|
+
return;
|
|
2567
|
+
}
|
|
2568
|
+
this.modes.forEach(mode => {
|
|
2569
|
+
mode._context = null;
|
|
2570
|
+
});
|
|
2571
|
+
this.modes = [];
|
|
2572
|
+
yield this.controller.removeAllModesFromContext();
|
|
2573
|
+
});
|
|
2548
2574
|
}
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
void this.didChange();
|
|
2560
|
-
}
|
|
2575
|
+
dispose() {
|
|
2576
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2577
|
+
var _a;
|
|
2578
|
+
if (!this.controller) {
|
|
2579
|
+
return;
|
|
2580
|
+
}
|
|
2581
|
+
(_a = this.view) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
2582
|
+
yield this.removeAllModes();
|
|
2583
|
+
this.controller.dispose();
|
|
2584
|
+
});
|
|
2561
2585
|
}
|
|
2562
2586
|
applySettings(settings) {
|
|
2563
2587
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2564
2588
|
this.settings = settings;
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
yield this.didChange();
|
|
2589
|
+
yield this.update();
|
|
2590
|
+
});
|
|
2591
|
+
}
|
|
2592
|
+
update() {
|
|
2593
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2594
|
+
if (!this.controller) {
|
|
2595
|
+
return;
|
|
2573
2596
|
}
|
|
2574
|
-
|
|
2597
|
+
yield this.controller.updateContextFromJSON();
|
|
2575
2598
|
});
|
|
2576
2599
|
}
|
|
2577
|
-
|
|
2578
|
-
this._context = newContext;
|
|
2579
|
-
if (newContext) {
|
|
2580
|
-
// Phase 3: Native camera is ready, resolve the promise so waiting operations can proceed
|
|
2581
|
-
if (this.nativeReadyTimeout) {
|
|
2582
|
-
clearTimeout(this.nativeReadyTimeout);
|
|
2583
|
-
this.nativeReadyTimeout = null;
|
|
2584
|
-
}
|
|
2585
|
-
if (this.nativeReadyResolver) {
|
|
2586
|
-
this.nativeReadyResolver();
|
|
2587
|
-
this.nativeReadyResolver = null;
|
|
2588
|
-
this.nativeReadyRejecter = null;
|
|
2589
|
-
this.nativeReadyPromise = null;
|
|
2590
|
-
}
|
|
2591
|
-
}
|
|
2592
|
-
else {
|
|
2593
|
-
// When context is removed, reset everything
|
|
2594
|
-
if (this.nativeReadyTimeout) {
|
|
2595
|
-
clearTimeout(this.nativeReadyTimeout);
|
|
2596
|
-
this.nativeReadyTimeout = null;
|
|
2597
|
-
}
|
|
2598
|
-
this.nativeReadyResolver = null;
|
|
2599
|
-
this.nativeReadyRejecter = null;
|
|
2600
|
-
this.nativeReadyPromise = null;
|
|
2601
|
-
}
|
|
2602
|
-
}
|
|
2603
|
-
get context() {
|
|
2604
|
-
return this._context;
|
|
2605
|
-
}
|
|
2606
|
-
setNativeFrameSourceIsBeingCreated() {
|
|
2607
|
-
this.nativeReadyPromise = new Promise((resolve, reject) => {
|
|
2608
|
-
this.nativeReadyResolver = resolve;
|
|
2609
|
-
this.nativeReadyRejecter = reject;
|
|
2610
|
-
this.nativeReadyTimeout = setTimeout(() => {
|
|
2611
|
-
this.nativeReadyTimeout = null;
|
|
2612
|
-
if (this.nativeReadyRejecter) {
|
|
2613
|
-
this.nativeReadyRejecter(new Error('Camera native initialization timed out after 5 seconds'));
|
|
2614
|
-
this.nativeReadyResolver = null;
|
|
2615
|
-
this.nativeReadyRejecter = null;
|
|
2616
|
-
this.nativeReadyPromise = null;
|
|
2617
|
-
}
|
|
2618
|
-
}, 5000);
|
|
2619
|
-
});
|
|
2620
|
-
}
|
|
2621
|
-
get isActiveCamera() {
|
|
2622
|
-
return this._context !== null;
|
|
2623
|
-
}
|
|
2624
|
-
static get default() {
|
|
2625
|
-
const defaultPosition = Camera.coreDefaults.Camera.defaultPosition;
|
|
2626
|
-
if (!defaultPosition) {
|
|
2627
|
-
return null;
|
|
2628
|
-
}
|
|
2629
|
-
return Camera.atPosition(defaultPosition);
|
|
2630
|
-
}
|
|
2631
|
-
static isMacroModeAvailable() {
|
|
2600
|
+
addModeInternal(mode) {
|
|
2632
2601
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2602
|
+
if (!this.modes.includes(mode)) {
|
|
2603
|
+
this.modes.push(mode);
|
|
2604
|
+
yield this.controller.addModeToContext(mode);
|
|
2605
|
+
mode._context = this;
|
|
2636
2606
|
}
|
|
2637
|
-
const adapter = new CoreProxyAdapter(proxy);
|
|
2638
|
-
return yield adapter.isMacroModeAvailable();
|
|
2639
2607
|
});
|
|
2640
2608
|
}
|
|
2641
|
-
|
|
2642
|
-
return this._position;
|
|
2643
|
-
}
|
|
2644
|
-
get isTorchAvailable() {
|
|
2645
|
-
return this.controller.getIsTorchAvailable();
|
|
2646
|
-
}
|
|
2647
|
-
get desiredState() {
|
|
2648
|
-
return this._desiredState;
|
|
2649
|
-
}
|
|
2650
|
-
set desiredTorchState(desiredTorchState) {
|
|
2651
|
-
this._desiredTorchState = desiredTorchState;
|
|
2652
|
-
if (this.nativeReadyPromise) {
|
|
2653
|
-
// Phase 2: Wait for native camera to be ready, then update
|
|
2654
|
-
void this.nativeReadyPromise.then(() => this.didChange());
|
|
2655
|
-
}
|
|
2656
|
-
else if (this.isActiveCamera) {
|
|
2657
|
-
// Phase 3: Execute immediately
|
|
2658
|
-
void this.didChange();
|
|
2659
|
-
}
|
|
2660
|
-
// Phase 1: Just update the property, no action needed
|
|
2661
|
-
}
|
|
2662
|
-
get desiredTorchState() {
|
|
2663
|
-
return this._desiredTorchState;
|
|
2664
|
-
}
|
|
2665
|
-
didChange() {
|
|
2609
|
+
removeModeInternal(mode) {
|
|
2666
2610
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2667
|
-
|
|
2668
|
-
|
|
2611
|
+
const index = this.modes.indexOf(mode);
|
|
2612
|
+
if (index !== -1) {
|
|
2613
|
+
this.modes.splice(index, 1);
|
|
2669
2614
|
}
|
|
2615
|
+
mode._context = null;
|
|
2616
|
+
yield this.controller.removeModeFromContext(mode);
|
|
2670
2617
|
});
|
|
2671
2618
|
}
|
|
2672
|
-
resetPhaseState() {
|
|
2673
|
-
if (this.nativeReadyTimeout) {
|
|
2674
|
-
clearTimeout(this.nativeReadyTimeout);
|
|
2675
|
-
this.nativeReadyTimeout = null;
|
|
2676
|
-
}
|
|
2677
|
-
this.nativeReadyResolver = null;
|
|
2678
|
-
this.nativeReadyRejecter = null;
|
|
2679
|
-
this.nativeReadyPromise = null;
|
|
2680
|
-
}
|
|
2681
2619
|
}
|
|
2682
|
-
Camera._cameraInstances = new Map();
|
|
2683
|
-
__decorate([
|
|
2684
|
-
ignoreFromSerialization
|
|
2685
|
-
], Camera.prototype, "controller", void 0);
|
|
2686
|
-
__decorate([
|
|
2687
|
-
serializationDefault({})
|
|
2688
|
-
], Camera.prototype, "settings", void 0);
|
|
2689
|
-
__decorate([
|
|
2690
|
-
nameForSerialization('position')
|
|
2691
|
-
], Camera.prototype, "_position", void 0);
|
|
2692
|
-
__decorate([
|
|
2693
|
-
nameForSerialization('desiredTorchState')
|
|
2694
|
-
], Camera.prototype, "_desiredTorchState", void 0);
|
|
2695
|
-
__decorate([
|
|
2696
|
-
nameForSerialization('desiredState')
|
|
2697
|
-
], Camera.prototype, "_desiredState", void 0);
|
|
2698
|
-
__decorate([
|
|
2699
|
-
nameForSerialization('hasTorchStateListeners')
|
|
2700
|
-
], Camera.prototype, "_hasTorchStateListeners", void 0);
|
|
2701
|
-
__decorate([
|
|
2702
|
-
nameForSerialization('hasMacroModeListeners')
|
|
2703
|
-
], Camera.prototype, "_hasMacroModeListeners", void 0);
|
|
2704
|
-
__decorate([
|
|
2705
|
-
ignoreFromSerialization
|
|
2706
|
-
], Camera.prototype, "currentCameraState", void 0);
|
|
2707
|
-
__decorate([
|
|
2708
|
-
ignoreFromSerialization
|
|
2709
|
-
], Camera.prototype, "listeners", void 0);
|
|
2710
|
-
__decorate([
|
|
2711
|
-
ignoreFromSerialization
|
|
2712
|
-
], Camera.prototype, "torchListeners", void 0);
|
|
2713
2620
|
__decorate([
|
|
2714
2621
|
ignoreFromSerialization
|
|
2715
|
-
],
|
|
2716
|
-
__decorate([
|
|
2717
|
-
ignoreFromSerialization
|
|
2718
|
-
], Camera.prototype, "zoomListeners", void 0);
|
|
2622
|
+
], DataCaptureContext.prototype, "controller", void 0);
|
|
2719
2623
|
__decorate([
|
|
2720
|
-
nameForSerialization('
|
|
2721
|
-
],
|
|
2624
|
+
nameForSerialization('framework')
|
|
2625
|
+
], DataCaptureContext.prototype, "_framework", void 0);
|
|
2722
2626
|
__decorate([
|
|
2723
|
-
|
|
2724
|
-
],
|
|
2627
|
+
nameForSerialization('frameworkVersion')
|
|
2628
|
+
], DataCaptureContext.prototype, "_frameworkVersion", void 0);
|
|
2725
2629
|
__decorate([
|
|
2726
|
-
|
|
2727
|
-
],
|
|
2630
|
+
nameForSerialization('frameSource')
|
|
2631
|
+
], DataCaptureContext.prototype, "_frameSource", void 0);
|
|
2728
2632
|
__decorate([
|
|
2729
2633
|
ignoreFromSerialization
|
|
2730
|
-
],
|
|
2634
|
+
], DataCaptureContext.prototype, "view", void 0);
|
|
2731
2635
|
__decorate([
|
|
2732
2636
|
ignoreFromSerialization
|
|
2733
|
-
],
|
|
2637
|
+
], DataCaptureContext.prototype, "modes", void 0);
|
|
2734
2638
|
__decorate([
|
|
2735
2639
|
ignoreFromSerialization
|
|
2736
|
-
],
|
|
2640
|
+
], DataCaptureContext.prototype, "listeners", void 0);
|
|
2737
2641
|
__decorate([
|
|
2738
2642
|
ignoreFromSerialization
|
|
2739
|
-
],
|
|
2643
|
+
], DataCaptureContext, "_instance", void 0);
|
|
2740
2644
|
__decorate([
|
|
2741
2645
|
ignoreFromSerialization
|
|
2742
|
-
],
|
|
2646
|
+
], DataCaptureContext, "coreDefaults", null);
|
|
2743
2647
|
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2648
|
+
var VibrationType;
|
|
2649
|
+
(function (VibrationType) {
|
|
2650
|
+
VibrationType["default"] = "default";
|
|
2651
|
+
VibrationType["selectionHaptic"] = "selectionHaptic";
|
|
2652
|
+
VibrationType["successHaptic"] = "successHaptic";
|
|
2653
|
+
VibrationType["failureHaptic"] = "failureHaptic";
|
|
2654
|
+
VibrationType["waveForm"] = "waveForm";
|
|
2655
|
+
VibrationType["impactHaptic"] = "impactHaptic";
|
|
2656
|
+
})(VibrationType || (VibrationType = {}));
|
|
2657
|
+
|
|
2658
|
+
class Vibration extends DefaultSerializeable {
|
|
2659
|
+
static get defaultVibration() {
|
|
2660
|
+
return new Vibration(VibrationType.default);
|
|
2750
2661
|
}
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
this.waitingQueue = new Map();
|
|
2754
|
-
this.protectedCameras = new Set();
|
|
2662
|
+
static get selectionHapticFeedback() {
|
|
2663
|
+
return new Vibration(VibrationType.selectionHaptic);
|
|
2755
2664
|
}
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
if (currentOwner && currentOwner.id !== owner.id) {
|
|
2759
|
-
return false; // Already owned by someone else
|
|
2760
|
-
}
|
|
2761
|
-
this.owners.set(position, owner);
|
|
2762
|
-
this.enableProtectionForOwner(position, owner);
|
|
2763
|
-
return true;
|
|
2665
|
+
static get successHapticFeedback() {
|
|
2666
|
+
return new Vibration(VibrationType.successHaptic);
|
|
2764
2667
|
}
|
|
2765
|
-
|
|
2766
|
-
return
|
|
2767
|
-
// Try immediate acquisition first
|
|
2768
|
-
if (this.requestOwnership(position, owner)) {
|
|
2769
|
-
return true;
|
|
2770
|
-
}
|
|
2771
|
-
// If not available, wait in queue
|
|
2772
|
-
return new Promise((resolve) => {
|
|
2773
|
-
const request = { owner, resolve };
|
|
2774
|
-
if (!this.waitingQueue.has(position)) {
|
|
2775
|
-
this.waitingQueue.set(position, []);
|
|
2776
|
-
}
|
|
2777
|
-
this.waitingQueue.get(position).push(request);
|
|
2778
|
-
// Optional timeout
|
|
2779
|
-
if (timeoutMs && timeoutMs > 0) {
|
|
2780
|
-
setTimeout(() => {
|
|
2781
|
-
this.removeFromQueue(position, request);
|
|
2782
|
-
resolve(false); // Timeout - ownership not acquired
|
|
2783
|
-
}, timeoutMs);
|
|
2784
|
-
}
|
|
2785
|
-
});
|
|
2786
|
-
});
|
|
2668
|
+
static get failureHapticFeedback() {
|
|
2669
|
+
return new Vibration(VibrationType.failureHaptic);
|
|
2787
2670
|
}
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2671
|
+
static get impactHapticFeedback() {
|
|
2672
|
+
return new Vibration(VibrationType.impactHaptic);
|
|
2673
|
+
}
|
|
2674
|
+
static fromJSON(json) {
|
|
2675
|
+
if (json.type === 'waveForm') {
|
|
2676
|
+
return new WaveFormVibration(json.timings, json.amplitudes);
|
|
2792
2677
|
}
|
|
2793
|
-
|
|
2794
|
-
this.disableProtectionForPosition(position);
|
|
2795
|
-
this.processWaitingQueue(position);
|
|
2796
|
-
return true;
|
|
2678
|
+
return new Vibration(json.type);
|
|
2797
2679
|
}
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2680
|
+
constructor(type) {
|
|
2681
|
+
super();
|
|
2682
|
+
this.type = type;
|
|
2801
2683
|
}
|
|
2802
|
-
|
|
2803
|
-
|
|
2684
|
+
}
|
|
2685
|
+
class WaveFormVibration extends Vibration {
|
|
2686
|
+
get timings() {
|
|
2687
|
+
return this._timings;
|
|
2804
2688
|
}
|
|
2805
|
-
|
|
2806
|
-
return this.
|
|
2689
|
+
get amplitudes() {
|
|
2690
|
+
return this._amplitudes;
|
|
2807
2691
|
}
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
}
|
|
2813
|
-
}
|
|
2814
|
-
return null;
|
|
2692
|
+
constructor(timings, amplitudes = null) {
|
|
2693
|
+
super(VibrationType.waveForm);
|
|
2694
|
+
this._timings = timings;
|
|
2695
|
+
this._amplitudes = amplitudes;
|
|
2815
2696
|
}
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2697
|
+
}
|
|
2698
|
+
__decorate([
|
|
2699
|
+
nameForSerialization('timings')
|
|
2700
|
+
], WaveFormVibration.prototype, "_timings", void 0);
|
|
2701
|
+
__decorate([
|
|
2702
|
+
ignoreFromSerializationIfNull,
|
|
2703
|
+
nameForSerialization('amplitudes')
|
|
2704
|
+
], WaveFormVibration.prototype, "_amplitudes", void 0);
|
|
2705
|
+
|
|
2706
|
+
class Sound extends DefaultSerializeable {
|
|
2707
|
+
static get defaultSound() {
|
|
2708
|
+
return new Sound(null);
|
|
2824
2709
|
}
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
if (!camera || this.protectedCameras.has(camera)) {
|
|
2828
|
-
return; // Camera not available or already protected
|
|
2829
|
-
}
|
|
2830
|
-
this.protectCameraForOwner(camera, position, owner);
|
|
2831
|
-
this.protectedCameras.add(camera);
|
|
2710
|
+
static fromJSON(json) {
|
|
2711
|
+
return new Sound(json.resource);
|
|
2832
2712
|
}
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
}
|
|
2838
|
-
this.unprotectCamera(camera);
|
|
2839
|
-
this.protectedCameras.delete(camera);
|
|
2713
|
+
constructor(resource) {
|
|
2714
|
+
super();
|
|
2715
|
+
this.resource = null;
|
|
2716
|
+
this.resource = resource;
|
|
2840
2717
|
}
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
nextRequest.resolve(true);
|
|
2851
|
-
// Clean up empty queue
|
|
2852
|
-
if (queue.length === 0) {
|
|
2853
|
-
this.waitingQueue.delete(position);
|
|
2854
|
-
}
|
|
2718
|
+
}
|
|
2719
|
+
__decorate([
|
|
2720
|
+
ignoreFromSerializationIfNull
|
|
2721
|
+
], Sound.prototype, "resource", void 0);
|
|
2722
|
+
|
|
2723
|
+
class FeedbackController extends BaseController {
|
|
2724
|
+
static forFeedback(feedback) {
|
|
2725
|
+
const controller = new FeedbackController(feedback);
|
|
2726
|
+
return controller;
|
|
2855
2727
|
}
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
const index = queue.indexOf(requestToRemove);
|
|
2861
|
-
if (index > -1) {
|
|
2862
|
-
queue.splice(index, 1);
|
|
2863
|
-
}
|
|
2864
|
-
if (queue.length === 0) {
|
|
2865
|
-
this.waitingQueue.delete(position);
|
|
2866
|
-
}
|
|
2728
|
+
constructor(feedback) {
|
|
2729
|
+
super('CoreProxy');
|
|
2730
|
+
this.feedback = feedback;
|
|
2731
|
+
this.adapter = new CoreProxyAdapter(this._proxy);
|
|
2867
2732
|
}
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
const originalSwitchToDesiredState = camera.switchToDesiredState.bind(camera);
|
|
2871
|
-
const originalApplySettings = camera.applySettings.bind(camera);
|
|
2872
|
-
const originalSetDesiredTorchState = (_b = (_a = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(camera), 'desiredTorchState')) === null || _a === void 0 ? void 0 : _a.set) === null || _b === void 0 ? void 0 : _b.bind(camera);
|
|
2873
|
-
// Protect switchToDesiredState - only owner can call it
|
|
2874
|
-
camera.switchToDesiredState = (state) => __awaiter(this, void 0, void 0, function* () {
|
|
2875
|
-
const currentOwner = this.getCurrentOwner(position);
|
|
2876
|
-
if (!currentOwner) {
|
|
2877
|
-
throw new Error(`Camera operation denied: No owner for camera at ${position}`);
|
|
2878
|
-
}
|
|
2879
|
-
// Allow operation - the owner is the only one who should have access to this camera instance
|
|
2880
|
-
return originalSwitchToDesiredState(state);
|
|
2881
|
-
});
|
|
2882
|
-
// Protect applySettings - only owner can call it
|
|
2883
|
-
camera.applySettings = (settings) => __awaiter(this, void 0, void 0, function* () {
|
|
2884
|
-
const currentOwner = this.getCurrentOwner(position);
|
|
2885
|
-
if (!currentOwner) {
|
|
2886
|
-
throw new Error(`Camera operation denied: No owner for camera at ${position}`);
|
|
2887
|
-
}
|
|
2888
|
-
return originalApplySettings(settings);
|
|
2889
|
-
});
|
|
2890
|
-
// Protect desiredTorchState setter - only owner can set it
|
|
2891
|
-
if (originalSetDesiredTorchState) {
|
|
2892
|
-
Object.defineProperty(camera, 'desiredTorchState', {
|
|
2893
|
-
set: (value) => {
|
|
2894
|
-
const currentOwner = this.getCurrentOwner(position);
|
|
2895
|
-
if (!currentOwner) {
|
|
2896
|
-
throw new Error(`Camera operation denied: No owner for camera at ${position}`);
|
|
2897
|
-
}
|
|
2898
|
-
originalSetDesiredTorchState(value);
|
|
2899
|
-
},
|
|
2900
|
-
get: (_d = (_c = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(camera), 'desiredTorchState')) === null || _c === void 0 ? void 0 : _c.get) === null || _d === void 0 ? void 0 : _d.bind(camera),
|
|
2901
|
-
configurable: true
|
|
2902
|
-
});
|
|
2903
|
-
}
|
|
2904
|
-
// Store originals for restoration
|
|
2905
|
-
camera.__originalMethods = {
|
|
2906
|
-
switchToDesiredState: originalSwitchToDesiredState,
|
|
2907
|
-
applySettings: originalApplySettings,
|
|
2908
|
-
setDesiredTorchState: originalSetDesiredTorchState
|
|
2909
|
-
};
|
|
2733
|
+
emit() {
|
|
2734
|
+
void this.adapter.emitFeedback({ feedbackJson: JSON.stringify(this.feedback.toJSON()) });
|
|
2910
2735
|
}
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
const originals = camera.__originalMethods;
|
|
2914
|
-
if (!originals)
|
|
2915
|
-
return;
|
|
2916
|
-
// Restore original methods
|
|
2917
|
-
camera.switchToDesiredState = originals.switchToDesiredState;
|
|
2918
|
-
camera.applySettings = originals.applySettings;
|
|
2919
|
-
if (originals.setDesiredTorchState) {
|
|
2920
|
-
Object.defineProperty(camera, 'desiredTorchState', {
|
|
2921
|
-
set: originals.setDesiredTorchState,
|
|
2922
|
-
get: (_b = (_a = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(camera), 'desiredTorchState')) === null || _a === void 0 ? void 0 : _a.get) === null || _b === void 0 ? void 0 : _b.bind(camera),
|
|
2923
|
-
configurable: true
|
|
2924
|
-
});
|
|
2925
|
-
}
|
|
2926
|
-
delete camera.__originalMethods;
|
|
2736
|
+
dispose() {
|
|
2737
|
+
this._proxy.dispose();
|
|
2927
2738
|
}
|
|
2928
2739
|
}
|
|
2929
2740
|
|
|
2930
|
-
class
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
*/
|
|
2934
|
-
static getCamera(position, owner) {
|
|
2935
|
-
// Check ownership
|
|
2936
|
-
if (!this.ownershipManager.checkOwnership(position, owner)) {
|
|
2937
|
-
console.warn(`Camera access denied: ${owner.id} does not own camera at ${position}`);
|
|
2938
|
-
return null;
|
|
2939
|
-
}
|
|
2940
|
-
return Camera.atPosition(position);
|
|
2941
|
-
}
|
|
2942
|
-
/**
|
|
2943
|
-
* Safely execute camera operations (only works if you own the camera)
|
|
2944
|
-
*/
|
|
2945
|
-
static withCamera(position, owner, operation) {
|
|
2946
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2947
|
-
const camera = this.getCamera(position, owner);
|
|
2948
|
-
if (!camera) {
|
|
2949
|
-
return null;
|
|
2950
|
-
}
|
|
2951
|
-
try {
|
|
2952
|
-
const result = yield operation(camera);
|
|
2953
|
-
return result;
|
|
2954
|
-
}
|
|
2955
|
-
catch (error) {
|
|
2956
|
-
console.error(`Camera operation failed for ${owner.id}:`, error);
|
|
2957
|
-
throw error;
|
|
2958
|
-
}
|
|
2959
|
-
});
|
|
2960
|
-
}
|
|
2961
|
-
/**
|
|
2962
|
-
* Execute camera operations, waiting for ownership if necessary
|
|
2963
|
-
*/
|
|
2964
|
-
static withCameraWhenAvailable(position, owner, operation, timeoutMs) {
|
|
2965
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2966
|
-
// Try to get ownership, wait if necessary
|
|
2967
|
-
const acquired = yield this.requestOwnership(position, owner, timeoutMs);
|
|
2968
|
-
if (!acquired) {
|
|
2969
|
-
console.warn(`Could not acquire camera ownership for ${owner.id} within timeout`);
|
|
2970
|
-
return null;
|
|
2971
|
-
}
|
|
2972
|
-
const camera = Camera.atPosition(position);
|
|
2973
|
-
if (!camera) {
|
|
2974
|
-
console.warn(`Camera not available at position ${position}`);
|
|
2975
|
-
return null;
|
|
2976
|
-
}
|
|
2977
|
-
try {
|
|
2978
|
-
const result = yield operation(camera);
|
|
2979
|
-
return result;
|
|
2980
|
-
}
|
|
2981
|
-
catch (error) {
|
|
2982
|
-
console.error(`Camera operation failed for ${owner.id}:`, error);
|
|
2983
|
-
throw error;
|
|
2984
|
-
}
|
|
2985
|
-
});
|
|
2741
|
+
class Feedback extends DefaultSerializeable {
|
|
2742
|
+
static get defaultFeedback() {
|
|
2743
|
+
return new Feedback(Vibration.defaultVibration, Sound.defaultSound);
|
|
2986
2744
|
}
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
*/
|
|
2990
|
-
static requestOwnership(position, owner, timeoutMs) {
|
|
2991
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2992
|
-
return this.ownershipManager.requestOwnershipAsync(position, owner, timeoutMs);
|
|
2993
|
-
});
|
|
2745
|
+
get vibration() {
|
|
2746
|
+
return this._vibration;
|
|
2994
2747
|
}
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
*/
|
|
2998
|
-
static releaseOwnership(position, owner) {
|
|
2999
|
-
return this.ownershipManager.releaseOwnership(position, owner);
|
|
2748
|
+
get sound() {
|
|
2749
|
+
return this._sound;
|
|
3000
2750
|
}
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
*/
|
|
3004
|
-
static hasOwnership(position, owner) {
|
|
3005
|
-
return this.ownershipManager.checkOwnership(position, owner);
|
|
2751
|
+
static fromJSON(json) {
|
|
2752
|
+
return new Feedback((json === null || json === void 0 ? void 0 : json.vibration) ? Vibration.fromJSON(json.vibration) : null, (json === null || json === void 0 ? void 0 : json.sound) ? Sound.fromJSON(json.sound) : null);
|
|
3006
2753
|
}
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
2754
|
+
constructor(vibration, sound) {
|
|
2755
|
+
super();
|
|
2756
|
+
this._vibration = null;
|
|
2757
|
+
this._sound = null;
|
|
2758
|
+
this._vibration = vibration;
|
|
2759
|
+
this._sound = sound;
|
|
2760
|
+
this.controller = new FeedbackController(this);
|
|
3012
2761
|
}
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
*/
|
|
3016
|
-
static getAllOwnedPositions(owner) {
|
|
3017
|
-
return this.ownershipManager.getAllOwnedPositions(owner);
|
|
2762
|
+
emit() {
|
|
2763
|
+
this.controller.emit();
|
|
3018
2764
|
}
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
*/
|
|
3022
|
-
static releaseAllOwnerships(owner) {
|
|
3023
|
-
const ownedPositions = this.getAllOwnedPositions(owner);
|
|
3024
|
-
for (const position of ownedPositions) {
|
|
3025
|
-
this.releaseOwnership(position, owner);
|
|
3026
|
-
}
|
|
2765
|
+
toJSON() {
|
|
2766
|
+
return super.toJSON();
|
|
3027
2767
|
}
|
|
3028
2768
|
}
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
2769
|
+
__decorate([
|
|
2770
|
+
ignoreFromSerializationIfNull,
|
|
2771
|
+
nameForSerialization('vibration')
|
|
2772
|
+
], Feedback.prototype, "_vibration", void 0);
|
|
2773
|
+
__decorate([
|
|
2774
|
+
ignoreFromSerializationIfNull,
|
|
2775
|
+
nameForSerialization('sound')
|
|
2776
|
+
], Feedback.prototype, "_sound", void 0);
|
|
2777
|
+
__decorate([
|
|
2778
|
+
ignoreFromSerialization
|
|
2779
|
+
], Feedback.prototype, "controller", void 0);
|
|
2780
|
+
|
|
2781
|
+
var FocusGestureListenerEvents;
|
|
2782
|
+
(function (FocusGestureListenerEvents) {
|
|
2783
|
+
FocusGestureListenerEvents["onFocusGesture"] = "FocusGestureListener.onFocusGesture";
|
|
2784
|
+
})(FocusGestureListenerEvents || (FocusGestureListenerEvents = {}));
|
|
2785
|
+
|
|
2786
|
+
var ZoomGestureListenerEvents;
|
|
2787
|
+
(function (ZoomGestureListenerEvents) {
|
|
2788
|
+
ZoomGestureListenerEvents["onZoomInGesture"] = "ZoomGestureListener.onZoomInGesture";
|
|
2789
|
+
ZoomGestureListenerEvents["onZoomOutGesture"] = "ZoomGestureListener.onZoomOutGesture";
|
|
2790
|
+
})(ZoomGestureListenerEvents || (ZoomGestureListenerEvents = {}));
|
|
2791
|
+
|
|
2792
|
+
var FrameSourceListenerEvents;
|
|
2793
|
+
(function (FrameSourceListenerEvents) {
|
|
2794
|
+
FrameSourceListenerEvents["didChangeState"] = "FrameSourceListener.onStateChanged";
|
|
2795
|
+
})(FrameSourceListenerEvents || (FrameSourceListenerEvents = {}));
|
|
2796
|
+
|
|
2797
|
+
var TorchListenerEvents;
|
|
2798
|
+
(function (TorchListenerEvents) {
|
|
2799
|
+
TorchListenerEvents["didChangeTorchToState"] = "TorchListener.onTorchStateChanged";
|
|
2800
|
+
})(TorchListenerEvents || (TorchListenerEvents = {}));
|
|
2801
|
+
|
|
2802
|
+
var MacroModeListenerEvents;
|
|
2803
|
+
(function (MacroModeListenerEvents) {
|
|
2804
|
+
MacroModeListenerEvents["didChangeMacroMode"] = "MacroModeListener.onMacroModeChanged";
|
|
2805
|
+
})(MacroModeListenerEvents || (MacroModeListenerEvents = {}));
|
|
2806
|
+
|
|
2807
|
+
var ZoomListenerEvents;
|
|
2808
|
+
(function (ZoomListenerEvents) {
|
|
3033
2809
|
ZoomListenerEvents["didChangeZoomLevel"] = "ZoomListener.onZoomLevelChanged";
|
|
3034
2810
|
})(ZoomListenerEvents || (ZoomListenerEvents = {}));
|
|
3035
2811
|
|
|
@@ -3062,21 +2838,21 @@ class CameraController extends BaseController {
|
|
|
3062
2838
|
getCurrentState() {
|
|
3063
2839
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3064
2840
|
return yield this.adapter.getCameraState({
|
|
3065
|
-
cameraPosition:
|
|
2841
|
+
cameraPosition: this.privateCamera._position,
|
|
3066
2842
|
});
|
|
3067
2843
|
});
|
|
3068
2844
|
}
|
|
3069
2845
|
getIsTorchAvailable() {
|
|
3070
2846
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3071
2847
|
return yield this.adapter.isTorchAvailable({
|
|
3072
|
-
cameraPosition:
|
|
2848
|
+
cameraPosition: this.privateCamera._position,
|
|
3073
2849
|
});
|
|
3074
2850
|
});
|
|
3075
2851
|
}
|
|
3076
2852
|
switchCameraToDesiredState(desiredState) {
|
|
3077
2853
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3078
2854
|
yield this.adapter.switchCameraToDesiredState({
|
|
3079
|
-
stateJson: desiredState.toString()
|
|
2855
|
+
stateJson: desiredState.toString(),
|
|
3080
2856
|
});
|
|
3081
2857
|
});
|
|
3082
2858
|
}
|
|
@@ -3198,472 +2974,678 @@ class CameraController extends BaseController {
|
|
|
3198
2974
|
}
|
|
3199
2975
|
}
|
|
3200
2976
|
|
|
3201
|
-
|
|
3202
|
-
|
|
2977
|
+
var FrameSourceState;
|
|
2978
|
+
(function (FrameSourceState) {
|
|
2979
|
+
FrameSourceState["On"] = "on";
|
|
2980
|
+
FrameSourceState["Off"] = "off";
|
|
2981
|
+
FrameSourceState["Starting"] = "starting";
|
|
2982
|
+
FrameSourceState["Stopping"] = "stopping";
|
|
2983
|
+
FrameSourceState["Standby"] = "standby";
|
|
2984
|
+
FrameSourceState["BootingUp"] = "bootingUp";
|
|
2985
|
+
FrameSourceState["WakingUp"] = "wakingUp";
|
|
2986
|
+
FrameSourceState["GoingToSleep"] = "goingToSleep";
|
|
2987
|
+
FrameSourceState["ShuttingDown"] = "shuttingDown";
|
|
2988
|
+
})(FrameSourceState || (FrameSourceState = {}));
|
|
2989
|
+
|
|
2990
|
+
class ImageBuffer {
|
|
2991
|
+
get width() {
|
|
2992
|
+
return this._width;
|
|
2993
|
+
}
|
|
2994
|
+
get height() {
|
|
2995
|
+
return this._height;
|
|
2996
|
+
}
|
|
2997
|
+
get data() {
|
|
2998
|
+
return this._data;
|
|
2999
|
+
}
|
|
3000
|
+
}
|
|
3001
|
+
|
|
3002
|
+
class ImageFrameSourceController extends BaseController {
|
|
3003
|
+
constructor(imageFrameSource) {
|
|
3203
3004
|
super('CoreProxy');
|
|
3005
|
+
this.handleDidChangeStateEventWrapper = (ev) => {
|
|
3006
|
+
return this.handleDidChangeStateEvent(ev);
|
|
3007
|
+
};
|
|
3008
|
+
this.imageFrameSource = imageFrameSource;
|
|
3204
3009
|
this.adapter = new CoreProxyAdapter(this._proxy);
|
|
3010
|
+
void this.subscribeListener();
|
|
3205
3011
|
}
|
|
3206
|
-
|
|
3012
|
+
get privateImageFrameSource() {
|
|
3013
|
+
return this.imageFrameSource;
|
|
3014
|
+
}
|
|
3015
|
+
getCurrentState() {
|
|
3207
3016
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
}
|
|
3212
|
-
const frameDataJSON = JSON.parse(result);
|
|
3213
|
-
return PrivateFrameData.fromJSON(frameDataJSON);
|
|
3017
|
+
return yield this.adapter.getCameraState({
|
|
3018
|
+
cameraPosition: JSON.stringify(this.privateImageFrameSource.position),
|
|
3019
|
+
});
|
|
3214
3020
|
});
|
|
3215
3021
|
}
|
|
3216
|
-
|
|
3022
|
+
switchCameraToDesiredState(desiredStateJson) {
|
|
3217
3023
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
}
|
|
3222
|
-
const frameDataJSON = JSON.parse(result);
|
|
3223
|
-
return PrivateFrameData.fromJSON(frameDataJSON);
|
|
3024
|
+
yield this.adapter.switchCameraToDesiredState({
|
|
3025
|
+
stateJson: desiredStateJson,
|
|
3026
|
+
});
|
|
3224
3027
|
});
|
|
3225
3028
|
}
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
return new ControlImage("base64", data, null);
|
|
3233
|
-
}
|
|
3234
|
-
static fromResourceName(resource) {
|
|
3235
|
-
return new ControlImage("resource", null, resource);
|
|
3029
|
+
subscribeListener() {
|
|
3030
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3031
|
+
yield this.adapter.registerFrameSourceListener();
|
|
3032
|
+
this._proxy.subscribeForEvents([FrameSourceListenerEvents.didChangeState]);
|
|
3033
|
+
this._proxy.eventEmitter.on(FrameSourceListenerEvents.didChangeState, this.handleDidChangeStateEventWrapper);
|
|
3034
|
+
});
|
|
3236
3035
|
}
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3036
|
+
unsubscribeListener() {
|
|
3037
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3038
|
+
yield this.adapter.unregisterFrameSourceListener();
|
|
3039
|
+
this._proxy.unsubscribeFromEvents([FrameSourceListenerEvents.didChangeState]);
|
|
3040
|
+
this._proxy.eventEmitter.off(FrameSourceListenerEvents.didChangeState, this.handleDidChangeStateEventWrapper);
|
|
3041
|
+
});
|
|
3242
3042
|
}
|
|
3243
|
-
|
|
3244
|
-
|
|
3043
|
+
dispose() {
|
|
3044
|
+
void this.unsubscribeListener();
|
|
3045
|
+
this._proxy.dispose();
|
|
3245
3046
|
}
|
|
3246
|
-
|
|
3247
|
-
|
|
3047
|
+
handleDidChangeStateEvent(ev) {
|
|
3048
|
+
const event = EventDataParser.parseIfShouldHandle(ev, {});
|
|
3049
|
+
if (event === SKIP) {
|
|
3050
|
+
return;
|
|
3051
|
+
}
|
|
3052
|
+
if (event === null) {
|
|
3053
|
+
console.error('ImageFrameSourceController didChangeState payload is null');
|
|
3054
|
+
return;
|
|
3055
|
+
}
|
|
3056
|
+
const newState = event.state;
|
|
3057
|
+
this.privateImageFrameSource.listeners.forEach(listener => {
|
|
3058
|
+
if (listener.didChangeState) {
|
|
3059
|
+
listener.didChangeState(this.imageFrameSource, newState);
|
|
3060
|
+
}
|
|
3061
|
+
});
|
|
3248
3062
|
}
|
|
3249
3063
|
}
|
|
3250
|
-
__decorate([
|
|
3251
|
-
ignoreFromSerializationIfNull,
|
|
3252
|
-
nameForSerialization('data')
|
|
3253
|
-
], ControlImage.prototype, "_data", void 0);
|
|
3254
|
-
__decorate([
|
|
3255
|
-
ignoreFromSerializationIfNull,
|
|
3256
|
-
nameForSerialization('name')
|
|
3257
|
-
], ControlImage.prototype, "_name", void 0);
|
|
3258
3064
|
|
|
3259
|
-
class
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3065
|
+
class ImageFrameSource extends DefaultSerializeable {
|
|
3066
|
+
set context(newContext) {
|
|
3067
|
+
if (newContext == null) {
|
|
3068
|
+
void this.controller.unsubscribeListener();
|
|
3069
|
+
}
|
|
3070
|
+
else if (this._context == null) {
|
|
3071
|
+
void this.controller.subscribeListener();
|
|
3072
|
+
}
|
|
3073
|
+
this._context = newContext;
|
|
3266
3074
|
}
|
|
3267
|
-
get
|
|
3268
|
-
return this.
|
|
3075
|
+
get context() {
|
|
3076
|
+
return this._context;
|
|
3269
3077
|
}
|
|
3270
|
-
get
|
|
3271
|
-
return this.
|
|
3078
|
+
get desiredState() {
|
|
3079
|
+
return this._desiredState;
|
|
3272
3080
|
}
|
|
3273
|
-
|
|
3274
|
-
|
|
3081
|
+
static create(image) {
|
|
3082
|
+
const imageFrameSource = new ImageFrameSource();
|
|
3083
|
+
imageFrameSource.image = image;
|
|
3084
|
+
return imageFrameSource;
|
|
3085
|
+
}
|
|
3086
|
+
static fromJSON(json) {
|
|
3087
|
+
return ImageFrameSource.create(json.image);
|
|
3275
3088
|
}
|
|
3276
|
-
}
|
|
3277
|
-
|
|
3278
|
-
class DataCaptureContextSettings extends DefaultSerializeable {
|
|
3279
3089
|
constructor() {
|
|
3280
3090
|
super();
|
|
3281
|
-
this.
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3091
|
+
this.type = 'image';
|
|
3092
|
+
this.image = '';
|
|
3093
|
+
this._id = `${Date.now()}`;
|
|
3094
|
+
this._desiredState = FrameSourceState.Off;
|
|
3095
|
+
this.listeners = [];
|
|
3096
|
+
this._context = null;
|
|
3097
|
+
this.controller = new ImageFrameSourceController(this);
|
|
3285
3098
|
}
|
|
3286
|
-
|
|
3287
|
-
this.
|
|
3099
|
+
switchToDesiredState(state) {
|
|
3100
|
+
this._desiredState = state;
|
|
3101
|
+
return this.controller.switchCameraToDesiredState(state);
|
|
3288
3102
|
}
|
|
3289
|
-
|
|
3290
|
-
|
|
3103
|
+
addListener(listener) {
|
|
3104
|
+
if (listener == null) {
|
|
3105
|
+
return;
|
|
3106
|
+
}
|
|
3107
|
+
if (this.listeners.includes(listener)) {
|
|
3108
|
+
return;
|
|
3109
|
+
}
|
|
3110
|
+
this.listeners.push(listener);
|
|
3291
3111
|
}
|
|
3292
|
-
|
|
3293
|
-
|
|
3112
|
+
removeListener(listener) {
|
|
3113
|
+
if (listener == null) {
|
|
3114
|
+
return;
|
|
3115
|
+
}
|
|
3116
|
+
if (!this.listeners.includes(listener)) {
|
|
3117
|
+
return;
|
|
3118
|
+
}
|
|
3119
|
+
this.listeners.splice(this.listeners.indexOf(listener), 1);
|
|
3294
3120
|
}
|
|
3295
|
-
|
|
3296
|
-
return this
|
|
3121
|
+
getCurrentState() {
|
|
3122
|
+
return this.controller.getCurrentState();
|
|
3297
3123
|
}
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
this._licenseText = licenseText;
|
|
3124
|
+
didChange() {
|
|
3125
|
+
if (this.context) {
|
|
3126
|
+
return this.context.update();
|
|
3127
|
+
}
|
|
3128
|
+
else {
|
|
3129
|
+
return Promise.resolve();
|
|
3130
|
+
}
|
|
3306
3131
|
}
|
|
3307
|
-
|
|
3308
|
-
|
|
3132
|
+
setNativeFrameSourceIsBeingCreated() {
|
|
3133
|
+
// ImageFrameSource has no asynchronous native initialization step, so
|
|
3134
|
+
// there is nothing to track here. The method exists only to satisfy the
|
|
3135
|
+
// PrivateFrameSource contract that DataCaptureContext.setFrameSource()
|
|
3136
|
+
// invokes on every frame source.
|
|
3309
3137
|
}
|
|
3310
3138
|
}
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3139
|
+
__decorate([
|
|
3140
|
+
nameForSerialization('id')
|
|
3141
|
+
], ImageFrameSource.prototype, "_id", void 0);
|
|
3142
|
+
__decorate([
|
|
3143
|
+
nameForSerialization('desiredState')
|
|
3144
|
+
], ImageFrameSource.prototype, "_desiredState", void 0);
|
|
3145
|
+
__decorate([
|
|
3146
|
+
ignoreFromSerialization
|
|
3147
|
+
], ImageFrameSource.prototype, "listeners", void 0);
|
|
3148
|
+
__decorate([
|
|
3149
|
+
ignoreFromSerialization
|
|
3150
|
+
], ImageFrameSource.prototype, "_context", void 0);
|
|
3151
|
+
__decorate([
|
|
3152
|
+
ignoreFromSerialization
|
|
3153
|
+
], ImageFrameSource.prototype, "controller", void 0);
|
|
3154
|
+
|
|
3155
|
+
class PrivateFrameData {
|
|
3156
|
+
get imageBuffers() {
|
|
3157
|
+
return this._imageBuffers;
|
|
3320
3158
|
}
|
|
3321
|
-
get
|
|
3322
|
-
return this.
|
|
3159
|
+
get imageBuffer() {
|
|
3160
|
+
return this._imageBuffers[0];
|
|
3323
3161
|
}
|
|
3324
|
-
get
|
|
3325
|
-
return this.
|
|
3162
|
+
get orientation() {
|
|
3163
|
+
return this._orientation;
|
|
3326
3164
|
}
|
|
3327
|
-
|
|
3328
|
-
return
|
|
3165
|
+
get timestamp() {
|
|
3166
|
+
return this._timestamp;
|
|
3329
3167
|
}
|
|
3330
|
-
static
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
return
|
|
3168
|
+
static fromJSON(json) {
|
|
3169
|
+
var _a;
|
|
3170
|
+
const frameData = new PrivateFrameData();
|
|
3171
|
+
frameData._imageBuffers = json.imageBuffers.map((imageBufferJSON) => {
|
|
3172
|
+
const imageBuffer = new ImageBuffer();
|
|
3173
|
+
imageBuffer._width = imageBufferJSON.width;
|
|
3174
|
+
imageBuffer._height = imageBufferJSON.height;
|
|
3175
|
+
imageBuffer._data = imageBufferJSON.data;
|
|
3176
|
+
return imageBuffer;
|
|
3339
3177
|
});
|
|
3178
|
+
frameData._orientation = json.orientation;
|
|
3179
|
+
frameData._timestamp = (_a = json.timestamp) !== null && _a !== void 0 ? _a : -1;
|
|
3180
|
+
return frameData;
|
|
3340
3181
|
}
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3182
|
+
static empty() {
|
|
3183
|
+
const frameData = new PrivateFrameData();
|
|
3184
|
+
frameData._imageBuffers = [];
|
|
3185
|
+
frameData._orientation = 90;
|
|
3186
|
+
frameData._timestamp = -1;
|
|
3187
|
+
return frameData;
|
|
3188
|
+
}
|
|
3189
|
+
}
|
|
3190
|
+
|
|
3191
|
+
class FrameDataController extends BaseController {
|
|
3192
|
+
constructor() {
|
|
3193
|
+
super('CoreProxy');
|
|
3344
3194
|
this.adapter = new CoreProxyAdapter(this._proxy);
|
|
3345
|
-
this.context = context;
|
|
3346
3195
|
}
|
|
3347
|
-
|
|
3196
|
+
getFrame(frameId) {
|
|
3348
3197
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3349
|
-
|
|
3350
|
-
|
|
3198
|
+
const result = yield this.adapter.getLastFrameAsJson({ frameId });
|
|
3199
|
+
if (result == null) {
|
|
3200
|
+
return PrivateFrameData.empty();
|
|
3351
3201
|
}
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
this._proxy.eventEmitter.on(DataCaptureContextEvents.didChangeStatus, this.handleDidChangeStatusEvent.bind(this));
|
|
3355
|
-
this._proxy.eventEmitter.on(DataCaptureContextEvents.didStartObservingContext, this.handleDidStartObservingContextEvent.bind(this));
|
|
3356
|
-
this._listenerRegistered = true;
|
|
3202
|
+
const frameDataJSON = JSON.parse(result);
|
|
3203
|
+
return PrivateFrameData.fromJSON(frameDataJSON);
|
|
3357
3204
|
});
|
|
3358
3205
|
}
|
|
3359
|
-
|
|
3206
|
+
getFrameOrNull(frameId) {
|
|
3360
3207
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
catch (error) {
|
|
3365
|
-
this.notifyListenersOfDeserializationError(error);
|
|
3366
|
-
throw error;
|
|
3208
|
+
const result = yield this.adapter.getLastFrameAsJson({ frameId });
|
|
3209
|
+
if (result == null) {
|
|
3210
|
+
return null;
|
|
3367
3211
|
}
|
|
3212
|
+
const frameDataJSON = JSON.parse(result);
|
|
3213
|
+
return PrivateFrameData.fromJSON(frameDataJSON);
|
|
3368
3214
|
});
|
|
3369
3215
|
}
|
|
3370
|
-
|
|
3371
|
-
|
|
3216
|
+
}
|
|
3217
|
+
|
|
3218
|
+
var TorchState;
|
|
3219
|
+
(function (TorchState) {
|
|
3220
|
+
TorchState["On"] = "on";
|
|
3221
|
+
TorchState["Off"] = "off";
|
|
3222
|
+
TorchState["Auto"] = "auto";
|
|
3223
|
+
})(TorchState || (TorchState = {}));
|
|
3224
|
+
|
|
3225
|
+
/**
|
|
3226
|
+
* Camera lifecycle and operation handling:
|
|
3227
|
+
*
|
|
3228
|
+
* Phase 1 - Initial State (before native creation starts):
|
|
3229
|
+
* - Camera object exists in TypeScript but not yet being created on native side
|
|
3230
|
+
* - State changes (torch, desired state, settings) only update TypeScript properties
|
|
3231
|
+
* - No native calls are triggered
|
|
3232
|
+
*
|
|
3233
|
+
* Phase 2 - Native Creation In Progress (after setFrameSource, before context set):
|
|
3234
|
+
* - setFrameSource() called on DataCaptureContext, triggering setNativeFrameSourceIsBeingCreated()
|
|
3235
|
+
* - A promise is created that will resolve when the native camera is ready
|
|
3236
|
+
* - State changes during this phase await the native ready promise before executing
|
|
3237
|
+
* - Native camera is created asynchronously
|
|
3238
|
+
*
|
|
3239
|
+
* Phase 3 - Active State (after context set):
|
|
3240
|
+
* - Native camera is ready and available
|
|
3241
|
+
* - The native ready promise is resolved
|
|
3242
|
+
* - All state changes execute immediately on native side
|
|
3243
|
+
*/
|
|
3244
|
+
class Camera extends DefaultSerializeable {
|
|
3245
|
+
static get coreDefaults() {
|
|
3246
|
+
return getCoreDefaults();
|
|
3372
3247
|
}
|
|
3373
|
-
|
|
3374
|
-
|
|
3248
|
+
static create(position, settings, desiredTorchState, desiredState) {
|
|
3249
|
+
const cameraPosition = position || Camera.coreDefaults.Camera.defaultPosition;
|
|
3250
|
+
if (!cameraPosition) {
|
|
3251
|
+
return null;
|
|
3252
|
+
}
|
|
3253
|
+
const existingCamera = Camera._cameraInstances.get(cameraPosition);
|
|
3254
|
+
if (existingCamera) {
|
|
3255
|
+
existingCamera.resetPhaseState();
|
|
3256
|
+
if (settings !== undefined) {
|
|
3257
|
+
existingCamera.settings = settings;
|
|
3258
|
+
}
|
|
3259
|
+
if (desiredTorchState !== undefined) {
|
|
3260
|
+
existingCamera._desiredTorchState = desiredTorchState;
|
|
3261
|
+
void existingCamera.didChange();
|
|
3262
|
+
}
|
|
3263
|
+
if (desiredState !== undefined) {
|
|
3264
|
+
existingCamera._desiredState = desiredState;
|
|
3265
|
+
void existingCamera.controller.switchCameraToDesiredState(desiredState);
|
|
3266
|
+
}
|
|
3267
|
+
return existingCamera;
|
|
3268
|
+
}
|
|
3269
|
+
if (!Camera.coreDefaults.Camera.availablePositions.includes(cameraPosition)) {
|
|
3270
|
+
return null;
|
|
3271
|
+
}
|
|
3272
|
+
const camera = new Camera(cameraPosition, settings, desiredTorchState, desiredState);
|
|
3273
|
+
Camera._cameraInstances.set(cameraPosition, camera);
|
|
3274
|
+
return camera;
|
|
3375
3275
|
}
|
|
3376
|
-
|
|
3377
|
-
return
|
|
3276
|
+
static withSettings(settings) {
|
|
3277
|
+
return Camera.create(undefined, settings);
|
|
3378
3278
|
}
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
void this.adapter.disposeContext();
|
|
3382
|
-
this._proxy.dispose();
|
|
3279
|
+
static asPositionWithSettings(cameraPosition, settings) {
|
|
3280
|
+
return Camera.create(cameraPosition, settings);
|
|
3383
3281
|
}
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
this._listenerRegistered = false;
|
|
3394
|
-
});
|
|
3282
|
+
static atPosition(cameraPosition) {
|
|
3283
|
+
if (!Camera.coreDefaults.Camera.availablePositions.includes(cameraPosition)) {
|
|
3284
|
+
return null;
|
|
3285
|
+
}
|
|
3286
|
+
const existingCamera = Camera._cameraInstances.get(cameraPosition);
|
|
3287
|
+
if (existingCamera) {
|
|
3288
|
+
return existingCamera;
|
|
3289
|
+
}
|
|
3290
|
+
return Camera.create(cameraPosition);
|
|
3395
3291
|
}
|
|
3396
|
-
|
|
3397
|
-
|
|
3292
|
+
constructor(position, settings, desiredTorchState, desiredState) {
|
|
3293
|
+
super();
|
|
3294
|
+
this.type = 'camera';
|
|
3295
|
+
this.settings = null;
|
|
3296
|
+
this._desiredTorchState = TorchState.Off;
|
|
3297
|
+
this._desiredState = FrameSourceState.Off;
|
|
3298
|
+
this._hasTorchStateListeners = false;
|
|
3299
|
+
this._hasMacroModeListeners = false;
|
|
3300
|
+
this.currentCameraState = FrameSourceState.Off;
|
|
3301
|
+
this.listeners = [];
|
|
3302
|
+
this.torchListeners = [];
|
|
3303
|
+
this.macroModeListeners = [];
|
|
3304
|
+
this.zoomListeners = [];
|
|
3305
|
+
this._hasZoomListeners = false;
|
|
3306
|
+
this._context = null;
|
|
3307
|
+
this.nativeReadyResolver = null;
|
|
3308
|
+
this.nativeReadyRejecter = null;
|
|
3309
|
+
this.nativeReadyPromise = null;
|
|
3310
|
+
this.nativeReadyTimeout = null;
|
|
3311
|
+
this._position = position || Camera.coreDefaults.Camera.defaultPosition;
|
|
3312
|
+
this.settings = settings || null;
|
|
3313
|
+
this._desiredTorchState = desiredTorchState || TorchState.Off;
|
|
3314
|
+
this._desiredState = desiredState || FrameSourceState.Off;
|
|
3315
|
+
this.controller = new CameraController(this);
|
|
3398
3316
|
}
|
|
3399
|
-
|
|
3317
|
+
switchToDesiredState(state) {
|
|
3400
3318
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3401
|
-
|
|
3402
|
-
|
|
3319
|
+
this._desiredState = state;
|
|
3320
|
+
if (this.nativeReadyPromise) {
|
|
3321
|
+
// Phase 2: Wait for native camera to be ready, then switch state
|
|
3322
|
+
yield this.nativeReadyPromise;
|
|
3323
|
+
yield this.controller.switchCameraToDesiredState(state);
|
|
3324
|
+
return;
|
|
3403
3325
|
}
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3326
|
+
if (!this.isActiveCamera) {
|
|
3327
|
+
// Phase 1: Not yet added to context
|
|
3328
|
+
console.warn('The current camera is not added to the DataCaptureContext. Add camera to the DataCaptureContext first.');
|
|
3329
|
+
return;
|
|
3407
3330
|
}
|
|
3331
|
+
// Phase 3: Execute immediately
|
|
3332
|
+
yield this.controller.switchCameraToDesiredState(state);
|
|
3408
3333
|
});
|
|
3409
3334
|
}
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3335
|
+
getCurrentState() {
|
|
3336
|
+
return Promise.resolve(this.currentCameraState);
|
|
3337
|
+
}
|
|
3338
|
+
getIsTorchAvailable() {
|
|
3339
|
+
return this.controller.getIsTorchAvailable();
|
|
3340
|
+
}
|
|
3341
|
+
addListener(listener) {
|
|
3342
|
+
if (listener == null) {
|
|
3413
3343
|
return;
|
|
3414
3344
|
}
|
|
3415
|
-
if (
|
|
3416
|
-
console.error('DataCaptureContextController didChangeStatus payload is null');
|
|
3345
|
+
if (this.listeners.includes(listener)) {
|
|
3417
3346
|
return;
|
|
3418
3347
|
}
|
|
3419
|
-
|
|
3420
|
-
this.notifyListenersOfDidChangeStatus(contextStatus);
|
|
3348
|
+
this.listeners.push(listener);
|
|
3421
3349
|
}
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
(_a = listener.didStartObservingContext) === null || _a === void 0 ? void 0 : _a.call(listener, this.context);
|
|
3426
|
-
});
|
|
3427
|
-
}
|
|
3428
|
-
notifyListenersOfDeserializationError(error) {
|
|
3429
|
-
const contextStatus = ContextStatus['fromJSON']({
|
|
3430
|
-
message: error,
|
|
3431
|
-
code: -1,
|
|
3432
|
-
isValid: true,
|
|
3433
|
-
});
|
|
3434
|
-
this.notifyListenersOfDidChangeStatus(contextStatus);
|
|
3435
|
-
}
|
|
3436
|
-
notifyListenersOfDidChangeStatus(contextStatus) {
|
|
3437
|
-
this.privateContext.listeners.forEach(listener => {
|
|
3438
|
-
if (listener.didChangeStatus) {
|
|
3439
|
-
listener.didChangeStatus(this.context, contextStatus);
|
|
3440
|
-
}
|
|
3441
|
-
});
|
|
3442
|
-
}
|
|
3443
|
-
}
|
|
3444
|
-
|
|
3445
|
-
class DataCaptureContext extends DefaultSerializeable {
|
|
3446
|
-
static get sharedInstance() {
|
|
3447
|
-
if (DataCaptureContext._instance == null) {
|
|
3448
|
-
DataCaptureContext._instance = new DataCaptureContext('', '', null);
|
|
3350
|
+
removeListener(listener) {
|
|
3351
|
+
if (listener == null) {
|
|
3352
|
+
return;
|
|
3449
3353
|
}
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
return DataCaptureContextController.getOpenSourceSoftwareLicenseInfo();
|
|
3455
|
-
});
|
|
3456
|
-
}
|
|
3457
|
-
static get coreDefaults() {
|
|
3458
|
-
return getCoreDefaults();
|
|
3459
|
-
}
|
|
3460
|
-
get frameSource() {
|
|
3461
|
-
return this._frameSource;
|
|
3462
|
-
}
|
|
3463
|
-
static get deviceID() {
|
|
3464
|
-
return DataCaptureContext.coreDefaults.deviceID;
|
|
3354
|
+
if (!this.listeners.includes(listener)) {
|
|
3355
|
+
return;
|
|
3356
|
+
}
|
|
3357
|
+
this.listeners.splice(this.listeners.indexOf(listener), 1);
|
|
3465
3358
|
}
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3359
|
+
addTorchListener(listener) {
|
|
3360
|
+
if (this.torchListeners.includes(listener)) {
|
|
3361
|
+
return;
|
|
3362
|
+
}
|
|
3363
|
+
this.torchListeners.push(listener);
|
|
3364
|
+
this._hasTorchStateListeners = this.torchListeners.length > 0;
|
|
3365
|
+
if (this.torchListeners.length === 1) {
|
|
3366
|
+
void this.controller.subscribeTorchListener();
|
|
3367
|
+
}
|
|
3368
|
+
if (this.isActiveCamera) {
|
|
3369
|
+
void this.didChange();
|
|
3370
|
+
}
|
|
3471
3371
|
}
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3372
|
+
removeTorchListener(listener) {
|
|
3373
|
+
if (!this.torchListeners.includes(listener)) {
|
|
3374
|
+
return;
|
|
3375
|
+
}
|
|
3376
|
+
this.torchListeners.splice(this.torchListeners.indexOf(listener), 1);
|
|
3377
|
+
this._hasTorchStateListeners = this.torchListeners.length > 0;
|
|
3378
|
+
if (this.torchListeners.length === 0) {
|
|
3379
|
+
void this.controller.unsubscribeTorchListener();
|
|
3380
|
+
}
|
|
3381
|
+
if (this.isActiveCamera) {
|
|
3382
|
+
void this.didChange();
|
|
3383
|
+
}
|
|
3477
3384
|
}
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3385
|
+
addMacroModeListener(listener) {
|
|
3386
|
+
if (this.macroModeListeners.includes(listener)) {
|
|
3387
|
+
return;
|
|
3388
|
+
}
|
|
3389
|
+
this.macroModeListeners.push(listener);
|
|
3390
|
+
this._hasMacroModeListeners = this.macroModeListeners.length > 0;
|
|
3391
|
+
if (this.macroModeListeners.length === 1) {
|
|
3392
|
+
void this.controller.subscribeMacroModeListener();
|
|
3393
|
+
}
|
|
3394
|
+
if (this.isActiveCamera) {
|
|
3395
|
+
void this.didChange();
|
|
3396
|
+
}
|
|
3483
3397
|
}
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3398
|
+
removeMacroModeListener(listener) {
|
|
3399
|
+
if (!this.macroModeListeners.includes(listener)) {
|
|
3400
|
+
return;
|
|
3401
|
+
}
|
|
3402
|
+
this.macroModeListeners.splice(this.macroModeListeners.indexOf(listener), 1);
|
|
3403
|
+
this._hasMacroModeListeners = this.macroModeListeners.length > 0;
|
|
3404
|
+
if (this.macroModeListeners.length === 0) {
|
|
3405
|
+
void this.controller.unsubscribeMacroModeListener();
|
|
3406
|
+
}
|
|
3407
|
+
if (this.isActiveCamera) {
|
|
3408
|
+
void this.didChange();
|
|
3409
|
+
}
|
|
3488
3410
|
}
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3411
|
+
addZoomListener(listener) {
|
|
3412
|
+
if (this.zoomListeners.includes(listener)) {
|
|
3413
|
+
return;
|
|
3414
|
+
}
|
|
3415
|
+
this.zoomListeners.push(listener);
|
|
3416
|
+
this._hasZoomListeners = this.zoomListeners.length > 0;
|
|
3417
|
+
if (this.zoomListeners.length === 1) {
|
|
3418
|
+
void this.controller.subscribeZoomListener();
|
|
3419
|
+
}
|
|
3420
|
+
if (this.isActiveCamera) {
|
|
3421
|
+
void this.didChange();
|
|
3422
|
+
}
|
|
3494
3423
|
}
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
this.deviceName = deviceName;
|
|
3499
|
-
this._framework = 'unknown';
|
|
3500
|
-
this._frameworkVersion = 'unknown';
|
|
3501
|
-
this.settings = new DataCaptureContextSettings();
|
|
3502
|
-
this._frameSource = null;
|
|
3503
|
-
this.view = null;
|
|
3504
|
-
this.modes = [];
|
|
3505
|
-
this.listeners = [];
|
|
3506
|
-
this.licenseKey = licenseKey;
|
|
3507
|
-
this.deviceName = deviceName;
|
|
3508
|
-
if (settings) {
|
|
3509
|
-
this.settings = settings;
|
|
3424
|
+
removeZoomListener(listener) {
|
|
3425
|
+
if (!this.zoomListeners.includes(listener)) {
|
|
3426
|
+
return;
|
|
3510
3427
|
}
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3428
|
+
this.zoomListeners.splice(this.zoomListeners.indexOf(listener), 1);
|
|
3429
|
+
this._hasZoomListeners = this.zoomListeners.length > 0;
|
|
3430
|
+
if (this.zoomListeners.length === 0) {
|
|
3431
|
+
void this.controller.unsubscribeZoomListener();
|
|
3432
|
+
}
|
|
3433
|
+
if (this.isActiveCamera) {
|
|
3434
|
+
void this.didChange();
|
|
3515
3435
|
}
|
|
3516
3436
|
}
|
|
3517
|
-
|
|
3437
|
+
applySettings(settings) {
|
|
3518
3438
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
// Set the flag to indicate that the native frame source is being created
|
|
3525
|
-
frameSource.setNativeFrameSourceIsBeingCreated();
|
|
3439
|
+
this.settings = settings;
|
|
3440
|
+
if (this.nativeReadyPromise) {
|
|
3441
|
+
// Phase 2: Wait for native camera to be ready, then apply settings
|
|
3442
|
+
yield this.nativeReadyPromise;
|
|
3443
|
+
yield this.didChange();
|
|
3526
3444
|
}
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
frameSource.context = this;
|
|
3445
|
+
else if (this.isActiveCamera) {
|
|
3446
|
+
// Phase 3: Execute immediately
|
|
3447
|
+
yield this.didChange();
|
|
3531
3448
|
}
|
|
3449
|
+
// Phase 1: Just update the property, no action needed
|
|
3532
3450
|
});
|
|
3533
3451
|
}
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3452
|
+
set context(newContext) {
|
|
3453
|
+
this._context = newContext;
|
|
3454
|
+
if (newContext) {
|
|
3455
|
+
// Phase 3: Native camera is ready, resolve the promise so waiting operations can proceed
|
|
3456
|
+
if (this.nativeReadyTimeout) {
|
|
3457
|
+
clearTimeout(this.nativeReadyTimeout);
|
|
3458
|
+
this.nativeReadyTimeout = null;
|
|
3541
3459
|
}
|
|
3542
|
-
this.
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
if (!this.listeners.includes(listener)) {
|
|
3548
|
-
return;
|
|
3460
|
+
if (this.nativeReadyResolver) {
|
|
3461
|
+
this.nativeReadyResolver();
|
|
3462
|
+
this.nativeReadyResolver = null;
|
|
3463
|
+
this.nativeReadyRejecter = null;
|
|
3464
|
+
this.nativeReadyPromise = null;
|
|
3549
3465
|
}
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3466
|
+
}
|
|
3467
|
+
else {
|
|
3468
|
+
// When context is removed, reset everything
|
|
3469
|
+
if (this.nativeReadyTimeout) {
|
|
3470
|
+
clearTimeout(this.nativeReadyTimeout);
|
|
3471
|
+
this.nativeReadyTimeout = null;
|
|
3553
3472
|
}
|
|
3554
|
-
|
|
3473
|
+
this.nativeReadyResolver = null;
|
|
3474
|
+
this.nativeReadyRejecter = null;
|
|
3475
|
+
this.nativeReadyPromise = null;
|
|
3476
|
+
}
|
|
3555
3477
|
}
|
|
3556
|
-
|
|
3557
|
-
return
|
|
3558
|
-
yield this.addModeInternal(mode);
|
|
3559
|
-
});
|
|
3478
|
+
get context() {
|
|
3479
|
+
return this._context;
|
|
3560
3480
|
}
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3481
|
+
setNativeFrameSourceIsBeingCreated() {
|
|
3482
|
+
this.nativeReadyPromise = new Promise((resolve, reject) => {
|
|
3483
|
+
this.nativeReadyResolver = resolve;
|
|
3484
|
+
this.nativeReadyRejecter = reject;
|
|
3485
|
+
this.nativeReadyTimeout = setTimeout(() => {
|
|
3486
|
+
this.nativeReadyTimeout = null;
|
|
3487
|
+
if (this.nativeReadyRejecter) {
|
|
3488
|
+
this.nativeReadyRejecter(new Error('Camera native initialization timed out after 5 seconds'));
|
|
3489
|
+
this.nativeReadyResolver = null;
|
|
3490
|
+
this.nativeReadyRejecter = null;
|
|
3491
|
+
this.nativeReadyPromise = null;
|
|
3492
|
+
}
|
|
3493
|
+
}, 5000);
|
|
3565
3494
|
});
|
|
3566
3495
|
}
|
|
3567
|
-
|
|
3568
|
-
return
|
|
3569
|
-
if (this.modes.length === 0) {
|
|
3570
|
-
return;
|
|
3571
|
-
}
|
|
3572
|
-
if (this.modes.length > 1) {
|
|
3573
|
-
console.warn('removeCurrentMode() called with multiple modes active. Consider using removeMode() for specific mode removal. Only the first mode will be removed.');
|
|
3574
|
-
}
|
|
3575
|
-
yield this.removeModeInternal(this.modes[0]);
|
|
3576
|
-
});
|
|
3496
|
+
get isActiveCamera() {
|
|
3497
|
+
return this._context !== null;
|
|
3577
3498
|
}
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3499
|
+
static get default() {
|
|
3500
|
+
const defaultPosition = Camera.coreDefaults.Camera.defaultPosition;
|
|
3501
|
+
if (!defaultPosition) {
|
|
3502
|
+
return null;
|
|
3503
|
+
}
|
|
3504
|
+
return Camera.atPosition(defaultPosition);
|
|
3582
3505
|
}
|
|
3583
|
-
|
|
3506
|
+
static isMacroModeAvailable() {
|
|
3584
3507
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3585
|
-
|
|
3586
|
-
|
|
3508
|
+
const proxy = FactoryMaker.getInstance('CoreProxy');
|
|
3509
|
+
if (!proxy) {
|
|
3510
|
+
return false;
|
|
3587
3511
|
}
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
});
|
|
3591
|
-
this.modes = [];
|
|
3592
|
-
yield this.controller.removeAllModesFromContext();
|
|
3512
|
+
const adapter = new CoreProxyAdapter(proxy);
|
|
3513
|
+
return yield adapter.isMacroModeAvailable();
|
|
3593
3514
|
});
|
|
3594
3515
|
}
|
|
3595
|
-
|
|
3596
|
-
return
|
|
3597
|
-
var _a;
|
|
3598
|
-
if (!this.controller) {
|
|
3599
|
-
return;
|
|
3600
|
-
}
|
|
3601
|
-
(_a = this.view) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
3602
|
-
yield this.removeAllModes();
|
|
3603
|
-
this.controller.dispose();
|
|
3604
|
-
});
|
|
3516
|
+
get position() {
|
|
3517
|
+
return this._position;
|
|
3605
3518
|
}
|
|
3606
|
-
|
|
3607
|
-
return
|
|
3608
|
-
this.settings = settings;
|
|
3609
|
-
yield this.update();
|
|
3610
|
-
});
|
|
3519
|
+
get isTorchAvailable() {
|
|
3520
|
+
return this.controller.getIsTorchAvailable();
|
|
3611
3521
|
}
|
|
3612
|
-
|
|
3613
|
-
return
|
|
3614
|
-
if (!this.controller) {
|
|
3615
|
-
return;
|
|
3616
|
-
}
|
|
3617
|
-
yield this.controller.updateContextFromJSON();
|
|
3618
|
-
});
|
|
3522
|
+
get desiredState() {
|
|
3523
|
+
return this._desiredState;
|
|
3619
3524
|
}
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3525
|
+
set desiredTorchState(desiredTorchState) {
|
|
3526
|
+
this._desiredTorchState = desiredTorchState;
|
|
3527
|
+
if (this.nativeReadyPromise) {
|
|
3528
|
+
// Phase 2: Wait for native camera to be ready, then update
|
|
3529
|
+
void this.nativeReadyPromise.then(() => this.didChange());
|
|
3530
|
+
}
|
|
3531
|
+
else if (this.isActiveCamera) {
|
|
3532
|
+
// Phase 3: Execute immediately
|
|
3533
|
+
void this.didChange();
|
|
3534
|
+
}
|
|
3535
|
+
// Phase 1: Just update the property, no action needed
|
|
3628
3536
|
}
|
|
3629
|
-
|
|
3537
|
+
get desiredTorchState() {
|
|
3538
|
+
return this._desiredTorchState;
|
|
3539
|
+
}
|
|
3540
|
+
didChange() {
|
|
3630
3541
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
this.modes.splice(index, 1);
|
|
3542
|
+
if (this.context) {
|
|
3543
|
+
yield this.context.update();
|
|
3634
3544
|
}
|
|
3635
|
-
mode._context = null;
|
|
3636
|
-
yield this.controller.removeModeFromContext(mode);
|
|
3637
3545
|
});
|
|
3638
3546
|
}
|
|
3547
|
+
resetPhaseState() {
|
|
3548
|
+
if (this.nativeReadyTimeout) {
|
|
3549
|
+
clearTimeout(this.nativeReadyTimeout);
|
|
3550
|
+
this.nativeReadyTimeout = null;
|
|
3551
|
+
}
|
|
3552
|
+
this.nativeReadyResolver = null;
|
|
3553
|
+
this.nativeReadyRejecter = null;
|
|
3554
|
+
this.nativeReadyPromise = null;
|
|
3555
|
+
}
|
|
3639
3556
|
}
|
|
3557
|
+
Camera._cameraInstances = new Map();
|
|
3640
3558
|
__decorate([
|
|
3641
3559
|
ignoreFromSerialization
|
|
3642
|
-
],
|
|
3560
|
+
], Camera.prototype, "controller", void 0);
|
|
3643
3561
|
__decorate([
|
|
3644
|
-
|
|
3645
|
-
],
|
|
3562
|
+
serializationDefault({})
|
|
3563
|
+
], Camera.prototype, "settings", void 0);
|
|
3646
3564
|
__decorate([
|
|
3647
|
-
nameForSerialization('
|
|
3648
|
-
],
|
|
3565
|
+
nameForSerialization('position')
|
|
3566
|
+
], Camera.prototype, "_position", void 0);
|
|
3649
3567
|
__decorate([
|
|
3650
|
-
nameForSerialization('
|
|
3651
|
-
],
|
|
3568
|
+
nameForSerialization('desiredTorchState')
|
|
3569
|
+
], Camera.prototype, "_desiredTorchState", void 0);
|
|
3570
|
+
__decorate([
|
|
3571
|
+
nameForSerialization('desiredState')
|
|
3572
|
+
], Camera.prototype, "_desiredState", void 0);
|
|
3573
|
+
__decorate([
|
|
3574
|
+
nameForSerialization('hasTorchStateListeners')
|
|
3575
|
+
], Camera.prototype, "_hasTorchStateListeners", void 0);
|
|
3576
|
+
__decorate([
|
|
3577
|
+
nameForSerialization('hasMacroModeListeners')
|
|
3578
|
+
], Camera.prototype, "_hasMacroModeListeners", void 0);
|
|
3652
3579
|
__decorate([
|
|
3653
3580
|
ignoreFromSerialization
|
|
3654
|
-
],
|
|
3581
|
+
], Camera.prototype, "currentCameraState", void 0);
|
|
3655
3582
|
__decorate([
|
|
3656
3583
|
ignoreFromSerialization
|
|
3657
|
-
],
|
|
3584
|
+
], Camera.prototype, "listeners", void 0);
|
|
3658
3585
|
__decorate([
|
|
3659
3586
|
ignoreFromSerialization
|
|
3660
|
-
],
|
|
3587
|
+
], Camera.prototype, "torchListeners", void 0);
|
|
3661
3588
|
__decorate([
|
|
3662
3589
|
ignoreFromSerialization
|
|
3663
|
-
],
|
|
3590
|
+
], Camera.prototype, "macroModeListeners", void 0);
|
|
3664
3591
|
__decorate([
|
|
3665
3592
|
ignoreFromSerialization
|
|
3666
|
-
],
|
|
3593
|
+
], Camera.prototype, "zoomListeners", void 0);
|
|
3594
|
+
__decorate([
|
|
3595
|
+
nameForSerialization('hasZoomListeners')
|
|
3596
|
+
], Camera.prototype, "_hasZoomListeners", void 0);
|
|
3597
|
+
__decorate([
|
|
3598
|
+
ignoreFromSerialization
|
|
3599
|
+
], Camera.prototype, "_context", void 0);
|
|
3600
|
+
__decorate([
|
|
3601
|
+
ignoreFromSerialization
|
|
3602
|
+
], Camera.prototype, "nativeReadyResolver", void 0);
|
|
3603
|
+
__decorate([
|
|
3604
|
+
ignoreFromSerialization
|
|
3605
|
+
], Camera.prototype, "nativeReadyRejecter", void 0);
|
|
3606
|
+
__decorate([
|
|
3607
|
+
ignoreFromSerialization
|
|
3608
|
+
], Camera.prototype, "nativeReadyPromise", void 0);
|
|
3609
|
+
__decorate([
|
|
3610
|
+
ignoreFromSerialization
|
|
3611
|
+
], Camera.prototype, "nativeReadyTimeout", void 0);
|
|
3612
|
+
__decorate([
|
|
3613
|
+
ignoreFromSerialization
|
|
3614
|
+
], Camera, "_cameraInstances", void 0);
|
|
3615
|
+
__decorate([
|
|
3616
|
+
ignoreFromSerialization
|
|
3617
|
+
], Camera, "coreDefaults", null);
|
|
3618
|
+
|
|
3619
|
+
class ControlImage extends DefaultSerializeable {
|
|
3620
|
+
static fromBase64EncodedImage(data) {
|
|
3621
|
+
if (data === null)
|
|
3622
|
+
return null;
|
|
3623
|
+
return new ControlImage('base64', data, null);
|
|
3624
|
+
}
|
|
3625
|
+
static fromResourceName(resource) {
|
|
3626
|
+
return new ControlImage('resource', null, resource);
|
|
3627
|
+
}
|
|
3628
|
+
constructor(type, data, name) {
|
|
3629
|
+
super();
|
|
3630
|
+
this.type = type;
|
|
3631
|
+
this._data = data;
|
|
3632
|
+
this._name = name;
|
|
3633
|
+
}
|
|
3634
|
+
isBase64EncodedImage() {
|
|
3635
|
+
return this.type === 'base64';
|
|
3636
|
+
}
|
|
3637
|
+
get data() {
|
|
3638
|
+
return this._data;
|
|
3639
|
+
}
|
|
3640
|
+
}
|
|
3641
|
+
__decorate([
|
|
3642
|
+
ignoreFromSerializationIfNull,
|
|
3643
|
+
nameForSerialization('data')
|
|
3644
|
+
], ControlImage.prototype, "_data", void 0);
|
|
3645
|
+
__decorate([
|
|
3646
|
+
ignoreFromSerializationIfNull,
|
|
3647
|
+
nameForSerialization('name')
|
|
3648
|
+
], ControlImage.prototype, "_name", void 0);
|
|
3667
3649
|
|
|
3668
3650
|
var DataCaptureViewEvents;
|
|
3669
3651
|
(function (DataCaptureViewEvents) {
|
|
@@ -3694,13 +3676,19 @@ class DataCaptureViewController extends BaseController {
|
|
|
3694
3676
|
}
|
|
3695
3677
|
viewPointForFramePoint(point) {
|
|
3696
3678
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3697
|
-
const result = yield this.adapter.viewPointForFramePoint({
|
|
3679
|
+
const result = yield this.adapter.viewPointForFramePoint({
|
|
3680
|
+
viewId: this.view.viewId,
|
|
3681
|
+
pointJson: JSON.stringify(point.toJSON()),
|
|
3682
|
+
});
|
|
3698
3683
|
return Point['fromJSON'](JSON.parse(result));
|
|
3699
3684
|
});
|
|
3700
3685
|
}
|
|
3701
3686
|
viewQuadrilateralForFrameQuadrilateral(quadrilateral) {
|
|
3702
3687
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3703
|
-
const result = yield this.adapter.viewQuadrilateralForFrameQuadrilateral({
|
|
3688
|
+
const result = yield this.adapter.viewQuadrilateralForFrameQuadrilateral({
|
|
3689
|
+
viewId: this.view.viewId,
|
|
3690
|
+
quadrilateralJson: JSON.stringify(quadrilateral.toJSON()),
|
|
3691
|
+
});
|
|
3704
3692
|
return Quadrilateral['fromJSON'](JSON.parse(result));
|
|
3705
3693
|
});
|
|
3706
3694
|
}
|
|
@@ -3868,7 +3856,10 @@ class DataCaptureViewController extends BaseController {
|
|
|
3868
3856
|
return;
|
|
3869
3857
|
}
|
|
3870
3858
|
yield this.adapter.registerZoomGestureListener({ viewId: this.view.viewId });
|
|
3871
|
-
this._proxy.subscribeForEvents([
|
|
3859
|
+
this._proxy.subscribeForEvents([
|
|
3860
|
+
ZoomGestureListenerEvents.onZoomInGesture,
|
|
3861
|
+
ZoomGestureListenerEvents.onZoomOutGesture,
|
|
3862
|
+
]);
|
|
3872
3863
|
this._proxy.eventEmitter.on(ZoomGestureListenerEvents.onZoomInGesture, this.handleOnZoomInGestureEventWrapper);
|
|
3873
3864
|
this._proxy.eventEmitter.on(ZoomGestureListenerEvents.onZoomOutGesture, this.handleOnZoomOutGestureEventWrapper);
|
|
3874
3865
|
this._zoomGestureListenerRegistered = true;
|
|
@@ -3880,14 +3871,19 @@ class DataCaptureViewController extends BaseController {
|
|
|
3880
3871
|
return;
|
|
3881
3872
|
}
|
|
3882
3873
|
yield this.adapter.unregisterZoomGestureListener({ viewId: this.view.viewId });
|
|
3883
|
-
this._proxy.unsubscribeFromEvents([
|
|
3874
|
+
this._proxy.unsubscribeFromEvents([
|
|
3875
|
+
ZoomGestureListenerEvents.onZoomInGesture,
|
|
3876
|
+
ZoomGestureListenerEvents.onZoomOutGesture,
|
|
3877
|
+
]);
|
|
3884
3878
|
this._proxy.eventEmitter.off(ZoomGestureListenerEvents.onZoomInGesture, this.handleOnZoomInGestureEventWrapper);
|
|
3885
3879
|
this._proxy.eventEmitter.off(ZoomGestureListenerEvents.onZoomOutGesture, this.handleOnZoomOutGestureEventWrapper);
|
|
3886
3880
|
this._zoomGestureListenerRegistered = false;
|
|
3887
3881
|
});
|
|
3888
3882
|
}
|
|
3889
3883
|
handleOnZoomInGestureEvent(eventPayload) {
|
|
3890
|
-
const event = EventDataParser.parseIfShouldHandle(eventPayload, {
|
|
3884
|
+
const event = EventDataParser.parseIfShouldHandle(eventPayload, {
|
|
3885
|
+
viewId: this.view.viewId,
|
|
3886
|
+
});
|
|
3891
3887
|
if (event === SKIP) {
|
|
3892
3888
|
return;
|
|
3893
3889
|
}
|
|
@@ -3907,7 +3903,9 @@ class DataCaptureViewController extends BaseController {
|
|
|
3907
3903
|
}
|
|
3908
3904
|
}
|
|
3909
3905
|
handleOnZoomOutGestureEvent(eventPayload) {
|
|
3910
|
-
const event = EventDataParser.parseIfShouldHandle(eventPayload, {
|
|
3906
|
+
const event = EventDataParser.parseIfShouldHandle(eventPayload, {
|
|
3907
|
+
viewId: this.view.viewId,
|
|
3908
|
+
});
|
|
3911
3909
|
if (event === SKIP) {
|
|
3912
3910
|
return;
|
|
3913
3911
|
}
|
|
@@ -3930,7 +3928,9 @@ class DataCaptureViewController extends BaseController {
|
|
|
3930
3928
|
return this._proxy.$createDataCaptureView({ viewJson: JSON.stringify(this.view.toJSON()) });
|
|
3931
3929
|
}
|
|
3932
3930
|
handleDidChangeSizeEvent(eventPayload) {
|
|
3933
|
-
const event = EventDataParser.parseIfShouldHandle(eventPayload, {
|
|
3931
|
+
const event = EventDataParser.parseIfShouldHandle(eventPayload, {
|
|
3932
|
+
viewId: this.view.viewId,
|
|
3933
|
+
});
|
|
3934
3934
|
if (event === SKIP) {
|
|
3935
3935
|
return;
|
|
3936
3936
|
}
|
|
@@ -4190,13 +4190,10 @@ class BaseDataCaptureView extends DefaultSerializeable {
|
|
|
4190
4190
|
}
|
|
4191
4191
|
createNativeView(viewId) {
|
|
4192
4192
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4193
|
-
var _a, _b, _c;
|
|
4194
4193
|
if (this.isViewCreated) {
|
|
4195
4194
|
return Promise.resolve();
|
|
4196
4195
|
}
|
|
4197
4196
|
this.viewId = viewId;
|
|
4198
|
-
const json = this.toJSON();
|
|
4199
|
-
console.log('[createNativeView] controls count:', (_b = (_a = json.controls) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0, 'control types:', (_c = json.controls) === null || _c === void 0 ? void 0 : _c.map((c) => c.type));
|
|
4200
4197
|
yield this.controller.createNativeView();
|
|
4201
4198
|
this.isViewCreated = true;
|
|
4202
4199
|
this.notifyOverlaysOfViewIdChange();
|
|
@@ -4671,7 +4668,7 @@ class CameraSettings extends DefaultSerializeable {
|
|
|
4671
4668
|
'manualLensPosition',
|
|
4672
4669
|
'shouldPreferSmoothAutoFocus',
|
|
4673
4670
|
'focusStrategy',
|
|
4674
|
-
'focusGestureStrategy'
|
|
4671
|
+
'focusGestureStrategy',
|
|
4675
4672
|
];
|
|
4676
4673
|
this.focus = {
|
|
4677
4674
|
range: CameraSettings.coreDefaults.Camera.Settings.focusRange,
|
|
@@ -4680,9 +4677,11 @@ class CameraSettings extends DefaultSerializeable {
|
|
|
4680
4677
|
manualLensPosition: CameraSettings.coreDefaults.Camera.Settings.manualLensPosition,
|
|
4681
4678
|
focusStrategy: CameraSettings.coreDefaults.Camera.Settings.focusStrategy,
|
|
4682
4679
|
};
|
|
4683
|
-
this.preferredResolution =
|
|
4680
|
+
this.preferredResolution =
|
|
4681
|
+
(_a = settings === null || settings === void 0 ? void 0 : settings.preferredResolution) !== null && _a !== void 0 ? _a : CameraSettings.coreDefaults.Camera.Settings.preferredResolution;
|
|
4684
4682
|
this.zoomFactor = (_b = settings === null || settings === void 0 ? void 0 : settings.zoomFactor) !== null && _b !== void 0 ? _b : CameraSettings.coreDefaults.Camera.Settings.zoomFactor;
|
|
4685
|
-
this.zoomGestureZoomFactor =
|
|
4683
|
+
this.zoomGestureZoomFactor =
|
|
4684
|
+
(_c = settings === null || settings === void 0 ? void 0 : settings.zoomGestureZoomFactor) !== null && _c !== void 0 ? _c : CameraSettings.coreDefaults.Camera.Settings.zoomGestureZoomFactor;
|
|
4686
4685
|
this.torchLevel = (_d = settings === null || settings === void 0 ? void 0 : settings.torchLevel) !== null && _d !== void 0 ? _d : CameraSettings.coreDefaults.Camera.Settings.torchLevel;
|
|
4687
4686
|
this.macroMode = (_e = settings === null || settings === void 0 ? void 0 : settings.macroMode) !== null && _e !== void 0 ? _e : CameraSettings.coreDefaults.Camera.Settings.macroMode;
|
|
4688
4687
|
this.adaptiveExposure = (_f = settings === null || settings === void 0 ? void 0 : settings.adaptiveExposure) !== null && _f !== void 0 ? _f : CameraSettings.coreDefaults.Camera.Settings.adaptiveExposure;
|
|
@@ -4740,27 +4739,301 @@ var ZoomSwitchOrientation;
|
|
|
4740
4739
|
ZoomSwitchOrientation["Vertical"] = "vertical";
|
|
4741
4740
|
})(ZoomSwitchOrientation || (ZoomSwitchOrientation = {}));
|
|
4742
4741
|
|
|
4743
|
-
|
|
4742
|
+
var CameraPosition;
|
|
4743
|
+
(function (CameraPosition) {
|
|
4744
|
+
CameraPosition["WorldFacing"] = "worldFacing";
|
|
4745
|
+
CameraPosition["UserFacing"] = "userFacing";
|
|
4746
|
+
CameraPosition["Unspecified"] = "unspecified";
|
|
4747
|
+
})(CameraPosition || (CameraPosition = {}));
|
|
4744
4748
|
|
|
4745
|
-
class
|
|
4746
|
-
static
|
|
4747
|
-
if (
|
|
4749
|
+
class CameraOwnershipManager {
|
|
4750
|
+
static getInstance() {
|
|
4751
|
+
if (!CameraOwnershipManager.instance) {
|
|
4752
|
+
CameraOwnershipManager.instance = new CameraOwnershipManager();
|
|
4753
|
+
}
|
|
4754
|
+
return CameraOwnershipManager.instance;
|
|
4755
|
+
}
|
|
4756
|
+
constructor() {
|
|
4757
|
+
this.owners = new Map();
|
|
4758
|
+
this.waitingQueue = new Map();
|
|
4759
|
+
this.protectedCameras = new Set();
|
|
4760
|
+
}
|
|
4761
|
+
requestOwnership(position, owner) {
|
|
4762
|
+
const currentOwner = this.owners.get(position);
|
|
4763
|
+
if (currentOwner && currentOwner.id !== owner.id) {
|
|
4764
|
+
return false; // Already owned by someone else
|
|
4765
|
+
}
|
|
4766
|
+
this.owners.set(position, owner);
|
|
4767
|
+
this.enableProtectionForOwner(position, owner);
|
|
4768
|
+
return true;
|
|
4769
|
+
}
|
|
4770
|
+
requestOwnershipAsync(position, owner, timeoutMs) {
|
|
4771
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4772
|
+
// Try immediate acquisition first
|
|
4773
|
+
if (this.requestOwnership(position, owner)) {
|
|
4774
|
+
return true;
|
|
4775
|
+
}
|
|
4776
|
+
// If not available, wait in queue
|
|
4777
|
+
return new Promise(resolve => {
|
|
4778
|
+
const request = { owner, resolve };
|
|
4779
|
+
if (!this.waitingQueue.has(position)) {
|
|
4780
|
+
this.waitingQueue.set(position, []);
|
|
4781
|
+
}
|
|
4782
|
+
this.waitingQueue.get(position).push(request);
|
|
4783
|
+
// Optional timeout
|
|
4784
|
+
if (timeoutMs && timeoutMs > 0) {
|
|
4785
|
+
setTimeout(() => {
|
|
4786
|
+
this.removeFromQueue(position, request);
|
|
4787
|
+
resolve(false); // Timeout - ownership not acquired
|
|
4788
|
+
}, timeoutMs);
|
|
4789
|
+
}
|
|
4790
|
+
});
|
|
4791
|
+
});
|
|
4792
|
+
}
|
|
4793
|
+
releaseOwnership(position, owner) {
|
|
4794
|
+
const currentOwner = this.owners.get(position);
|
|
4795
|
+
if (!currentOwner || currentOwner.id !== owner.id) {
|
|
4796
|
+
return false; // Not the owner
|
|
4797
|
+
}
|
|
4798
|
+
this.owners.delete(position);
|
|
4799
|
+
this.disableProtectionForPosition(position);
|
|
4800
|
+
this.processWaitingQueue(position);
|
|
4801
|
+
return true;
|
|
4802
|
+
}
|
|
4803
|
+
isOwner(position, owner) {
|
|
4804
|
+
const currentOwner = this.owners.get(position);
|
|
4805
|
+
return (currentOwner === null || currentOwner === void 0 ? void 0 : currentOwner.id) === owner.id;
|
|
4806
|
+
}
|
|
4807
|
+
getCurrentOwner(position) {
|
|
4808
|
+
return this.owners.get(position) || null;
|
|
4809
|
+
}
|
|
4810
|
+
checkOwnership(position, owner) {
|
|
4811
|
+
return this.isOwner(position, owner);
|
|
4812
|
+
}
|
|
4813
|
+
getOwnedPosition(owner) {
|
|
4814
|
+
for (const [position, currentOwner] of this.owners.entries()) {
|
|
4815
|
+
if (currentOwner.id === owner.id) {
|
|
4816
|
+
return position;
|
|
4817
|
+
}
|
|
4818
|
+
}
|
|
4819
|
+
return null;
|
|
4820
|
+
}
|
|
4821
|
+
getAllOwnedPositions(owner) {
|
|
4822
|
+
const positions = [];
|
|
4823
|
+
for (const [position, currentOwner] of this.owners.entries()) {
|
|
4824
|
+
if (currentOwner.id === owner.id) {
|
|
4825
|
+
positions.push(position);
|
|
4826
|
+
}
|
|
4827
|
+
}
|
|
4828
|
+
return positions;
|
|
4829
|
+
}
|
|
4830
|
+
enableProtectionForOwner(position, owner) {
|
|
4831
|
+
const camera = Camera.atPosition(position);
|
|
4832
|
+
if (!camera || this.protectedCameras.has(camera)) {
|
|
4833
|
+
return; // Camera not available or already protected
|
|
4834
|
+
}
|
|
4835
|
+
this.protectCameraForOwner(camera, position, owner);
|
|
4836
|
+
this.protectedCameras.add(camera);
|
|
4837
|
+
}
|
|
4838
|
+
disableProtectionForPosition(position) {
|
|
4839
|
+
const camera = Camera.atPosition(position);
|
|
4840
|
+
if (!camera || !this.protectedCameras.has(camera)) {
|
|
4841
|
+
return;
|
|
4842
|
+
}
|
|
4843
|
+
this.unprotectCamera(camera);
|
|
4844
|
+
this.protectedCameras.delete(camera);
|
|
4845
|
+
}
|
|
4846
|
+
processWaitingQueue(position) {
|
|
4847
|
+
const queue = this.waitingQueue.get(position);
|
|
4848
|
+
if (!queue || queue.length === 0) {
|
|
4849
|
+
return;
|
|
4850
|
+
}
|
|
4851
|
+
// Give ownership to the first in queue
|
|
4852
|
+
const nextRequest = queue.shift();
|
|
4853
|
+
this.owners.set(position, nextRequest.owner);
|
|
4854
|
+
this.enableProtectionForOwner(position, nextRequest.owner);
|
|
4855
|
+
nextRequest.resolve(true);
|
|
4856
|
+
// Clean up empty queue
|
|
4857
|
+
if (queue.length === 0) {
|
|
4858
|
+
this.waitingQueue.delete(position);
|
|
4859
|
+
}
|
|
4860
|
+
}
|
|
4861
|
+
removeFromQueue(position, requestToRemove) {
|
|
4862
|
+
const queue = this.waitingQueue.get(position);
|
|
4863
|
+
if (!queue)
|
|
4864
|
+
return;
|
|
4865
|
+
const index = queue.indexOf(requestToRemove);
|
|
4866
|
+
if (index > -1) {
|
|
4867
|
+
queue.splice(index, 1);
|
|
4868
|
+
}
|
|
4869
|
+
if (queue.length === 0) {
|
|
4870
|
+
this.waitingQueue.delete(position);
|
|
4871
|
+
}
|
|
4872
|
+
}
|
|
4873
|
+
protectCameraForOwner(camera, position, _owner) {
|
|
4874
|
+
var _a, _b, _c, _d;
|
|
4875
|
+
const originalSwitchToDesiredState = camera.switchToDesiredState.bind(camera);
|
|
4876
|
+
const originalApplySettings = camera.applySettings.bind(camera);
|
|
4877
|
+
const originalSetDesiredTorchState = (_b = (_a = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(camera), 'desiredTorchState')) === null || _a === void 0 ? void 0 : _a.set) === null || _b === void 0 ? void 0 : _b.bind(camera);
|
|
4878
|
+
// Protect switchToDesiredState - only owner can call it
|
|
4879
|
+
camera.switchToDesiredState = (state) => __awaiter(this, void 0, void 0, function* () {
|
|
4880
|
+
const currentOwner = this.getCurrentOwner(position);
|
|
4881
|
+
if (!currentOwner) {
|
|
4882
|
+
throw new Error(`Camera operation denied: No owner for camera at ${position}`);
|
|
4883
|
+
}
|
|
4884
|
+
// Allow operation - the owner is the only one who should have access to this camera instance
|
|
4885
|
+
return originalSwitchToDesiredState(state);
|
|
4886
|
+
});
|
|
4887
|
+
// Protect applySettings - only owner can call it
|
|
4888
|
+
camera.applySettings = (settings) => __awaiter(this, void 0, void 0, function* () {
|
|
4889
|
+
const currentOwner = this.getCurrentOwner(position);
|
|
4890
|
+
if (!currentOwner) {
|
|
4891
|
+
throw new Error(`Camera operation denied: No owner for camera at ${position}`);
|
|
4892
|
+
}
|
|
4893
|
+
return originalApplySettings(settings);
|
|
4894
|
+
});
|
|
4895
|
+
// Protect desiredTorchState setter - only owner can set it
|
|
4896
|
+
if (originalSetDesiredTorchState) {
|
|
4897
|
+
Object.defineProperty(camera, 'desiredTorchState', {
|
|
4898
|
+
set: (value) => {
|
|
4899
|
+
const currentOwner = this.getCurrentOwner(position);
|
|
4900
|
+
if (!currentOwner) {
|
|
4901
|
+
throw new Error(`Camera operation denied: No owner for camera at ${position}`);
|
|
4902
|
+
}
|
|
4903
|
+
originalSetDesiredTorchState(value);
|
|
4904
|
+
},
|
|
4905
|
+
get: (_d = (_c = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(camera), 'desiredTorchState')) === null || _c === void 0 ? void 0 : _c.get) === null || _d === void 0 ? void 0 : _d.bind(camera),
|
|
4906
|
+
configurable: true,
|
|
4907
|
+
});
|
|
4908
|
+
}
|
|
4909
|
+
// Store originals for restoration
|
|
4910
|
+
camera.__originalMethods = {
|
|
4911
|
+
switchToDesiredState: originalSwitchToDesiredState,
|
|
4912
|
+
applySettings: originalApplySettings,
|
|
4913
|
+
setDesiredTorchState: originalSetDesiredTorchState,
|
|
4914
|
+
};
|
|
4915
|
+
}
|
|
4916
|
+
unprotectCamera(camera) {
|
|
4917
|
+
var _a, _b;
|
|
4918
|
+
const originals = camera.__originalMethods;
|
|
4919
|
+
if (!originals)
|
|
4920
|
+
return;
|
|
4921
|
+
// Restore original methods
|
|
4922
|
+
camera.switchToDesiredState = originals.switchToDesiredState;
|
|
4923
|
+
camera.applySettings = originals.applySettings;
|
|
4924
|
+
if (originals.setDesiredTorchState) {
|
|
4925
|
+
Object.defineProperty(camera, 'desiredTorchState', {
|
|
4926
|
+
set: originals.setDesiredTorchState,
|
|
4927
|
+
get: (_b = (_a = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(camera), 'desiredTorchState')) === null || _a === void 0 ? void 0 : _a.get) === null || _b === void 0 ? void 0 : _b.bind(camera),
|
|
4928
|
+
configurable: true,
|
|
4929
|
+
});
|
|
4930
|
+
}
|
|
4931
|
+
delete camera.__originalMethods;
|
|
4932
|
+
}
|
|
4933
|
+
}
|
|
4934
|
+
|
|
4935
|
+
class CameraOwnershipHelper {
|
|
4936
|
+
/**
|
|
4937
|
+
* Get camera instance for the owner (only works if you own it)
|
|
4938
|
+
*/
|
|
4939
|
+
static getCamera(position, owner) {
|
|
4940
|
+
// Check ownership
|
|
4941
|
+
if (!this.ownershipManager.checkOwnership(position, owner)) {
|
|
4942
|
+
console.warn(`Camera access denied: ${owner.id} does not own camera at ${position}`);
|
|
4748
4943
|
return null;
|
|
4749
4944
|
}
|
|
4750
|
-
return
|
|
4945
|
+
return Camera.atPosition(position);
|
|
4751
4946
|
}
|
|
4752
|
-
|
|
4753
|
-
|
|
4947
|
+
/**
|
|
4948
|
+
* Safely execute camera operations (only works if you own the camera)
|
|
4949
|
+
*/
|
|
4950
|
+
static withCamera(position, owner, operation) {
|
|
4951
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4952
|
+
const camera = this.getCamera(position, owner);
|
|
4953
|
+
if (!camera) {
|
|
4954
|
+
return null;
|
|
4955
|
+
}
|
|
4956
|
+
try {
|
|
4957
|
+
const result = yield operation(camera);
|
|
4958
|
+
return result;
|
|
4959
|
+
}
|
|
4960
|
+
catch (error) {
|
|
4961
|
+
console.error(`Camera operation failed for ${owner.id}:`, error);
|
|
4962
|
+
throw error;
|
|
4963
|
+
}
|
|
4964
|
+
});
|
|
4965
|
+
}
|
|
4966
|
+
/**
|
|
4967
|
+
* Execute camera operations, waiting for ownership if necessary
|
|
4968
|
+
*/
|
|
4969
|
+
static withCameraWhenAvailable(position, owner, operation, timeoutMs) {
|
|
4970
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4971
|
+
// Try to get ownership, wait if necessary
|
|
4972
|
+
const acquired = yield this.requestOwnership(position, owner, timeoutMs);
|
|
4973
|
+
if (!acquired) {
|
|
4974
|
+
console.warn(`Could not acquire camera ownership for ${owner.id} within timeout`);
|
|
4975
|
+
return null;
|
|
4976
|
+
}
|
|
4977
|
+
const camera = Camera.atPosition(position);
|
|
4978
|
+
if (!camera) {
|
|
4979
|
+
console.warn(`Camera not available at position ${position}`);
|
|
4980
|
+
return null;
|
|
4981
|
+
}
|
|
4982
|
+
try {
|
|
4983
|
+
const result = yield operation(camera);
|
|
4984
|
+
return result;
|
|
4985
|
+
}
|
|
4986
|
+
catch (error) {
|
|
4987
|
+
console.error(`Camera operation failed for ${owner.id}:`, error);
|
|
4988
|
+
throw error;
|
|
4989
|
+
}
|
|
4990
|
+
});
|
|
4991
|
+
}
|
|
4992
|
+
/**
|
|
4993
|
+
* Request ownership and wait if necessary
|
|
4994
|
+
*/
|
|
4995
|
+
static requestOwnership(position, owner, timeoutMs) {
|
|
4996
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4997
|
+
return this.ownershipManager.requestOwnershipAsync(position, owner, timeoutMs);
|
|
4998
|
+
});
|
|
4999
|
+
}
|
|
5000
|
+
/**
|
|
5001
|
+
* Release ownership
|
|
5002
|
+
*/
|
|
5003
|
+
static releaseOwnership(position, owner) {
|
|
5004
|
+
return this.ownershipManager.releaseOwnership(position, owner);
|
|
5005
|
+
}
|
|
5006
|
+
/**
|
|
5007
|
+
* Check if owner has ownership
|
|
5008
|
+
*/
|
|
5009
|
+
static hasOwnership(position, owner) {
|
|
5010
|
+
return this.ownershipManager.checkOwnership(position, owner);
|
|
5011
|
+
}
|
|
5012
|
+
/**
|
|
5013
|
+
* Get the camera position currently owned by the owner (if unknown)
|
|
5014
|
+
*/
|
|
5015
|
+
static getOwnedPosition(owner) {
|
|
5016
|
+
return this.ownershipManager.getOwnedPosition(owner);
|
|
5017
|
+
}
|
|
5018
|
+
/**
|
|
5019
|
+
* Get all camera positions currently owned by the owner
|
|
5020
|
+
*/
|
|
5021
|
+
static getAllOwnedPositions(owner) {
|
|
5022
|
+
return this.ownershipManager.getAllOwnedPositions(owner);
|
|
4754
5023
|
}
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
5024
|
+
/**
|
|
5025
|
+
* Release ownership of all cameras owned by the owner
|
|
5026
|
+
*/
|
|
5027
|
+
static releaseAllOwnerships(owner) {
|
|
5028
|
+
const ownedPositions = this.getAllOwnedPositions(owner);
|
|
5029
|
+
for (const position of ownedPositions) {
|
|
5030
|
+
this.releaseOwnership(position, owner);
|
|
5031
|
+
}
|
|
4759
5032
|
}
|
|
4760
5033
|
}
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
5034
|
+
CameraOwnershipHelper.ownershipManager = CameraOwnershipManager.getInstance();
|
|
5035
|
+
|
|
5036
|
+
const NoViewfinder = { type: 'none' };
|
|
4764
5037
|
|
|
4765
5038
|
class RectangularViewfinder extends DefaultSerializeable {
|
|
4766
5039
|
get sizeWithUnitAndAspect() {
|
|
@@ -4903,240 +5176,6 @@ class LaserlineViewfinder extends DefaultSerializeable {
|
|
|
4903
5176
|
}
|
|
4904
5177
|
}
|
|
4905
5178
|
|
|
4906
|
-
// Capacitor returns nested values as already-parsed objects; other bridges (Cordova, RN) return JSON strings.
|
|
4907
|
-
function parseOrUse(value) {
|
|
4908
|
-
return typeof value === 'string' ? JSON.parse(value) : value;
|
|
4909
|
-
}
|
|
4910
|
-
function parseDefaults(jsonDefaults) {
|
|
4911
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
4912
|
-
const coreDefaults = {
|
|
4913
|
-
Camera: {
|
|
4914
|
-
Settings: {
|
|
4915
|
-
preferredResolution: jsonDefaults.Camera.Settings.preferredResolution,
|
|
4916
|
-
zoomFactor: jsonDefaults.Camera.Settings.zoomFactor,
|
|
4917
|
-
focusRange: jsonDefaults.Camera.Settings.focusRange,
|
|
4918
|
-
zoomGestureZoomFactor: jsonDefaults.Camera.Settings.zoomGestureZoomFactor,
|
|
4919
|
-
zoomLevels: (_a = jsonDefaults.Camera.Settings.zoomLevels) !== null && _a !== void 0 ? _a : [1, 2],
|
|
4920
|
-
focusGestureStrategy: jsonDefaults.Camera.Settings.focusGestureStrategy,
|
|
4921
|
-
shouldPreferSmoothAutoFocus: jsonDefaults.Camera.Settings.shouldPreferSmoothAutoFocus,
|
|
4922
|
-
torchLevel: (_b = jsonDefaults.Camera.Settings.torchLevel) !== null && _b !== void 0 ? _b : 1.0,
|
|
4923
|
-
macroMode: ((_c = jsonDefaults.Camera.Settings.macroMode) !== null && _c !== void 0 ? _c : 'auto'),
|
|
4924
|
-
adaptiveExposure: (_d = jsonDefaults.Camera.Settings.adaptiveExposure) !== null && _d !== void 0 ? _d : false,
|
|
4925
|
-
manualLensPosition: (_e = jsonDefaults.Camera.Settings.manualLensPosition) !== null && _e !== void 0 ? _e : 0,
|
|
4926
|
-
focusStrategy: (_f = jsonDefaults.Camera.Settings.focusStrategy) !== null && _f !== void 0 ? _f : 'auto',
|
|
4927
|
-
properties: jsonDefaults.Camera.Settings.properties,
|
|
4928
|
-
},
|
|
4929
|
-
defaultPosition: (jsonDefaults.Camera.defaultPosition || null),
|
|
4930
|
-
availablePositions: jsonDefaults.Camera.availablePositions,
|
|
4931
|
-
},
|
|
4932
|
-
ZoomSwitchControl: {
|
|
4933
|
-
orientation: ((_h = (_g = jsonDefaults.ZoomSwitchControl) === null || _g === void 0 ? void 0 : _g.orientation) !== null && _h !== void 0 ? _h : 'horizontal'),
|
|
4934
|
-
isAlwaysExpanded: (_k = (_j = jsonDefaults.ZoomSwitchControl) === null || _j === void 0 ? void 0 : _j.isAlwaysExpanded) !== null && _k !== void 0 ? _k : false,
|
|
4935
|
-
isExpanded: (_m = (_l = jsonDefaults.ZoomSwitchControl) === null || _l === void 0 ? void 0 : _l.isExpanded) !== null && _m !== void 0 ? _m : false,
|
|
4936
|
-
accessibilityLabel: (_p = (_o = jsonDefaults.ZoomSwitchControl) === null || _o === void 0 ? void 0 : _o.accessibilityLabel) !== null && _p !== void 0 ? _p : 'Zoom <level>',
|
|
4937
|
-
accessibilityHint: (_r = (_q = jsonDefaults.ZoomSwitchControl) === null || _q === void 0 ? void 0 : _q.accessibilityHint) !== null && _r !== void 0 ? _r : 'Adjusts the camera zoom level',
|
|
4938
|
-
},
|
|
4939
|
-
DataCaptureView: {
|
|
4940
|
-
scanAreaMargins: MarginsWithUnit['fromJSON'](parseOrUse(jsonDefaults.DataCaptureView.scanAreaMargins)),
|
|
4941
|
-
pointOfInterest: PointWithUnit['fromJSON'](parseOrUse(jsonDefaults.DataCaptureView.pointOfInterest)),
|
|
4942
|
-
logoAnchor: jsonDefaults.DataCaptureView.logoAnchor,
|
|
4943
|
-
logoOffset: PointWithUnit['fromJSON'](parseOrUse(jsonDefaults.DataCaptureView.logoOffset)),
|
|
4944
|
-
focusGesture: PrivateFocusGestureDeserializer['fromJSON'](parseOrUse(jsonDefaults.DataCaptureView.focusGesture)),
|
|
4945
|
-
zoomGesture: PrivateZoomGestureDeserializer['fromJSON'](parseOrUse(jsonDefaults.DataCaptureView.zoomGesture)),
|
|
4946
|
-
zoomGestures: jsonDefaults.DataCaptureView.zoomGestures
|
|
4947
|
-
? PrivateZoomGestureDeserializer['fromJSONArray'](parseOrUse(jsonDefaults.DataCaptureView.zoomGestures).map(parseOrUse))
|
|
4948
|
-
: PrivateZoomGestureDeserializer['fromJSON'](parseOrUse(jsonDefaults.DataCaptureView.zoomGesture)) != null
|
|
4949
|
-
? [PrivateZoomGestureDeserializer['fromJSON'](parseOrUse(jsonDefaults.DataCaptureView.zoomGesture))]
|
|
4950
|
-
: [],
|
|
4951
|
-
logoStyle: jsonDefaults.DataCaptureView.logoStyle,
|
|
4952
|
-
shouldShowZoomNotification: jsonDefaults.DataCaptureView.shouldShowZoomNotification,
|
|
4953
|
-
},
|
|
4954
|
-
RectangularViewfinder: Object.keys(jsonDefaults.RectangularViewfinder.styles).reduce((acc, key) => {
|
|
4955
|
-
const viewfinder = jsonDefaults.RectangularViewfinder.styles[key];
|
|
4956
|
-
acc.styles[key] = {
|
|
4957
|
-
size: SizeWithUnitAndAspect['fromJSON'](parseOrUse(viewfinder.size)),
|
|
4958
|
-
color: Color['fromJSON'](viewfinder.color),
|
|
4959
|
-
disabledColor: Color['fromJSON'](viewfinder.disabledColor),
|
|
4960
|
-
style: viewfinder.style,
|
|
4961
|
-
lineStyle: viewfinder.lineStyle,
|
|
4962
|
-
dimming: viewfinder.dimming,
|
|
4963
|
-
disabledDimming: viewfinder.disabledDimming,
|
|
4964
|
-
animation: RectangularViewfinderAnimation['fromJSON'](parseOrUse(viewfinder.animation)),
|
|
4965
|
-
};
|
|
4966
|
-
return acc;
|
|
4967
|
-
}, { defaultStyle: jsonDefaults.RectangularViewfinder.defaultStyle, styles: {} }),
|
|
4968
|
-
AimerViewfinder: {
|
|
4969
|
-
frameColor: Color['fromJSON'](jsonDefaults.AimerViewfinder.frameColor),
|
|
4970
|
-
dotColor: Color['fromJSON'](jsonDefaults.AimerViewfinder.dotColor),
|
|
4971
|
-
},
|
|
4972
|
-
Brush: new Brush(Color['fromJSON'](jsonDefaults.Brush.fillColor), Color['fromJSON'](jsonDefaults.Brush.strokeColor), jsonDefaults.Brush.strokeWidth),
|
|
4973
|
-
LaserlineViewfinder: {
|
|
4974
|
-
width: NumberWithUnit['fromJSON'](parseOrUse(jsonDefaults.LaserlineViewfinder.width)),
|
|
4975
|
-
enabledColor: Color['fromJSON'](jsonDefaults.LaserlineViewfinder.enabledColor),
|
|
4976
|
-
disabledColor: Color['fromJSON'](jsonDefaults.LaserlineViewfinder.disabledColor),
|
|
4977
|
-
},
|
|
4978
|
-
deviceID: jsonDefaults.deviceID,
|
|
4979
|
-
};
|
|
4980
|
-
// Inject defaults to avoid a circular dependency between these classes and the defaults
|
|
4981
|
-
Brush['defaults'] = coreDefaults.Brush;
|
|
4982
|
-
return coreDefaults;
|
|
4983
|
-
}
|
|
4984
|
-
|
|
4985
|
-
let coreDefaultsLoader;
|
|
4986
|
-
function setCoreDefaultsLoader(loader) {
|
|
4987
|
-
coreDefaultsLoader = loader;
|
|
4988
|
-
}
|
|
4989
|
-
function ensureCoreDefaults() {
|
|
4990
|
-
var _a, _b;
|
|
4991
|
-
const existing = (_a = FactoryMaker.instances.get('CoreDefaults')) === null || _a === void 0 ? void 0 : _a.instance;
|
|
4992
|
-
if (existing) {
|
|
4993
|
-
return existing;
|
|
4994
|
-
}
|
|
4995
|
-
coreDefaultsLoader === null || coreDefaultsLoader === void 0 ? void 0 : coreDefaultsLoader();
|
|
4996
|
-
const reloaded = (_b = FactoryMaker.instances.get('CoreDefaults')) === null || _b === void 0 ? void 0 : _b.instance;
|
|
4997
|
-
if (reloaded) {
|
|
4998
|
-
return reloaded;
|
|
4999
|
-
}
|
|
5000
|
-
throw new Error('CoreDefaults missing and re-init failed');
|
|
5001
|
-
}
|
|
5002
|
-
function loadCoreDefaults(jsonDefaults) {
|
|
5003
|
-
const coreDefaults = parseDefaults(jsonDefaults);
|
|
5004
|
-
FactoryMaker.bindInstanceIfNotExists('CoreDefaults', coreDefaults);
|
|
5005
|
-
}
|
|
5006
|
-
|
|
5007
|
-
function getCoreDefaults() {
|
|
5008
|
-
return ensureCoreDefaults();
|
|
5009
|
-
}
|
|
5010
|
-
|
|
5011
|
-
var VibrationType;
|
|
5012
|
-
(function (VibrationType) {
|
|
5013
|
-
VibrationType["default"] = "default";
|
|
5014
|
-
VibrationType["selectionHaptic"] = "selectionHaptic";
|
|
5015
|
-
VibrationType["successHaptic"] = "successHaptic";
|
|
5016
|
-
VibrationType["waveForm"] = "waveForm";
|
|
5017
|
-
VibrationType["impactHaptic"] = "impactHaptic";
|
|
5018
|
-
})(VibrationType || (VibrationType = {}));
|
|
5019
|
-
|
|
5020
|
-
class Vibration extends DefaultSerializeable {
|
|
5021
|
-
static get defaultVibration() {
|
|
5022
|
-
return new Vibration(VibrationType.default);
|
|
5023
|
-
}
|
|
5024
|
-
static get selectionHapticFeedback() {
|
|
5025
|
-
return new Vibration(VibrationType.selectionHaptic);
|
|
5026
|
-
}
|
|
5027
|
-
static get successHapticFeedback() {
|
|
5028
|
-
return new Vibration(VibrationType.successHaptic);
|
|
5029
|
-
}
|
|
5030
|
-
static get impactHapticFeedback() {
|
|
5031
|
-
return new Vibration(VibrationType.impactHaptic);
|
|
5032
|
-
}
|
|
5033
|
-
static fromJSON(json) {
|
|
5034
|
-
if (json.type === 'waveForm') {
|
|
5035
|
-
return new WaveFormVibration(json.timings, json.amplitudes);
|
|
5036
|
-
}
|
|
5037
|
-
return new Vibration(json.type);
|
|
5038
|
-
}
|
|
5039
|
-
constructor(type) {
|
|
5040
|
-
super();
|
|
5041
|
-
this.type = type;
|
|
5042
|
-
}
|
|
5043
|
-
}
|
|
5044
|
-
class WaveFormVibration extends Vibration {
|
|
5045
|
-
get timings() {
|
|
5046
|
-
return this._timings;
|
|
5047
|
-
}
|
|
5048
|
-
get amplitudes() {
|
|
5049
|
-
return this._amplitudes;
|
|
5050
|
-
}
|
|
5051
|
-
constructor(timings, amplitudes = null) {
|
|
5052
|
-
super(VibrationType.waveForm);
|
|
5053
|
-
this._timings = timings;
|
|
5054
|
-
this._amplitudes = amplitudes;
|
|
5055
|
-
}
|
|
5056
|
-
}
|
|
5057
|
-
__decorate([
|
|
5058
|
-
nameForSerialization('timings')
|
|
5059
|
-
], WaveFormVibration.prototype, "_timings", void 0);
|
|
5060
|
-
__decorate([
|
|
5061
|
-
ignoreFromSerializationIfNull,
|
|
5062
|
-
nameForSerialization('amplitudes')
|
|
5063
|
-
], WaveFormVibration.prototype, "_amplitudes", void 0);
|
|
5064
|
-
|
|
5065
|
-
class Sound extends DefaultSerializeable {
|
|
5066
|
-
static get defaultSound() {
|
|
5067
|
-
return new Sound(null);
|
|
5068
|
-
}
|
|
5069
|
-
static fromJSON(json) {
|
|
5070
|
-
return new Sound(json.resource);
|
|
5071
|
-
}
|
|
5072
|
-
constructor(resource) {
|
|
5073
|
-
super();
|
|
5074
|
-
this.resource = null;
|
|
5075
|
-
this.resource = resource;
|
|
5076
|
-
}
|
|
5077
|
-
}
|
|
5078
|
-
__decorate([
|
|
5079
|
-
ignoreFromSerializationIfNull
|
|
5080
|
-
], Sound.prototype, "resource", void 0);
|
|
5081
|
-
|
|
5082
|
-
class FeedbackController extends BaseController {
|
|
5083
|
-
static forFeedback(feedback) {
|
|
5084
|
-
const controller = new FeedbackController(feedback);
|
|
5085
|
-
return controller;
|
|
5086
|
-
}
|
|
5087
|
-
constructor(feedback) {
|
|
5088
|
-
super('CoreProxy');
|
|
5089
|
-
this.feedback = feedback;
|
|
5090
|
-
this.adapter = new CoreProxyAdapter(this._proxy);
|
|
5091
|
-
}
|
|
5092
|
-
emit() {
|
|
5093
|
-
void this.adapter.emitFeedback({ feedbackJson: JSON.stringify(this.feedback.toJSON()) });
|
|
5094
|
-
}
|
|
5095
|
-
dispose() {
|
|
5096
|
-
this._proxy.dispose();
|
|
5097
|
-
}
|
|
5098
|
-
}
|
|
5099
|
-
|
|
5100
|
-
class Feedback extends DefaultSerializeable {
|
|
5101
|
-
static get defaultFeedback() {
|
|
5102
|
-
return new Feedback(Vibration.defaultVibration, Sound.defaultSound);
|
|
5103
|
-
}
|
|
5104
|
-
get vibration() {
|
|
5105
|
-
return this._vibration;
|
|
5106
|
-
}
|
|
5107
|
-
get sound() {
|
|
5108
|
-
return this._sound;
|
|
5109
|
-
}
|
|
5110
|
-
static fromJSON(json) {
|
|
5111
|
-
return new Feedback((json === null || json === void 0 ? void 0 : json.vibration) ? Vibration.fromJSON(json.vibration) : null, (json === null || json === void 0 ? void 0 : json.sound) ? Sound.fromJSON(json.sound) : null);
|
|
5112
|
-
}
|
|
5113
|
-
constructor(vibration, sound) {
|
|
5114
|
-
super();
|
|
5115
|
-
this._vibration = null;
|
|
5116
|
-
this._sound = null;
|
|
5117
|
-
this._vibration = vibration;
|
|
5118
|
-
this._sound = sound;
|
|
5119
|
-
this.controller = new FeedbackController(this);
|
|
5120
|
-
}
|
|
5121
|
-
emit() {
|
|
5122
|
-
this.controller.emit();
|
|
5123
|
-
}
|
|
5124
|
-
toJSON() {
|
|
5125
|
-
return super.toJSON();
|
|
5126
|
-
}
|
|
5127
|
-
}
|
|
5128
|
-
__decorate([
|
|
5129
|
-
ignoreFromSerializationIfNull,
|
|
5130
|
-
nameForSerialization('vibration')
|
|
5131
|
-
], Feedback.prototype, "_vibration", void 0);
|
|
5132
|
-
__decorate([
|
|
5133
|
-
ignoreFromSerializationIfNull,
|
|
5134
|
-
nameForSerialization('sound')
|
|
5135
|
-
], Feedback.prototype, "_sound", void 0);
|
|
5136
|
-
__decorate([
|
|
5137
|
-
ignoreFromSerialization
|
|
5138
|
-
], Feedback.prototype, "controller", void 0);
|
|
5139
|
-
|
|
5140
5179
|
const NoneLocationSelection = { type: 'none' };
|
|
5141
5180
|
|
|
5142
5181
|
class RadiusLocationSelection extends DefaultSerializeable {
|
|
@@ -5195,7 +5234,8 @@ class RectangularLocationSelection extends DefaultSerializeable {
|
|
|
5195
5234
|
const height = NumberWithUnit['fromJSON'](rectangularLocationSelectionJSON.aspect.height);
|
|
5196
5235
|
return this.withHeightAndAspectRatio(height, rectangularLocationSelectionJSON.aspect.aspect);
|
|
5197
5236
|
}
|
|
5198
|
-
else if (rectangularLocationSelectionJSON.aspect.shorterDimension &&
|
|
5237
|
+
else if (rectangularLocationSelectionJSON.aspect.shorterDimension &&
|
|
5238
|
+
rectangularLocationSelectionJSON.aspect.aspect) {
|
|
5199
5239
|
const shorterDimension = NumberWithUnit['fromJSON'](rectangularLocationSelectionJSON.aspect.shorterDimension);
|
|
5200
5240
|
const sizeWithUnitAndAspect = SizeWithUnitAndAspect['sizeWithShorterDimensionAndAspectRatio'](shorterDimension, rectangularLocationSelectionJSON.aspect.aspect);
|
|
5201
5241
|
const locationSelection = new RectangularLocationSelection();
|
|
@@ -5265,7 +5305,7 @@ const nativeProxyHook = {
|
|
|
5265
5305
|
// Event registration methods with $$ prefix
|
|
5266
5306
|
// These establish persistent event listeners (callbackContext.successAndKeepCallback())
|
|
5267
5307
|
// and get special handling in Cordova to set up continuous event callbacks
|
|
5268
|
-
if (prop.startsWith(
|
|
5308
|
+
if (prop.startsWith('$$')) {
|
|
5269
5309
|
return (args) => {
|
|
5270
5310
|
const methodName = prop.substring(2);
|
|
5271
5311
|
return nativeProxy._callEventRegistration(methodName, args);
|
|
@@ -5274,7 +5314,7 @@ const nativeProxyHook = {
|
|
|
5274
5314
|
// All the methods with the following structure
|
|
5275
5315
|
// $methodName will be redirected to the special _call
|
|
5276
5316
|
// method on AdvancedNativeProxy
|
|
5277
|
-
if (prop.startsWith(
|
|
5317
|
+
if (prop.startsWith('$')) {
|
|
5278
5318
|
if (prop in nativeProxy) {
|
|
5279
5319
|
return nativeProxy[prop];
|
|
5280
5320
|
}
|
|
@@ -5285,7 +5325,7 @@ const nativeProxyHook = {
|
|
|
5285
5325
|
else {
|
|
5286
5326
|
return nativeProxy[prop];
|
|
5287
5327
|
}
|
|
5288
|
-
}
|
|
5328
|
+
},
|
|
5289
5329
|
};
|
|
5290
5330
|
class NativeProxy {
|
|
5291
5331
|
constructor(nativeCaller) {
|
|
@@ -5373,11 +5413,7 @@ function registerProxies(proxyTypeNames, provider) {
|
|
|
5373
5413
|
});
|
|
5374
5414
|
}
|
|
5375
5415
|
|
|
5376
|
-
const CORE_PROXY_TYPE_NAMES = [
|
|
5377
|
-
'CoreProxy',
|
|
5378
|
-
'DataCaptureViewProxy',
|
|
5379
|
-
'DataCaptureContextProxy'
|
|
5380
|
-
];
|
|
5416
|
+
const CORE_PROXY_TYPE_NAMES = ['CoreProxy', 'DataCaptureViewProxy', 'DataCaptureContextProxy'];
|
|
5381
5417
|
|
|
5382
5418
|
function registerCoreProxies(provider) {
|
|
5383
5419
|
registerProxies(CORE_PROXY_TYPE_NAMES, provider);
|
|
@@ -5399,5 +5435,5 @@ var ClusteringMode;
|
|
|
5399
5435
|
ClusteringMode["AutoWithManualCorrection"] = "autoWithManualCorrection";
|
|
5400
5436
|
})(ClusteringMode || (ClusteringMode = {}));
|
|
5401
5437
|
|
|
5402
|
-
export { AimerViewfinder, Anchor, BaseController, BaseDataCaptureView, Brush, CORE_PROXY_TYPE_NAMES, Camera, CameraController, CameraOwnershipHelper, CameraOwnershipManager, CameraPosition, CameraSettings, ClusteringMode, Color, ContextStatus, ControlImage, CoreProxyAdapter, DataCaptureContext, DataCaptureContextEvents, DataCaptureContextSettings, DataCaptureViewController, DataCaptureViewEvents, DefaultSerializeable, Direction, EventDataParser, EventEmitter, Expiration, FactoryMaker, Feedback, FocusGestureListenerEvents, FocusGestureStrategy, FocusRange, FontFamily, FrameDataController, FrameDataSettings, FrameDataSettingsBuilder, FrameSourceListenerEvents, FrameSourceState, HTMLElementState, HtmlElementPosition, HtmlElementSize, ImageBuffer, ImageFrameSource, LaserlineViewfinder, LicenseInfo, LogoStyle, MacroMode, MacroModeListenerEvents, MarginsWithUnit, MeasureUnit, NativeProxy, NoViewfinder, NoneLocationSelection, NumberWithUnit, Observable, OpenSourceSoftwareLicenseInfo, Orientation, PinchToZoom, Point, PointWithUnit, PrivateFocusGestureDeserializer, PrivateFrameData, PrivateZoomGestureDeserializer, Quadrilateral, RadiusLocationSelection, Rect, RectWithUnit, RectangularLocationSelection, RectangularViewfinder, RectangularViewfinderAnimation, RectangularViewfinderLineStyle, RectangularViewfinderStyle, SKIP, ScanIntention, ScanditIcon, ScanditIconBuilder, ScanditIconShape, ScanditIconType, Size, SizeWithAspect, SizeWithUnit, SizeWithUnitAndAspect, SizingMode, Sound, SwipeToZoom, TapToFocus, TextAlignment, TorchListenerEvents, TorchState, TorchSwitchControl, Vibration, VibrationType, VideoResolution, WaveFormVibration, ZoomGestureListenerEvents, ZoomListenerEvents, ZoomSwitchControl, ZoomSwitchOrientation, createNativeProxy, ensureCoreDefaults, generateIdentifier, getCoreDefaults, ignoreFromSerialization, ignoreFromSerializationIfNull, loadCoreDefaults, nameForSerialization, registerCoreProxies, registerProxies, serializationDefault, setCoreDefaultsLoader };
|
|
5438
|
+
export { AimerViewfinder, Anchor, BaseController, BaseDataCaptureView, Brush, CORE_PROXY_TYPE_NAMES, Camera, CameraController, CameraOwnershipHelper, CameraOwnershipManager, CameraPosition, CameraSettings, ClusteringMode, Color, ContextStatus, ControlImage, CoreProxyAdapter, DataCaptureContext, DataCaptureContextEvents, DataCaptureContextSettings, DataCaptureViewController, DataCaptureViewEvents, DefaultSerializeable, Direction, EventDataParser, EventEmitter, Expiration, FactoryMaker, Feedback, FocusGestureListenerEvents, FocusGestureStrategy, FocusRange, FontFamily, FrameDataController, FrameDataSettings, FrameDataSettingsBuilder, FrameSourceListenerEvents, FrameSourceState, HTMLElementState, HtmlElementPosition, HtmlElementSize, ImageBuffer, ImageFrameSource, LaserlineViewfinder, LicenseInfo, LogoStyle, MacroMode, MacroModeListenerEvents, MarginsWithUnit, MeasureUnit, NativeProxy, NoViewfinder, NoneLocationSelection, NumberWithUnit, Observable, OpenSourceSoftwareLicenseInfo, Orientation, PinchToZoom, Point, PointWithUnit, PrivateFocusGestureDeserializer, PrivateFrameData, PrivateZoomGestureDeserializer, Quadrilateral, RadiusLocationSelection, Rect, RectWithUnit, RectangularLocationSelection, RectangularViewfinder, RectangularViewfinderAnimation, RectangularViewfinderLineStyle, RectangularViewfinderStyle, SKIP, ScanIntention, ScanditIcon, ScanditIconBuilder, ScanditIconShape, ScanditIconType, SelectionMode, Size, SizeWithAspect, SizeWithUnit, SizeWithUnitAndAspect, SizingMode, Sound, SwipeToZoom, TapToFocus, TextAlignment, TorchListenerEvents, TorchState, TorchSwitchControl, Vibration, VibrationType, VideoResolution, WaveFormVibration, ZoomGestureListenerEvents, ZoomListenerEvents, ZoomSwitchControl, ZoomSwitchOrientation, createNativeProxy, ensureCoreDefaults, generateIdentifier, getCoreDefaults, ignoreFromSerialization, ignoreFromSerializationIfNull, loadCoreDefaults, nameForSerialization, registerCoreProxies, registerProxies, serializationDefault, setCoreDefaultsLoader };
|
|
5403
5439
|
//# sourceMappingURL=core.js.map
|