@regulaforensics/cordova-plugin-document-reader-api 9.11.937-rc → 9.11.939-rc
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/package.json +1 -1
- package/plugin.xml +8 -10
- package/src/android/build.gradle +1 -1
- package/src/ios/Config.swift +1115 -0
- package/src/ios/Decoder.swift +1866 -0
- package/src/ios/Implementation.swift +346 -0
- package/src/ios/RGLWDocumentReader.swift +86 -0
- package/src/ios/Utils.swift +167 -0
- package/src/ios/RGLWConfig.h +0 -44
- package/src/ios/RGLWConfig.m +0 -1577
- package/src/ios/RGLWDocumentReader.h +0 -7
- package/src/ios/RGLWDocumentReader.m +0 -41
- package/src/ios/RGLWJSONConstructor.h +0 -216
- package/src/ios/RGLWJSONConstructor.m +0 -2875
- package/src/ios/RGLWMain.h +0 -34
- package/src/ios/RGLWMain.m +0 -722
package/src/ios/RGLWMain.m
DELETED
|
@@ -1,722 +0,0 @@
|
|
|
1
|
-
#import "RGLWMain.h"
|
|
2
|
-
|
|
3
|
-
@implementation RGLWMain
|
|
4
|
-
|
|
5
|
-
+(void)methodCall:(NSString*)method :(NSArray*)args :(RGLWCallback)callback :(RGLWEventSender)eventSender {
|
|
6
|
-
if(!this) this = [RGLWMain new];
|
|
7
|
-
sendEvent = eventSender;
|
|
8
|
-
NSDictionary* Switch = @{
|
|
9
|
-
@"getDocumentReaderIsReady": ^{ [self getDocumentReaderIsReady :callback]; },
|
|
10
|
-
@"getDocumentReaderStatus": ^{ [self getDocumentReaderStatus :callback]; },
|
|
11
|
-
@"getRfidSessionStatus": ^{ [self getRfidSessionStatus :callback]; },
|
|
12
|
-
@"setRfidSessionStatus": ^{ [self setRfidSessionStatus :args[0]]; },
|
|
13
|
-
@"getTag": ^{ [self getTag :callback]; },
|
|
14
|
-
@"setTag": ^{ [self setTag :args[0]]; },
|
|
15
|
-
@"getTenant": ^{ [self getTenant :callback]; },
|
|
16
|
-
@"setTenant": ^{ [self setTenant :args[0]]; },
|
|
17
|
-
@"getEnv": ^{ [self getEnv :callback]; },
|
|
18
|
-
@"setEnv": ^{ [self setEnv :args[0]]; },
|
|
19
|
-
@"getLocale": ^{ [self getLocale :callback]; },
|
|
20
|
-
@"setLocale": ^{ [self setLocale :args[0]]; },
|
|
21
|
-
@"getFunctionality": ^{ [self getFunctionality :callback]; },
|
|
22
|
-
@"setFunctionality": ^{ [self setFunctionality :args[0]]; },
|
|
23
|
-
@"getProcessParams": ^{ [self getProcessParams :callback]; },
|
|
24
|
-
@"setProcessParams": ^{ [self setProcessParams :args[0]]; },
|
|
25
|
-
@"getCustomization": ^{ [self getCustomization :callback]; },
|
|
26
|
-
@"setCustomization": ^{ [self setCustomization :args[0]]; },
|
|
27
|
-
@"getRfidScenario": ^{ [self getRfidScenario :callback]; },
|
|
28
|
-
@"setRfidScenario": ^{ [self setRfidScenario :args[0]]; },
|
|
29
|
-
@"resetConfiguration": ^{ [self resetConfiguration]; },
|
|
30
|
-
@"initialize": ^{ [self initialize :args[0] :callback]; },
|
|
31
|
-
@"initializeReader": ^{ [self initialize :args[0] :callback]; }, // deprecated
|
|
32
|
-
@"initializeReaderWithBleDeviceConfig": ^{ [self initializeReaderWithBleDeviceConfig :args[0] :callback]; }, // deprecated
|
|
33
|
-
@"deinitializeReader": ^{ [self deinitializeReader]; },
|
|
34
|
-
@"prepareDatabase": ^{ [self prepareDatabase :args[0] :callback]; },
|
|
35
|
-
@"removeDatabase": ^{ [self removeDatabase :callback]; },
|
|
36
|
-
@"runAutoUpdate": ^{ [self runAutoUpdate :args[0] :callback]; },
|
|
37
|
-
@"cancelDBUpdate": ^{ [self cancelDBUpdate :callback]; },
|
|
38
|
-
@"checkDatabaseUpdate": ^{ [self checkDatabaseUpdate :args[0] :callback]; },
|
|
39
|
-
@"scan": ^{ [self startScanner :args[0]]; },
|
|
40
|
-
@"startScanner": ^{ [self startScanner :args[0]]; },
|
|
41
|
-
@"recognize": ^{ [self recognize :args[0]]; },
|
|
42
|
-
@"startNewPage": ^{ [self startNewPage]; },
|
|
43
|
-
@"stopScanner": ^{ [self stopScanner]; },
|
|
44
|
-
@"startRFIDReader": ^{ [self startRFIDReader :args[0]]; },
|
|
45
|
-
@"readRFID": ^{ [self readRFID :args[0]]; },
|
|
46
|
-
@"stopRFIDReader": ^{ [self stopRFIDReader]; },
|
|
47
|
-
@"providePACertificates": ^{ [self providePACertificates :args[0]]; },
|
|
48
|
-
@"provideTACertificates": ^{ [self provideTACertificates :args[0]]; },
|
|
49
|
-
@"provideTASignature": ^{ [self provideTASignature :args[0]]; },
|
|
50
|
-
@"provideAAChallenge": ^{ [self provideAAChallenge :args[0]]; },
|
|
51
|
-
@"selectPACEProtocol": ^{ [self selectPACEProtocol :args[0]]; },
|
|
52
|
-
@"selectCAProtocol": ^{ [self selectCAProtocol :args[0]]; },
|
|
53
|
-
@"setTCCParams": ^{ [self setTCCParams :args[0] :callback]; },
|
|
54
|
-
@"addPKDCertificates": ^{ [self addPKDCertificates :args[0]]; },
|
|
55
|
-
@"clearPKDCertificates": ^{ [self clearPKDCertificates]; },
|
|
56
|
-
@"startNewSession": ^{ [self startNewSession]; },
|
|
57
|
-
@"connectBluetoothDevice": ^{ [self connectBluetoothDevice :args[0] :callback]; },
|
|
58
|
-
@"btDeviceRequestFlashing": ^{ /* android only */ },
|
|
59
|
-
@"btDeviceRequestFlashingFullIR": ^{ /* android only */ },
|
|
60
|
-
@"btDeviceRequestTurnOffAll": ^{ /* android only */ },
|
|
61
|
-
@"startReadMDl": ^{ [self startReadMDl :args[0] :args[1] :callback]; },
|
|
62
|
-
@"startEngageDevice": ^{ [self startEngageDevice :args[0] :callback]; },
|
|
63
|
-
@"engageDeviceNFC": ^{ [self engageDeviceNFC :callback]; },
|
|
64
|
-
@"engageDeviceData": ^{ [self engageDeviceData :args[0] :callback]; },
|
|
65
|
-
@"startRetrieveData": ^{ [self startRetrieveData :args[0] :args[1] :callback]; },
|
|
66
|
-
@"retrieveDataNFC": ^{ [self retrieveDataNFC :args[0] :callback]; },
|
|
67
|
-
@"retrieveDataBLE": ^{ [self retrieveDataBLE :args[0] :args[0] :callback]; },
|
|
68
|
-
@"setLocalizationDictionary": ^{ [self setLocalizationDictionary :args[0]]; },
|
|
69
|
-
@"getLicense": ^{ [self getLicense :callback]; },
|
|
70
|
-
@"getAvailableScenarios": ^{ [self getAvailableScenarios :callback]; },
|
|
71
|
-
@"getIsRFIDAvailableForUse": ^{ [self getIsRFIDAvailableForUse :callback]; },
|
|
72
|
-
@"isAuthenticatorRFIDAvailableForUse": ^{ [self isAuthenticatorRFIDAvailableForUse :callback]; },
|
|
73
|
-
@"isAuthenticatorAvailableForUse": ^{ [self isAuthenticatorAvailableForUse :callback]; },
|
|
74
|
-
@"getDocReaderVersion": ^{ [self getDocReaderVersion :callback]; },
|
|
75
|
-
@"getDocReaderDocumentsDatabase": ^{ [self getDocReaderDocumentsDatabase :callback]; },
|
|
76
|
-
@"finalizePackage": ^{ [self finalizePackage :callback]; },
|
|
77
|
-
@"finalizePackageWithFinalizeConfig": ^{ [self finalizePackageWithFinalizeConfig :args[0] :callback]; },
|
|
78
|
-
@"endBackendTransaction": ^{ [self endBackendTransaction]; },
|
|
79
|
-
@"textFieldValueByType": ^{ [self textFieldValueByType :args[0] :args[1] :callback]; },
|
|
80
|
-
@"textFieldValueByTypeLcid": ^{ [self textFieldValueByTypeLcid :args[0] :args[1] :args[2] :callback]; },
|
|
81
|
-
@"textFieldValueByTypeSource": ^{ [self textFieldValueByTypeSource :args[0] :args[1] :args[2] :callback]; },
|
|
82
|
-
@"textFieldValueByTypeLcidSource": ^{ [self textFieldValueByTypeLcidSource :args[0] :args[1] :args[2] :args[3] :callback]; },
|
|
83
|
-
@"textFieldValueByTypeSourceOriginal": ^{ [self textFieldValueByTypeSourceOriginal :args[0] :args[1] :args[2] :args[3] :callback]; },
|
|
84
|
-
@"textFieldValueByTypeLcidSourceOriginal": ^{ [self textFieldValueByTypeLcidSourceOriginal :args[0] :args[1] :args[2] :args[3] :args[4] :callback]; },
|
|
85
|
-
@"textFieldByType": ^{ [self textFieldByType :args[0] :args[1] :callback]; },
|
|
86
|
-
@"textFieldByTypeLcid": ^{ [self textFieldByTypeLcid :args[0] :args[1] :args[2] :callback]; },
|
|
87
|
-
@"graphicFieldByTypeSource": ^{ [self graphicFieldByTypeSource :args[0] :args[1] :args[2] :callback]; },
|
|
88
|
-
@"graphicFieldByTypeSourcePageIndex": ^{ [self graphicFieldByTypeSourcePageIndex :args[0] :args[1] :args[2] :args[3] :callback]; },
|
|
89
|
-
@"graphicFieldByTypeSourcePageIndexLight": ^{ [self graphicFieldByTypeSourcePageIndexLight :args[0] :args[1] :args[2] :args[3] :args[4] :callback]; },
|
|
90
|
-
@"graphicFieldImageByType": ^{ [self graphicFieldImageByType :args[0] :args[1] :callback]; },
|
|
91
|
-
@"graphicFieldImageByTypeSource": ^{ [self graphicFieldImageByTypeSource :args[0] :args[1] :args[2] :callback]; },
|
|
92
|
-
@"graphicFieldImageByTypeSourcePageIndex": ^{ [self graphicFieldImageByTypeSourcePageIndex :args[0] :args[1] :args[2] :args[3] :callback]; },
|
|
93
|
-
@"graphicFieldImageByTypeSourcePageIndexLight": ^{ [self graphicFieldImageByTypeSourcePageIndexLight :args[0] :args[1] :args[2] :args[3] :args[4] :callback]; },
|
|
94
|
-
@"containers": ^{ [self containers :args[0] :args[1] :callback]; },
|
|
95
|
-
@"encryptedContainers": ^{ [self encryptedContainers :args[0] :callback]; },
|
|
96
|
-
@"getTranslation": ^{ [self getTranslation :args[0] :args[1] :callback]; },
|
|
97
|
-
};
|
|
98
|
-
((void(^)(void))Switch[method])();
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
static RGLWMain* this;
|
|
102
|
-
static RGLWEventSender sendEvent;
|
|
103
|
-
static NSDictionary* headers;
|
|
104
|
-
|
|
105
|
-
+(void)getDocumentReaderIsReady:(RGLWCallback)callback {
|
|
106
|
-
callback([RGLDocReader.shared isDocumentReaderIsReady] ? @YES : @NO);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
+(void)getDocumentReaderStatus:(RGLWCallback)callback {
|
|
110
|
-
callback(RGLDocReader.shared.documentReaderStatus);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
+(void)getRfidSessionStatus:(RGLWCallback)callback {
|
|
114
|
-
callback(RGLDocReader.shared.rfidSessionStatus);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
+(void)setRfidSessionStatus:(NSString*)status {
|
|
118
|
-
RGLDocReader.shared.rfidSessionStatus = status;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
+(void)getTag:(RGLWCallback)callback {
|
|
122
|
-
callback([RGLDocReader.shared tag]);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
+(void)setTag:(NSString*)tag {
|
|
126
|
-
[RGLDocReader.shared setTag:tag];
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
+(void)getTenant:(RGLWCallback)callback {
|
|
130
|
-
callback([RGLDocReader.shared tenant]);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
+(void)setTenant:(NSString*)tag {
|
|
134
|
-
[RGLDocReader.shared setTenant:tag];
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
+(void)getEnv:(RGLWCallback)callback {
|
|
138
|
-
callback([RGLDocReader.shared env]);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
+(void)setEnv:(NSString*)tag {
|
|
142
|
-
[RGLDocReader.shared setEnv:tag];
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
+(void)getLocale:(RGLWCallback)callback {
|
|
146
|
-
callback([RGLDocReader.shared languageLocaleCode]);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
+(void)setLocale:(NSString*)locale {
|
|
150
|
-
[RGLDocReader.shared setLanguageLocaleCode:locale];
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
+(void)getFunctionality:(RGLWCallback)callback {
|
|
154
|
-
callback([RGLWJSONConstructor dictToString: [RGLWConfig getFunctionality: RGLDocReader.shared.functionality]]);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
+(void)setFunctionality:(NSDictionary*)functionality {
|
|
158
|
-
[RGLWConfig setFunctionality:functionality :RGLDocReader.shared.functionality];
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
+(void)getProcessParams:(RGLWCallback)callback {
|
|
162
|
-
callback([RGLWJSONConstructor dictToString: [RGLWConfig getProcessParams:RGLDocReader.shared.processParams]]);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
+(void)setProcessParams:(NSDictionary*)processParams {
|
|
166
|
-
[RGLWConfig setProcessParams:processParams :RGLDocReader.shared.processParams];
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
+(void)getCustomization:(RGLWCallback)callback {
|
|
170
|
-
callback([RGLWJSONConstructor dictToString: [RGLWConfig getCustomization :RGLDocReader.shared.customization]]);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
+(void)setCustomization:(NSDictionary*)customization {
|
|
174
|
-
[RGLWConfig setCustomization:customization :RGLDocReader.shared.customization];
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
+(void)getRfidScenario:(RGLWCallback)callback {
|
|
178
|
-
callback([RGLWJSONConstructor dictToString: [RGLWConfig getRfidScenario:RGLDocReader.shared.rfidScenario]]);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
+(void)setRfidScenario:(NSDictionary*)rfidScenario {
|
|
182
|
-
[RGLWConfig setRfidScenario:rfidScenario :RGLDocReader.shared.rfidScenario];
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
+(void)resetConfiguration {
|
|
186
|
-
RGLDocReader.shared.functionality = [RGLFunctionality new];
|
|
187
|
-
RGLDocReader.shared.processParams = [RGLProcessParams new];
|
|
188
|
-
RGLDocReader.shared.customization = [RGLCustomization new];
|
|
189
|
-
RGLDocReader.shared.rfidScenario = [RGLRFIDScenario new];
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
+(void)initialize:(NSDictionary*)config :(RGLWCallback)callback {
|
|
193
|
-
if (config[@"useBleDevice"] && [config[@"useBleDevice"] boolValue] == true)
|
|
194
|
-
[RGLDocReader.shared initializeReaderWithConfig:[RGLWJSONConstructor bleDeviceConfigFromJson:config :bluetooth] completion: [self initCompletion :callback]];
|
|
195
|
-
else
|
|
196
|
-
[RGLDocReader.shared initializeReaderWithConfig:[RGLWJSONConstructor configFromJson:config] completion:[self initCompletion :callback]];
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// deprecated
|
|
200
|
-
+(void)initializeReaderWithBleDeviceConfig:(NSDictionary*)config :(RGLWCallback)callback {
|
|
201
|
-
[RGLDocReader.shared initializeReaderWithConfig:[RGLWJSONConstructor bleDeviceConfigFromJson:config :bluetooth] completion: [self initCompletion :callback]];
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
+(void)deinitializeReader {
|
|
205
|
-
[RGLDocReader.shared deinitializeReader];
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
+(void)prepareDatabase:(NSString*)databaseID :(RGLWCallback)callback {
|
|
209
|
-
[RGLDocReader.shared prepareDatabase:databaseID progressHandler:nil completion:[self prepareCompletion :callback]];
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
+(void)removeDatabase:(RGLWCallback)callback {
|
|
213
|
-
[RGLDocReader.shared removeDatabase:^(BOOL success, NSError * _Nullable error) {
|
|
214
|
-
callback(success ? @YES : @NO);
|
|
215
|
-
}];
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
+(void)runAutoUpdate:(NSString*)databaseID :(RGLWCallback)callback {
|
|
219
|
-
[RGLDocReader.shared runAutoUpdate:databaseID progressHandler:nil completion:[self prepareCompletion :callback]];
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
+(void)cancelDBUpdate:(RGLWCallback)callback {
|
|
223
|
-
[RGLDocReader.shared cancelDBUpdate];
|
|
224
|
-
callback(@YES);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
+(void)checkDatabaseUpdate:(NSString*)databaseID :(RGLWCallback)callback {
|
|
228
|
-
[RGLDocReader.shared checkDatabaseUpdate:databaseID completion:^(RGLDocReaderDocumentsDatabase* database) {
|
|
229
|
-
callback([RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateDocReaderDocumentsDatabase:database]]);
|
|
230
|
-
}];
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
+(void)startScanner:(NSDictionary*)config {
|
|
234
|
-
dispatch_async(dispatch_get_main_queue(), ^{
|
|
235
|
-
[RGLDocReader.shared startScannerFromPresenter:RGLWRootViewController() config:[RGLWJSONConstructor scannerConfigFromJson:config] completion:[self completion]];
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
+(void)recognize:(NSDictionary*)config {
|
|
240
|
-
dispatch_async(dispatch_get_main_queue(), ^{
|
|
241
|
-
[RGLDocReader.shared recognizeImageFromPresenter:RGLWRootViewController() config:[RGLWJSONConstructor recognizeConfigFromJson:config] completion:[self completion]];
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
+(void)startNewPage {
|
|
246
|
-
[RGLDocReader.shared startNewPage];
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
+(void)stopScanner {
|
|
250
|
-
dispatch_async(dispatch_get_main_queue(), ^{
|
|
251
|
-
[RGLDocReader.shared stopScanner:nil];
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
+(void)startRFIDReader:(NSDictionary*)config {
|
|
256
|
-
rfidReaderRequest = config;
|
|
257
|
-
dispatch_async(dispatch_get_main_queue(), ^{
|
|
258
|
-
[RGLDocReader.shared startRFIDReaderFromPresenter:RGLWRootViewController() completion:[self completion]];
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
+(void)readRFID:(NSDictionary*)config {
|
|
263
|
-
rfidReaderRequest = config;
|
|
264
|
-
[RGLDocReader.shared readRFID:^(RGLRFIDNotificationAction notificationAction, RGLRFIDNotify* _Nullable notification) {
|
|
265
|
-
if (notification != nil) sendEvent(rfidOnProgressEvent, [RGLWJSONConstructor generateDocumentReaderNotification:notification]);
|
|
266
|
-
} completion :^(RGLRFIDCompleteAction action, RGLDocumentReaderResults * _Nullable results, NSError * _Nullable error, RGLRFIDErrorCodes errorCode) {
|
|
267
|
-
sendEvent(completionEvent, [RGLWJSONConstructor generateCompletion:[RGLWConfig generateRFIDCompleteAction: action] :results :error]);
|
|
268
|
-
}];
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
+(void)stopRFIDReader {
|
|
272
|
-
[RGLDocReader.shared stopRFIDReader:nil];
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
+(void)providePACertificates:(NSArray*)certificates {
|
|
276
|
-
NSMutableArray *certificatesMutable = [NSMutableArray new];
|
|
277
|
-
for(NSDictionary* certificateJSON in certificates)
|
|
278
|
-
[certificatesMutable addObject:[RGLWJSONConstructor pkdCertificateFromJson:certificateJSON]];
|
|
279
|
-
paCertificateCompletion(certificatesMutable);
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
+(void)provideTACertificates:(NSArray*)certificates {
|
|
283
|
-
NSMutableArray *certificatesMutable = [NSMutableArray new];
|
|
284
|
-
for(NSDictionary* certificateJSON in certificates)
|
|
285
|
-
[certificatesMutable addObject:[RGLWJSONConstructor pkdCertificateFromJson:certificateJSON]];
|
|
286
|
-
taCertificateCompletion(certificatesMutable);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
+(void)provideTASignature:(NSString*)signature {
|
|
290
|
-
taSignatureCompletion([RGLWJSONConstructor base64Decode:signature]);
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
+(void)provideAAChallenge:(NSString*)challenge {
|
|
294
|
-
aaChallengeCompletion(challenge);
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
+(void)selectPACEProtocol:(NSDictionary*)protocol {
|
|
298
|
-
paceProtocolCompletion([RGLWJSONConstructor paceProtocolFromJson:protocol]);
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
+(void)selectCAProtocol:(NSDictionary*)protocol {
|
|
302
|
-
caProtocolCompletion([RGLWJSONConstructor caProtocolFromJson:protocol]);
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
+(void)setTCCParams:(NSDictionary*)params :(RGLWCallback)callback {
|
|
306
|
-
[RGLDocReader.shared setTCCParams:[RGLWJSONConstructor tccParamsFromJson:params] completion:^(BOOL success, NSError * _Nullable error) {
|
|
307
|
-
callback([RGLWJSONConstructor generateSuccessCompletion:success :error]);
|
|
308
|
-
}];
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
+(void)addPKDCertificates:(NSArray*)certificates {
|
|
312
|
-
NSMutableArray *certificatesMutable = [NSMutableArray new];
|
|
313
|
-
for(NSDictionary* certificateJSON in certificates)
|
|
314
|
-
[certificatesMutable addObject:[RGLWJSONConstructor pkdCertificateFromJson:certificateJSON]];
|
|
315
|
-
[RGLDocReader.shared addPKDCertificates:certificatesMutable];
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
+(void)clearPKDCertificates {
|
|
319
|
-
[RGLDocReader.shared clearPKDCertificates];
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
+(void)startNewSession {
|
|
323
|
-
[RGLDocReader.shared startNewSession];
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
RGLBluetooth* bluetooth;
|
|
327
|
-
RGLWCallback savedCallbackForBluetoothResult;
|
|
328
|
-
|
|
329
|
-
+(void)connectBluetoothDevice:(NSString*)deviceName :(RGLWCallback)callback {
|
|
330
|
-
// return if already connected
|
|
331
|
-
if (bluetooth && bluetooth.state == RGLBluetoothConnectionStateConnected) return;
|
|
332
|
-
|
|
333
|
-
// start searching devices
|
|
334
|
-
if (!bluetooth) {
|
|
335
|
-
bluetooth = [RGLBluetooth new];
|
|
336
|
-
bluetooth.delegate = (id<RGLBluetoothDelegate>)this;
|
|
337
|
-
}
|
|
338
|
-
savedCallbackForBluetoothResult = callback;
|
|
339
|
-
[bluetooth connectWithDeviceName:deviceName];
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
// RGLBluetoothDelegate
|
|
343
|
-
- (void)didChangeConnectionState:(RGLBluetooth *)bluetooth state:(RGLBluetoothConnectionState)state {
|
|
344
|
-
if (state == RGLBluetoothConnectionStateNone && savedCallbackForBluetoothResult)
|
|
345
|
-
[RGLWMain bluetoothDeviceConnectionFailed];
|
|
346
|
-
|
|
347
|
-
// set searching timeout
|
|
348
|
-
if (state == RGLBluetoothConnectionStateSearching)
|
|
349
|
-
[[self class] performSelector:NSSelectorFromString(@"bluetoothDeviceConnectionFailed") withObject:nil afterDelay:7.0];
|
|
350
|
-
|
|
351
|
-
if (state == RGLBluetoothConnectionStateConnected) {
|
|
352
|
-
savedCallbackForBluetoothResult(@YES);
|
|
353
|
-
savedCallbackForBluetoothResult = nil;
|
|
354
|
-
[NSObject cancelPreviousPerformRequestsWithTarget:[self class] selector:NSSelectorFromString(@"bluetoothDeviceConnectionFailed") object:nil];
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
+(void)bluetoothDeviceConnectionFailed {
|
|
359
|
-
if (savedCallbackForBluetoothResult) {
|
|
360
|
-
savedCallbackForBluetoothResult(@NO);
|
|
361
|
-
savedCallbackForBluetoothResult = nil;
|
|
362
|
-
}
|
|
363
|
-
[bluetooth stopSearchDevices];
|
|
364
|
-
[bluetooth disconnect];
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
+(void)startReadMDl:(NSNumber*)type :(NSDictionary*)dataRetrieval :(RGLWCallback)callback {
|
|
368
|
-
dispatch_async(dispatch_get_main_queue(), ^{
|
|
369
|
-
[RGLDocReader.shared startReadMDLFromPresenter:RGLWRootViewController() engagementType:[type integerValue] dataRetrieval:[RGLWJSONConstructor dataRetrievalFromJson:dataRetrieval] completion:^(RGLDocReaderAction action, RGLDocumentReaderResults * _Nullable results, NSError * _Nullable error) {
|
|
370
|
-
callback([RGLWJSONConstructor generateCompletion:[RGLWConfig generateDocReaderAction: action] :results :error]);
|
|
371
|
-
}];
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
+(void)startEngageDevice:(NSNumber*)type :(RGLWCallback)callback {
|
|
376
|
-
dispatch_async(dispatch_get_main_queue(), ^{
|
|
377
|
-
[RGLDocReader.shared startEngageDeviceFromPresenter:RGLWRootViewController() type:[type integerValue] completion:^(RGLDeviceEngagement* deviceEngagement, NSError* error) {
|
|
378
|
-
callback([RGLWJSONConstructor generateDeviceEngagementCompletion:deviceEngagement :error]);
|
|
379
|
-
}];
|
|
380
|
-
});
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
+(void)engageDeviceNFC:(RGLWCallback)callback {
|
|
384
|
-
dispatch_async(dispatch_get_main_queue(), ^{
|
|
385
|
-
[RGLDocReader.shared engageDeviceNFC:RGLWRootViewController() completion:^(RGLDeviceEngagement * _Nullable deviceEngagement, NSError * _Nullable error) {
|
|
386
|
-
callback([RGLWJSONConstructor generateDeviceEngagementCompletion:deviceEngagement :error]);
|
|
387
|
-
}];
|
|
388
|
-
});
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
+(void)engageDeviceData:(NSString*)data :(RGLWCallback)callback {
|
|
392
|
-
[RGLDocReader.shared engageDeviceData:data completion:^(RGLDeviceEngagement * _Nullable deviceEngagement, NSError * _Nullable error) {
|
|
393
|
-
callback([RGLWJSONConstructor generateDeviceEngagementCompletion:deviceEngagement :error]);
|
|
394
|
-
}];
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
+(void)startRetrieveData:(NSDictionary*)dataRetrieval :(NSDictionary*)deviceEngagement :(RGLWCallback)callback {
|
|
398
|
-
[RGLDocReader.shared startRetrieveData:[RGLWJSONConstructor deviceEngagementFromJson:deviceEngagement] dataRetrieval:[RGLWJSONConstructor dataRetrievalFromJson:dataRetrieval] completion:^(RGLDocReaderAction action, RGLDocumentReaderResults * _Nullable results, NSError * _Nullable error) {
|
|
399
|
-
callback([RGLWJSONConstructor generateCompletion:[RGLWConfig generateDocReaderAction: action] :results :error]);
|
|
400
|
-
}];
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
+(void)retrieveDataNFC:(NSDictionary*)dataRetrieval :(RGLWCallback)callback {
|
|
404
|
-
[RGLDocReader.shared retrieveDataNFC:[RGLWJSONConstructor dataRetrievalFromJson:dataRetrieval] completion:^(RGLDocReaderAction action, RGLDocumentReaderResults * _Nullable results, NSError * _Nullable error) {
|
|
405
|
-
callback([RGLWJSONConstructor generateCompletion:[RGLWConfig generateDocReaderAction: action] :results :error]);
|
|
406
|
-
}];
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
+(void)retrieveDataBLE:(NSDictionary*)dataRetrieval :(NSDictionary*)deviceEngagement :(RGLWCallback)callback {
|
|
410
|
-
[RGLDocReader.shared retrieveDataBLE:[RGLWJSONConstructor deviceEngagementFromJson:deviceEngagement] dataRetrieval:[RGLWJSONConstructor dataRetrievalFromJson:dataRetrieval] completion:^(RGLDocReaderAction action, RGLDocumentReaderResults * _Nullable results, NSError * _Nullable error) {
|
|
411
|
-
callback([RGLWJSONConstructor generateCompletion:[RGLWConfig generateDocReaderAction: action] :results :error]);
|
|
412
|
-
}];
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
+(void)setLocalizationDictionary:(NSDictionary*)dictionary {
|
|
416
|
-
RGLDocReader.shared.localizationHandler = ^NSString * _Nullable(NSString * _Nonnull localizationKey) {
|
|
417
|
-
if(dictionary != nil && ![dictionary isEqual:[NSNull null]] && [dictionary valueForKey:localizationKey] != nil)
|
|
418
|
-
return [dictionary valueForKey:localizationKey];
|
|
419
|
-
return nil;
|
|
420
|
-
};
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
+(void)getLicense :(RGLWCallback)callback {
|
|
424
|
-
callback([RGLWJSONConstructor generateLicense:RGLDocReader.shared.license]);
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
+(void)getAvailableScenarios :(RGLWCallback)callback {
|
|
428
|
-
NSMutableArray *availableScenarios = [NSMutableArray new];
|
|
429
|
-
for(RGLScenario *scenario in RGLDocReader.shared.availableScenarios)
|
|
430
|
-
[availableScenarios addObject:[RGLWJSONConstructor generateScenario:scenario]];
|
|
431
|
-
callback([RGLWJSONConstructor arrayToString:availableScenarios]);
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
+(void)getIsRFIDAvailableForUse :(RGLWCallback)callback {
|
|
435
|
-
callback(RGLDocReader.shared.isRFIDAvailableForUse ? @YES : @NO);
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
+(void)getDocReaderVersion :(RGLWCallback)callback {
|
|
439
|
-
callback([RGLWJSONConstructor generateDocReaderVersion:RGLDocReader.shared.version]);
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
+(void)isAuthenticatorRFIDAvailableForUse :(RGLWCallback)callback {
|
|
443
|
-
callback(RGLDocReader.shared.isAuthenticatorRFIDAvailableForUse ? @YES : @NO);
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
+(void)isAuthenticatorAvailableForUse :(RGLWCallback)callback {
|
|
447
|
-
callback(RGLDocReader.shared.isAuthenticatorAvailableForUse ? @YES : @NO);
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
+(void)getDocReaderDocumentsDatabase :(RGLWCallback)callback {
|
|
451
|
-
if(RGLDocReader.shared.version != nil)
|
|
452
|
-
callback([RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateDocReaderDocumentsDatabase:RGLDocReader.shared.version.database]]);
|
|
453
|
-
else callback(nil);
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
+(void)finalizePackage:(RGLWCallback)callback {
|
|
457
|
-
[RGLDocReader.shared finalizePackageWithCompletion:^(RGLDocReaderAction action, RGLTransactionInfo* info, NSError* error) {
|
|
458
|
-
callback([RGLWJSONConstructor generateFinalizePackageCompletion:[RGLWConfig generateDocReaderAction: action] :info :error]);
|
|
459
|
-
}];
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
+(void)finalizePackageWithFinalizeConfig:(NSDictionary*)config :(RGLWCallback)callback {
|
|
463
|
-
[RGLDocReader.shared finalizePackageWithFinalizeConfig:[RGLWJSONConstructor finalizeConfigFromJson:config] completion:^(RGLDocReaderAction action, RGLTransactionInfo* info, NSError* error) {
|
|
464
|
-
callback([RGLWJSONConstructor generateFinalizePackageCompletion:[RGLWConfig generateDocReaderAction: action] :info :error]);
|
|
465
|
-
}];
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
+(void)endBackendTransaction {
|
|
469
|
-
[RGLDocReader.shared endBackendTransaction];
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
+(void)textFieldValueByType:(NSString*)rawResult :(NSNumber*)fieldType :(RGLWCallback)callback {
|
|
473
|
-
RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
|
|
474
|
-
callback([results getTextFieldValueByType:[fieldType integerValue]]);
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
+(void)textFieldValueByTypeLcid:(NSString*)rawResult :(NSNumber*)fieldType :(NSNumber*)lcid :(RGLWCallback)callback {
|
|
478
|
-
RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
|
|
479
|
-
callback([results getTextFieldValueByType:[fieldType integerValue] lcid:[lcid integerValue]]);
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
+(void)textFieldValueByTypeSource:(NSString*)rawResult :(NSNumber*)fieldType :(NSNumber*)source :(RGLWCallback)callback {
|
|
483
|
-
RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
|
|
484
|
-
callback([results getTextFieldValueByType:[fieldType integerValue] source:[source integerValue]]);
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
+(void)textFieldValueByTypeLcidSource:(NSString*)rawResult :(NSNumber*)fieldType :(NSNumber*)lcid :(NSNumber*)source :(RGLWCallback)callback {
|
|
488
|
-
RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
|
|
489
|
-
callback([results getTextFieldValueByType:[fieldType integerValue] lcid:[lcid integerValue] source:[source integerValue]]);
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
+(void)textFieldValueByTypeSourceOriginal:(NSString*)rawResult :(NSNumber*)fieldType :(NSNumber*)source :(BOOL)original :(RGLWCallback)callback {
|
|
493
|
-
RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
|
|
494
|
-
callback([results getTextFieldValueByType:[fieldType integerValue] source:[source integerValue] original:original]);
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
+(void)textFieldValueByTypeLcidSourceOriginal:(NSString*)rawResult :(NSNumber*)fieldType :(NSNumber*)lcid :(NSNumber*)source :(BOOL)original :(RGLWCallback)callback {
|
|
498
|
-
RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
|
|
499
|
-
callback([results getTextFieldValueByType:[fieldType integerValue] lcid:[lcid integerValue] source:[source integerValue] original:original]);
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
+(void)textFieldByType:(NSString*)rawResult :(NSNumber*)fieldType :(RGLWCallback)callback {
|
|
503
|
-
RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
|
|
504
|
-
RGLDocumentReaderTextField* result = [results getTextFieldByType:[fieldType integerValue]];
|
|
505
|
-
if (result == nil) callback(nil);
|
|
506
|
-
callback([RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateDocumentReaderTextField:result]]);
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
+(void)textFieldByTypeLcid:(NSString*)rawResult :(NSNumber*)fieldType :(NSNumber*)lcid :(RGLWCallback)callback {
|
|
510
|
-
RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
|
|
511
|
-
RGLDocumentReaderTextField* result = [results getTextFieldByType:[fieldType integerValue] lcid:[lcid integerValue]];
|
|
512
|
-
if (result == nil) callback(nil);
|
|
513
|
-
callback([RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateDocumentReaderTextField:result]]);
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
+(void)graphicFieldByTypeSource:(NSString*)rawResult :(NSNumber*)fieldType :(NSNumber*)source :(RGLWCallback)callback {
|
|
517
|
-
RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
|
|
518
|
-
RGLDocumentReaderGraphicField* result = [results getGraphicFieldByType:[fieldType integerValue] source:[source integerValue]];
|
|
519
|
-
if (result == nil) callback(nil);
|
|
520
|
-
callback([RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateDocumentReaderGraphicField:result]]);
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
+(void)graphicFieldByTypeSourcePageIndex:(NSString*)rawResult :(NSNumber*)fieldType :(NSNumber*)source :(NSNumber*)pageIndex :(RGLWCallback)callback {
|
|
524
|
-
RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
|
|
525
|
-
RGLDocumentReaderGraphicField* result = [results getGraphicFieldByType:[fieldType integerValue] source:[source integerValue] pageIndex:[pageIndex integerValue]];
|
|
526
|
-
if (result == nil) callback(nil);
|
|
527
|
-
callback([RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateDocumentReaderGraphicField:result]]);
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
+(void)graphicFieldByTypeSourcePageIndexLight:(NSString*)rawResult :(NSNumber*)fieldType :(NSNumber*)source :(NSNumber*)pageIndex :(NSNumber*)light :(RGLWCallback)callback {
|
|
531
|
-
RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
|
|
532
|
-
RGLDocumentReaderGraphicField* result = [results getGraphicFieldByType:[fieldType integerValue] source:[source integerValue] pageIndex:[pageIndex integerValue] light:[light integerValue]];
|
|
533
|
-
if (result == nil) callback(nil);
|
|
534
|
-
callback([RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateDocumentReaderGraphicField:result]]);
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
+(void)graphicFieldImageByType:(NSString*)rawResult :(NSNumber*)fieldType :(RGLWCallback)callback {
|
|
538
|
-
RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
|
|
539
|
-
callback([RGLWJSONConstructor base64WithImage:[results getGraphicFieldImageByType:[fieldType integerValue]]]);
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
+(void)graphicFieldImageByTypeSource:(NSString*)rawResult :(NSNumber*)fieldType :(NSNumber*)source :(RGLWCallback)callback {
|
|
543
|
-
RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
|
|
544
|
-
callback([RGLWJSONConstructor base64WithImage:[results getGraphicFieldImageByType:[fieldType integerValue] source:[source integerValue]]]);
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
+(void)graphicFieldImageByTypeSourcePageIndex:(NSString*)rawResult :(NSNumber*)fieldType :(NSNumber*)source :(NSNumber*)pageIndex :(RGLWCallback)callback {
|
|
548
|
-
RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
|
|
549
|
-
callback([RGLWJSONConstructor base64WithImage:[results getGraphicFieldImageByType:[fieldType integerValue] source:[source integerValue] pageIndex:[pageIndex integerValue]]]);
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
+(void)graphicFieldImageByTypeSourcePageIndexLight:(NSString*)rawResult :(NSNumber*)fieldType :(NSNumber*)source :(NSNumber*)pageIndex :(NSNumber*)light :(RGLWCallback)callback {
|
|
553
|
-
RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
|
|
554
|
-
callback([RGLWJSONConstructor base64WithImage:[results getGraphicFieldImageByType:[fieldType integerValue] source:[source integerValue] pageIndex:[pageIndex integerValue] light:[light integerValue]]]);
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
+(void)containers:(NSString*)rawResult :(NSArray<NSNumber*>*)resultType :(RGLWCallback)callback {
|
|
558
|
-
RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
|
|
559
|
-
callback([results getContainersByResultTypes:resultType]);
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
+(void)encryptedContainers:(NSString*)rawResult :(RGLWCallback)callback {
|
|
563
|
-
RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
|
|
564
|
-
callback([results getEncryptedContainers]);
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
+(void)getTranslation:(NSString*)className :(NSNumber*)value :(RGLWCallback)callback {
|
|
568
|
-
if([className isEqualToString:@"RFIDErrorCodes"])
|
|
569
|
-
callback(RGLRFIDErrorCodesGetStringValue([value intValue]));
|
|
570
|
-
else if([className isEqualToString:@"LDSParsingErrorCodes"])
|
|
571
|
-
callback(eLDS_ParsingErrorCodesGetStringValue([value intValue]));
|
|
572
|
-
else if([className isEqualToString:@"LDSParsingNotificationCodes"])
|
|
573
|
-
callback(eLDS_ParsingNotificationCodesGetStringValue([value intValue]));
|
|
574
|
-
else if([className isEqualToString:@"ImageQualityCheckType"])
|
|
575
|
-
callback(RGLImageQualityCheckTypeGetStringValue([RGLWConfig imageQualityCheckTypeWithNumber:value]));
|
|
576
|
-
else if([className isEqualToString:@"RFIDDataFileType"])
|
|
577
|
-
callback(RGLRFIDDataFileTypeGetStringValue([value intValue]));
|
|
578
|
-
else if([className isEqualToString:@"VisualFieldType"])
|
|
579
|
-
callback(RGLFieldTypeGetStringValue([value intValue]));
|
|
580
|
-
else if([className isEqualToString:@"LCID"])
|
|
581
|
-
callback([RGLDocumentReaderTextField lcidName:[value intValue]]);
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
+(RGLDocumentReaderCompletion _Nonnull)completion {
|
|
585
|
-
return ^(RGLDocReaderAction action, RGLDocumentReaderResults * _Nullable results, NSError * _Nullable error) {
|
|
586
|
-
sendEvent(completionEvent, [RGLWJSONConstructor generateCompletion:[RGLWConfig generateDocReaderAction: action] :results :error]);
|
|
587
|
-
};
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
+(RGLDocumentReaderPrepareCompletion _Nonnull)prepareCompletion:(RGLWCallback)callback {
|
|
591
|
-
RGLDocReader.shared.databaseFetchDelegate = this;
|
|
592
|
-
return ^(BOOL success, NSError * _Nullable error) {
|
|
593
|
-
callback([RGLWJSONConstructor generateSuccessCompletion:success :error]);
|
|
594
|
-
};
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
+(RGLDocumentReaderInitializationCompletion)initCompletion:(RGLWCallback)callback {
|
|
598
|
-
return ^(BOOL success, NSError * _Nullable error ) {
|
|
599
|
-
if (success) {
|
|
600
|
-
RGLDocReader.shared.rfidDelegate = this;
|
|
601
|
-
RGLDocReader.shared.functionality.recordScanningProcessDelegate = this;
|
|
602
|
-
RGLDocReader.shared.customization.actionDelegate = this;
|
|
603
|
-
}
|
|
604
|
-
callback([RGLWJSONConstructor generateSuccessCompletion:success :error]);
|
|
605
|
-
};
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
// RGLDocReaderDatabaseFetchDelegate
|
|
609
|
-
- (void)onProgressChanged:(NSNumber *)downloadedBytes totalBytes:(NSNumber *)totalBytes {
|
|
610
|
-
int progress = 0;
|
|
611
|
-
if (downloadedBytes > 0 && totalBytes > 0) {
|
|
612
|
-
double percent = [downloadedBytes doubleValue] / [totalBytes doubleValue];
|
|
613
|
-
progress = (int) (percent * 100);
|
|
614
|
-
}
|
|
615
|
-
NSDictionary* result = @{
|
|
616
|
-
@"downloadedBytes":downloadedBytes,
|
|
617
|
-
@"totalBytes":totalBytes,
|
|
618
|
-
@"progress":@(progress)
|
|
619
|
-
};
|
|
620
|
-
sendEvent(databaseProgressEvent, [RGLWJSONConstructor dictToString: result]);
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
// RGLCustomizationActionDelegate
|
|
624
|
-
- (void)onCustomButtonTappedWithTag:(NSInteger)tag {
|
|
625
|
-
sendEvent(drOnCustomButtonTappedEvent, @(tag));
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
// RGLRecordScanningProcessDelegate
|
|
629
|
-
- (void)didFinishRecordingToFile:(NSURL *)fileURL {
|
|
630
|
-
sendEvent(drVideoEncoderCompletionEvent, fileURL.absoluteString);
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
- (void)didFailWithError:(NSError *)error {
|
|
634
|
-
// ignore error to match android
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
RGLRFIDCertificatesCallback paCertificateCompletion;
|
|
638
|
-
RGLRFIDCertificatesCallback taCertificateCompletion;
|
|
639
|
-
RGLWRFIDSignatureCallback taSignatureCompletion;
|
|
640
|
-
RGLRFIDAAChallengeCallback aaChallengeCompletion;
|
|
641
|
-
RGLRFIDAccessControlPACECallback paceProtocolCompletion;
|
|
642
|
-
RGLRFIDAccessControlCACallback caProtocolCompletion;
|
|
643
|
-
|
|
644
|
-
NSDictionary* rfidReaderRequest;
|
|
645
|
-
|
|
646
|
-
- (void)onRequestPACertificatesWithSerial:(NSData *)serialNumber issuer:(RGLPAResourcesIssuer *)issuer callback:(RGLRFIDCertificatesCallback)callback {
|
|
647
|
-
if ([rfidReaderRequest isKindOfClass:[NSDictionary class]] && [rfidReaderRequest[@"paCertificates"] boolValue]) {
|
|
648
|
-
paCertificateCompletion = callback;
|
|
649
|
-
sendEvent(paCertificateCompletionEvent, [RGLWJSONConstructor generatePACertificateCompletion:serialNumber :issuer]);
|
|
650
|
-
} else {
|
|
651
|
-
paCertificateCompletion = nil;
|
|
652
|
-
callback(nil);
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
- (void)onRequestTACertificatesWithKey:(NSString *)keyCAR callback:(RGLRFIDCertificatesCallback)callback {
|
|
657
|
-
if ([rfidReaderRequest isKindOfClass:[NSDictionary class]] && [rfidReaderRequest[@"taCertificates"] boolValue]) {
|
|
658
|
-
taCertificateCompletion = callback;
|
|
659
|
-
sendEvent(taCertificateCompletionEvent, keyCAR);
|
|
660
|
-
} else {
|
|
661
|
-
taCertificateCompletion = nil;
|
|
662
|
-
callback(nil);
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
- (void)onRequestTASignatureWithChallenge:(RGLTAChallenge *)challenge callback:(void(^)(NSData *signature))callback {
|
|
667
|
-
if ([rfidReaderRequest isKindOfClass:[NSDictionary class]] && [rfidReaderRequest[@"taSignature"] boolValue]) {
|
|
668
|
-
taSignatureCompletion = callback;
|
|
669
|
-
sendEvent(taSignatureCompletionEvent, [RGLWJSONConstructor dictToString: [RGLWJSONConstructor generateTAChallenge:challenge]]);
|
|
670
|
-
} else {
|
|
671
|
-
taSignatureCompletion = nil;
|
|
672
|
-
callback(nil);
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
- (void)onRequestAAChallenge:(NSString*)challenge callback:(void(^)(NSString* challenge))callback {
|
|
677
|
-
if ([rfidReaderRequest isKindOfClass:[NSDictionary class]] && [rfidReaderRequest[@"aaChallenge"] boolValue]) {
|
|
678
|
-
aaChallengeCompletion = callback;
|
|
679
|
-
sendEvent(aaChallengeCompletionEvent, challenge);
|
|
680
|
-
} else {
|
|
681
|
-
aaChallengeCompletion = nil;
|
|
682
|
-
callback(nil);
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
- (void)onRequestPACEProtocolWithOptions:(NSArray<RGLRFIDAccessControlPACE*>*)protocols callback:(RGLRFIDAccessControlPACECallback)callback {
|
|
687
|
-
if ([rfidReaderRequest isKindOfClass:[NSDictionary class]] && [rfidReaderRequest[@"paceProtocol"] boolValue]) {
|
|
688
|
-
paceProtocolCompletion = callback;
|
|
689
|
-
NSMutableArray *array = [NSMutableArray new];
|
|
690
|
-
for(RGLRFIDAccessControlPACE* item in protocols)
|
|
691
|
-
[array addObject:[RGLWJSONConstructor generatePaceProtocol:item]];
|
|
692
|
-
sendEvent(paceProtocolCompletionEvent, [RGLWJSONConstructor arrayToString: array]);
|
|
693
|
-
} else {
|
|
694
|
-
paceProtocolCompletion = nil;
|
|
695
|
-
callback(nil);
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
- (void)onRequestCAProtocolWithOptions:(NSArray<RGLRFIDAccessControlCA*>*)protocols callback:(RGLRFIDAccessControlCACallback)callback {
|
|
700
|
-
if ([rfidReaderRequest isKindOfClass:[NSDictionary class]] && [rfidReaderRequest[@"caProtocol"] boolValue]) {
|
|
701
|
-
caProtocolCompletion = callback;
|
|
702
|
-
NSMutableArray *array = [NSMutableArray new];
|
|
703
|
-
for(RGLRFIDAccessControlCA* item in protocols)
|
|
704
|
-
[array addObject:[RGLWJSONConstructor generateCaProtocol:item]];
|
|
705
|
-
sendEvent(caProtocolCompletionEvent, [RGLWJSONConstructor arrayToString: array]);
|
|
706
|
-
} else {
|
|
707
|
-
caProtocolCompletionEvent = nil;
|
|
708
|
-
callback(nil);
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
- (void)didChipConnected {
|
|
713
|
-
sendEvent(rfidOnChipDetectedEvent, @"");
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
- (void)didReceivedError:(RGLRFIDErrorCodes)errorCode {
|
|
717
|
-
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
718
|
-
result[@"code"] = [NSNumber numberWithInteger:errorCode];
|
|
719
|
-
sendEvent(rfidOnRetryReadChipEvent, [RGLWJSONConstructor dictToString:result]);
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
@end
|