@regulaforensics/cordova-plugin-document-reader-api 6.9.1 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -40
- package/example/README.md +32 -0
- package/example/config.xml +5 -1
- package/example/package.json +7 -10
- package/example/www/js/index.js +85 -160
- package/package.json +1 -1
- package/plugin.xml +8 -8
- package/src/android/BluetoothUtil.kt +78 -74
- package/src/android/Config.kt +690 -0
- package/src/android/DocumentReader.kt +525 -0
- package/src/android/JSONConstructor.kt +2187 -0
- package/src/android/Utils.kt +256 -0
- package/src/android/build.gradle +3 -3
- package/src/ios/RGLWConfig.h +48 -0
- package/src/ios/RGLWConfig.m +1325 -0
- package/src/ios/RGLWDocumentReader.h +11 -8
- package/src/ios/RGLWDocumentReader.m +388 -576
- package/src/ios/RGLWJSONConstructor.h +173 -69
- package/src/ios/RGLWJSONConstructor.m +1817 -762
- package/www/DocumentReader.js +241 -116
- package/src/android/DocumentReader.java +0 -1118
- package/src/android/Helpers.java +0 -259
- package/src/android/JSONConstructor.java +0 -1119
- package/src/android/RegulaConfig.java +0 -830
- package/src/ios/RGLWRegulaConfig.h +0 -26
- package/src/ios/RGLWRegulaConfig.m +0 -1152
|
@@ -1,71 +1,154 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RGLWJSONConstructor.m
|
|
3
|
+
// DocumentReader
|
|
4
|
+
//
|
|
5
|
+
// Created by Pavel Masiuk on 21.09.2023.
|
|
6
|
+
// Copyright © 2023 Regula. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
1
9
|
#import <Foundation/Foundation.h>
|
|
2
10
|
#import "RGLWJSONConstructor.h"
|
|
3
|
-
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
4
11
|
|
|
5
12
|
@implementation RGLWJSONConstructor
|
|
6
13
|
|
|
7
|
-
+(NSString*)dictToString:(
|
|
14
|
+
+(NSString*)dictToString:(NSDictionary*)input {
|
|
15
|
+
if(input == nil) return nil;
|
|
8
16
|
return [[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:input options:NSJSONWritingPrettyPrinted error:nil] encoding:NSUTF8StringEncoding];
|
|
9
17
|
}
|
|
10
18
|
|
|
11
|
-
+(NSString*)arrayToString:(
|
|
19
|
+
+(NSString*)arrayToString:(NSArray*)input {
|
|
20
|
+
if(input == nil) return nil;
|
|
12
21
|
return [[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:input options:NSJSONWritingPrettyPrinted error:nil] encoding:NSUTF8StringEncoding];
|
|
13
22
|
}
|
|
14
23
|
|
|
15
|
-
+(
|
|
24
|
+
+(NSData*)base64Decode:(NSString*)input {
|
|
25
|
+
if(input == nil) return nil;
|
|
26
|
+
return [[NSData alloc] initWithBase64EncodedString:input options:0];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
+(NSString*)base64Encode:(NSData*)input {
|
|
30
|
+
if(input == nil) return nil;
|
|
31
|
+
return [input base64EncodedStringWithOptions:0];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
+(UIImage*)imageWithBase64:(NSString*)input {
|
|
35
|
+
if(input == nil) return nil;
|
|
36
|
+
return [UIImage imageWithData:[self base64Decode:input]];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
+(NSString*)base64WithImage:(UIImage*)input {
|
|
40
|
+
return [self base64Encode: UIImagePNGRepresentation(input)];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
+(NSError*)errorFromJson:(NSDictionary*)input {
|
|
44
|
+
if(input == nil) return nil;
|
|
45
|
+
NSInteger code = [[input valueForKey:@"code"] integerValue];
|
|
46
|
+
NSString* message = [input valueForKey:@"message"];
|
|
47
|
+
NSDictionary *userInfo = @{NSLocalizedDescriptionKey: NSLocalizedString(message, nil)};
|
|
48
|
+
return [NSError errorWithDomain:RGLDocumentReaderDomain code:code userInfo:userInfo];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
+(NSDictionary*)generateError:(NSError*)input {
|
|
52
|
+
if(input == nil) return nil;
|
|
16
53
|
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
17
|
-
if(input == nil) return result;
|
|
18
54
|
|
|
19
|
-
result[@"
|
|
55
|
+
result[@"code"] = [NSNumber numberWithInteger:input.code];
|
|
20
56
|
result[@"message"] = input.localizedDescription;
|
|
21
57
|
|
|
22
58
|
return result;
|
|
23
59
|
}
|
|
24
60
|
|
|
25
|
-
+(
|
|
61
|
+
+(NSString*)generateCompletion:(NSNumber*)action :(RGLDocumentReaderResults*)results :(NSError*)error {
|
|
26
62
|
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
27
|
-
|
|
63
|
+
int actionInt = [action intValue];
|
|
28
64
|
|
|
29
|
-
|
|
30
|
-
result[
|
|
65
|
+
if(actionInt == 0 || actionInt == 2 || actionInt == 3 || actionInt == 4 || actionInt == 6)
|
|
66
|
+
result[@"results"] = [self generateDocumentReaderResults:results];
|
|
67
|
+
result[@"action"] = action;
|
|
68
|
+
result[@"error"] = [self generateError:error];
|
|
31
69
|
|
|
32
|
-
return result;
|
|
70
|
+
return [RGLWJSONConstructor dictToString: result];
|
|
33
71
|
}
|
|
34
72
|
|
|
35
|
-
+(
|
|
36
|
-
|
|
37
|
-
|
|
73
|
+
+(NSString*)generateSuccessCompletion:(BOOL)success :(NSError*)error {
|
|
74
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
75
|
+
|
|
76
|
+
result[@"success"] = success? @YES : @NO;
|
|
77
|
+
result[@"error"] = [self generateError:error];
|
|
78
|
+
|
|
79
|
+
return [RGLWJSONConstructor dictToString: result];
|
|
38
80
|
}
|
|
39
81
|
|
|
40
|
-
+(NSString*)
|
|
41
|
-
|
|
42
|
-
|
|
82
|
+
+(NSString*)generatePACertificateCompletion:(NSData *)serialNumber :(RGLPAResourcesIssuer *)issuer{
|
|
83
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
84
|
+
|
|
85
|
+
result[@"serialNumber"] = [self base64Encode:serialNumber];;
|
|
86
|
+
result[@"issuer"] = [self generatePAResourcesIssuer:issuer];
|
|
87
|
+
|
|
88
|
+
return [RGLWJSONConstructor dictToString: result];
|
|
43
89
|
}
|
|
44
90
|
|
|
45
|
-
+(
|
|
46
|
-
|
|
47
|
-
NSData* binaryData = [[NSData alloc] initWithBase64EncodedString:[input objectForKey:@"binaryData"] options:0];
|
|
48
|
-
NSData* privateKey = [input objectForKey:@"privateKey"] != nil ? [[NSData alloc] initWithBase64EncodedString:[input objectForKey:@"privateKey"] options:0] : nil;
|
|
91
|
+
+(NSString*)generateFinalizePackageCompletion:(NSNumber*)action :(RGLTransactionInfo*)info :(NSError*)error {
|
|
92
|
+
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
49
93
|
|
|
50
|
-
|
|
94
|
+
result[@"action"] = action;
|
|
95
|
+
result[@"info"] = [self generateTransactionInfo:info];
|
|
96
|
+
result[@"error"] = [self generateError:error];
|
|
97
|
+
|
|
98
|
+
return [RGLWJSONConstructor dictToString: result];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
+(RGLTransactionInfo*)transactionInfoFromJson:(NSDictionary*)input {
|
|
102
|
+
if(input == nil) return nil;
|
|
103
|
+
|
|
104
|
+
NSString* transactionId = [input valueForKey:@"transactionId"];
|
|
105
|
+
NSString* tag = [input valueForKey:@"tag"];
|
|
106
|
+
|
|
107
|
+
return [[RGLTransactionInfo alloc] initWithTag:tag transactionId:transactionId];
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
+(NSDictionary*)generateTransactionInfo:(RGLTransactionInfo*)input {
|
|
111
|
+
if(input == nil) return nil;
|
|
112
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
113
|
+
|
|
114
|
+
result[@"transactionId"] = input.transactionId;
|
|
115
|
+
result[@"tag"] = input.tag;
|
|
116
|
+
|
|
117
|
+
return result;
|
|
51
118
|
}
|
|
52
119
|
|
|
53
|
-
+(RGLTCCParams*)
|
|
120
|
+
+(RGLTCCParams*)tccParamsFromJson:(NSDictionary*)input {
|
|
121
|
+
if(input == nil) return nil;
|
|
122
|
+
|
|
54
123
|
NSString* serviceTAURLString = [input valueForKey:@"serviceUrlTA"];
|
|
55
124
|
NSString* servicePAURLString = [input valueForKey:@"serviceUrlPA"];
|
|
56
125
|
NSString* pfxCertURLString = [input valueForKey:@"pfxCertUrl"];
|
|
57
126
|
NSString* pfxPassPhrase = [input valueForKey:@"pfxPassPhrase"];
|
|
58
|
-
NSData* pfxCertData = [
|
|
59
|
-
|
|
127
|
+
NSData* pfxCertData = [self base64Decode:[input objectForKey:@"pfxCert"]];
|
|
128
|
+
|
|
60
129
|
return [[RGLTCCParams alloc] initWithServiceTAURLString:serviceTAURLString servicePAURLString:servicePAURLString pfxCertURLString:pfxCertURLString pfxCertData: pfxCertData pfxPassPhrase:pfxPassPhrase];
|
|
61
130
|
}
|
|
62
131
|
|
|
63
|
-
+(
|
|
132
|
+
+(NSDictionary*)generateTCCParams:(RGLTCCParams*)input {
|
|
133
|
+
if(input == nil) return nil;
|
|
134
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
135
|
+
|
|
136
|
+
result[@"serviceUrlTA"] = input.serviceTAURLString;
|
|
137
|
+
result[@"serviceUrlPA"] = input.servicePAURLString;
|
|
138
|
+
result[@"pfxCertUrl"] = input.pfxCertURLString;
|
|
139
|
+
result[@"pfxPassPhrase"] = input.pfxPassPhrase;
|
|
140
|
+
result[@"pfxCert"] = [self base64Encode:input.pfxCertData];
|
|
141
|
+
|
|
142
|
+
return result;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
+(RGLConfig*)configFromJson:(NSDictionary*)input {
|
|
146
|
+
if(input == nil) return nil;
|
|
64
147
|
if([input valueForKey:@"license"] == nil) return nil;
|
|
65
|
-
RGLConfig *config = [[RGLConfig alloc] initWithLicenseData:[
|
|
148
|
+
RGLConfig *config = [[RGLConfig alloc] initWithLicenseData:[self base64Decode: [input valueForKey:@"license"]]];
|
|
66
149
|
|
|
67
150
|
if([input valueForKey:@"databasePath"] != nil)
|
|
68
|
-
config.databasePath = [
|
|
151
|
+
config.databasePath = [input valueForKey:@"databasePath"];
|
|
69
152
|
if([input valueForKey:@"licenseUpdate"] != nil)
|
|
70
153
|
config.licenseUpdateCheck = [[input valueForKey:@"licenseUpdate"] boolValue];
|
|
71
154
|
if([input valueForKey:@"delayedNNLoad"] != nil)
|
|
@@ -74,14 +157,26 @@
|
|
|
74
157
|
return config;
|
|
75
158
|
}
|
|
76
159
|
|
|
77
|
-
+(
|
|
160
|
+
+(NSDictionary*)generateConfig:(RGLConfig*)input {
|
|
161
|
+
if(input == nil) return nil;
|
|
162
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
163
|
+
|
|
164
|
+
result[@"license"] = [self base64Encode: input.licenseData];
|
|
165
|
+
result[@"databasePath"] = input.databasePath;
|
|
166
|
+
result[@"licenseUpdate"] = @(input.licenseUpdateCheck);
|
|
167
|
+
result[@"delayedNNLoad"] = @(input.delayedNNLoadEnabled);
|
|
168
|
+
|
|
169
|
+
return result;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
+(RGLScannerConfig*)scannerConfigFromJson:(NSDictionary*)input {
|
|
78
173
|
if([input valueForKey:@"scenario"] == nil && [input valueForKey:@"onlineProcessingConfig"] == nil) return nil;
|
|
79
174
|
RGLScannerConfig *config = [RGLScannerConfig new];
|
|
80
175
|
|
|
81
176
|
if([input valueForKey:@"scenario"] != nil)
|
|
82
177
|
config.scenario = [input valueForKey:@"scenario"];
|
|
83
178
|
if([input valueForKey:@"onlineProcessingConfig"] != nil)
|
|
84
|
-
config.onlineProcessingConfig = [
|
|
179
|
+
config.onlineProcessingConfig = [self onlineProcessingConfigFromJson:[input valueForKey:@"onlineProcessingConfig"]];
|
|
85
180
|
if([input valueForKey:@"livePortrait"] != nil)
|
|
86
181
|
config.livePortrait = [self imageWithBase64:[input valueForKey:@"livePortrait"]];
|
|
87
182
|
if([input valueForKey:@"extPortrait"] != nil)
|
|
@@ -90,29 +185,44 @@
|
|
|
90
185
|
return config;
|
|
91
186
|
}
|
|
92
187
|
|
|
93
|
-
+(
|
|
188
|
+
+(NSDictionary*)generateScannerConfig:(RGLScannerConfig*)input {
|
|
189
|
+
if(input == nil) return nil;
|
|
190
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
191
|
+
|
|
192
|
+
result[@"scenario"] = input.scenario;
|
|
193
|
+
result[@"onlineProcessingConfig"] = [self generateOnlineProcessingConfig: input.onlineProcessingConfig];
|
|
194
|
+
result[@"livePortrait"] = [self base64WithImage: input.livePortrait];
|
|
195
|
+
result[@"extPortrait"] = [self base64WithImage: input.extPortrait];
|
|
196
|
+
|
|
197
|
+
return result;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
+(RGLRecognizeConfig*)recognizeConfigFromJson:(NSDictionary*)input {
|
|
94
201
|
if([input valueForKey:@"scenario"] == nil && [input valueForKey:@"onlineProcessingConfig"] == nil) return nil;
|
|
95
|
-
if([input valueForKey:@"image"] == nil && [input valueForKey:@"images"] == nil && [input valueForKey:@"imageInputs"] == nil) return nil;
|
|
202
|
+
if([input valueForKey:@"image"] == nil && [input valueForKey:@"data"] == nil && [input valueForKey:@"images"] == nil && [input valueForKey:@"imageInputs"] == nil) return nil;
|
|
96
203
|
RGLRecognizeConfig *config = [RGLRecognizeConfig alloc];
|
|
97
204
|
|
|
98
205
|
if([input valueForKey:@"image"] != nil)
|
|
99
206
|
config = [config initWithImage:[RGLWJSONConstructor imageWithBase64:[input valueForKey:@"image"]]];
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
207
|
+
if([input valueForKey:@"data"] != nil)
|
|
208
|
+
config = [config initWithImageData:[RGLWJSONConstructor base64Decode:[input valueForKey:@"data"]]];
|
|
209
|
+
if([input valueForKey:@"images"] != nil) {
|
|
210
|
+
NSMutableArray<UIImage*>* images = [NSMutableArray new];
|
|
211
|
+
for(NSString* base64 in [input valueForKey:@"images"])
|
|
103
212
|
[images addObject:[RGLWJSONConstructor imageWithBase64:base64]];
|
|
104
213
|
config = [config initWithImages:images];
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
214
|
+
}
|
|
215
|
+
if([input valueForKey:@"imageInputData"] != nil) {
|
|
216
|
+
NSMutableArray<RGLImageInput*>* images = [NSMutableArray new];
|
|
217
|
+
for(NSDictionary* image in [input valueForKey:@"imageInputData"])
|
|
218
|
+
[images addObject:[RGLWJSONConstructor imageInputFromJson: image]];
|
|
109
219
|
config = [config initWithImageInputs:images];
|
|
110
220
|
}
|
|
111
221
|
|
|
112
222
|
if([input valueForKey:@"scenario"] != nil)
|
|
113
223
|
config.scenario = [input valueForKey:@"scenario"];
|
|
114
224
|
if([input valueForKey:@"onlineProcessingConfig"] != nil)
|
|
115
|
-
config.onlineProcessingConfig = [
|
|
225
|
+
config.onlineProcessingConfig = [self onlineProcessingConfigFromJson:[input valueForKey:@"onlineProcessingConfig"]];
|
|
116
226
|
if([input valueForKey:@"livePortrait"] != nil)
|
|
117
227
|
config.livePortrait = [self imageWithBase64:[input valueForKey:@"livePortrait"]];
|
|
118
228
|
if([input valueForKey:@"extPortrait"] != nil)
|
|
@@ -123,428 +233,519 @@
|
|
|
123
233
|
return config;
|
|
124
234
|
}
|
|
125
235
|
|
|
126
|
-
+(
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
236
|
+
+(NSDictionary*)generateRecognizeConfig:(RGLRecognizeConfig*)input {
|
|
237
|
+
if(input == nil) return nil;
|
|
238
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
239
|
+
|
|
240
|
+
result[@"scenario"] = input.scenario;
|
|
241
|
+
result[@"onlineProcessingConfig"] = [self generateOnlineProcessingConfig: input.onlineProcessingConfig];
|
|
242
|
+
result[@"livePortrait"] = [self base64WithImage: input.livePortrait];
|
|
243
|
+
result[@"extPortrait"] = [self base64WithImage: input.extPortrait];
|
|
244
|
+
result[@"oneShotIdentification"] = @(input.oneShotIdentification);
|
|
245
|
+
result[@"image"] = [self base64WithImage: input.image];
|
|
246
|
+
result[@"data"] = [self base64Encode: input.imageData];
|
|
247
|
+
if(input.images != nil) {
|
|
248
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
249
|
+
for(UIImage* item in input.images)
|
|
250
|
+
[array addObject:[self base64WithImage:item]];
|
|
251
|
+
result[@"images"] = array;
|
|
252
|
+
}
|
|
253
|
+
if(input.imageInputs != nil) {
|
|
254
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
255
|
+
for(RGLImageInput* item in input.imageInputs)
|
|
256
|
+
[array addObject:[self generateImageInput:item]];
|
|
257
|
+
result[@"imageInputData"] = array;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
return result;
|
|
136
261
|
}
|
|
137
262
|
|
|
138
|
-
+(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
263
|
+
+(RGLBackendProcessingConfig*)backendProcessingConfigFromJson:(NSDictionary*)input {
|
|
264
|
+
if(input == nil) return nil;
|
|
265
|
+
RGLBackendProcessingConfig *result = [RGLBackendProcessingConfig new];
|
|
266
|
+
|
|
267
|
+
if([input valueForKey:@"url"] != nil)
|
|
268
|
+
result.url = [input valueForKey:@"url"];
|
|
269
|
+
if([input valueForKey:@"httpHeaders"] != nil)
|
|
270
|
+
result.httpHeaders = [input valueForKey:@"httpHeaders"];
|
|
271
|
+
if([input valueForKey:@"rfidServerSideChipVerification"] != nil)
|
|
272
|
+
result.rfidServerSideChipVerification = [input valueForKey:@"rfidServerSideChipVerification"];
|
|
273
|
+
|
|
144
274
|
return result;
|
|
145
275
|
}
|
|
146
276
|
|
|
147
|
-
+(
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
result[@"
|
|
152
|
-
result[@"
|
|
153
|
-
result[@"
|
|
154
|
-
|
|
277
|
+
+(NSDictionary*)generateBackendProcessingConfig:(RGLBackendProcessingConfig*)input {
|
|
278
|
+
if(input == nil) return nil;
|
|
279
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
280
|
+
|
|
281
|
+
result[@"url"] = input.url;
|
|
282
|
+
result[@"httpHeaders"] = input.httpHeaders;
|
|
283
|
+
result[@"rfidServerSideChipVerification"] = input.rfidServerSideChipVerification;
|
|
284
|
+
|
|
155
285
|
return result;
|
|
156
286
|
}
|
|
157
287
|
|
|
158
|
-
+(
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
if(rect != nil)
|
|
162
|
-
[result addObject:[self generateCGRect:[rect CGRectValue]]];
|
|
288
|
+
+(RGLImageQA*)imageQAFromJson:(NSDictionary*)input {
|
|
289
|
+
RGLImageQA *result = [RGLImageQA new];
|
|
290
|
+
[RGLWConfig setImageQA:result input:input];
|
|
163
291
|
return result;
|
|
164
292
|
}
|
|
165
293
|
|
|
166
|
-
+(
|
|
167
|
-
|
|
294
|
+
+(NSDictionary*)generateImageQA:(RGLImageQA*)input {
|
|
295
|
+
return [RGLWConfig getImageQA:input];
|
|
296
|
+
}
|
|
168
297
|
|
|
169
|
-
|
|
170
|
-
result
|
|
171
|
-
|
|
172
|
-
return result;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
+(NSInteger)generateDocReaderAction:(RGLDocReaderAction)input {
|
|
176
|
-
NSInteger result = -1;
|
|
177
|
-
switch (input) {
|
|
178
|
-
case RGLDocReaderActionComplete:
|
|
179
|
-
result = 0;
|
|
180
|
-
break;
|
|
181
|
-
case RGLDocReaderActionProcess:
|
|
182
|
-
result = 1;
|
|
183
|
-
break;
|
|
184
|
-
case RGLDocReaderActionMorePagesAvailable:
|
|
185
|
-
result = 2;
|
|
186
|
-
break;
|
|
187
|
-
case RGLDocReaderActionCancel:
|
|
188
|
-
result = 3;
|
|
189
|
-
break;
|
|
190
|
-
case RGLDocReaderActionError:
|
|
191
|
-
result = 4;
|
|
192
|
-
break;
|
|
193
|
-
case RGLDocReaderActionProcessWhiteFlashLight:
|
|
194
|
-
result = 5;
|
|
195
|
-
break;
|
|
196
|
-
case RGLDocReaderActionProcessTimeout:
|
|
197
|
-
result = 6;
|
|
198
|
-
break;
|
|
199
|
-
case RGLDocReaderActionProcessOnServer:
|
|
200
|
-
result = 7;
|
|
201
|
-
break;
|
|
202
|
-
default:
|
|
203
|
-
break;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
return result;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
+(NSInteger)generateRFIDCompleteAction:(RGLRFIDCompleteAction)input {
|
|
210
|
-
NSInteger result = 0;
|
|
211
|
-
switch (input) {
|
|
212
|
-
case RGLRFIDCompleteActionComplete:
|
|
213
|
-
result = 0;
|
|
214
|
-
break;
|
|
215
|
-
case RGLRFIDCompleteActionError:
|
|
216
|
-
result = 4;
|
|
217
|
-
break;
|
|
218
|
-
case RGLRFIDCompleteActionCancel:
|
|
219
|
-
result = 3;
|
|
220
|
-
break;
|
|
221
|
-
case RGLRFIDCompleteActionSessionRestarted:
|
|
222
|
-
result = 0;
|
|
223
|
-
break;
|
|
224
|
-
default:
|
|
225
|
-
break;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
return result;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
+(NSMutableDictionary*)generateCompletion:(NSInteger)action :(RGLDocumentReaderResults*)results :(NSError*)error {
|
|
232
|
-
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
298
|
+
+(RGLAuthenticityParams*)authenticityParamsFromJson:(NSDictionary*)input {
|
|
299
|
+
RGLAuthenticityParams *result = [RGLAuthenticityParams defaultParams];
|
|
300
|
+
[RGLWConfig setAuthenticityParams:result input:input];
|
|
301
|
+
return result;
|
|
302
|
+
}
|
|
233
303
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
result[@"error"] = [self generateNSError:error];
|
|
304
|
+
+(NSDictionary*)generateAuthenticityParams:(RGLAuthenticityParams*)input {
|
|
305
|
+
return [RGLWConfig getAuthenticityParams:input];
|
|
306
|
+
}
|
|
238
307
|
|
|
308
|
+
+(RGLLivenessParams*)livenessParamsFromJson:(NSDictionary*)input {
|
|
309
|
+
RGLLivenessParams *result = [RGLLivenessParams defaultParams];
|
|
310
|
+
[RGLWConfig setLivenessParams:result input:input];
|
|
239
311
|
return result;
|
|
240
312
|
}
|
|
241
313
|
|
|
242
|
-
+(
|
|
243
|
-
|
|
244
|
-
return @0;
|
|
245
|
-
else if(value == RGLImageQualityCheckTypeImageFocus)
|
|
246
|
-
return @1;
|
|
247
|
-
else if(value == RGLImageQualityCheckTypeImageResolution)
|
|
248
|
-
return @2;
|
|
249
|
-
else if(value == RGLImageQualityCheckTypeImageColorness)
|
|
250
|
-
return @3;
|
|
251
|
-
else if(value == RGLImageQualityCheckTypeImagePerspective)
|
|
252
|
-
return @4;
|
|
253
|
-
else if(value == RGLImageQualityCheckTypeImageBounds)
|
|
254
|
-
return @5;
|
|
255
|
-
else if(value == RGLImageQualityCheckTypeScreenCapture)
|
|
256
|
-
return @6;
|
|
257
|
-
else if(value == RGLImageQualityCheckTypePortrait)
|
|
258
|
-
return @7;
|
|
259
|
-
else if(value == RGLImageQualityCheckTypeHandwritten)
|
|
260
|
-
return @8;
|
|
261
|
-
else
|
|
262
|
-
return @0;
|
|
314
|
+
+(NSDictionary*)generateLivenessParams:(RGLLivenessParams*)input {
|
|
315
|
+
return [RGLWConfig getLivenessParams:input];
|
|
263
316
|
}
|
|
264
317
|
|
|
265
|
-
+(
|
|
266
|
-
|
|
318
|
+
+(RGLeDLDataGroup*)eDLDataGroupsFromJson:(NSDictionary*)input {
|
|
319
|
+
RGLeDLDataGroup *result = [RGLeDLDataGroup new];
|
|
320
|
+
[RGLWConfig setDataGroups :result dict:input];
|
|
321
|
+
return result;
|
|
267
322
|
}
|
|
268
323
|
|
|
269
|
-
+(
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
result[@"serialNumber"] = [self generateNSData:serialNumber];
|
|
273
|
-
result[@"issuer"] = [self generateRGLPAResourcesIssuer:issuer];
|
|
324
|
+
+(NSDictionary*)generateEDLDataGroups:(RGLeDLDataGroup*)input {
|
|
325
|
+
return [RGLWConfig getDataGroups:input];
|
|
326
|
+
}
|
|
274
327
|
|
|
328
|
+
+(RGLePassportDataGroup*)ePassportDataGroupsFromJson:(NSDictionary*)input {
|
|
329
|
+
RGLePassportDataGroup *result = [RGLePassportDataGroup new];
|
|
330
|
+
[RGLWConfig setDataGroups :result dict:input];
|
|
275
331
|
return result;
|
|
276
332
|
}
|
|
277
333
|
|
|
278
|
-
+(
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
result[@"notificationCode"] = @(input.code & 0xFFFF0000);
|
|
283
|
-
result[@"dataFileType"] = @(input.code & 0x0000FFFF);
|
|
284
|
-
result[@"progress"] = @((int)input.value & 0xFFFFFFF0);
|
|
334
|
+
+(NSDictionary*)generateEPassportDataGroups:(RGLePassportDataGroup*)input {
|
|
335
|
+
return [RGLWConfig getDataGroups:input];
|
|
336
|
+
}
|
|
285
337
|
|
|
338
|
+
+(RGLeIDDataGroup*)eIDDataGroupsFromJson:(NSDictionary*)input {
|
|
339
|
+
RGLeIDDataGroup *result = [RGLeIDDataGroup new];
|
|
340
|
+
[RGLWConfig setDataGroups :result dict:input];
|
|
286
341
|
return result;
|
|
287
342
|
}
|
|
288
343
|
|
|
289
|
-
|
|
344
|
+
+(NSDictionary*)generateEIDDataGroups:(RGLeIDDataGroup*)input {
|
|
345
|
+
return [RGLWConfig getDataGroups:input];
|
|
346
|
+
}
|
|
290
347
|
|
|
291
|
-
+(
|
|
292
|
-
|
|
293
|
-
|
|
348
|
+
+(RGLRFIDScenario*)rfidScenarioFromJson:(NSDictionary*)input {
|
|
349
|
+
RGLRFIDScenario *result = [RGLRFIDScenario new];
|
|
350
|
+
[RGLWConfig setRfidScenario:input :result];
|
|
351
|
+
return result;
|
|
352
|
+
}
|
|
294
353
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
if(item != nil)
|
|
299
|
-
[array addObject:[self generateRGLDocumentReaderDocumentType:item]];
|
|
300
|
-
result[@"documentType"] = array;
|
|
301
|
-
}
|
|
302
|
-
result[@"textResult"] = [self generateRGLDocumentReaderTextResult:input.textResult];
|
|
303
|
-
result[@"graphicResult"] = [self generateRGLDocumentReaderGraphicResult:input.graphicResult];
|
|
304
|
-
if(input.documentPosition != nil){
|
|
305
|
-
NSMutableArray *array = [NSMutableArray new];
|
|
306
|
-
for(RGLPosition* item in input.documentPosition)
|
|
307
|
-
if(item != nil)
|
|
308
|
-
[array addObject:[self generateRGLPosition:item]];
|
|
309
|
-
result[@"documentPosition"] = array;
|
|
310
|
-
}
|
|
311
|
-
if(input.barcodePosition != nil){
|
|
312
|
-
NSMutableArray *array = [NSMutableArray new];
|
|
313
|
-
for(RGLPosition* item in input.barcodePosition)
|
|
314
|
-
if(item != nil)
|
|
315
|
-
[array addObject:[self generateRGLPosition:item]];
|
|
316
|
-
result[@"barcodePosition"] = array;
|
|
317
|
-
}
|
|
318
|
-
if(input.mrzPosition != nil){
|
|
319
|
-
NSMutableArray *array = [NSMutableArray new];
|
|
320
|
-
for(RGLPosition* item in input.mrzPosition)
|
|
321
|
-
if(item != nil)
|
|
322
|
-
[array addObject:[self generateRGLPosition:item]];
|
|
323
|
-
result[@"mrzPosition"] = array;
|
|
324
|
-
}
|
|
325
|
-
if(input.imageQualityGroup != nil){
|
|
326
|
-
NSMutableArray *array = [NSMutableArray new];
|
|
327
|
-
for(RGLImageQualityGroup* item in input.imageQualityGroup)
|
|
328
|
-
if(item != nil)
|
|
329
|
-
[array addObject:[self generateRGLImageQualityGroup:item]];
|
|
330
|
-
result[@"imageQuality"] = array;
|
|
331
|
-
}
|
|
332
|
-
result[@"authenticityResult"] = [self generateRGLDocumentReaderAuthenticityResult:input.authenticityResults];
|
|
333
|
-
result[@"rfidSessionData"] = [self generateRGLRFIDSessionData:input.rfidSessionData];
|
|
334
|
-
result[@"chipPage"] = @(input.chipPage);
|
|
335
|
-
result[@"barcodeResult"] = [self generateRGLDocumentReaderBarcodeResult:input.barcodeResult];
|
|
336
|
-
result[@"processingFinishedStatus"] = @(input.processingFinishedStatus);
|
|
337
|
-
result[@"morePagesAvailable"] = @(input.morePagesAvailable);
|
|
338
|
-
result[@"elapsedTime"] = @(input.elapsedTime);
|
|
339
|
-
result[@"elapsedTimeRFID"] = @(input.elapsedTimeRFID);
|
|
340
|
-
result[@"rawResult"] = input.rawResult;
|
|
341
|
-
result[@"status"] = [self generateRGLDocumentReaderResultsStatus:input.status];
|
|
342
|
-
result[@"vdsncData"] = [self generateRGLVDSNCData:input.vdsncData];
|
|
354
|
+
+(NSDictionary*)generateRFIDScenario:(RGLRFIDScenario*)input {
|
|
355
|
+
return [RGLWConfig getRfidScenario:input];
|
|
356
|
+
}
|
|
343
357
|
|
|
358
|
+
+(RGLCustomization*)customizationFromJson:(NSDictionary*)input {
|
|
359
|
+
RGLCustomization *result = [RGLCustomization new];
|
|
360
|
+
[RGLWConfig setCustomization:input :result];
|
|
344
361
|
return result;
|
|
345
362
|
}
|
|
346
363
|
|
|
347
|
-
+(
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
result[@"width"] = @(input.size.width);
|
|
352
|
-
result[@"height"] = @(input.size.height);
|
|
353
|
-
result[@"center"] = [self generateCGPoint:input.center];
|
|
354
|
-
result[@"leftTop"] = [self generateCGPoint:input.leftTop];
|
|
355
|
-
result[@"leftBottom"] = [self generateCGPoint:input.leftBottom];
|
|
356
|
-
result[@"rightTop"] = [self generateCGPoint:input.rightTop];
|
|
357
|
-
result[@"rightBottom"] = [self generateCGPoint:input.rightBottom];
|
|
358
|
-
result[@"angle"] = @(input.angle);
|
|
359
|
-
result[@"perspectiveTr"] = @(input.perspectiveTr);
|
|
360
|
-
result[@"objArea"] = @(input.objArea);
|
|
361
|
-
result[@"objIntAngleDev"] = @(input.objIntAngleDev);
|
|
362
|
-
result[@"resultStatus"] = @(input.resultStatus);
|
|
363
|
-
result[@"docFormat"] = @(input.docFormat);
|
|
364
|
-
result[@"pageIndex"] = @(input.pageIndex);
|
|
365
|
-
result[@"dpi"] = @(input.dpi);
|
|
366
|
-
result[@"inverse"] = @(input.inverse);
|
|
364
|
+
+(NSDictionary*)generateCustomization:(RGLCustomization*)input {
|
|
365
|
+
return [RGLWConfig getCustomization:input];
|
|
366
|
+
}
|
|
367
367
|
|
|
368
|
+
+(RGLFunctionality*)functionalityFromJson:(NSDictionary*)input {
|
|
369
|
+
RGLFunctionality *result = [RGLFunctionality new];
|
|
370
|
+
[RGLWConfig setFunctionality:input :result];
|
|
368
371
|
return result;
|
|
369
372
|
}
|
|
370
373
|
|
|
371
|
-
+(
|
|
372
|
-
|
|
373
|
-
|
|
374
|
+
+(NSDictionary*)generateFunctionality:(RGLFunctionality*)input {
|
|
375
|
+
return [RGLWConfig getFunctionality:input];
|
|
376
|
+
}
|
|
374
377
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
378
|
+
+(RGLOnlineProcessingConfig*)onlineProcessingConfigFromJson:(NSDictionary*)input {
|
|
379
|
+
if(input == nil) return nil;
|
|
380
|
+
if([input valueForKey:@"mode"] == nil) return nil;
|
|
381
|
+
|
|
382
|
+
RGLOnlineProcessingConfig *result = [[RGLOnlineProcessingConfig alloc] initWithMode:[[input valueForKey:@"mode"] integerValue]];
|
|
383
|
+
|
|
384
|
+
if([input valueForKey:@"imageFormat"] != nil)
|
|
385
|
+
result.imageFormat = [[input valueForKey:@"imageFormat"] integerValue];
|
|
386
|
+
if([input valueForKey:@"url"] != nil)
|
|
387
|
+
result.serviceURL = [input valueForKey:@"url"];
|
|
388
|
+
if([input valueForKey:@"imageCompressionQuality"] != nil)
|
|
389
|
+
result.imageCompressionQuality = [[input valueForKey:@"imageCompressionQuality"] floatValue];
|
|
390
|
+
if([input valueForKey:@"processParams"] != nil) {
|
|
391
|
+
RGLProcessParams *params = [RGLProcessParams new];
|
|
392
|
+
[RGLWConfig setProcessParams:[input valueForKey:@"processParams"] :params];
|
|
393
|
+
result.processParams = params;
|
|
381
394
|
}
|
|
382
|
-
|
|
395
|
+
|
|
383
396
|
return result;
|
|
384
397
|
}
|
|
385
398
|
|
|
386
|
-
+(
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
result[@"
|
|
391
|
-
result[@"
|
|
392
|
-
result[@"
|
|
393
|
-
result[@"
|
|
394
|
-
result[@"
|
|
399
|
+
+(NSDictionary*)generateOnlineProcessingConfig:(RGLOnlineProcessingConfig*)input {
|
|
400
|
+
if(input == nil) return nil;
|
|
401
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
402
|
+
|
|
403
|
+
result[@"mode"] = @(input.mode);
|
|
404
|
+
result[@"url"] = input.serviceURL;
|
|
405
|
+
result[@"processParams"] = [RGLWConfig getProcessParams:input.processParams];
|
|
406
|
+
result[@"imageFormat"] = @(input.imageFormat);
|
|
407
|
+
result[@"imageCompressionQuality"] = @(input.imageCompressionQuality);
|
|
408
|
+
|
|
409
|
+
return result;
|
|
410
|
+
}
|
|
395
411
|
|
|
412
|
+
+(RGLGlaresCheckParams*)glaresCheckParamsFromJson:(NSDictionary*)input {
|
|
413
|
+
if(input == nil) return nil;
|
|
414
|
+
RGLGlaresCheckParams *result = [RGLGlaresCheckParams new];
|
|
415
|
+
|
|
416
|
+
if([input valueForKey:@"imgMarginPart"] != nil)
|
|
417
|
+
result.imgMarginPart = [input valueForKey:@"imgMarginPart"];
|
|
418
|
+
if([input valueForKey:@"maxGlaringPart"] != nil)
|
|
419
|
+
result.maxGlaringPart = [input valueForKey:@"maxGlaringPart"];
|
|
420
|
+
|
|
396
421
|
return result;
|
|
397
422
|
}
|
|
398
423
|
|
|
399
|
-
+(
|
|
400
|
-
|
|
401
|
-
|
|
424
|
+
+(NSDictionary*)generateGlaresCheckParams:(RGLGlaresCheckParams*)input {
|
|
425
|
+
if(input == nil) return nil;
|
|
426
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
427
|
+
|
|
428
|
+
result[@"imgMarginPart"] = input.imgMarginPart;
|
|
429
|
+
result[@"maxGlaringPart"] = input.maxGlaringPart;
|
|
430
|
+
|
|
431
|
+
return result;
|
|
432
|
+
}
|
|
402
433
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
434
|
+
+(RGLImageInput*)imageInputFromJson:(NSDictionary*)input {
|
|
435
|
+
if(input == nil) return nil;
|
|
436
|
+
|
|
437
|
+
NSInteger pageIndex = 0;
|
|
438
|
+
if([input valueForKey:@"pageIndex"] != nil)
|
|
439
|
+
pageIndex = [[input valueForKey:@"pageIndex"] integerValue];
|
|
440
|
+
NSInteger light = 6;
|
|
441
|
+
if([input valueForKey:@"light"] != nil)
|
|
442
|
+
light = [[input valueForKey:@"light"] integerValue];
|
|
443
|
+
if([input valueForKey:@"image"] != nil)
|
|
444
|
+
return [[RGLImageInput alloc] initWithImage:[self imageWithBase64:[input valueForKey:@"image"]] light:light pageIndex:pageIndex];
|
|
445
|
+
return nil;
|
|
446
|
+
}
|
|
406
447
|
|
|
448
|
+
+(NSDictionary*)generateImageInput:(RGLImageInput*)input {
|
|
449
|
+
if(input == nil) return nil;
|
|
450
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
451
|
+
|
|
452
|
+
result[@"pageIndex"] = @(input.pageIndex);
|
|
453
|
+
result[@"light"] = @(input.lightType);
|
|
454
|
+
result[@"image"] = [self base64WithImage:input.image];
|
|
455
|
+
|
|
407
456
|
return result;
|
|
408
457
|
}
|
|
409
458
|
|
|
410
|
-
+(
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
[array addObject:[self generateRGLAuthenticityCheck:item]];
|
|
420
|
-
result[@"checks"] = array;
|
|
421
|
-
}
|
|
459
|
+
+(RGLPKDCertificate*)pkdCertificateFromJson:(NSDictionary*)input {
|
|
460
|
+
if(input == nil) return nil;
|
|
461
|
+
|
|
462
|
+
NSInteger type = [[input valueForKey:@"resourceType"] integerValue];
|
|
463
|
+
NSData* binaryData = [self base64Decode:[input objectForKey:@"binaryData"]];
|
|
464
|
+
NSData* privateKey = [self base64Decode:[input objectForKey:@"privateKey"]];
|
|
465
|
+
|
|
466
|
+
return [[RGLPKDCertificate alloc] initWithBinaryData:binaryData resourceType:type privateKey:privateKey];
|
|
467
|
+
}
|
|
422
468
|
|
|
469
|
+
+(NSDictionary*)generatePKDCertificate:(RGLPKDCertificate*)input {
|
|
470
|
+
if(input == nil) return nil;
|
|
471
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
472
|
+
|
|
473
|
+
result[@"resourceType"] = @(input.resourceType);
|
|
474
|
+
result[@"binaryData"] = [self base64Encode:input.binaryData];
|
|
475
|
+
result[@"privateKey"] = [self base64Encode:input.privateKey];
|
|
476
|
+
|
|
423
477
|
return result;
|
|
424
478
|
}
|
|
425
479
|
|
|
426
|
-
+(
|
|
427
|
-
|
|
428
|
-
if(input == nil) return result;
|
|
480
|
+
+(RGLRFIDParams*)rfidParamsFromJson:(NSDictionary*)input {
|
|
481
|
+
RGLRFIDParams* result = [RGLRFIDParams new];
|
|
429
482
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
result[@"status"] = @(input.status);
|
|
433
|
-
if(input.elements != nil){
|
|
434
|
-
NSMutableArray *array = [NSMutableArray new];
|
|
435
|
-
for(RGLAuthenticityElement* item in input.elements)
|
|
436
|
-
if(item != nil)
|
|
437
|
-
[array addObject:[self generateRGLAuthenticityElement:item]];
|
|
438
|
-
result[@"elements"] = array;
|
|
439
|
-
}
|
|
440
|
-
result[@"pageIndex"] = @(input.pageIndex);
|
|
483
|
+
if([input valueForKey:@"paIgnoreNotificationCodes"] != nil)
|
|
484
|
+
result.paIgnoreNotificationCodes = [input valueForKey:@"paIgnoreNotificationCodes"];
|
|
441
485
|
|
|
442
486
|
return result;
|
|
443
487
|
}
|
|
444
488
|
|
|
445
|
-
+(
|
|
489
|
+
+(NSDictionary*)generateRFIDParams:(RGLRFIDParams*)input {
|
|
490
|
+
if(input == nil) return nil;
|
|
446
491
|
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
result
|
|
451
|
-
|
|
452
|
-
result[@"elementDiagnose"] = @(input.elementDiagnose);
|
|
453
|
-
result[@"elementDiagnoseName"] = input.elementDiagnoseName;
|
|
492
|
+
|
|
493
|
+
result[@"paIgnoreNotificationCodes"] = input.paIgnoreNotificationCodes;
|
|
494
|
+
|
|
495
|
+
return result;
|
|
496
|
+
}
|
|
454
497
|
|
|
498
|
+
+(RGLProcessParams*)processParamsFromJson:(NSDictionary*)input {
|
|
499
|
+
RGLProcessParams* result = [RGLProcessParams new];
|
|
500
|
+
[RGLWConfig setProcessParams:input :result];
|
|
455
501
|
return result;
|
|
456
502
|
}
|
|
457
503
|
|
|
458
|
-
+(
|
|
459
|
-
|
|
460
|
-
|
|
504
|
+
+(NSDictionary*)generateProcessParams:(RGLProcessParams*)input {
|
|
505
|
+
return [RGLWConfig getProcessParams:input];
|
|
506
|
+
}
|
|
461
507
|
|
|
462
|
-
|
|
463
|
-
result
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
508
|
+
+(RGLFaceAPIParams*)faceAPIParamsFromJson:(NSDictionary*)input {
|
|
509
|
+
RGLFaceAPIParams* result = [RGLFaceAPIParams defaultParams];
|
|
510
|
+
|
|
511
|
+
if([input valueForKey:@"url"] != nil)
|
|
512
|
+
result.url = [input valueForKey:@"url"];
|
|
513
|
+
if([input valueForKey:@"mode"] != nil)
|
|
514
|
+
result.mode = [input valueForKey:@"mode"];
|
|
515
|
+
if([input valueForKey:@"threshold"] != nil)
|
|
516
|
+
result.threshold = [input valueForKey:@"threshold"];
|
|
517
|
+
if([input valueForKey:@"searchParams"] != nil)
|
|
518
|
+
result.searchParams = [self faceAPISearchParamsFromJson:[input valueForKey:@"searchParams"]];
|
|
519
|
+
if([input valueForKey:@"serviceTimeout"] != nil)
|
|
520
|
+
result.serviceTimeout = [input valueForKey:@"serviceTimeout"];
|
|
521
|
+
if([input valueForKey:@"proxy"] != nil)
|
|
522
|
+
result.proxy = [input valueForKey:@"proxy"];
|
|
523
|
+
if([input valueForKey:@"proxyPassword"] != nil)
|
|
524
|
+
result.proxyPassword = [input valueForKey:@"proxyPassword"];
|
|
525
|
+
if([input valueForKey:@"proxyType"] != nil)
|
|
526
|
+
result.proxyType = [input valueForKey:@"proxyType"];
|
|
471
527
|
|
|
472
528
|
return result;
|
|
473
529
|
}
|
|
474
530
|
|
|
475
|
-
+(
|
|
531
|
+
+(NSDictionary*)generateFaceAPIParams:(RGLFaceAPIParams*)input {
|
|
532
|
+
if(input == nil) return nil;
|
|
476
533
|
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
result[@"
|
|
480
|
-
result[@"
|
|
481
|
-
result[@"
|
|
482
|
-
result[@"
|
|
483
|
-
|
|
534
|
+
|
|
535
|
+
result[@"url"] = input.url;
|
|
536
|
+
result[@"mode"] = input.mode;
|
|
537
|
+
result[@"searchParams"] = [self generateFaceAPISearchParams:input.searchParams];
|
|
538
|
+
result[@"threshold"] = input.threshold;
|
|
539
|
+
result[@"serviceTimeout"] = input.serviceTimeout;
|
|
540
|
+
result[@"proxy"] = input.proxy;
|
|
541
|
+
result[@"proxyPassword"] = input.proxyPassword;
|
|
542
|
+
result[@"proxyType"] = input.proxyType;
|
|
543
|
+
|
|
484
544
|
return result;
|
|
485
545
|
}
|
|
486
546
|
|
|
487
|
-
+(
|
|
488
|
-
|
|
489
|
-
if(input == nil) return result;
|
|
547
|
+
+(RGLFaceAPISearchParams*)faceAPISearchParamsFromJson:(NSDictionary*)input {
|
|
548
|
+
RGLFaceAPISearchParams* result = [RGLFaceAPISearchParams new];
|
|
490
549
|
|
|
491
|
-
if(input
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
result[
|
|
497
|
-
}
|
|
550
|
+
if([input valueForKey:@"limit"] != nil)
|
|
551
|
+
result.limit = [input valueForKey:@"limit"];
|
|
552
|
+
if([input valueForKey:@"threshold"] != nil)
|
|
553
|
+
result.threshold = [input valueForKey:@"threshold"];
|
|
554
|
+
if([input valueForKey:@"groupIds"] != nil)
|
|
555
|
+
result.groupIDs = [input valueForKey:@"groupIds"];
|
|
498
556
|
|
|
499
557
|
return result;
|
|
500
558
|
}
|
|
501
559
|
|
|
502
|
-
+(
|
|
503
|
-
|
|
504
|
-
|
|
560
|
+
+(NSDictionary*)generateFaceAPISearchParams:(RGLFaceAPISearchParams*)input {
|
|
561
|
+
if(input == nil) return nil;
|
|
562
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
563
|
+
|
|
564
|
+
result[@"limit"] = input.limit;
|
|
565
|
+
result[@"threshold"] = input.threshold;
|
|
566
|
+
result[@"groupIds"] = input.groupIDs;
|
|
567
|
+
|
|
568
|
+
return result;
|
|
569
|
+
}
|
|
505
570
|
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
571
|
+
+(RGLScenario*)scenarioFromJson:(NSDictionary*)input {
|
|
572
|
+
if(input == nil) return nil;
|
|
573
|
+
|
|
574
|
+
NSString* identifier = [input valueForKey:@"name"];
|
|
575
|
+
double frameKWHLandscape = [[input valueForKey:@"frameKWHLandscape"] doubleValue];
|
|
576
|
+
double frameKWHPortrait = [[input valueForKey:@"frameKWHPortrait"] doubleValue];
|
|
577
|
+
double frameKWHDoublePageSpreadPortrait = [[input valueForKey:@"frameKWHDoublePageSpreadPortrait"] doubleValue];
|
|
578
|
+
double frameKWHDoublePageSpreadLandscape = [[input valueForKey:@"frameKWHDoublePageSpreadLandscape"] doubleValue];
|
|
579
|
+
NSString* scenarioDescription = [input valueForKey:@"description"];
|
|
580
|
+
BOOL faceExt = [[input valueForKey:@"faceExt"] boolValue];
|
|
581
|
+
BOOL multiPageOff = [[input valueForKey:@"multiPageOff"] boolValue];
|
|
582
|
+
BOOL seriesProcessMode = [[input valueForKey:@"seriesProcessMode"] boolValue];
|
|
583
|
+
NSString* caption = [input valueForKey:@"caption"];
|
|
584
|
+
BOOL uvTorch = [[input valueForKey:@"uvTorch"] boolValue];
|
|
585
|
+
NSInteger frameOrientation = [[input valueForKey:@"frameOrientation"] integerValue];
|
|
586
|
+
BOOL manualCrop = [[input valueForKey:@"manualCrop"] boolValue];
|
|
587
|
+
|
|
588
|
+
return [[RGLScenario new] initWithIdentifier:identifier frame:0 frameKWHLandscape:frameKWHLandscape frameKWHPortrait:frameKWHPortrait frameKWHDoublePageSpreadPortrait:frameKWHDoublePageSpreadPortrait frameKWHDoublePageSpreadLandscape:frameKWHDoublePageSpreadLandscape scenarioDescription:scenarioDescription barcodeExt:nil faceExt:faceExt multiPageOff:multiPageOff caption:caption uvTorch:uvTorch frameOrientation:frameOrientation seriesProcessMode:seriesProcessMode manualCrop:manualCrop];
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
+(NSDictionary*)generateScenario:(RGLScenario*)input {
|
|
592
|
+
if(input == nil) return nil;
|
|
593
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
594
|
+
|
|
595
|
+
result[@"name"] = input.identifier;
|
|
596
|
+
result[@"frameKWHLandscape"] = @(input.frameKWHLandscape);
|
|
597
|
+
result[@"frameKWHPortrait"] = @(input.frameKWHPortrait);
|
|
598
|
+
result[@"frameKWHDoublePageSpreadPortrait"] = @(input.frameKWHDoublePageSpreadPortrait);
|
|
599
|
+
result[@"frameKWHDoublePageSpreadLandscape"] = @(input.frameKWHDoublePageSpreadLandscape);
|
|
600
|
+
result[@"description"] = input.scenarioDescription;
|
|
601
|
+
result[@"faceExt"] = @(input.faceExt);
|
|
602
|
+
result[@"multiPageOff"] = @(input.multiPageOff);
|
|
603
|
+
result[@"seriesProcessMode"] = @(input.seriesProcessMode);
|
|
604
|
+
result[@"caption"] = input.caption;
|
|
605
|
+
result[@"uvTorch"] = @(input.uvTorch);
|
|
606
|
+
result[@"frameOrientation"] = @(input.frameOrientation);
|
|
607
|
+
result[@"manualCrop"] = @(input.manualCrop);
|
|
608
|
+
|
|
609
|
+
return result;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
+(CGRect)rectFromJson:(NSDictionary*)input {
|
|
613
|
+
return CGRectMake(
|
|
614
|
+
[[input valueForKey:@"left"] floatValue],
|
|
615
|
+
[[input valueForKey:@"top"] floatValue],
|
|
616
|
+
[[input valueForKey:@"right"] floatValue] - [[input valueForKey:@"left"] floatValue],
|
|
617
|
+
[[input valueForKey:@"bottom"] floatValue] - [[input valueForKey:@"top"] floatValue]);
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
+(NSDictionary*)generateRect:(CGRect)input {
|
|
621
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
622
|
+
if(input.origin.x == 0 && input.origin.y == 0) return nil;
|
|
623
|
+
|
|
624
|
+
result[@"top"] = @(input.origin.y);
|
|
625
|
+
result[@"left"] = @(input.origin.x);
|
|
626
|
+
result[@"bottom"] = @(input.origin.y+input.size.height);
|
|
627
|
+
result[@"right"] = @(input.origin.x+input.size.width);
|
|
628
|
+
|
|
629
|
+
return result;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
+(RGLDocumentReaderGraphicField*)documentReaderGraphicFieldFromJson:(NSDictionary*)input {
|
|
633
|
+
return [[RGLDocumentReaderGraphicField alloc]
|
|
634
|
+
initWithSourceType:[[input valueForKey:@"sourceType"] integerValue]
|
|
635
|
+
fieldType:[[input valueForKey:@"fieldType"] integerValue]
|
|
636
|
+
boundRect:[self rectFromJson: [input valueForKey:@"fieldRect"]]
|
|
637
|
+
value:[self imageWithBase64: [input valueForKey:@"value"]]
|
|
638
|
+
light:[[input valueForKey:@"light"] integerValue]
|
|
639
|
+
pageIndex:[[input valueForKey:@"pageIndex"] integerValue]
|
|
640
|
+
originalPageIndex:[[input valueForKey:@"originalPageIndex"] integerValue]];
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
+(NSDictionary*)generateDocumentReaderGraphicField:(RGLDocumentReaderGraphicField*)input {
|
|
644
|
+
if(input == nil) return nil;
|
|
645
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
646
|
+
|
|
647
|
+
result[@"sourceType"] = @(input.sourceType);
|
|
648
|
+
result[@"fieldType"] = @(input.fieldType);
|
|
649
|
+
result[@"fieldName"] = input.fieldName;
|
|
650
|
+
result[@"fieldRect"] = [self generateRect:input.boundRect];
|
|
651
|
+
result[@"value"] = [self base64WithImage:input.value];
|
|
652
|
+
result[@"light"] = @(input.lightType);
|
|
512
653
|
result[@"lightName"] = input.lightName;
|
|
513
654
|
result[@"pageIndex"] = @(input.pageIndex);
|
|
514
655
|
result[@"originalPageIndex"] = @(input.originalPageIndex);
|
|
515
|
-
|
|
656
|
+
|
|
516
657
|
return result;
|
|
517
658
|
}
|
|
518
659
|
|
|
519
|
-
+(
|
|
520
|
-
|
|
521
|
-
|
|
660
|
+
+(RGLDocumentReaderGraphicResult*)documentReaderGraphicResultFromJson:(NSDictionary*)input {
|
|
661
|
+
NSMutableArray<RGLDocumentReaderGraphicField*>* array = [NSMutableArray new];
|
|
662
|
+
for(NSDictionary* item in [input valueForKey:@"fields"]){
|
|
663
|
+
[array addObject:[self documentReaderGraphicFieldFromJson: item]];
|
|
664
|
+
}
|
|
665
|
+
return [[RGLDocumentReaderGraphicResult alloc] initWithFields:array];
|
|
666
|
+
}
|
|
522
667
|
|
|
523
|
-
|
|
668
|
+
+(NSDictionary*)generateDocumentReaderGraphicResult:(RGLDocumentReaderGraphicResult*)input {
|
|
669
|
+
if(input == nil) return nil;
|
|
670
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
671
|
+
|
|
672
|
+
if(input.fields != nil) {
|
|
524
673
|
NSMutableArray *array = [NSMutableArray new];
|
|
525
|
-
for(
|
|
526
|
-
|
|
527
|
-
[array addObject:[self generateRGLDocumentReaderTextField:item]];
|
|
674
|
+
for(RGLDocumentReaderGraphicField* item in input.fields)
|
|
675
|
+
[array addObject:[self generateDocumentReaderGraphicField:item]];
|
|
528
676
|
result[@"fields"] = array;
|
|
529
677
|
}
|
|
530
|
-
|
|
531
|
-
result
|
|
532
|
-
|
|
533
|
-
|
|
678
|
+
|
|
679
|
+
return result;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
+(NSDictionary*)documentReaderValueDictionaryFromJson:(NSDictionary*)input {
|
|
683
|
+
NSMutableDictionary* json = input.mutableCopy;
|
|
684
|
+
|
|
685
|
+
json[@"containerType"] = [input valueForKey:@"sourceType"];
|
|
686
|
+
json[@"fieldRect"] = [input valueForKey:@"boundRect"];
|
|
687
|
+
|
|
688
|
+
return json;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
+(RGLDocumentReaderValue*)documentReaderValueFromJson:(NSDictionary*)input {
|
|
692
|
+
return [RGLDocumentReaderValue initWithJSON:[self documentReaderValueDictionaryFromJson:input] field:[RGLDocumentReaderTextField initWithJSON:[NSDictionary new] sourceList:[NSDictionary new]]];
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
+(NSDictionary*)generateDocumentReaderValue:(RGLDocumentReaderValue*)input {
|
|
696
|
+
if(input == nil) return nil;
|
|
697
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
698
|
+
|
|
699
|
+
result[@"sourceType"] = @(input.sourceType);
|
|
700
|
+
result[@"value"] = input.value;
|
|
701
|
+
result[@"originalValue"] = input.originalValue;
|
|
702
|
+
result[@"boundRect"] = [self generateRect:input.boundRect];
|
|
703
|
+
result[@"pageIndex"] = @(input.pageIndex);
|
|
704
|
+
result[@"probability"] = @(input.probability);
|
|
705
|
+
if(input.originalSymbols != nil){
|
|
534
706
|
NSMutableArray *array = [NSMutableArray new];
|
|
535
|
-
for(
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
result[@"availableSourceList"] = array;
|
|
707
|
+
for(RGLDocumentReaderSymbol* item in input.originalSymbols)
|
|
708
|
+
[array addObject:[self generateDocumentReaderSymbol:item]];
|
|
709
|
+
result[@"originalSymbols"] = array;
|
|
539
710
|
}
|
|
540
|
-
|
|
711
|
+
result[@"rfidOrigin"] = [self generateDocumentReaderRfidOrigin:input.rfidOrigin];
|
|
712
|
+
|
|
541
713
|
return result;
|
|
542
714
|
}
|
|
543
715
|
|
|
544
|
-
+(
|
|
545
|
-
NSMutableDictionary
|
|
546
|
-
|
|
716
|
+
+(NSDictionary*)documentReaderTextFieldDictionaryFromJson:(NSDictionary*)input {
|
|
717
|
+
NSMutableDictionary* json = input.mutableCopy;
|
|
718
|
+
|
|
719
|
+
json[@"sourceType"] = [[[input mutableArrayValueForKey:@"validityList"] objectAtIndex:0] valueForKey:@"sourceType"];
|
|
720
|
+
json[@"sourceTypeLeft"] = [[[input mutableArrayValueForKey:@"comparisonList"] objectAtIndex:0] valueForKey:@"sourceTypeLeft"];
|
|
721
|
+
json[@"sourceTypeRight"] = [[[input mutableArrayValueForKey:@"comparisonList"] objectAtIndex:0] valueForKey:@"sourceTypeRight"];
|
|
722
|
+
NSMutableArray<NSDictionary*>* validityList = [NSMutableArray new];
|
|
723
|
+
for(NSDictionary* item in [input valueForKey:@"validityList"]){
|
|
724
|
+
[validityList addObject:[self documentReaderValidityDictionaryFromJson:item]];
|
|
725
|
+
}
|
|
726
|
+
json[@"validityList"] = validityList;
|
|
727
|
+
NSMutableArray<NSDictionary*>* comparisonList = [NSMutableArray new];
|
|
728
|
+
for(NSDictionary* item in [input valueForKey:@"comparisonList"]){
|
|
729
|
+
[comparisonList addObject:[self documentReaderComparisonDictionaryFromJson:item]];
|
|
730
|
+
}
|
|
731
|
+
json[@"comparisonList"] = comparisonList;
|
|
732
|
+
NSMutableArray<NSDictionary*>* valueList = [NSMutableArray new];
|
|
733
|
+
for(NSDictionary* item in [input valueForKey:@"values"]){
|
|
734
|
+
[valueList addObject:[self documentReaderValueDictionaryFromJson:item]];
|
|
735
|
+
}
|
|
736
|
+
json[@"valueList"] = valueList;
|
|
737
|
+
|
|
738
|
+
return json;
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
+(RGLDocumentReaderTextField*)documentReaderTextFieldFromJson:(NSDictionary*)input {
|
|
742
|
+
return [RGLDocumentReaderTextField initWithJSON:[self documentReaderTextFieldDictionaryFromJson:input] sourceList:[self documentReaderTextFieldDictionaryFromJson:input]];
|
|
743
|
+
}
|
|
547
744
|
|
|
745
|
+
+(NSDictionary*)generateDocumentReaderTextField:(RGLDocumentReaderTextField*)input {
|
|
746
|
+
if(input == nil) return nil;
|
|
747
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
748
|
+
|
|
548
749
|
result[@"fieldType"] = @(input.fieldType);
|
|
549
750
|
result[@"fieldName"] = input.fieldName;
|
|
550
751
|
result[@"lcid"] = @(input.lcid);
|
|
@@ -552,67 +753,231 @@
|
|
|
552
753
|
if(input.values != nil){
|
|
553
754
|
NSMutableArray *array = [NSMutableArray new];
|
|
554
755
|
for(RGLDocumentReaderValue* item in input.values)
|
|
555
|
-
|
|
556
|
-
[array addObject:[self generateRGLDocumentReaderValue:item]];
|
|
756
|
+
[array addObject:[self generateDocumentReaderValue:item]];
|
|
557
757
|
result[@"values"] = array;
|
|
558
758
|
}
|
|
559
759
|
result[@"status"] = @(input.status);
|
|
760
|
+
result[@"comparisonStatus"] = @(input.comparisonStatus);
|
|
761
|
+
result[@"validityStatus"] = @(input.validityStatus);
|
|
560
762
|
result[@"value"] = input.value;
|
|
561
|
-
result[@"getValue"] = [self
|
|
763
|
+
result[@"getValue"] = [self generateDocumentReaderValue:[input getValue]];
|
|
562
764
|
if(input.comparisonList != nil){
|
|
563
765
|
NSMutableArray *array = [NSMutableArray new];
|
|
564
766
|
for(RGLDocumentReaderComparison* item in input.comparisonList)
|
|
565
|
-
|
|
566
|
-
[array addObject:[self generateRGLDocumentReaderComparison:item]];
|
|
767
|
+
[array addObject:[self generateDocumentReaderComparison:item]];
|
|
567
768
|
result[@"comparisonList"] = array;
|
|
568
769
|
}
|
|
569
770
|
if(input.validityList != nil){
|
|
570
771
|
NSMutableArray *array = [NSMutableArray new];
|
|
571
772
|
for(RGLDocumentReaderValidity* item in input.validityList)
|
|
572
|
-
|
|
573
|
-
[array addObject:[self generateRGLDocumentReaderValidity:item]];
|
|
773
|
+
[array addObject:[self generateDocumentReaderValidity:item]];
|
|
574
774
|
result[@"validityList"] = array;
|
|
575
775
|
}
|
|
776
|
+
|
|
777
|
+
return result;
|
|
778
|
+
}
|
|
576
779
|
|
|
780
|
+
+(NSDictionary*)documentReaderTextResultDictionaryFromJson:(NSDictionary*)input {
|
|
781
|
+
NSMutableDictionary* json = input.mutableCopy;
|
|
782
|
+
|
|
783
|
+
NSMutableArray<NSDictionary*>* availableSourceList = [NSMutableArray new];
|
|
784
|
+
for(NSDictionary* item in [input valueForKey:@"availableSourceList"]){
|
|
785
|
+
[availableSourceList addObject:[self documentReaderTextSourceDictionaryFromJson:item]];
|
|
786
|
+
}
|
|
787
|
+
json[@"availableSourceList"] = availableSourceList;
|
|
788
|
+
NSMutableArray<NSDictionary*>* fields = [NSMutableArray new];
|
|
789
|
+
for(NSDictionary* item in [input valueForKey:@"fields"]){
|
|
790
|
+
[fields addObject:[self documentReaderTextFieldDictionaryFromJson:item]];
|
|
791
|
+
}
|
|
792
|
+
json[@"fieldList"] = fields;
|
|
793
|
+
|
|
794
|
+
return json;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
+(RGLDocumentReaderTextResult*)documentReaderTextResultFromJson:(NSDictionary*)input {
|
|
798
|
+
return [RGLDocumentReaderTextResult initWithJSON:[self documentReaderTextResultDictionaryFromJson: input]];
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
+(NSDictionary*)generateDocumentReaderTextResult:(RGLDocumentReaderTextResult*)input {
|
|
802
|
+
if(input == nil) return nil;
|
|
803
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
804
|
+
|
|
805
|
+
if(input.fields != nil){
|
|
806
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
807
|
+
for(RGLDocumentReaderTextField* item in input.fields)
|
|
808
|
+
[array addObject:[self generateDocumentReaderTextField:item]];
|
|
809
|
+
result[@"fields"] = array;
|
|
810
|
+
}
|
|
811
|
+
result[@"status"] = @(input.status);
|
|
812
|
+
result[@"comparisonStatus"] = @(input.comparisonStatus);
|
|
813
|
+
result[@"validityStatus"] = @(input.validityStatus);
|
|
814
|
+
if(input.availableSourceList != nil){
|
|
815
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
816
|
+
for(RGLDocumentReaderTextSource* item in input.availableSourceList)
|
|
817
|
+
[array addObject:[self generateDocumentReaderTextSource:item]];
|
|
818
|
+
result[@"availableSourceList"] = array;
|
|
819
|
+
}
|
|
820
|
+
|
|
577
821
|
return result;
|
|
578
822
|
}
|
|
579
823
|
|
|
580
|
-
+(
|
|
581
|
-
|
|
582
|
-
|
|
824
|
+
+(CGPoint)pointFromJson:(NSDictionary*)input {
|
|
825
|
+
return CGPointMake([[input valueForKey:@"x"] floatValue], [[input valueForKey:@"y"] floatValue]);
|
|
826
|
+
}
|
|
583
827
|
|
|
584
|
-
|
|
585
|
-
result
|
|
586
|
-
|
|
587
|
-
result[@"
|
|
588
|
-
result[@"
|
|
589
|
-
|
|
828
|
+
+(NSDictionary*)generatePoint:(CGPoint)input {
|
|
829
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
830
|
+
|
|
831
|
+
result[@"x"] = [NSNumber numberWithFloat:input.x];
|
|
832
|
+
result[@"y"] = [NSNumber numberWithFloat:input.y];
|
|
833
|
+
|
|
834
|
+
return result;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
+(RGLPosition*)positionFromJson:(NSDictionary*)input {
|
|
838
|
+
NSMutableDictionary* json = input.mutableCopy;
|
|
839
|
+
|
|
840
|
+
json[@"Width"] = [input valueForKey:@"width"];
|
|
841
|
+
json[@"Height"] = [input valueForKey:@"height"];
|
|
842
|
+
json[@"Angle"] = [input valueForKey:@"angle"];
|
|
843
|
+
json[@"Center"] = [input valueForKey:@"center"];
|
|
844
|
+
json[@"LeftTop"] = [input valueForKey:@"leftTop"];
|
|
845
|
+
json[@"LeftBottom"] = [input valueForKey:@"leftBottom"];
|
|
846
|
+
json[@"RightTop"] = [input valueForKey:@"rightTop"];
|
|
847
|
+
json[@"RightBottom"] = [input valueForKey:@"rightBottom"];
|
|
848
|
+
json[@"PerspectiveTr"] = [input valueForKey:@"perspectiveTr"];
|
|
849
|
+
json[@"ObjArea"] = [input valueForKey:@"objArea"];
|
|
850
|
+
json[@"ObjIntAngleDev"] = [input valueForKey:@"objIntAngleDev"];
|
|
851
|
+
json[@"ResultStatus"] = [input valueForKey:@"resultStatus"];
|
|
852
|
+
json[@"docFormat"] = [input valueForKey:@"docFormat"];
|
|
853
|
+
json[@"page_idx"] = [input valueForKey:@"pageIndex"];
|
|
854
|
+
json[@"Dpi"] = [input valueForKey:@"dpi"];
|
|
855
|
+
json[@"Inverse"] = [input valueForKey:@"inverse"];
|
|
856
|
+
|
|
857
|
+
return [RGLPosition initWithJSON:json];
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
+(NSDictionary*)generatePosition:(RGLPosition*)input {
|
|
861
|
+
if(input == nil) return nil;
|
|
862
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
863
|
+
|
|
864
|
+
result[@"width"] = @(input.size.width);
|
|
865
|
+
result[@"height"] = @(input.size.height);
|
|
866
|
+
result[@"angle"] = @(input.angle);
|
|
867
|
+
result[@"center"] = [self generatePoint:input.center];
|
|
868
|
+
result[@"leftTop"] = [self generatePoint:input.leftTop];
|
|
869
|
+
result[@"leftBottom"] = [self generatePoint:input.leftBottom];
|
|
870
|
+
result[@"rightTop"] = [self generatePoint:input.rightTop];
|
|
871
|
+
result[@"rightBottom"] = [self generatePoint:input.rightBottom];
|
|
872
|
+
result[@"perspectiveTr"] = @(input.perspectiveTr);
|
|
873
|
+
result[@"objArea"] = @(input.objArea);
|
|
874
|
+
result[@"objIntAngleDev"] = @(input.objIntAngleDev);
|
|
875
|
+
result[@"resultStatus"] = @(input.resultStatus);
|
|
876
|
+
result[@"docFormat"] = @(input.docFormat);
|
|
590
877
|
result[@"pageIndex"] = @(input.pageIndex);
|
|
591
|
-
result[@"
|
|
592
|
-
|
|
878
|
+
result[@"dpi"] = @(input.dpi);
|
|
879
|
+
result[@"inverse"] = @(input.inverse);
|
|
880
|
+
|
|
881
|
+
return result;
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
+(NSDictionary*)imageQualityDictionaryFromJson:(NSDictionary*)input {
|
|
885
|
+
NSMutableDictionary* json = [NSMutableDictionary new];
|
|
886
|
+
|
|
887
|
+
json[@"featureType"] = [input valueForKey:@"featureType"];
|
|
888
|
+
json[@"type"] = [RGLWConfig imageQualityCheckTypeWithNumber:[input valueForKey:@"type"]];
|
|
889
|
+
json[@"result"] = [input valueForKey:@"result"];
|
|
890
|
+
NSDictionary* dict = @{@"List":[input valueForKey:@"boundRects"]};
|
|
891
|
+
json[@"areas"] = dict;
|
|
892
|
+
|
|
893
|
+
return json;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
+(RGLImageQuality*)imageQualityFromJson:(NSDictionary*)input {
|
|
897
|
+
return [RGLImageQuality initWithJSON:[self imageQualityDictionaryFromJson:input]];
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
+(NSDictionary*)generateImageQuality:(RGLImageQuality*)input {
|
|
901
|
+
if(input == nil) return nil;
|
|
902
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
903
|
+
|
|
904
|
+
result[@"type"] = [RGLWConfig generateImageQualityCheckType:input.type];
|
|
905
|
+
result[@"result"] = @(input.result);
|
|
906
|
+
result[@"featureType"] = @(input.featureType);
|
|
907
|
+
if(input.boundRects != nil){
|
|
593
908
|
NSMutableArray *array = [NSMutableArray new];
|
|
594
|
-
for(
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
result[@"originalSymbols"] = array;
|
|
909
|
+
for(NSValue* item in input.boundRects)
|
|
910
|
+
[array addObject:[self generateRect:[item CGRectValue]]];
|
|
911
|
+
result[@"boundRects"] = array;
|
|
598
912
|
}
|
|
599
|
-
|
|
600
|
-
|
|
913
|
+
|
|
601
914
|
return result;
|
|
602
915
|
}
|
|
603
916
|
|
|
604
|
-
+(
|
|
605
|
-
|
|
606
|
-
|
|
917
|
+
+(RGLImageQualityGroup*)imageQualityGroupFromJson:(NSDictionary*)input {
|
|
918
|
+
if(input == nil) return nil;
|
|
919
|
+
NSMutableDictionary* json = [NSMutableDictionary new];
|
|
920
|
+
|
|
921
|
+
json[@"Count"] = [input valueForKey:@"count"];
|
|
922
|
+
json[@"result"] = [input valueForKey:@"result"];
|
|
923
|
+
json[@"page_idx"] = [input valueForKey:@"pageIndex"];
|
|
924
|
+
NSMutableArray<NSDictionary*>* array = [NSMutableArray new];
|
|
925
|
+
for(NSDictionary* item in [input valueForKey:@"imageQualityList"]){
|
|
926
|
+
[array addObject:[self imageQualityDictionaryFromJson:item]];
|
|
927
|
+
}
|
|
928
|
+
json[@"List"] = array;
|
|
929
|
+
|
|
930
|
+
return [RGLImageQualityGroup initWithJSON:json];
|
|
931
|
+
}
|
|
607
932
|
|
|
933
|
+
+(NSDictionary*)generateImageQualityGroup:(RGLImageQualityGroup*)input {
|
|
934
|
+
if(input == nil) return nil;
|
|
935
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
936
|
+
|
|
937
|
+
result[@"count"] = @(input.count);
|
|
938
|
+
result[@"result"] = @(input.result);
|
|
939
|
+
if(input.imageQualityList != nil){
|
|
940
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
941
|
+
for(RGLImageQuality* item in input.imageQualityList)
|
|
942
|
+
[array addObject:[self generateImageQuality:item]];
|
|
943
|
+
result[@"imageQualityList"] = array;
|
|
944
|
+
}
|
|
945
|
+
result[@"pageIndex"] = @(input.pageIndex);
|
|
946
|
+
|
|
947
|
+
return result;
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
+(RGLDocumentReaderDocumentType*)documentReaderDocumentTypeFromJson:(NSDictionary*)input {
|
|
951
|
+
NSMutableDictionary* json = input.mutableCopy;
|
|
952
|
+
|
|
953
|
+
json[@"DocumentName"] = [input valueForKey:@"name"];
|
|
954
|
+
json[@"ID"] = [input valueForKey:@"documentID"];
|
|
955
|
+
json[@"ICAOCode"] = [input valueForKey:@"ICAOCode"];
|
|
956
|
+
json[@"List"] = [input valueForKey:@"FDSID"];
|
|
957
|
+
json[@"dType"] = [input valueForKey:@"dType"];
|
|
958
|
+
json[@"dFormat"] = [input valueForKey:@"dFormat"];
|
|
959
|
+
json[@"dMRZ"] = [input valueForKey:@"dMRZ"];
|
|
960
|
+
json[@"isDeprecated"] = [input valueForKey:@"isDeprecated"];
|
|
961
|
+
json[@"dDescription"] = [input valueForKey:@"dDescription"];
|
|
962
|
+
json[@"dYear"] = [input valueForKey:@"dYear"];
|
|
963
|
+
json[@"dCountryName"] = [input valueForKey:@"dCountryName"];
|
|
964
|
+
json[@"page_idx"] = [input valueForKey:@"pageIndex"];
|
|
965
|
+
json[@"FDSIDList"] = json.copy;
|
|
966
|
+
|
|
967
|
+
return [RGLDocumentReaderDocumentType initWithJSON:json];
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
+(NSDictionary*)generateDocumentReaderDocumentType:(RGLDocumentReaderDocumentType*)input {
|
|
971
|
+
if(input == nil) return nil;
|
|
972
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
973
|
+
|
|
608
974
|
result[@"name"] = input.name;
|
|
609
975
|
result[@"documentID"] = @(input.documentID);
|
|
610
976
|
result[@"ICAOCode"] = input.ICAOCode;
|
|
611
977
|
if(input.FDSID != nil){
|
|
612
978
|
NSMutableArray *array = [NSMutableArray new];
|
|
613
979
|
for(NSNumber* item in input.FDSID)
|
|
614
|
-
|
|
615
|
-
[array addObject:item];
|
|
980
|
+
[array addObject:item];
|
|
616
981
|
result[@"FDSID"] = array;
|
|
617
982
|
}
|
|
618
983
|
result[@"dType"] = @(input.dType);
|
|
@@ -623,179 +988,156 @@
|
|
|
623
988
|
result[@"dYear"] = input.dYear;
|
|
624
989
|
result[@"dCountryName"] = input.dCountryName;
|
|
625
990
|
result[@"pageIndex"] = @(input.pageIndex);
|
|
626
|
-
|
|
991
|
+
|
|
627
992
|
return result;
|
|
628
993
|
}
|
|
629
994
|
|
|
630
|
-
+(
|
|
995
|
+
+(NSString*)generateDocumentReaderNotification:(RGLRFIDNotify*)input{
|
|
996
|
+
if(input == nil) return nil;
|
|
631
997
|
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
632
|
-
|
|
998
|
+
|
|
999
|
+
result[@"notificationCode"] = @(input.code & -0x10000);
|
|
1000
|
+
result[@"dataFileType"] = @((int)input.attachment);
|
|
1001
|
+
result[@"progress"] = @((int)input.value);
|
|
633
1002
|
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
result[@"frameKWHLandscape"] = @(input.frameKWHLandscape);
|
|
637
|
-
result[@"frameKWHPortrait"] = @(input.frameKWHPortrait);
|
|
638
|
-
result[@"frameKWHDoublePageSpreadPortrait"] = @(input.frameKWHDoublePageSpreadPortrait);
|
|
639
|
-
result[@"frameKWHDoublePageSpreadLandscape"] = @(input.frameKWHDoublePageSpreadLandscape);
|
|
640
|
-
result[@"description"] = input.scenarioDescription;
|
|
641
|
-
result[@"barcodeExt"] = @(input.barcodeExt);
|
|
642
|
-
result[@"faceExt"] = @(input.faceExt);
|
|
643
|
-
result[@"multiPageOff"] = @(input.multiPageOff);
|
|
644
|
-
result[@"seriesProcessMode"] = @(input.seriesProcessMode);
|
|
645
|
-
result[@"caption"] = input.caption;
|
|
646
|
-
result[@"uvTorch"] = @(input.uvTorch);
|
|
647
|
-
result[@"frameOrientation"] = @(input.frameOrientation);
|
|
648
|
-
result[@"manualCrop"] = @(input.manualCrop);
|
|
1003
|
+
return [RGLWJSONConstructor dictToString: result];
|
|
1004
|
+
}
|
|
649
1005
|
|
|
650
|
-
|
|
1006
|
+
+(NSDictionary*)accessControlProcedureTypeDictionaryFromJson:(NSDictionary*)input {
|
|
1007
|
+
NSMutableDictionary* json = [NSMutableDictionary new];
|
|
1008
|
+
|
|
1009
|
+
json[@"ActiveOptionIdx"] = [input valueForKey:@"activeOptionIdx"];
|
|
1010
|
+
json[@"Notifications"] = [input valueForKey:@"notifications"];
|
|
1011
|
+
json[@"Status"] = [input valueForKey:@"status"];
|
|
1012
|
+
json[@"Type"] = [input valueForKey:@"type"];
|
|
1013
|
+
|
|
1014
|
+
return json;
|
|
651
1015
|
}
|
|
652
1016
|
|
|
653
|
-
+(
|
|
654
|
-
|
|
655
|
-
|
|
1017
|
+
+(RGLAccessControlProcedureType*)accessControlProcedureTypeFromJson:(NSDictionary*)input {
|
|
1018
|
+
return [RGLAccessControlProcedureType initWithJSON:[self accessControlProcedureTypeDictionaryFromJson:input]];
|
|
1019
|
+
}
|
|
656
1020
|
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
}
|
|
664
|
-
if(input.applications != nil){
|
|
665
|
-
NSMutableArray *array = [NSMutableArray new];
|
|
666
|
-
for(RGLApplication* item in input.applications)
|
|
667
|
-
if(item != nil)
|
|
668
|
-
[array addObject:[self generateRGLApplication:item]];
|
|
669
|
-
result[@"applications"] = array;
|
|
670
|
-
}
|
|
671
|
-
if(input.securityObjects != nil){
|
|
1021
|
+
+(NSDictionary*)generateAccessControlProcedureType:(RGLAccessControlProcedureType*)input {
|
|
1022
|
+
if(input == nil) return nil;
|
|
1023
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
1024
|
+
|
|
1025
|
+
result[@"activeOptionIdx"] = @(input.activeOptionIdx);
|
|
1026
|
+
if(input.notifications != nil){
|
|
672
1027
|
NSMutableArray *array = [NSMutableArray new];
|
|
673
|
-
for(
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
result[@"securityObjects"] = array;
|
|
1028
|
+
for(NSNumber* item in input.notifications)
|
|
1029
|
+
[array addObject:item];
|
|
1030
|
+
result[@"notifications"] = array;
|
|
677
1031
|
}
|
|
678
|
-
result[@"cardProperties"] = [self generateRGLCardProperties:input.cardProperties];
|
|
679
|
-
result[@"totalBytesReceived"] = @(input.totalBytesReceived);
|
|
680
|
-
result[@"totalBytesSent"] = @(input.totalBytesSent);
|
|
681
1032
|
result[@"status"] = @(input.status);
|
|
682
|
-
result[@"
|
|
683
|
-
|
|
684
|
-
if(input.dataGroups != nil){
|
|
685
|
-
NSMutableArray *array = [NSMutableArray new];
|
|
686
|
-
for(NSNumber* item in input.dataGroups)
|
|
687
|
-
if(item != nil)
|
|
688
|
-
[array addObject:item];
|
|
689
|
-
result[@"dataGroups"] = array;
|
|
690
|
-
}
|
|
691
|
-
if(input.dataFields != nil){
|
|
692
|
-
NSMutableArray *array = [NSMutableArray new];
|
|
693
|
-
for(RGLDataField* item in input.dataFields)
|
|
694
|
-
if(item != nil)
|
|
695
|
-
[array addObject:[self generateRGLDataField:item]];
|
|
696
|
-
result[@"dataFields"] = array;
|
|
697
|
-
}
|
|
698
|
-
|
|
1033
|
+
result[@"type"] = @(input.type);
|
|
1034
|
+
|
|
699
1035
|
return result;
|
|
700
1036
|
}
|
|
701
1037
|
|
|
702
|
-
+(
|
|
703
|
-
NSMutableDictionary
|
|
704
|
-
|
|
1038
|
+
+(NSDictionary*)fileDataDictionaryFromJson:(NSDictionary*)input {
|
|
1039
|
+
NSMutableDictionary* json = [NSMutableDictionary new];
|
|
1040
|
+
|
|
1041
|
+
json[@"Data"] = [input valueForKey:@"data"];
|
|
1042
|
+
json[@"Length"] = [input valueForKey:@"length"];
|
|
1043
|
+
json[@"Status"] = [input valueForKey:@"status"];
|
|
1044
|
+
json[@"Type"] = [input valueForKey:@"type"];
|
|
1045
|
+
|
|
1046
|
+
return json;
|
|
1047
|
+
}
|
|
705
1048
|
|
|
706
|
-
|
|
707
|
-
|
|
1049
|
+
+(RGLFileData*)fileDataFromJson:(NSDictionary*)input {
|
|
1050
|
+
return [RGLFileData initWithJSON:[self fileDataDictionaryFromJson:input]];
|
|
1051
|
+
}
|
|
708
1052
|
|
|
1053
|
+
+(NSDictionary*)generateFileData:(RGLFileData*)input {
|
|
1054
|
+
if(input == nil) return nil;
|
|
1055
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
1056
|
+
|
|
1057
|
+
result[@"data"] = input.data;
|
|
1058
|
+
result[@"length"] = @(input.length);
|
|
1059
|
+
result[@"status"] = @(input.status);
|
|
1060
|
+
result[@"type"] = @(input.type);
|
|
1061
|
+
|
|
709
1062
|
return result;
|
|
710
1063
|
}
|
|
711
1064
|
|
|
712
|
-
+(
|
|
713
|
-
NSMutableDictionary
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
result[@"baudrate1"] = input.baudrate1;
|
|
720
|
-
result[@"baudrate2"] = input.baudrate2;
|
|
721
|
-
result[@"bitRateR"] = @(input.bitRateR);
|
|
722
|
-
result[@"bitRateS"] = @(input.bitRateS);
|
|
723
|
-
result[@"chipTypeA"] = @(input.chipTypeA);
|
|
724
|
-
result[@"mifareMemory"] = @(input.mifareMemory);
|
|
725
|
-
result[@"rfidType"] = @(input.rfidType);
|
|
726
|
-
result[@"sAK"] = @(input.sAK);
|
|
727
|
-
result[@"support4"] = @(input.support4);
|
|
728
|
-
result[@"supportMifare"] = @(input.supportMifare);
|
|
729
|
-
result[@"uID"] = input.uID;
|
|
730
|
-
|
|
731
|
-
return result;
|
|
1065
|
+
+(NSDictionary*)certificateDataDictionaryFromJson:(NSDictionary*)input {
|
|
1066
|
+
NSMutableDictionary* json = [NSMutableDictionary new];
|
|
1067
|
+
|
|
1068
|
+
json[@"Data"] = [input valueForKey:@"data"];
|
|
1069
|
+
json[@"Length"] = [input valueForKey:@"length"];
|
|
1070
|
+
|
|
1071
|
+
return json;
|
|
732
1072
|
}
|
|
733
1073
|
|
|
734
|
-
+(
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
result[@"AA"] = @(input.AA);
|
|
739
|
-
result[@"BAC"] = @(input.BAC);
|
|
740
|
-
result[@"CA"] = @(input.CA);
|
|
741
|
-
result[@"PA"] = @(input.PA);
|
|
742
|
-
result[@"PACE"] = @(input.PACE);
|
|
743
|
-
result[@"TA"] = @(input.TA);
|
|
744
|
-
result[@"overallStatus"] = @(input.overallStatus);
|
|
1074
|
+
+(RGLCertificateData*)certificateDataFromJson:(NSDictionary*)input {
|
|
1075
|
+
return [RGLCertificateData initWithJSON:[self certificateDataDictionaryFromJson:input]];
|
|
1076
|
+
}
|
|
745
1077
|
|
|
1078
|
+
+(NSDictionary*)generateCertificateData:(RGLCertificateData*)input {
|
|
1079
|
+
if(input == nil) return nil;
|
|
1080
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
1081
|
+
|
|
1082
|
+
result[@"data"] = input.data;
|
|
1083
|
+
result[@"length"] = @(input.length);
|
|
1084
|
+
|
|
746
1085
|
return result;
|
|
747
1086
|
}
|
|
748
1087
|
|
|
749
|
-
+(
|
|
750
|
-
NSMutableDictionary
|
|
751
|
-
|
|
1088
|
+
+(NSDictionary*)securityObjectCertificatesDictionaryFromJson:(NSDictionary*)input {
|
|
1089
|
+
NSMutableDictionary* json = [NSMutableDictionary new];
|
|
1090
|
+
|
|
1091
|
+
json[@"Certificate_Data"] = [self certificateDataDictionaryFromJson: [input valueForKey:@"securityObject"]];
|
|
1092
|
+
|
|
1093
|
+
return json;
|
|
1094
|
+
}
|
|
752
1095
|
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
for(NSNumber* item in input.notifications)
|
|
757
|
-
if(item != nil)
|
|
758
|
-
[array addObject:item];
|
|
759
|
-
result[@"notifications"] = array;
|
|
760
|
-
}
|
|
761
|
-
result[@"status"] = @(input.status);
|
|
762
|
-
result[@"type"] = @(input.type);
|
|
1096
|
+
+(RGLSecurityObjectCertificates*)securityObjectCertificatesFromJson:(NSDictionary*)input {
|
|
1097
|
+
return [RGLSecurityObjectCertificates initWithJSON:[self securityObjectCertificatesDictionaryFromJson:input]];
|
|
1098
|
+
}
|
|
763
1099
|
|
|
1100
|
+
+(NSDictionary*)generateSecurityObjectCertificates:(RGLSecurityObjectCertificates*)input {
|
|
1101
|
+
if(input == nil) return nil;
|
|
1102
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
1103
|
+
|
|
1104
|
+
result[@"securityObject"] = [self generateCertificateData:input.securityObject];
|
|
1105
|
+
|
|
764
1106
|
return result;
|
|
765
1107
|
}
|
|
766
1108
|
|
|
767
|
-
+(
|
|
768
|
-
NSMutableDictionary
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
result[@"version"] = input.version;
|
|
784
|
-
|
|
785
|
-
return result;
|
|
1109
|
+
+(NSDictionary*)fileDictionaryFromJson:(NSDictionary*)input {
|
|
1110
|
+
NSMutableDictionary* json = [NSMutableDictionary new];
|
|
1111
|
+
|
|
1112
|
+
json[@"FileData"] = [self fileDataDictionaryFromJson: [input valueForKey:@"fileData"]];
|
|
1113
|
+
json[@"SecurityObject_Certificates"] = [self securityObjectCertificatesDictionaryFromJson: [input valueForKey:@"certificates"]];
|
|
1114
|
+
json[@"FileID"] = [input valueForKey:@"fileID"];
|
|
1115
|
+
json[@"PA_Status"] = [input valueForKey:@"pAStatus"];
|
|
1116
|
+
json[@"ReadingStatus"] = [input valueForKey:@"readingStatus"];
|
|
1117
|
+
json[@"ReadingTime"] = [input valueForKey:@"readingTime"];
|
|
1118
|
+
json[@"Type"] = [input valueForKey:@"type"];
|
|
1119
|
+
json[@"DocFields_Originals"] = [input valueForKey:@"docFieldsOriginals"];
|
|
1120
|
+
json[@"DocFields_Graphics"] = [input valueForKey:@"docFieldsGraphics"];
|
|
1121
|
+
json[@"DocFields_Text"] = [input valueForKey:@"docFieldsText"];
|
|
1122
|
+
json[@"Notifications"] = [input valueForKey:@"notifications"];
|
|
1123
|
+
|
|
1124
|
+
return json;
|
|
786
1125
|
}
|
|
787
1126
|
|
|
788
|
-
+(
|
|
789
|
-
|
|
790
|
-
|
|
1127
|
+
+(RGLFile*)fileFromJson:(NSDictionary*)input {
|
|
1128
|
+
return [RGLFile initWithJSON:[self fileDictionaryFromJson:input]];
|
|
1129
|
+
}
|
|
791
1130
|
|
|
792
|
-
|
|
1131
|
+
+(NSDictionary*)generateFile:(RGLFile*)input {
|
|
1132
|
+
if(input == nil) return nil;
|
|
1133
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
1134
|
+
|
|
1135
|
+
result[@"fileData"] = [self generateFileData:input.fileData];
|
|
793
1136
|
result[@"fileID"] = input.fileID;
|
|
794
1137
|
if(input.notifications != nil){
|
|
795
1138
|
NSMutableArray *array = [NSMutableArray new];
|
|
796
1139
|
for(NSNumber* item in input.notifications)
|
|
797
|
-
|
|
798
|
-
[array addObject:item];
|
|
1140
|
+
[array addObject:item];
|
|
799
1141
|
result[@"notifications"] = array;
|
|
800
1142
|
}
|
|
801
1143
|
result[@"pAStatus"] = @(input.pAStatus);
|
|
@@ -806,275 +1148,790 @@
|
|
|
806
1148
|
if(input.docFieldsText != nil){
|
|
807
1149
|
NSMutableArray *array = [NSMutableArray new];
|
|
808
1150
|
for(NSNumber* item in input.docFieldsText)
|
|
809
|
-
|
|
810
|
-
[array addObject:item];
|
|
1151
|
+
[array addObject:item];
|
|
811
1152
|
result[@"docFieldsText"] = array;
|
|
812
1153
|
}
|
|
813
1154
|
if(input.docFieldsGraphics != nil){
|
|
814
1155
|
NSMutableArray *array = [NSMutableArray new];
|
|
815
1156
|
for(NSNumber* item in input.docFieldsGraphics)
|
|
816
|
-
|
|
817
|
-
[array addObject:item];
|
|
1157
|
+
[array addObject:item];
|
|
818
1158
|
result[@"docFieldsGraphics"] = array;
|
|
819
1159
|
}
|
|
820
1160
|
if(input.docFieldsOriginals != nil){
|
|
821
1161
|
NSMutableArray *array = [NSMutableArray new];
|
|
822
1162
|
for(NSNumber* item in input.docFieldsOriginals)
|
|
823
|
-
|
|
824
|
-
[array addObject:item];
|
|
1163
|
+
[array addObject:item];
|
|
825
1164
|
result[@"docFieldsOriginals"] = array;
|
|
826
1165
|
}
|
|
827
|
-
result[@"certificates"] = [self
|
|
1166
|
+
result[@"certificates"] = [self generateSecurityObjectCertificates:input.certificates];
|
|
1167
|
+
|
|
1168
|
+
return result;
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
+(NSDictionary*)applicationDictionaryFromJson:(NSDictionary*)input {
|
|
1172
|
+
NSMutableDictionary* json = [NSMutableDictionary new];
|
|
1173
|
+
|
|
1174
|
+
json[@"ApplicationID"] = [input valueForKey:@"applicationID"];
|
|
1175
|
+
json[@"DataHashAlgorithm"] = [input valueForKey:@"dataHashAlgorithm"];
|
|
1176
|
+
json[@"Type"] = [input valueForKey:@"type"];
|
|
1177
|
+
json[@"Status"] = [input valueForKey:@"status"];
|
|
1178
|
+
json[@"UnicodeVersion"] = [input valueForKey:@"unicodeVersion"];
|
|
1179
|
+
json[@"Version"] = [input valueForKey:@"version"];
|
|
1180
|
+
NSMutableArray<NSDictionary*>* array = [NSMutableArray new];
|
|
1181
|
+
for(NSDictionary* item in [input valueForKey:@"files"]){
|
|
1182
|
+
[array addObject:[self fileDictionaryFromJson:item]];
|
|
1183
|
+
}
|
|
1184
|
+
json[@"Files"] = array;
|
|
1185
|
+
|
|
1186
|
+
return json;
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
+(RGLApplication*)applicationFromJson:(NSDictionary*)input {
|
|
1190
|
+
return [RGLApplication initWithJSON:[self applicationDictionaryFromJson:input]];
|
|
1191
|
+
}
|
|
828
1192
|
|
|
1193
|
+
+(NSDictionary*)generateApplication:(RGLApplication*)input {
|
|
1194
|
+
if(input == nil) return nil;
|
|
1195
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
1196
|
+
|
|
1197
|
+
result[@"applicationID"] = input.applicationID;
|
|
1198
|
+
result[@"dataHashAlgorithm"] = input.dataHashAlgorithm;
|
|
1199
|
+
if(input.files != nil){
|
|
1200
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
1201
|
+
for(RGLFile* item in input.files)
|
|
1202
|
+
[array addObject:[self generateFile:item]];
|
|
1203
|
+
result[@"files"] = array;
|
|
1204
|
+
}
|
|
1205
|
+
result[@"type"] = @(input.type);
|
|
1206
|
+
result[@"status"] = @(input.status);
|
|
1207
|
+
result[@"unicodeVersion"] = input.unicodeVersion;
|
|
1208
|
+
result[@"version"] = input.version;
|
|
1209
|
+
|
|
829
1210
|
return result;
|
|
830
1211
|
}
|
|
831
1212
|
|
|
832
|
-
+(
|
|
833
|
-
NSMutableDictionary
|
|
834
|
-
|
|
1213
|
+
+(NSDictionary*)rfidValueDictionaryFromJson:(NSDictionary*)input {
|
|
1214
|
+
NSMutableDictionary* json = [NSMutableDictionary new];
|
|
1215
|
+
|
|
1216
|
+
json[@"Type"] = [input valueForKey:@"type"];
|
|
1217
|
+
json[@"Data"] = [input valueForKey:@"data"];
|
|
1218
|
+
json[@"Length"] = [input valueForKey:@"length"];
|
|
1219
|
+
json[@"Status"] = [input valueForKey:@"status"];
|
|
1220
|
+
json[@"Format"] = [input valueForKey:@"format"];
|
|
1221
|
+
|
|
1222
|
+
return json;
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
+(RGLRFIDValue*)rfidValueFromJson:(NSDictionary*)input {
|
|
1226
|
+
return [RGLRFIDValue initWithJSON:[self rfidValueDictionaryFromJson:input]];
|
|
1227
|
+
}
|
|
835
1228
|
|
|
1229
|
+
+(NSDictionary*)generateRFIDValue:(RGLRFIDValue*)input {
|
|
1230
|
+
if(input == nil) return nil;
|
|
1231
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
1232
|
+
|
|
836
1233
|
result[@"data"] = input.data;
|
|
837
1234
|
result[@"length"] = @(input.length);
|
|
838
1235
|
result[@"status"] = @(input.status);
|
|
839
1236
|
result[@"type"] = @(input.type);
|
|
1237
|
+
result[@"format"] = input.format;
|
|
1238
|
+
|
|
1239
|
+
return result;
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
+(NSDictionary*)attributeDictionaryFromJson:(NSDictionary*)input {
|
|
1243
|
+
NSMutableDictionary* json = [NSMutableDictionary new];
|
|
1244
|
+
|
|
1245
|
+
json[@"Type"] = [input valueForKey:@"type"];
|
|
1246
|
+
json[@"Value"] = [self rfidValueDictionaryFromJson: [input valueForKey:@"value"]];
|
|
1247
|
+
|
|
1248
|
+
return json;
|
|
1249
|
+
}
|
|
840
1250
|
|
|
1251
|
+
+(RGLAttribute*)attributeFromJson:(NSDictionary*)input {
|
|
1252
|
+
return [RGLAttribute initWithJSON:[self attributeDictionaryFromJson:input]];
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
+(NSDictionary*)generateAttribute:(RGLAttribute*)input {
|
|
1256
|
+
if(input == nil) return nil;
|
|
1257
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
1258
|
+
|
|
1259
|
+
result[@"type"] = input.type;
|
|
1260
|
+
result[@"value"] = [self generateRFIDValue:input.value];
|
|
1261
|
+
|
|
841
1262
|
return result;
|
|
842
1263
|
}
|
|
843
1264
|
|
|
844
|
-
+(
|
|
845
|
-
NSMutableDictionary
|
|
846
|
-
|
|
1265
|
+
+(NSDictionary*)authorityDictionaryFromJson:(NSDictionary*)input {
|
|
1266
|
+
NSMutableDictionary* json = [NSMutableDictionary new];
|
|
1267
|
+
|
|
1268
|
+
json[@"Data"] = [input valueForKey:@"data"];
|
|
1269
|
+
json[@"FriendlyName"] = [self rfidValueDictionaryFromJson: [input valueForKey:@"friendlyName"]];
|
|
1270
|
+
NSMutableArray<NSDictionary*>* array = [NSMutableArray new];
|
|
1271
|
+
for(NSDictionary* item in [input valueForKey:@"attributes"]){
|
|
1272
|
+
[array addObject:[self attributeDictionaryFromJson:item]];
|
|
1273
|
+
}
|
|
1274
|
+
json[@"Attributes"] = array;
|
|
1275
|
+
|
|
1276
|
+
return json;
|
|
1277
|
+
}
|
|
847
1278
|
|
|
848
|
-
|
|
1279
|
+
+(RGLAuthority*)authorityFromJson:(NSDictionary*)input {
|
|
1280
|
+
return [RGLAuthority initWithJSON:[self authorityDictionaryFromJson:input]];
|
|
1281
|
+
}
|
|
849
1282
|
|
|
1283
|
+
+(NSDictionary*)generateAuthority:(RGLAuthority*)input {
|
|
1284
|
+
if(input == nil) return nil;
|
|
1285
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
1286
|
+
|
|
1287
|
+
if(input.attributes != nil){
|
|
1288
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
1289
|
+
for(RGLAttribute* item in input.attributes)
|
|
1290
|
+
[array addObject:[self generateAttribute:item]];
|
|
1291
|
+
result[@"attributes"] = array;
|
|
1292
|
+
}
|
|
1293
|
+
result[@"data"] = input.data;
|
|
1294
|
+
result[@"friendlyName"] = [self generateRFIDValue:input.friendlyName];
|
|
1295
|
+
|
|
850
1296
|
return result;
|
|
851
1297
|
}
|
|
852
1298
|
|
|
853
|
-
+(
|
|
854
|
-
NSMutableDictionary
|
|
855
|
-
|
|
1299
|
+
+(NSDictionary*)extensionDictionaryFromJson:(NSDictionary*)input {
|
|
1300
|
+
NSMutableDictionary* json = [NSMutableDictionary new];
|
|
1301
|
+
|
|
1302
|
+
json[@"Data"] = [input valueForKey:@"data"];
|
|
1303
|
+
json[@"Type"] = [input valueForKey:@"type"];
|
|
1304
|
+
|
|
1305
|
+
return json;
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
+(RGLExtension*)extensionFromJson:(NSDictionary*)input {
|
|
1309
|
+
return [RGLExtension initWithJSON:[self extensionDictionaryFromJson:input]];
|
|
1310
|
+
}
|
|
856
1311
|
|
|
1312
|
+
+(NSDictionary*)generateExtension:(RGLExtension*)input {
|
|
1313
|
+
if(input == nil) return nil;
|
|
1314
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
1315
|
+
|
|
857
1316
|
result[@"data"] = input.data;
|
|
858
|
-
result[@"
|
|
1317
|
+
result[@"type"] = input.type;
|
|
1318
|
+
|
|
1319
|
+
return result;
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
+(NSDictionary*)validityDictionaryFromJson:(NSDictionary*)input {
|
|
1323
|
+
NSMutableDictionary* json = [NSMutableDictionary new];
|
|
1324
|
+
|
|
1325
|
+
json[@"NotAfter"] = [self rfidValueDictionaryFromJson: [input valueForKey:@"notAfter"]];
|
|
1326
|
+
json[@"NotBefore"] = [self rfidValueDictionaryFromJson: [input valueForKey:@"notBefore"]];
|
|
1327
|
+
|
|
1328
|
+
return json;
|
|
1329
|
+
}
|
|
859
1330
|
|
|
1331
|
+
+(RGLValidity*)validityFromJson:(NSDictionary*)input {
|
|
1332
|
+
return [RGLValidity initWithJSON:[self validityDictionaryFromJson:input]];
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
+(NSDictionary*)generateValidity:(RGLValidity*)input {
|
|
1336
|
+
if(input == nil) return nil;
|
|
1337
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
1338
|
+
|
|
1339
|
+
result[@"notAfter"] = [self generateRFIDValue:input.notAfter];
|
|
1340
|
+
result[@"notBefore"] = [self generateRFIDValue:input.notBefore];
|
|
1341
|
+
|
|
860
1342
|
return result;
|
|
861
1343
|
}
|
|
862
1344
|
|
|
863
|
-
+(
|
|
864
|
-
NSMutableDictionary
|
|
865
|
-
|
|
1345
|
+
+(NSDictionary*)certificateChainDictionaryFromJson:(NSDictionary*)input {
|
|
1346
|
+
NSMutableDictionary* json = [NSMutableDictionary new];
|
|
1347
|
+
|
|
1348
|
+
json[@"Version"] = [input valueForKey:@"version"];
|
|
1349
|
+
json[@"Type"] = [input valueForKey:@"type"];
|
|
1350
|
+
json[@"SubjectPKAlgorithm"] = [input valueForKey:@"subjectPKAlgorithm"];
|
|
1351
|
+
json[@"SignatureAlgorithm"] = [input valueForKey:@"signatureAlgorithm"];
|
|
1352
|
+
json[@"SerialNumber"] = [input valueForKey:@"serialNumber"];
|
|
1353
|
+
json[@"PA_Status"] = [input valueForKey:@"paStatus"];
|
|
1354
|
+
json[@"Origin"] = [input valueForKey:@"origin"];
|
|
1355
|
+
json[@"Notifications"] = [input valueForKey:@"notifications"];
|
|
1356
|
+
json[@"Validity"] = [self validityDictionaryFromJson: [input valueForKey:@"validity"]];
|
|
1357
|
+
json[@"Subject"] = [self authorityDictionaryFromJson: [input valueForKey:@"subject"]];
|
|
1358
|
+
json[@"Issuer"] = [self authorityDictionaryFromJson: [input valueForKey:@"issuer"]];
|
|
1359
|
+
json[@"FileName"] = [self rfidValueDictionaryFromJson: [input valueForKey:@"fileName"]];
|
|
1360
|
+
NSMutableArray<NSDictionary*>* array = [NSMutableArray new];
|
|
1361
|
+
for(NSDictionary* item in [input valueForKey:@"extensions"]){
|
|
1362
|
+
[array addObject:[self extensionDictionaryFromJson:item]];
|
|
1363
|
+
}
|
|
1364
|
+
json[@"Extensions"] = array;
|
|
1365
|
+
|
|
1366
|
+
return json;
|
|
1367
|
+
}
|
|
866
1368
|
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
1369
|
+
+(RGLCertificateChain*)certificateChainFromJson:(NSDictionary*)input {
|
|
1370
|
+
return [RGLCertificateChain initWithJSON:[self certificateChainDictionaryFromJson:input]];
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
+(NSDictionary*)generateCertificateChain:(RGLCertificateChain*)input {
|
|
1374
|
+
if(input == nil) return nil;
|
|
1375
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
1376
|
+
|
|
1377
|
+
if(input.extensions != nil){
|
|
871
1378
|
NSMutableArray *array = [NSMutableArray new];
|
|
872
|
-
for(
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
result[@"signerInfos"] = array;
|
|
1379
|
+
for(RGLExtension* item in input.extensions)
|
|
1380
|
+
[array addObject:[self generateExtension:item]];
|
|
1381
|
+
result[@"extensions"] = array;
|
|
876
1382
|
}
|
|
1383
|
+
result[@"fileName"] = [self generateRFIDValue:input.fileName];
|
|
1384
|
+
result[@"issuer"] = [self generateAuthority:input.issuer];
|
|
877
1385
|
if(input.notifications != nil){
|
|
878
1386
|
NSMutableArray *array = [NSMutableArray new];
|
|
879
1387
|
for(NSNumber* item in input.notifications)
|
|
880
|
-
|
|
881
|
-
[array addObject:item];
|
|
1388
|
+
[array addObject:item];
|
|
882
1389
|
result[@"notifications"] = array;
|
|
883
1390
|
}
|
|
884
|
-
|
|
1391
|
+
result[@"origin"] = @(input.origin);
|
|
1392
|
+
result[@"paStatus"] = @(input.paStatus);
|
|
1393
|
+
result[@"serialNumber"] = input.serialNumber;
|
|
1394
|
+
result[@"signatureAlgorithm"] = input.signatureAlgorithm;
|
|
1395
|
+
result[@"subject"] = [self generateAuthority:input.subject];
|
|
1396
|
+
result[@"subjectPKAlgorithm"] = input.subjectPKAlgorithm;
|
|
1397
|
+
result[@"type"] = @(input.type);
|
|
1398
|
+
result[@"validity"] = [self generateValidity:input.validity];
|
|
1399
|
+
result[@"version"] = @(input.version);
|
|
1400
|
+
|
|
885
1401
|
return result;
|
|
886
1402
|
}
|
|
887
1403
|
|
|
888
|
-
+(
|
|
889
|
-
NSMutableDictionary
|
|
890
|
-
|
|
1404
|
+
+(NSDictionary*)signerInfoDictionaryFromJson:(NSDictionary*)input {
|
|
1405
|
+
NSMutableDictionary* json = [NSMutableDictionary new];
|
|
1406
|
+
|
|
1407
|
+
json[@"DataToHash"] = [input valueForKey:@"dataToHash"];
|
|
1408
|
+
json[@"DigestAlgorithm"] = [input valueForKey:@"digestAlgorithm"];
|
|
1409
|
+
json[@"PA_Status"] = [input valueForKey:@"paStatus"];
|
|
1410
|
+
json[@"SignatureAlgorithm"] = [input valueForKey:@"signatureAlgorithm"];
|
|
1411
|
+
json[@"Version"] = [input valueForKey:@"version"];
|
|
1412
|
+
json[@"Notifications"] = [input valueForKey:@"notifications"];
|
|
1413
|
+
json[@"Issuer"] = [self authorityDictionaryFromJson: [input valueForKey:@"issuer"]];
|
|
1414
|
+
json[@"SerialNumber"] = [self rfidValueDictionaryFromJson: [input valueForKey:@"serialNumber"]];
|
|
1415
|
+
json[@"Signature"] = [self rfidValueDictionaryFromJson: [input valueForKey:@"signature"]];
|
|
1416
|
+
json[@"SubjectKeyIdentifier"] = [self rfidValueDictionaryFromJson: [input valueForKey:@"subjectKeyIdentifier"]];
|
|
1417
|
+
NSMutableArray<NSDictionary*>* array = [NSMutableArray new];
|
|
1418
|
+
for(NSDictionary* item in [input valueForKey:@"certificateChain"]){
|
|
1419
|
+
[array addObject:[self certificateChainDictionaryFromJson:item]];
|
|
1420
|
+
}
|
|
1421
|
+
json[@"CertificateChain"] = array;
|
|
1422
|
+
NSMutableArray<NSDictionary*>* array2 = [NSMutableArray new];
|
|
1423
|
+
for(NSDictionary* item in [input valueForKey:@"signedAttributes"]){
|
|
1424
|
+
[array2 addObject:[self extensionDictionaryFromJson:item]];
|
|
1425
|
+
}
|
|
1426
|
+
json[@"SignedAttributes"] = array2;
|
|
1427
|
+
|
|
1428
|
+
return json;
|
|
1429
|
+
}
|
|
891
1430
|
|
|
1431
|
+
+(RGLSignerInfo*)signerInfoFromJson:(NSDictionary*)input {
|
|
1432
|
+
return [RGLSignerInfo initWithJSON:[self signerInfoDictionaryFromJson:input]];
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
+(NSDictionary*)generateSignerInfo:(RGLSignerInfo*)input {
|
|
1436
|
+
if(input == nil) return nil;
|
|
1437
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
1438
|
+
|
|
892
1439
|
result[@"dataToHash"] = input.dataToHash;
|
|
893
1440
|
result[@"digestAlgorithm"] = input.digestAlgorithm;
|
|
894
1441
|
result[@"paStatus"] = @(input.paStatus);
|
|
895
1442
|
result[@"signatureAlgorithm"] = input.signatureAlgorithm;
|
|
896
1443
|
result[@"version"] = @(input.version);
|
|
897
|
-
result[@"issuer"] = [self
|
|
898
|
-
result[@"serialNumber"] = [self
|
|
899
|
-
result[@"signature"] = [self
|
|
1444
|
+
result[@"issuer"] = [self generateAuthority:input.issuer];
|
|
1445
|
+
result[@"serialNumber"] = [self generateRFIDValue:input.serialNumber];
|
|
1446
|
+
result[@"signature"] = [self generateRFIDValue:input.signature];
|
|
900
1447
|
if(input.signedAttributes != nil){
|
|
901
1448
|
NSMutableArray *array = [NSMutableArray new];
|
|
902
1449
|
for(RGLExtension* item in input.signedAttributes)
|
|
903
|
-
|
|
904
|
-
[array addObject:[self generateRGLExtension:item]];
|
|
1450
|
+
[array addObject:[self generateExtension:item]];
|
|
905
1451
|
result[@"signedAttributes"] = array;
|
|
906
1452
|
}
|
|
907
|
-
result[@"subjectKeyIdentifier"] = [self
|
|
1453
|
+
result[@"subjectKeyIdentifier"] = [self generateRFIDValue:input.subjectKeyIdentifier];
|
|
908
1454
|
if(input.certificateChain != nil){
|
|
909
1455
|
NSMutableArray *array = [NSMutableArray new];
|
|
910
1456
|
for(RGLCertificateChain* item in input.certificateChain)
|
|
911
|
-
|
|
912
|
-
[array addObject:[self generateRGLCertificateChain:item]];
|
|
1457
|
+
[array addObject:[self generateCertificateChain:item]];
|
|
913
1458
|
result[@"certificateChain"] = array;
|
|
914
1459
|
}
|
|
915
1460
|
if(input.notifications != nil){
|
|
916
1461
|
NSMutableArray *array = [NSMutableArray new];
|
|
917
1462
|
for(NSNumber* item in input.notifications)
|
|
918
|
-
|
|
919
|
-
[array addObject:item];
|
|
1463
|
+
[array addObject:item];
|
|
920
1464
|
result[@"notifications"] = array;
|
|
921
1465
|
}
|
|
1466
|
+
|
|
1467
|
+
return result;
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
+(NSDictionary*)securityObjectDictionaryFromJson:(NSDictionary*)input {
|
|
1471
|
+
NSMutableDictionary* json = [NSMutableDictionary new];
|
|
1472
|
+
|
|
1473
|
+
json[@"FileReference"] = [input valueForKey:@"fileReference"];
|
|
1474
|
+
json[@"ObjectType"] = [input valueForKey:@"objectType"];
|
|
1475
|
+
json[@"Version"] = [input valueForKey:@"version"];
|
|
1476
|
+
json[@"Notifications"] = [input valueForKey:@"notifications"];
|
|
1477
|
+
NSMutableArray<NSDictionary*>* array = [NSMutableArray new];
|
|
1478
|
+
for(NSDictionary* item in [input valueForKey:@"signerInfos"]){
|
|
1479
|
+
[array addObject:[self signerInfoDictionaryFromJson:item]];
|
|
1480
|
+
}
|
|
1481
|
+
json[@"SignerInfos"] = array;
|
|
1482
|
+
|
|
1483
|
+
return json;
|
|
1484
|
+
}
|
|
922
1485
|
|
|
1486
|
+
+(RGLSecurityObject*)securityObjectFromJson:(NSDictionary*)input {
|
|
1487
|
+
return [RGLSecurityObject initWithJSON:[self securityObjectDictionaryFromJson:input]];
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
+(NSDictionary*)generateSecurityObject:(RGLSecurityObject*)input {
|
|
1491
|
+
if(input == nil) return nil;
|
|
1492
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
1493
|
+
|
|
1494
|
+
result[@"fileReference"] = @(input.fileReference);
|
|
1495
|
+
result[@"objectType"] = input.objectType;
|
|
1496
|
+
result[@"version"] = @(input.version);
|
|
1497
|
+
if(input.signerInfos != nil){
|
|
1498
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
1499
|
+
for(RGLSignerInfo* item in input.signerInfos)
|
|
1500
|
+
[array addObject:[self generateSignerInfo:item]];
|
|
1501
|
+
result[@"signerInfos"] = array;
|
|
1502
|
+
}
|
|
1503
|
+
if(input.notifications != nil){
|
|
1504
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
1505
|
+
for(NSNumber* item in input.notifications)
|
|
1506
|
+
[array addObject:item];
|
|
1507
|
+
result[@"notifications"] = array;
|
|
1508
|
+
}
|
|
1509
|
+
|
|
923
1510
|
return result;
|
|
924
1511
|
}
|
|
925
1512
|
|
|
926
|
-
+(
|
|
927
|
-
NSMutableDictionary
|
|
928
|
-
|
|
1513
|
+
+(NSDictionary*)cardPropertiesDictionaryFromJson:(NSDictionary*)input {
|
|
1514
|
+
NSMutableDictionary* json = [NSMutableDictionary new];
|
|
1515
|
+
|
|
1516
|
+
json[@"ATQ_A"] = [input valueForKey:@"aTQA"];
|
|
1517
|
+
json[@"ATQ_B"] = [input valueForKey:@"aTQB"];
|
|
1518
|
+
json[@"ATR"] = [input valueForKey:@"aTR"];
|
|
1519
|
+
json[@"Baudrate1"] = [input valueForKey:@"baudrate1"];
|
|
1520
|
+
json[@"Baudrate2"] = [input valueForKey:@"baudrate2"];
|
|
1521
|
+
json[@"BitRateR"] = [input valueForKey:@"bitRateR"];
|
|
1522
|
+
json[@"BitRateS"] = [input valueForKey:@"bitRateS"];
|
|
1523
|
+
json[@"ChipType_A"] = [input valueForKey:@"chipTypeA"];
|
|
1524
|
+
json[@"MifareMemory"] = [input valueForKey:@"mifareMemory"];
|
|
1525
|
+
json[@"RFID_Type"] = [input valueForKey:@"rfidType"];
|
|
1526
|
+
json[@"SAK"] = [input valueForKey:@"sAK"];
|
|
1527
|
+
json[@"Support_4"] = [input valueForKey:@"support4"];
|
|
1528
|
+
json[@"Support_Mifare"] = [input valueForKey:@"supportMifare"];
|
|
1529
|
+
json[@"UID"] = [input valueForKey:@"uID"];
|
|
1530
|
+
|
|
1531
|
+
return json;
|
|
1532
|
+
}
|
|
1533
|
+
|
|
1534
|
+
+(RGLCardProperties*)cardPropertiesFromJson:(NSDictionary*)input {
|
|
1535
|
+
return [RGLCardProperties initWithJSON:[self cardPropertiesDictionaryFromJson:input]];
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
+(NSDictionary*)generateCardProperties:(RGLCardProperties*)input {
|
|
1539
|
+
if(input == nil) return nil;
|
|
1540
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
1541
|
+
|
|
1542
|
+
result[@"aTQA"] = @(input.aTQA);
|
|
1543
|
+
result[@"aTQB"] = input.aTQB;
|
|
1544
|
+
result[@"aTR"] = input.aTR;
|
|
1545
|
+
result[@"baudrate1"] = input.baudrate1;
|
|
1546
|
+
result[@"baudrate2"] = input.baudrate2;
|
|
1547
|
+
result[@"bitRateR"] = @(input.bitRateR);
|
|
1548
|
+
result[@"bitRateS"] = @(input.bitRateS);
|
|
1549
|
+
result[@"chipTypeA"] = @(input.chipTypeA);
|
|
1550
|
+
result[@"mifareMemory"] = @(input.mifareMemory);
|
|
1551
|
+
result[@"rfidType"] = @(input.rfidType);
|
|
1552
|
+
result[@"sAK"] = @(input.sAK);
|
|
1553
|
+
result[@"support4"] = @(input.support4);
|
|
1554
|
+
result[@"supportMifare"] = @(input.supportMifare);
|
|
1555
|
+
result[@"uID"] = input.uID;
|
|
1556
|
+
|
|
1557
|
+
return result;
|
|
1558
|
+
}
|
|
929
1559
|
|
|
930
|
-
|
|
1560
|
+
+(NSDictionary*)rfidSessionDataDictionaryFromJson:(NSDictionary*)input {
|
|
1561
|
+
NSMutableDictionary* json = [NSMutableDictionary new];
|
|
1562
|
+
|
|
1563
|
+
json[@"ExtLeSupport"] = [input valueForKey:@"extLeSupport"];
|
|
1564
|
+
json[@"ProcessTime"] = [input valueForKey:@"processTime"];
|
|
1565
|
+
json[@"Status"] = [input valueForKey:@"status"];
|
|
1566
|
+
json[@"TotalBytesReceived"] = [input valueForKey:@"totalBytesReceived"];
|
|
1567
|
+
json[@"TotalBytesSent"] = [input valueForKey:@"totalBytesSent"];
|
|
1568
|
+
json[@"DataGroups"] = [input valueForKey:@"dataGroups"];
|
|
1569
|
+
json[@"CardProperties"] = [self cardPropertiesDictionaryFromJson: [input valueForKey:@"cardProperties"]];
|
|
1570
|
+
NSMutableArray<NSDictionary*>* array = [NSMutableArray new];
|
|
1571
|
+
for(NSDictionary* item in [input valueForKey:@"accessControls"]){
|
|
1572
|
+
[array addObject:[self accessControlProcedureTypeDictionaryFromJson:item]];
|
|
1573
|
+
}
|
|
1574
|
+
json[@"AccessControls"] = array;
|
|
1575
|
+
NSMutableArray<NSDictionary*>* array2 = [NSMutableArray new];
|
|
1576
|
+
for(NSDictionary* item in [input valueForKey:@"applications"]){
|
|
1577
|
+
[array2 addObject:[self applicationDictionaryFromJson:item]];
|
|
1578
|
+
}
|
|
1579
|
+
json[@"Applications"] = array2;
|
|
1580
|
+
NSMutableArray<NSDictionary*>* array3 = [NSMutableArray new];
|
|
1581
|
+
for(NSDictionary* item in [input valueForKey:@"securityObjects"]){
|
|
1582
|
+
[array3 addObject:[self securityObjectDictionaryFromJson:item]];
|
|
1583
|
+
}
|
|
1584
|
+
json[@"SecurityObjects"] = array3;
|
|
1585
|
+
|
|
1586
|
+
return json;
|
|
1587
|
+
}
|
|
1588
|
+
|
|
1589
|
+
+(RGLRFIDSessionData*)rfidSessionDataFromJson:(NSDictionary*)input {
|
|
1590
|
+
NSMutableArray<RGLDataField*>* array = [NSMutableArray new];
|
|
1591
|
+
for(NSDictionary* item in [input valueForKey:@"dataFields"]){
|
|
1592
|
+
[array addObject:[self dataFieldFromJson:item]];
|
|
1593
|
+
}
|
|
1594
|
+
return [RGLRFIDSessionData
|
|
1595
|
+
initWithJSON:[self rfidSessionDataDictionaryFromJson:input]
|
|
1596
|
+
dataFields:array];
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
+(NSDictionary*)generateRFIDSessionData:(RGLRFIDSessionData*)input {
|
|
1600
|
+
if(input == nil) return nil;
|
|
1601
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
1602
|
+
|
|
1603
|
+
if(input.accessControls != nil){
|
|
931
1604
|
NSMutableArray *array = [NSMutableArray new];
|
|
932
|
-
for(
|
|
1605
|
+
for(RGLAccessControlProcedureType* item in input.accessControls)
|
|
1606
|
+
[array addObject:[self generateAccessControlProcedureType:item]];
|
|
1607
|
+
result[@"accessControls"] = array;
|
|
1608
|
+
}
|
|
1609
|
+
if(input.applications != nil){
|
|
1610
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
1611
|
+
for(RGLApplication* item in input.applications)
|
|
1612
|
+
[array addObject:[self generateApplication:item]];
|
|
1613
|
+
result[@"applications"] = array;
|
|
1614
|
+
}
|
|
1615
|
+
if(input.securityObjects != nil){
|
|
1616
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
1617
|
+
for(RGLSecurityObject* item in input.securityObjects)
|
|
1618
|
+
[array addObject:[self generateSecurityObject:item]];
|
|
1619
|
+
result[@"securityObjects"] = array;
|
|
1620
|
+
}
|
|
1621
|
+
result[@"cardProperties"] = [self generateCardProperties:input.cardProperties];
|
|
1622
|
+
result[@"totalBytesReceived"] = @(input.totalBytesReceived);
|
|
1623
|
+
result[@"totalBytesSent"] = @(input.totalBytesSent);
|
|
1624
|
+
result[@"status"] = @(input.status);
|
|
1625
|
+
result[@"extLeSupport"] = @(input.extLeSupport);
|
|
1626
|
+
result[@"processTime"] = @(input.processTime);
|
|
1627
|
+
if(input.dataGroups != nil){
|
|
1628
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
1629
|
+
for(NSNumber* item in input.dataGroups)
|
|
933
1630
|
if(item != nil)
|
|
934
|
-
[array addObject:
|
|
935
|
-
result[@"
|
|
1631
|
+
[array addObject:item];
|
|
1632
|
+
result[@"dataGroups"] = array;
|
|
936
1633
|
}
|
|
937
|
-
|
|
938
|
-
|
|
1634
|
+
if(input.dataFields != nil){
|
|
1635
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
1636
|
+
for(RGLDataField* item in input.dataFields)
|
|
1637
|
+
if(item != nil)
|
|
1638
|
+
[array addObject:[self generateDataField:item]];
|
|
1639
|
+
result[@"dataFields"] = array;
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1642
|
+
return result;
|
|
1643
|
+
}
|
|
939
1644
|
|
|
940
|
-
|
|
1645
|
+
+(NSDictionary*)dataFieldDictionaryFromJson:(NSDictionary*)input {
|
|
1646
|
+
NSMutableDictionary* json = [NSMutableDictionary new];
|
|
1647
|
+
|
|
1648
|
+
json[@"Data"] = [input valueForKey:@"data"];
|
|
1649
|
+
json[@"FieldType"] = [input valueForKey:@"fieldType"];
|
|
1650
|
+
|
|
1651
|
+
return json;
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
+(RGLDataField*)dataFieldFromJson:(NSDictionary*)input {
|
|
1655
|
+
return [RGLDataField initWithJSON:[self dataFieldDictionaryFromJson:input]];
|
|
941
1656
|
}
|
|
942
1657
|
|
|
943
|
-
+(
|
|
1658
|
+
+(NSDictionary*)generateDataField:(RGLDataField*)input {
|
|
944
1659
|
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
945
|
-
if(input == nil) return
|
|
1660
|
+
if(input == nil) return nil;
|
|
946
1661
|
|
|
947
1662
|
result[@"data"] = input.data;
|
|
948
|
-
result[@"
|
|
949
|
-
result[@"status"] = @(input.status);
|
|
950
|
-
result[@"type"] = @(input.type);
|
|
951
|
-
result[@"format"] = input.format;
|
|
1663
|
+
result[@"fieldType"] = @(input.fieldType);
|
|
952
1664
|
|
|
953
1665
|
return result;
|
|
954
1666
|
}
|
|
955
1667
|
|
|
956
|
-
+(
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
1668
|
+
+(RGLAuthenticityCheck*)authenticityCheckFromJson:(NSDictionary*)input {
|
|
1669
|
+
if(input == nil) return nil;
|
|
1670
|
+
NSMutableArray<RGLAuthenticityElement*> *array = [NSMutableArray new];
|
|
1671
|
+
for(NSDictionary* item in [input valueForKey:@"elements"])
|
|
1672
|
+
[array addObject:[self authenticityElementFromJson:item]];
|
|
1673
|
+
return [[RGLAuthenticityCheck alloc]
|
|
1674
|
+
initWithAuthenticity:[[input valueForKey:@"type"] integerValue]
|
|
1675
|
+
elements:array
|
|
1676
|
+
pageIndex:[[input valueForKey:@"pageIndex"] integerValue]];
|
|
1677
|
+
}
|
|
962
1678
|
|
|
1679
|
+
+(NSDictionary*)generateAuthenticityCheck:(RGLAuthenticityCheck*)input {
|
|
1680
|
+
if(input == nil) return nil;
|
|
1681
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
1682
|
+
|
|
1683
|
+
result[@"type"] = @(input.type);
|
|
1684
|
+
result[@"typeName"] = input.typeName;
|
|
1685
|
+
result[@"status"] = @(input.status);
|
|
1686
|
+
if(input.elements != nil){
|
|
1687
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
1688
|
+
for(RGLAuthenticityElement* item in input.elements)
|
|
1689
|
+
[array addObject:[self generateAuthenticityElement:item]];
|
|
1690
|
+
result[@"elements"] = array;
|
|
1691
|
+
}
|
|
1692
|
+
result[@"pageIndex"] = @(input.pageIndex);
|
|
1693
|
+
|
|
963
1694
|
return result;
|
|
964
1695
|
}
|
|
965
1696
|
|
|
966
|
-
+(
|
|
967
|
-
NSMutableDictionary
|
|
968
|
-
|
|
1697
|
+
+(NSDictionary*)pdf417InfoDictionaryFromJson:(NSDictionary*)input {
|
|
1698
|
+
NSMutableDictionary* json = [NSMutableDictionary new];
|
|
1699
|
+
|
|
1700
|
+
json[@"bcErrorLevel"] = [input valueForKey:@"errorLevel"];
|
|
1701
|
+
json[@"bcColumn"] = [input valueForKey:@"columns"];
|
|
1702
|
+
json[@"bcRow"] = [input valueForKey:@"rows"];
|
|
1703
|
+
|
|
1704
|
+
return json;
|
|
1705
|
+
}
|
|
969
1706
|
|
|
970
|
-
|
|
971
|
-
|
|
1707
|
+
+(RGLPDF417Info*)pdf417InfoFromJson:(NSDictionary*)input {
|
|
1708
|
+
return [RGLPDF417Info initWithJSON:[self pdf417InfoDictionaryFromJson:input]];
|
|
1709
|
+
}
|
|
972
1710
|
|
|
1711
|
+
+(NSDictionary*)generatePDF417Info:(RGLPDF417Info*)input {
|
|
1712
|
+
if(input == nil) return nil;
|
|
1713
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
1714
|
+
|
|
1715
|
+
result[@"errorLevel"] = @(input.errorLevel);
|
|
1716
|
+
result[@"columns"] = @(input.columns);
|
|
1717
|
+
result[@"rows"] = @(input.rows);
|
|
1718
|
+
|
|
973
1719
|
return result;
|
|
974
1720
|
}
|
|
975
1721
|
|
|
976
|
-
+(
|
|
977
|
-
|
|
978
|
-
|
|
1722
|
+
+(RGLDocumentReaderBarcodeResult*)documentReaderBarcodeResultFromJson:(NSDictionary*)input {
|
|
1723
|
+
NSMutableArray<RGLDocumentReaderBarcodeField*> *array = [NSMutableArray new];
|
|
1724
|
+
for(NSDictionary* item in [input valueForKey:@"fields"])
|
|
1725
|
+
[array addObject:[self documentReaderBarcodeFieldFromJson:item]];
|
|
1726
|
+
return [[RGLDocumentReaderBarcodeResult alloc]
|
|
1727
|
+
initWithFields:array];
|
|
1728
|
+
}
|
|
979
1729
|
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
result[@"extensions"] = array;
|
|
986
|
-
}
|
|
987
|
-
result[@"fileName"] = [self generateRGLRFIDValue:input.fileName];
|
|
988
|
-
result[@"issuer"] = [self generateRGLAuthority:input.issuer];
|
|
989
|
-
if(input.notifications != nil){
|
|
1730
|
+
+(NSDictionary*)generateDocumentReaderBarcodeResult:(RGLDocumentReaderBarcodeResult*)input {
|
|
1731
|
+
if(input == nil) return nil;
|
|
1732
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
1733
|
+
|
|
1734
|
+
if(input.fields != nil){
|
|
990
1735
|
NSMutableArray *array = [NSMutableArray new];
|
|
991
|
-
for(
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
result[@"notifications"] = array;
|
|
1736
|
+
for(RGLDocumentReaderBarcodeField* item in input.fields)
|
|
1737
|
+
[array addObject:[self generateDocumentReaderBarcodeField:item]];
|
|
1738
|
+
result[@"fields"] = array;
|
|
995
1739
|
}
|
|
996
|
-
|
|
997
|
-
result
|
|
998
|
-
|
|
999
|
-
result[@"signatureAlgorithm"] = input.signatureAlgorithm;
|
|
1000
|
-
result[@"subject"] = [self generateRGLAuthority:input.subject];
|
|
1001
|
-
result[@"subjectPKAlgorithm"] = input.subjectPKAlgorithm;
|
|
1002
|
-
result[@"type"] = @(input.type);
|
|
1003
|
-
result[@"validity"] = [self generateRGLValidity:input.validity];
|
|
1004
|
-
result[@"version"] = @(input.version);
|
|
1740
|
+
|
|
1741
|
+
return result;
|
|
1742
|
+
}
|
|
1005
1743
|
|
|
1744
|
+
+(RGLDocumentReaderBarcodeField*)documentReaderBarcodeFieldFromJson:(NSDictionary*)input {
|
|
1745
|
+
if(input == nil) return nil;
|
|
1746
|
+
NSMutableDictionary* json = [NSMutableDictionary new];
|
|
1747
|
+
|
|
1748
|
+
json[@"bcType_DECODE"] = [input valueForKey:@"barcodeType"];
|
|
1749
|
+
json[@"bcCodeResult"] = [input valueForKey:@"status"];
|
|
1750
|
+
json[@"bcPDF417INFO"] = [self pdf417InfoDictionaryFromJson:[input valueForKey:@"pdf417Info"]];
|
|
1751
|
+
NSMutableArray<NSDictionary*>* array = [NSMutableArray new];
|
|
1752
|
+
NSMutableDictionary* dict = [NSMutableDictionary new];
|
|
1753
|
+
dict[@"mData"] = [input valueForKey:@"data"];
|
|
1754
|
+
[array addObject:dict];
|
|
1755
|
+
json[@"bcDataModule"] = array;
|
|
1756
|
+
json[@"page_idx"] = [input valueForKey:@"pageIndex"];
|
|
1757
|
+
|
|
1758
|
+
return [RGLDocumentReaderBarcodeField initWithJSON:json];
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
+(NSDictionary*)generateDocumentReaderBarcodeField:(RGLDocumentReaderBarcodeField*)input {
|
|
1762
|
+
if(input == nil) return nil;
|
|
1763
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
1764
|
+
|
|
1765
|
+
result[@"barcodeType"] = @(input.barcodeType);
|
|
1766
|
+
result[@"status"] = @(input.status);
|
|
1767
|
+
result[@"pdf417Info"] = [self generatePDF417Info:input.pdf417Info];
|
|
1768
|
+
result[@"data"] = [self base64Encode:input.data];
|
|
1769
|
+
result[@"pageIndex"] = @(input.pageIndex);
|
|
1770
|
+
|
|
1006
1771
|
return result;
|
|
1007
1772
|
}
|
|
1008
1773
|
|
|
1009
|
-
+(
|
|
1010
|
-
|
|
1011
|
-
|
|
1774
|
+
+(RGLDocumentReaderAuthenticityResult*)documentReaderAuthenticityResultFromJson:(NSDictionary*)input {
|
|
1775
|
+
if(input == nil) return nil;
|
|
1776
|
+
NSMutableArray<RGLAuthenticityCheck*> *array = [NSMutableArray new];
|
|
1777
|
+
for(NSDictionary* item in [input valueForKey:@"checks"])
|
|
1778
|
+
[array addObject:[self authenticityCheckFromJson:item]];
|
|
1779
|
+
return [[RGLDocumentReaderAuthenticityResult alloc]
|
|
1780
|
+
initWithAuthenticityChecks:array];
|
|
1781
|
+
}
|
|
1782
|
+
|
|
1783
|
+
+(NSDictionary*)generateDocumentReaderAuthenticityResult:(RGLDocumentReaderAuthenticityResult*)input {
|
|
1784
|
+
if(input == nil) return nil;
|
|
1785
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
1786
|
+
|
|
1787
|
+
result[@"status"] = @(input.status);
|
|
1788
|
+
if(input.checks != nil){
|
|
1789
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
1790
|
+
for(RGLAuthenticityCheck* item in input.checks)
|
|
1791
|
+
[array addObject:[self generateAuthenticityCheck:item]];
|
|
1792
|
+
result[@"checks"] = array;
|
|
1793
|
+
}
|
|
1794
|
+
|
|
1795
|
+
return result;
|
|
1796
|
+
}
|
|
1012
1797
|
|
|
1013
|
-
|
|
1014
|
-
|
|
1798
|
+
+(RGLAuthenticityElement*)authenticityElementFromJson:(NSDictionary*)input {
|
|
1799
|
+
if(input == nil) return nil;
|
|
1800
|
+
return [[RGLAuthenticityElement alloc]
|
|
1801
|
+
initWithStatus:[[input valueForKey:@"status"] integerValue]
|
|
1802
|
+
elementType:[[input valueForKey:@"elementType"] integerValue]
|
|
1803
|
+
elementDiagnose:[[input valueForKey:@"elementDiagnose"] integerValue]];
|
|
1804
|
+
}
|
|
1015
1805
|
|
|
1806
|
+
+(NSDictionary*)generateAuthenticityElement:(RGLAuthenticityElement*)input {
|
|
1807
|
+
if(input == nil) return nil;
|
|
1808
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
1809
|
+
|
|
1810
|
+
result[@"status"] = @(input.status);
|
|
1811
|
+
result[@"elementType"] = @(input.elementType);
|
|
1812
|
+
result[@"elementTypeName"] = input.elementTypeName;
|
|
1813
|
+
result[@"elementDiagnose"] = @(input.elementDiagnose);
|
|
1814
|
+
result[@"elementDiagnoseName"] = input.elementDiagnoseName;
|
|
1815
|
+
|
|
1016
1816
|
return result;
|
|
1017
1817
|
}
|
|
1018
1818
|
|
|
1019
|
-
+(
|
|
1020
|
-
NSMutableDictionary
|
|
1021
|
-
|
|
1819
|
+
+(NSDictionary*)paResourcesIssuerDictionaryFromJson:(NSDictionary*)input {
|
|
1820
|
+
NSMutableDictionary* json = input.mutableCopy;
|
|
1821
|
+
|
|
1822
|
+
json[@"Data"] = @{@"#text": [input valueForKey:@"data"]};
|
|
1823
|
+
json[@"FriendlyName"] = [input valueForKey:@"friendlyName"];
|
|
1824
|
+
NSMutableArray<NSDictionary*> *array = [NSMutableArray new];
|
|
1825
|
+
for(NSDictionary* item in [input valueForKey:@"attributes"])
|
|
1826
|
+
[array addObject:[self paAttributeDictionaryFromJson:item]];
|
|
1827
|
+
json[@"Attributes"] = @{@"RFID_Attribute_Name": array};
|
|
1828
|
+
|
|
1829
|
+
return json;
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
+(RGLPAResourcesIssuer*)paResourcesIssuerFromJson:(NSDictionary*)input {
|
|
1833
|
+
return [RGLPAResourcesIssuer initWithJSON:[self paResourcesIssuerDictionaryFromJson: input]];
|
|
1834
|
+
}
|
|
1022
1835
|
|
|
1023
|
-
|
|
1836
|
+
+(NSDictionary*)generatePAResourcesIssuer:(RGLPAResourcesIssuer*)input {
|
|
1837
|
+
if(input == nil) return nil;
|
|
1838
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
1839
|
+
|
|
1840
|
+
result[@"data"] = [self base64Encode:input.data];
|
|
1024
1841
|
result[@"friendlyName"] = input.friendlyName;
|
|
1025
1842
|
if(input.attributes != nil){
|
|
1026
1843
|
NSMutableArray *array = [NSMutableArray new];
|
|
1027
1844
|
for(RGLPAAttribute* item in input.attributes)
|
|
1028
|
-
|
|
1029
|
-
[array addObject:[self generateRGLPAAttribute:item]];
|
|
1845
|
+
[array addObject:[self generatePAAttribute:item]];
|
|
1030
1846
|
result[@"attributes"] = array;
|
|
1031
1847
|
}
|
|
1032
|
-
|
|
1848
|
+
|
|
1033
1849
|
return result;
|
|
1034
1850
|
}
|
|
1035
1851
|
|
|
1036
|
-
+(
|
|
1037
|
-
NSMutableDictionary
|
|
1038
|
-
|
|
1852
|
+
+(NSDictionary*)paAttributeDictionaryFromJson:(NSDictionary*)input {
|
|
1853
|
+
NSMutableDictionary* json = input.mutableCopy;
|
|
1854
|
+
|
|
1855
|
+
json[@"Value"] = [input valueForKey:@"value"];
|
|
1856
|
+
json[@"Type"] = [input valueForKey:@"type"];
|
|
1857
|
+
|
|
1858
|
+
return json;
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
+(RGLPAAttribute*)paAttributeFromJson:(NSDictionary*)input {
|
|
1862
|
+
return [RGLPAAttribute initWithJSON:[self paAttributeDictionaryFromJson: input]];
|
|
1863
|
+
}
|
|
1039
1864
|
|
|
1865
|
+
+(NSDictionary*)generatePAAttribute:(RGLPAAttribute*)input {
|
|
1866
|
+
if(input == nil) return nil;
|
|
1867
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
1868
|
+
|
|
1040
1869
|
result[@"value"] = input.value;
|
|
1041
1870
|
result[@"type"] = input.type;
|
|
1042
|
-
|
|
1871
|
+
|
|
1043
1872
|
return result;
|
|
1044
1873
|
}
|
|
1045
1874
|
|
|
1046
|
-
+(
|
|
1047
|
-
NSMutableDictionary
|
|
1048
|
-
|
|
1875
|
+
+(RGLTAChallenge*)taChallengeFromJson:(NSDictionary*)input {
|
|
1876
|
+
NSMutableDictionary* json = input.mutableCopy;
|
|
1877
|
+
|
|
1878
|
+
json[@"#text"] = [self base64Decode:[input valueForKey:@"data"]];
|
|
1879
|
+
json[@"@auxPCD"] = [input valueForKey:@"auxPCD"];
|
|
1880
|
+
json[@"@challengePICC"] = [input valueForKey: @"challengePICC"];
|
|
1881
|
+
json[@"@hashPK"] = [input valueForKey:@"hashPK"];
|
|
1882
|
+
json[@"@idPICC"] = [input valueForKey:@"idPICC"];
|
|
1883
|
+
|
|
1884
|
+
return [RGLTAChallenge initWithJSON:json];
|
|
1885
|
+
}
|
|
1049
1886
|
|
|
1050
|
-
|
|
1887
|
+
+(NSDictionary*)generateTAChallenge:(RGLTAChallenge*)input {
|
|
1888
|
+
if(input == nil) return nil;
|
|
1889
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
1890
|
+
|
|
1891
|
+
result[@"data"] = [self base64Encode:input.data];
|
|
1051
1892
|
result[@"auxPCD"] = input.auxPCD;
|
|
1052
1893
|
result[@"challengePICC"] = input.challengePICC;
|
|
1053
1894
|
result[@"hashPK"] = input.hashPK;
|
|
1054
1895
|
result[@"idPICC"] = input.idPICC;
|
|
1055
|
-
|
|
1896
|
+
|
|
1056
1897
|
return result;
|
|
1057
1898
|
}
|
|
1058
1899
|
|
|
1059
|
-
+(
|
|
1060
|
-
NSMutableDictionary
|
|
1061
|
-
|
|
1900
|
+
+(NSDictionary*)documentReaderResultsStatusDictionaryFromJson:(NSDictionary*)input {
|
|
1901
|
+
NSMutableDictionary* json = input.mutableCopy;
|
|
1902
|
+
|
|
1903
|
+
json[@"detailsRFID"] = [self rfidSessionDataStatusDictionaryFromJson: [input valueForKey:@"detailsRFID"] ];
|
|
1904
|
+
|
|
1905
|
+
return json;
|
|
1906
|
+
}
|
|
1062
1907
|
|
|
1908
|
+
+(RGLDocumentReaderResultsStatus*)documentReaderResultsStatusFromJson:(NSDictionary*)input {
|
|
1909
|
+
return [RGLDocumentReaderResultsStatus performSelector:NSSelectorFromString(@"resultsStatusWithJSON:") withObject:[self documentReaderResultsStatusDictionaryFromJson: input]];
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
+(NSDictionary*)generateDocumentReaderResultsStatus:(RGLDocumentReaderResultsStatus*)input {
|
|
1913
|
+
if(input == nil) return nil;
|
|
1914
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
1915
|
+
|
|
1063
1916
|
result[@"overallStatus"] = @(input.overallStatus);
|
|
1064
1917
|
result[@"optical"] = @(input.optical);
|
|
1065
|
-
result[@"detailsOptical"] = [self
|
|
1918
|
+
result[@"detailsOptical"] = [self generateOpticalStatus:input.detailsOptical];
|
|
1066
1919
|
result[@"rfid"] = @(input.rfid);
|
|
1067
|
-
result[@"detailsRFID"] = [self
|
|
1920
|
+
result[@"detailsRFID"] = [self generateRFIDSessionDataStatus:input.detailsRFID];
|
|
1068
1921
|
result[@"portrait"] = @(input.portrait);
|
|
1069
1922
|
result[@"stopList"] = @(input.stopList);
|
|
1070
|
-
|
|
1923
|
+
|
|
1071
1924
|
return result;
|
|
1072
1925
|
}
|
|
1073
1926
|
|
|
1074
|
-
+(
|
|
1075
|
-
|
|
1076
|
-
|
|
1927
|
+
+(RGLOpticalStatus*)opticalStatusFromJson:(NSDictionary*)input {
|
|
1928
|
+
return [RGLOpticalStatus performSelector:NSSelectorFromString(@"opticalStatusWithJSON:") withObject:input];
|
|
1929
|
+
}
|
|
1077
1930
|
|
|
1931
|
+
+(NSDictionary*)generateOpticalStatus:(RGLOpticalStatus*)input {
|
|
1932
|
+
if(input == nil) return nil;
|
|
1933
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
1934
|
+
|
|
1078
1935
|
result[@"overallStatus"] = @(input.overallStatus);
|
|
1079
1936
|
result[@"mrz"] = @(input.mrz);
|
|
1080
1937
|
result[@"text"] = @(input.text);
|
|
@@ -1084,105 +1941,170 @@
|
|
|
1084
1941
|
result[@"expiry"] = @(input.expiry);
|
|
1085
1942
|
result[@"vds"] = @(input.vds);
|
|
1086
1943
|
result[@"pagesCount"] = @(input.pagesCount);
|
|
1944
|
+
|
|
1945
|
+
return result;
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1948
|
+
+(NSDictionary*)rfidSessionDataStatusDictionaryFromJson:(NSDictionary*)input {
|
|
1949
|
+
NSMutableDictionary* json = [NSMutableDictionary new];
|
|
1950
|
+
|
|
1951
|
+
json[@"overallStatus"] = [input valueForKey:@"overallStatus"];
|
|
1952
|
+
json[@"AA"] = [input valueForKey:@"aa"];
|
|
1953
|
+
json[@"BAC"] = [input valueForKey:@"bac"];
|
|
1954
|
+
json[@"CA"] = [input valueForKey:@"ca"];
|
|
1955
|
+
json[@"PA"] = [input valueForKey:@"pa"];
|
|
1956
|
+
json[@"PACE"] = [input valueForKey:@"pace"];
|
|
1957
|
+
json[@"TA"] = [input valueForKey:@"ta"];
|
|
1958
|
+
|
|
1959
|
+
return json;
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
+(RGLRFIDSessionDataStatus*)rfidSessionDataStatusFromJson:(NSDictionary*)input {
|
|
1963
|
+
return [RGLRFIDSessionDataStatus performSelector:NSSelectorFromString(@"rfidStatusWithJSON:") withObject:[self rfidSessionDataStatusDictionaryFromJson: input]];
|
|
1964
|
+
}
|
|
1087
1965
|
|
|
1966
|
+
+(NSDictionary*)generateRFIDSessionDataStatus:(RGLRFIDSessionDataStatus*)input {
|
|
1967
|
+
if(input == nil) return nil;
|
|
1968
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
1969
|
+
|
|
1970
|
+
result[@"aa"] = @(input.AA);
|
|
1971
|
+
result[@"bac"] = @(input.BAC);
|
|
1972
|
+
result[@"ca"] = @(input.CA);
|
|
1973
|
+
result[@"pa"] = @(input.PA);
|
|
1974
|
+
result[@"pace"] = @(input.PACE);
|
|
1975
|
+
result[@"ta"] = @(input.TA);
|
|
1976
|
+
result[@"overallStatus"] = @(input.overallStatus);
|
|
1977
|
+
|
|
1088
1978
|
return result;
|
|
1089
1979
|
}
|
|
1090
1980
|
|
|
1091
|
-
+(
|
|
1092
|
-
NSMutableDictionary
|
|
1093
|
-
|
|
1981
|
+
+(NSDictionary*)vdsncDataDictionaryFromJson:(NSDictionary*)input {
|
|
1982
|
+
NSMutableDictionary* json = [NSMutableDictionary new];
|
|
1983
|
+
|
|
1984
|
+
json[@"Type"] = [input valueForKey:@"type"];
|
|
1985
|
+
json[@"Version"] = [input valueForKey:@"version"];
|
|
1986
|
+
json[@"IssuingCountry"] = [input valueForKey:@"issuingCountry"];
|
|
1987
|
+
json[@"Message"] = [input valueForKey:@"message"];
|
|
1988
|
+
json[@"SignatureAlg"] = [input valueForKey:@"signatureAlgorithm"];
|
|
1989
|
+
json[@"Notifications"] = [input valueForKey:@"notifications"];
|
|
1990
|
+
json[@"Signature"] = [self bytesDataDictionaryFromJson: [input valueForKey:@"signature"]];
|
|
1991
|
+
json[@"Certificate"] = [self bytesDataDictionaryFromJson: [input valueForKey:@"certificate"]];
|
|
1992
|
+
NSMutableArray<NSDictionary*>* array = [NSMutableArray new];
|
|
1993
|
+
for(NSDictionary* item in [input valueForKey:@"certificateChain"]){
|
|
1994
|
+
[array addObject:[self certificateChainDictionaryFromJson:item]];
|
|
1995
|
+
}
|
|
1996
|
+
json[@"CertificateChain"] = array;
|
|
1997
|
+
|
|
1998
|
+
return json;
|
|
1999
|
+
}
|
|
2000
|
+
|
|
2001
|
+
+(RGLVDSNCData*)vdsncDataFromJson:(NSDictionary*)input {
|
|
2002
|
+
return [RGLVDSNCData performSelector:NSSelectorFromString(@"dataWithJSON:") withObject:[self vdsncDataDictionaryFromJson: input]];
|
|
2003
|
+
}
|
|
1094
2004
|
|
|
2005
|
+
+(NSDictionary*)generateVDSNCData:(RGLVDSNCData*)input {
|
|
2006
|
+
if(input == nil) return nil;
|
|
2007
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
2008
|
+
|
|
1095
2009
|
result[@"type"] = input.type;
|
|
1096
2010
|
result[@"version"] = @(input.version);
|
|
1097
2011
|
result[@"issuingCountry"] = input.issuingCountry;
|
|
1098
|
-
result[@"message"] =
|
|
2012
|
+
result[@"message"] = input.message;
|
|
1099
2013
|
result[@"signatureAlgorithm"] = input.signatureAlgorithm;
|
|
1100
|
-
result[@"signature"] = [self
|
|
1101
|
-
result[@"certificate"] = [self
|
|
2014
|
+
result[@"signature"] = [self generateBytesData:input.signature];
|
|
2015
|
+
result[@"certificate"] = [self generateBytesData:input.certificate];
|
|
1102
2016
|
if(input.certificateChain != nil){
|
|
1103
2017
|
NSMutableArray *array = [NSMutableArray new];
|
|
1104
2018
|
for(RGLCertificateChain* item in input.certificateChain)
|
|
1105
|
-
|
|
1106
|
-
[array addObject:[self generateRGLCertificateChain:item]];
|
|
2019
|
+
[array addObject:[self generateCertificateChain:item]];
|
|
1107
2020
|
result[@"certificateChain"] = array;
|
|
1108
2021
|
}
|
|
1109
2022
|
if(input.notifications != nil){
|
|
1110
2023
|
NSMutableArray *array = [NSMutableArray new];
|
|
1111
2024
|
for(NSNumber* item in input.notifications)
|
|
1112
|
-
|
|
1113
|
-
[array addObject:item];
|
|
2025
|
+
[array addObject:item];
|
|
1114
2026
|
result[@"notifications"] = array;
|
|
1115
2027
|
}
|
|
1116
|
-
|
|
2028
|
+
|
|
1117
2029
|
return result;
|
|
1118
2030
|
}
|
|
1119
2031
|
|
|
1120
|
-
+(
|
|
1121
|
-
NSMutableDictionary
|
|
1122
|
-
|
|
2032
|
+
+(NSDictionary*)bytesDataDictionaryFromJson:(NSDictionary*)input {
|
|
2033
|
+
NSMutableDictionary* json = [NSMutableDictionary new];
|
|
2034
|
+
|
|
2035
|
+
json[@"Data"] = [input valueForKey:@"data"];
|
|
2036
|
+
json[@"Length"] = [input valueForKey:@"length"];
|
|
2037
|
+
json[@"Status"] = [input valueForKey:@"status"];
|
|
2038
|
+
json[@"Type"] = [input valueForKey:@"type"];
|
|
2039
|
+
|
|
2040
|
+
return json;
|
|
2041
|
+
}
|
|
2042
|
+
|
|
2043
|
+
+(RGLBytesData*)bytesDataFromJson:(NSDictionary*)input {
|
|
2044
|
+
return [RGLBytesData performSelector:NSSelectorFromString(@"bytesDataWithJSON:") withObject:[self bytesDataDictionaryFromJson: input]];
|
|
2045
|
+
}
|
|
1123
2046
|
|
|
2047
|
+
+(NSDictionary*)generateBytesData:(RGLBytesData*)input {
|
|
2048
|
+
if(input == nil) return nil;
|
|
2049
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
2050
|
+
|
|
1124
2051
|
result[@"data"] = input.data;
|
|
1125
2052
|
result[@"length"] = @(input.length);
|
|
1126
2053
|
result[@"status"] = @(input.status);
|
|
1127
2054
|
result[@"type"] = @(input.type);
|
|
1128
|
-
|
|
2055
|
+
|
|
1129
2056
|
return result;
|
|
1130
2057
|
}
|
|
1131
2058
|
|
|
1132
|
-
+(
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
if(input.
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
result[@"
|
|
1142
|
-
}
|
|
1143
|
-
|
|
1144
|
-
result[@"
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
NSMutableArray *array = [NSMutableArray new];
|
|
1161
|
-
for(NSNumber* item in input.area)
|
|
1162
|
-
if(item != nil)
|
|
1163
|
-
[array addObject:item];
|
|
1164
|
-
result[@"area"] = array;
|
|
1165
|
-
}
|
|
1166
|
-
if(input.colorValues != nil){
|
|
1167
|
-
NSMutableArray *array = [NSMutableArray new];
|
|
1168
|
-
for(NSNumber* item in input.colorValues)
|
|
1169
|
-
if(item != nil)
|
|
1170
|
-
[array addObject:item];
|
|
1171
|
-
result[@"colorValues"] = array;
|
|
1172
|
-
}
|
|
1173
|
-
result[@"status"] = @(input.status);
|
|
1174
|
-
result[@"elementType"] = @(input.elementType);
|
|
1175
|
-
result[@"elementTypeName"] = input.elementTypeName;
|
|
1176
|
-
result[@"elementDiagnose"] = @(input.elementDiagnose);
|
|
1177
|
-
result[@"elementDiagnoseName"] = input.elementDiagnoseName;
|
|
1178
|
-
|
|
1179
|
-
return result;
|
|
2059
|
+
+(NSString*)generateLicense:(RGLLicense*)input {
|
|
2060
|
+
if(input == nil) return nil;
|
|
2061
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
2062
|
+
|
|
2063
|
+
if(input.expiryDate != nil) {
|
|
2064
|
+
NSDateFormatter *formatter = [NSDateFormatter new];
|
|
2065
|
+
[formatter setFormatterBehavior:NSDateFormatterBehaviorDefault];
|
|
2066
|
+
[formatter setDateStyle:NSDateFormatterShortStyle];
|
|
2067
|
+
[formatter setTimeStyle:NSDateFormatterNoStyle];
|
|
2068
|
+
result[@"expiryDate"] = [formatter stringFromDate:input.expiryDate];
|
|
2069
|
+
} else result[@"expiryDate"] = nil;
|
|
2070
|
+
|
|
2071
|
+
result[@"countryFilter"] = input.countryFilter;
|
|
2072
|
+
result[@"isRfidAvailable"] = input.rfidAvailable ? @YES : @NO;
|
|
2073
|
+
|
|
2074
|
+
return [RGLWJSONConstructor dictToString: result];
|
|
2075
|
+
}
|
|
2076
|
+
|
|
2077
|
+
+(NSString*)generateDocReaderVersion:(RGLDocReaderVersion*)input {
|
|
2078
|
+
if(input == nil) return nil;
|
|
2079
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
2080
|
+
|
|
2081
|
+
result[@"api"] = input.api;
|
|
2082
|
+
result[@"core"] = input.core;
|
|
2083
|
+
result[@"coreMode"] = input.coreMode;
|
|
2084
|
+
result[@"database"] = [self generateDocReaderDocumentsDatabase:input.database];
|
|
2085
|
+
|
|
2086
|
+
return [RGLWJSONConstructor dictToString: result];
|
|
1180
2087
|
}
|
|
1181
2088
|
|
|
1182
|
-
+(
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
2089
|
+
+(RGLDocReaderDocumentsDatabase*)docReaderDocumentsDatabaseFromJson:(NSDictionary*)input {
|
|
2090
|
+
if(input == nil) return nil;
|
|
2091
|
+
NSMutableDictionary* json = [NSMutableDictionary new];
|
|
2092
|
+
|
|
2093
|
+
json[@"id"] = [input valueForKey:@"databaseID"];
|
|
2094
|
+
json[@"version"] = [input valueForKey:@"version"];
|
|
2095
|
+
json[@"export_date"] = [input valueForKey:@"date"];
|
|
2096
|
+
json[@"description"] = [input valueForKey:@"databaseDescription"];
|
|
2097
|
+
json[@"countriesNumber"] = [input valueForKey:@"countriesNumber"];
|
|
2098
|
+
json[@"documentsNumber"] = [input valueForKey:@"documentsNumber"];
|
|
2099
|
+
json[@"size"] = [input valueForKey:@"size"];
|
|
2100
|
+
|
|
2101
|
+
return [RGLDocReaderDocumentsDatabase initWithJSON:json];
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
+(NSDictionary*)generateDocReaderDocumentsDatabase:(RGLDocReaderDocumentsDatabase*)input {
|
|
2105
|
+
if(input == nil) return nil;
|
|
2106
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
2107
|
+
|
|
1186
2108
|
result[@"databaseID"] = input.databaseID;
|
|
1187
2109
|
result[@"version"] = input.version;
|
|
1188
2110
|
result[@"date"] = input.date;
|
|
@@ -1190,75 +2112,208 @@
|
|
|
1190
2112
|
result[@"countriesNumber"] = @(input.countriesNumber);
|
|
1191
2113
|
result[@"documentsNumber"] = @(input.documentsNumber);
|
|
1192
2114
|
result[@"size"] = input.size;
|
|
1193
|
-
|
|
2115
|
+
|
|
1194
2116
|
return result;
|
|
1195
2117
|
}
|
|
1196
2118
|
|
|
1197
|
-
+(
|
|
1198
|
-
NSMutableDictionary
|
|
1199
|
-
|
|
2119
|
+
+(NSDictionary*)documentReaderComparisonDictionaryFromJson:(NSDictionary*)input {
|
|
2120
|
+
NSMutableDictionary* json = input.mutableCopy;
|
|
2121
|
+
json[@"sourceLeft"] = @"sourceTypeLeft";
|
|
2122
|
+
json[@"sourceRight"] = @"sourceTypeRight";
|
|
2123
|
+
return json;
|
|
2124
|
+
}
|
|
1200
2125
|
|
|
2126
|
+
+(RGLDocumentReaderComparison*)documentReaderComparisonFromJson:(NSDictionary*)input {
|
|
2127
|
+
return [RGLDocumentReaderComparison initWithJSON:[self documentReaderComparisonDictionaryFromJson: input] sourceList:[self documentReaderComparisonDictionaryFromJson: input]];
|
|
2128
|
+
}
|
|
2129
|
+
|
|
2130
|
+
+(NSDictionary*)generateDocumentReaderComparison:(RGLDocumentReaderComparison*)input {
|
|
2131
|
+
if(input == nil) return nil;
|
|
2132
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
2133
|
+
|
|
1201
2134
|
result[@"sourceTypeLeft"] = @(input.sourceTypeLeft);
|
|
1202
2135
|
result[@"sourceTypeRight"] = @(input.sourceTypeRight);
|
|
1203
2136
|
result[@"status"] = @(input.status);
|
|
1204
|
-
|
|
2137
|
+
|
|
1205
2138
|
return result;
|
|
1206
2139
|
}
|
|
1207
2140
|
|
|
1208
|
-
+(
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
result[@"sourceType"] = @(input.sourceType);
|
|
1213
|
-
result[@"status"] = @(input.status);
|
|
2141
|
+
+(RGLDocumentReaderRfidOrigin*)documentReaderRfidOriginFromJson:(NSDictionary*)input {
|
|
2142
|
+
return [RGLDocumentReaderRfidOrigin initWithJSON:input];
|
|
2143
|
+
}
|
|
1214
2144
|
|
|
2145
|
+
+(NSDictionary*)generateDocumentReaderRfidOrigin:(RGLDocumentReaderRfidOrigin*)input {
|
|
2146
|
+
if(input == nil) return nil;
|
|
2147
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
2148
|
+
|
|
2149
|
+
result[@"dg"] = @(input.dg);
|
|
2150
|
+
result[@"dgTag"] = @(input.dgTag);
|
|
2151
|
+
result[@"entryView"] = @(input.entryView);
|
|
2152
|
+
result[@"tagEntry"] = @(input.tagEntry);
|
|
2153
|
+
|
|
1215
2154
|
return result;
|
|
1216
2155
|
}
|
|
1217
2156
|
|
|
1218
|
-
+(
|
|
1219
|
-
NSMutableDictionary
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
result[@"code"] = @(input.code);
|
|
1223
|
-
result[@"rect"] = [self generateCGRect:input.rect];
|
|
1224
|
-
result[@"probability"] = @(input.probability);
|
|
1225
|
-
|
|
1226
|
-
return result;
|
|
2157
|
+
+(NSDictionary*)documentReaderTextSourceDictionaryFromJson:(NSDictionary*)input {
|
|
2158
|
+
NSMutableDictionary* json = input.mutableCopy;
|
|
2159
|
+
json[@"containerType"] = [input valueForKey:@"sourceType"];
|
|
2160
|
+
return json;
|
|
1227
2161
|
}
|
|
1228
2162
|
|
|
1229
|
-
+(
|
|
1230
|
-
|
|
1231
|
-
|
|
2163
|
+
+(RGLDocumentReaderTextSource*)documentReaderTextSourceFromJson:(NSDictionary*)input {
|
|
2164
|
+
return [RGLDocumentReaderTextSource initWithJSON:[self documentReaderTextSourceDictionaryFromJson: input]];
|
|
2165
|
+
}
|
|
1232
2166
|
|
|
2167
|
+
+(NSDictionary*)generateDocumentReaderTextSource:(RGLDocumentReaderTextSource*)input {
|
|
2168
|
+
if(input == nil) return nil;
|
|
2169
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
2170
|
+
|
|
1233
2171
|
result[@"sourceType"] = @(input.sourceType);
|
|
1234
2172
|
result[@"source"] = input.source;
|
|
1235
2173
|
result[@"validityStatus"] = @(input.validityStatus);
|
|
2174
|
+
|
|
2175
|
+
return result;
|
|
2176
|
+
}
|
|
2177
|
+
|
|
2178
|
+
+(RGLDocumentReaderSymbol*)documentReaderSymbolFromJson:(NSDictionary*)input {
|
|
2179
|
+
return [RGLDocumentReaderSymbol initWithJSON:input];
|
|
2180
|
+
}
|
|
1236
2181
|
|
|
2182
|
+
+(NSDictionary*)generateDocumentReaderSymbol:(RGLDocumentReaderSymbol*)input {
|
|
2183
|
+
if(input == nil) return nil;
|
|
2184
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
2185
|
+
|
|
2186
|
+
result[@"code"] = @(input.code);
|
|
2187
|
+
result[@"rect"] = [self generateRect:input.rect];
|
|
2188
|
+
result[@"probability"] = @(input.probability);
|
|
2189
|
+
|
|
1237
2190
|
return result;
|
|
1238
2191
|
}
|
|
1239
2192
|
|
|
1240
|
-
+(
|
|
1241
|
-
NSMutableDictionary
|
|
1242
|
-
|
|
2193
|
+
+(NSDictionary*)documentReaderValidityDictionaryFromJson:(NSDictionary*)input {
|
|
2194
|
+
NSMutableDictionary* json = input.mutableCopy;
|
|
2195
|
+
json[@"source"] = @"sourceType";
|
|
2196
|
+
return json;
|
|
2197
|
+
}
|
|
1243
2198
|
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
result[@"tagEntry"] = @(input.tagEntry);
|
|
2199
|
+
+(RGLDocumentReaderValidity*)documentReaderValidityFromJson:(NSDictionary*)input {
|
|
2200
|
+
return [RGLDocumentReaderValidity initWithJSON:[self documentReaderValidityDictionaryFromJson:input] sourceList:[self documentReaderValidityDictionaryFromJson:input]];
|
|
2201
|
+
}
|
|
1248
2202
|
|
|
2203
|
+
+(NSDictionary*)generateDocumentReaderValidity:(RGLDocumentReaderValidity*)input {
|
|
2204
|
+
if(input == nil) return nil;
|
|
2205
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
2206
|
+
|
|
2207
|
+
result[@"sourceType"] = @(input.sourceType);
|
|
2208
|
+
result[@"status"] = @(input.status);
|
|
2209
|
+
|
|
1249
2210
|
return result;
|
|
1250
2211
|
}
|
|
1251
2212
|
|
|
1252
|
-
+(
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
2213
|
+
+(RGLDocumentReaderResults*)documentReaderResultsFromJson:(NSDictionary*)input {
|
|
2214
|
+
NSMutableArray<RGLDocumentReaderDocumentType*>* documentType = [NSMutableArray new];
|
|
2215
|
+
for(NSDictionary* item in [input valueForKey:@"documentType"]){
|
|
2216
|
+
[documentType addObject:[self documentReaderDocumentTypeFromJson:item]];
|
|
2217
|
+
}
|
|
2218
|
+
NSMutableArray<RGLDocumentPosition*>* documentPosition = [NSMutableArray new];
|
|
2219
|
+
for(NSDictionary* item in [input valueForKey:@"documentPosition"]){
|
|
2220
|
+
[documentPosition addObject:(RGLDocumentPosition*)[self positionFromJson:item]];
|
|
2221
|
+
}
|
|
2222
|
+
NSMutableArray<RGLBarcodePosition*>* barcodePosition = [NSMutableArray new];
|
|
2223
|
+
for(NSDictionary* item in [input valueForKey:@"barcodePosition"]){
|
|
2224
|
+
[barcodePosition addObject:(RGLBarcodePosition*)[self positionFromJson:item]];
|
|
2225
|
+
}
|
|
2226
|
+
NSMutableArray<RGLMrzPosition*>* mrzPosition = [NSMutableArray new];
|
|
2227
|
+
for(NSDictionary* item in [input valueForKey:@"mrzPosition"]){
|
|
2228
|
+
[mrzPosition addObject:(RGLMrzPosition*)[self positionFromJson:item]];
|
|
2229
|
+
}
|
|
2230
|
+
NSMutableArray<RGLImageQualityGroup*>* imageQuality = [NSMutableArray new];
|
|
2231
|
+
for(NSDictionary* item in [input valueForKey:@"imageQuality"]){
|
|
2232
|
+
[imageQuality addObject:[self imageQualityGroupFromJson:item]];
|
|
2233
|
+
}
|
|
2234
|
+
|
|
2235
|
+
return [[RGLDocumentReaderResults alloc]
|
|
2236
|
+
initWithDocumentTypes:documentType
|
|
2237
|
+
textResult:[self documentReaderTextResultFromJson: [input valueForKey:@"textResult"]]
|
|
2238
|
+
graphicResult:[self documentReaderGraphicResultFromJson: [input valueForKey:@"graphicResult"]]
|
|
2239
|
+
rawResult:[input valueForKey:@"rawResult"]
|
|
2240
|
+
documentPosition:documentPosition
|
|
2241
|
+
barcodePosition:barcodePosition
|
|
2242
|
+
mrzPosition:mrzPosition
|
|
2243
|
+
imageQualityGroup:imageQuality
|
|
2244
|
+
authenticityResults:[self documentReaderAuthenticityResultFromJson: [input valueForKey:@"authenticityResult"]]
|
|
2245
|
+
rfidSessionData:[self rfidSessionDataFromJson: [input valueForKey:@"rfidSessionData"]]
|
|
2246
|
+
chipPage:[[input valueForKey:@"chipPage"] integerValue]
|
|
2247
|
+
barcodeResult:[self documentReaderBarcodeResultFromJson: [input valueForKey:@"barcodeResult"]]
|
|
2248
|
+
vdsncData:[self vdsncDataFromJson: [input valueForKey:@"vdsncData"]]
|
|
2249
|
+
status:[self documentReaderResultsStatusFromJson: [input valueForKey:@"status"]]
|
|
2250
|
+
processingFinished:[[input valueForKey:@"processingFinishedStatus"] integerValue]
|
|
2251
|
+
morePagesAvailable:[[input valueForKey:@"morePagesAvailable"] integerValue]
|
|
2252
|
+
elapsedTime:[[input valueForKey:@"elapsedTime"] integerValue]
|
|
2253
|
+
elapsedTimeRFID:[[input valueForKey:@"elapsedTimeRFID"] integerValue]
|
|
2254
|
+
transactionInfo:[self transactionInfoFromJson:[input valueForKey:@"transactionInfo"]]];
|
|
2255
|
+
}
|
|
2256
|
+
|
|
2257
|
+
+(NSDictionary*)generateDocumentReaderResults:(RGLDocumentReaderResults*)input {
|
|
2258
|
+
if(input == nil) return nil;
|
|
2259
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
2260
|
+
|
|
2261
|
+
if(input.documentType != nil){
|
|
2262
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
2263
|
+
for(RGLDocumentReaderDocumentType* item in input.documentType)
|
|
2264
|
+
[array addObject:[self generateDocumentReaderDocumentType:item]];
|
|
2265
|
+
result[@"documentType"] = array;
|
|
2266
|
+
}
|
|
2267
|
+
result[@"textResult"] = [self generateDocumentReaderTextResult:input.textResult];
|
|
2268
|
+
result[@"graphicResult"] = [self generateDocumentReaderGraphicResult:input.graphicResult];
|
|
2269
|
+
if(input.documentPosition != nil){
|
|
2270
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
2271
|
+
for(RGLPosition* item in input.documentPosition)
|
|
2272
|
+
[array addObject:[self generatePosition:item]];
|
|
2273
|
+
result[@"documentPosition"] = array;
|
|
2274
|
+
}
|
|
2275
|
+
if(input.barcodePosition != nil){
|
|
2276
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
2277
|
+
for(RGLPosition* item in input.barcodePosition)
|
|
2278
|
+
[array addObject:[self generatePosition:item]];
|
|
2279
|
+
result[@"barcodePosition"] = array;
|
|
2280
|
+
}
|
|
2281
|
+
if(input.mrzPosition != nil){
|
|
2282
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
2283
|
+
for(RGLPosition* item in input.mrzPosition)
|
|
2284
|
+
[array addObject:[self generatePosition:item]];
|
|
2285
|
+
result[@"mrzPosition"] = array;
|
|
2286
|
+
}
|
|
2287
|
+
if(input.imageQualityGroup != nil){
|
|
2288
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
2289
|
+
for(RGLImageQualityGroup* item in input.imageQualityGroup)
|
|
2290
|
+
[array addObject:[self generateImageQualityGroup:item]];
|
|
2291
|
+
result[@"imageQuality"] = array;
|
|
2292
|
+
}
|
|
2293
|
+
result[@"authenticityResult"] = [self generateDocumentReaderAuthenticityResult:input.authenticityResults];
|
|
2294
|
+
result[@"rfidSessionData"] = [self generateRFIDSessionData:input.rfidSessionData];
|
|
2295
|
+
result[@"chipPage"] = @(input.chipPage);
|
|
2296
|
+
result[@"barcodeResult"] = [self generateDocumentReaderBarcodeResult:input.barcodeResult];
|
|
2297
|
+
result[@"processingFinishedStatus"] = @(input.processingFinishedStatus);
|
|
2298
|
+
result[@"morePagesAvailable"] = @(input.morePagesAvailable);
|
|
2299
|
+
result[@"elapsedTime"] = @(input.elapsedTime);
|
|
2300
|
+
result[@"elapsedTimeRFID"] = @(input.elapsedTimeRFID);
|
|
2301
|
+
result[@"rawResult"] = input.rawResult;
|
|
2302
|
+
result[@"status"] = [self generateDocumentReaderResultsStatus:input.status];
|
|
2303
|
+
result[@"vdsncData"] = [self generateVDSNCData:input.vdsncData];
|
|
2304
|
+
result[@"transactionInfo"] = [self generateTransactionInfo:input.transactionInfo];
|
|
2305
|
+
|
|
2306
|
+
return result;
|
|
2307
|
+
}
|
|
1260
2308
|
|
|
2309
|
+
+(NSDictionary*)generateDictionary:(NSDictionary<NSNumber*, NSNumber*>*)input {
|
|
2310
|
+
if(input == nil) return nil;
|
|
2311
|
+
NSMutableDictionary* result = [NSMutableDictionary new];
|
|
2312
|
+
|
|
2313
|
+
for(NSNumber* key in input)
|
|
2314
|
+
result[[key stringValue]] = input[key];
|
|
2315
|
+
|
|
1261
2316
|
return result;
|
|
1262
2317
|
}
|
|
1263
2318
|
|
|
1264
|
-
@end
|
|
2319
|
+
@end
|