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