@regulaforensics/cordova-plugin-document-reader-api 6.9.0 → 7.1.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/README.md +10 -40
- package/example/README.md +32 -0
- package/example/config.xml +5 -1
- package/example/package.json +7 -10
- package/example/www/js/index.js +85 -160
- package/package.json +1 -1
- package/plugin.xml +8 -8
- package/src/android/BluetoothUtil.kt +78 -74
- package/src/android/Config.kt +690 -0
- package/src/android/DocumentReader.kt +525 -0
- package/src/android/JSONConstructor.kt +2187 -0
- package/src/android/Utils.kt +256 -0
- package/src/android/build.gradle +3 -3
- package/src/ios/RGLWConfig.h +48 -0
- package/src/ios/RGLWConfig.m +1325 -0
- package/src/ios/RGLWDocumentReader.h +11 -8
- package/src/ios/RGLWDocumentReader.m +388 -576
- package/src/ios/RGLWJSONConstructor.h +173 -69
- package/src/ios/RGLWJSONConstructor.m +1817 -762
- package/www/DocumentReader.js +241 -116
- package/src/android/DocumentReader.java +0 -1118
- package/src/android/Helpers.java +0 -259
- package/src/android/JSONConstructor.java +0 -1119
- package/src/android/RegulaConfig.java +0 -830
- package/src/ios/RGLWRegulaConfig.h +0 -26
- package/src/ios/RGLWRegulaConfig.m +0 -1152
|
@@ -1,830 +0,0 @@
|
|
|
1
|
-
package cordova.plugin.documentreader;
|
|
2
|
-
|
|
3
|
-
import static cordova.plugin.documentreader.Helpers.*;
|
|
4
|
-
import static cordova.plugin.documentreader.JSONConstructor.*;
|
|
5
|
-
|
|
6
|
-
import android.annotation.SuppressLint;
|
|
7
|
-
import android.content.Context;
|
|
8
|
-
import android.graphics.Paint;
|
|
9
|
-
import android.graphics.Typeface;
|
|
10
|
-
import android.text.SpannableString;
|
|
11
|
-
import android.widget.ImageView.ScaleType;
|
|
12
|
-
|
|
13
|
-
import com.regula.documentreader.api.DocumentReader;
|
|
14
|
-
import com.regula.documentreader.api.params.*;
|
|
15
|
-
import com.regula.documentreader.api.params.rfid.RFIDParams;
|
|
16
|
-
import com.regula.documentreader.api.params.rfid.ReprocParams;
|
|
17
|
-
import com.regula.documentreader.api.params.rfid.dg.DataGroups;
|
|
18
|
-
|
|
19
|
-
import org.json.JSONArray;
|
|
20
|
-
import org.json.JSONException;
|
|
21
|
-
import org.json.JSONObject;
|
|
22
|
-
|
|
23
|
-
import java.math.BigDecimal;
|
|
24
|
-
|
|
25
|
-
@SuppressWarnings("deprecation")
|
|
26
|
-
class RegulaConfig {
|
|
27
|
-
static void setConfig(DocumentReader reader, JSONObject opts, Context context) throws JSONException {
|
|
28
|
-
if (opts.has("customization"))
|
|
29
|
-
setCustomization(reader.customization(), opts.getJSONObject("customization"), context);
|
|
30
|
-
if (opts.has("functionality"))
|
|
31
|
-
setFunctionality(reader.functionality(), opts.getJSONObject("functionality"));
|
|
32
|
-
if (opts.has("processParams"))
|
|
33
|
-
setProcessParams(reader.processParams(), opts.getJSONObject("processParams"));
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
static JSONObject getConfig(DocumentReader reader) throws JSONException {
|
|
37
|
-
JSONObject object = new JSONObject();
|
|
38
|
-
object.put("customization", getCustomization(reader.customization()));
|
|
39
|
-
object.put("functionality", getFunctionality(reader.functionality()));
|
|
40
|
-
object.put("processParams", getProcessParams(reader.processParams()));
|
|
41
|
-
|
|
42
|
-
return object;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
@SuppressLint("MissingPermission")
|
|
46
|
-
private static void setFunctionality(Functionality functionality, JSONObject opts) throws JSONException {
|
|
47
|
-
Functionality.FunctionalityEditor editor = functionality.edit();
|
|
48
|
-
if (opts.has("pictureOnBoundsReady"))
|
|
49
|
-
editor.setPictureOnBoundsReady(opts.getBoolean("pictureOnBoundsReady"));
|
|
50
|
-
if (opts.has("showTorchButton"))
|
|
51
|
-
editor.setShowTorchButton(opts.getBoolean("showTorchButton"));
|
|
52
|
-
if (opts.has("showCloseButton"))
|
|
53
|
-
editor.setShowCloseButton(opts.getBoolean("showCloseButton"));
|
|
54
|
-
if (opts.has("videoCaptureMotionControl"))
|
|
55
|
-
editor.setVideoCaptureMotionControl(opts.getBoolean("videoCaptureMotionControl"));
|
|
56
|
-
if (opts.has("showCaptureButton"))
|
|
57
|
-
editor.setShowCaptureButton(opts.getBoolean("showCaptureButton"));
|
|
58
|
-
if (opts.has("showChangeFrameButton"))
|
|
59
|
-
editor.setShowChangeFrameButton(opts.getBoolean("showChangeFrameButton"));
|
|
60
|
-
if (opts.has("showCaptureButtonDelayFromDetect"))
|
|
61
|
-
editor.setShowCaptureButtonDelayFromDetect(opts.getInt("showCaptureButtonDelayFromDetect"));
|
|
62
|
-
if (opts.has("showCaptureButtonDelayFromStart"))
|
|
63
|
-
editor.setShowCaptureButtonDelayFromStart(opts.getInt("showCaptureButtonDelayFromStart"));
|
|
64
|
-
if (opts.has("databaseAutoupdate"))
|
|
65
|
-
editor.setDatabaseAutoupdate(opts.getBoolean("databaseAutoupdate"));
|
|
66
|
-
if (opts.has("showSkipNextPageButton"))
|
|
67
|
-
editor.setShowSkipNextPageButton(opts.getBoolean("showSkipNextPageButton"));
|
|
68
|
-
if (opts.has("useAuthenticator"))
|
|
69
|
-
editor.setUseAuthenticator(opts.getBoolean("useAuthenticator"));
|
|
70
|
-
if (opts.has("skipFocusingFrames"))
|
|
71
|
-
editor.setSkipFocusingFrames(opts.getBoolean("skipFocusingFrames"));
|
|
72
|
-
if (opts.has("showCameraSwitchButton"))
|
|
73
|
-
editor.setShowCameraSwitchButton(opts.getBoolean("showCameraSwitchButton"));
|
|
74
|
-
if (opts.has("cameraFrame"))
|
|
75
|
-
editor.setCameraFrame(opts.getString("cameraFrame"));
|
|
76
|
-
if (opts.has("btDeviceName"))
|
|
77
|
-
editor.setBtDeviceName(opts.getString("btDeviceName"));
|
|
78
|
-
if (opts.has("orientation"))
|
|
79
|
-
editor.setOrientation(opts.getInt("orientation"));
|
|
80
|
-
if (opts.has("startDocReaderForResult"))
|
|
81
|
-
editor.setStartDocReaderForResult(opts.getBoolean("startDocReaderForResult"));
|
|
82
|
-
if (opts.has("captureMode"))
|
|
83
|
-
editor.setCaptureMode(opts.getInt("captureMode"));
|
|
84
|
-
if (opts.has("displayMetadata"))
|
|
85
|
-
editor.setDisplayMetadata(opts.getBoolean("displayMetadata"));
|
|
86
|
-
if (opts.has("cameraSize"))
|
|
87
|
-
editor.setCameraSize(opts.getJSONObject("cameraSize").getInt("width"), opts.getJSONObject("cameraSize").getInt("height"));
|
|
88
|
-
if (opts.has("cameraMode"))
|
|
89
|
-
editor.setCameraMode(opts.getInt("cameraMode"));
|
|
90
|
-
if (opts.has("excludedCamera2Models"))
|
|
91
|
-
editor.setExcludedCamera2Models(stringListFromJson(opts.getJSONArray("excludedCamera2Models")));
|
|
92
|
-
if (opts.has("isZoomEnabled"))
|
|
93
|
-
editor.setZoomEnabled(opts.getBoolean("isZoomEnabled"));
|
|
94
|
-
if (opts.has("zoomFactor"))
|
|
95
|
-
editor.setZoomFactor(BigDecimal.valueOf(opts.getDouble("zoomFactor")).floatValue());
|
|
96
|
-
if (opts.has("isCameraTorchCheckDisabled"))
|
|
97
|
-
editor.setIsCameraTorchCheckDisabled(opts.getBoolean("isCameraTorchCheckDisabled"));
|
|
98
|
-
if (opts.has("recordScanningProcess"))
|
|
99
|
-
editor.setDoRecordProcessingVideo(opts.getBoolean("recordScanningProcess"));
|
|
100
|
-
if (opts.has("manualMultipageMode"))
|
|
101
|
-
editor.setManualMultipageMode(opts.getBoolean("manualMultipageMode"));
|
|
102
|
-
if (opts.has("exposure"))
|
|
103
|
-
editor.setExposure(BigDecimal.valueOf(opts.getDouble("exposure")).floatValue());
|
|
104
|
-
if (opts.has("rfidTimeout"))
|
|
105
|
-
editor.setRfidTimeout(opts.getInt("rfidTimeout"));
|
|
106
|
-
if (opts.has("onlineProcessingConfiguration"))
|
|
107
|
-
editor.setOnlineProcessingConfiguration(OnlineProcessingConfigFromJSON(opts.getJSONObject("onlineProcessingConfiguration")));
|
|
108
|
-
|
|
109
|
-
editor.apply();
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
private static void setProcessParams(ProcessParam processParams, JSONObject opts) throws JSONException {
|
|
113
|
-
if (opts.has("multipageProcessing"))
|
|
114
|
-
processParams.multipageProcessing = opts.getBoolean("multipageProcessing");
|
|
115
|
-
if (opts.has("dateFormat"))
|
|
116
|
-
processParams.dateFormat = opts.getString("dateFormat");
|
|
117
|
-
if (opts.has("logs"))
|
|
118
|
-
processParams.setLogs(opts.getBoolean("logs"));
|
|
119
|
-
if (opts.has("debugSaveImages"))
|
|
120
|
-
processParams.debugSaveImages = opts.getBoolean("debugSaveImages");
|
|
121
|
-
if (opts.has("debugSaveLogs"))
|
|
122
|
-
processParams.debugSaveLogs = opts.getBoolean("debugSaveLogs");
|
|
123
|
-
if (opts.has("returnUncroppedImage"))
|
|
124
|
-
processParams.returnUncroppedImage = opts.getBoolean("returnUncroppedImage");
|
|
125
|
-
if (opts.has("customParams"))
|
|
126
|
-
processParams.customParams = opts.getJSONObject("customParams");
|
|
127
|
-
if (opts.has("uvTorchEnabled"))
|
|
128
|
-
processParams.uvTorchEnabled = opts.getBoolean("uvTorchEnabled");
|
|
129
|
-
if (opts.has("debugSaveCroppedImages"))
|
|
130
|
-
processParams.debugSaveCroppedImages = opts.getBoolean("debugSaveCroppedImages");
|
|
131
|
-
if (opts.has("scenario"))
|
|
132
|
-
processParams.scenario = opts.getString("scenario");
|
|
133
|
-
if (opts.has("measureSystem"))
|
|
134
|
-
processParams.measureSystem = opts.getInt("measureSystem");
|
|
135
|
-
if (opts.has("captureButtonScenario"))
|
|
136
|
-
processParams.captureButtonScenario = opts.getString("captureButtonScenario");
|
|
137
|
-
if (opts.has("disableFocusingCheck"))
|
|
138
|
-
processParams.disableFocusingCheck = opts.getBoolean("disableFocusingCheck");
|
|
139
|
-
if (opts.has("debugSaveRFIDSession"))
|
|
140
|
-
processParams.debugSaveRFIDSession = opts.getBoolean("debugSaveRFIDSession");
|
|
141
|
-
if (opts.has("doublePageSpread"))
|
|
142
|
-
processParams.doublePageSpread = opts.getBoolean("doublePageSpread");
|
|
143
|
-
if (opts.has("barcodeParserType"))
|
|
144
|
-
processParams.barcodeParserType = opts.getInt("barcodeParserType");
|
|
145
|
-
if (opts.has("documentIDList"))
|
|
146
|
-
processParams.documentIDList = intArrayFromJson(opts.getJSONArray("documentIDList"));
|
|
147
|
-
if (opts.has("fieldTypesFilter"))
|
|
148
|
-
processParams.fieldTypesFilter = intArrayFromJson(opts.getJSONArray("fieldTypesFilter"));
|
|
149
|
-
if (opts.has("barcodeTypes"))
|
|
150
|
-
processParams.doBarcodes = barcodeTypeArrayFromJson(opts.getJSONArray("barcodeTypes"));
|
|
151
|
-
if (opts.has("faceMetaData"))
|
|
152
|
-
processParams.faceMetaData = faceMetaDataArrayFromJson(opts.getJSONArray("faceMetaData"));
|
|
153
|
-
if (opts.has("timeout"))
|
|
154
|
-
processParams.timeout = opts.getDouble("timeout");
|
|
155
|
-
if (opts.has("timeoutFromFirstDetect"))
|
|
156
|
-
processParams.timeoutFromFirstDetect = opts.getDouble("timeoutFromFirstDetect");
|
|
157
|
-
if (opts.has("timeoutFromFirstDocType"))
|
|
158
|
-
processParams.timeoutFromFirstDocType = opts.getDouble("timeoutFromFirstDocType");
|
|
159
|
-
if (opts.has("manualCrop"))
|
|
160
|
-
processParams.manualCrop = opts.getBoolean("manualCrop");
|
|
161
|
-
if (opts.has("perspectiveAngle"))
|
|
162
|
-
processParams.perspectiveAngle = opts.getInt("perspectiveAngle");
|
|
163
|
-
if (opts.has("integralImage"))
|
|
164
|
-
processParams.integralImage = opts.getBoolean("integralImage");
|
|
165
|
-
if (opts.has("minDPI"))
|
|
166
|
-
processParams.minDPI = opts.getInt("minDPI");
|
|
167
|
-
if (opts.has("returnCroppedBarcode"))
|
|
168
|
-
processParams.returnCroppedBarcode = opts.getBoolean("returnCroppedBarcode");
|
|
169
|
-
if (opts.has("checkHologram"))
|
|
170
|
-
processParams.checkHologram = opts.getBoolean("checkHologram");
|
|
171
|
-
if (opts.has("checkRequiredTextFields"))
|
|
172
|
-
processParams.checkRequiredTextFields = opts.getBoolean("checkRequiredTextFields");
|
|
173
|
-
if (opts.has("depersonalizeLog"))
|
|
174
|
-
processParams.depersonalizeLog = opts.getBoolean("depersonalizeLog");
|
|
175
|
-
if (opts.has("resultTypeOutput"))
|
|
176
|
-
processParams.resultTypeOutput = intArrayFromJson(opts.getJSONArray("resultTypeOutput"));
|
|
177
|
-
if (opts.has("generateDoublePageSpreadImage"))
|
|
178
|
-
processParams.generateDoublePageSpreadImage = opts.getBoolean("generateDoublePageSpreadImage");
|
|
179
|
-
if (opts.has("imageDpiOutMax"))
|
|
180
|
-
processParams.imageDpiOutMax = opts.getInt("imageDpiOutMax");
|
|
181
|
-
if (opts.has("alreadyCropped"))
|
|
182
|
-
processParams.alreadyCropped = opts.getBoolean("alreadyCropped");
|
|
183
|
-
if (opts.has("forceDocID"))
|
|
184
|
-
processParams.forceDocID = opts.getInt("forceDocID");
|
|
185
|
-
if (opts.has("matchTextFieldMask"))
|
|
186
|
-
processParams.matchTextFieldMask = opts.getBoolean("matchTextFieldMask");
|
|
187
|
-
if (opts.has("fastDocDetect"))
|
|
188
|
-
processParams.fastDocDetect = opts.getBoolean("fastDocDetect");
|
|
189
|
-
if (opts.has("updateOCRValidityByGlare"))
|
|
190
|
-
processParams.updateOCRValidityByGlare = opts.getBoolean("updateOCRValidityByGlare");
|
|
191
|
-
if (opts.has("imageQA"))
|
|
192
|
-
processParams.imageQA = ImageQAFromJSON(opts.getJSONObject("imageQA"));
|
|
193
|
-
if (opts.has("forceDocFormat"))
|
|
194
|
-
processParams.forceDocFormat = opts.getInt("forceDocFormat");
|
|
195
|
-
if (opts.has("noGraphics"))
|
|
196
|
-
processParams.noGraphics = opts.getBoolean("noGraphics");
|
|
197
|
-
if (opts.has("documentAreaMin"))
|
|
198
|
-
processParams.documentAreaMin = opts.getDouble("documentAreaMin");
|
|
199
|
-
if (opts.has("multiDocOnImage"))
|
|
200
|
-
processParams.multiDocOnImage = opts.getBoolean("multiDocOnImage");
|
|
201
|
-
if (opts.has("shiftExpiryDate"))
|
|
202
|
-
processParams.shiftExpiryDate = opts.getInt("shiftExpiryDate");
|
|
203
|
-
if (opts.has("minimalHolderAge"))
|
|
204
|
-
processParams.minimalHolderAge = opts.getInt("minimalHolderAge");
|
|
205
|
-
if (opts.has("mrzFormatsFilter"))
|
|
206
|
-
processParams.mrzFormatsFilter = stringArrayFromJson(opts.getJSONArray("mrzFormatsFilter"));
|
|
207
|
-
if (opts.has("forceReadMrzBeforeLocate"))
|
|
208
|
-
processParams.forceReadMrzBeforeLocate = opts.getBoolean("forceReadMrzBeforeLocate");
|
|
209
|
-
if (opts.has("parseBarcodes"))
|
|
210
|
-
processParams.parseBarcodes = opts.getBoolean("parseBarcodes");
|
|
211
|
-
if (opts.has("shouldReturnPackageForReprocess"))
|
|
212
|
-
processParams.shouldReturnPackageForReprocess = opts.getBoolean("shouldReturnPackageForReprocess");
|
|
213
|
-
if (opts.has("imageOutputMaxHeight"))
|
|
214
|
-
processParams.imageOutputMaxHeight = opts.getInt("imageOutputMaxHeight");
|
|
215
|
-
if (opts.has("imageOutputMaxWidth"))
|
|
216
|
-
processParams.imageOutputMaxWidth = opts.getInt("imageOutputMaxWidth");
|
|
217
|
-
if (opts.has("disablePerforationOCR"))
|
|
218
|
-
processParams.disablePerforationOCR = opts.getBoolean("disablePerforationOCR");
|
|
219
|
-
if (opts.has("documentGroupFilter"))
|
|
220
|
-
processParams.documentGroupFilter = intArrayFromJson(opts.getJSONArray("documentGroupFilter"));
|
|
221
|
-
if (opts.has("respectImageQuality"))
|
|
222
|
-
processParams.respectImageQuality = opts.getBoolean("respectImageQuality");
|
|
223
|
-
if (opts.has("splitNames"))
|
|
224
|
-
processParams.splitNames = opts.getBoolean("splitNames");
|
|
225
|
-
if (opts.has("convertCase"))
|
|
226
|
-
processParams.convertCase = opts.getInt("convertCase");
|
|
227
|
-
if (opts.has("doFlipYAxis"))
|
|
228
|
-
processParams.doFlipYAxis = opts.getBoolean("doFlipYAxis");
|
|
229
|
-
if (opts.has("rfidParams"))
|
|
230
|
-
processParams.rfidParams = RFIDParamsFromJSON(opts.getJSONObject("rfidParams"));
|
|
231
|
-
if (opts.has("doDetectCan"))
|
|
232
|
-
processParams.doDetectCan = opts.getBoolean("doDetectCan");
|
|
233
|
-
if (opts.has("faceApiParams"))
|
|
234
|
-
processParams.faceApiParams = FaceApiParamsFromJSON(opts.getJSONObject("faceApiParams"));
|
|
235
|
-
if (opts.has("useFaceApi"))
|
|
236
|
-
processParams.useFaceApi = opts.getBoolean("useFaceApi");
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
private static void setCustomization(ParamsCustomization customization, JSONObject opts, Context context) throws JSONException {
|
|
240
|
-
ParamsCustomization.CustomizationEditor editor = customization.edit();
|
|
241
|
-
if (opts.has("status"))
|
|
242
|
-
editor.setStatus(opts.getString("status"));
|
|
243
|
-
if (opts.has("resultStatus"))
|
|
244
|
-
editor.setResultStatus(opts.getString("resultStatus"));
|
|
245
|
-
if (opts.has("cameraFrameDefaultColor"))
|
|
246
|
-
editor.setCameraFrameDefaultColor(opts.getString("cameraFrameDefaultColor"));
|
|
247
|
-
if (opts.has("cameraFrameActiveColor"))
|
|
248
|
-
editor.setCameraFrameActiveColor(opts.getString("cameraFrameActiveColor"));
|
|
249
|
-
if (opts.has("statusTextColor"))
|
|
250
|
-
editor.setStatusTextColor(opts.getString("statusTextColor"));
|
|
251
|
-
if (opts.has("resultStatusTextColor"))
|
|
252
|
-
editor.setResultStatusTextColor(opts.getString("resultStatusTextColor"));
|
|
253
|
-
if (opts.has("resultStatusBackgroundColor"))
|
|
254
|
-
editor.setResultStatusBackgroundColor(opts.getString("resultStatusBackgroundColor"));
|
|
255
|
-
if (opts.has("multipageButtonBackgroundColor"))
|
|
256
|
-
editor.setMultipageButtonBackgroundColor(opts.getString("multipageButtonBackgroundColor"));
|
|
257
|
-
if (opts.has("tintColor"))
|
|
258
|
-
editor.setTintColor(opts.getString("tintColor"));
|
|
259
|
-
if (opts.has("cameraPreviewBackgroundColor"))
|
|
260
|
-
editor.setCameraPreviewBackgroundColor(opts.getString("cameraPreviewBackgroundColor"));
|
|
261
|
-
if (opts.has("activityIndicatorColor"))
|
|
262
|
-
editor.setActivityIndicatorColor(opts.getString("activityIndicatorColor"));
|
|
263
|
-
if (opts.has("showStatusMessages"))
|
|
264
|
-
editor.setShowStatusMessages(opts.getBoolean("showStatusMessages"));
|
|
265
|
-
if (opts.has("showResultStatusMessages"))
|
|
266
|
-
editor.setShowResultStatusMessages(opts.getBoolean("showResultStatusMessages"));
|
|
267
|
-
if (opts.has("showHelpAnimation"))
|
|
268
|
-
editor.setShowHelpAnimation(opts.getBoolean("showHelpAnimation"));
|
|
269
|
-
if (opts.has("showNextPageAnimation"))
|
|
270
|
-
editor.setShowNextPageAnimation(opts.getBoolean("showNextPageAnimation"));
|
|
271
|
-
if (opts.has("showBackgroundMask"))
|
|
272
|
-
editor.setShowBackgroundMask(opts.getBoolean("showBackgroundMask"));
|
|
273
|
-
if (opts.has("cameraFrameBorderWidth"))
|
|
274
|
-
editor.setCameraFrameBorderWidth(opts.getInt("cameraFrameBorderWidth"));
|
|
275
|
-
if (opts.has("statusTextSize"))
|
|
276
|
-
editor.setStatusTextSize(opts.getInt("statusTextSize"));
|
|
277
|
-
if (opts.has("cameraFrameLineLength"))
|
|
278
|
-
editor.setCameraFrameLineLength(opts.getInt("cameraFrameLineLength"));
|
|
279
|
-
if (opts.has("cameraFrameShapeType"))
|
|
280
|
-
editor.setCameraFrameShapeType(opts.getInt("cameraFrameShapeType"));
|
|
281
|
-
if (opts.has("resultStatusTextSize"))
|
|
282
|
-
editor.setResultStatusTextSize(opts.getInt("resultStatusTextSize"));
|
|
283
|
-
if (opts.has("cameraFrameOffsetWidth"))
|
|
284
|
-
editor.setCameraFrameOffsetWidth(opts.getInt("cameraFrameOffsetWidth"));
|
|
285
|
-
if (opts.has("customLabelStatus"))
|
|
286
|
-
editor.setCustomLabelStatus(new SpannableString(opts.getString("customLabelStatus")));
|
|
287
|
-
if (opts.has("multipageAnimationFrontImage"))
|
|
288
|
-
editor.setMultipageAnimationFrontImage(drawableFromBase64(opts.getString("multipageAnimationFrontImage"), context));
|
|
289
|
-
if (opts.has("multipageAnimationBackImage"))
|
|
290
|
-
editor.setMultipageAnimationBackImage(drawableFromBase64(opts.getString("multipageAnimationBackImage"), context));
|
|
291
|
-
if (opts.has("borderBackgroundImage"))
|
|
292
|
-
editor.setBorderBackgroundImage(drawableFromBase64(opts.getString("borderBackgroundImage"), context));
|
|
293
|
-
if (opts.has("helpAnimationImage"))
|
|
294
|
-
editor.setHelpAnimationImage(drawableFromBase64(opts.getString("helpAnimationImage"), context));
|
|
295
|
-
if (opts.has("statusPositionMultiplier"))
|
|
296
|
-
editor.setStatusPositionMultiplier(BigDecimal.valueOf(opts.getDouble("statusPositionMultiplier")).floatValue());
|
|
297
|
-
if (opts.has("resultStatusPositionMultiplier"))
|
|
298
|
-
editor.setResultStatusPositionMultiplier(BigDecimal.valueOf(opts.getDouble("resultStatusPositionMultiplier")).floatValue());
|
|
299
|
-
if (opts.has("backgroundMaskAlpha"))
|
|
300
|
-
editor.setBackgroundMaskAlpha((float) opts.getDouble("backgroundMaskAlpha"));
|
|
301
|
-
if (opts.has("statusTextFont"))
|
|
302
|
-
editor.setStatusTextFont(Typeface.create(opts.getString("statusTextFont"), opts.has("statusTextFontStyle") ? opts.getInt("statusTextFontStyle") : Typeface.NORMAL));
|
|
303
|
-
if (opts.has("resultStatusTextFont"))
|
|
304
|
-
editor.setResultStatusTextFont(Typeface.create(opts.getString("resultStatusTextFont"), opts.has("resultStatusTextFontStyle") ? opts.getInt("resultStatusTextFontStyle") : Typeface.NORMAL));
|
|
305
|
-
if (opts.has("helpAnimationImageScaleType"))
|
|
306
|
-
editor.setHelpAnimationImageScaleType(ScaleType.valueOf(opts.getString("helpAnimationImageScaleType")));
|
|
307
|
-
if (opts.has("multipageAnimationFrontImageScaleType"))
|
|
308
|
-
editor.setMultipageAnimationFrontImageScaleType(ScaleType.valueOf(opts.getString("multipageAnimationFrontImageScaleType")));
|
|
309
|
-
if (opts.has("multipageAnimationBackImageScaleType"))
|
|
310
|
-
editor.setMultipageAnimationBackImageScaleType(ScaleType.valueOf(opts.getString("multipageAnimationBackImageScaleType")));
|
|
311
|
-
if (opts.has("borderBackgroundImageScaleType"))
|
|
312
|
-
editor.setBorderBackgroundImageScaleType(ScaleType.valueOf(opts.getString("borderBackgroundImageScaleType")));
|
|
313
|
-
if (opts.has("helpAnimationImageMatrix"))
|
|
314
|
-
editor.setHelpAnimationImageMatrix(matrixFromFloatArray(floatArrayFromJson(opts.getJSONArray("helpAnimationImageMatrix"))));
|
|
315
|
-
if (opts.has("multipageAnimationFrontImageMatrix"))
|
|
316
|
-
editor.setMultipageAnimationFrontImageMatrix(matrixFromFloatArray(floatArrayFromJson(opts.getJSONArray("multipageAnimationFrontImageMatrix"))));
|
|
317
|
-
if (opts.has("multipageAnimationBackImageMatrix"))
|
|
318
|
-
editor.setMultipageAnimationBackImageMatrix(matrixFromFloatArray(floatArrayFromJson(opts.getJSONArray("multipageAnimationBackImageMatrix"))));
|
|
319
|
-
if (opts.has("borderBackgroundImageMatrix"))
|
|
320
|
-
editor.setBorderBackgroundImageMatrix(matrixFromFloatArray(floatArrayFromJson(opts.getJSONArray("borderBackgroundImageMatrix"))));
|
|
321
|
-
if (opts.has("customStatusPositionMultiplier"))
|
|
322
|
-
editor.setCustomStatusPositionMultiplier((float) opts.getDouble("customStatusPositionMultiplier"));
|
|
323
|
-
if (opts.has("cameraFrameVerticalPositionMultiplier"))
|
|
324
|
-
editor.setCameraFrameVerticalPositionMultiplier((float) opts.getDouble("cameraFrameVerticalPositionMultiplier"));
|
|
325
|
-
if (opts.has("cameraFrameLandscapeAspectRatio"))
|
|
326
|
-
editor.setCameraFrameLandscapeAspectRatio((float) opts.getDouble("cameraFrameLandscapeAspectRatio"));
|
|
327
|
-
if (opts.has("cameraFramePortraitAspectRatio"))
|
|
328
|
-
editor.setCameraFramePortraitAspectRatio((float) opts.getDouble("cameraFramePortraitAspectRatio"));
|
|
329
|
-
if (opts.has("cameraFrameCornerRadius"))
|
|
330
|
-
editor.setCameraFrameCornerRadius((float) opts.getDouble("cameraFrameCornerRadius"));
|
|
331
|
-
if (opts.has("cameraFrameLineCap"))
|
|
332
|
-
editor.setCameraFrameLineCap(Paint.Cap.values()[(opts.getInt("cameraFrameLineCap"))]);
|
|
333
|
-
if (opts.has("closeButtonImage"))
|
|
334
|
-
editor.setCloseButtonImage(drawableFromBase64(opts.getString("closeButtonImage"), context));
|
|
335
|
-
if (opts.has("captureButtonImage"))
|
|
336
|
-
editor.setCaptureButtonImage(drawableFromBase64(opts.getString("captureButtonImage"), context));
|
|
337
|
-
if (opts.has("changeFrameCollapseButtonImage"))
|
|
338
|
-
editor.setChangeFrameCollapseButtonImage(drawableFromBase64(opts.getString("changeFrameCollapseButtonImage"), context));
|
|
339
|
-
if (opts.has("changeFrameExpandButtonImage"))
|
|
340
|
-
editor.setChangeFrameExpandButtonImage(drawableFromBase64(opts.getString("changeFrameExpandButtonImage"), context));
|
|
341
|
-
if (opts.has("cameraSwitchButtonImage"))
|
|
342
|
-
editor.setCameraSwitchButtonImage(drawableFromBase64(opts.getString("cameraSwitchButtonImage"), context));
|
|
343
|
-
if (opts.has("torchButtonOnImage"))
|
|
344
|
-
editor.setTorchImageOn(drawableFromBase64(opts.getString("torchButtonOnImage"), context));
|
|
345
|
-
if (opts.has("torchButtonOffImage"))
|
|
346
|
-
editor.setTorchImageOff(drawableFromBase64(opts.getString("torchButtonOffImage"), context));
|
|
347
|
-
if (opts.has("changeFrameButtonExpandImage"))
|
|
348
|
-
editor.setChangeFrameExpandButtonImage(drawableFromBase64(opts.getString("changeFrameButtonExpandImage"), context));
|
|
349
|
-
if (opts.has("changeFrameButtonCollapseImage"))
|
|
350
|
-
editor.setChangeFrameCollapseButtonImage(drawableFromBase64(opts.getString("changeFrameButtonCollapseImage"), context));
|
|
351
|
-
if (opts.has("toolbarSize"))
|
|
352
|
-
editor.setToolbarSize(BigDecimal.valueOf(opts.getDouble("toolbarSize")).floatValue());
|
|
353
|
-
if (opts.has("statusBackgroundColor"))
|
|
354
|
-
editor.setStatusBackgroundColor(opts.getString("statusBackgroundColor"));
|
|
355
|
-
if (opts.has("hologramAnimationImage"))
|
|
356
|
-
editor.setHologramAnimationImage(drawableFromBase64(opts.getString("hologramAnimationImage"), context));
|
|
357
|
-
if (opts.has("hologramAnimationPositionMultiplier"))
|
|
358
|
-
editor.setHologramAnimationPositionMultiplier((float) opts.getDouble("hologramAnimationPositionMultiplier"));
|
|
359
|
-
if (opts.has("hologramAnimationImageMatrix"))
|
|
360
|
-
editor.setHologramAnimationImageMatrix(matrixFromFloatArray(floatArrayFromJson(opts.getJSONArray("hologramAnimationImageMatrix"))));
|
|
361
|
-
if (opts.has("hologramAnimationImageScaleType"))
|
|
362
|
-
editor.setHologramAnimationImageScaleType(ScaleType.valueOf(opts.getString("hologramAnimationImageScaleType")));
|
|
363
|
-
if (opts.has("uiCustomizationLayer"))
|
|
364
|
-
editor.setUiCustomizationLayer(opts.getJSONObject("uiCustomizationLayer"));
|
|
365
|
-
if (opts.has("activityIndicatorSize"))
|
|
366
|
-
editor.setActivityIndicatorSize(opts.getInt("activityIndicatorSize"));
|
|
367
|
-
|
|
368
|
-
editor.applyImmediately(context);
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
private static JSONObject getFunctionality(Functionality functionality) throws JSONException {
|
|
372
|
-
JSONObject object = new JSONObject();
|
|
373
|
-
object.put("pictureOnBoundsReady", functionality.isPictureOnBoundsReady());
|
|
374
|
-
object.put("showTorchButton", functionality.isShowTorchButton());
|
|
375
|
-
object.put("showCloseButton", functionality.isShowCloseButton());
|
|
376
|
-
object.put("videoCaptureMotionControl", functionality.isVideoCaptureMotionControl());
|
|
377
|
-
object.put("showCaptureButton", functionality.isShowCaptureButton());
|
|
378
|
-
object.put("showChangeFrameButton", functionality.isShowChangeFrameButton());
|
|
379
|
-
object.put("showCaptureButtonDelayFromDetect", functionality.getShowCaptureButtonDelayFromDetect());
|
|
380
|
-
object.put("showCaptureButtonDelayFromStart", functionality.getShowCaptureButtonDelayFromStart());
|
|
381
|
-
object.put("databaseAutoupdate", functionality.isDatabaseAutoupdate());
|
|
382
|
-
object.put("showSkipNextPageButton", functionality.isShowSkipNextPageButton());
|
|
383
|
-
object.put("useAuthenticator", functionality.isUseAuthenticator());
|
|
384
|
-
object.put("skipFocusingFrames", functionality.isSkipFocusingFrames());
|
|
385
|
-
object.put("showCameraSwitchButton", functionality.isShowCameraSwitchButton());
|
|
386
|
-
object.put("cameraFrame", functionality.getCameraFrame());
|
|
387
|
-
object.put("btDeviceName", functionality.getBtDeviceName());
|
|
388
|
-
object.put("orientation", functionality.getOrientation());
|
|
389
|
-
object.put("BTDeviceApiPresent", functionality.isBTDeviceApiPresent());
|
|
390
|
-
object.put("startDocReaderForResult", functionality.getStartDocReaderForResult());
|
|
391
|
-
object.put("captureMode", functionality.getCaptureMode());
|
|
392
|
-
object.put("displayMetadata", functionality.isDisplayMetaData());
|
|
393
|
-
object.put("cameraSize", new JSONObject() {{
|
|
394
|
-
put("width", functionality.getCameraWidth());
|
|
395
|
-
put("height", functionality.getCameraHeight());
|
|
396
|
-
}});
|
|
397
|
-
object.put("cameraMode", functionality.getCameraMode());
|
|
398
|
-
object.put("excludedCamera2Models", generateList(functionality.getExcludedCamera2Models()));
|
|
399
|
-
object.put("isZoomEnabled", functionality.isZoomEnabled());
|
|
400
|
-
object.put("zoomFactor", functionality.getZoomFactor());
|
|
401
|
-
object.put("isCameraTorchCheckDisabled", functionality.isCameraTorchCheckDisabled());
|
|
402
|
-
object.put("recordScanningProcess", functionality.doRecordProcessingVideo());
|
|
403
|
-
object.put("manualMultipageMode", functionality.isManualMultipageMode());
|
|
404
|
-
object.put("exposure", functionality.getExposure());
|
|
405
|
-
object.put("rfidTimeout", functionality.getRfidTimeout());
|
|
406
|
-
|
|
407
|
-
return object;
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
private static JSONObject getCustomization(ParamsCustomization customization) throws JSONException {
|
|
411
|
-
JSONObject object = new JSONObject();
|
|
412
|
-
object.put("status", customization.getStatus());
|
|
413
|
-
object.put("resultStatus", customization.getResultStatus());
|
|
414
|
-
object.put("cameraFrameDefaultColor", customization.getCameraFrameDefaultColor());
|
|
415
|
-
object.put("cameraFrameActiveColor", customization.getCameraFrameActiveColor());
|
|
416
|
-
object.put("cameraPreviewBackgroundColor", customization.getCameraPreviewBackgroundColor());
|
|
417
|
-
object.put("statusTextColor", customization.getStatusTextColor());
|
|
418
|
-
object.put("resultStatusTextColor", customization.getResultStatusTextColor());
|
|
419
|
-
object.put("resultStatusBackgroundColor", customization.getResultStatusBackgroundColor());
|
|
420
|
-
object.put("multipageButtonBackgroundColor", customization.getMultipageButtonBackgroundColor());
|
|
421
|
-
object.put("tintColor", customization.getTintColor());
|
|
422
|
-
object.put("activityIndicatorColor", customization.getActivityIndicatorColor());
|
|
423
|
-
object.put("showStatusMessages", customization.isShowStatusMessages());
|
|
424
|
-
object.put("showResultStatusMessages", customization.isShowResultStatusMessages());
|
|
425
|
-
object.put("showHelpAnimation", customization.isShowHelpAnimation());
|
|
426
|
-
object.put("showNextPageAnimation", customization.isShowNextPageAnimation());
|
|
427
|
-
object.put("showBackgroundMask", customization.isShowBackgroundMask());
|
|
428
|
-
object.put("cameraFrameBorderWidth", customization.getCameraFrameBorderWidth());
|
|
429
|
-
object.put("statusTextSize", customization.getStatusTextSize());
|
|
430
|
-
object.put("cameraFrameLineLength", customization.getCameraFrameLineLength());
|
|
431
|
-
object.put("cameraFrameShapeType", customization.getCameraFrameShapeType());
|
|
432
|
-
object.put("resultStatusTextSize", customization.getResultStatusTextSize());
|
|
433
|
-
object.put("multipageAnimationFrontImage", bitmapToBase64String(bitmapFromDrawable(customization.getMultipageAnimationFrontImage())));
|
|
434
|
-
object.put("multipageAnimationBackImage", bitmapToBase64String(bitmapFromDrawable(customization.getMultipageAnimationBackImage())));
|
|
435
|
-
object.put("borderBackgroundImage", bitmapToBase64String(bitmapFromDrawable(customization.getBorderBackgroundImage())));
|
|
436
|
-
object.put("helpAnimationImageScaleType", customization.getHelpAnimationImageScaleType());
|
|
437
|
-
object.put("multipageAnimationFrontImageScaleType", customization.getMultipageAnimationFrontImageScaleType());
|
|
438
|
-
object.put("multipageAnimationBackImageScaleType", customization.getMultipageAnimationBackImageScaleType());
|
|
439
|
-
object.put("borderBackgroundImageScaleType", customization.getBorderBackgroundImageScaleType());
|
|
440
|
-
object.put("helpAnimationImageMatrix", customization.getHelpAnimationImageMatrix());
|
|
441
|
-
object.put("multipageAnimationFrontImageMatrix", customization.getMultipageAnimationFrontImageMatrix());
|
|
442
|
-
object.put("multipageAnimationBackImageMatrix", customization.getMultipageAnimationBackImageMatrix());
|
|
443
|
-
object.put("borderBackgroundImageMatrix", customization.getBorderBackgroundImageMatrix());
|
|
444
|
-
object.put("statusTextFont", customization.getStatusTextFont());
|
|
445
|
-
object.put("resultStatusTextFont", customization.getResultStatusTextFont());
|
|
446
|
-
object.put("statusPositionMultiplier", customization.getStatusPositionMultiplier());
|
|
447
|
-
object.put("resultStatusPositionMultiplier", customization.getResultStatusPositionMultiplier());
|
|
448
|
-
object.put("backgroundMaskAlpha", customization.getBackgroundMaskAlpha());
|
|
449
|
-
object.put("helpAnimationImage", bitmapToBase64String(bitmapFromDrawable(customization.getHelpAnimationImageDrawable())));
|
|
450
|
-
object.put("cameraFrameOffsetWidth", customization.getCameraFrameOffsetWidth());
|
|
451
|
-
object.put("customLabelStatus", customization.getCustomLabelStatus().toString());
|
|
452
|
-
object.put("customStatusPositionMultiplier", customization.getCustomStatusPositionMultiplier());
|
|
453
|
-
object.put("cameraFrameVerticalPositionMultiplier", customization.getCameraFrameVerticalPositionMultiplier());
|
|
454
|
-
object.put("cameraFrameLandscapeAspectRatio", customization.getCameraFrameLandscapeAspectRatio());
|
|
455
|
-
object.put("cameraFramePortraitAspectRatio", customization.getCameraFramePortraitAspectRatio());
|
|
456
|
-
object.put("cameraFrameCornerRadius", customization.getCameraFrameCornerRadius());
|
|
457
|
-
object.put("cameraFrameLineCap", customization.getCameraFrameLineCap().toString());
|
|
458
|
-
object.put("closeButtonImage", bitmapToBase64String(bitmapFromDrawable(customization.getCloseButtonDrawable())));
|
|
459
|
-
object.put("captureButtonImage", bitmapToBase64String(bitmapFromDrawable(customization.getCaptureButtonDrawable())));
|
|
460
|
-
object.put("changeFrameCollapseButtonImage", bitmapToBase64String(bitmapFromDrawable(customization.getChangeFrameCollapseButtonDrawable())));
|
|
461
|
-
object.put("changeFrameExpandButtonImage", bitmapToBase64String(bitmapFromDrawable(customization.getChangeFrameExpandButtonDrawable())));
|
|
462
|
-
object.put("cameraSwitchButtonImage", bitmapToBase64String(bitmapFromDrawable(customization.getCameraSwitchButtonDrawable())));
|
|
463
|
-
object.put("torchButtonOnImage", bitmapToBase64String(bitmapFromDrawable(customization.getTorchImageOnDrawable())));
|
|
464
|
-
object.put("torchButtonOffImage", bitmapToBase64String(bitmapFromDrawable(customization.getTorchImageOffDrawable())));
|
|
465
|
-
object.put("changeFrameButtonExpandImage", bitmapToBase64String(bitmapFromDrawable(customization.getChangeFrameExpandButtonDrawable())));
|
|
466
|
-
object.put("changeFrameButtonCollapseImage", bitmapToBase64String(bitmapFromDrawable(customization.getChangeFrameCollapseButtonDrawable())));
|
|
467
|
-
object.put("toolbarSize", customization.getToolbarSize());
|
|
468
|
-
object.put("statusBackgroundColor", customization.getStatusBackgroundColor());
|
|
469
|
-
object.put("hologramAnimationImage", bitmapToBase64String(bitmapFromDrawable(customization.getHologramAnimationImage())));
|
|
470
|
-
object.put("hologramAnimationPositionMultiplier", customization.getHologramAnimationPositionMultiplier());
|
|
471
|
-
object.put("hologramAnimationImageMatrix", customization.getHologramAnimationImageMatrix());
|
|
472
|
-
object.put("hologramAnimationImageScaleType", customization.getHologramAnimationImageScaleType());
|
|
473
|
-
object.put("uiCustomizationLayer", customization.getUiCustomizationLayer());
|
|
474
|
-
object.put("activityIndicatorSize", customization.getActivityIndicatorSize());
|
|
475
|
-
|
|
476
|
-
return object;
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
private static JSONObject getProcessParams(ProcessParam processParams) throws JSONException {
|
|
480
|
-
JSONObject object = new JSONObject();
|
|
481
|
-
object.put("documentIDList", processParams.documentIDList != null ? generateIntArray(processParams.documentIDList) : null);
|
|
482
|
-
object.put("barcodeTypes", processParams.doBarcodes != null ? generateArray(processParams.doBarcodes) : null);
|
|
483
|
-
object.put("fieldTypesFilter", processParams.fieldTypesFilter != null ? generateIntArray(processParams.fieldTypesFilter) : null);
|
|
484
|
-
object.put("scenario", processParams.scenario);
|
|
485
|
-
object.put("measureSystem", processParams.measureSystem);
|
|
486
|
-
object.put("uvTorchEnabled", processParams.uvTorchEnabled);
|
|
487
|
-
object.put("debugSaveImages", true);
|
|
488
|
-
object.put("debugSaveLogs", processParams.debugSaveLogs);
|
|
489
|
-
object.put("multipageProcessing", processParams.multipageProcessing);
|
|
490
|
-
object.put("dateFormat", processParams.dateFormat);
|
|
491
|
-
object.put("debugSaveCroppedImages", processParams.debugSaveCroppedImages);
|
|
492
|
-
object.put("sessionLogFolder", processParams.sessionLogFolder);
|
|
493
|
-
object.put("disableFocusingCheck", processParams.disableFocusingCheck);
|
|
494
|
-
object.put("captureButtonScenario", processParams.captureButtonScenario);
|
|
495
|
-
object.put("returnUncroppedImage", processParams.returnUncroppedImage);
|
|
496
|
-
object.put("customParams", processParams.customParams != null ? processParams.customParams.toString() : new JSONArray());
|
|
497
|
-
object.put("debugSaveRFIDSession", processParams.debugSaveRFIDSession);
|
|
498
|
-
object.put("barcodeParserType", processParams.barcodeParserType);
|
|
499
|
-
object.put("doublePageSpread", processParams.doublePageSpread);
|
|
500
|
-
object.put("timeout", processParams.timeout);
|
|
501
|
-
object.put("timeoutFromFirstDetect", processParams.timeoutFromFirstDetect);
|
|
502
|
-
object.put("timeoutFromFirstDocType", processParams.timeoutFromFirstDocType);
|
|
503
|
-
object.put("manualCrop", processParams.manualCrop);
|
|
504
|
-
object.put("perspectiveAngle", processParams.perspectiveAngle);
|
|
505
|
-
object.put("integralImage", processParams.integralImage);
|
|
506
|
-
object.put("minDPI", processParams.minDPI);
|
|
507
|
-
object.put("logs", processParams.isLogEnable());
|
|
508
|
-
object.put("returnCroppedBarcode", processParams.returnCroppedBarcode);
|
|
509
|
-
object.put("checkHologram", processParams.checkHologram);
|
|
510
|
-
object.put("checkRequiredTextFields", processParams.checkRequiredTextFields);
|
|
511
|
-
object.put("depersonalizeLog", processParams.depersonalizeLog);
|
|
512
|
-
object.put("resultTypeOutput", processParams.resultTypeOutput);
|
|
513
|
-
object.put("generateDoublePageSpreadImage", processParams.generateDoublePageSpreadImage);
|
|
514
|
-
object.put("imageDpiOutMax", processParams.imageDpiOutMax);
|
|
515
|
-
object.put("alreadyCropped", processParams.alreadyCropped);
|
|
516
|
-
object.put("forceDocID", processParams.forceDocID);
|
|
517
|
-
object.put("matchTextFieldMask", processParams.matchTextFieldMask);
|
|
518
|
-
object.put("fastDocDetect", processParams.fastDocDetect);
|
|
519
|
-
object.put("updateOCRValidityByGlare", processParams.updateOCRValidityByGlare);
|
|
520
|
-
object.put("imageQA", generateImageQA(processParams.imageQA));
|
|
521
|
-
object.put("forceDocFormat", processParams.forceDocFormat);
|
|
522
|
-
object.put("noGraphics", processParams.noGraphics);
|
|
523
|
-
object.put("documentAreaMin", processParams.documentAreaMin);
|
|
524
|
-
object.put("multiDocOnImage", processParams.multiDocOnImage);
|
|
525
|
-
object.put("shiftExpiryDate", processParams.shiftExpiryDate);
|
|
526
|
-
object.put("minimalHolderAge", processParams.minimalHolderAge);
|
|
527
|
-
object.put("mrzFormatsFilter", processParams.mrzFormatsFilter != null ? generateArray(processParams.mrzFormatsFilter) : null);
|
|
528
|
-
object.put("forceReadMrzBeforeLocate", processParams.forceReadMrzBeforeLocate);
|
|
529
|
-
object.put("parseBarcodes", processParams.parseBarcodes);
|
|
530
|
-
object.put("shouldReturnPackageForReprocess", processParams.shouldReturnPackageForReprocess);
|
|
531
|
-
object.put("imageOutputMaxHeight", processParams.imageOutputMaxHeight);
|
|
532
|
-
object.put("imageOutputMaxWidth", processParams.imageOutputMaxWidth);
|
|
533
|
-
object.put("disablePerforationOCR", processParams.disablePerforationOCR);
|
|
534
|
-
object.put("documentGroupFilter", generateIntArray(processParams.documentGroupFilter));
|
|
535
|
-
object.put("respectImageQuality", processParams.respectImageQuality);
|
|
536
|
-
object.put("splitNames", processParams.splitNames);
|
|
537
|
-
object.put("convertCase", processParams.convertCase);
|
|
538
|
-
object.put("doFlipYAxis", processParams.doFlipYAxis);
|
|
539
|
-
object.put("doDetectCan", processParams.doDetectCan);
|
|
540
|
-
object.put("useFaceApi", processParams.useFaceApi);
|
|
541
|
-
|
|
542
|
-
return object;
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
static void setRfidScenario(JSONObject opts) throws JSONException {
|
|
546
|
-
if (opts.has("paceStaticBinding"))
|
|
547
|
-
DocumentReader.Instance().rfidScenario().setPaceStaticBinding(opts.getBoolean("PACE_StaticBinding"));
|
|
548
|
-
if (opts.has("signManagementAction"))
|
|
549
|
-
DocumentReader.Instance().rfidScenario().setSignManagementAction(opts.getInt("signManagementAction"));
|
|
550
|
-
if (opts.has("readingBuffer"))
|
|
551
|
-
DocumentReader.Instance().rfidScenario().setReadingBuffer(opts.getInt("readingBuffer"));
|
|
552
|
-
if (opts.has("onlineTAToSignDataType"))
|
|
553
|
-
DocumentReader.Instance().rfidScenario().setOnlineTAToSignDataType(opts.getInt("onlineTAToSignDataType"));
|
|
554
|
-
if (opts.has("onlineTA"))
|
|
555
|
-
DocumentReader.Instance().rfidScenario().setOnlineTA(opts.getBoolean("onlineTA"));
|
|
556
|
-
if (opts.has("writeEid"))
|
|
557
|
-
DocumentReader.Instance().rfidScenario().setWriteEid(opts.getBoolean("writeEid"));
|
|
558
|
-
if (opts.has("profilerType"))
|
|
559
|
-
DocumentReader.Instance().rfidScenario().setProfilerType(opts.getInt("profilerType"));
|
|
560
|
-
if (opts.has("authProcType"))
|
|
561
|
-
DocumentReader.Instance().rfidScenario().setAuthProcType(opts.getInt("authProcType"));
|
|
562
|
-
if (opts.has("baseSMProcedure"))
|
|
563
|
-
DocumentReader.Instance().rfidScenario().setBaseSMProcedure(opts.getInt("baseSMProcedure"));
|
|
564
|
-
if (opts.has("pacePasswordType"))
|
|
565
|
-
DocumentReader.Instance().rfidScenario().setPacePasswordType(opts.getInt("pacePasswordType"));
|
|
566
|
-
if (opts.has("terminalType"))
|
|
567
|
-
DocumentReader.Instance().rfidScenario().setTerminalType(opts.getInt("terminalType"));
|
|
568
|
-
if (opts.has("universalAccessRights"))
|
|
569
|
-
DocumentReader.Instance().rfidScenario().setUniversalAccessRights(opts.getBoolean("universalAccessRights"));
|
|
570
|
-
if (opts.has("authorizedRestrictedIdentification"))
|
|
571
|
-
DocumentReader.Instance().rfidScenario().setAuthorizedRestrictedIdentification(opts.getBoolean("authorizedRestrictedIdentification"));
|
|
572
|
-
if (opts.has("auxVerificationCommunityID"))
|
|
573
|
-
DocumentReader.Instance().rfidScenario().setAuxVerificationCommunityID(opts.getBoolean("auxVerificationCommunityID"));
|
|
574
|
-
if (opts.has("auxVerificationDateOfBirth"))
|
|
575
|
-
DocumentReader.Instance().rfidScenario().setAuxVerificationDateOfBirth(opts.getBoolean("auxVerificationDateOfBirth"));
|
|
576
|
-
if (opts.has("skipAA"))
|
|
577
|
-
DocumentReader.Instance().rfidScenario().setSkipAA(opts.getBoolean("skipAA"));
|
|
578
|
-
if (opts.has("strictProcessing"))
|
|
579
|
-
DocumentReader.Instance().rfidScenario().setStrictProcessing(opts.getBoolean("strictProcessing"));
|
|
580
|
-
if (opts.has("pkdDSCertPriority"))
|
|
581
|
-
DocumentReader.Instance().rfidScenario().setPkdDSCertPriority(opts.getBoolean("pkdDSCertPriority"));
|
|
582
|
-
if (opts.has("pkdUseExternalCSCA"))
|
|
583
|
-
DocumentReader.Instance().rfidScenario().setPkdUseExternalCSCA(opts.getBoolean("pkdUseExternalCSCA"));
|
|
584
|
-
if (opts.has("trustedPKD"))
|
|
585
|
-
DocumentReader.Instance().rfidScenario().setTrustedPKD(opts.getBoolean("trustedPKD"));
|
|
586
|
-
if (opts.has("passiveAuth"))
|
|
587
|
-
DocumentReader.Instance().rfidScenario().setPassiveAuth(opts.getBoolean("passiveAuth"));
|
|
588
|
-
if (opts.has("password"))
|
|
589
|
-
DocumentReader.Instance().rfidScenario().setPassword(opts.getString("password"));
|
|
590
|
-
if (opts.has("useSFI"))
|
|
591
|
-
DocumentReader.Instance().rfidScenario().setUseSFI(opts.getBoolean("useSFI"));
|
|
592
|
-
if (opts.has("pkdPA"))
|
|
593
|
-
DocumentReader.Instance().rfidScenario().setPkdPA(opts.getString("pkdPA"));
|
|
594
|
-
if (opts.has("pkdEAC"))
|
|
595
|
-
DocumentReader.Instance().rfidScenario().setPkdEAC(opts.getString("pkdEAC"));
|
|
596
|
-
if (opts.has("readEPassport"))
|
|
597
|
-
DocumentReader.Instance().rfidScenario().setReadEPassport(opts.getBoolean("readEPassport"));
|
|
598
|
-
if (opts.has("readEID"))
|
|
599
|
-
DocumentReader.Instance().rfidScenario().setReadEID(opts.getBoolean("readEID"));
|
|
600
|
-
if (opts.has("readEDL"))
|
|
601
|
-
DocumentReader.Instance().rfidScenario().setReadEDL(opts.getBoolean("readEDL"));
|
|
602
|
-
if (opts.has("mrz"))
|
|
603
|
-
DocumentReader.Instance().rfidScenario().setMrz(opts.getString("mrz"));
|
|
604
|
-
if (opts.has("eSignPINDefault"))
|
|
605
|
-
DocumentReader.Instance().rfidScenario().seteSignPINDefault(opts.getString("eSignPINDefault"));
|
|
606
|
-
if (opts.has("eSignPINNewValue"))
|
|
607
|
-
DocumentReader.Instance().rfidScenario().seteSignPINNewValue(opts.getString("eSignPINNewValue"));
|
|
608
|
-
if (opts.has("authorizedSTSignature"))
|
|
609
|
-
DocumentReader.Instance().rfidScenario().setAuthorizedSTSignature(opts.getBoolean("authorizedSTSignature"));
|
|
610
|
-
if (opts.has("authorizedSTQSignature"))
|
|
611
|
-
DocumentReader.Instance().rfidScenario().setAuthorizedSTQSignature(opts.getBoolean("authorizedSTQSignature"));
|
|
612
|
-
if (opts.has("authorizedWriteDG17"))
|
|
613
|
-
DocumentReader.Instance().rfidScenario().setAuthorizedWriteDG17(opts.getBoolean("authorizedWriteDG17"));
|
|
614
|
-
if (opts.has("authorizedWriteDG18"))
|
|
615
|
-
DocumentReader.Instance().rfidScenario().setAuthorizedWriteDG18(opts.getBoolean("authorizedWriteDG18"));
|
|
616
|
-
if (opts.has("authorizedWriteDG19"))
|
|
617
|
-
DocumentReader.Instance().rfidScenario().setAuthorizedWriteDG19(opts.getBoolean("authorizedWriteDG19"));
|
|
618
|
-
if (opts.has("authorizedWriteDG20"))
|
|
619
|
-
DocumentReader.Instance().rfidScenario().setAuthorizedWriteDG20(opts.getBoolean("authorizedWriteDG20"));
|
|
620
|
-
if (opts.has("authorizedWriteDG21"))
|
|
621
|
-
DocumentReader.Instance().rfidScenario().setAuthorizedWriteDG21(opts.getBoolean("authorizedWriteDG21"));
|
|
622
|
-
if (opts.has("authorizedVerifyAge"))
|
|
623
|
-
DocumentReader.Instance().rfidScenario().setAuthorizedVerifyAge(opts.getBoolean("authorizedVerifyAge"));
|
|
624
|
-
if (opts.has("authorizedVerifyCommunityID"))
|
|
625
|
-
DocumentReader.Instance().rfidScenario().setAuthorizedVerifyCommunityID(opts.getBoolean("authorizedVerifyCommunityID"));
|
|
626
|
-
if (opts.has("authorizedPrivilegedTerminal"))
|
|
627
|
-
DocumentReader.Instance().rfidScenario().setAuthorizedPrivilegedTerminal(opts.getBoolean("authorizedPrivilegedTerminal"));
|
|
628
|
-
if (opts.has("authorizedCANAllowed"))
|
|
629
|
-
DocumentReader.Instance().rfidScenario().setAuthorizedCANAllowed(opts.getBoolean("authorizedCANAllowed"));
|
|
630
|
-
if (opts.has("authorizedPINManagement"))
|
|
631
|
-
DocumentReader.Instance().rfidScenario().setAuthorizedPINManagment(opts.getBoolean("authorizedPINManagement"));
|
|
632
|
-
if (opts.has("authorizedInstallCert"))
|
|
633
|
-
DocumentReader.Instance().rfidScenario().setAuthorizedInstallCert(opts.getBoolean("authorizedInstallCert"));
|
|
634
|
-
if (opts.has("authorizedInstallQCert"))
|
|
635
|
-
DocumentReader.Instance().rfidScenario().setAuthorizedInstallQCert(opts.getBoolean("authorizedInstallQCert"));
|
|
636
|
-
if (opts.has("applyAmendments"))
|
|
637
|
-
DocumentReader.Instance().rfidScenario().setApplyAmendments(opts.getBoolean("applyAmendments"));
|
|
638
|
-
if (opts.has("autoSettings"))
|
|
639
|
-
DocumentReader.Instance().rfidScenario().setAutoSettings(opts.getBoolean("autoSettings"));
|
|
640
|
-
if (opts.has("ePassportDataGroups"))
|
|
641
|
-
setDataGroups(DocumentReader.Instance().rfidScenario().ePassportDataGroups(), opts.getJSONObject("ePassportDataGroups"));
|
|
642
|
-
if (opts.has("eIDDataGroups"))
|
|
643
|
-
setDataGroups(DocumentReader.Instance().rfidScenario().eIDDataGroups(), opts.getJSONObject("eIDDataGroups"));
|
|
644
|
-
if (opts.has("eDLDataGroups"))
|
|
645
|
-
setDataGroups(DocumentReader.Instance().rfidScenario().eDLDataGroups(), opts.getJSONObject("eDLDataGroups"));
|
|
646
|
-
if (opts.has("reprocessParams"))
|
|
647
|
-
DocumentReader.Instance().rfidScenario().setReprocessParams(ReprocParamsFromJSON(opts.getJSONObject("reprocessParams")));
|
|
648
|
-
if (opts.has("defaultReadingBufferSize"))
|
|
649
|
-
DocumentReader.Instance().rfidScenario().setDefaultReadingBufferSize(opts.getInt("defaultReadingBufferSize"));
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
private static void setDataGroups(DataGroups dataGroup, JSONObject opts) throws JSONException {
|
|
653
|
-
if (opts.has("DG1"))
|
|
654
|
-
dataGroup.setDG1(opts.getBoolean("DG1"));
|
|
655
|
-
if (opts.has("DG2"))
|
|
656
|
-
dataGroup.setDG2(opts.getBoolean("DG2"));
|
|
657
|
-
if (opts.has("DG3"))
|
|
658
|
-
dataGroup.setDG3(opts.getBoolean("DG3"));
|
|
659
|
-
if (opts.has("DG4"))
|
|
660
|
-
dataGroup.setDG4(opts.getBoolean("DG4"));
|
|
661
|
-
if (opts.has("DG5"))
|
|
662
|
-
dataGroup.setDG5(opts.getBoolean("DG5"));
|
|
663
|
-
if (opts.has("DG6"))
|
|
664
|
-
dataGroup.setDG6(opts.getBoolean("DG6"));
|
|
665
|
-
if (opts.has("DG7"))
|
|
666
|
-
dataGroup.setDG7(opts.getBoolean("DG7"));
|
|
667
|
-
if (opts.has("DG8"))
|
|
668
|
-
dataGroup.setDG8(opts.getBoolean("DG8"));
|
|
669
|
-
if (opts.has("DG9"))
|
|
670
|
-
dataGroup.setDG9(opts.getBoolean("DG9"));
|
|
671
|
-
if (opts.has("DG10"))
|
|
672
|
-
dataGroup.setDG10(opts.getBoolean("DG10"));
|
|
673
|
-
if (opts.has("DG11"))
|
|
674
|
-
dataGroup.setDG11(opts.getBoolean("DG11"));
|
|
675
|
-
if (opts.has("DG12"))
|
|
676
|
-
dataGroup.setDG12(opts.getBoolean("DG12"));
|
|
677
|
-
if (opts.has("DG13"))
|
|
678
|
-
dataGroup.setDG13(opts.getBoolean("DG13"));
|
|
679
|
-
if (opts.has("DG14"))
|
|
680
|
-
dataGroup.setDG14(opts.getBoolean("DG14"));
|
|
681
|
-
if (opts.has("DG15"))
|
|
682
|
-
dataGroup.setDG14(opts.getBoolean("DG15"));
|
|
683
|
-
if (opts.has("DG16"))
|
|
684
|
-
dataGroup.setDG14(opts.getBoolean("DG16"));
|
|
685
|
-
if (opts.has("DG17"))
|
|
686
|
-
dataGroup.setDG14(opts.getBoolean("DG17"));
|
|
687
|
-
if (opts.has("DG18"))
|
|
688
|
-
dataGroup.setDG14(opts.getBoolean("DG18"));
|
|
689
|
-
if (opts.has("DG19"))
|
|
690
|
-
dataGroup.setDG14(opts.getBoolean("DG19"));
|
|
691
|
-
if (opts.has("DG20"))
|
|
692
|
-
dataGroup.setDG14(opts.getBoolean("DG20"));
|
|
693
|
-
if (opts.has("DG21"))
|
|
694
|
-
dataGroup.setDG14(opts.getBoolean("DG21"));
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
private static ReprocParams ReprocParamsFromJSON(JSONObject input) {
|
|
698
|
-
try {
|
|
699
|
-
ReprocParams result;
|
|
700
|
-
if (input.has("serviceUrl"))
|
|
701
|
-
result = new ReprocParams(input.getString("serviceUrl"));
|
|
702
|
-
else return null;
|
|
703
|
-
if (input.has("failIfNoService"))
|
|
704
|
-
result.setFailIfNoService(input.getBoolean("failIfNoService"));
|
|
705
|
-
if (input.has("httpHeaders"))
|
|
706
|
-
result.setHttpHeaders(stringMapFromJson(input.getJSONObject("httpHeaders")));
|
|
707
|
-
return result;
|
|
708
|
-
} catch (JSONException e) {
|
|
709
|
-
e.printStackTrace();
|
|
710
|
-
}
|
|
711
|
-
return null;
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
static OnlineProcessingConfig OnlineProcessingConfigFromJSON(JSONObject input) {
|
|
715
|
-
if(input == null) return null;
|
|
716
|
-
try {
|
|
717
|
-
OnlineProcessingConfig.Builder builder;
|
|
718
|
-
if (input.has("mode"))
|
|
719
|
-
builder = new OnlineProcessingConfig.Builder(input.getInt("mode"));
|
|
720
|
-
else return null;
|
|
721
|
-
if (input.has("imageFormat"))
|
|
722
|
-
builder.setImageFormat(input.getInt("imageFormat"));
|
|
723
|
-
if (input.has("url"))
|
|
724
|
-
builder.setUrl(input.getString("url"));
|
|
725
|
-
if (input.has("imageCompressionQuality"))
|
|
726
|
-
builder.setImageCompressionQuality((float) input.getDouble("imageCompressionQuality"));
|
|
727
|
-
if (input.has("processParams")) {
|
|
728
|
-
ProcessParam params = new ProcessParam();
|
|
729
|
-
setProcessParams(params, input.getJSONObject("processParams"));
|
|
730
|
-
builder.setProcessParams(params);
|
|
731
|
-
}
|
|
732
|
-
return builder.build();
|
|
733
|
-
} catch (JSONException e) {
|
|
734
|
-
e.printStackTrace();
|
|
735
|
-
}
|
|
736
|
-
return null;
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
private static RFIDParams RFIDParamsFromJSON(JSONObject input) {
|
|
740
|
-
try {
|
|
741
|
-
RFIDParams result = new RFIDParams();
|
|
742
|
-
|
|
743
|
-
if (input.has("paIgnoreNotificationCodes"))
|
|
744
|
-
result.setPaIgnoreNotificationCodes(intArrayFromJSON(input.getJSONArray("paIgnoreNotificationCodes")));
|
|
745
|
-
|
|
746
|
-
return result;
|
|
747
|
-
} catch (JSONException e) {
|
|
748
|
-
e.printStackTrace();
|
|
749
|
-
}
|
|
750
|
-
return null;
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
static FaceApiParams FaceApiParamsFromJSON(JSONObject input) {
|
|
754
|
-
try {
|
|
755
|
-
FaceApiParams result = new FaceApiParams();
|
|
756
|
-
String url;
|
|
757
|
-
if (input.has("url") && !input.isNull("url")) {
|
|
758
|
-
url = input.getString("url");
|
|
759
|
-
result.setUrl(url);
|
|
760
|
-
}
|
|
761
|
-
String mode;
|
|
762
|
-
if (input.has("mode") && !input.isNull("mode")) {
|
|
763
|
-
mode = input.getString("mode");
|
|
764
|
-
result.setMode(mode);
|
|
765
|
-
}
|
|
766
|
-
FaceApiParams.Search search;
|
|
767
|
-
if (input.has("searchParams") && !input.isNull("searchParams")) {
|
|
768
|
-
search = SearchFromJSON(input.getJSONObject("searchParams"));
|
|
769
|
-
result.setSearch(search);
|
|
770
|
-
}
|
|
771
|
-
int threshold;
|
|
772
|
-
if (input.has("threshold") && !input.isNull("threshold")) {
|
|
773
|
-
threshold = input.getInt("threshold");
|
|
774
|
-
result.setThreshold(threshold);
|
|
775
|
-
}
|
|
776
|
-
int serviceTimeout;
|
|
777
|
-
if (input.has("serviceTimeout") && !input.isNull("serviceTimeout")) {
|
|
778
|
-
serviceTimeout = input.getInt("serviceTimeout");
|
|
779
|
-
result.setServiceTimeout(serviceTimeout);
|
|
780
|
-
}
|
|
781
|
-
String proxy;
|
|
782
|
-
if (input.has("proxy") && !input.isNull("proxy")) {
|
|
783
|
-
proxy = input.getString("proxy");
|
|
784
|
-
result.setProxy(proxy);
|
|
785
|
-
}
|
|
786
|
-
String proxyUserPwd;
|
|
787
|
-
if (input.has("proxyPassword") && !input.isNull("proxyPassword")) {
|
|
788
|
-
proxyUserPwd = input.getString("proxyPassword");
|
|
789
|
-
result.setProxyUserPwd(proxyUserPwd);
|
|
790
|
-
}
|
|
791
|
-
int proxyType;
|
|
792
|
-
if (input.has("proxyType") && !input.isNull("proxyType")) {
|
|
793
|
-
proxyType = input.getInt("proxyType");
|
|
794
|
-
result.setProxyType(proxyType);
|
|
795
|
-
}
|
|
796
|
-
return result;
|
|
797
|
-
} catch (JSONException e) {
|
|
798
|
-
e.printStackTrace();
|
|
799
|
-
}
|
|
800
|
-
return null;
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
-
static FaceApiParams.Search SearchFromJSON(JSONObject input) {
|
|
804
|
-
try {
|
|
805
|
-
FaceApiParams.Search result = new FaceApiParams.Search();
|
|
806
|
-
int limit;
|
|
807
|
-
if (input.has("limit") && !input.isNull("limit")) {
|
|
808
|
-
limit = input.getInt("limit");
|
|
809
|
-
result.setLimit(limit);
|
|
810
|
-
}
|
|
811
|
-
double threshold;
|
|
812
|
-
if (input.has("threshold") && !input.isNull("threshold")) {
|
|
813
|
-
threshold = input.getDouble("threshold");
|
|
814
|
-
result.setThreshold((float) threshold);
|
|
815
|
-
}
|
|
816
|
-
int[] groupIds;
|
|
817
|
-
if (input.has("groupIds") && !input.isNull("groupIds")) {
|
|
818
|
-
JSONArray jsonArray_groupIds = input.getJSONArray("groupIds");
|
|
819
|
-
groupIds = new int[jsonArray_groupIds.length()];
|
|
820
|
-
for (int i = 0; i < jsonArray_groupIds.length(); i++)
|
|
821
|
-
groupIds[i] = jsonArray_groupIds.getInt(i);
|
|
822
|
-
result.setGroupIds(groupIds);
|
|
823
|
-
}
|
|
824
|
-
return result;
|
|
825
|
-
} catch (JSONException e) {
|
|
826
|
-
e.printStackTrace();
|
|
827
|
-
}
|
|
828
|
-
return null;
|
|
829
|
-
}
|
|
830
|
-
}
|