dynamsoft-capture-vision-react-native 1.0.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.
Files changed (31) hide show
  1. package/.gitattributes +1 -0
  2. package/LICENSE +5 -0
  3. package/Legal.txt +551 -0
  4. package/README.md +247 -0
  5. package/android/build.gradle +54 -0
  6. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  7. package/android/gradle/wrapper/gradle-wrapper.properties +6 -0
  8. package/android/src/main/AndroidManifest.xml +6 -0
  9. package/android/src/main/java/com/dynamsoft/reactlibrary/RNDCECameraView.java +90 -0
  10. package/android/src/main/java/com/dynamsoft/reactlibrary/RNDCECameraViewManager.java +156 -0
  11. package/android/src/main/java/com/dynamsoft/reactlibrary/RNDynamsoftBarcodeReaderModule.java +253 -0
  12. package/android/src/main/java/com/dynamsoft/reactlibrary/RNDynamsoftCaptrueVisionPackage.java +28 -0
  13. package/dynamsoft-capture-vision-react-native.podspec +22 -0
  14. package/ios/RNDynamsoftCaptureVision/DYSCameraView.h +26 -0
  15. package/ios/RNDynamsoftCaptureVision/DYSCameraView.m +71 -0
  16. package/ios/RNDynamsoftCaptureVision/DYSCameraViewManager.h +17 -0
  17. package/ios/RNDynamsoftCaptureVision/DYSCameraViewManager.m +77 -0
  18. package/ios/RNDynamsoftCaptureVision/RCTDynamsoftBarcodeReader.h +14 -0
  19. package/ios/RNDynamsoftCaptureVision/RCTDynamsoftBarcodeReader.m +223 -0
  20. package/ios/RNDynamsoftCaptureVision/StaticClass.h +26 -0
  21. package/ios/RNDynamsoftCaptureVision/StaticClass.m +21 -0
  22. package/ios/RNDynamsoftCaptureVision.xcodeproj/project.pbxproj +337 -0
  23. package/js/BarcodeSettings.d.ts +112 -0
  24. package/js/BarcodeSettings.js +66 -0
  25. package/js/DynamsoftBarcodeReader.d.ts +14 -0
  26. package/js/DynamsoftBarcodeReader.js +75 -0
  27. package/js/DynamsoftCameraView.d.ts +10 -0
  28. package/js/DynamsoftCameraView.js +107 -0
  29. package/js/index.d.ts +3 -0
  30. package/js/index.js +3 -0
  31. package/package.json +31 -0
