@regulaforensics/cordova-plugin-document-reader-api 6.1.2 → 6.2.2
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/package.json +2 -2
- package/example/www/js/index.js +70 -67
- package/package.json +1 -1
- package/plugin.xml +2 -2
- package/src/android/JSONConstructor.java +81 -3
- package/src/android/build.gradle +1 -1
- package/src/ios/RGLWJSONConstructor.h +2 -0
- package/src/ios/RGLWJSONConstructor.m +63 -1
- package/www/DocumentReader.js +1439 -900
package/example/package.json
CHANGED
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"cordova-android": "^9.0.0",
|
|
17
17
|
"cordova-ios": "^6.1.1",
|
|
18
18
|
"cordova-plugin-add-swift-support": "^2.0.2",
|
|
19
|
-
"@regulaforensics/cordova-plugin-document-reader-api": "^6.
|
|
20
|
-
"@regulaforensics/cordova-plugin-document-reader-core-fullrfid": "^6.1
|
|
19
|
+
"@regulaforensics/cordova-plugin-document-reader-api": "^6.2.2",
|
|
20
|
+
"@regulaforensics/cordova-plugin-document-reader-core-fullrfid": "^6.2.1",
|
|
21
21
|
"cordova-plugin-file": "^6.0.2",
|
|
22
22
|
"cordova-plugin-image-picker": "^1.1.3",
|
|
23
23
|
"cordova-plugin-android-permissions": "1.1.0",
|
package/example/www/js/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var app = {
|
|
2
|
-
initialize: function
|
|
2
|
+
initialize: function() {
|
|
3
3
|
document.addEventListener('deviceready', this.onDeviceReady.bind(this), false)
|
|
4
4
|
},
|
|
5
5
|
|
|
6
|
-
onDeviceReady: function
|
|
6
|
+
onDeviceReady: function() {
|
|
7
7
|
this.receivedEvent('deviceready')
|
|
8
8
|
document.getElementById("status").innerHTML = "loading......"
|
|
9
9
|
document.getElementById("status").style.backgroundColor = "grey"
|
|
@@ -35,7 +35,7 @@ var app = {
|
|
|
35
35
|
input.value = DocumentReaderScenario.fromJson(typeof scenarios[index] === "string" ? JSON.parse(scenarios[index]) : scenarios[index]).name
|
|
36
36
|
if (index == 0)
|
|
37
37
|
input.checked = true
|
|
38
|
-
input.onclick = function
|
|
38
|
+
input.onclick = function() { DocumentReader.setConfig({ processParams: { scenario: this.value } }, function(m) {}, function(e) {}) }
|
|
39
39
|
input.style.display = "inline-block"
|
|
40
40
|
document.getElementById("scenariosRadioGroup").appendChild(input)
|
|
41
41
|
var label = document.createElement("span")
|
|
@@ -43,7 +43,7 @@ var app = {
|
|
|
43
43
|
label.style.display = "inline-block"
|
|
44
44
|
label.style.width = "200px"
|
|
45
45
|
label.radioButton = input
|
|
46
|
-
label.onclick = function
|
|
46
|
+
label.onclick = function() { this.radioButton.click() }
|
|
47
47
|
document.getElementById("scenariosRadioGroup").appendChild(label)
|
|
48
48
|
document.getElementById("scenariosRadioGroup").appendChild(document.createElement("br"))
|
|
49
49
|
}
|
|
@@ -51,25 +51,25 @@ var app = {
|
|
|
51
51
|
document.getElementById("rfidCheckbox").disabled = false
|
|
52
52
|
document.getElementById("rfidCheckboxText").style.color = "black"
|
|
53
53
|
document.getElementById("rfidCheckboxText").innerHTML = " Process rfid reading"
|
|
54
|
-
document.getElementById("rfidCheckboxText").onclick = function
|
|
55
|
-
document.getElementById("rfidCheckbox").onchange = function
|
|
54
|
+
document.getElementById("rfidCheckboxText").onclick = function() { document.getElementById("rfidCheckbox").click() }
|
|
55
|
+
document.getElementById("rfidCheckbox").onchange = function() { doRfid = this.checked }
|
|
56
56
|
}
|
|
57
57
|
document.getElementById("encryptionCheckbox").disabled = false
|
|
58
58
|
document.getElementById("encryptionCheckboxText").style.color = "black"
|
|
59
59
|
document.getElementById("encryptionCheckboxText").innerHTML = " Data encryption"
|
|
60
|
-
document.getElementById("encryptionCheckboxText").onclick = function
|
|
61
|
-
document.getElementById("encryptionCheckbox").onchange = function
|
|
60
|
+
document.getElementById("encryptionCheckboxText").onclick = function() { document.getElementById("encryptionCheckbox").click() }
|
|
61
|
+
document.getElementById("encryptionCheckbox").onchange = function() { encryption = this.checked }
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
function scan() {
|
|
65
|
-
DocumentReader.showScanner(function
|
|
65
|
+
DocumentReader.showScanner(function(m) {
|
|
66
66
|
handleCompletion(DocumentReader.DocumentReaderCompletion.fromJson(JSON.parse(m)))
|
|
67
|
-
}, function
|
|
67
|
+
}, function(e) {})
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
function recognizeAndroid() {
|
|
71
71
|
var permissions = cordova.plugins.permissions
|
|
72
|
-
permissions.checkPermission(permissions.READ_EXTERNAL_STORAGE, function
|
|
72
|
+
permissions.checkPermission(permissions.READ_EXTERNAL_STORAGE, function(status) {
|
|
73
73
|
if (status.hasPermission)
|
|
74
74
|
recognize()
|
|
75
75
|
else {
|
|
@@ -85,11 +85,11 @@ var app = {
|
|
|
85
85
|
|
|
86
86
|
function stopRfid() {
|
|
87
87
|
hideRfidUI()
|
|
88
|
-
DocumentReader.stopRFIDReader(function
|
|
88
|
+
DocumentReader.stopRFIDReader(function(e) {}, function(e) {})
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
function recognize() {
|
|
92
|
-
window.imagePicker.getPictures(function
|
|
92
|
+
window.imagePicker.getPictures(function(results) {
|
|
93
93
|
if (results.length > 0) {
|
|
94
94
|
clearResults()
|
|
95
95
|
document.getElementById("status").innerHTML = "copying image......"
|
|
@@ -97,14 +97,14 @@ var app = {
|
|
|
97
97
|
}
|
|
98
98
|
var images = []
|
|
99
99
|
for (var index in results)
|
|
100
|
-
readFile(results[index], function
|
|
100
|
+
readFile(results[index], function(base64) {
|
|
101
101
|
document.getElementById("status").innerHTML = "processing image......"
|
|
102
102
|
document.getElementById("status").style.backgroundColor = "grey"
|
|
103
103
|
images.push(base64)
|
|
104
104
|
if (images.length === results.length)
|
|
105
|
-
DocumentReader.recognizeImages(images, function
|
|
105
|
+
DocumentReader.recognizeImages(images, function(m) { handleCompletion(DocumentReader.DocumentReaderCompletion.fromJson(JSON.parse(m))) }, function(e) {})
|
|
106
106
|
})
|
|
107
|
-
}, function
|
|
107
|
+
}, function(e) {}, { maximumImagesCount: 10 })
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
function handleCompletion(completion) {
|
|
@@ -120,8 +120,8 @@ var app = {
|
|
|
120
120
|
hideRfidUI()
|
|
121
121
|
displayResults(completion.results)
|
|
122
122
|
}
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
else
|
|
124
|
+
handleResults(completion.results)
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
function showRfidUI() {
|
|
@@ -155,7 +155,7 @@ var app = {
|
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
function updateRfidUI(results) {
|
|
158
|
-
if (results.code === Enum.
|
|
158
|
+
if (results.code === Enum.eRFID_NotificationCodes.RFID_NOTIFICATION_PCSC_READING_DATAGROUP) {
|
|
159
159
|
rfidDescription = Enum.eRFID_DataFile_Type.getTranslation(results.number)
|
|
160
160
|
document.getElementById("rfidDescription").innerHTML = rfidDescription
|
|
161
161
|
}
|
|
@@ -166,12 +166,12 @@ var app = {
|
|
|
166
166
|
rfidProgress = results.value
|
|
167
167
|
document.getElementById("rfidProgress").value = rfidProgress
|
|
168
168
|
if (window.cordova.platformId === 'ios')
|
|
169
|
-
DocumentReader.setRfidSessionStatus(rfidDescription + "\n" + results.value + "%", function
|
|
169
|
+
DocumentReader.setRfidSessionStatus(rfidDescription + "\n" + results.value + "%", function(e) {}, function(e) {})
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
function customRFID() {
|
|
173
173
|
showRfidUI()
|
|
174
|
-
DocumentReader.readRFID(function
|
|
174
|
+
DocumentReader.readRFID(function(m) { handleCompletion(DocumentReader.DocumentReaderCompletion.fromJson(JSON.parse(m))) }, function(e) {})
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
function usualRFID() {
|
|
@@ -180,7 +180,7 @@ var app = {
|
|
|
180
180
|
var paCert = "paCertificateCompletionEvent"
|
|
181
181
|
var taCert = "taCertificateCompletionEvent"
|
|
182
182
|
var taSig = "taSignatureCompletionEvent"
|
|
183
|
-
DocumentReader.startRFIDReader(function
|
|
183
|
+
DocumentReader.startRFIDReader(function(m) {
|
|
184
184
|
if (m.substring(0, notification.length) === notification) {
|
|
185
185
|
m = m.substring(notification.length, m.length)
|
|
186
186
|
console.log(notification + ": " + m)
|
|
@@ -195,7 +195,7 @@ var app = {
|
|
|
195
195
|
console.log(taSig + ": " + m)
|
|
196
196
|
} else
|
|
197
197
|
handleCompletion(DocumentReader.DocumentReaderCompletion.fromJson(JSON.parse(m)))
|
|
198
|
-
}, function
|
|
198
|
+
}, function(e) {})
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
function handleResults(results) {
|
|
@@ -204,38 +204,39 @@ var app = {
|
|
|
204
204
|
accessKey = results.getTextFieldValueByType(DocumentReader.Enum.eVisualFieldType.FT_MRZ_STRINGS)
|
|
205
205
|
if (accessKey != null && accessKey != "") {
|
|
206
206
|
accessKey = accessKey.replace(/^/g, '').replace(/\n/g, '')
|
|
207
|
-
DocumentReader.setRfidScenario({ mrz: accessKey, pacePasswordType: DocumentReader.Enum.eRFID_Password_Type.PPT_MRZ }, function
|
|
207
|
+
DocumentReader.setRfidScenario({ mrz: accessKey, pacePasswordType: DocumentReader.Enum.eRFID_Password_Type.PPT_MRZ }, function(m) {}, function(e) {})
|
|
208
208
|
} else {
|
|
209
209
|
accessKey = results.getTextFieldValueByType(DocumentReader.Enum.eVisualFieldType.FT_CARD_ACCESS_NUMBER)
|
|
210
210
|
if (accessKey != null && accessKey != "")
|
|
211
|
-
DocumentReader.setRfidScenario({ password: accessKey, pacePasswordType: DocumentReader.Enum.eRFID_Password_Type.PPT_CAN }, function
|
|
211
|
+
DocumentReader.setRfidScenario({ password: accessKey, pacePasswordType: DocumentReader.Enum.eRFID_Password_Type.PPT_CAN }, function(m) {}, function(e) {})
|
|
212
212
|
}
|
|
213
213
|
//customRFID()
|
|
214
214
|
usualRFID()
|
|
215
215
|
} else
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
216
|
+
if (encryption) {
|
|
217
|
+
var input = JSON.parse(results.rawResult)
|
|
218
|
+
var processParam = {
|
|
219
|
+
alreadyCropped: true,
|
|
220
|
+
scenario: "FullProcess"
|
|
221
|
+
}
|
|
222
|
+
var body = {
|
|
223
|
+
List: input["ContainerList"]["List"],
|
|
224
|
+
processParam: processParam
|
|
225
|
+
}
|
|
226
|
+
postRequest(body)
|
|
227
|
+
} else
|
|
228
|
+
displayResults(results)
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
function postRequest(body) {
|
|
232
232
|
document.getElementById("status").innerHTML = "Getting results from server......"
|
|
233
233
|
document.getElementById("status").style.backgroundColor = "grey"
|
|
234
234
|
http.setDataSerializer('utf8')
|
|
235
|
-
http.post(ENCRYPTED_RESULT_SERVICE, JSON.stringify(body), { "content-type": "application/json; utf-8" }, function
|
|
236
|
-
DocumentReader.parseCoreResults(response.data, function
|
|
237
|
-
displayResults(DocumentReader.DocumentReaderResults.fromJson(JSON.parse(m)))
|
|
238
|
-
|
|
235
|
+
http.post(ENCRYPTED_RESULT_SERVICE, JSON.stringify(body), { "content-type": "application/json; utf-8" }, function(response) {
|
|
236
|
+
DocumentReader.parseCoreResults(response.data, function(m) {
|
|
237
|
+
displayResults(DocumentReader.DocumentReaderResults.fromJson(JSON.parse(m)))
|
|
238
|
+
}, function(e) {})
|
|
239
|
+
}, function(response) {
|
|
239
240
|
console.error(response.error)
|
|
240
241
|
document.getElementById("status").innerHTML = "Something went wrong!"
|
|
241
242
|
document.getElementById("status").style.backgroundColor = "red"
|
|
@@ -258,8 +259,8 @@ var app = {
|
|
|
258
259
|
}
|
|
259
260
|
|
|
260
261
|
function addCertificates() {
|
|
261
|
-
window.resolveLocalFileSystemURL(cordova.file.applicationDirectory + "www/certificates/", function
|
|
262
|
-
fileSystem.createReader().readEntries(function
|
|
262
|
+
window.resolveLocalFileSystemURL(cordova.file.applicationDirectory + "www/certificates/", function(fileSystem) {
|
|
263
|
+
fileSystem.createReader().readEntries(function(entries) {
|
|
263
264
|
for (var i in entries) {
|
|
264
265
|
var item = entries[i]
|
|
265
266
|
if (item.isFile) {
|
|
@@ -267,44 +268,44 @@ var app = {
|
|
|
267
268
|
var pkdResourceType = 0
|
|
268
269
|
if (findExt.length > 0)
|
|
269
270
|
pkdResourceType = Enum.PKDResourceType.getType(findExt[findExt.length - 1].toLowerCase())
|
|
270
|
-
readFile("www/certificates/" + item.name, function
|
|
271
|
+
readFile("www/certificates/" + item.name, function(file, resType) {
|
|
271
272
|
resType = resType[0]
|
|
272
273
|
var certificates = []
|
|
273
274
|
certificates.push({
|
|
274
275
|
'binaryData': file,
|
|
275
276
|
'resourceType': resType
|
|
276
277
|
})
|
|
277
|
-
DocumentReader.addPKDCertificates(certificates, function
|
|
278
|
+
DocumentReader.addPKDCertificates(certificates, function(s) {
|
|
278
279
|
console.log("certificate added")
|
|
279
|
-
}, function
|
|
280
|
+
}, function(e) { console.log(e) })
|
|
280
281
|
}, pkdResourceType)
|
|
281
282
|
}
|
|
282
283
|
}
|
|
283
|
-
}, function
|
|
284
|
-
}, function
|
|
284
|
+
}, function(err) { console.log(err) })
|
|
285
|
+
}, function(err) { console.log(err) })
|
|
285
286
|
}
|
|
286
287
|
|
|
287
288
|
function readFile(path, callback, ...items) {
|
|
288
289
|
if (path.substring(0, 8) !== "file:///")
|
|
289
290
|
path = cordova.file.applicationDirectory + path
|
|
290
|
-
window.resolveLocalFileSystemURL(path, function
|
|
291
|
-
fileEntry.file(function
|
|
291
|
+
window.resolveLocalFileSystemURL(path, function(fileEntry) {
|
|
292
|
+
fileEntry.file(function(file) {
|
|
292
293
|
var reader = new FileReader()
|
|
293
|
-
reader.onloadend = function
|
|
294
|
+
reader.onloadend = function(e) {
|
|
294
295
|
callback(this.result.substring(this.result.indexOf(',') + 1), items)
|
|
295
296
|
}
|
|
296
297
|
reader.readAsDataURL(file)
|
|
297
298
|
})
|
|
298
|
-
}, function
|
|
299
|
+
}, function(e) { console.log(JSON.stringify(e)) })
|
|
299
300
|
}
|
|
300
301
|
|
|
301
|
-
readFile("www/regula.license", function
|
|
302
|
-
DocumentReader.prepareDatabase("Full", function
|
|
302
|
+
readFile("www/regula.license", function(license) {
|
|
303
|
+
DocumentReader.prepareDatabase("Full", function(message) {
|
|
303
304
|
if (message != "database prepared")
|
|
304
305
|
document.getElementById("status").innerHTML = "Downloading database: " + message + "%"
|
|
305
306
|
else {
|
|
306
307
|
document.getElementById("status").innerHTML = "Loading......"
|
|
307
|
-
DocumentReader.initializeReader(license, function
|
|
308
|
+
DocumentReader.initializeReader(license, function(message) {
|
|
308
309
|
document.getElementById("status").innerHTML = "Ready"
|
|
309
310
|
document.getElementById("status").style.backgroundColor = "green"
|
|
310
311
|
document.getElementById("showScannerButton").addEventListener("click", scan)
|
|
@@ -316,30 +317,32 @@ var app = {
|
|
|
316
317
|
functionality: {
|
|
317
318
|
videoCaptureMotionControl: true,
|
|
318
319
|
showCaptureButton: true
|
|
319
|
-
},
|
|
320
|
+
},
|
|
321
|
+
customization: {
|
|
320
322
|
showResultStatusMessages: true,
|
|
321
323
|
showStatusMessages: true
|
|
322
|
-
},
|
|
324
|
+
},
|
|
325
|
+
processParams: {
|
|
323
326
|
scenario: "Mrz",
|
|
324
327
|
doRfid: false,
|
|
325
328
|
},
|
|
326
|
-
}, function
|
|
327
|
-
DocumentReader.getAvailableScenarios(function
|
|
328
|
-
DocumentReader.isRFIDAvailableForUse(function
|
|
329
|
-
}, function
|
|
330
|
-
DocumentReader.setRfidDelegate(Enum.RFIDDelegate.NO_PA, function
|
|
331
|
-
|
|
332
|
-
}, function
|
|
329
|
+
}, function(m) {}, function(e) {})
|
|
330
|
+
DocumentReader.getAvailableScenarios(function(s) {
|
|
331
|
+
DocumentReader.isRFIDAvailableForUse(function(r) { postInitialize(JSON.parse(s), r) }, function(e) {})
|
|
332
|
+
}, function(e) {})
|
|
333
|
+
DocumentReader.setRfidDelegate(Enum.RFIDDelegate.NO_PA, function(r) {}, function(e) {})
|
|
334
|
+
// addCertificates()
|
|
335
|
+
}, function(error) {
|
|
333
336
|
console.log(error)
|
|
334
337
|
document.getElementById("status").innerHTML = error
|
|
335
338
|
document.getElementById("status").style.backgroundColor = "red"
|
|
336
339
|
})
|
|
337
340
|
}
|
|
338
|
-
}, function
|
|
341
|
+
}, function(e) { console.log(e) })
|
|
339
342
|
})
|
|
340
343
|
},
|
|
341
344
|
|
|
342
|
-
receivedEvent: function
|
|
345
|
+
receivedEvent: function(id) {
|
|
343
346
|
var parentElement = document.getElementById(id)
|
|
344
347
|
var listeningElement = parentElement.querySelector('.listening')
|
|
345
348
|
var receivedElement = parentElement.querySelector('.received')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@regulaforensics/cordova-plugin-document-reader-api",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.2",
|
|
4
4
|
"description": "Cordova plugin for reading and validation of identification documents (API framework)",
|
|
5
5
|
"cordova": {
|
|
6
6
|
"id": "@regulaforensics/cordova-plugin-document-reader-api",
|
package/plugin.xml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<?xml version='1.0' encoding='utf-8'?>
|
|
2
|
-
<plugin id="cordova-plugin-document-reader-api" version="6.
|
|
2
|
+
<plugin id="cordova-plugin-document-reader-api" version="6.2.2"
|
|
3
3
|
xmlns="http://apache.org/cordova/ns/plugins/1.0">
|
|
4
4
|
<name>DocumentReaderApi</name>
|
|
5
5
|
<description>Cordova plugin Document reader api</description>
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
<podspec>
|
|
26
26
|
<config/>
|
|
27
27
|
<pods>
|
|
28
|
-
<pod name="DocumentReader" spec="~> 6.
|
|
28
|
+
<pod name="DocumentReader" spec="~> 6.2.2441" />
|
|
29
29
|
</pods>
|
|
30
30
|
</podspec>
|
|
31
31
|
</platform>
|
|
@@ -42,6 +42,7 @@ import com.regula.documentreader.api.results.VDSNCData;
|
|
|
42
42
|
import com.regula.documentreader.api.results.authenticity.DocumentReaderAuthenticityCheck;
|
|
43
43
|
import com.regula.documentreader.api.results.authenticity.DocumentReaderAuthenticityElement;
|
|
44
44
|
import com.regula.documentreader.api.results.authenticity.DocumentReaderAuthenticityResult;
|
|
45
|
+
import com.regula.documentreader.api.results.authenticity.DocumentReaderUvFiberElement;
|
|
45
46
|
import com.regula.documentreader.api.results.rfid.AccessControlProcedureType;
|
|
46
47
|
import com.regula.documentreader.api.results.rfid.Application;
|
|
47
48
|
import com.regula.documentreader.api.results.rfid.Attribute;
|
|
@@ -606,9 +607,9 @@ class JSONConstructor {
|
|
|
606
607
|
JSONObject result = new JSONObject();
|
|
607
608
|
if (input == null) return result;
|
|
608
609
|
try {
|
|
609
|
-
result.put("code", input.
|
|
610
|
-
result.put("
|
|
611
|
-
result.put("value", input.
|
|
610
|
+
result.put("code", input.getNotificationCode());
|
|
611
|
+
result.put("attachment", input.getDataFileType());
|
|
612
|
+
result.put("value", input.getProgress());
|
|
612
613
|
} catch (JSONException e) {
|
|
613
614
|
e.printStackTrace();
|
|
614
615
|
}
|
|
@@ -1141,6 +1142,28 @@ class JSONConstructor {
|
|
|
1141
1142
|
return result;
|
|
1142
1143
|
}
|
|
1143
1144
|
|
|
1145
|
+
static JSONObject generateDocumentReaderUvFiberElement(DocumentReaderUvFiberElement input, Context context) {
|
|
1146
|
+
JSONObject result = new JSONObject();
|
|
1147
|
+
if (input == null) return result;
|
|
1148
|
+
try {
|
|
1149
|
+
result.put("rectArray", generateList(input.rectArray, JSONConstructor::generateDocReaderFieldRect));
|
|
1150
|
+
result.put("rectCount", input.rectCount);
|
|
1151
|
+
result.put("expectedCount", input.expectedCount);
|
|
1152
|
+
result.put("width", generateIntArray(input.width));
|
|
1153
|
+
result.put("length", generateIntArray(input.length));
|
|
1154
|
+
result.put("area", generateIntArray(input.area));
|
|
1155
|
+
result.put("colorValues", generateIntArray(input.colorValues));
|
|
1156
|
+
result.put("status", input.status);
|
|
1157
|
+
result.put("elementType", input.elementType);
|
|
1158
|
+
result.put("elementDiagnose", input.elementDiagnose);
|
|
1159
|
+
result.put("elementTypeName", input.getElementTypeName(context));
|
|
1160
|
+
result.put("elementDiagnoseName", input.getElementDiagnoseName(context));
|
|
1161
|
+
} catch (JSONException e) {
|
|
1162
|
+
e.printStackTrace();
|
|
1163
|
+
}
|
|
1164
|
+
return result;
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1144
1167
|
static JSONObject generateDocumentReaderResults(DocumentReaderResults input, Context context) {
|
|
1145
1168
|
JSONObject result = new JSONObject();
|
|
1146
1169
|
if (input == null) return result;
|
|
@@ -2172,6 +2195,61 @@ class JSONConstructor {
|
|
|
2172
2195
|
return null;
|
|
2173
2196
|
}
|
|
2174
2197
|
|
|
2198
|
+
static DocumentReaderUvFiberElement DocumentReaderUvFiberElementFromJSON(JSONObject input) {
|
|
2199
|
+
try {
|
|
2200
|
+
DocumentReaderUvFiberElement result = new DocumentReaderUvFiberElement();
|
|
2201
|
+
if (input.has("rectArray")){
|
|
2202
|
+
JSONArray jsonArray_rectArray = input.getJSONArray("rectArray");
|
|
2203
|
+
List<DocReaderFieldRect> rectArray = new ArrayList<>();
|
|
2204
|
+
for (int i = 0; i < jsonArray_rectArray.length(); i++)
|
|
2205
|
+
rectArray.add(DocReaderFieldRectFromJSON(jsonArray_rectArray.getJSONObject(i)));
|
|
2206
|
+
result.rectArray = rectArray;
|
|
2207
|
+
}
|
|
2208
|
+
if (input.has("rectCount"))
|
|
2209
|
+
result.rectCount = input.getInt("rectCount");
|
|
2210
|
+
if (input.has("expectedCount"))
|
|
2211
|
+
result.expectedCount = input.getInt("expectedCount");
|
|
2212
|
+
if (input.has("width")){
|
|
2213
|
+
JSONArray jsonArray_width = input.getJSONArray("width");
|
|
2214
|
+
int[] width = new int[jsonArray_width.length()];
|
|
2215
|
+
for (int i = 0; i < jsonArray_width.length(); i++)
|
|
2216
|
+
width[i] = jsonArray_width.getInt(i);
|
|
2217
|
+
result.width = width;
|
|
2218
|
+
}
|
|
2219
|
+
if (input.has("length")){
|
|
2220
|
+
JSONArray jsonArray_length = input.getJSONArray("length");
|
|
2221
|
+
int[] length = new int[jsonArray_length.length()];
|
|
2222
|
+
for (int i = 0; i < jsonArray_length.length(); i++)
|
|
2223
|
+
length[i] = jsonArray_length.getInt(i);
|
|
2224
|
+
result.length = length;
|
|
2225
|
+
}
|
|
2226
|
+
if (input.has("area")){
|
|
2227
|
+
JSONArray jsonArray_area = input.getJSONArray("area");
|
|
2228
|
+
int[] area = new int[jsonArray_area.length()];
|
|
2229
|
+
for (int i = 0; i < jsonArray_area.length(); i++)
|
|
2230
|
+
area[i] = jsonArray_area.getInt(i);
|
|
2231
|
+
result.area = area;
|
|
2232
|
+
}
|
|
2233
|
+
if (input.has("colorValues")){
|
|
2234
|
+
JSONArray jsonArray_colorValues = input.getJSONArray("colorValues");
|
|
2235
|
+
int[] colorValues = new int[jsonArray_colorValues.length()];
|
|
2236
|
+
for (int i = 0; i < jsonArray_colorValues.length(); i++)
|
|
2237
|
+
colorValues[i] = jsonArray_colorValues.getInt(i);
|
|
2238
|
+
result.colorValues = colorValues;
|
|
2239
|
+
}
|
|
2240
|
+
if (input.has("status"))
|
|
2241
|
+
result.status = input.getInt("status");
|
|
2242
|
+
if (input.has("elementType"))
|
|
2243
|
+
result.elementType = input.getInt("elementType");
|
|
2244
|
+
if (input.has("elementDiagnose"))
|
|
2245
|
+
result.elementDiagnose = input.getInt("elementDiagnose");
|
|
2246
|
+
return result;
|
|
2247
|
+
} catch (JSONException e) {
|
|
2248
|
+
e.printStackTrace();
|
|
2249
|
+
}
|
|
2250
|
+
return null;
|
|
2251
|
+
}
|
|
2252
|
+
|
|
2175
2253
|
static DocumentReaderResults DocumentReaderResultsFromJSON(JSONObject input) {
|
|
2176
2254
|
try {
|
|
2177
2255
|
DocumentReaderResults result = new DocumentReaderResults();
|
package/src/android/build.gradle
CHANGED
|
@@ -61,6 +61,8 @@
|
|
|
61
61
|
+(NSMutableDictionary* _Nonnull)generateRGLVDSNCData:(RGLVDSNCData* _Nullable)input;
|
|
62
62
|
+(NSMutableDictionary* _Nonnull)generateRGLBytesData:(RGLBytesData* _Nullable)input;
|
|
63
63
|
+(NSMutableDictionary* _Nonnull)generateRGLRFIDNotify:(RGLRFIDNotify* _Nullable)input;
|
|
64
|
+
+(NSMutableDictionary* _Nonnull)generateRGLUVFiberElement:(RGLUVFiberElement* _Nullable)input;
|
|
65
|
+
+(NSMutableDictionary* _Nonnull)generateRGLElementRect:(RGLElementRect* _Nullable)input;
|
|
64
66
|
|
|
65
67
|
@end
|
|
66
68
|
#endif
|
|
@@ -1002,7 +1002,69 @@
|
|
|
1002
1002
|
|
|
1003
1003
|
result[@"code"] = @(input.code);
|
|
1004
1004
|
result[@"value"] = @(input.value);
|
|
1005
|
-
result[@"
|
|
1005
|
+
result[@"attachment"] = @(input.attachment);
|
|
1006
|
+
|
|
1007
|
+
return result;
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
+(NSMutableDictionary* _Nonnull)generateRGLUVFiberElement:(RGLUVFiberElement* _Nullable)input {
|
|
1011
|
+
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
1012
|
+
if(input == nil) return result;
|
|
1013
|
+
|
|
1014
|
+
if(input.rectArray != nil){
|
|
1015
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
1016
|
+
for(RGLElementRect* item in input.rectArray)
|
|
1017
|
+
if(item != nil)
|
|
1018
|
+
[array addObject:[self generateRGLElementRect:item]];
|
|
1019
|
+
result[@"rectArray"] = array;
|
|
1020
|
+
}
|
|
1021
|
+
result[@"rectCount"] = @(input.rectCount);
|
|
1022
|
+
result[@"expectedCount"] = @(input.expectedCount);
|
|
1023
|
+
if(input.width != nil){
|
|
1024
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
1025
|
+
for(NSNumber* item in input.width)
|
|
1026
|
+
if(item != nil)
|
|
1027
|
+
[array addObject:item];
|
|
1028
|
+
result[@"width"] = array;
|
|
1029
|
+
}
|
|
1030
|
+
if(input.length != nil){
|
|
1031
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
1032
|
+
for(NSNumber* item in input.length)
|
|
1033
|
+
if(item != nil)
|
|
1034
|
+
[array addObject:item];
|
|
1035
|
+
result[@"length"] = array;
|
|
1036
|
+
}
|
|
1037
|
+
if(input.area != nil){
|
|
1038
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
1039
|
+
for(NSNumber* item in input.area)
|
|
1040
|
+
if(item != nil)
|
|
1041
|
+
[array addObject:item];
|
|
1042
|
+
result[@"area"] = array;
|
|
1043
|
+
}
|
|
1044
|
+
if(input.colorValues != nil){
|
|
1045
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
1046
|
+
for(NSNumber* item in input.colorValues)
|
|
1047
|
+
if(item != nil)
|
|
1048
|
+
[array addObject:item];
|
|
1049
|
+
result[@"colorValues"] = array;
|
|
1050
|
+
}
|
|
1051
|
+
result[@"status"] = @(input.status);
|
|
1052
|
+
result[@"elementType"] = @(input.elementType);
|
|
1053
|
+
result[@"elementTypeName"] = input.elementTypeName;
|
|
1054
|
+
result[@"elementDiagnose"] = @(input.elementDiagnose);
|
|
1055
|
+
result[@"elementDiagnoseName"] = input.elementDiagnoseName;
|
|
1056
|
+
|
|
1057
|
+
return result;
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
+(NSMutableDictionary* _Nonnull)generateRGLElementRect:(RGLElementRect* _Nullable)input {
|
|
1061
|
+
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
1062
|
+
if(input == nil) return result;
|
|
1063
|
+
|
|
1064
|
+
result[@"bottom"] = @(input.bottom);
|
|
1065
|
+
result[@"left"] = @(input.left);
|
|
1066
|
+
result[@"right"] = @(input.right);
|
|
1067
|
+
result[@"top"] = @(input.top);
|
|
1006
1068
|
|
|
1007
1069
|
return result;
|
|
1008
1070
|
}
|