@regulaforensics/cordova-plugin-document-reader-api 6.4.0 → 6.6.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/example/config.xml +7 -0
- package/example/package.json +5 -5
- package/example/www/index.html +109 -111
- package/example/www/js/index.js +86 -85
- package/package.json +1 -1
- package/plugin.xml +5 -3
- package/src/android/BluetoothUtil.kt +108 -0
- package/src/android/DocumentReader.java +112 -21
- package/src/android/Helpers.java +5 -6
- package/src/android/JSONConstructor.java +171 -1389
- package/src/android/RegulaConfig.java +68 -7
- package/src/android/build.gradle +5 -11
- package/src/ios/RGLDocumentReader.m +78 -34
- package/src/ios/RGLWJSONConstructor.h +7 -0
- package/src/ios/RGLWJSONConstructor.m +124 -4
- package/src/ios/RegulaConfig.m +62 -7
- package/www/DocumentReader.js +3296 -3182
|
@@ -4,7 +4,6 @@ import static com.regula.documentreader.api.completions.IRfidNotificationComplet
|
|
|
4
4
|
|
|
5
5
|
import android.content.Context;
|
|
6
6
|
import android.graphics.Bitmap;
|
|
7
|
-
import android.graphics.BitmapFactory;
|
|
8
7
|
import android.graphics.Rect;
|
|
9
8
|
import android.os.Bundle;
|
|
10
9
|
import android.util.Base64;
|
|
@@ -15,7 +14,8 @@ import com.regula.documentreader.api.enums.eGraphicFieldType;
|
|
|
15
14
|
import com.regula.documentreader.api.enums.eRPRM_Lights;
|
|
16
15
|
import com.regula.documentreader.api.errors.DocumentReaderException;
|
|
17
16
|
import com.regula.documentreader.api.internal.core.CoreDetailedScenario;
|
|
18
|
-
import com.regula.documentreader.api.params.
|
|
17
|
+
import com.regula.documentreader.api.params.DocReaderConfig;
|
|
18
|
+
import com.regula.documentreader.api.internal.params.FaceMetaData;
|
|
19
19
|
import com.regula.documentreader.api.params.ImageInputData;
|
|
20
20
|
import com.regula.documentreader.api.params.rfid.TccParams;
|
|
21
21
|
import com.regula.documentreader.api.params.rfid.authorization.PAAttribute;
|
|
@@ -24,18 +24,24 @@ import com.regula.documentreader.api.params.rfid.authorization.TAChallenge;
|
|
|
24
24
|
import com.regula.documentreader.api.results.Bounds;
|
|
25
25
|
import com.regula.documentreader.api.results.BytesData;
|
|
26
26
|
import com.regula.documentreader.api.results.Coordinate;
|
|
27
|
+
import com.regula.documentreader.api.results.DocReaderDocumentsDatabase;
|
|
27
28
|
import com.regula.documentreader.api.results.DocReaderFieldRect;
|
|
28
29
|
import com.regula.documentreader.api.results.DocumentReaderBarcodeField;
|
|
29
30
|
import com.regula.documentreader.api.results.DocumentReaderBarcodeResult;
|
|
31
|
+
import com.regula.documentreader.api.results.DocumentReaderComparison;
|
|
30
32
|
import com.regula.documentreader.api.results.DocumentReaderDocumentType;
|
|
31
33
|
import com.regula.documentreader.api.results.DocumentReaderGraphicField;
|
|
32
34
|
import com.regula.documentreader.api.results.DocumentReaderGraphicResult;
|
|
33
35
|
import com.regula.documentreader.api.results.DocumentReaderNotification;
|
|
34
36
|
import com.regula.documentreader.api.results.DocumentReaderResults;
|
|
35
37
|
import com.regula.documentreader.api.results.DocumentReaderResultsStatus;
|
|
38
|
+
import com.regula.documentreader.api.results.DocumentReaderRfidOrigin;
|
|
36
39
|
import com.regula.documentreader.api.results.DocumentReaderScenario;
|
|
40
|
+
import com.regula.documentreader.api.results.DocumentReaderSymbol;
|
|
37
41
|
import com.regula.documentreader.api.results.DocumentReaderTextField;
|
|
38
42
|
import com.regula.documentreader.api.results.DocumentReaderTextResult;
|
|
43
|
+
import com.regula.documentreader.api.results.DocumentReaderTextSource;
|
|
44
|
+
import com.regula.documentreader.api.results.DocumentReaderValidity;
|
|
39
45
|
import com.regula.documentreader.api.results.DocumentReaderValue;
|
|
40
46
|
import com.regula.documentreader.api.results.ElementPosition;
|
|
41
47
|
import com.regula.documentreader.api.results.ImageQuality;
|
|
@@ -44,7 +50,6 @@ import com.regula.documentreader.api.results.VDSNCData;
|
|
|
44
50
|
import com.regula.documentreader.api.results.authenticity.DocumentReaderAuthenticityCheck;
|
|
45
51
|
import com.regula.documentreader.api.results.authenticity.DocumentReaderAuthenticityElement;
|
|
46
52
|
import com.regula.documentreader.api.results.authenticity.DocumentReaderAuthenticityResult;
|
|
47
|
-
import com.regula.documentreader.api.results.authenticity.DocumentReaderUvFiberElement;
|
|
48
53
|
import com.regula.documentreader.api.results.rfid.AccessControlProcedureType;
|
|
49
54
|
import com.regula.documentreader.api.results.rfid.Application;
|
|
50
55
|
import com.regula.documentreader.api.results.rfid.Attribute;
|
|
@@ -56,7 +61,6 @@ import com.regula.documentreader.api.results.rfid.Extension;
|
|
|
56
61
|
import com.regula.documentreader.api.results.rfid.File;
|
|
57
62
|
import com.regula.documentreader.api.results.rfid.FileData;
|
|
58
63
|
import com.regula.documentreader.api.results.rfid.RFIDSessionData;
|
|
59
|
-
import com.regula.documentreader.api.results.rfid.RFIDSessionDataStatus;
|
|
60
64
|
import com.regula.documentreader.api.results.rfid.SecurityObject;
|
|
61
65
|
import com.regula.documentreader.api.results.rfid.SecurityObjectCertificates;
|
|
62
66
|
import com.regula.documentreader.api.results.rfid.SignerInfo;
|
|
@@ -67,12 +71,9 @@ import org.json.JSONArray;
|
|
|
67
71
|
import org.json.JSONException;
|
|
68
72
|
import org.json.JSONObject;
|
|
69
73
|
|
|
70
|
-
import java.io.ByteArrayOutputStream;
|
|
71
|
-
import java.util.ArrayList;
|
|
72
74
|
import java.util.List;
|
|
73
75
|
import java.util.Map;
|
|
74
76
|
|
|
75
|
-
@SuppressWarnings({"ConstantConditions", "unused", "RedundantSuppression"})
|
|
76
77
|
class JSONConstructor {
|
|
77
78
|
interface JSONObjectGeneratorWithContext<T> {
|
|
78
79
|
JSONObject generateJSONObject(T param, Context context) throws JSONException;
|
|
@@ -82,13 +83,9 @@ class JSONConstructor {
|
|
|
82
83
|
JSONObject generateJSONObject(T param) throws JSONException;
|
|
83
84
|
}
|
|
84
85
|
|
|
85
|
-
interface StringGenerator<T> {
|
|
86
|
-
String generateString(T param);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
86
|
static <T> JSONArray generateList(List<T> list) {
|
|
90
87
|
JSONArray result = new JSONArray();
|
|
91
|
-
if(list == null) return result;
|
|
88
|
+
if (list == null) return result;
|
|
92
89
|
for (T t : list)
|
|
93
90
|
if (t != null)
|
|
94
91
|
result.put(t);
|
|
@@ -98,7 +95,7 @@ class JSONConstructor {
|
|
|
98
95
|
|
|
99
96
|
static <T> JSONArray generateList(List<T> list, JSONObjectGenerator<T> generator) throws JSONException {
|
|
100
97
|
JSONArray result = new JSONArray();
|
|
101
|
-
if(list == null) return result;
|
|
98
|
+
if (list == null) return result;
|
|
102
99
|
for (T t : list)
|
|
103
100
|
if (t != null)
|
|
104
101
|
result.put(generator.generateJSONObject(t));
|
|
@@ -106,19 +103,9 @@ class JSONConstructor {
|
|
|
106
103
|
return result;
|
|
107
104
|
}
|
|
108
105
|
|
|
109
|
-
static <T> JSONArray generateList(List<T> list, StringGenerator<T> generator) {
|
|
110
|
-
JSONArray result = new JSONArray();
|
|
111
|
-
if(list == null) return result;
|
|
112
|
-
for (T t : list)
|
|
113
|
-
if (t != null)
|
|
114
|
-
result.put(generator.generateString(t));
|
|
115
|
-
|
|
116
|
-
return result;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
106
|
static <T> JSONArray generateList(List<T> list, JSONObjectGeneratorWithContext<T> generator, Context context) throws JSONException {
|
|
120
107
|
JSONArray result = new JSONArray();
|
|
121
|
-
if(list == null) return result;
|
|
108
|
+
if (list == null) return result;
|
|
122
109
|
for (T t : list)
|
|
123
110
|
if (t != null)
|
|
124
111
|
result.put(generator.generateJSONObject(t, context));
|
|
@@ -128,7 +115,7 @@ class JSONConstructor {
|
|
|
128
115
|
|
|
129
116
|
static <T> JSONArray generateArray(T[] array) throws JSONException {
|
|
130
117
|
JSONArray result = new JSONArray();
|
|
131
|
-
if(array == null) return result;
|
|
118
|
+
if (array == null) return result;
|
|
132
119
|
for (int i = 0; i < array.length; i++)
|
|
133
120
|
result.put(i, array[i]);
|
|
134
121
|
|
|
@@ -137,88 +124,25 @@ class JSONConstructor {
|
|
|
137
124
|
|
|
138
125
|
static <T> JSONArray generateArray(T[] array, JSONObjectGenerator<T> generator) throws JSONException {
|
|
139
126
|
JSONArray result = new JSONArray();
|
|
140
|
-
if(array == null) return result;
|
|
127
|
+
if (array == null) return result;
|
|
141
128
|
for (int i = 0; i < array.length; i++)
|
|
142
129
|
result.put(i, generator.generateJSONObject(array[i]));
|
|
143
130
|
|
|
144
131
|
return result;
|
|
145
132
|
}
|
|
146
133
|
|
|
147
|
-
static <T> JSONArray generateArray(T[] array, StringGenerator<T> generator) throws JSONException {
|
|
148
|
-
JSONArray result = new JSONArray();
|
|
149
|
-
if(array == null) return result;
|
|
150
|
-
for (int i = 0; i < array.length; i++)
|
|
151
|
-
result.put(i, generator.generateString(array[i]));
|
|
152
|
-
|
|
153
|
-
return result;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
static <T> JSONArray generateArray(T[] array, JSONObjectGeneratorWithContext<T> generator, Context context) throws JSONException {
|
|
157
|
-
JSONArray result = new JSONArray();
|
|
158
|
-
if(array == null) return result;
|
|
159
|
-
for (int i = 0; i < array.length; i++)
|
|
160
|
-
result.put(i, generator.generateJSONObject(array[i], context));
|
|
161
|
-
|
|
162
|
-
return result;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
134
|
static <T, V> JSONObject generateMap(Map<T, V> map) throws JSONException {
|
|
166
135
|
JSONObject result = new JSONObject();
|
|
167
|
-
if(map == null) return result;
|
|
136
|
+
if (map == null) return result;
|
|
168
137
|
for (Map.Entry<T, V> entry : map.entrySet())
|
|
169
138
|
if (entry != null)
|
|
170
139
|
result.put(entry.getKey().toString(), entry.getValue());
|
|
171
140
|
return result;
|
|
172
141
|
}
|
|
173
142
|
|
|
174
|
-
static <T, V> JSONObject generateMap(Map<T, V> map, JSONObjectGenerator<V> generator) throws JSONException {
|
|
175
|
-
JSONObject result = new JSONObject();
|
|
176
|
-
if(map == null) return result;
|
|
177
|
-
for (Map.Entry<T, V> entry : map.entrySet())
|
|
178
|
-
if (entry != null)
|
|
179
|
-
result.put(entry.getKey().toString(), generator.generateJSONObject(entry.getValue()));
|
|
180
|
-
return result;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
static <T, V> JSONObject generateMap(Map<T, V> map, StringGenerator<V> generator) throws JSONException {
|
|
184
|
-
JSONObject result = new JSONObject();
|
|
185
|
-
if(map == null) return result;
|
|
186
|
-
for (Map.Entry<T, V> entry : map.entrySet())
|
|
187
|
-
if (entry != null)
|
|
188
|
-
result.put(entry.getKey().toString(), generator.generateString(entry.getValue()));
|
|
189
|
-
return result;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
static <T, V> JSONObject generateMap(Map<T, V> map, JSONObjectGeneratorWithContext<V> generator, Context context) throws JSONException {
|
|
193
|
-
JSONObject result = new JSONObject();
|
|
194
|
-
if(map == null) return result;
|
|
195
|
-
for (Map.Entry<T, V> entry : map.entrySet())
|
|
196
|
-
if (entry != null)
|
|
197
|
-
result.put(entry.getKey().toString(), generator.generateJSONObject(entry.getValue(), context));
|
|
198
|
-
return result;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
143
|
static JSONArray generateIntArray(int[] array) throws JSONException {
|
|
202
144
|
JSONArray result = new JSONArray();
|
|
203
|
-
if(array == null) return result;
|
|
204
|
-
for (int i = 0; i < array.length; i++)
|
|
205
|
-
result.put(i, array[i]);
|
|
206
|
-
|
|
207
|
-
return result;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
static JSONArray generateBooleanArray(boolean[] array) throws JSONException {
|
|
211
|
-
JSONArray result = new JSONArray();
|
|
212
|
-
if(array == null) return result;
|
|
213
|
-
for (int i = 0; i < array.length; i++)
|
|
214
|
-
result.put(i, array[i]);
|
|
215
|
-
|
|
216
|
-
return result;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
static JSONArray generateDoubleArray(double[] array) throws JSONException {
|
|
220
|
-
JSONArray result = new JSONArray();
|
|
221
|
-
if(array == null) return result;
|
|
145
|
+
if (array == null) return result;
|
|
222
146
|
for (int i = 0; i < array.length; i++)
|
|
223
147
|
result.put(i, array[i]);
|
|
224
148
|
|
|
@@ -227,7 +151,7 @@ class JSONConstructor {
|
|
|
227
151
|
|
|
228
152
|
static JSONArray generateByteArray(byte[] array) throws JSONException {
|
|
229
153
|
JSONArray result = new JSONArray();
|
|
230
|
-
if(array == null) return result;
|
|
154
|
+
if (array == null) return result;
|
|
231
155
|
for (int i = 0; i < array.length; i++)
|
|
232
156
|
result.put(i, array[i]);
|
|
233
157
|
|
|
@@ -236,33 +160,13 @@ class JSONConstructor {
|
|
|
236
160
|
|
|
237
161
|
static JSONArray generateLongArray(long[] array) throws JSONException {
|
|
238
162
|
JSONArray result = new JSONArray();
|
|
239
|
-
if(array == null) return result;
|
|
163
|
+
if (array == null) return result;
|
|
240
164
|
for (int i = 0; i < array.length; i++)
|
|
241
165
|
result.put(i, array[i]);
|
|
242
166
|
|
|
243
167
|
return result;
|
|
244
168
|
}
|
|
245
169
|
|
|
246
|
-
static String generateBitmap(Bitmap bitmap) {
|
|
247
|
-
if (bitmap == null) return "";
|
|
248
|
-
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
|
249
|
-
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream);
|
|
250
|
-
byte[] byteArray = byteArrayOutputStream.toByteArray();
|
|
251
|
-
|
|
252
|
-
return Base64.encodeToString(byteArray, Base64.DEFAULT);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
static Bitmap BitmapFromJSON(String base64) {
|
|
256
|
-
byte[] decodedString = Base64.decode(base64, Base64.DEFAULT);
|
|
257
|
-
BitmapFactory.Options options = new BitmapFactory.Options();
|
|
258
|
-
options.inPreferredConfig = Bitmap.Config.RGB_565;
|
|
259
|
-
Bitmap result = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length, options);
|
|
260
|
-
int sizeMultiplier = result.getByteCount() / 5000000;
|
|
261
|
-
if (result.getByteCount() > 5000000)
|
|
262
|
-
result = Bitmap.createScaledBitmap(result, result.getWidth() / (int) Math.sqrt(sizeMultiplier), result.getHeight() / (int) Math.sqrt(sizeMultiplier), false);
|
|
263
|
-
return result;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
170
|
static JSONObject generateVideoEncoderCompletion(String sessionId, java.io.File file) {
|
|
267
171
|
JSONObject result = new JSONObject();
|
|
268
172
|
|
|
@@ -307,8 +211,8 @@ class JSONConstructor {
|
|
|
307
211
|
JSONObject result = new JSONObject();
|
|
308
212
|
try {
|
|
309
213
|
result.put("notification", notification);
|
|
310
|
-
if(value != null)
|
|
311
|
-
|
|
214
|
+
if (value != null)
|
|
215
|
+
result.put("value", value.get(RFID_EXTRA_ERROR_CODE));
|
|
312
216
|
} catch (JSONException ignored) {
|
|
313
217
|
}
|
|
314
218
|
|
|
@@ -332,16 +236,6 @@ class JSONConstructor {
|
|
|
332
236
|
return new JSONObject();
|
|
333
237
|
}
|
|
334
238
|
|
|
335
|
-
static DocumentReaderNotification DocumentReaderNotificationFromJSON(JSONObject jsonObject) {
|
|
336
|
-
DocumentReaderNotification result = new DocumentReaderNotification();
|
|
337
|
-
try {
|
|
338
|
-
if (jsonObject.has("value"))
|
|
339
|
-
result.value = jsonObject.getInt("value");
|
|
340
|
-
} catch (JSONException ignored) {
|
|
341
|
-
}
|
|
342
|
-
return result;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
239
|
static TccParams TCCParamsFromJSON(JSONObject input) {
|
|
346
240
|
TccParams result = new TccParams();
|
|
347
241
|
try {
|
|
@@ -361,22 +255,45 @@ class JSONConstructor {
|
|
|
361
255
|
return result;
|
|
362
256
|
}
|
|
363
257
|
|
|
258
|
+
static DocReaderConfig DocReaderConfigFromJSON(JSONObject input) {
|
|
259
|
+
DocReaderConfig result;
|
|
260
|
+
byte[] license;
|
|
261
|
+
try {
|
|
262
|
+
if (input.has("license")) {
|
|
263
|
+
license = Base64.decode(input.getString("license"), Base64.DEFAULT);
|
|
264
|
+
result = new DocReaderConfig(license);
|
|
265
|
+
} else return null;
|
|
266
|
+
if (input.has("customDb"))
|
|
267
|
+
result = new DocReaderConfig(license, Base64.decode(input.getString("customDb"), Base64.DEFAULT));
|
|
268
|
+
if (input.has("licenseUpdate"))
|
|
269
|
+
result.setLicenseUpdate(input.getBoolean("licenseUpdate"));
|
|
270
|
+
if (input.has("delayedNNLoad"))
|
|
271
|
+
result.setDelayedNNLoad(input.getBoolean("delayedNNLoad"));
|
|
272
|
+
if (input.has("blackList"))
|
|
273
|
+
result.setBlackList(input.getJSONObject("blackList"));
|
|
274
|
+
|
|
275
|
+
return result;
|
|
276
|
+
} catch (JSONException e) {
|
|
277
|
+
e.printStackTrace();
|
|
278
|
+
}
|
|
279
|
+
return null;
|
|
280
|
+
}
|
|
281
|
+
|
|
364
282
|
static ImageInputData ImageInputDataFromJSON(JSONObject input) {
|
|
365
|
-
ImageInputData result =
|
|
283
|
+
ImageInputData result = null;
|
|
366
284
|
int pageIndex = 0;
|
|
367
285
|
int light = 6;
|
|
368
|
-
int type = 254;
|
|
369
286
|
int width = 0;
|
|
370
287
|
int height = 0;
|
|
371
288
|
Bitmap bitmap;
|
|
372
289
|
byte[] imgBytes;
|
|
373
290
|
|
|
374
291
|
try {
|
|
375
|
-
if(input.has("pageIndex"))
|
|
292
|
+
if (input.has("pageIndex"))
|
|
376
293
|
pageIndex = input.optInt("pageIndex");
|
|
377
|
-
if(input.has("light"))
|
|
294
|
+
if (input.has("light"))
|
|
378
295
|
pageIndex = input.optInt("light");
|
|
379
|
-
if(input.has("type"))
|
|
296
|
+
if (input.has("type"))
|
|
380
297
|
pageIndex = input.optInt("type");
|
|
381
298
|
if (input.has("bitmap")) {
|
|
382
299
|
bitmap = Helpers.bitmapFromBase64(input.getString("bitmap"));
|
|
@@ -397,19 +314,11 @@ class JSONConstructor {
|
|
|
397
314
|
return result;
|
|
398
315
|
}
|
|
399
316
|
|
|
400
|
-
static Throwable ThrowableFromJSON(JSONObject jsonObject) {
|
|
401
|
-
return new Throwable();
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
static StackTraceElement StackTraceElementFromJSON(JSONObject jsonObject) {
|
|
405
|
-
return null;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
317
|
// To JSON
|
|
409
318
|
|
|
410
319
|
static JSONObject generateDocumentReaderScenario(DocumentReaderScenario input) {
|
|
411
320
|
JSONObject result = new JSONObject();
|
|
412
|
-
if (input == null) return
|
|
321
|
+
if (input == null) return null;
|
|
413
322
|
try {
|
|
414
323
|
result.put("name", input.name);
|
|
415
324
|
result.put("caption", input.caption);
|
|
@@ -422,7 +331,7 @@ class JSONConstructor {
|
|
|
422
331
|
|
|
423
332
|
static JSONObject generateCoreDetailedScenario(CoreDetailedScenario input) {
|
|
424
333
|
JSONObject result = new JSONObject();
|
|
425
|
-
if (input == null) return
|
|
334
|
+
if (input == null) return null;
|
|
426
335
|
try {
|
|
427
336
|
result.put("uvTorch", input.uvTorch);
|
|
428
337
|
result.put("frameOrientation", input.frameOrientation);
|
|
@@ -445,7 +354,7 @@ class JSONConstructor {
|
|
|
445
354
|
|
|
446
355
|
static JSONObject generateFaceMetaData(FaceMetaData input) {
|
|
447
356
|
JSONObject result = new JSONObject();
|
|
448
|
-
if (input == null) return
|
|
357
|
+
if (input == null) return null;
|
|
449
358
|
try {
|
|
450
359
|
result.put("ID", input.ID);
|
|
451
360
|
result.put("rollAngle", input.rollAngle);
|
|
@@ -458,7 +367,7 @@ class JSONConstructor {
|
|
|
458
367
|
|
|
459
368
|
static JSONObject generateBounds(Bounds input) {
|
|
460
369
|
JSONObject result = new JSONObject();
|
|
461
|
-
if (input == null) return
|
|
370
|
+
if (input == null) return null;
|
|
462
371
|
try {
|
|
463
372
|
result.put("x", input.x);
|
|
464
373
|
result.put("y", input.y);
|
|
@@ -472,7 +381,7 @@ class JSONConstructor {
|
|
|
472
381
|
|
|
473
382
|
static JSONObject generateRect(Rect input) {
|
|
474
383
|
JSONObject result = new JSONObject();
|
|
475
|
-
if (input == null) return
|
|
384
|
+
if (input == null) return null;
|
|
476
385
|
try {
|
|
477
386
|
result.put("bottom", input.bottom);
|
|
478
387
|
result.put("top", input.top);
|
|
@@ -486,7 +395,7 @@ class JSONConstructor {
|
|
|
486
395
|
|
|
487
396
|
static JSONObject generateDocReaderFieldRect(DocReaderFieldRect input) {
|
|
488
397
|
JSONObject result = new JSONObject();
|
|
489
|
-
if (input == null) return
|
|
398
|
+
if (input == null) return null;
|
|
490
399
|
try {
|
|
491
400
|
result.put("bottom", input.bottom);
|
|
492
401
|
result.put("top", input.top);
|
|
@@ -500,7 +409,7 @@ class JSONConstructor {
|
|
|
500
409
|
|
|
501
410
|
static JSONObject generateDocumentReaderGraphicField(DocumentReaderGraphicField input, Context context) {
|
|
502
411
|
JSONObject result = new JSONObject();
|
|
503
|
-
if (input == null) return
|
|
412
|
+
if (input == null) return null;
|
|
504
413
|
try {
|
|
505
414
|
result.put("sourceType", input.sourceType);
|
|
506
415
|
result.put("fieldType", input.fieldType);
|
|
@@ -518,7 +427,7 @@ class JSONConstructor {
|
|
|
518
427
|
|
|
519
428
|
static JSONObject generateDocumentReaderGraphicResult(DocumentReaderGraphicResult input, Context context) {
|
|
520
429
|
JSONObject result = new JSONObject();
|
|
521
|
-
if (input == null) return
|
|
430
|
+
if (input == null) return null;
|
|
522
431
|
try {
|
|
523
432
|
result.put("fields", generateList(input.fields, JSONConstructor::generateDocumentReaderGraphicField, context));
|
|
524
433
|
} catch (JSONException e) {
|
|
@@ -527,9 +436,9 @@ class JSONConstructor {
|
|
|
527
436
|
return result;
|
|
528
437
|
}
|
|
529
438
|
|
|
530
|
-
static JSONObject generateDocumentReaderValue(DocumentReaderValue input) {
|
|
439
|
+
static JSONObject generateDocumentReaderValue(DocumentReaderValue input, Context context) {
|
|
531
440
|
JSONObject result = new JSONObject();
|
|
532
|
-
if (input == null) return
|
|
441
|
+
if (input == null) return null;
|
|
533
442
|
try {
|
|
534
443
|
result.put("pageIndex", input.pageIndex);
|
|
535
444
|
result.put("sourceType", input.sourceType);
|
|
@@ -539,6 +448,8 @@ class JSONConstructor {
|
|
|
539
448
|
result.put("originalValue", input.originalValue);
|
|
540
449
|
result.put("boundRect", generateRect(input.boundRect));
|
|
541
450
|
result.put("comparison", generateMap(input.comparison));
|
|
451
|
+
result.put("originalSymbols", generateList(input.originalSymbols, JSONConstructor::generateDocumentReaderSymbol));
|
|
452
|
+
result.put("rfidOrigin", generateDocumentReaderRfidOrigin(input.rfidOrigin));
|
|
542
453
|
} catch (JSONException e) {
|
|
543
454
|
e.printStackTrace();
|
|
544
455
|
}
|
|
@@ -547,15 +458,18 @@ class JSONConstructor {
|
|
|
547
458
|
|
|
548
459
|
static JSONObject generateDocumentReaderTextField(DocumentReaderTextField input, Context context) {
|
|
549
460
|
JSONObject result = new JSONObject();
|
|
550
|
-
if (input == null) return
|
|
461
|
+
if (input == null) return null;
|
|
551
462
|
try {
|
|
552
463
|
result.put("fieldType", input.fieldType);
|
|
553
464
|
result.put("lcid", input.lcid);
|
|
554
465
|
result.put("status", input.status);
|
|
555
466
|
result.put("lcidName", input.getLcidName(context));
|
|
556
467
|
result.put("fieldName", input.getFieldName(context));
|
|
557
|
-
result.put("value",
|
|
558
|
-
result.put("
|
|
468
|
+
result.put("value", input.value);
|
|
469
|
+
result.put("getValue", generateDocumentReaderValue(input.value(), context));
|
|
470
|
+
result.put("values", generateList(input.values, JSONConstructor::generateDocumentReaderValue, context));
|
|
471
|
+
result.put("comparisonList", generateList(input.comparisonList, JSONConstructor::generateDocumentReaderComparison));
|
|
472
|
+
result.put("validityList", generateList(input.validityList, JSONConstructor::generateDocumentReaderValidity));
|
|
559
473
|
} catch (JSONException e) {
|
|
560
474
|
e.printStackTrace();
|
|
561
475
|
}
|
|
@@ -564,9 +478,12 @@ class JSONConstructor {
|
|
|
564
478
|
|
|
565
479
|
static JSONObject generateDocumentReaderTextResult(DocumentReaderTextResult input, Context context) {
|
|
566
480
|
JSONObject result = new JSONObject();
|
|
567
|
-
if (input == null) return
|
|
481
|
+
if (input == null) return null;
|
|
568
482
|
try {
|
|
569
483
|
result.put("status", input.status);
|
|
484
|
+
result.put("comparisonStatus", input.comparisonStatus);
|
|
485
|
+
result.put("validityStatus", input.validityStatus);
|
|
486
|
+
result.put("availableSourceList", generateList(input.availableSourceList, JSONConstructor::generateDocumentReaderTextSource));
|
|
570
487
|
result.put("fields", generateList(input.fields, JSONConstructor::generateDocumentReaderTextField, context));
|
|
571
488
|
} catch (JSONException e) {
|
|
572
489
|
e.printStackTrace();
|
|
@@ -576,7 +493,7 @@ class JSONConstructor {
|
|
|
576
493
|
|
|
577
494
|
static JSONObject generateCoordinate(Coordinate input) {
|
|
578
495
|
JSONObject result = new JSONObject();
|
|
579
|
-
if (input == null) return
|
|
496
|
+
if (input == null) return null;
|
|
580
497
|
try {
|
|
581
498
|
result.put("x", input.x);
|
|
582
499
|
result.put("y", input.y);
|
|
@@ -588,7 +505,7 @@ class JSONConstructor {
|
|
|
588
505
|
|
|
589
506
|
static JSONObject generateElementPosition(ElementPosition input) {
|
|
590
507
|
JSONObject result = new JSONObject();
|
|
591
|
-
if (input == null) return
|
|
508
|
+
if (input == null) return null;
|
|
592
509
|
try {
|
|
593
510
|
result.put("docFormat", input.docFormat);
|
|
594
511
|
result.put("width", input.width);
|
|
@@ -614,7 +531,7 @@ class JSONConstructor {
|
|
|
614
531
|
|
|
615
532
|
static JSONObject generateImageQuality(ImageQuality input) {
|
|
616
533
|
JSONObject result = new JSONObject();
|
|
617
|
-
if (input == null) return
|
|
534
|
+
if (input == null) return null;
|
|
618
535
|
try {
|
|
619
536
|
result.put("featureType", input.featureType);
|
|
620
537
|
result.put("result", input.result);
|
|
@@ -627,7 +544,7 @@ class JSONConstructor {
|
|
|
627
544
|
|
|
628
545
|
static JSONObject generateImageQualityGroup(ImageQualityGroup input) {
|
|
629
546
|
JSONObject result = new JSONObject();
|
|
630
|
-
if (input == null) return
|
|
547
|
+
if (input == null) return null;
|
|
631
548
|
try {
|
|
632
549
|
result.put("count", input.count);
|
|
633
550
|
result.put("result", input.result);
|
|
@@ -641,7 +558,7 @@ class JSONConstructor {
|
|
|
641
558
|
|
|
642
559
|
static JSONObject generateDocumentReaderDocumentType(DocumentReaderDocumentType input) {
|
|
643
560
|
JSONObject result = new JSONObject();
|
|
644
|
-
if (input == null) return
|
|
561
|
+
if (input == null) return null;
|
|
645
562
|
try {
|
|
646
563
|
result.put("pageIndex", input.pageIndex);
|
|
647
564
|
result.put("documentID", input.documentID);
|
|
@@ -662,7 +579,7 @@ class JSONConstructor {
|
|
|
662
579
|
|
|
663
580
|
static JSONObject generateDocumentReaderNotification(DocumentReaderNotification input) {
|
|
664
581
|
JSONObject result = new JSONObject();
|
|
665
|
-
if (input == null) return
|
|
582
|
+
if (input == null) return null;
|
|
666
583
|
try {
|
|
667
584
|
result.put("code", input.getNotificationCode());
|
|
668
585
|
result.put("attachment", input.getDataFileType());
|
|
@@ -675,7 +592,7 @@ class JSONConstructor {
|
|
|
675
592
|
|
|
676
593
|
static JSONObject generateAccessControlProcedureType(AccessControlProcedureType input) {
|
|
677
594
|
JSONObject result = new JSONObject();
|
|
678
|
-
if (input == null) return
|
|
595
|
+
if (input == null) return null;
|
|
679
596
|
try {
|
|
680
597
|
result.put("activeOptionIdx", input.activeOptionIdx);
|
|
681
598
|
result.put("type", input.type);
|
|
@@ -689,7 +606,7 @@ class JSONConstructor {
|
|
|
689
606
|
|
|
690
607
|
static JSONObject generateFileData(FileData input) {
|
|
691
608
|
JSONObject result = new JSONObject();
|
|
692
|
-
if (input == null) return
|
|
609
|
+
if (input == null) return null;
|
|
693
610
|
try {
|
|
694
611
|
result.put("length", input.length);
|
|
695
612
|
result.put("type", input.type);
|
|
@@ -703,7 +620,7 @@ class JSONConstructor {
|
|
|
703
620
|
|
|
704
621
|
static JSONObject generateCertificateData(CertificateData input) {
|
|
705
622
|
JSONObject result = new JSONObject();
|
|
706
|
-
if (input == null) return
|
|
623
|
+
if (input == null) return null;
|
|
707
624
|
try {
|
|
708
625
|
result.put("length", input.length);
|
|
709
626
|
result.put("data", input.data);
|
|
@@ -715,7 +632,7 @@ class JSONConstructor {
|
|
|
715
632
|
|
|
716
633
|
static JSONObject generateSecurityObjectCertificates(SecurityObjectCertificates input) {
|
|
717
634
|
JSONObject result = new JSONObject();
|
|
718
|
-
if (input == null) return
|
|
635
|
+
if (input == null) return null;
|
|
719
636
|
try {
|
|
720
637
|
result.put("securityObject", generateCertificateData(input.securityObject));
|
|
721
638
|
} catch (JSONException e) {
|
|
@@ -726,7 +643,7 @@ class JSONConstructor {
|
|
|
726
643
|
|
|
727
644
|
static JSONObject generateFile(File input) {
|
|
728
645
|
JSONObject result = new JSONObject();
|
|
729
|
-
if (input == null) return
|
|
646
|
+
if (input == null) return null;
|
|
730
647
|
try {
|
|
731
648
|
result.put("readingTime", input.readingTime);
|
|
732
649
|
result.put("type", input.type);
|
|
@@ -747,7 +664,7 @@ class JSONConstructor {
|
|
|
747
664
|
|
|
748
665
|
static JSONObject generateApplication(Application input) {
|
|
749
666
|
JSONObject result = new JSONObject();
|
|
750
|
-
if (input == null) return
|
|
667
|
+
if (input == null) return null;
|
|
751
668
|
try {
|
|
752
669
|
result.put("type", input.type);
|
|
753
670
|
result.put("status", input.status);
|
|
@@ -764,7 +681,7 @@ class JSONConstructor {
|
|
|
764
681
|
|
|
765
682
|
static JSONObject generateValue(Value input) {
|
|
766
683
|
JSONObject result = new JSONObject();
|
|
767
|
-
if (input == null) return
|
|
684
|
+
if (input == null) return null;
|
|
768
685
|
try {
|
|
769
686
|
result.put("length", input.length);
|
|
770
687
|
result.put("type", input.type);
|
|
@@ -779,7 +696,7 @@ class JSONConstructor {
|
|
|
779
696
|
|
|
780
697
|
static JSONObject generateAttribute(Attribute input) {
|
|
781
698
|
JSONObject result = new JSONObject();
|
|
782
|
-
if (input == null) return
|
|
699
|
+
if (input == null) return null;
|
|
783
700
|
try {
|
|
784
701
|
result.put("type", input.type);
|
|
785
702
|
result.put("value", generateValue(input.value));
|
|
@@ -791,7 +708,7 @@ class JSONConstructor {
|
|
|
791
708
|
|
|
792
709
|
static JSONObject generateAuthority(Authority input) {
|
|
793
710
|
JSONObject result = new JSONObject();
|
|
794
|
-
if (input == null) return
|
|
711
|
+
if (input == null) return null;
|
|
795
712
|
try {
|
|
796
713
|
result.put("data", input.data);
|
|
797
714
|
result.put("friendlyName", generateValue(input.friendlyName));
|
|
@@ -804,7 +721,7 @@ class JSONConstructor {
|
|
|
804
721
|
|
|
805
722
|
static JSONObject generateExtension(Extension input) {
|
|
806
723
|
JSONObject result = new JSONObject();
|
|
807
|
-
if (input == null) return
|
|
724
|
+
if (input == null) return null;
|
|
808
725
|
try {
|
|
809
726
|
result.put("data", input.data);
|
|
810
727
|
result.put("type", input.type);
|
|
@@ -816,7 +733,7 @@ class JSONConstructor {
|
|
|
816
733
|
|
|
817
734
|
static JSONObject generateValidity(Validity input) {
|
|
818
735
|
JSONObject result = new JSONObject();
|
|
819
|
-
if (input == null) return
|
|
736
|
+
if (input == null) return null;
|
|
820
737
|
try {
|
|
821
738
|
result.put("notAfter", generateValue(input.notAfter));
|
|
822
739
|
result.put("notBefore", generateValue(input.notBefore));
|
|
@@ -828,7 +745,7 @@ class JSONConstructor {
|
|
|
828
745
|
|
|
829
746
|
static JSONObject generateCertificateChain(CertificateChain input) {
|
|
830
747
|
JSONObject result = new JSONObject();
|
|
831
|
-
if (input == null) return
|
|
748
|
+
if (input == null) return null;
|
|
832
749
|
try {
|
|
833
750
|
result.put("origin", input.origin);
|
|
834
751
|
result.put("type", input.type);
|
|
@@ -851,7 +768,7 @@ class JSONConstructor {
|
|
|
851
768
|
|
|
852
769
|
static JSONObject generateSignerInfo(SignerInfo input) {
|
|
853
770
|
JSONObject result = new JSONObject();
|
|
854
|
-
if (input == null) return
|
|
771
|
+
if (input == null) return null;
|
|
855
772
|
try {
|
|
856
773
|
result.put("version", input.version);
|
|
857
774
|
result.put("paStatus", input.paStatus);
|
|
@@ -873,7 +790,7 @@ class JSONConstructor {
|
|
|
873
790
|
|
|
874
791
|
static JSONObject generateSecurityObject(SecurityObject input) {
|
|
875
792
|
JSONObject result = new JSONObject();
|
|
876
|
-
if (input == null) return
|
|
793
|
+
if (input == null) return null;
|
|
877
794
|
try {
|
|
878
795
|
result.put("fileReference", input.fileReference);
|
|
879
796
|
result.put("version", input.version);
|
|
@@ -888,7 +805,7 @@ class JSONConstructor {
|
|
|
888
805
|
|
|
889
806
|
static JSONObject generateCardProperties(CardProperties input) {
|
|
890
807
|
JSONObject result = new JSONObject();
|
|
891
|
-
if (input == null) return
|
|
808
|
+
if (input == null) return null;
|
|
892
809
|
try {
|
|
893
810
|
result.put("aTQA", input.aTQA);
|
|
894
811
|
result.put("bitRateR", input.bitRateR);
|
|
@@ -912,7 +829,7 @@ class JSONConstructor {
|
|
|
912
829
|
|
|
913
830
|
static JSONObject generateRFIDSessionData(RFIDSessionData input) {
|
|
914
831
|
JSONObject result = new JSONObject();
|
|
915
|
-
if (input == null) return
|
|
832
|
+
if (input == null) return null;
|
|
916
833
|
try {
|
|
917
834
|
result.put("totalBytesReceived", input.totalBytesReceived);
|
|
918
835
|
result.put("totalBytesSent", input.totalBytesSent);
|
|
@@ -920,7 +837,6 @@ class JSONConstructor {
|
|
|
920
837
|
result.put("extLeSupport", input.extLeSupport);
|
|
921
838
|
result.put("processTime", input.processTime);
|
|
922
839
|
result.put("cardProperties", generateCardProperties(input.cardProperties));
|
|
923
|
-
result.put("sessionDataStatus", generateRFIDSessionDataStatus(input.sessionDataStatus));
|
|
924
840
|
result.put("accessControls", generateList(input.accessControls, JSONConstructor::generateAccessControlProcedureType));
|
|
925
841
|
result.put("applications", generateList(input.applications, JSONConstructor::generateApplication));
|
|
926
842
|
result.put("securityObjects", generateList(input.securityObjects, JSONConstructor::generateSecurityObject));
|
|
@@ -932,7 +848,7 @@ class JSONConstructor {
|
|
|
932
848
|
|
|
933
849
|
static JSONObject generateDocumentReaderAuthenticityCheck(DocumentReaderAuthenticityCheck input, Context context) {
|
|
934
850
|
JSONObject result = new JSONObject();
|
|
935
|
-
if (input == null) return
|
|
851
|
+
if (input == null) return null;
|
|
936
852
|
try {
|
|
937
853
|
result.put("type", input.type);
|
|
938
854
|
result.put("status", input.getStatus());
|
|
@@ -947,7 +863,7 @@ class JSONConstructor {
|
|
|
947
863
|
|
|
948
864
|
static JSONObject generatePDF417Info(PDF417Info input) {
|
|
949
865
|
JSONObject result = new JSONObject();
|
|
950
|
-
if (input == null) return
|
|
866
|
+
if (input == null) return null;
|
|
951
867
|
try {
|
|
952
868
|
result.put("errorLevel", input.errorLevel);
|
|
953
869
|
result.put("columns", input.columns);
|
|
@@ -958,26 +874,9 @@ class JSONConstructor {
|
|
|
958
874
|
return result;
|
|
959
875
|
}
|
|
960
876
|
|
|
961
|
-
static JSONObject generateRFIDSessionDataStatus(RFIDSessionDataStatus input) {
|
|
962
|
-
JSONObject result = new JSONObject();
|
|
963
|
-
if (input == null) return result;
|
|
964
|
-
try {
|
|
965
|
-
result.put("AA", input.AA);
|
|
966
|
-
result.put("BAC", input.BAC);
|
|
967
|
-
result.put("CA", input.CA);
|
|
968
|
-
result.put("PA", input.PA);
|
|
969
|
-
result.put("PACE", input.PACE);
|
|
970
|
-
result.put("TA", input.TA);
|
|
971
|
-
result.put("overallStatus", input.overallStatus);
|
|
972
|
-
} catch (JSONException e) {
|
|
973
|
-
e.printStackTrace();
|
|
974
|
-
}
|
|
975
|
-
return result;
|
|
976
|
-
}
|
|
977
|
-
|
|
978
877
|
static JSONObject generateDocumentReaderBarcodeResult(DocumentReaderBarcodeResult input) {
|
|
979
878
|
JSONObject result = new JSONObject();
|
|
980
|
-
if (input == null) return
|
|
879
|
+
if (input == null) return null;
|
|
981
880
|
try {
|
|
982
881
|
result.put("fields", generateList(input.fields, JSONConstructor::generateDocumentReaderBarcodeField));
|
|
983
882
|
} catch (JSONException e) {
|
|
@@ -988,7 +887,7 @@ class JSONConstructor {
|
|
|
988
887
|
|
|
989
888
|
static JSONObject generateDocumentReaderBarcodeField(DocumentReaderBarcodeField input) {
|
|
990
889
|
JSONObject result = new JSONObject();
|
|
991
|
-
if (input == null) return
|
|
890
|
+
if (input == null) return null;
|
|
992
891
|
try {
|
|
993
892
|
result.put("barcodeType", input.barcodeType);
|
|
994
893
|
result.put("status", input.status);
|
|
@@ -1003,7 +902,7 @@ class JSONConstructor {
|
|
|
1003
902
|
|
|
1004
903
|
static JSONObject generateDocumentReaderAuthenticityResult(DocumentReaderAuthenticityResult input, Context context) {
|
|
1005
904
|
JSONObject result = new JSONObject();
|
|
1006
|
-
if (input == null) return
|
|
905
|
+
if (input == null) return null;
|
|
1007
906
|
try {
|
|
1008
907
|
result.put("status", input.getStatus());
|
|
1009
908
|
result.put("checks", generateList(input.checks, JSONConstructor::generateDocumentReaderAuthenticityCheck, context));
|
|
@@ -1015,7 +914,7 @@ class JSONConstructor {
|
|
|
1015
914
|
|
|
1016
915
|
static JSONObject generateDocumentReaderAuthenticityElement(DocumentReaderAuthenticityElement input, Context context) {
|
|
1017
916
|
JSONObject result = new JSONObject();
|
|
1018
|
-
if (input == null) return
|
|
917
|
+
if (input == null) return null;
|
|
1019
918
|
try {
|
|
1020
919
|
result.put("status", input.status);
|
|
1021
920
|
result.put("elementType", input.elementType);
|
|
@@ -1030,43 +929,10 @@ class JSONConstructor {
|
|
|
1030
929
|
|
|
1031
930
|
static JSONObject generateDocumentReaderException(DocumentReaderException input) {
|
|
1032
931
|
JSONObject result = new JSONObject();
|
|
1033
|
-
if (input == null) return
|
|
932
|
+
if (input == null) return null;
|
|
1034
933
|
try {
|
|
1035
934
|
result.put("errorCode", input.getErrorCode());
|
|
1036
|
-
result.put("localizedMessage", input.getLocalizedMessage());
|
|
1037
|
-
result.put("message", input.getMessage());
|
|
1038
|
-
result.put("string", input.toString());
|
|
1039
|
-
result.put("stackTrace", generateArray(input.getStackTrace(), JSONConstructor::generateStackTraceElement));
|
|
1040
|
-
} catch (JSONException e) {
|
|
1041
|
-
e.printStackTrace();
|
|
1042
|
-
}
|
|
1043
|
-
return result;
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
|
-
static JSONObject generateThrowable(Throwable input) {
|
|
1047
|
-
JSONObject result = new JSONObject();
|
|
1048
|
-
if (input == null) return result;
|
|
1049
|
-
try {
|
|
1050
|
-
result.put("localizedMessage", input.getLocalizedMessage());
|
|
1051
935
|
result.put("message", input.getMessage());
|
|
1052
|
-
result.put("string", input.toString());
|
|
1053
|
-
result.put("stackTrace", generateArray(input.getStackTrace(), JSONConstructor::generateStackTraceElement));
|
|
1054
|
-
} catch (JSONException e) {
|
|
1055
|
-
e.printStackTrace();
|
|
1056
|
-
}
|
|
1057
|
-
return result;
|
|
1058
|
-
}
|
|
1059
|
-
|
|
1060
|
-
static JSONObject generateStackTraceElement(StackTraceElement input) {
|
|
1061
|
-
JSONObject result = new JSONObject();
|
|
1062
|
-
if (input == null) return result;
|
|
1063
|
-
try {
|
|
1064
|
-
result.put("lineNumber", input.getLineNumber());
|
|
1065
|
-
result.put("isNativeMethod", input.isNativeMethod());
|
|
1066
|
-
result.put("className", input.getClassName());
|
|
1067
|
-
result.put("fileName", input.getFileName());
|
|
1068
|
-
result.put("methodName", input.getMethodName());
|
|
1069
|
-
result.put("string", input.toString());
|
|
1070
936
|
} catch (JSONException e) {
|
|
1071
937
|
e.printStackTrace();
|
|
1072
938
|
}
|
|
@@ -1075,7 +941,7 @@ class JSONConstructor {
|
|
|
1075
941
|
|
|
1076
942
|
static JSONObject generatePAResourcesIssuer(PAResourcesIssuer input) {
|
|
1077
943
|
JSONObject result = new JSONObject();
|
|
1078
|
-
if (input == null) return
|
|
944
|
+
if (input == null) return null;
|
|
1079
945
|
try {
|
|
1080
946
|
result.put("data", generateByteArray(input.data));
|
|
1081
947
|
result.put("friendlyName", input.friendlyName);
|
|
@@ -1088,7 +954,7 @@ class JSONConstructor {
|
|
|
1088
954
|
|
|
1089
955
|
static JSONObject generatePAAttribute(PAAttribute input) {
|
|
1090
956
|
JSONObject result = new JSONObject();
|
|
1091
|
-
if (input == null) return
|
|
957
|
+
if (input == null) return null;
|
|
1092
958
|
try {
|
|
1093
959
|
result.put("type", input.type);
|
|
1094
960
|
result.put("value", input.value);
|
|
@@ -1100,7 +966,7 @@ class JSONConstructor {
|
|
|
1100
966
|
|
|
1101
967
|
static JSONObject generateTAChallenge(TAChallenge input) {
|
|
1102
968
|
JSONObject result = new JSONObject();
|
|
1103
|
-
if (input == null) return
|
|
969
|
+
if (input == null) return null;
|
|
1104
970
|
try {
|
|
1105
971
|
result.put("data", generateByteArray(input.data));
|
|
1106
972
|
result.put("auxPCD", input.auxPCD);
|
|
@@ -1115,7 +981,7 @@ class JSONConstructor {
|
|
|
1115
981
|
|
|
1116
982
|
static JSONObject generateDocumentReaderResultsStatus(DocumentReaderResultsStatus input) {
|
|
1117
983
|
JSONObject result = new JSONObject();
|
|
1118
|
-
if (input == null) return
|
|
984
|
+
if (input == null) return null;
|
|
1119
985
|
try {
|
|
1120
986
|
result.put("overallStatus", input.getOverallStatus());
|
|
1121
987
|
result.put("optical", input.getOptical());
|
|
@@ -1132,7 +998,7 @@ class JSONConstructor {
|
|
|
1132
998
|
|
|
1133
999
|
static JSONObject generateDetailsOptical(DocumentReaderResultsStatus.DetailsOptical input) {
|
|
1134
1000
|
JSONObject result = new JSONObject();
|
|
1135
|
-
if (input == null) return
|
|
1001
|
+
if (input == null) return null;
|
|
1136
1002
|
try {
|
|
1137
1003
|
result.put("overallStatus", input.getOverallStatus());
|
|
1138
1004
|
result.put("mrz", input.getMrz());
|
|
@@ -1151,7 +1017,7 @@ class JSONConstructor {
|
|
|
1151
1017
|
|
|
1152
1018
|
static JSONObject generateDetailsRFID(DocumentReaderResultsStatus.DetailsRFID input) {
|
|
1153
1019
|
JSONObject result = new JSONObject();
|
|
1154
|
-
if (input == null) return
|
|
1020
|
+
if (input == null) return null;
|
|
1155
1021
|
try {
|
|
1156
1022
|
result.put("pa", input.getPA());
|
|
1157
1023
|
result.put("ca", input.getCA());
|
|
@@ -1168,7 +1034,7 @@ class JSONConstructor {
|
|
|
1168
1034
|
|
|
1169
1035
|
static JSONObject generateVDSNCData(VDSNCData input) {
|
|
1170
1036
|
JSONObject result = new JSONObject();
|
|
1171
|
-
if (input == null) return
|
|
1037
|
+
if (input == null) return null;
|
|
1172
1038
|
try {
|
|
1173
1039
|
result.put("type", input.getType());
|
|
1174
1040
|
result.put("version", input.getVersion());
|
|
@@ -1187,7 +1053,7 @@ class JSONConstructor {
|
|
|
1187
1053
|
|
|
1188
1054
|
static JSONObject generateBytesData(BytesData input) {
|
|
1189
1055
|
JSONObject result = new JSONObject();
|
|
1190
|
-
if (input == null) return
|
|
1056
|
+
if (input == null) return null;
|
|
1191
1057
|
try {
|
|
1192
1058
|
result.put("data", input.getData());
|
|
1193
1059
|
result.put("length", input.getLength());
|
|
@@ -1199,1201 +1065,117 @@ class JSONConstructor {
|
|
|
1199
1065
|
return result;
|
|
1200
1066
|
}
|
|
1201
1067
|
|
|
1202
|
-
static JSONObject
|
|
1068
|
+
static JSONObject generateDocReaderDocumentsDatabase(DocReaderDocumentsDatabase input) {
|
|
1203
1069
|
JSONObject result = new JSONObject();
|
|
1204
|
-
if (input == null) return
|
|
1070
|
+
if (input == null) return null;
|
|
1205
1071
|
try {
|
|
1206
|
-
result.put("
|
|
1207
|
-
result.put("
|
|
1208
|
-
result.put("
|
|
1209
|
-
result.put("
|
|
1210
|
-
result.put("
|
|
1211
|
-
result.put("
|
|
1212
|
-
result.put("colorValues", generateIntArray(input.colorValues));
|
|
1213
|
-
result.put("status", input.status);
|
|
1214
|
-
result.put("elementType", input.elementType);
|
|
1215
|
-
result.put("elementDiagnose", input.elementDiagnose);
|
|
1216
|
-
result.put("elementTypeName", input.getElementTypeName(context));
|
|
1217
|
-
result.put("elementDiagnoseName", input.getElementDiagnoseName(context));
|
|
1072
|
+
result.put("databaseID", input.databaseID);
|
|
1073
|
+
result.put("version", input.version);
|
|
1074
|
+
result.put("date", input.date);
|
|
1075
|
+
result.put("databaseDescription", input.databaseDescription);
|
|
1076
|
+
result.put("countriesNumber", input.countriesNumber);
|
|
1077
|
+
result.put("documentsNumber", input.documentsNumber);
|
|
1218
1078
|
} catch (JSONException e) {
|
|
1219
1079
|
e.printStackTrace();
|
|
1220
1080
|
}
|
|
1221
1081
|
return result;
|
|
1222
1082
|
}
|
|
1223
1083
|
|
|
1224
|
-
static JSONObject
|
|
1084
|
+
static JSONObject generateDocumentReaderComparison(DocumentReaderComparison input) {
|
|
1225
1085
|
JSONObject result = new JSONObject();
|
|
1226
|
-
if (input == null) return
|
|
1086
|
+
if (input == null) return null;
|
|
1227
1087
|
try {
|
|
1228
|
-
result.put("
|
|
1229
|
-
result.put("
|
|
1230
|
-
result.put("
|
|
1231
|
-
result.put("width", input.getWidth());
|
|
1232
|
-
result.put("height", input.getHeight());
|
|
1233
|
-
result.put("bitmap", generateBitmap(input.getBitmap()));
|
|
1234
|
-
result.put("imgBytes", generateByteArray(input.getImgBytes()));
|
|
1088
|
+
result.put("sourceTypeLeft", input.sourceTypeLeft);
|
|
1089
|
+
result.put("sourceTypeRight", input.sourceTypeRight);
|
|
1090
|
+
result.put("status", input.status);
|
|
1235
1091
|
} catch (JSONException e) {
|
|
1236
1092
|
e.printStackTrace();
|
|
1237
1093
|
}
|
|
1238
1094
|
return result;
|
|
1239
1095
|
}
|
|
1240
1096
|
|
|
1241
|
-
static JSONObject
|
|
1097
|
+
static JSONObject generateDocumentReaderRfidOrigin(DocumentReaderRfidOrigin input) {
|
|
1242
1098
|
JSONObject result = new JSONObject();
|
|
1243
|
-
if (input == null) return
|
|
1099
|
+
if (input == null) return null;
|
|
1244
1100
|
try {
|
|
1245
|
-
result.put("
|
|
1246
|
-
result.put("
|
|
1247
|
-
result.put("
|
|
1248
|
-
result.put("
|
|
1249
|
-
result.put("elapsedTimeRFID", input.elapsedTimeRFID);
|
|
1250
|
-
result.put("morePagesAvailable", input.morePagesAvailable);
|
|
1251
|
-
result.put("rfidResult", input.rfidResult);
|
|
1252
|
-
result.put("highResolution", input.highResolution);
|
|
1253
|
-
result.put("graphicResult", generateDocumentReaderGraphicResult(input.graphicResult, context));
|
|
1254
|
-
result.put("textResult", generateDocumentReaderTextResult(input.textResult, context));
|
|
1255
|
-
result.put("documentPosition", generateList(input.documentPosition, JSONConstructor::generateElementPosition));
|
|
1256
|
-
result.put("barcodePosition", generateList(input.barcodePosition, JSONConstructor::generateElementPosition));
|
|
1257
|
-
result.put("mrzPosition", generateList(input.mrzPosition, JSONConstructor::generateElementPosition));
|
|
1258
|
-
result.put("imageQuality", generateList(input.imageQuality, JSONConstructor::generateImageQualityGroup));
|
|
1259
|
-
result.put("rawResult", input.rawResult);
|
|
1260
|
-
result.put("documentReaderNotification", generateDocumentReaderNotification(input.documentReaderNotification));
|
|
1261
|
-
result.put("rfidSessionData", generateRFIDSessionData(input.rfidSessionData));
|
|
1262
|
-
result.put("authenticityResult", generateDocumentReaderAuthenticityResult(input.authenticityResult, context));
|
|
1263
|
-
result.put("barcodeResult", generateDocumentReaderBarcodeResult(input.barcodeResult));
|
|
1264
|
-
result.put("documentType", generateList(input.documentType, JSONConstructor::generateDocumentReaderDocumentType));
|
|
1265
|
-
result.put("status", generateDocumentReaderResultsStatus(input.status));
|
|
1266
|
-
result.put("vdsncData", generateVDSNCData(input.vdsncData));
|
|
1101
|
+
result.put("dg", input.dg);
|
|
1102
|
+
result.put("dgTag", input.dgTag);
|
|
1103
|
+
result.put("entryView", input.entryView);
|
|
1104
|
+
result.put("tagEntry", input.tagEntry);
|
|
1267
1105
|
} catch (JSONException e) {
|
|
1268
1106
|
e.printStackTrace();
|
|
1269
1107
|
}
|
|
1270
1108
|
return result;
|
|
1271
1109
|
}
|
|
1272
1110
|
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
try {
|
|
1277
|
-
DocumentReaderScenario result = new DocumentReaderScenario();
|
|
1278
|
-
if (input.has("name"))
|
|
1279
|
-
result.name = input.getString("name");
|
|
1280
|
-
if (input.has("caption"))
|
|
1281
|
-
result.caption = input.getString("caption");
|
|
1282
|
-
if (input.has("description"))
|
|
1283
|
-
result.description = input.getString("description");
|
|
1284
|
-
return result;
|
|
1285
|
-
} catch (JSONException e) {
|
|
1286
|
-
e.printStackTrace();
|
|
1287
|
-
}
|
|
1288
|
-
return null;
|
|
1289
|
-
}
|
|
1290
|
-
|
|
1291
|
-
static CoreDetailedScenario CoreDetailedScenarioFromJSON(JSONObject input) {
|
|
1292
|
-
try {
|
|
1293
|
-
CoreDetailedScenario result = new CoreDetailedScenario();
|
|
1294
|
-
if (input.has("uvTorch"))
|
|
1295
|
-
result.uvTorch = input.getBoolean("uvTorch");
|
|
1296
|
-
if (input.has("frameOrientation"))
|
|
1297
|
-
result.frameOrientation = input.getInt("frameOrientation");
|
|
1298
|
-
if (input.has("faceExt"))
|
|
1299
|
-
result.faceExt = input.getBoolean("faceExt");
|
|
1300
|
-
if (input.has("multiPageOff"))
|
|
1301
|
-
result.multiPageOff = input.getInt("multiPageOff");
|
|
1302
|
-
if (input.has("seriesProcessMode"))
|
|
1303
|
-
result.seriesProcessMode = input.getBoolean("seriesProcessMode");
|
|
1304
|
-
if (input.has("frameKWHLandscape"))
|
|
1305
|
-
result.frameKWHLandscape = input.getDouble("frameKWHLandscape");
|
|
1306
|
-
if (input.has("frameKWHPortrait"))
|
|
1307
|
-
result.frameKWHPortrait = input.getDouble("frameKWHPortrait");
|
|
1308
|
-
if (input.has("frameKWHDoublePageSpreadPortrait"))
|
|
1309
|
-
result.frameKWHDoublePageSpreadPortrait = input.getDouble("frameKWHDoublePageSpreadPortrait");
|
|
1310
|
-
if (input.has("frameKWHDoublePageSpreadLandscape"))
|
|
1311
|
-
result.frameKWHDoublePageSpreadLandscape = input.getDouble("frameKWHDoublePageSpreadLandscape");
|
|
1312
|
-
if (input.has("name"))
|
|
1313
|
-
result.name = input.getString("name");
|
|
1314
|
-
if (input.has("caption"))
|
|
1315
|
-
result.caption = input.getString("caption");
|
|
1316
|
-
if (input.has("description"))
|
|
1317
|
-
result.description = input.getString("description");
|
|
1318
|
-
if (input.has("manualCrop"))
|
|
1319
|
-
result.manualCrop = input.getBoolean("manualCrop");
|
|
1320
|
-
return result;
|
|
1321
|
-
} catch (JSONException e) {
|
|
1322
|
-
e.printStackTrace();
|
|
1323
|
-
}
|
|
1324
|
-
return null;
|
|
1325
|
-
}
|
|
1326
|
-
|
|
1327
|
-
static FaceMetaData FaceMetaDataFromJSON(JSONObject input) {
|
|
1328
|
-
try {
|
|
1329
|
-
FaceMetaData result = new FaceMetaData();
|
|
1330
|
-
if (input.has("ID"))
|
|
1331
|
-
result.ID = input.getInt("ID");
|
|
1332
|
-
if (input.has("rollAngle"))
|
|
1333
|
-
result.rollAngle = input.getInt("rollAngle");
|
|
1334
|
-
if (input.has("bounds"))
|
|
1335
|
-
result.bounds = BoundsFromJSON(input.getJSONObject("bounds"));
|
|
1336
|
-
return result;
|
|
1337
|
-
} catch (JSONException e) {
|
|
1338
|
-
e.printStackTrace();
|
|
1339
|
-
}
|
|
1340
|
-
return null;
|
|
1341
|
-
}
|
|
1342
|
-
|
|
1343
|
-
static Bounds BoundsFromJSON(JSONObject input) {
|
|
1344
|
-
try {
|
|
1345
|
-
Bounds result = new Bounds();
|
|
1346
|
-
if (input.has("x"))
|
|
1347
|
-
result.x = input.getInt("x");
|
|
1348
|
-
if (input.has("y"))
|
|
1349
|
-
result.y = input.getInt("y");
|
|
1350
|
-
if (input.has("width"))
|
|
1351
|
-
result.width = input.getInt("width");
|
|
1352
|
-
if (input.has("height"))
|
|
1353
|
-
result.height = input.getInt("height");
|
|
1354
|
-
return result;
|
|
1355
|
-
} catch (JSONException e) {
|
|
1356
|
-
e.printStackTrace();
|
|
1357
|
-
}
|
|
1358
|
-
return null;
|
|
1359
|
-
}
|
|
1360
|
-
|
|
1361
|
-
static Rect RectFromJSON(JSONObject input) {
|
|
1362
|
-
try {
|
|
1363
|
-
Rect result = new Rect();
|
|
1364
|
-
if (input.has("bottom"))
|
|
1365
|
-
result.bottom = input.getInt("bottom");
|
|
1366
|
-
if (input.has("top"))
|
|
1367
|
-
result.top = input.getInt("top");
|
|
1368
|
-
if (input.has("left"))
|
|
1369
|
-
result.left = input.getInt("left");
|
|
1370
|
-
if (input.has("right"))
|
|
1371
|
-
result.right = input.getInt("right");
|
|
1372
|
-
return result;
|
|
1373
|
-
} catch (JSONException e) {
|
|
1374
|
-
e.printStackTrace();
|
|
1375
|
-
}
|
|
1376
|
-
return null;
|
|
1377
|
-
}
|
|
1378
|
-
|
|
1379
|
-
static DocReaderFieldRect DocReaderFieldRectFromJSON(JSONObject input) {
|
|
1380
|
-
try {
|
|
1381
|
-
DocReaderFieldRect result = new DocReaderFieldRect();
|
|
1382
|
-
if (input.has("bottom"))
|
|
1383
|
-
result.bottom = input.getInt("bottom");
|
|
1384
|
-
if (input.has("top"))
|
|
1385
|
-
result.top = input.getInt("top");
|
|
1386
|
-
if (input.has("left"))
|
|
1387
|
-
result.left = input.getInt("left");
|
|
1388
|
-
if (input.has("right"))
|
|
1389
|
-
result.right = input.getInt("right");
|
|
1390
|
-
return result;
|
|
1391
|
-
} catch (JSONException e) {
|
|
1392
|
-
e.printStackTrace();
|
|
1393
|
-
}
|
|
1394
|
-
return null;
|
|
1395
|
-
}
|
|
1396
|
-
|
|
1397
|
-
static DocumentReaderGraphicField DocumentReaderGraphicFieldFromJSON(JSONObject input) {
|
|
1398
|
-
try {
|
|
1399
|
-
DocumentReaderGraphicField result = new DocumentReaderGraphicField();
|
|
1400
|
-
if (input.has("sourceType"))
|
|
1401
|
-
result.sourceType = input.getInt("sourceType");
|
|
1402
|
-
if (input.has("fieldType"))
|
|
1403
|
-
result.fieldType = input.getInt("fieldType");
|
|
1404
|
-
if (input.has("lightType"))
|
|
1405
|
-
result.light = input.getInt("lightType");
|
|
1406
|
-
if (input.has("pageIndex"))
|
|
1407
|
-
result.pageIndex = input.getInt("pageIndex");
|
|
1408
|
-
if (input.has("fieldRect"))
|
|
1409
|
-
result.boundRect = DocReaderFieldRectFromJSON(input.getJSONObject("fieldRect"));
|
|
1410
|
-
return result;
|
|
1411
|
-
} catch (JSONException e) {
|
|
1412
|
-
e.printStackTrace();
|
|
1413
|
-
}
|
|
1414
|
-
return null;
|
|
1415
|
-
}
|
|
1416
|
-
|
|
1417
|
-
static DocumentReaderGraphicResult DocumentReaderGraphicResultFromJSON(JSONObject input) {
|
|
1418
|
-
try {
|
|
1419
|
-
DocumentReaderGraphicResult result = new DocumentReaderGraphicResult();
|
|
1420
|
-
if (input.has("fields")){
|
|
1421
|
-
JSONArray jsonArray_fields = input.getJSONArray("fields");
|
|
1422
|
-
List<DocumentReaderGraphicField> fields = new ArrayList<>();
|
|
1423
|
-
for (int i = 0; i < jsonArray_fields.length(); i++)
|
|
1424
|
-
fields.add(DocumentReaderGraphicFieldFromJSON(jsonArray_fields.getJSONObject(i)));
|
|
1425
|
-
result.fields = fields;
|
|
1426
|
-
}
|
|
1427
|
-
return result;
|
|
1428
|
-
} catch (JSONException e) {
|
|
1429
|
-
e.printStackTrace();
|
|
1430
|
-
}
|
|
1431
|
-
return null;
|
|
1432
|
-
}
|
|
1433
|
-
|
|
1434
|
-
static DocumentReaderValue DocumentReaderValueFromJSON(JSONObject input) {
|
|
1111
|
+
static JSONObject generateDocumentReaderTextSource(DocumentReaderTextSource input) {
|
|
1112
|
+
JSONObject result = new JSONObject();
|
|
1113
|
+
if (input == null) return null;
|
|
1435
1114
|
try {
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
if (input.has("sourceType"))
|
|
1440
|
-
result.sourceType = input.getInt("sourceType");
|
|
1441
|
-
if (input.has("validity"))
|
|
1442
|
-
result.validity = input.getInt("validity");
|
|
1443
|
-
if (input.has("probability"))
|
|
1444
|
-
result.probability = input.getInt("probability");
|
|
1445
|
-
if (input.has("value"))
|
|
1446
|
-
result.value = input.getString("value");
|
|
1447
|
-
if (input.has("originalValue"))
|
|
1448
|
-
result.originalValue = input.getString("originalValue");
|
|
1449
|
-
if (input.has("boundRect"))
|
|
1450
|
-
result.boundRect = RectFromJSON(input.getJSONObject("boundRect"));
|
|
1451
|
-
return result;
|
|
1115
|
+
result.put("sourceType", input.sourceType);
|
|
1116
|
+
result.put("source", input.source);
|
|
1117
|
+
result.put("validityStatus", input.validityStatus);
|
|
1452
1118
|
} catch (JSONException e) {
|
|
1453
1119
|
e.printStackTrace();
|
|
1454
1120
|
}
|
|
1455
|
-
return
|
|
1121
|
+
return result;
|
|
1456
1122
|
}
|
|
1457
1123
|
|
|
1458
|
-
static
|
|
1124
|
+
static JSONObject generateDocumentReaderSymbol(DocumentReaderSymbol input) {
|
|
1125
|
+
JSONObject result = new JSONObject();
|
|
1126
|
+
if (input == null) return null;
|
|
1459
1127
|
try {
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
if (input.has("lcid"))
|
|
1464
|
-
result.lcid = input.getInt("lcid");
|
|
1465
|
-
if (input.has("status"))
|
|
1466
|
-
result.status = input.getInt("status");
|
|
1467
|
-
if (input.has("values")){
|
|
1468
|
-
JSONArray jsonArray_values = input.getJSONArray("values");
|
|
1469
|
-
List<DocumentReaderValue> values = new ArrayList<>();
|
|
1470
|
-
for (int i = 0; i < jsonArray_values.length(); i++)
|
|
1471
|
-
values.add(DocumentReaderValueFromJSON(jsonArray_values.getJSONObject(i)));
|
|
1472
|
-
result.values = values;
|
|
1473
|
-
}
|
|
1474
|
-
return result;
|
|
1128
|
+
result.put("code", input.code);
|
|
1129
|
+
result.put("rect", generateRect(input.rect));
|
|
1130
|
+
result.put("probability", input.probability);
|
|
1475
1131
|
} catch (JSONException e) {
|
|
1476
1132
|
e.printStackTrace();
|
|
1477
1133
|
}
|
|
1478
|
-
return
|
|
1134
|
+
return result;
|
|
1479
1135
|
}
|
|
1480
1136
|
|
|
1481
|
-
static
|
|
1137
|
+
static JSONObject generateDocumentReaderValidity(DocumentReaderValidity input) {
|
|
1138
|
+
JSONObject result = new JSONObject();
|
|
1139
|
+
if (input == null) return null;
|
|
1482
1140
|
try {
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
result.status = input.getInt("status");
|
|
1486
|
-
if (input.has("fields")){
|
|
1487
|
-
JSONArray jsonArray_fields = input.getJSONArray("fields");
|
|
1488
|
-
List<DocumentReaderTextField> fields = new ArrayList<>();
|
|
1489
|
-
for (int i = 0; i < jsonArray_fields.length(); i++)
|
|
1490
|
-
fields.add(DocumentReaderTextFieldFromJSON(jsonArray_fields.getJSONObject(i)));
|
|
1491
|
-
result.fields = fields;
|
|
1492
|
-
}
|
|
1493
|
-
return result;
|
|
1141
|
+
result.put("sourceType", input.sourceType);
|
|
1142
|
+
result.put("status", input.status);
|
|
1494
1143
|
} catch (JSONException e) {
|
|
1495
1144
|
e.printStackTrace();
|
|
1496
1145
|
}
|
|
1497
|
-
return
|
|
1146
|
+
return result;
|
|
1498
1147
|
}
|
|
1499
1148
|
|
|
1500
|
-
static
|
|
1149
|
+
static JSONObject generateDocumentReaderResults(DocumentReaderResults input, Context context) {
|
|
1150
|
+
JSONObject result = new JSONObject();
|
|
1151
|
+
if (input == null) return null;
|
|
1501
1152
|
try {
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1153
|
+
result.put("chipPage", input.chipPage);
|
|
1154
|
+
result.put("processingFinishedStatus", input.processingFinishedStatus);
|
|
1155
|
+
result.put("elapsedTime", input.elapsedTime);
|
|
1156
|
+
result.put("elapsedTimeRFID", input.elapsedTimeRFID);
|
|
1157
|
+
result.put("morePagesAvailable", input.morePagesAvailable);
|
|
1158
|
+
result.put("rfidResult", input.rfidResult);
|
|
1159
|
+
result.put("highResolution", input.highResolution);
|
|
1160
|
+
result.put("graphicResult", generateDocumentReaderGraphicResult(input.graphicResult, context));
|
|
1161
|
+
result.put("textResult", generateDocumentReaderTextResult(input.textResult, context));
|
|
1162
|
+
result.put("documentPosition", generateList(input.documentPosition, JSONConstructor::generateElementPosition));
|
|
1163
|
+
result.put("barcodePosition", generateList(input.barcodePosition, JSONConstructor::generateElementPosition));
|
|
1164
|
+
result.put("mrzPosition", generateList(input.mrzPosition, JSONConstructor::generateElementPosition));
|
|
1165
|
+
result.put("imageQuality", generateList(input.imageQuality, JSONConstructor::generateImageQualityGroup));
|
|
1166
|
+
result.put("rawResult", input.rawResult);
|
|
1167
|
+
result.put("documentReaderNotification", generateDocumentReaderNotification(input.documentReaderNotification));
|
|
1168
|
+
result.put("rfidSessionData", generateRFIDSessionData(input.rfidSessionData));
|
|
1169
|
+
result.put("authenticityResult", generateDocumentReaderAuthenticityResult(input.authenticityResult, context));
|
|
1170
|
+
result.put("barcodeResult", generateDocumentReaderBarcodeResult(input.barcodeResult));
|
|
1171
|
+
result.put("documentType", generateList(input.documentType, JSONConstructor::generateDocumentReaderDocumentType));
|
|
1172
|
+
result.put("status", generateDocumentReaderResultsStatus(input.status));
|
|
1173
|
+
result.put("vdsncData", generateVDSNCData(input.vdsncData));
|
|
1508
1174
|
} catch (JSONException e) {
|
|
1509
1175
|
e.printStackTrace();
|
|
1510
1176
|
}
|
|
1511
|
-
return
|
|
1177
|
+
return result;
|
|
1512
1178
|
}
|
|
1513
1179
|
|
|
1514
|
-
|
|
1515
|
-
try {
|
|
1516
|
-
ElementPosition result = new ElementPosition();
|
|
1517
|
-
if (input.has("docFormat"))
|
|
1518
|
-
result.docFormat = input.getInt("docFormat");
|
|
1519
|
-
if (input.has("width"))
|
|
1520
|
-
result.width = input.getInt("width");
|
|
1521
|
-
if (input.has("height"))
|
|
1522
|
-
result.height = input.getInt("height");
|
|
1523
|
-
if (input.has("dpi"))
|
|
1524
|
-
result.dpi = input.getInt("dpi");
|
|
1525
|
-
if (input.has("pageIndex"))
|
|
1526
|
-
result.pageIndex = input.getInt("pageIndex");
|
|
1527
|
-
if (input.has("inverse"))
|
|
1528
|
-
result.inverse = input.getInt("inverse");
|
|
1529
|
-
if (input.has("perspectiveTr"))
|
|
1530
|
-
result.perspectiveTr = input.getInt("perspectiveTr");
|
|
1531
|
-
if (input.has("objArea"))
|
|
1532
|
-
result.objArea = input.getInt("objArea");
|
|
1533
|
-
if (input.has("objIntAngleDev"))
|
|
1534
|
-
result.objIntAngleDev = input.getInt("objIntAngleDev");
|
|
1535
|
-
if (input.has("resultStatus"))
|
|
1536
|
-
result.resultStatus = input.getInt("resultStatus");
|
|
1537
|
-
if (input.has("angle"))
|
|
1538
|
-
result.angle = input.getDouble("angle");
|
|
1539
|
-
if (input.has("center"))
|
|
1540
|
-
result.center = CoordinateFromJSON(input.getJSONObject("center"));
|
|
1541
|
-
if (input.has("leftTop"))
|
|
1542
|
-
result.leftTop = CoordinateFromJSON(input.getJSONObject("leftTop"));
|
|
1543
|
-
if (input.has("leftBottom"))
|
|
1544
|
-
result.leftBottom = CoordinateFromJSON(input.getJSONObject("leftBottom"));
|
|
1545
|
-
if (input.has("rightTop"))
|
|
1546
|
-
result.rightTop = CoordinateFromJSON(input.getJSONObject("rightTop"));
|
|
1547
|
-
if (input.has("rightBottom"))
|
|
1548
|
-
result.rightBottom = CoordinateFromJSON(input.getJSONObject("rightBottom"));
|
|
1549
|
-
return result;
|
|
1550
|
-
} catch (JSONException e) {
|
|
1551
|
-
e.printStackTrace();
|
|
1552
|
-
}
|
|
1553
|
-
return null;
|
|
1554
|
-
}
|
|
1555
|
-
|
|
1556
|
-
static ImageQuality ImageQualityFromJSON(JSONObject input) {
|
|
1557
|
-
try {
|
|
1558
|
-
ImageQuality result = new ImageQuality();
|
|
1559
|
-
if (input.has("featureType"))
|
|
1560
|
-
result.featureType = input.getInt("featureType");
|
|
1561
|
-
if (input.has("result"))
|
|
1562
|
-
result.result = input.getInt("result");
|
|
1563
|
-
if (input.has("type"))
|
|
1564
|
-
result.type = input.getInt("type");
|
|
1565
|
-
return result;
|
|
1566
|
-
} catch (JSONException e) {
|
|
1567
|
-
e.printStackTrace();
|
|
1568
|
-
}
|
|
1569
|
-
return null;
|
|
1570
|
-
}
|
|
1571
|
-
|
|
1572
|
-
static ImageQualityGroup ImageQualityGroupFromJSON(JSONObject input) {
|
|
1573
|
-
try {
|
|
1574
|
-
ImageQualityGroup result = new ImageQualityGroup();
|
|
1575
|
-
if (input.has("count"))
|
|
1576
|
-
result.count = input.getInt("count");
|
|
1577
|
-
if (input.has("result"))
|
|
1578
|
-
result.result = input.getInt("result");
|
|
1579
|
-
if (input.has("imageQualityList")){
|
|
1580
|
-
JSONArray jsonArray_imageQualityList = input.getJSONArray("imageQualityList");
|
|
1581
|
-
List<ImageQuality> imageQualityList = new ArrayList<>();
|
|
1582
|
-
for (int i = 0; i < jsonArray_imageQualityList.length(); i++)
|
|
1583
|
-
imageQualityList.add(ImageQualityFromJSON(jsonArray_imageQualityList.getJSONObject(i)));
|
|
1584
|
-
result.imageQualityList = imageQualityList;
|
|
1585
|
-
}
|
|
1586
|
-
if (input.has("pageIndex"))
|
|
1587
|
-
result.pageIndex = input.getInt("pageIndex");
|
|
1588
|
-
return result;
|
|
1589
|
-
} catch (JSONException e) {
|
|
1590
|
-
e.printStackTrace();
|
|
1591
|
-
}
|
|
1592
|
-
return null;
|
|
1593
|
-
}
|
|
1594
|
-
|
|
1595
|
-
static DocumentReaderDocumentType DocumentReaderDocumentTypeFromJSON(JSONObject input) {
|
|
1596
|
-
try {
|
|
1597
|
-
DocumentReaderDocumentType result = new DocumentReaderDocumentType();
|
|
1598
|
-
if (input.has("pageIndex"))
|
|
1599
|
-
result.pageIndex = input.getInt("pageIndex");
|
|
1600
|
-
if (input.has("documentID"))
|
|
1601
|
-
result.documentID = input.getInt("documentID");
|
|
1602
|
-
if (input.has("dType"))
|
|
1603
|
-
result.dType = input.getInt("dType");
|
|
1604
|
-
if (input.has("dFormat"))
|
|
1605
|
-
result.dFormat = input.getInt("dFormat");
|
|
1606
|
-
if (input.has("dMRZ"))
|
|
1607
|
-
result.dMRZ = input.getBoolean("dMRZ");
|
|
1608
|
-
if (input.has("name"))
|
|
1609
|
-
result.name = input.getString("name");
|
|
1610
|
-
if (input.has("ICAOCode"))
|
|
1611
|
-
result.ICAOCode = input.getString("ICAOCode");
|
|
1612
|
-
if (input.has("dDescription"))
|
|
1613
|
-
result.dDescription = input.getString("dDescription");
|
|
1614
|
-
if (input.has("dYear"))
|
|
1615
|
-
result.dYear = input.getString("dYear");
|
|
1616
|
-
if (input.has("dCountryName"))
|
|
1617
|
-
result.dCountryName = input.getString("dCountryName");
|
|
1618
|
-
if (input.has("FDSID")){
|
|
1619
|
-
JSONArray jsonArray_FDSID = input.getJSONArray("FDSID");
|
|
1620
|
-
int[] FDSID = new int[jsonArray_FDSID.length()];
|
|
1621
|
-
for (int i = 0; i < jsonArray_FDSID.length(); i++)
|
|
1622
|
-
FDSID[i] = jsonArray_FDSID.getInt(i);
|
|
1623
|
-
result.FDSID = FDSID;
|
|
1624
|
-
}
|
|
1625
|
-
return result;
|
|
1626
|
-
} catch (JSONException e) {
|
|
1627
|
-
e.printStackTrace();
|
|
1628
|
-
}
|
|
1629
|
-
return null;
|
|
1630
|
-
}
|
|
1631
|
-
|
|
1632
|
-
static AccessControlProcedureType AccessControlProcedureTypeFromJSON(JSONObject input) {
|
|
1633
|
-
try {
|
|
1634
|
-
AccessControlProcedureType result = new AccessControlProcedureType();
|
|
1635
|
-
if (input.has("activeOptionIdx"))
|
|
1636
|
-
result.activeOptionIdx = input.getInt("activeOptionIdx");
|
|
1637
|
-
if (input.has("type"))
|
|
1638
|
-
result.type = input.getInt("type");
|
|
1639
|
-
if (input.has("status"))
|
|
1640
|
-
result.status = input.getInt("status");
|
|
1641
|
-
if (input.has("notifications")){
|
|
1642
|
-
JSONArray jsonArray_notifications = input.getJSONArray("notifications");
|
|
1643
|
-
List<Long> notifications = new ArrayList<>();
|
|
1644
|
-
for (int i = 0; i < jsonArray_notifications.length(); i++)
|
|
1645
|
-
notifications.add(jsonArray_notifications.getLong(i));
|
|
1646
|
-
result.notifications = notifications;
|
|
1647
|
-
}
|
|
1648
|
-
return result;
|
|
1649
|
-
} catch (JSONException e) {
|
|
1650
|
-
e.printStackTrace();
|
|
1651
|
-
}
|
|
1652
|
-
return null;
|
|
1653
|
-
}
|
|
1654
|
-
|
|
1655
|
-
static FileData FileDataFromJSON(JSONObject input) {
|
|
1656
|
-
try {
|
|
1657
|
-
FileData result = new FileData();
|
|
1658
|
-
if (input.has("length"))
|
|
1659
|
-
result.length = input.getInt("length");
|
|
1660
|
-
if (input.has("type"))
|
|
1661
|
-
result.type = input.getInt("type");
|
|
1662
|
-
if (input.has("status"))
|
|
1663
|
-
result.status = input.getInt("status");
|
|
1664
|
-
if (input.has("data"))
|
|
1665
|
-
result.data = input.getString("data");
|
|
1666
|
-
return result;
|
|
1667
|
-
} catch (JSONException e) {
|
|
1668
|
-
e.printStackTrace();
|
|
1669
|
-
}
|
|
1670
|
-
return null;
|
|
1671
|
-
}
|
|
1672
|
-
|
|
1673
|
-
static CertificateData CertificateDataFromJSON(JSONObject input) {
|
|
1674
|
-
try {
|
|
1675
|
-
CertificateData result = new CertificateData();
|
|
1676
|
-
if (input.has("length"))
|
|
1677
|
-
result.length = input.getInt("length");
|
|
1678
|
-
if (input.has("data"))
|
|
1679
|
-
result.data = input.getString("data");
|
|
1680
|
-
return result;
|
|
1681
|
-
} catch (JSONException e) {
|
|
1682
|
-
e.printStackTrace();
|
|
1683
|
-
}
|
|
1684
|
-
return null;
|
|
1685
|
-
}
|
|
1686
|
-
|
|
1687
|
-
static SecurityObjectCertificates SecurityObjectCertificatesFromJSON(JSONObject input) {
|
|
1688
|
-
try {
|
|
1689
|
-
SecurityObjectCertificates result = new SecurityObjectCertificates();
|
|
1690
|
-
if (input.has("securityObject"))
|
|
1691
|
-
result.securityObject = CertificateDataFromJSON(input.getJSONObject("securityObject"));
|
|
1692
|
-
return result;
|
|
1693
|
-
} catch (JSONException e) {
|
|
1694
|
-
e.printStackTrace();
|
|
1695
|
-
}
|
|
1696
|
-
return null;
|
|
1697
|
-
}
|
|
1698
|
-
|
|
1699
|
-
static File FileFromJSON(JSONObject input) {
|
|
1700
|
-
try {
|
|
1701
|
-
File result = new File();
|
|
1702
|
-
if (input.has("readingTime"))
|
|
1703
|
-
result.readingTime = input.getInt("readingTime");
|
|
1704
|
-
if (input.has("type"))
|
|
1705
|
-
result.type = input.getInt("type");
|
|
1706
|
-
if (input.has("pAStatus"))
|
|
1707
|
-
result.pAStatus = input.getInt("pAStatus");
|
|
1708
|
-
if (input.has("readingStatus"))
|
|
1709
|
-
result.readingStatus = input.getInt("readingStatus");
|
|
1710
|
-
if (input.has("fileID"))
|
|
1711
|
-
result.fileID = input.getString("fileID");
|
|
1712
|
-
if (input.has("fileData"))
|
|
1713
|
-
result.fileData = FileDataFromJSON(input.getJSONObject("fileData"));
|
|
1714
|
-
if (input.has("certificates"))
|
|
1715
|
-
result.certificates = SecurityObjectCertificatesFromJSON(input.getJSONObject("certificates"));
|
|
1716
|
-
if (input.has("docFieldsText")){
|
|
1717
|
-
JSONArray jsonArray_docFieldsText = input.getJSONArray("docFieldsText");
|
|
1718
|
-
List<Integer> docFieldsText = new ArrayList<>();
|
|
1719
|
-
for (int i = 0; i < jsonArray_docFieldsText.length(); i++)
|
|
1720
|
-
docFieldsText.add(jsonArray_docFieldsText.getInt(i));
|
|
1721
|
-
result.docFieldsText = docFieldsText;
|
|
1722
|
-
}
|
|
1723
|
-
if (input.has("docFieldsGraphics")){
|
|
1724
|
-
JSONArray jsonArray_docFieldsGraphics = input.getJSONArray("docFieldsGraphics");
|
|
1725
|
-
List<Integer> docFieldsGraphics = new ArrayList<>();
|
|
1726
|
-
for (int i = 0; i < jsonArray_docFieldsGraphics.length(); i++)
|
|
1727
|
-
docFieldsGraphics.add(jsonArray_docFieldsGraphics.getInt(i));
|
|
1728
|
-
result.docFieldsGraphics = docFieldsGraphics;
|
|
1729
|
-
}
|
|
1730
|
-
if (input.has("docFieldsOriginals")){
|
|
1731
|
-
JSONArray jsonArray_docFieldsOriginals = input.getJSONArray("docFieldsOriginals");
|
|
1732
|
-
List<Integer> docFieldsOriginals = new ArrayList<>();
|
|
1733
|
-
for (int i = 0; i < jsonArray_docFieldsOriginals.length(); i++)
|
|
1734
|
-
docFieldsOriginals.add(jsonArray_docFieldsOriginals.getInt(i));
|
|
1735
|
-
result.docFieldsOriginals = docFieldsOriginals;
|
|
1736
|
-
}
|
|
1737
|
-
if (input.has("notifications")){
|
|
1738
|
-
JSONArray jsonArray_notifications = input.getJSONArray("notifications");
|
|
1739
|
-
List<Long> notifications = new ArrayList<>();
|
|
1740
|
-
for (int i = 0; i < jsonArray_notifications.length(); i++)
|
|
1741
|
-
notifications.add(jsonArray_notifications.getLong(i));
|
|
1742
|
-
result.notifications = notifications;
|
|
1743
|
-
}
|
|
1744
|
-
return result;
|
|
1745
|
-
} catch (JSONException e) {
|
|
1746
|
-
e.printStackTrace();
|
|
1747
|
-
}
|
|
1748
|
-
return null;
|
|
1749
|
-
}
|
|
1750
|
-
|
|
1751
|
-
static Application ApplicationFromJSON(JSONObject input) {
|
|
1752
|
-
try {
|
|
1753
|
-
Application result = new Application();
|
|
1754
|
-
if (input.has("type"))
|
|
1755
|
-
result.type = input.getInt("type");
|
|
1756
|
-
if (input.has("status"))
|
|
1757
|
-
result.status = input.getInt("status");
|
|
1758
|
-
if (input.has("applicationID"))
|
|
1759
|
-
result.applicationID = input.getString("applicationID");
|
|
1760
|
-
if (input.has("dataHashAlgorithm"))
|
|
1761
|
-
result.dataHashAlgorithm = input.getString("dataHashAlgorithm");
|
|
1762
|
-
if (input.has("unicodeVersion"))
|
|
1763
|
-
result.unicodeVersion = input.getString("unicodeVersion");
|
|
1764
|
-
if (input.has("version"))
|
|
1765
|
-
result.version = input.getString("version");
|
|
1766
|
-
if (input.has("files")){
|
|
1767
|
-
JSONArray jsonArray_files = input.getJSONArray("files");
|
|
1768
|
-
List<File> files = new ArrayList<>();
|
|
1769
|
-
for (int i = 0; i < jsonArray_files.length(); i++)
|
|
1770
|
-
files.add(FileFromJSON(jsonArray_files.getJSONObject(i)));
|
|
1771
|
-
result.files = files;
|
|
1772
|
-
}
|
|
1773
|
-
return result;
|
|
1774
|
-
} catch (JSONException e) {
|
|
1775
|
-
e.printStackTrace();
|
|
1776
|
-
}
|
|
1777
|
-
return null;
|
|
1778
|
-
}
|
|
1779
|
-
|
|
1780
|
-
static Value ValueFromJSON(JSONObject input) {
|
|
1781
|
-
try {
|
|
1782
|
-
Value result = new Value();
|
|
1783
|
-
if (input.has("length"))
|
|
1784
|
-
result.length = input.getInt("length");
|
|
1785
|
-
if (input.has("type"))
|
|
1786
|
-
result.type = input.getInt("type");
|
|
1787
|
-
if (input.has("status"))
|
|
1788
|
-
result.status = input.getInt("status");
|
|
1789
|
-
if (input.has("data"))
|
|
1790
|
-
result.data = input.getString("data");
|
|
1791
|
-
if (input.has("format"))
|
|
1792
|
-
result.format = input.getString("format");
|
|
1793
|
-
return result;
|
|
1794
|
-
} catch (JSONException e) {
|
|
1795
|
-
e.printStackTrace();
|
|
1796
|
-
}
|
|
1797
|
-
return null;
|
|
1798
|
-
}
|
|
1799
|
-
|
|
1800
|
-
static Attribute AttributeFromJSON(JSONObject input) {
|
|
1801
|
-
try {
|
|
1802
|
-
Attribute result = new Attribute();
|
|
1803
|
-
if (input.has("type"))
|
|
1804
|
-
result.type = input.getString("type");
|
|
1805
|
-
if (input.has("value"))
|
|
1806
|
-
result.value = ValueFromJSON(input.getJSONObject("value"));
|
|
1807
|
-
return result;
|
|
1808
|
-
} catch (JSONException e) {
|
|
1809
|
-
e.printStackTrace();
|
|
1810
|
-
}
|
|
1811
|
-
return null;
|
|
1812
|
-
}
|
|
1813
|
-
|
|
1814
|
-
static Authority AuthorityFromJSON(JSONObject input) {
|
|
1815
|
-
try {
|
|
1816
|
-
Authority result = new Authority();
|
|
1817
|
-
if (input.has("data"))
|
|
1818
|
-
result.data = input.getString("data");
|
|
1819
|
-
if (input.has("friendlyName"))
|
|
1820
|
-
result.friendlyName = ValueFromJSON(input.getJSONObject("friendlyName"));
|
|
1821
|
-
if (input.has("attributes")){
|
|
1822
|
-
JSONArray jsonArray_attributes = input.getJSONArray("attributes");
|
|
1823
|
-
List<Attribute> attributes = new ArrayList<>();
|
|
1824
|
-
for (int i = 0; i < jsonArray_attributes.length(); i++)
|
|
1825
|
-
attributes.add(AttributeFromJSON(jsonArray_attributes.getJSONObject(i)));
|
|
1826
|
-
result.attributes = attributes;
|
|
1827
|
-
}
|
|
1828
|
-
return result;
|
|
1829
|
-
} catch (JSONException e) {
|
|
1830
|
-
e.printStackTrace();
|
|
1831
|
-
}
|
|
1832
|
-
return null;
|
|
1833
|
-
}
|
|
1834
|
-
|
|
1835
|
-
static Extension ExtensionFromJSON(JSONObject input) {
|
|
1836
|
-
try {
|
|
1837
|
-
Extension result = new Extension();
|
|
1838
|
-
if (input.has("data"))
|
|
1839
|
-
result.data = input.getString("data");
|
|
1840
|
-
if (input.has("type"))
|
|
1841
|
-
result.type = input.getString("type");
|
|
1842
|
-
return result;
|
|
1843
|
-
} catch (JSONException e) {
|
|
1844
|
-
e.printStackTrace();
|
|
1845
|
-
}
|
|
1846
|
-
return null;
|
|
1847
|
-
}
|
|
1848
|
-
|
|
1849
|
-
static Validity ValidityFromJSON(JSONObject input) {
|
|
1850
|
-
try {
|
|
1851
|
-
Validity result = new Validity();
|
|
1852
|
-
if (input.has("notAfter"))
|
|
1853
|
-
result.notAfter = ValueFromJSON(input.getJSONObject("notAfter"));
|
|
1854
|
-
if (input.has("notBefore"))
|
|
1855
|
-
result.notBefore = ValueFromJSON(input.getJSONObject("notBefore"));
|
|
1856
|
-
return result;
|
|
1857
|
-
} catch (JSONException e) {
|
|
1858
|
-
e.printStackTrace();
|
|
1859
|
-
}
|
|
1860
|
-
return null;
|
|
1861
|
-
}
|
|
1862
|
-
|
|
1863
|
-
static CertificateChain CertificateChainFromJSON(JSONObject input) {
|
|
1864
|
-
try {
|
|
1865
|
-
CertificateChain result = new CertificateChain();
|
|
1866
|
-
if (input.has("origin"))
|
|
1867
|
-
result.origin = input.getInt("origin");
|
|
1868
|
-
if (input.has("type"))
|
|
1869
|
-
result.type = input.getInt("type");
|
|
1870
|
-
if (input.has("version"))
|
|
1871
|
-
result.version = input.getInt("version");
|
|
1872
|
-
if (input.has("paStatus"))
|
|
1873
|
-
result.paStatus = input.getInt("paStatus");
|
|
1874
|
-
if (input.has("serialNumber"))
|
|
1875
|
-
result.serialNumber = input.getString("serialNumber");
|
|
1876
|
-
if (input.has("signatureAlgorithm"))
|
|
1877
|
-
result.signatureAlgorithm = input.getString("signatureAlgorithm");
|
|
1878
|
-
if (input.has("subjectPKAlgorithm"))
|
|
1879
|
-
result.subjectPKAlgorithm = input.getString("subjectPKAlgorithm");
|
|
1880
|
-
if (input.has("fileName"))
|
|
1881
|
-
result.fileName = ValueFromJSON(input.getJSONObject("fileName"));
|
|
1882
|
-
if (input.has("validity"))
|
|
1883
|
-
result.validity = ValidityFromJSON(input.getJSONObject("validity"));
|
|
1884
|
-
if (input.has("issuer"))
|
|
1885
|
-
result.issuer = AuthorityFromJSON(input.getJSONObject("issuer"));
|
|
1886
|
-
if (input.has("subject"))
|
|
1887
|
-
result.subject = AuthorityFromJSON(input.getJSONObject("subject"));
|
|
1888
|
-
if (input.has("notifications")){
|
|
1889
|
-
JSONArray jsonArray_notifications = input.getJSONArray("notifications");
|
|
1890
|
-
List<Long> notifications = new ArrayList<>();
|
|
1891
|
-
for (int i = 0; i < jsonArray_notifications.length(); i++)
|
|
1892
|
-
notifications.add(jsonArray_notifications.getLong(i));
|
|
1893
|
-
result.notifications = notifications;
|
|
1894
|
-
}
|
|
1895
|
-
if (input.has("extensions")){
|
|
1896
|
-
JSONArray jsonArray_extensions = input.getJSONArray("extensions");
|
|
1897
|
-
List<Extension> extensions = new ArrayList<>();
|
|
1898
|
-
for (int i = 0; i < jsonArray_extensions.length(); i++)
|
|
1899
|
-
extensions.add(ExtensionFromJSON(jsonArray_extensions.getJSONObject(i)));
|
|
1900
|
-
result.extensions = extensions;
|
|
1901
|
-
}
|
|
1902
|
-
return result;
|
|
1903
|
-
} catch (JSONException e) {
|
|
1904
|
-
e.printStackTrace();
|
|
1905
|
-
}
|
|
1906
|
-
return null;
|
|
1907
|
-
}
|
|
1908
|
-
|
|
1909
|
-
static SignerInfo SignerInfoFromJSON(JSONObject input) {
|
|
1910
|
-
try {
|
|
1911
|
-
SignerInfo result = new SignerInfo();
|
|
1912
|
-
if (input.has("version"))
|
|
1913
|
-
result.version = input.getInt("version");
|
|
1914
|
-
if (input.has("paStatus"))
|
|
1915
|
-
result.paStatus = input.getInt("paStatus");
|
|
1916
|
-
if (input.has("dataToHash"))
|
|
1917
|
-
result.dataToHash = input.getString("dataToHash");
|
|
1918
|
-
if (input.has("digestAlgorithm"))
|
|
1919
|
-
result.digestAlgorithm = input.getString("digestAlgorithm");
|
|
1920
|
-
if (input.has("signatureAlgorithm"))
|
|
1921
|
-
result.signatureAlgorithm = input.getString("signatureAlgorithm");
|
|
1922
|
-
if (input.has("serialNumber"))
|
|
1923
|
-
result.serialNumber = ValueFromJSON(input.getJSONObject("serialNumber"));
|
|
1924
|
-
if (input.has("signature"))
|
|
1925
|
-
result.signature = ValueFromJSON(input.getJSONObject("signature"));
|
|
1926
|
-
if (input.has("subjectKeyIdentifier"))
|
|
1927
|
-
result.subjectKeyIdentifier = ValueFromJSON(input.getJSONObject("subjectKeyIdentifier"));
|
|
1928
|
-
if (input.has("issuer"))
|
|
1929
|
-
result.issuer = AuthorityFromJSON(input.getJSONObject("issuer"));
|
|
1930
|
-
if (input.has("notifications")){
|
|
1931
|
-
JSONArray jsonArray_notifications = input.getJSONArray("notifications");
|
|
1932
|
-
List<Long> notifications = new ArrayList<>();
|
|
1933
|
-
for (int i = 0; i < jsonArray_notifications.length(); i++)
|
|
1934
|
-
notifications.add(jsonArray_notifications.getLong(i));
|
|
1935
|
-
result.notifications = notifications;
|
|
1936
|
-
}
|
|
1937
|
-
if (input.has("signedAttributes")){
|
|
1938
|
-
JSONArray jsonArray_signedAttributes = input.getJSONArray("signedAttributes");
|
|
1939
|
-
List<Extension> signedAttributes = new ArrayList<>();
|
|
1940
|
-
for (int i = 0; i < jsonArray_signedAttributes.length(); i++)
|
|
1941
|
-
signedAttributes.add(ExtensionFromJSON(jsonArray_signedAttributes.getJSONObject(i)));
|
|
1942
|
-
result.signedAttributes = signedAttributes;
|
|
1943
|
-
}
|
|
1944
|
-
if (input.has("certificateChain")){
|
|
1945
|
-
JSONArray jsonArray_certificateChain = input.getJSONArray("certificateChain");
|
|
1946
|
-
List<CertificateChain> certificateChain = new ArrayList<>();
|
|
1947
|
-
for (int i = 0; i < jsonArray_certificateChain.length(); i++)
|
|
1948
|
-
certificateChain.add(CertificateChainFromJSON(jsonArray_certificateChain.getJSONObject(i)));
|
|
1949
|
-
result.certificateChain = certificateChain;
|
|
1950
|
-
}
|
|
1951
|
-
return result;
|
|
1952
|
-
} catch (JSONException e) {
|
|
1953
|
-
e.printStackTrace();
|
|
1954
|
-
}
|
|
1955
|
-
return null;
|
|
1956
|
-
}
|
|
1957
|
-
|
|
1958
|
-
static SecurityObject SecurityObjectFromJSON(JSONObject input) {
|
|
1959
|
-
try {
|
|
1960
|
-
SecurityObject result = new SecurityObject();
|
|
1961
|
-
if (input.has("fileReference"))
|
|
1962
|
-
result.fileReference = input.getInt("fileReference");
|
|
1963
|
-
if (input.has("version"))
|
|
1964
|
-
result.version = input.getInt("version");
|
|
1965
|
-
if (input.has("objectType"))
|
|
1966
|
-
result.objectType = input.getString("objectType");
|
|
1967
|
-
if (input.has("notifications")){
|
|
1968
|
-
JSONArray jsonArray_notifications = input.getJSONArray("notifications");
|
|
1969
|
-
List<Long> notifications = new ArrayList<>();
|
|
1970
|
-
for (int i = 0; i < jsonArray_notifications.length(); i++)
|
|
1971
|
-
notifications.add(jsonArray_notifications.getLong(i));
|
|
1972
|
-
result.notifications = notifications;
|
|
1973
|
-
}
|
|
1974
|
-
if (input.has("signerInfos")){
|
|
1975
|
-
JSONArray jsonArray_signerInfos = input.getJSONArray("signerInfos");
|
|
1976
|
-
List<SignerInfo> signerInfos = new ArrayList<>();
|
|
1977
|
-
for (int i = 0; i < jsonArray_signerInfos.length(); i++)
|
|
1978
|
-
signerInfos.add(SignerInfoFromJSON(jsonArray_signerInfos.getJSONObject(i)));
|
|
1979
|
-
result.signerInfos = signerInfos;
|
|
1980
|
-
}
|
|
1981
|
-
return result;
|
|
1982
|
-
} catch (JSONException e) {
|
|
1983
|
-
e.printStackTrace();
|
|
1984
|
-
}
|
|
1985
|
-
return null;
|
|
1986
|
-
}
|
|
1987
|
-
|
|
1988
|
-
static CardProperties CardPropertiesFromJSON(JSONObject input) {
|
|
1989
|
-
try {
|
|
1990
|
-
CardProperties result = new CardProperties();
|
|
1991
|
-
if (input.has("aTQA"))
|
|
1992
|
-
result.aTQA = input.getInt("aTQA");
|
|
1993
|
-
if (input.has("bitRateR"))
|
|
1994
|
-
result.bitRateR = input.getInt("bitRateR");
|
|
1995
|
-
if (input.has("bitRateS"))
|
|
1996
|
-
result.bitRateS = input.getInt("bitRateS");
|
|
1997
|
-
if (input.has("chipTypeA"))
|
|
1998
|
-
result.chipTypeA = input.getInt("chipTypeA");
|
|
1999
|
-
if (input.has("mifareMemory"))
|
|
2000
|
-
result.mifareMemory = input.getInt("mifareMemory");
|
|
2001
|
-
if (input.has("rfidType"))
|
|
2002
|
-
result.rfidType = input.getInt("rfidType");
|
|
2003
|
-
if (input.has("sAK"))
|
|
2004
|
-
result.sAK = input.getInt("sAK");
|
|
2005
|
-
if (input.has("support4"))
|
|
2006
|
-
result.support4 = input.getBoolean("support4");
|
|
2007
|
-
if (input.has("supportMifare"))
|
|
2008
|
-
result.supportMifare = input.getBoolean("supportMifare");
|
|
2009
|
-
if (input.has("aTQB"))
|
|
2010
|
-
result.aTQB = input.getString("aTQB");
|
|
2011
|
-
if (input.has("aTR"))
|
|
2012
|
-
result.aTR = input.getString("aTR");
|
|
2013
|
-
if (input.has("baudrate1"))
|
|
2014
|
-
result.baudrate1 = input.getString("baudrate1");
|
|
2015
|
-
if (input.has("baudrate2"))
|
|
2016
|
-
result.baudrate2 = input.getString("baudrate2");
|
|
2017
|
-
if (input.has("uID"))
|
|
2018
|
-
result.uID = input.getString("uID");
|
|
2019
|
-
return result;
|
|
2020
|
-
} catch (JSONException e) {
|
|
2021
|
-
e.printStackTrace();
|
|
2022
|
-
}
|
|
2023
|
-
return null;
|
|
2024
|
-
}
|
|
2025
|
-
|
|
2026
|
-
static RFIDSessionData RFIDSessionDataFromJSON(JSONObject input) {
|
|
2027
|
-
try {
|
|
2028
|
-
RFIDSessionData result = new RFIDSessionData();
|
|
2029
|
-
if (input.has("totalBytesReceived"))
|
|
2030
|
-
result.totalBytesReceived = input.getInt("totalBytesReceived");
|
|
2031
|
-
if (input.has("totalBytesSent"))
|
|
2032
|
-
result.totalBytesSent = input.getInt("totalBytesSent");
|
|
2033
|
-
if (input.has("status"))
|
|
2034
|
-
result.status = input.getInt("status");
|
|
2035
|
-
if (input.has("extLeSupport"))
|
|
2036
|
-
result.extLeSupport = input.getInt("extLeSupport");
|
|
2037
|
-
if (input.has("processTime"))
|
|
2038
|
-
result.processTime = input.getInt("processTime");
|
|
2039
|
-
if (input.has("cardProperties"))
|
|
2040
|
-
result.cardProperties = CardPropertiesFromJSON(input.getJSONObject("cardProperties"));
|
|
2041
|
-
if (input.has("sessionDataStatus"))
|
|
2042
|
-
result.sessionDataStatus = RFIDSessionDataStatusFromJSON(input.getJSONObject("sessionDataStatus"));
|
|
2043
|
-
if (input.has("accessControls")){
|
|
2044
|
-
JSONArray jsonArray_accessControls = input.getJSONArray("accessControls");
|
|
2045
|
-
List<AccessControlProcedureType> accessControls = new ArrayList<>();
|
|
2046
|
-
for (int i = 0; i < jsonArray_accessControls.length(); i++)
|
|
2047
|
-
accessControls.add(AccessControlProcedureTypeFromJSON(jsonArray_accessControls.getJSONObject(i)));
|
|
2048
|
-
result.accessControls = accessControls;
|
|
2049
|
-
}
|
|
2050
|
-
if (input.has("applications")){
|
|
2051
|
-
JSONArray jsonArray_applications = input.getJSONArray("applications");
|
|
2052
|
-
List<Application> applications = new ArrayList<>();
|
|
2053
|
-
for (int i = 0; i < jsonArray_applications.length(); i++)
|
|
2054
|
-
applications.add(ApplicationFromJSON(jsonArray_applications.getJSONObject(i)));
|
|
2055
|
-
result.applications = applications;
|
|
2056
|
-
}
|
|
2057
|
-
if (input.has("securityObjects")){
|
|
2058
|
-
JSONArray jsonArray_securityObjects = input.getJSONArray("securityObjects");
|
|
2059
|
-
List<SecurityObject> securityObjects = new ArrayList<>();
|
|
2060
|
-
for (int i = 0; i < jsonArray_securityObjects.length(); i++)
|
|
2061
|
-
securityObjects.add(SecurityObjectFromJSON(jsonArray_securityObjects.getJSONObject(i)));
|
|
2062
|
-
result.securityObjects = securityObjects;
|
|
2063
|
-
}
|
|
2064
|
-
return result;
|
|
2065
|
-
} catch (JSONException e) {
|
|
2066
|
-
e.printStackTrace();
|
|
2067
|
-
}
|
|
2068
|
-
return null;
|
|
2069
|
-
}
|
|
2070
|
-
|
|
2071
|
-
static DocumentReaderAuthenticityCheck DocumentReaderAuthenticityCheckFromJSON(JSONObject input) {
|
|
2072
|
-
try {
|
|
2073
|
-
DocumentReaderAuthenticityCheck result = new DocumentReaderAuthenticityCheck();
|
|
2074
|
-
if (input.has("type"))
|
|
2075
|
-
result.type = input.getInt("type");
|
|
2076
|
-
if (input.has("pageIndex"))
|
|
2077
|
-
result.pageIndex = input.getInt("pageIndex");
|
|
2078
|
-
if (input.has("elements")){
|
|
2079
|
-
JSONArray jsonArray_elements = input.getJSONArray("elements");
|
|
2080
|
-
List<DocumentReaderAuthenticityElement> elements = new ArrayList<>();
|
|
2081
|
-
for (int i = 0; i < jsonArray_elements.length(); i++)
|
|
2082
|
-
elements.add(DocumentReaderAuthenticityElementFromJSON(jsonArray_elements.getJSONObject(i)));
|
|
2083
|
-
result.elements = elements;
|
|
2084
|
-
}
|
|
2085
|
-
return result;
|
|
2086
|
-
} catch (JSONException e) {
|
|
2087
|
-
e.printStackTrace();
|
|
2088
|
-
}
|
|
2089
|
-
return null;
|
|
2090
|
-
}
|
|
2091
|
-
|
|
2092
|
-
static PDF417Info PDF417InfoFromJSON(JSONObject input) {
|
|
2093
|
-
try {
|
|
2094
|
-
PDF417Info result = new PDF417Info();
|
|
2095
|
-
if (input.has("errorLevel"))
|
|
2096
|
-
result.errorLevel = input.getInt("errorLevel");
|
|
2097
|
-
if (input.has("columns"))
|
|
2098
|
-
result.columns = input.getInt("columns");
|
|
2099
|
-
if (input.has("rows"))
|
|
2100
|
-
result.rows = input.getInt("rows");
|
|
2101
|
-
return result;
|
|
2102
|
-
} catch (JSONException e) {
|
|
2103
|
-
e.printStackTrace();
|
|
2104
|
-
}
|
|
2105
|
-
return null;
|
|
2106
|
-
}
|
|
2107
|
-
|
|
2108
|
-
static RFIDSessionDataStatus RFIDSessionDataStatusFromJSON(JSONObject input) {
|
|
2109
|
-
try {
|
|
2110
|
-
RFIDSessionDataStatus result = new RFIDSessionDataStatus();
|
|
2111
|
-
if (input.has("AA"))
|
|
2112
|
-
result.AA = input.getInt("AA");
|
|
2113
|
-
if (input.has("BAC"))
|
|
2114
|
-
result.BAC = input.getInt("BAC");
|
|
2115
|
-
if (input.has("CA"))
|
|
2116
|
-
result.CA = input.getInt("CA");
|
|
2117
|
-
if (input.has("PA"))
|
|
2118
|
-
result.PA = input.getInt("PA");
|
|
2119
|
-
if (input.has("PACE"))
|
|
2120
|
-
result.PACE = input.getInt("PACE");
|
|
2121
|
-
if (input.has("TA"))
|
|
2122
|
-
result.TA = input.getInt("TA");
|
|
2123
|
-
if (input.has("overallStatus"))
|
|
2124
|
-
result.overallStatus = input.getInt("overallStatus");
|
|
2125
|
-
return result;
|
|
2126
|
-
} catch (JSONException e) {
|
|
2127
|
-
e.printStackTrace();
|
|
2128
|
-
}
|
|
2129
|
-
return null;
|
|
2130
|
-
}
|
|
2131
|
-
|
|
2132
|
-
static DocumentReaderBarcodeResult DocumentReaderBarcodeResultFromJSON(JSONObject input) {
|
|
2133
|
-
try {
|
|
2134
|
-
DocumentReaderBarcodeResult result = new DocumentReaderBarcodeResult();
|
|
2135
|
-
if (input.has("fields")){
|
|
2136
|
-
JSONArray jsonArray_fields = input.getJSONArray("fields");
|
|
2137
|
-
List<DocumentReaderBarcodeField> fields = new ArrayList<>();
|
|
2138
|
-
for (int i = 0; i < jsonArray_fields.length(); i++)
|
|
2139
|
-
fields.add(DocumentReaderBarcodeFieldFromJSON(jsonArray_fields.getJSONObject(i)));
|
|
2140
|
-
result.fields = fields;
|
|
2141
|
-
}
|
|
2142
|
-
return result;
|
|
2143
|
-
} catch (JSONException e) {
|
|
2144
|
-
e.printStackTrace();
|
|
2145
|
-
}
|
|
2146
|
-
return null;
|
|
2147
|
-
}
|
|
2148
|
-
|
|
2149
|
-
static DocumentReaderBarcodeField DocumentReaderBarcodeFieldFromJSON(JSONObject input) {
|
|
2150
|
-
try {
|
|
2151
|
-
DocumentReaderBarcodeField result = new DocumentReaderBarcodeField();
|
|
2152
|
-
if (input.has("barcodeType"))
|
|
2153
|
-
result.barcodeType = input.getInt("barcodeType");
|
|
2154
|
-
if (input.has("status"))
|
|
2155
|
-
result.status = input.getInt("status");
|
|
2156
|
-
if (input.has("pageIndex"))
|
|
2157
|
-
result.pageIndex = input.getInt("pageIndex");
|
|
2158
|
-
if (input.has("pdf417Info"))
|
|
2159
|
-
result.pdf417Info = PDF417InfoFromJSON(input.getJSONObject("pdf417Info"));
|
|
2160
|
-
if (input.has("data")){
|
|
2161
|
-
JSONArray jsonArray_data = input.getJSONArray("data");
|
|
2162
|
-
byte[] data = new byte[jsonArray_data.length()];
|
|
2163
|
-
for (int i = 0; i < jsonArray_data.length(); i++)
|
|
2164
|
-
data[i] = (byte) jsonArray_data.get(i);
|
|
2165
|
-
result.data = data;
|
|
2166
|
-
}
|
|
2167
|
-
return result;
|
|
2168
|
-
} catch (JSONException e) {
|
|
2169
|
-
e.printStackTrace();
|
|
2170
|
-
}
|
|
2171
|
-
return null;
|
|
2172
|
-
}
|
|
2173
|
-
|
|
2174
|
-
static DocumentReaderAuthenticityResult DocumentReaderAuthenticityResultFromJSON(JSONObject input) {
|
|
2175
|
-
try {
|
|
2176
|
-
DocumentReaderAuthenticityResult result = new DocumentReaderAuthenticityResult();
|
|
2177
|
-
if (input.has("checks")){
|
|
2178
|
-
JSONArray jsonArray_checks = input.getJSONArray("checks");
|
|
2179
|
-
List<DocumentReaderAuthenticityCheck> checks = new ArrayList<>();
|
|
2180
|
-
for (int i = 0; i < jsonArray_checks.length(); i++)
|
|
2181
|
-
checks.add(DocumentReaderAuthenticityCheckFromJSON(jsonArray_checks.getJSONObject(i)));
|
|
2182
|
-
result.checks = checks;
|
|
2183
|
-
}
|
|
2184
|
-
return result;
|
|
2185
|
-
} catch (JSONException e) {
|
|
2186
|
-
e.printStackTrace();
|
|
2187
|
-
}
|
|
2188
|
-
return null;
|
|
2189
|
-
}
|
|
2190
|
-
|
|
2191
|
-
static DocumentReaderAuthenticityElement DocumentReaderAuthenticityElementFromJSON(JSONObject input) {
|
|
2192
|
-
try {
|
|
2193
|
-
DocumentReaderAuthenticityElement result = new DocumentReaderAuthenticityElement();
|
|
2194
|
-
if (input.has("status"))
|
|
2195
|
-
result.status = input.getInt("status");
|
|
2196
|
-
if (input.has("elementType"))
|
|
2197
|
-
result.elementType = input.getInt("elementType");
|
|
2198
|
-
if (input.has("elementDiagnose"))
|
|
2199
|
-
result.elementDiagnose = input.getInt("elementDiagnose");
|
|
2200
|
-
return result;
|
|
2201
|
-
} catch (JSONException e) {
|
|
2202
|
-
e.printStackTrace();
|
|
2203
|
-
}
|
|
2204
|
-
return null;
|
|
2205
|
-
}
|
|
2206
|
-
|
|
2207
|
-
static PAResourcesIssuer PAResourcesIssuerFromJSON(JSONObject input) {
|
|
2208
|
-
try {
|
|
2209
|
-
PAResourcesIssuer result = new PAResourcesIssuer();
|
|
2210
|
-
if (input.has("data")){
|
|
2211
|
-
JSONArray jsonArray_data = input.getJSONArray("data");
|
|
2212
|
-
byte[] data = new byte[jsonArray_data.length()];
|
|
2213
|
-
for (int i = 0; i < jsonArray_data.length(); i++)
|
|
2214
|
-
data[i] = (byte) jsonArray_data.get(i);
|
|
2215
|
-
result.data = data;
|
|
2216
|
-
}
|
|
2217
|
-
if (input.has("friendlyName"))
|
|
2218
|
-
result.friendlyName = input.getString("friendlyName");
|
|
2219
|
-
if (input.has("attributes")){
|
|
2220
|
-
JSONArray jsonArray_attributes = input.getJSONArray("attributes");
|
|
2221
|
-
PAAttribute[] attributes = new PAAttribute[jsonArray_attributes.length()];
|
|
2222
|
-
for (int i = 0; i < jsonArray_attributes.length(); i++)
|
|
2223
|
-
attributes[i] = PAAttributeFromJSON(jsonArray_attributes.getJSONObject(i));
|
|
2224
|
-
result.attributes = attributes;
|
|
2225
|
-
}
|
|
2226
|
-
return result;
|
|
2227
|
-
} catch (JSONException e) {
|
|
2228
|
-
e.printStackTrace();
|
|
2229
|
-
}
|
|
2230
|
-
return null;
|
|
2231
|
-
}
|
|
2232
|
-
|
|
2233
|
-
static PAAttribute PAAttributeFromJSON(JSONObject input) {
|
|
2234
|
-
try {
|
|
2235
|
-
PAAttribute result = new PAAttribute();
|
|
2236
|
-
if (input.has("type"))
|
|
2237
|
-
result.type = input.getString("type");
|
|
2238
|
-
if (input.has("value"))
|
|
2239
|
-
result.value = input.getString("value");
|
|
2240
|
-
return result;
|
|
2241
|
-
} catch (JSONException e) {
|
|
2242
|
-
e.printStackTrace();
|
|
2243
|
-
}
|
|
2244
|
-
return null;
|
|
2245
|
-
}
|
|
2246
|
-
|
|
2247
|
-
static TAChallenge TAChallengeFromJSON(JSONObject input) {
|
|
2248
|
-
try {
|
|
2249
|
-
TAChallenge result = new TAChallenge();
|
|
2250
|
-
if (input.has("data")){
|
|
2251
|
-
JSONArray jsonArray_data = input.getJSONArray("data");
|
|
2252
|
-
byte[] data = new byte[jsonArray_data.length()];
|
|
2253
|
-
for (int i = 0; i < jsonArray_data.length(); i++)
|
|
2254
|
-
data[i] = (byte) jsonArray_data.get(i);
|
|
2255
|
-
result.data = data;
|
|
2256
|
-
}
|
|
2257
|
-
if (input.has("auxPCD"))
|
|
2258
|
-
result.auxPCD = input.getString("auxPCD");
|
|
2259
|
-
if (input.has("challengePICC"))
|
|
2260
|
-
result.challengePICC = input.getString("challengePICC");
|
|
2261
|
-
if (input.has("hashPK"))
|
|
2262
|
-
result.hashPK = input.getString("hashPK");
|
|
2263
|
-
if (input.has("idPICC"))
|
|
2264
|
-
result.idPICC = input.getString("idPICC");
|
|
2265
|
-
return result;
|
|
2266
|
-
} catch (JSONException e) {
|
|
2267
|
-
e.printStackTrace();
|
|
2268
|
-
}
|
|
2269
|
-
return null;
|
|
2270
|
-
}
|
|
2271
|
-
|
|
2272
|
-
static DocumentReaderUvFiberElement DocumentReaderUvFiberElementFromJSON(JSONObject input) {
|
|
2273
|
-
try {
|
|
2274
|
-
DocumentReaderUvFiberElement result = new DocumentReaderUvFiberElement();
|
|
2275
|
-
if (input.has("rectArray")){
|
|
2276
|
-
JSONArray jsonArray_rectArray = input.getJSONArray("rectArray");
|
|
2277
|
-
List<DocReaderFieldRect> rectArray = new ArrayList<>();
|
|
2278
|
-
for (int i = 0; i < jsonArray_rectArray.length(); i++)
|
|
2279
|
-
rectArray.add(DocReaderFieldRectFromJSON(jsonArray_rectArray.getJSONObject(i)));
|
|
2280
|
-
result.rectArray = rectArray;
|
|
2281
|
-
}
|
|
2282
|
-
if (input.has("rectCount"))
|
|
2283
|
-
result.rectCount = input.getInt("rectCount");
|
|
2284
|
-
if (input.has("expectedCount"))
|
|
2285
|
-
result.expectedCount = input.getInt("expectedCount");
|
|
2286
|
-
if (input.has("width")){
|
|
2287
|
-
JSONArray jsonArray_width = input.getJSONArray("width");
|
|
2288
|
-
int[] width = new int[jsonArray_width.length()];
|
|
2289
|
-
for (int i = 0; i < jsonArray_width.length(); i++)
|
|
2290
|
-
width[i] = jsonArray_width.getInt(i);
|
|
2291
|
-
result.width = width;
|
|
2292
|
-
}
|
|
2293
|
-
if (input.has("length")){
|
|
2294
|
-
JSONArray jsonArray_length = input.getJSONArray("length");
|
|
2295
|
-
int[] length = new int[jsonArray_length.length()];
|
|
2296
|
-
for (int i = 0; i < jsonArray_length.length(); i++)
|
|
2297
|
-
length[i] = jsonArray_length.getInt(i);
|
|
2298
|
-
result.length = length;
|
|
2299
|
-
}
|
|
2300
|
-
if (input.has("area")){
|
|
2301
|
-
JSONArray jsonArray_area = input.getJSONArray("area");
|
|
2302
|
-
int[] area = new int[jsonArray_area.length()];
|
|
2303
|
-
for (int i = 0; i < jsonArray_area.length(); i++)
|
|
2304
|
-
area[i] = jsonArray_area.getInt(i);
|
|
2305
|
-
result.area = area;
|
|
2306
|
-
}
|
|
2307
|
-
if (input.has("colorValues")){
|
|
2308
|
-
JSONArray jsonArray_colorValues = input.getJSONArray("colorValues");
|
|
2309
|
-
int[] colorValues = new int[jsonArray_colorValues.length()];
|
|
2310
|
-
for (int i = 0; i < jsonArray_colorValues.length(); i++)
|
|
2311
|
-
colorValues[i] = jsonArray_colorValues.getInt(i);
|
|
2312
|
-
result.colorValues = colorValues;
|
|
2313
|
-
}
|
|
2314
|
-
if (input.has("status"))
|
|
2315
|
-
result.status = input.getInt("status");
|
|
2316
|
-
if (input.has("elementType"))
|
|
2317
|
-
result.elementType = input.getInt("elementType");
|
|
2318
|
-
if (input.has("elementDiagnose"))
|
|
2319
|
-
result.elementDiagnose = input.getInt("elementDiagnose");
|
|
2320
|
-
return result;
|
|
2321
|
-
} catch (JSONException e) {
|
|
2322
|
-
e.printStackTrace();
|
|
2323
|
-
}
|
|
2324
|
-
return null;
|
|
2325
|
-
}
|
|
2326
|
-
|
|
2327
|
-
static DocumentReaderResults DocumentReaderResultsFromJSON(JSONObject input) {
|
|
2328
|
-
try {
|
|
2329
|
-
DocumentReaderResults result = new DocumentReaderResults();
|
|
2330
|
-
if (input.has("chipPage"))
|
|
2331
|
-
result.chipPage = input.getInt("chipPage");
|
|
2332
|
-
if (input.has("processingFinishedStatus"))
|
|
2333
|
-
result.processingFinishedStatus = input.getInt("processingFinishedStatus");
|
|
2334
|
-
if (input.has("elapsedTime"))
|
|
2335
|
-
result.elapsedTime = input.getInt("elapsedTime");
|
|
2336
|
-
if (input.has("elapsedTimeRFID"))
|
|
2337
|
-
result.elapsedTimeRFID = input.getInt("elapsedTimeRFID");
|
|
2338
|
-
if (input.has("morePagesAvailable"))
|
|
2339
|
-
result.morePagesAvailable = input.getInt("morePagesAvailable");
|
|
2340
|
-
if (input.has("rfidResult"))
|
|
2341
|
-
result.rfidResult = input.getInt("rfidResult");
|
|
2342
|
-
if (input.has("highResolution"))
|
|
2343
|
-
result.highResolution = input.getBoolean("highResolution");
|
|
2344
|
-
if (input.has("graphicResult"))
|
|
2345
|
-
result.graphicResult = DocumentReaderGraphicResultFromJSON(input.getJSONObject("graphicResult"));
|
|
2346
|
-
if (input.has("textResult"))
|
|
2347
|
-
result.textResult = DocumentReaderTextResultFromJSON(input.getJSONObject("textResult"));
|
|
2348
|
-
if (input.has("documentPosition")){
|
|
2349
|
-
JSONArray jsonArray_documentPosition = input.getJSONArray("documentPosition");
|
|
2350
|
-
List<ElementPosition> documentPosition = new ArrayList<>();
|
|
2351
|
-
for (int i = 0; i < jsonArray_documentPosition.length(); i++)
|
|
2352
|
-
documentPosition.add(ElementPositionFromJSON(jsonArray_documentPosition.getJSONObject(i)));
|
|
2353
|
-
result.documentPosition = documentPosition;
|
|
2354
|
-
}
|
|
2355
|
-
if (input.has("barcodePosition")){
|
|
2356
|
-
JSONArray jsonArray_barcodePosition = input.getJSONArray("barcodePosition");
|
|
2357
|
-
List<ElementPosition> barcodePosition = new ArrayList<>();
|
|
2358
|
-
for (int i = 0; i < jsonArray_barcodePosition.length(); i++)
|
|
2359
|
-
barcodePosition.add(ElementPositionFromJSON(jsonArray_barcodePosition.getJSONObject(i)));
|
|
2360
|
-
result.barcodePosition = barcodePosition;
|
|
2361
|
-
}
|
|
2362
|
-
if (input.has("mrzPosition")){
|
|
2363
|
-
JSONArray jsonArray_mrzPosition = input.getJSONArray("mrzPosition");
|
|
2364
|
-
List<ElementPosition> mrzPosition = new ArrayList<>();
|
|
2365
|
-
for (int i = 0; i < jsonArray_mrzPosition.length(); i++)
|
|
2366
|
-
mrzPosition.add(ElementPositionFromJSON(jsonArray_mrzPosition.getJSONObject(i)));
|
|
2367
|
-
result.mrzPosition = mrzPosition;
|
|
2368
|
-
}
|
|
2369
|
-
if (input.has("imageQuality")){
|
|
2370
|
-
JSONArray jsonArray_imageQuality = input.getJSONArray("imageQuality");
|
|
2371
|
-
List<ImageQualityGroup> imageQuality = new ArrayList<>();
|
|
2372
|
-
for (int i = 0; i < jsonArray_imageQuality.length(); i++)
|
|
2373
|
-
imageQuality.add(ImageQualityGroupFromJSON(jsonArray_imageQuality.getJSONObject(i)));
|
|
2374
|
-
result.imageQuality = imageQuality;
|
|
2375
|
-
}
|
|
2376
|
-
if (input.has("rawResult"))
|
|
2377
|
-
result.rawResult = input.getString("rawResult");
|
|
2378
|
-
if (input.has("documentReaderNotification"))
|
|
2379
|
-
result.documentReaderNotification = DocumentReaderNotificationFromJSON(input.getJSONObject("documentReaderNotification"));
|
|
2380
|
-
if (input.has("rfidSessionData"))
|
|
2381
|
-
result.rfidSessionData = RFIDSessionDataFromJSON(input.getJSONObject("rfidSessionData"));
|
|
2382
|
-
if (input.has("authenticityResult"))
|
|
2383
|
-
result.authenticityResult = DocumentReaderAuthenticityResultFromJSON(input.getJSONObject("authenticityResult"));
|
|
2384
|
-
if (input.has("barcodeResult"))
|
|
2385
|
-
result.barcodeResult = DocumentReaderBarcodeResultFromJSON(input.getJSONObject("barcodeResult"));
|
|
2386
|
-
if (input.has("documentType")){
|
|
2387
|
-
JSONArray jsonArray_documentType = input.getJSONArray("documentType");
|
|
2388
|
-
List<DocumentReaderDocumentType> documentType = new ArrayList<>();
|
|
2389
|
-
for (int i = 0; i < jsonArray_documentType.length(); i++)
|
|
2390
|
-
documentType.add(DocumentReaderDocumentTypeFromJSON(jsonArray_documentType.getJSONObject(i)));
|
|
2391
|
-
result.documentType = documentType;
|
|
2392
|
-
}
|
|
2393
|
-
return result;
|
|
2394
|
-
} catch (JSONException e) {
|
|
2395
|
-
e.printStackTrace();
|
|
2396
|
-
}
|
|
2397
|
-
return null;
|
|
2398
|
-
}
|
|
1180
|
+
// From JSON
|
|
2399
1181
|
}
|