@@ -0,0 +1,112 @@
1
+ export interface DBRRuntimeSettings {
2
+ barcodeFormatIds: number;
3
+ barcodeFormatIds_2: number;
4
+ expectedBarcodesCount: number;
5
+ timeout: number;
6
+ }
7
+ export interface BarcodeResult {
8
+ /**
9
+ * The barcode text.
10
+ */
11
+ barcodeText: string;
12
+
13
+ /**
14
+ * Barcode type in string.
15
+ */
16
+ barcodeFormatString: string;
17
+
18
+ /**
19
+ * The corresponding localization result.
20
+ */
21
+ barcodeLocation: BarcodeLocationResult;
22
+ }
23
+ export interface BarcodeLocationResult {
24
+ /**
25
+ * The angle of a barcode. Values range from 0 to 360.
26
+ */
27
+ angle: number;
28
+
29
+
30
+ /**
31
+ * The quadrilateral
32
+ */
33
+ quadrilateral: Quadrilateral;
34
+ }
35
+
36
+ export interface Quadrilateral {
37
+ points : Point[];
38
+ }
39
+
40
+ export interface Point {
41
+ x:number;
42
+ y:number;
43
+ }
44
+
45
+ export interface Region {
46
+ regionBottom: number;
47
+ regionRight: number;
48
+ regionLeft: number;
49
+ regionTop: number;
50
+ regionMeasuredByPercentage: number | boolean;
51
+ }
52
+
53
+ export declare enum EnumDBRPresetTemplate {
54
+ DEFAULT,
55
+ VIDEO_SINGLE_BARCODE,
56
+ VIDEO_SPEED_FIRST,
57
+ VIDEO_READ_RATE_FIRST,
58
+ IMAGE_SPEED_FIRST,
59
+ IMAGE_READ_RATE_FIRST,
60
+ IMAGE_DEFAULT
61
+ }
62
+
63
+ export declare enum EnumBarcodeFormat {
64
+ BF_ALL = 0xFE3FFFFF | 0,
65
+ BF_ONED = 0x3007FF,
66
+ BF_GS1_DATABAR = 0x3F800,
67
+ BF_CODE_39 = 0x1,
68
+ BF_CODE_128 = 0x2,
69
+ BF_CODE_93 = 0x4,
70
+ BF_CODABAR = 0x8,
71
+ BF_CODE_11 = 0x200000,
72
+ BF_ITF = 0x10,
73
+ BF_EAN_13 = 0x20,
74
+ BF_EAN_8 = 0x40,
75
+ BF_UPC_A = 0x80,
76
+ BF_UPC_E = 0x100,
77
+ BF_INDUSTRIAL_25 = 0x200,
78
+ BF_CODE_39_EXTENDED = 0x400,
79
+ BF_GS1_DATABAR_OMNIDIRECTIONAL = 0x800,
80
+ BF_GS1_DATABAR_TRUNCATED = 0x1000,
81
+ BF_GS1_DATABAR_STACKED = 0x2000,
82
+ BF_GS1_DATABAR_STACKED_OMNIDIRECTIONAL = 0x4000,
83
+ BF_GS1_DATABAR_EXPANDED = 0x8000,
84
+ BF_GS1_DATABAR_EXPANDED_STACKED = 0x10000,
85
+ BF_GS1_DATABAR_LIMITED = 0x20000,
86
+ BF_PATCHCODE = 0x40000,
87
+ BF_PDF417 = 0x2000000,
88
+ BF_QR_CODE = 0x4000000,
89
+ BF_DATAMATRIX = 0x8000000,
90
+ BF_AZTEC = 0x10000000,
91
+ BF_MAXICODE = 0x20000000,
92
+ BF_MICRO_QR = 0x40000000,
93
+ BF_MICRO_PDF417 = 0x80000,
94
+ BF_GS1_COMPOSITE = 0x80000000 | 0,
95
+ BF_MSI_CODE = 0x100000,
96
+ BF_NULL = 0x00
97
+ }
98
+
99
+ export declare enum EnumBarcodeFormat_2 {
100
+ BF2_AUSTRALIANPOST = 0x00800000,
101
+ BF2_DOTCODE = 0x02,
102
+ BF2_NONSTANDARD_BARCODE = 0x01,
103
+ BF2_NULL = 0x00,
104
+ BF2_PHARMACODE = 0x0c,
105
+ BF2_PHARMACODE_ONE_TRACK = 0x04,
106
+ BF2_PHARMACODE_TWO_TRACK = 0x08,
107
+ BF2_PLANET = 0x00400000,
108
+ BF2_POSTALCODE = 0x01F00000,
109
+ BF2_POSTNET = 0x00200000,
110
+ BF2_RM4SCC = 0x01000000,
111
+ BF2_USPSINTELLIGENTMAIL = 0x00100000
112
+ }
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+
4
+ var EnumDBRPresetTemplate;
5
+ (function (EnumDBRPresetTemplate) {
6
+ EnumDBRPresetTemplate["DEFAULT"] = 0;
7
+ EnumDBRPresetTemplate["VIDEO_SINGLE_BARCODE"] = 1;
8
+ EnumDBRPresetTemplate["VIDEO_SPEED_FIRST"] = 2;
9
+ EnumDBRPresetTemplate["VIDEO_READ_RATE_FIRST"] = 3;
10
+ EnumDBRPresetTemplate["IMAGE_SPEED_FIRST"] = 4;
11
+ EnumDBRPresetTemplate["IMAGE_READ_RATE_FIRST"] = 5;
12
+ EnumDBRPresetTemplate["IMAGE_DEFAULT"] = 6;
13
+ })(EnumDBRPresetTemplate = exports.EnumDBRPresetTemplate || (exports.EnumDBRPresetTemplate = {}));
14
+
15
+ var EnumBarcodeFormat;
16
+ (function (EnumBarcodeFormat) {
17
+ EnumBarcodeFormat["BF_ALL"] = 0xFE3FFFFF | 0;
18
+ EnumBarcodeFormat["BF_ONED"] = 0x3007FF;
19
+ EnumBarcodeFormat["BF_GS1_DATABAR"] = 0x3F800;
20
+ EnumBarcodeFormat["BF_CODE_39"] = 0x1;
21
+ EnumBarcodeFormat["BF_CODE_128"] = 0x2;
22
+ EnumBarcodeFormat["BF_CODE_93"] = 0x4;
23
+ EnumBarcodeFormat["BF_CODABAR"] = 0x8;
24
+ EnumBarcodeFormat["BF_CODE_11"] = 0x200000;
25
+ EnumBarcodeFormat["BF_ITF"] = 0x10;
26
+ EnumBarcodeFormat["BF_EAN_13"] = 0x20;
27
+ EnumBarcodeFormat["BF_EAN_8"] = 0x40;
28
+ EnumBarcodeFormat["BF_UPC_A"] = 0x80;
29
+ EnumBarcodeFormat["BF_UPC_E"] = 0x100;
30
+ EnumBarcodeFormat["BF_INDUSTRIAL_25"] = 0x200;
31
+ EnumBarcodeFormat["BF_CODE_39_EXTENDED"] = 0x400;
32
+ EnumBarcodeFormat["BF_GS1_DATABAR_OMNIDIRECTIONAL"] = 0x800;
33
+ EnumBarcodeFormat["BF_GS1_DATABAR_TRUNCATED"] = 0x1000;
34
+ EnumBarcodeFormat["BF_GS1_DATABAR_STACKED"] = 0x2000;
35
+ EnumBarcodeFormat["BF_GS1_DATABAR_STACKED_OMNIDIRECTIONAL"] = 0x4000;
36
+ EnumBarcodeFormat["BF_GS1_DATABAR_EXPANDED"] = 0x8000;
37
+ EnumBarcodeFormat["BF_GS1_DATABAR_EXPANDED_STACKED"] = 0x10000;
38
+ EnumBarcodeFormat["BF_GS1_DATABAR_LIMITED"] = 0x20000;
39
+ EnumBarcodeFormat["BF_PATCHCODE"] = 0x40000;
40
+ EnumBarcodeFormat["BF_PDF417"] = 0x2000000;
41
+ EnumBarcodeFormat["BF_QR_CODE"] = 0x4000000;
42
+ EnumBarcodeFormat["BF_DATAMATRIX"] = 0x8000000;
43
+ EnumBarcodeFormat["BF_AZTEC"] = 0x10000000;
44
+ EnumBarcodeFormat["BF_MAXICODE"] = 0x20000000;
45
+ EnumBarcodeFormat["BF_MICRO_QR"] = 0x40000000;
46
+ EnumBarcodeFormat["BF_MICRO_PDF417"] = 0x80000;
47
+ EnumBarcodeFormat["BF_GS1_COMPOSITE"] = 0x80000000 | 0;
48
+ EnumBarcodeFormat["BF_MSI_CODE"] = 0x100000;
49
+ EnumBarcodeFormat["BF_NULL"] = 0x00;
50
+ })(EnumBarcodeFormat = exports.EnumBarcodeFormat || (exports.EnumBarcodeFormat = {}));
51
+
52
+ var EnumBarcodeFormat_2;
53
+ (function (EnumBarcodeFormat_2) {
54
+ EnumBarcodeFormat_2["BF2_AUSTRALIANPOST"] = 0x00800000;
55
+ EnumBarcodeFormat_2["BF2_DOTCODE"] = 0x02;
56
+ EnumBarcodeFormat_2["BF2_NONSTANDARD_BARCODE"] = 0x01;
57
+ EnumBarcodeFormat_2["BF2_NULL"] = 0x00;
58
+ EnumBarcodeFormat_2["BF2_PHARMACODE"] = 0x0c;
59
+ EnumBarcodeFormat_2["BF2_PHARMACODE_ONE_TRACK"] = 0x04;
60
+ EnumBarcodeFormat_2["BF2_PHARMACODE_TWO_TRACK"] = 0x08;
61
+ EnumBarcodeFormat_2["BF2_PLANET"] = 0x00400000;
62
+ EnumBarcodeFormat_2["BF2_POSTALCODE"] = 0x01F00000;
63
+ EnumBarcodeFormat_2["BF2_POSTNET"] = 0x00200000;
64
+ EnumBarcodeFormat_2["BF2_RM4SCC"] = 0x01000000;
65
+ EnumBarcodeFormat_2["BF2_USPSINTELLIGENTMAIL"] = 0x00100000;
66
+ })(EnumBarcodeFormat_2 = exports.EnumBarcodeFormat_2 || (exports.EnumBarcodeFormat_2 = {}));
@@ -0,0 +1,14 @@
1
+ import {BarcodeResult, DBRRuntimeSettings, EnumDBRPresetTemplate } from "./BarcodeSettings";
2
+ export declare class DynamsoftBarcodeReader {
3
+ static initLicense(license: string): Promise<void>;
4
+ static createInstance(): Promise<DynamsoftBarcodeReader>;
5
+ getVersion(): Promise<string>;
6
+ getRuntimeSettings(): Promise<DBRRuntimeSettings>;
7
+ resetRuntimeSettings(): Promise<boolean>;
8
+ outputRuntimeSettingsToString(): Promise<string>;
9
+ updateRuntimeSettings(settings: DBRRuntimeSettings | number | EnumDBRPresetTemplate | string): Promise<boolean>;
10
+ startScanning(): Promise<void>;
11
+ stopScanning(): Promise<void>;
12
+ addResultListener(listener: (results: BarcodeResult[]) => void): void;
13
+ removeAllResultListeners(): void;
14
+ }
@@ -0,0 +1,75 @@
1
+ import PropTypes from 'prop-types'
2
+ import {
3
+ NativeEventEmitter,
4
+ NativeModules,
5
+ Platform,
6
+ } from 'react-native'
7
+ import {DBRRuntimeSettings, EnumDBRPresetTemplate} from "./BarcodeSettings"
8
+
9
+ const DBRModule = NativeModules.RNDynamsoftBarcodeReader
10
+ const DBREventEmitter = new NativeEventEmitter(DBRModule)
11
+
12
+ export class DynamsoftBarcodeReader {
13
+
14
+ static async initLicense(license) {
15
+ try {
16
+ return await DBRModule.initLicense(license)
17
+ }catch (e) {
18
+ throw (e)
19
+ }
20
+ }
21
+
22
+ static async createInstance(){
23
+ await DBRModule.createInstance()
24
+ return new DynamsoftBarcodeReader()
25
+ }
26
+
27
+ getVersion(){
28
+ return DBRModule.getVersion()
29
+ }
30
+
31
+ getRuntimeSettings() {
32
+ return DBRModule.getSettings()
33
+ }
34
+
35
+ resetRuntimeSettings(){
36
+ return DBRModule.resetSettings()
37
+ }
38
+
39
+ outputRuntimeSettingsToString(){
40
+ return DBRModule.outputSettings()
41
+ }
42
+
43
+ updateRuntimeSettings(settings){
44
+ if (typeof settings === 'object') {
45
+ return DBRModule.updateSettingsFromDictionary(settings)
46
+ } else if (typeof settings === 'number') {
47
+ return DBRModule.updateSettingsFromNumber(settings)
48
+ } else if (typeof settings === 'string') {
49
+ return DBRModule.updateSettingsFromString(settings)
50
+ }
51
+ }
52
+
53
+ startScanning(){
54
+ DBRModule.startBarcodeScanning()
55
+ }
56
+
57
+ stopScanning(){
58
+ DBRModule.stopBarcodeScanning()
59
+ }
60
+
61
+ addResultListener(listener){
62
+ if(Platform.OS === 'android') {
63
+ DBRModule.addResultListener()
64
+ }
65
+ DBREventEmitter.addListener(
66
+ 'resultEvent',
67
+ listener
68
+ );
69
+ }
70
+
71
+ removeAllResultListeners(){
72
+ DBREventEmitter.removeAllListeners('resultEvent');
73
+ }
74
+
75
+ }
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import {Region} from './BarcodeSettings'
3
+ export class DynamsoftCameraView extends React.Component {
4
+ componentDidMount(): void;
5
+ componentWillUnmount(): void;
6
+ render(): boolean;
7
+ scanRegionVisible: boolean;
8
+ overlayVisible: boolean;
9
+ scanRegion: Region;
10
+ }
@@ -0,0 +1,107 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import {
4
+ findNodeHandle,
5
+ requireNativeComponent,
6
+ View,
7
+ StyleSheet,
8
+ Platform, UIManager
9
+ } from 'react-native';
10
+
11
+ const propTypes = {
12
+ name: 'DYSCameraView',
13
+ propTypes: {
14
+ scanRegionVisible: PropTypes.bool,
15
+ overlayVisible: PropTypes.bool,
16
+ scanRegion: PropTypes.shape({
17
+ regionLeft: PropTypes.number,
18
+ regionRight: PropTypes.number,
19
+ regionTop: PropTypes.number,
20
+ regionBottom: PropTypes.number,
21
+ regionMeasuredByPercentage: PropTypes.bool
22
+ }),
23
+ ...View.propTypes
24
+ }
25
+ };
26
+
27
+ const ReactDCEView = requireNativeComponent('DYSCameraView', propTypes);
28
+
29
+ export class DynamsoftCameraView extends React.Component {
30
+
31
+ componentDidMount() {
32
+ this.dispatcher = new CommandDispatcher(findNodeHandle(this.references));
33
+ if(Platform.OS === 'ios') {
34
+ this.open()
35
+ }
36
+ }
37
+
38
+ componentWillUnmount(){
39
+ if(Platform.OS === 'ios') {
40
+ this.close()
41
+ }
42
+ }
43
+
44
+ renderChildren = () => {
45
+ return this.props.children
46
+ }
47
+
48
+ render() {
49
+ return (
50
+ <View style={this.props.style}>
51
+ <ReactDCEView
52
+ style={StyleSheet.absoluteFill}
53
+ ref={(ref) => {
54
+ this.references = ref
55
+ }}
56
+ overlayVisible={this.props.overlayVisible}
57
+ scanRegionVisible={this.props.scanRegionVisible}
58
+ scanRegion={this.props.scanRegion}
59
+ />
60
+ {this.renderChildren()}
61
+ </View>
62
+ );
63
+ }
64
+
65
+ open() {
66
+ this.dispatcher.open();
67
+ }
68
+
69
+ close() {
70
+ this.dispatcher.close();
71
+ }
72
+
73
+ }
74
+
75
+ class CommandDispatcher {
76
+ dceViewHandle;
77
+
78
+ constructor(viewHandle) {
79
+ //console.log(viewHandle)
80
+ this.dceViewHandle = viewHandle;
81
+ }
82
+
83
+ getViewManagerConfig(viewManagerConfig) {
84
+ if (UIManager.getViewManagerConfig) {
85
+ return UIManager.getViewManagerConfig(viewManagerConfig);
86
+ } else {
87
+ return UIManager[viewManagerConfig];
88
+ }
89
+ }
90
+
91
+ open() {
92
+ UIManager.dispatchViewManagerCommand(
93
+ this.dceViewHandle,
94
+ this.getViewManagerConfig('DYSCameraView').Commands.open,
95
+ null);
96
+ }
97
+
98
+ close() {
99
+ UIManager.dispatchViewManagerCommand(
100
+ this.dceViewHandle,
101
+ this.getViewManagerConfig('DYSCameraView').Commands.close,
102
+ null);
103
+ }
104
+
105
+ }
106
+
107
+
package/js/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from './BarcodeSettings';
2
+ export * from './DynamsoftBarcodeReader';
3
+ export * from './DynamsoftCameraView';
package/js/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from './BarcodeSettings';
2
+ export * from './DynamsoftBarcodeReader';
3
+ export * from './DynamsoftCameraView';
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "dynamsoft-capture-vision-react-native",
3
+ "version": "1.0.0",
4
+ "description": "Dynamsoft Capture Vision React Native SDK",
5
+ "homepage": "https://www.dynamsoft.com/capture-vision/docs/introduction",
6
+ "main": "./js/index.js",
7
+ "types": "./js/index.d.ts",
8
+ "license": "SEE LICENSE",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/dynamsoft/capture-vision-react-native.git"
12
+ },
13
+ "scripts": {
14
+ "android": "react-native run-android",
15
+ "ios": "react-native run-ios"
16
+ },
17
+ "keywords": [
18
+ "react-native",
19
+ "barcode",
20
+ "PDF417",
21
+ "QRCode",
22
+ "DataMatrix",
23
+ "Linear barcode",
24
+ "1D barcode"
25
+ ],
26
+ "author": {
27
+ "name": "Dynamsoft",
28
+ "url": "https://www.dynamsoft.com",
29
+ "email": "support@dynamsoft.com"
30
+ }
31
+ }