theta-client-react-native 1.0.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/LICENSE +21 -0
- package/README.ja.md +64 -0
- package/README.md +66 -0
- package/android/build.gradle +149 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/com/ricoh360/thetaclientreactnative/Converter.kt +557 -0
- package/android/src/main/java/com/ricoh360/thetaclientreactnative/ThetaClientSdkModule.kt +774 -0
- package/android/src/main/java/com/ricoh360/thetaclientreactnative/ThetaClientSdkPackage.kt +17 -0
- package/ios/ThetaClientReactNative.h +28 -0
- package/ios/ThetaClientReactNative.mm +2105 -0
- package/ios/ThetaClientReactNative.xcodeproj/project.pbxproj +325 -0
- package/lib/commonjs/index.js +1061 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/index.js +1023 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/index.d.ts +975 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/package.json +154 -0
- package/src/index.tsx +1265 -0
- package/theta-client-react-native.podspec +36 -0
|
@@ -0,0 +1,2105 @@
|
|
|
1
|
+
#import "THETAClient.h"
|
|
2
|
+
#import "ThetaClientReactNative.h"
|
|
3
|
+
#import "RCTConvert.h"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* converter for int32_t
|
|
7
|
+
*/
|
|
8
|
+
@implementation RCTConvert (int32_t)
|
|
9
|
+
RCT_NUMBER_CONVERTER(int32_t, intValue)
|
|
10
|
+
@end
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* takepicture callback holder
|
|
14
|
+
*/
|
|
15
|
+
@interface PhotoCallback: NSObject <THETACPhotoCaptureTakePictureCallback>
|
|
16
|
+
@end
|
|
17
|
+
@implementation PhotoCallback {
|
|
18
|
+
RCTPromiseResolveBlock _resolve; ///< takepicture callback resolver
|
|
19
|
+
RCTPromiseRejectBlock _reject; ///< takepicture callback rejecter
|
|
20
|
+
ThetaClientReactNative *_sdk; ///< theta client sdk instance
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* initialize PhotoCallback
|
|
24
|
+
* @param sdk theta client sdk instance
|
|
25
|
+
* @param resolve resolver for promise
|
|
26
|
+
* @param reject rejecter for promise
|
|
27
|
+
* @return initialized callback instance
|
|
28
|
+
*/
|
|
29
|
+
-(id)initWith:(ThetaClientReactNative *)sdk
|
|
30
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
|
31
|
+
withRejecter:(RCTPromiseRejectBlock)reject
|
|
32
|
+
{
|
|
33
|
+
self = [super init];
|
|
34
|
+
if (self) {
|
|
35
|
+
_sdk = sdk;
|
|
36
|
+
_resolve = resolve;
|
|
37
|
+
_reject = reject;
|
|
38
|
+
}
|
|
39
|
+
return self;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* call when error detect
|
|
44
|
+
* @param exception exception object
|
|
45
|
+
*/
|
|
46
|
+
-(void)onErrorException:(THETACThetaRepositoryThetaRepositoryException *)exception
|
|
47
|
+
{
|
|
48
|
+
_reject(@"error", exception.message, nil);
|
|
49
|
+
_sdk.photoCapture = nil;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* call when successfully taken picture
|
|
54
|
+
* @param fileUrl taken picture file url
|
|
55
|
+
*/
|
|
56
|
+
-(void)onSuccessFileUrl:(NSString *)fileUrl
|
|
57
|
+
{
|
|
58
|
+
_resolve(fileUrl);
|
|
59
|
+
_sdk.photoCapture = nil;
|
|
60
|
+
}
|
|
61
|
+
@end
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* startCapture callback holder
|
|
65
|
+
*/
|
|
66
|
+
@interface VideoCallback: NSObject <THETACVideoCaptureStartCaptureCallback>
|
|
67
|
+
@end
|
|
68
|
+
@implementation VideoCallback {
|
|
69
|
+
RCTPromiseResolveBlock _resolve; ///< start capture resolver
|
|
70
|
+
RCTPromiseRejectBlock _reject; ///< start capture rejecter
|
|
71
|
+
ThetaClientReactNative *_sdk; ///< theta client sdk instance
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* initialize VideoCallback
|
|
76
|
+
* @param sdk theta client sdk instance
|
|
77
|
+
* @param resolve resolver for promise
|
|
78
|
+
* @param reject rejecter for promise
|
|
79
|
+
* @return initialized callback instance
|
|
80
|
+
*/
|
|
81
|
+
-(id)initWith:(ThetaClientReactNative *)sdk
|
|
82
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
|
83
|
+
withRejecter:(RCTPromiseRejectBlock)reject
|
|
84
|
+
{
|
|
85
|
+
self = [super init];
|
|
86
|
+
if (self) {
|
|
87
|
+
_sdk = sdk;
|
|
88
|
+
_resolve = resolve;
|
|
89
|
+
_reject = reject;
|
|
90
|
+
}
|
|
91
|
+
return self;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* call when error detect
|
|
96
|
+
* @param exception exception object
|
|
97
|
+
*/
|
|
98
|
+
-(void)onErrorException:(THETACThetaRepositoryThetaRepositoryException *)exception
|
|
99
|
+
{
|
|
100
|
+
_reject(@"error", exception.message, nil);
|
|
101
|
+
_sdk.videoCapture = nil;
|
|
102
|
+
_sdk.videoCapturing = nil;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* call when successfully video captured
|
|
107
|
+
* @param fileUrl captured video file url
|
|
108
|
+
*/
|
|
109
|
+
-(void)onSuccessFileUrl:(NSString *)fileUrl
|
|
110
|
+
{
|
|
111
|
+
_resolve(fileUrl);
|
|
112
|
+
_sdk.videoCapture = nil;
|
|
113
|
+
_sdk.videoCapturing = nil;
|
|
114
|
+
}
|
|
115
|
+
@end
|
|
116
|
+
|
|
117
|
+
/** frame event handler with NSData */
|
|
118
|
+
typedef void (^FrameEventHandler)(NSData *);
|
|
119
|
+
/** frame interval time */
|
|
120
|
+
static CFTimeInterval FRAME_INTERVAL = (CFTimeInterval) (1.0/10.0);
|
|
121
|
+
/**
|
|
122
|
+
* live preview frame handler holder
|
|
123
|
+
*/
|
|
124
|
+
@interface FrameHandler: NSObject <THETACKotlinSuspendFunction1>
|
|
125
|
+
@end
|
|
126
|
+
@implementation FrameHandler {
|
|
127
|
+
FrameEventHandler _handler; ///< frame event handler
|
|
128
|
+
ThetaClientReactNative *_sdk; ///< theta client sdk instance
|
|
129
|
+
CFTimeInterval _last; ///< last event time
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* initialize frame handler
|
|
134
|
+
* @param sdk theta client sdk instance
|
|
135
|
+
* @param handler frame event handler
|
|
136
|
+
*/
|
|
137
|
+
-(id)initWith:(ThetaClientReactNative *)sdk
|
|
138
|
+
withEvent:(FrameEventHandler)handler
|
|
139
|
+
{
|
|
140
|
+
self = [super init];
|
|
141
|
+
if (self) {
|
|
142
|
+
_sdk = sdk;
|
|
143
|
+
_handler = handler;
|
|
144
|
+
_last = 0;
|
|
145
|
+
}
|
|
146
|
+
return self;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* call when frame data arrived
|
|
151
|
+
* @param p1 ByteReadPacket instance
|
|
152
|
+
* @param completionHandler set result
|
|
153
|
+
*/
|
|
154
|
+
- (void)invokeP1:(id)p1 completionHandler:(void (^)(id _Nullable_result, NSError * _Nullable))completionHandler __attribute__((swift_name("invoke(p1:completionHandler:)")));
|
|
155
|
+
{
|
|
156
|
+
CFTimeInterval now = CACurrentMediaTime();
|
|
157
|
+
if (now - _last > FRAME_INTERVAL) {
|
|
158
|
+
NSData *data =
|
|
159
|
+
[THETACPlatformKt frameFromPacket:(THETACKotlinPair<THETACKotlinByteArray *, THETACInt *> *)p1];
|
|
160
|
+
_handler(data);
|
|
161
|
+
completionHandler(@(_sdk.previewing), nil);
|
|
162
|
+
_last = now;
|
|
163
|
+
} else {
|
|
164
|
+
completionHandler(@(_sdk.previewing), nil);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
@end
|
|
168
|
+
|
|
169
|
+
/** opiton converter from theta to react */
|
|
170
|
+
typedef void (^SetFromTheta)(NSMutableDictionary *, THETACThetaRepositoryOptions *);
|
|
171
|
+
/** option converter from react to theta */
|
|
172
|
+
typedef void (^SetToTheta)(NSDictionary *, THETACThetaRepositoryOptions *);
|
|
173
|
+
/** option converter to set photo option */
|
|
174
|
+
typedef void (^SetPhotoOption)(NSDictionary *, THETACPhotoCaptureBuilder *);
|
|
175
|
+
/** option converter to set video option */
|
|
176
|
+
typedef void (^SetVideoOption)(NSDictionary *, THETACVideoCaptureBuilder *);
|
|
177
|
+
|
|
178
|
+
typedef struct _convert_t {
|
|
179
|
+
NSDictionary* toTheta; ///< dictionary react to theta
|
|
180
|
+
NSDictionary* fromTheta; ///< dictionary theta to react
|
|
181
|
+
NSDictionary* photoOption; ///< dictionary photoOption
|
|
182
|
+
NSDictionary* videoOption; ///< dictionary videoOption
|
|
183
|
+
SetToTheta setToTheta; ///< option setter react to theta
|
|
184
|
+
SetFromTheta setFromTheta; ///< option setter theta to react
|
|
185
|
+
SetPhotoOption setPhotoOption; ///< photo option setter
|
|
186
|
+
SetVideoOption setVideoOption; ///< video option setter
|
|
187
|
+
} convert_t;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* ChargingStateEnum converter
|
|
191
|
+
*/
|
|
192
|
+
static convert_t ChargingStateEnum = {
|
|
193
|
+
.fromTheta = @{
|
|
194
|
+
THETACThetaRepositoryChargingStateEnum.charging: @"CHARGING",
|
|
195
|
+
THETACThetaRepositoryChargingStateEnum.completed: @"COMPLETED",
|
|
196
|
+
THETACThetaRepositoryChargingStateEnum.notCharging: @"NOT_CHARGING"
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* FileTypeEnum converter
|
|
202
|
+
*/
|
|
203
|
+
static convert_t FileTypeEnum = {
|
|
204
|
+
.toTheta = @{
|
|
205
|
+
@"IMAGE": THETACThetaRepositoryFileTypeEnum.image,
|
|
206
|
+
@"VIDEO": THETACThetaRepositoryFileTypeEnum.video,
|
|
207
|
+
@"ALL": THETACThetaRepositoryFileTypeEnum.all
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* AuthModeEnum converter
|
|
213
|
+
*/
|
|
214
|
+
static convert_t AuthModeEnum = {
|
|
215
|
+
.toTheta = @{
|
|
216
|
+
@"NONE": THETACThetaRepositoryAuthModeEnum.none,
|
|
217
|
+
@"WEP": THETACThetaRepositoryAuthModeEnum.wep,
|
|
218
|
+
@"WPA": THETACThetaRepositoryAuthModeEnum.wpa
|
|
219
|
+
},
|
|
220
|
+
.fromTheta = @{
|
|
221
|
+
THETACThetaRepositoryAuthModeEnum.none: @"NONE",
|
|
222
|
+
THETACThetaRepositoryAuthModeEnum.wep: @"WEP",
|
|
223
|
+
THETACThetaRepositoryAuthModeEnum.wpa: @"WPA"
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* ApertureEnum converter
|
|
229
|
+
*/
|
|
230
|
+
static convert_t ApertureEnum = {
|
|
231
|
+
.toTheta = @{
|
|
232
|
+
@"APERTURE_AUTO": THETACThetaRepositoryApertureEnum.apertureAuto,
|
|
233
|
+
@"APERTURE_2_0": THETACThetaRepositoryApertureEnum.aperture20,
|
|
234
|
+
@"APERTURE_2_1": THETACThetaRepositoryApertureEnum.aperture21,
|
|
235
|
+
@"APERTURE_2_4": THETACThetaRepositoryApertureEnum.aperture24,
|
|
236
|
+
@"APERTURE_3_5": THETACThetaRepositoryApertureEnum.aperture35,
|
|
237
|
+
@"APERTURE_5_6": THETACThetaRepositoryApertureEnum.aperture56
|
|
238
|
+
},
|
|
239
|
+
.fromTheta = @{
|
|
240
|
+
THETACThetaRepositoryApertureEnum.apertureAuto: @"APERTURE_AUTO",
|
|
241
|
+
THETACThetaRepositoryApertureEnum.aperture20: @"APERTURE_2_0",
|
|
242
|
+
THETACThetaRepositoryApertureEnum.aperture21: @"APERTURE_2_1",
|
|
243
|
+
THETACThetaRepositoryApertureEnum.aperture24: @"APERTURE_2_4",
|
|
244
|
+
THETACThetaRepositoryApertureEnum.aperture35: @"APERTURE_3_5",
|
|
245
|
+
THETACThetaRepositoryApertureEnum.aperture56: @"APERTURE_5_6"
|
|
246
|
+
},
|
|
247
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
248
|
+
id val = [ApertureEnum.toTheta objectForKey:[rct objectForKey:@"aperture"]];
|
|
249
|
+
if (val) {
|
|
250
|
+
opt.aperture = val;
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
254
|
+
id val = [ApertureEnum.fromTheta objectForKey:opt.aperture];
|
|
255
|
+
if (val) {
|
|
256
|
+
[rct setObject:val forKey:@"aperture"];
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
.setPhotoOption = ^(NSDictionary* rct, THETACPhotoCaptureBuilder *builder) {
|
|
260
|
+
id val = [ApertureEnum.toTheta objectForKey:[rct objectForKey:@"aperture"]];
|
|
261
|
+
if (val) {
|
|
262
|
+
[builder setApertureAperture:val];
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
.setVideoOption = ^(NSDictionary* rct, THETACVideoCaptureBuilder *builder) {
|
|
266
|
+
id val = [ApertureEnum.toTheta objectForKey:[rct objectForKey:@"aperture"]];
|
|
267
|
+
if (val) {
|
|
268
|
+
[builder setApertureAperture:val];
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* CaptureModeEnum converter
|
|
275
|
+
*/
|
|
276
|
+
static convert_t CaptureModeEnum = {
|
|
277
|
+
.toTheta = @{
|
|
278
|
+
@"IMAGE": THETACThetaRepositoryCaptureModeEnum.image,
|
|
279
|
+
@"VIDEO": THETACThetaRepositoryCaptureModeEnum.video
|
|
280
|
+
},
|
|
281
|
+
.fromTheta = @{
|
|
282
|
+
THETACThetaRepositoryCaptureModeEnum.image: @"IMAGE",
|
|
283
|
+
THETACThetaRepositoryCaptureModeEnum.video: @"VIDEO"
|
|
284
|
+
},
|
|
285
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
286
|
+
id val = [CaptureModeEnum.toTheta objectForKey:[rct objectForKey:@"captureMode"]];
|
|
287
|
+
if (val) {
|
|
288
|
+
opt.captureMode = val;
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
292
|
+
id val = [CaptureModeEnum.fromTheta objectForKey:opt.captureMode];
|
|
293
|
+
if (val) {
|
|
294
|
+
[rct setObject:val forKey:@"captureMode"];
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* ExposureCompensationEnum converter
|
|
301
|
+
*/
|
|
302
|
+
static convert_t ExposureCompensationEnum = {
|
|
303
|
+
.toTheta = @{
|
|
304
|
+
@"M_2_0": THETACThetaRepositoryExposureCompensationEnum.m20,
|
|
305
|
+
@"M_1_7": THETACThetaRepositoryExposureCompensationEnum.m17,
|
|
306
|
+
@"M_1_3": THETACThetaRepositoryExposureCompensationEnum.m13,
|
|
307
|
+
@"M_1_0": THETACThetaRepositoryExposureCompensationEnum.m10,
|
|
308
|
+
@"M_0_7": THETACThetaRepositoryExposureCompensationEnum.m07,
|
|
309
|
+
@"M_0_3": THETACThetaRepositoryExposureCompensationEnum.m03,
|
|
310
|
+
@"ZERO": THETACThetaRepositoryExposureCompensationEnum.zero,
|
|
311
|
+
@"P_0_3": THETACThetaRepositoryExposureCompensationEnum.p03,
|
|
312
|
+
@"P_0_7": THETACThetaRepositoryExposureCompensationEnum.p07,
|
|
313
|
+
@"P_1_0": THETACThetaRepositoryExposureCompensationEnum.p10,
|
|
314
|
+
@"P_1_3": THETACThetaRepositoryExposureCompensationEnum.p13,
|
|
315
|
+
@"P_1_7": THETACThetaRepositoryExposureCompensationEnum.p17,
|
|
316
|
+
@"P_2_0": THETACThetaRepositoryExposureCompensationEnum.p20
|
|
317
|
+
},
|
|
318
|
+
.fromTheta = @{
|
|
319
|
+
THETACThetaRepositoryExposureCompensationEnum.m20: @"M_2_0",
|
|
320
|
+
THETACThetaRepositoryExposureCompensationEnum.m17: @"M_1_7",
|
|
321
|
+
THETACThetaRepositoryExposureCompensationEnum.m13: @"M_1_3",
|
|
322
|
+
THETACThetaRepositoryExposureCompensationEnum.m10: @"M_1_0",
|
|
323
|
+
THETACThetaRepositoryExposureCompensationEnum.m07: @"M_0_7",
|
|
324
|
+
THETACThetaRepositoryExposureCompensationEnum.m03: @"M_0_3",
|
|
325
|
+
THETACThetaRepositoryExposureCompensationEnum.zero: @"ZERO",
|
|
326
|
+
THETACThetaRepositoryExposureCompensationEnum.p03: @"P_0_3",
|
|
327
|
+
THETACThetaRepositoryExposureCompensationEnum.p07: @"P_0_7",
|
|
328
|
+
THETACThetaRepositoryExposureCompensationEnum.p10: @"P_1_0",
|
|
329
|
+
THETACThetaRepositoryExposureCompensationEnum.p13: @"P_1_3",
|
|
330
|
+
THETACThetaRepositoryExposureCompensationEnum.p17: @"P_1_7",
|
|
331
|
+
THETACThetaRepositoryExposureCompensationEnum.p20: @"P_2_0",
|
|
332
|
+
},
|
|
333
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
334
|
+
id val = [ExposureCompensationEnum.toTheta
|
|
335
|
+
objectForKey:[rct objectForKey:@"exposureCompensation"]];
|
|
336
|
+
if (val) {
|
|
337
|
+
opt.exposureCompensation = val;
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
341
|
+
id val = [ExposureCompensationEnum.fromTheta objectForKey:opt.exposureCompensation];
|
|
342
|
+
if (val) {
|
|
343
|
+
[rct setObject:val forKey:@"exposureCompensation"];
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
.setPhotoOption = ^(NSDictionary* rct, THETACPhotoCaptureBuilder *builder) {
|
|
347
|
+
id val = [ExposureCompensationEnum.toTheta
|
|
348
|
+
objectForKey:[rct objectForKey:@"exposureCompensation"]];
|
|
349
|
+
if (val) {
|
|
350
|
+
[builder setExposureCompensationValue:val];
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
.setVideoOption = ^(NSDictionary* rct, THETACVideoCaptureBuilder *builder) {
|
|
354
|
+
id val = [ExposureCompensationEnum.toTheta
|
|
355
|
+
objectForKey:[rct objectForKey:@"exposureCompensation"]];
|
|
356
|
+
if (val) {
|
|
357
|
+
[builder setExposureCompensationValue:val];
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* ExposureDelayEnum converter
|
|
364
|
+
*/
|
|
365
|
+
static convert_t ExposureDelayEnum = {
|
|
366
|
+
.toTheta = @{
|
|
367
|
+
@"DELAY_OFF": THETACThetaRepositoryExposureDelayEnum.delayOff,
|
|
368
|
+
@"DELAY_1": THETACThetaRepositoryExposureDelayEnum.delay1,
|
|
369
|
+
@"DELAY_2": THETACThetaRepositoryExposureDelayEnum.delay2,
|
|
370
|
+
@"DELAY_3": THETACThetaRepositoryExposureDelayEnum.delay3,
|
|
371
|
+
@"DELAY_4": THETACThetaRepositoryExposureDelayEnum.delay4,
|
|
372
|
+
@"DELAY_5": THETACThetaRepositoryExposureDelayEnum.delay5,
|
|
373
|
+
@"DELAY_6": THETACThetaRepositoryExposureDelayEnum.delay6,
|
|
374
|
+
@"DELAY_7": THETACThetaRepositoryExposureDelayEnum.delay7,
|
|
375
|
+
@"DELAY_8": THETACThetaRepositoryExposureDelayEnum.delay8,
|
|
376
|
+
@"DELAY_9": THETACThetaRepositoryExposureDelayEnum.delay9,
|
|
377
|
+
@"DELAY_10": THETACThetaRepositoryExposureDelayEnum.delay10
|
|
378
|
+
},
|
|
379
|
+
.fromTheta = @{
|
|
380
|
+
THETACThetaRepositoryExposureDelayEnum.delayOff: @"DELAY_OFF",
|
|
381
|
+
THETACThetaRepositoryExposureDelayEnum.delay1: @"DELAY_1",
|
|
382
|
+
THETACThetaRepositoryExposureDelayEnum.delay2: @"DELAY_2",
|
|
383
|
+
THETACThetaRepositoryExposureDelayEnum.delay3: @"DELAY_3",
|
|
384
|
+
THETACThetaRepositoryExposureDelayEnum.delay4: @"DELAY_4",
|
|
385
|
+
THETACThetaRepositoryExposureDelayEnum.delay5: @"DELAY_5",
|
|
386
|
+
THETACThetaRepositoryExposureDelayEnum.delay6: @"DELAY_6",
|
|
387
|
+
THETACThetaRepositoryExposureDelayEnum.delay7: @"DELAY_7",
|
|
388
|
+
THETACThetaRepositoryExposureDelayEnum.delay8: @"DELAY_8",
|
|
389
|
+
THETACThetaRepositoryExposureDelayEnum.delay9: @"DELAY_9",
|
|
390
|
+
THETACThetaRepositoryExposureDelayEnum.delay10: @"DELAY_10"
|
|
391
|
+
},
|
|
392
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
393
|
+
id val = [ExposureDelayEnum.toTheta objectForKey:[rct objectForKey:@"exposureDelay"]];
|
|
394
|
+
if (val) {
|
|
395
|
+
opt.exposureDelay = val;
|
|
396
|
+
}
|
|
397
|
+
},
|
|
398
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
399
|
+
id val = [ExposureDelayEnum.fromTheta objectForKey:opt.exposureDelay];
|
|
400
|
+
if (val) {
|
|
401
|
+
[rct setObject:val forKey:@"exposureDelay"];
|
|
402
|
+
}
|
|
403
|
+
},
|
|
404
|
+
.setPhotoOption = ^(NSDictionary* rct, THETACPhotoCaptureBuilder *builder) {
|
|
405
|
+
id val = [ExposureDelayEnum.toTheta objectForKey:[rct objectForKey:@"exposureDelay"]];
|
|
406
|
+
if (val) {
|
|
407
|
+
[builder setExposureDelayDelay:val];
|
|
408
|
+
}
|
|
409
|
+
},
|
|
410
|
+
.setVideoOption = ^(NSDictionary* rct, THETACVideoCaptureBuilder *builder) {
|
|
411
|
+
id val = [ExposureDelayEnum.toTheta objectForKey:[rct objectForKey:@"exposureDelay"]];
|
|
412
|
+
if (val) {
|
|
413
|
+
[builder setExposureDelayDelay:val];
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* ExposureProgramEnum converter
|
|
420
|
+
*/
|
|
421
|
+
static convert_t ExposureProgramEnum = {
|
|
422
|
+
.toTheta = @{
|
|
423
|
+
@"MANUAL": THETACThetaRepositoryExposureProgramEnum.manual,
|
|
424
|
+
@"NORMAL_PROGRAM": THETACThetaRepositoryExposureProgramEnum.normalProgram,
|
|
425
|
+
@"APERTURE_PRIORITY": THETACThetaRepositoryExposureProgramEnum.aperturePriority,
|
|
426
|
+
@"SHUTTER_PRIORITY": THETACThetaRepositoryExposureProgramEnum.shutterPriority,
|
|
427
|
+
@"ISO_PRIORITY": THETACThetaRepositoryExposureProgramEnum.isoPriority
|
|
428
|
+
},
|
|
429
|
+
.fromTheta = @{
|
|
430
|
+
THETACThetaRepositoryExposureProgramEnum.manual: @"MANUAL",
|
|
431
|
+
THETACThetaRepositoryExposureProgramEnum.normalProgram: @"NORMAL_PROGRAM",
|
|
432
|
+
THETACThetaRepositoryExposureProgramEnum.aperturePriority: @"APERTURE_PRIORITY",
|
|
433
|
+
THETACThetaRepositoryExposureProgramEnum.shutterPriority: @"SHUTTER_PRIORITY",
|
|
434
|
+
THETACThetaRepositoryExposureProgramEnum.isoPriority: @"ISO_PRIORITY"
|
|
435
|
+
},
|
|
436
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
437
|
+
id val = [ExposureProgramEnum.toTheta
|
|
438
|
+
objectForKey:[rct objectForKey:@"exposureProgram"]];
|
|
439
|
+
if (val) {
|
|
440
|
+
opt.exposureProgram = val;
|
|
441
|
+
}
|
|
442
|
+
},
|
|
443
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
444
|
+
id val = [ExposureProgramEnum.fromTheta objectForKey:opt.exposureProgram];
|
|
445
|
+
if (val) {
|
|
446
|
+
[rct setObject:val forKey:@"exposureProgram"];
|
|
447
|
+
}
|
|
448
|
+
},
|
|
449
|
+
.setPhotoOption = ^(NSDictionary* rct, THETACPhotoCaptureBuilder *builder) {
|
|
450
|
+
id val = [ExposureProgramEnum.toTheta
|
|
451
|
+
objectForKey:[rct objectForKey:@"exposureProgram"]];
|
|
452
|
+
if (val) {
|
|
453
|
+
[builder setExposureProgramProgram:val];
|
|
454
|
+
}
|
|
455
|
+
},
|
|
456
|
+
.setVideoOption = ^(NSDictionary* rct, THETACVideoCaptureBuilder *builder) {
|
|
457
|
+
id val = [ExposureProgramEnum.toTheta
|
|
458
|
+
objectForKey:[rct objectForKey:@"exposureProgram"]];
|
|
459
|
+
if (val) {
|
|
460
|
+
[builder setExposureProgramProgram:val];
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* FileFormatTypeEnum converter
|
|
467
|
+
*/
|
|
468
|
+
static convert_t FileFormatTypeEnum = {
|
|
469
|
+
.toTheta = @{
|
|
470
|
+
@"JPEG": THETACThetaRepositoryFileFormatTypeEnum.jpeg,
|
|
471
|
+
@"MP4": THETACThetaRepositoryFileFormatTypeEnum.mp4,
|
|
472
|
+
@"RAW": THETACThetaRepositoryFileFormatTypeEnum.raw
|
|
473
|
+
},
|
|
474
|
+
.fromTheta = @{
|
|
475
|
+
THETACThetaRepositoryFileFormatTypeEnum.jpeg: @"JPEG",
|
|
476
|
+
THETACThetaRepositoryFileFormatTypeEnum.mp4: @"MP4",
|
|
477
|
+
THETACThetaRepositoryFileFormatTypeEnum.raw: @"RAW"
|
|
478
|
+
}
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
/**
|
|
482
|
+
* FileFormatEnum converter
|
|
483
|
+
*/
|
|
484
|
+
static convert_t FileFormatEnum = {
|
|
485
|
+
.toTheta = @{
|
|
486
|
+
@"IMAGE_2K": THETACThetaRepositoryFileFormatEnum.image2k,
|
|
487
|
+
@"IMAGE_5K": THETACThetaRepositoryFileFormatEnum.image5k,
|
|
488
|
+
@"IMAGE_6_7K": THETACThetaRepositoryFileFormatEnum.image67k,
|
|
489
|
+
@"RAW_P_6_7K": THETACThetaRepositoryFileFormatEnum.rawP67k,
|
|
490
|
+
@"IMAGE_5_5K": THETACThetaRepositoryFileFormatEnum.image55k,
|
|
491
|
+
@"IMAGE_11K": THETACThetaRepositoryFileFormatEnum.image11k,
|
|
492
|
+
@"VIDEO_HD": THETACThetaRepositoryFileFormatEnum.videoHd,
|
|
493
|
+
@"VIDEO_FULL_HD": THETACThetaRepositoryFileFormatEnum.videoFullHd,
|
|
494
|
+
@"VIDEO_2K": THETACThetaRepositoryFileFormatEnum.video2k,
|
|
495
|
+
@"VIDEO_4K": THETACThetaRepositoryFileFormatEnum.video4k,
|
|
496
|
+
@"VIDEO_2K_30F": THETACThetaRepositoryFileFormatEnum.video2k30f,
|
|
497
|
+
@"VIDEO_2K_60F": THETACThetaRepositoryFileFormatEnum.video2k60f,
|
|
498
|
+
@"VIDEO_4K_30F": THETACThetaRepositoryFileFormatEnum.video4k30f,
|
|
499
|
+
@"VIDEO_4K_60F": THETACThetaRepositoryFileFormatEnum.video4k60f,
|
|
500
|
+
@"VIDEO_5_7K_2F": THETACThetaRepositoryFileFormatEnum.video57k2f,
|
|
501
|
+
@"VIDEO_5_7K_5F": THETACThetaRepositoryFileFormatEnum.video57k5f,
|
|
502
|
+
@"VIDEO_5_7K_30F": THETACThetaRepositoryFileFormatEnum.video57k30f,
|
|
503
|
+
@"VIDEO_7K_2F": THETACThetaRepositoryFileFormatEnum.video7k2f,
|
|
504
|
+
@"VIDEO_7K_5F": THETACThetaRepositoryFileFormatEnum.video7k5f,
|
|
505
|
+
@"VIDEO_7K_10F": THETACThetaRepositoryFileFormatEnum.video7k10f
|
|
506
|
+
},
|
|
507
|
+
.fromTheta = @{
|
|
508
|
+
THETACThetaRepositoryFileFormatEnum.image2k: @"IMAGE_2K",
|
|
509
|
+
THETACThetaRepositoryFileFormatEnum.image5k: @"IMAGE_5K",
|
|
510
|
+
THETACThetaRepositoryFileFormatEnum.image67k: @"IMAGE_6_7K",
|
|
511
|
+
THETACThetaRepositoryFileFormatEnum.rawP67k: @"RAW_P_6_7K",
|
|
512
|
+
THETACThetaRepositoryFileFormatEnum.image55k: @"IMAGE_5_5K",
|
|
513
|
+
THETACThetaRepositoryFileFormatEnum.image11k: @"IMAGE_11K",
|
|
514
|
+
THETACThetaRepositoryFileFormatEnum.videoHd: @"VIDEO_HD",
|
|
515
|
+
THETACThetaRepositoryFileFormatEnum.videoFullHd: @"VIDEO_FULL_HD",
|
|
516
|
+
THETACThetaRepositoryFileFormatEnum.video2k: @"VIDEO_2K",
|
|
517
|
+
THETACThetaRepositoryFileFormatEnum.video4k: @"VIDEO_4K",
|
|
518
|
+
THETACThetaRepositoryFileFormatEnum.video2k30f: @"VIDEO_2K_30F",
|
|
519
|
+
THETACThetaRepositoryFileFormatEnum.video2k60f: @"VIDEO_2K_60F",
|
|
520
|
+
THETACThetaRepositoryFileFormatEnum.video4k30f: @"VIDEO_4K_30F",
|
|
521
|
+
THETACThetaRepositoryFileFormatEnum.video4k60f: @"VIDEO_4K_60F",
|
|
522
|
+
THETACThetaRepositoryFileFormatEnum.video57k2f: @"VIDEO_5_7K_2F",
|
|
523
|
+
THETACThetaRepositoryFileFormatEnum.video57k5f: @"VIDEO_5_7K_5F",
|
|
524
|
+
THETACThetaRepositoryFileFormatEnum.video57k30f: @"VIDEO_5_7K_30F",
|
|
525
|
+
THETACThetaRepositoryFileFormatEnum.video7k2f: @"VIDEO_7K_2F",
|
|
526
|
+
THETACThetaRepositoryFileFormatEnum.video7k5f: @"VIDEO_7K_5F",
|
|
527
|
+
THETACThetaRepositoryFileFormatEnum.video7k10f: @"VIDEO_7K_10F"
|
|
528
|
+
},
|
|
529
|
+
.photoOption = @{
|
|
530
|
+
@"IMAGE_2K": THETACThetaRepositoryPhotoFileFormatEnum.image2k,
|
|
531
|
+
@"IMAGE_5K": THETACThetaRepositoryPhotoFileFormatEnum.image5k,
|
|
532
|
+
@"IMAGE_6_7K": THETACThetaRepositoryPhotoFileFormatEnum.image67k,
|
|
533
|
+
@"RAW_P_6_7K": THETACThetaRepositoryPhotoFileFormatEnum.rawP67k,
|
|
534
|
+
@"IMAGE_5_5K": THETACThetaRepositoryPhotoFileFormatEnum.image55k,
|
|
535
|
+
@"IMAGE_11K": THETACThetaRepositoryPhotoFileFormatEnum.image11k,
|
|
536
|
+
},
|
|
537
|
+
.videoOption = @{
|
|
538
|
+
@"VIDEO_HD": THETACThetaRepositoryVideoFileFormatEnum.videoHd,
|
|
539
|
+
@"VIDEO_FULL_HD": THETACThetaRepositoryVideoFileFormatEnum.videoFullHd,
|
|
540
|
+
@"VIDEO_2K": THETACThetaRepositoryVideoFileFormatEnum.video2k,
|
|
541
|
+
@"VIDEO_4K": THETACThetaRepositoryVideoFileFormatEnum.video4k,
|
|
542
|
+
@"VIDEO_2K_30F": THETACThetaRepositoryVideoFileFormatEnum.video2k30f,
|
|
543
|
+
@"VIDEO_2K_60F": THETACThetaRepositoryVideoFileFormatEnum.video2k60f,
|
|
544
|
+
@"VIDEO_4K_30F": THETACThetaRepositoryVideoFileFormatEnum.video4k30f,
|
|
545
|
+
@"VIDEO_4K_60F": THETACThetaRepositoryVideoFileFormatEnum.video4k60f,
|
|
546
|
+
@"VIDEO_5_7K_2F": THETACThetaRepositoryVideoFileFormatEnum.video57k2f,
|
|
547
|
+
@"VIDEO_5_7K_5F": THETACThetaRepositoryVideoFileFormatEnum.video57k5f,
|
|
548
|
+
@"VIDEO_5_7K_30F": THETACThetaRepositoryVideoFileFormatEnum.video57k30f,
|
|
549
|
+
@"VIDEO_7K_2F": THETACThetaRepositoryVideoFileFormatEnum.video7k2f,
|
|
550
|
+
@"VIDEO_7K_5F": THETACThetaRepositoryVideoFileFormatEnum.video7k5f,
|
|
551
|
+
@"VIDEO_7K_10F": THETACThetaRepositoryVideoFileFormatEnum.video7k10f
|
|
552
|
+
},
|
|
553
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
554
|
+
id val = [FileFormatEnum.toTheta objectForKey:[rct objectForKey:@"fileFormat"]];
|
|
555
|
+
if (val) {
|
|
556
|
+
opt.fileFormat = val;
|
|
557
|
+
}
|
|
558
|
+
},
|
|
559
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
560
|
+
id val = [FileFormatEnum.fromTheta objectForKey:opt.fileFormat];
|
|
561
|
+
if (val) {
|
|
562
|
+
[rct setObject:val forKey:@"fileFormat"];
|
|
563
|
+
}
|
|
564
|
+
},
|
|
565
|
+
.setPhotoOption = ^(NSDictionary* rct, THETACPhotoCaptureBuilder *builder) {
|
|
566
|
+
id val = [FileFormatEnum.photoOption objectForKey:[rct objectForKey:@"fileFormat"]];
|
|
567
|
+
if (val) {
|
|
568
|
+
[builder setFileFormatFileFormat:val];
|
|
569
|
+
}
|
|
570
|
+
},
|
|
571
|
+
.setVideoOption = ^(NSDictionary* rct, THETACVideoCaptureBuilder *builder) {
|
|
572
|
+
id val = [FileFormatEnum.videoOption objectForKey:[rct objectForKey:@"fileFormat"]];
|
|
573
|
+
if (val) {
|
|
574
|
+
[builder setFileFormatFileFormat:val];
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
};
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* FilterEnum converter
|
|
581
|
+
*/
|
|
582
|
+
static convert_t FilterEnum = {
|
|
583
|
+
.toTheta = @{
|
|
584
|
+
@"OFF": THETACThetaRepositoryFilterEnum.off,
|
|
585
|
+
@"NOISE_REDUCTION": THETACThetaRepositoryFilterEnum.noiseReduction,
|
|
586
|
+
@"HDR": THETACThetaRepositoryFilterEnum.hdr
|
|
587
|
+
},
|
|
588
|
+
.fromTheta = @{
|
|
589
|
+
THETACThetaRepositoryFilterEnum.off: @"OFF",
|
|
590
|
+
THETACThetaRepositoryFilterEnum.noiseReduction: @"NOISE_REDUCTION",
|
|
591
|
+
THETACThetaRepositoryFilterEnum.hdr: @"HDR"
|
|
592
|
+
},
|
|
593
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
594
|
+
id val = [FilterEnum.toTheta objectForKey:[rct objectForKey:@"filter"]];
|
|
595
|
+
if (val) {
|
|
596
|
+
opt.filter = val;
|
|
597
|
+
}
|
|
598
|
+
},
|
|
599
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
600
|
+
id val = [FilterEnum.fromTheta objectForKey:opt.filter];
|
|
601
|
+
if (val) {
|
|
602
|
+
[rct setObject:val forKey:@"filter"];
|
|
603
|
+
}
|
|
604
|
+
},
|
|
605
|
+
.setPhotoOption = ^(NSDictionary* rct, THETACPhotoCaptureBuilder *builder) {
|
|
606
|
+
id val = [FilterEnum.toTheta objectForKey:[rct objectForKey:@"filter"]];
|
|
607
|
+
if (val) {
|
|
608
|
+
[builder setFilterFilter:val];
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
};
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* GpsTagRecordingEnum converter
|
|
615
|
+
*/
|
|
616
|
+
static convert_t GpsTagRecordingEnum = {
|
|
617
|
+
.toTheta = @{
|
|
618
|
+
@"ON": THETACThetaRepositoryGpsTagRecordingEnum.on,
|
|
619
|
+
@"OFF": THETACThetaRepositoryGpsTagRecordingEnum.off
|
|
620
|
+
},
|
|
621
|
+
.fromTheta = @{
|
|
622
|
+
THETACThetaRepositoryGpsTagRecordingEnum.on: @"ON",
|
|
623
|
+
THETACThetaRepositoryGpsTagRecordingEnum.off: @"OFF"
|
|
624
|
+
},
|
|
625
|
+
.setPhotoOption = ^(NSDictionary* rct, THETACPhotoCaptureBuilder *builder) {
|
|
626
|
+
id val = [GpsTagRecordingEnum.toTheta
|
|
627
|
+
objectForKey:[rct objectForKey:@"_gpsTagRecording"]];
|
|
628
|
+
if (val) {
|
|
629
|
+
[builder setGpsTagRecordingValue:val];
|
|
630
|
+
}
|
|
631
|
+
},
|
|
632
|
+
.setVideoOption = ^(NSDictionary* rct, THETACVideoCaptureBuilder *builder) {
|
|
633
|
+
id val = [GpsTagRecordingEnum.toTheta
|
|
634
|
+
objectForKey:[rct objectForKey:@"_gpsTagRecording"]];
|
|
635
|
+
if (val) {
|
|
636
|
+
[builder setGpsTagRecordingValue:val];
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
};
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* IsoEnum converter
|
|
643
|
+
*/
|
|
644
|
+
static convert_t IsoEnum = {
|
|
645
|
+
.toTheta = @{
|
|
646
|
+
@"ISO_AUTO": THETACThetaRepositoryIsoEnum.isoAuto,
|
|
647
|
+
@"ISO_50": THETACThetaRepositoryIsoEnum.iso50,
|
|
648
|
+
@"ISO_64": THETACThetaRepositoryIsoEnum.iso64,
|
|
649
|
+
@"ISO_80": THETACThetaRepositoryIsoEnum.iso80,
|
|
650
|
+
@"ISO_100": THETACThetaRepositoryIsoEnum.iso100,
|
|
651
|
+
@"ISO_125": THETACThetaRepositoryIsoEnum.iso125,
|
|
652
|
+
@"ISO_160": THETACThetaRepositoryIsoEnum.iso160,
|
|
653
|
+
@"ISO_200": THETACThetaRepositoryIsoEnum.iso200,
|
|
654
|
+
@"ISO_250": THETACThetaRepositoryIsoEnum.iso250,
|
|
655
|
+
@"ISO_320": THETACThetaRepositoryIsoEnum.iso320,
|
|
656
|
+
@"ISO_400": THETACThetaRepositoryIsoEnum.iso400,
|
|
657
|
+
@"ISO_500": THETACThetaRepositoryIsoEnum.iso500,
|
|
658
|
+
@"ISO_640": THETACThetaRepositoryIsoEnum.iso640,
|
|
659
|
+
@"ISO_800": THETACThetaRepositoryIsoEnum.iso800,
|
|
660
|
+
@"ISO_1000": THETACThetaRepositoryIsoEnum.iso1000,
|
|
661
|
+
@"ISO_1250": THETACThetaRepositoryIsoEnum.iso1250,
|
|
662
|
+
@"ISO_1600": THETACThetaRepositoryIsoEnum.iso1600,
|
|
663
|
+
@"ISO_2000": THETACThetaRepositoryIsoEnum.iso2000,
|
|
664
|
+
@"ISO_2500": THETACThetaRepositoryIsoEnum.iso2500,
|
|
665
|
+
@"ISO_3200": THETACThetaRepositoryIsoEnum.iso3200,
|
|
666
|
+
@"ISO_4000": THETACThetaRepositoryIsoEnum.iso4000,
|
|
667
|
+
@"ISO_5000": THETACThetaRepositoryIsoEnum.iso5000,
|
|
668
|
+
@"ISO_6400": THETACThetaRepositoryIsoEnum.iso6400
|
|
669
|
+
},
|
|
670
|
+
.fromTheta = @{
|
|
671
|
+
THETACThetaRepositoryIsoEnum.isoAuto: @"ISO_AUTO",
|
|
672
|
+
THETACThetaRepositoryIsoEnum.iso50: @"ISO_50",
|
|
673
|
+
THETACThetaRepositoryIsoEnum.iso64: @"ISO_64",
|
|
674
|
+
THETACThetaRepositoryIsoEnum.iso80: @"ISO_80",
|
|
675
|
+
THETACThetaRepositoryIsoEnum.iso100: @"ISO_100",
|
|
676
|
+
THETACThetaRepositoryIsoEnum.iso125: @"ISO_125",
|
|
677
|
+
THETACThetaRepositoryIsoEnum.iso160: @"ISO_160",
|
|
678
|
+
THETACThetaRepositoryIsoEnum.iso200: @"ISO_200",
|
|
679
|
+
THETACThetaRepositoryIsoEnum.iso250: @"ISO_250",
|
|
680
|
+
THETACThetaRepositoryIsoEnum.iso320: @"ISO_320",
|
|
681
|
+
THETACThetaRepositoryIsoEnum.iso400: @"ISO_400",
|
|
682
|
+
THETACThetaRepositoryIsoEnum.iso500: @"ISO_500",
|
|
683
|
+
THETACThetaRepositoryIsoEnum.iso640: @"ISO_640",
|
|
684
|
+
THETACThetaRepositoryIsoEnum.iso800: @"ISO_800",
|
|
685
|
+
THETACThetaRepositoryIsoEnum.iso1000: @"ISO_1000",
|
|
686
|
+
THETACThetaRepositoryIsoEnum.iso1250: @"ISO_1250",
|
|
687
|
+
THETACThetaRepositoryIsoEnum.iso1600: @"ISO_1600",
|
|
688
|
+
THETACThetaRepositoryIsoEnum.iso2000: @"ISO_2000",
|
|
689
|
+
THETACThetaRepositoryIsoEnum.iso2500: @"ISO_2500",
|
|
690
|
+
THETACThetaRepositoryIsoEnum.iso3200: @"ISO_3200",
|
|
691
|
+
THETACThetaRepositoryIsoEnum.iso4000: @"ISO_4000",
|
|
692
|
+
THETACThetaRepositoryIsoEnum.iso5000: @"ISO_5000",
|
|
693
|
+
THETACThetaRepositoryIsoEnum.iso6400: @"ISO_6400"
|
|
694
|
+
},
|
|
695
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
696
|
+
id val = [IsoEnum.toTheta objectForKey:[rct objectForKey:@"iso"]];
|
|
697
|
+
if (val) {
|
|
698
|
+
opt.iso = val;
|
|
699
|
+
}
|
|
700
|
+
},
|
|
701
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
702
|
+
id val = [IsoEnum.fromTheta objectForKey:opt.iso];
|
|
703
|
+
if (val) {
|
|
704
|
+
[rct setObject:val forKey:@"iso"];
|
|
705
|
+
}
|
|
706
|
+
},
|
|
707
|
+
.setPhotoOption = ^(NSDictionary* rct, THETACPhotoCaptureBuilder *builder) {
|
|
708
|
+
id val = [IsoEnum.toTheta objectForKey:[rct objectForKey:@"iso"]];
|
|
709
|
+
if (val) {
|
|
710
|
+
[builder setIsoIso:val];
|
|
711
|
+
}
|
|
712
|
+
},
|
|
713
|
+
.setVideoOption = ^(NSDictionary* rct, THETACVideoCaptureBuilder *builder) {
|
|
714
|
+
id val = [IsoEnum.toTheta objectForKey:[rct objectForKey:@"iso"]];
|
|
715
|
+
if (val) {
|
|
716
|
+
[builder setIsoIso:val];
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
};
|
|
720
|
+
|
|
721
|
+
/**
|
|
722
|
+
* IsoAutoHighLimitEnum converter
|
|
723
|
+
*/
|
|
724
|
+
static convert_t IsoAutoHighLimitEnum = {
|
|
725
|
+
.toTheta = @{
|
|
726
|
+
@"ISO_100": THETACThetaRepositoryIsoAutoHighLimitEnum.iso100,
|
|
727
|
+
@"ISO_125": THETACThetaRepositoryIsoAutoHighLimitEnum.iso125,
|
|
728
|
+
@"ISO_160": THETACThetaRepositoryIsoAutoHighLimitEnum.iso160,
|
|
729
|
+
@"ISO_200": THETACThetaRepositoryIsoAutoHighLimitEnum.iso200,
|
|
730
|
+
@"ISO_250": THETACThetaRepositoryIsoAutoHighLimitEnum.iso250,
|
|
731
|
+
@"ISO_320": THETACThetaRepositoryIsoAutoHighLimitEnum.iso320,
|
|
732
|
+
@"ISO_400": THETACThetaRepositoryIsoAutoHighLimitEnum.iso400,
|
|
733
|
+
@"ISO_500": THETACThetaRepositoryIsoAutoHighLimitEnum.iso500,
|
|
734
|
+
@"ISO_640": THETACThetaRepositoryIsoAutoHighLimitEnum.iso640,
|
|
735
|
+
@"ISO_800": THETACThetaRepositoryIsoAutoHighLimitEnum.iso800,
|
|
736
|
+
@"ISO_1000": THETACThetaRepositoryIsoAutoHighLimitEnum.iso1000,
|
|
737
|
+
@"ISO_1250": THETACThetaRepositoryIsoAutoHighLimitEnum.iso1250,
|
|
738
|
+
@"ISO_1600": THETACThetaRepositoryIsoAutoHighLimitEnum.iso1600,
|
|
739
|
+
@"ISO_2000": THETACThetaRepositoryIsoAutoHighLimitEnum.iso2000,
|
|
740
|
+
@"ISO_2500": THETACThetaRepositoryIsoAutoHighLimitEnum.iso2500,
|
|
741
|
+
@"ISO_3200": THETACThetaRepositoryIsoAutoHighLimitEnum.iso3200,
|
|
742
|
+
@"ISO_4000": THETACThetaRepositoryIsoAutoHighLimitEnum.iso4000,
|
|
743
|
+
@"ISO_5000": THETACThetaRepositoryIsoAutoHighLimitEnum.iso5000,
|
|
744
|
+
@"ISO_6400": THETACThetaRepositoryIsoAutoHighLimitEnum.iso6400
|
|
745
|
+
},
|
|
746
|
+
.fromTheta = @{
|
|
747
|
+
THETACThetaRepositoryIsoAutoHighLimitEnum.iso100: @"ISO_100",
|
|
748
|
+
THETACThetaRepositoryIsoAutoHighLimitEnum.iso125: @"ISO_125",
|
|
749
|
+
THETACThetaRepositoryIsoAutoHighLimitEnum.iso160: @"ISO_160",
|
|
750
|
+
THETACThetaRepositoryIsoAutoHighLimitEnum.iso200: @"ISO_200",
|
|
751
|
+
THETACThetaRepositoryIsoAutoHighLimitEnum.iso250: @"ISO_250",
|
|
752
|
+
THETACThetaRepositoryIsoAutoHighLimitEnum.iso320: @"ISO_320",
|
|
753
|
+
THETACThetaRepositoryIsoAutoHighLimitEnum.iso400: @"ISO_400",
|
|
754
|
+
THETACThetaRepositoryIsoAutoHighLimitEnum.iso500: @"ISO_500",
|
|
755
|
+
THETACThetaRepositoryIsoAutoHighLimitEnum.iso640: @"ISO_640",
|
|
756
|
+
THETACThetaRepositoryIsoAutoHighLimitEnum.iso800: @"ISO_800",
|
|
757
|
+
THETACThetaRepositoryIsoAutoHighLimitEnum.iso1000: @"ISO_1000",
|
|
758
|
+
THETACThetaRepositoryIsoAutoHighLimitEnum.iso1250: @"ISO_1250",
|
|
759
|
+
THETACThetaRepositoryIsoAutoHighLimitEnum.iso1600: @"ISO_1600",
|
|
760
|
+
THETACThetaRepositoryIsoAutoHighLimitEnum.iso2000: @"ISO_2000",
|
|
761
|
+
THETACThetaRepositoryIsoAutoHighLimitEnum.iso2500: @"ISO_2500",
|
|
762
|
+
THETACThetaRepositoryIsoAutoHighLimitEnum.iso3200: @"ISO_3200",
|
|
763
|
+
THETACThetaRepositoryIsoAutoHighLimitEnum.iso4000: @"ISO_4000",
|
|
764
|
+
THETACThetaRepositoryIsoAutoHighLimitEnum.iso5000: @"ISO_5000",
|
|
765
|
+
THETACThetaRepositoryIsoAutoHighLimitEnum.iso6400: @"ISO_6400"
|
|
766
|
+
},
|
|
767
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
768
|
+
id val = [IsoAutoHighLimitEnum.toTheta
|
|
769
|
+
objectForKey:[rct objectForKey:@"isoAutoHighLimit"]];
|
|
770
|
+
if (val) {
|
|
771
|
+
opt.isoAutoHighLimit = val;
|
|
772
|
+
}
|
|
773
|
+
},
|
|
774
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
775
|
+
id val = [IsoAutoHighLimitEnum.fromTheta objectForKey:opt.isoAutoHighLimit];
|
|
776
|
+
if (val) {
|
|
777
|
+
[rct setObject:val forKey:@"isoAutoHighLimit"];
|
|
778
|
+
}
|
|
779
|
+
},
|
|
780
|
+
.setPhotoOption = ^(NSDictionary* rct, THETACPhotoCaptureBuilder *builder) {
|
|
781
|
+
id val = [IsoAutoHighLimitEnum.toTheta
|
|
782
|
+
objectForKey:[rct objectForKey:@"isoAutoHighLimit"]];
|
|
783
|
+
if (val) {
|
|
784
|
+
[builder setIsoAutoHighLimitIso:val];
|
|
785
|
+
}
|
|
786
|
+
},
|
|
787
|
+
.setVideoOption = ^(NSDictionary* rct, THETACVideoCaptureBuilder *builder) {
|
|
788
|
+
id val = [IsoAutoHighLimitEnum.toTheta
|
|
789
|
+
objectForKey:[rct objectForKey:@"isoAutoHighLimit"]];
|
|
790
|
+
if (val) {
|
|
791
|
+
[builder setIsoAutoHighLimitIso:val];
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
};
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* LanguageEnum converter
|
|
798
|
+
*/
|
|
799
|
+
static convert_t LanguageEnum = {
|
|
800
|
+
.toTheta = @{
|
|
801
|
+
@"DE": THETACThetaRepositoryLanguageEnum.de,
|
|
802
|
+
@"EN_GB": THETACThetaRepositoryLanguageEnum.enGb,
|
|
803
|
+
@"EN_US": THETACThetaRepositoryLanguageEnum.enUs,
|
|
804
|
+
@"FR": THETACThetaRepositoryLanguageEnum.fr,
|
|
805
|
+
@"IT": THETACThetaRepositoryLanguageEnum.it,
|
|
806
|
+
@"JA": THETACThetaRepositoryLanguageEnum.ja,
|
|
807
|
+
@"KO": THETACThetaRepositoryLanguageEnum.ko,
|
|
808
|
+
@"ZH_CN": THETACThetaRepositoryLanguageEnum.zhCn,
|
|
809
|
+
@"ZH_TW": THETACThetaRepositoryLanguageEnum.zhTw
|
|
810
|
+
},
|
|
811
|
+
.fromTheta = @{
|
|
812
|
+
THETACThetaRepositoryLanguageEnum.de: @"DE",
|
|
813
|
+
THETACThetaRepositoryLanguageEnum.enGb: @"EN_GB",
|
|
814
|
+
THETACThetaRepositoryLanguageEnum.enUs: @"EN_US",
|
|
815
|
+
THETACThetaRepositoryLanguageEnum.fr: @"FR",
|
|
816
|
+
THETACThetaRepositoryLanguageEnum.it: @"IT",
|
|
817
|
+
THETACThetaRepositoryLanguageEnum.ja: @"JA",
|
|
818
|
+
THETACThetaRepositoryLanguageEnum.ko: @"KO",
|
|
819
|
+
THETACThetaRepositoryLanguageEnum.zhCn: @"ZH_CN",
|
|
820
|
+
THETACThetaRepositoryLanguageEnum.zhTw: @"ZH_TW"
|
|
821
|
+
},
|
|
822
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
823
|
+
id val = [LanguageEnum.toTheta objectForKey:[rct objectForKey:@"language"]];
|
|
824
|
+
if (val) {
|
|
825
|
+
opt.language = val;
|
|
826
|
+
}
|
|
827
|
+
},
|
|
828
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
829
|
+
id val = [LanguageEnum.fromTheta objectForKey:opt.language];
|
|
830
|
+
if (val) {
|
|
831
|
+
[rct setObject:val forKey:@"language"];
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
};
|
|
835
|
+
|
|
836
|
+
/**
|
|
837
|
+
* MaxRecordableTimeEnum converter
|
|
838
|
+
*/
|
|
839
|
+
static convert_t MaxRecordableTimeEnum = {
|
|
840
|
+
.toTheta = @{
|
|
841
|
+
@"RECORDABLE_TIME_180": THETACThetaRepositoryMaxRecordableTimeEnum.recordableTime180,
|
|
842
|
+
@"RECORDABLE_TIME_300": THETACThetaRepositoryMaxRecordableTimeEnum.recordableTime300,
|
|
843
|
+
@"RECORDABLE_TIME_1500": THETACThetaRepositoryMaxRecordableTimeEnum.recordableTime1500
|
|
844
|
+
},
|
|
845
|
+
.fromTheta = @{
|
|
846
|
+
THETACThetaRepositoryMaxRecordableTimeEnum.recordableTime180: @"RECORDABLE_TIME_180",
|
|
847
|
+
THETACThetaRepositoryMaxRecordableTimeEnum.recordableTime300: @"RECORDABLE_TIME_300",
|
|
848
|
+
THETACThetaRepositoryMaxRecordableTimeEnum.recordableTime1500: @"RECORDABLE_TIME_1500"
|
|
849
|
+
},
|
|
850
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
851
|
+
id val = [MaxRecordableTimeEnum.toTheta
|
|
852
|
+
objectForKey:[rct objectForKey:@"maxRecordableTime"]];
|
|
853
|
+
if (val) {
|
|
854
|
+
opt.maxRecordableTime = val;
|
|
855
|
+
}
|
|
856
|
+
},
|
|
857
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
858
|
+
id val = [MaxRecordableTimeEnum.fromTheta objectForKey:opt.maxRecordableTime];
|
|
859
|
+
if (val) {
|
|
860
|
+
[rct setObject:val forKey:@"maxRecordableTime"];
|
|
861
|
+
}
|
|
862
|
+
},
|
|
863
|
+
.setVideoOption = ^(NSDictionary* rct, THETACVideoCaptureBuilder *builder) {
|
|
864
|
+
id val = [MaxRecordableTimeEnum.toTheta
|
|
865
|
+
objectForKey:[rct objectForKey:@"maxRecordableTime"]];
|
|
866
|
+
if (val) {
|
|
867
|
+
[builder setMaxRecordableTimeTime:val];
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
};
|
|
871
|
+
|
|
872
|
+
/**
|
|
873
|
+
* OffDelayEnum converter
|
|
874
|
+
*/
|
|
875
|
+
static convert_t OffDelayEnum = {
|
|
876
|
+
.toTheta = @{
|
|
877
|
+
@"DISABLE": THETACThetaRepositoryOffDelayEnum.disable,
|
|
878
|
+
@"OFF_DELAY_5M": THETACThetaRepositoryOffDelayEnum.offDelay5m,
|
|
879
|
+
@"OFF_DELAY_10M": THETACThetaRepositoryOffDelayEnum.offDelay10m,
|
|
880
|
+
@"OFF_DELAY_15M": THETACThetaRepositoryOffDelayEnum.offDelay15m,
|
|
881
|
+
@"OFF_DELAY_30M": THETACThetaRepositoryOffDelayEnum.offDelay30m
|
|
882
|
+
},
|
|
883
|
+
.fromTheta = @{
|
|
884
|
+
@(THETACThetaRepositoryOffDelayEnum.disable.sec): @"DISABLE",
|
|
885
|
+
@(THETACThetaRepositoryOffDelayEnum.offDelay5m.sec): @"OFF_DELAY_5M",
|
|
886
|
+
@(THETACThetaRepositoryOffDelayEnum.offDelay10m.sec): @"OFF_DELAY_10M",
|
|
887
|
+
@(THETACThetaRepositoryOffDelayEnum.offDelay15m.sec): @"OFF_DELAY_15M",
|
|
888
|
+
@(THETACThetaRepositoryOffDelayEnum.offDelay30m.sec): @"OFF_DELAY_30M"
|
|
889
|
+
},
|
|
890
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
891
|
+
id rv = [rct objectForKey:@"offDelay"];
|
|
892
|
+
if (rv) {
|
|
893
|
+
if ([rv isKindOfClass:NSString.class]) {
|
|
894
|
+
id val = [OffDelayEnum.toTheta objectForKey:rv];
|
|
895
|
+
opt.offDelay = val;
|
|
896
|
+
} else if ([rv isKindOfClass:NSNumber.class]) {
|
|
897
|
+
id val = [[THETACThetaRepositoryOffDelaySec alloc] initWithSec:[rv intValue]];
|
|
898
|
+
opt.offDelay = val;
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
},
|
|
902
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
903
|
+
if (opt.offDelay) {
|
|
904
|
+
id val = [OffDelayEnum.fromTheta objectForKey:@(opt.offDelay.sec)];
|
|
905
|
+
if (val) {
|
|
906
|
+
[rct setObject:val forKey:@"offDelay"];
|
|
907
|
+
} else {
|
|
908
|
+
[rct setObject:@(opt.offDelay.sec) forKey:@"offDelay"];
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
};
|
|
913
|
+
|
|
914
|
+
/**
|
|
915
|
+
* WhiteBalanceEnum converter
|
|
916
|
+
*/
|
|
917
|
+
static convert_t WhiteBalanceEnum = {
|
|
918
|
+
.toTheta = @{
|
|
919
|
+
@"AUTO": THETACThetaRepositoryWhiteBalanceEnum.auto_,
|
|
920
|
+
@"DAYLIGHT": THETACThetaRepositoryWhiteBalanceEnum.daylight,
|
|
921
|
+
@"SHADE": THETACThetaRepositoryWhiteBalanceEnum.shade,
|
|
922
|
+
@"CLOUDY_DAYLIGHT": THETACThetaRepositoryWhiteBalanceEnum.cloudyDaylight,
|
|
923
|
+
@"INCANDESCENT": THETACThetaRepositoryWhiteBalanceEnum.incandescent,
|
|
924
|
+
@"WARM_WHITE_FLUORESCENT": THETACThetaRepositoryWhiteBalanceEnum.warmWhiteFluorescent,
|
|
925
|
+
@"DAYLIGHT_FLUORESCENT": THETACThetaRepositoryWhiteBalanceEnum.daylightFluorescent,
|
|
926
|
+
@"DAYWHITE_FLUORESCENT": THETACThetaRepositoryWhiteBalanceEnum.daywhiteFluorescent,
|
|
927
|
+
@"FLUORESCENT": THETACThetaRepositoryWhiteBalanceEnum.fluorescent,
|
|
928
|
+
@"BULB_FLUORESCENT": THETACThetaRepositoryWhiteBalanceEnum.bulbFluorescent,
|
|
929
|
+
@"COLOR_TEMPERATURE": THETACThetaRepositoryWhiteBalanceEnum.colorTemperature,
|
|
930
|
+
@"UNDERWATER": THETACThetaRepositoryWhiteBalanceEnum.underwater
|
|
931
|
+
},
|
|
932
|
+
.fromTheta = @{
|
|
933
|
+
THETACThetaRepositoryWhiteBalanceEnum.auto_: @"AUTO",
|
|
934
|
+
THETACThetaRepositoryWhiteBalanceEnum.daylight: @"DAYLIGHT",
|
|
935
|
+
THETACThetaRepositoryWhiteBalanceEnum.shade: @"SHADE",
|
|
936
|
+
THETACThetaRepositoryWhiteBalanceEnum.cloudyDaylight: @"CLOUDY_DAYLIGHT",
|
|
937
|
+
THETACThetaRepositoryWhiteBalanceEnum.incandescent: @"INCANDESCENT",
|
|
938
|
+
THETACThetaRepositoryWhiteBalanceEnum.warmWhiteFluorescent: @"WARM_WHITE_FLUORESCENT",
|
|
939
|
+
THETACThetaRepositoryWhiteBalanceEnum.daylightFluorescent: @"DAYLIGHT_FLUORESCENT",
|
|
940
|
+
THETACThetaRepositoryWhiteBalanceEnum.daywhiteFluorescent: @"DAYWHITE_FLUORESCENT",
|
|
941
|
+
THETACThetaRepositoryWhiteBalanceEnum.fluorescent: @"FLUORESCENT",
|
|
942
|
+
THETACThetaRepositoryWhiteBalanceEnum.bulbFluorescent: @"BULB_FLUORESCENT",
|
|
943
|
+
THETACThetaRepositoryWhiteBalanceEnum.colorTemperature: @"COLOR_TEMPERATURE",
|
|
944
|
+
THETACThetaRepositoryWhiteBalanceEnum.underwater: @"UNDERWATER"
|
|
945
|
+
},
|
|
946
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
947
|
+
id val = [WhiteBalanceEnum.toTheta objectForKey:[rct objectForKey:@"whiteBalance"]];
|
|
948
|
+
if (val) {
|
|
949
|
+
opt.whiteBalance = val;
|
|
950
|
+
}
|
|
951
|
+
},
|
|
952
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
953
|
+
id val = [WhiteBalanceEnum.fromTheta objectForKey:opt.whiteBalance];
|
|
954
|
+
if (val) {
|
|
955
|
+
[rct setObject:val forKey:@"whiteBalance"];
|
|
956
|
+
}
|
|
957
|
+
},
|
|
958
|
+
.setPhotoOption = ^(NSDictionary* rct, THETACPhotoCaptureBuilder *builder) {
|
|
959
|
+
id val = [WhiteBalanceEnum.toTheta
|
|
960
|
+
objectForKey:[rct objectForKey:@"whiteBalance"]];
|
|
961
|
+
if (val) {
|
|
962
|
+
[builder setWhiteBalanceWhiteBalance:val];
|
|
963
|
+
}
|
|
964
|
+
},
|
|
965
|
+
.setVideoOption = ^(NSDictionary* rct, THETACVideoCaptureBuilder *builder) {
|
|
966
|
+
id val = [WhiteBalanceEnum.toTheta
|
|
967
|
+
objectForKey:[rct objectForKey:@"whiteBalance"]];
|
|
968
|
+
if (val) {
|
|
969
|
+
[builder setWhiteBalanceWhiteBalance:val];
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
};
|
|
973
|
+
|
|
974
|
+
/**
|
|
975
|
+
* ColorTemperature converter
|
|
976
|
+
*/
|
|
977
|
+
static convert_t ColorTemperatureCvt = {
|
|
978
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
979
|
+
NSNumber* val = [rct objectForKey:@"colorTemperature"];
|
|
980
|
+
if (val) {
|
|
981
|
+
opt.colorTemperature = (THETACInt *) val;
|
|
982
|
+
}
|
|
983
|
+
},
|
|
984
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
985
|
+
[rct setObject:opt.colorTemperature forKey:@"colorTemperature"];
|
|
986
|
+
},
|
|
987
|
+
.setPhotoOption = ^(NSDictionary* rct, THETACPhotoCaptureBuilder *builder) {
|
|
988
|
+
NSNumber *val = (NSNumber*) [rct objectForKey:@"colorTemperature"];
|
|
989
|
+
if (val) {
|
|
990
|
+
[builder setColorTemperatureKelvin:val.intValue];
|
|
991
|
+
}
|
|
992
|
+
},
|
|
993
|
+
.setVideoOption = ^(NSDictionary* rct, THETACVideoCaptureBuilder *builder) {
|
|
994
|
+
NSNumber *val = (NSNumber*) [rct objectForKey:@"colorTemperature"];
|
|
995
|
+
if (val) {
|
|
996
|
+
[builder setColorTemperatureKelvin:val.intValue];
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
};
|
|
1000
|
+
|
|
1001
|
+
/**
|
|
1002
|
+
* DateTimeZone converter
|
|
1003
|
+
*/
|
|
1004
|
+
static convert_t DateTimeZoneCvt = {
|
|
1005
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1006
|
+
NSString* val = [rct objectForKey:@"dateTimeZone"];
|
|
1007
|
+
if (val) {
|
|
1008
|
+
opt.dateTimeZone = val;
|
|
1009
|
+
}
|
|
1010
|
+
},
|
|
1011
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1012
|
+
if (opt.dateTimeZone) {
|
|
1013
|
+
[rct setObject:opt.dateTimeZone forKey:@"dateTimeZone"];
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
};
|
|
1017
|
+
|
|
1018
|
+
/**
|
|
1019
|
+
* IsGpsOn converter
|
|
1020
|
+
*/
|
|
1021
|
+
static convert_t IsGpsOnCvt = {
|
|
1022
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1023
|
+
NSNumber* val = [rct objectForKey:@"isGpsOn"];
|
|
1024
|
+
if (val) {
|
|
1025
|
+
opt.isGpsOn = (THETACBoolean *) val;
|
|
1026
|
+
}
|
|
1027
|
+
},
|
|
1028
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1029
|
+
if (opt.isGpsOn) {
|
|
1030
|
+
[rct setObject:@(((NSNumber *) opt.isGpsOn).boolValue) forKey:@"isGpsOn"];
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
};
|
|
1034
|
+
|
|
1035
|
+
/**
|
|
1036
|
+
* SleepDelay converter
|
|
1037
|
+
*/
|
|
1038
|
+
static convert_t SleepDelayEnum = {
|
|
1039
|
+
.toTheta = @{
|
|
1040
|
+
@"DISABLE": THETACThetaRepositorySleepDelayEnum.disable,
|
|
1041
|
+
@"SLEEP_DELAY_3M": THETACThetaRepositorySleepDelayEnum.sleepDelay3m,
|
|
1042
|
+
@"SLEEP_DELAY_5M": THETACThetaRepositorySleepDelayEnum.sleepDelay5m,
|
|
1043
|
+
@"SLEEP_DELAY_7M": THETACThetaRepositorySleepDelayEnum.sleepDelay7m,
|
|
1044
|
+
@"SLEEP_DELAY_10M": THETACThetaRepositorySleepDelayEnum.sleepDelay10m
|
|
1045
|
+
},
|
|
1046
|
+
.fromTheta = @{
|
|
1047
|
+
@(THETACThetaRepositorySleepDelayEnum.disable.sec): @"DISABLE",
|
|
1048
|
+
@(THETACThetaRepositorySleepDelayEnum.sleepDelay3m.sec): @"SLEEP_DELAY_3M",
|
|
1049
|
+
@(THETACThetaRepositorySleepDelayEnum.sleepDelay5m.sec): @"SLEEP_DELAY_5M",
|
|
1050
|
+
@(THETACThetaRepositorySleepDelayEnum.sleepDelay7m.sec): @"SLEEP_DELAY_7M",
|
|
1051
|
+
@(THETACThetaRepositorySleepDelayEnum.sleepDelay10m.sec): @"SLEEP_DELAY_10M"
|
|
1052
|
+
},
|
|
1053
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1054
|
+
id rv = [rct objectForKey:@"sleepDelay"];
|
|
1055
|
+
if (rv) {
|
|
1056
|
+
if ([rv isKindOfClass:NSString.class]) {
|
|
1057
|
+
id val = [SleepDelayEnum.toTheta objectForKey:rv];
|
|
1058
|
+
opt.sleepDelay = val;
|
|
1059
|
+
} else if ([rv isKindOfClass:NSNumber.class]) {
|
|
1060
|
+
id val = [[THETACThetaRepositorySleepDelaySec alloc] initWithSec:[rv intValue]];
|
|
1061
|
+
opt.sleepDelay = val;
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
},
|
|
1065
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1066
|
+
if (opt.sleepDelay) {
|
|
1067
|
+
id val = [SleepDelayEnum.fromTheta objectForKey:@(opt.sleepDelay.sec)];
|
|
1068
|
+
if (val) {
|
|
1069
|
+
[rct setObject:val forKey:@"sleepDelay"];
|
|
1070
|
+
} else {
|
|
1071
|
+
[rct setObject:@(opt.sleepDelay.sec) forKey:@"sleepDelay"];
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
};
|
|
1076
|
+
|
|
1077
|
+
/**
|
|
1078
|
+
* RemainingPictures converter
|
|
1079
|
+
*/
|
|
1080
|
+
static convert_t RemainingPicturesCvt = {
|
|
1081
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1082
|
+
NSNumber* val = [rct objectForKey:@"remainingPictures"];
|
|
1083
|
+
if (val) {
|
|
1084
|
+
opt.remainingPictures = (THETACInt *) val;
|
|
1085
|
+
}
|
|
1086
|
+
},
|
|
1087
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1088
|
+
if (opt.remainingPictures) {
|
|
1089
|
+
[rct setObject:opt.remainingPictures forKey:@"remainingPictures"];
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
};
|
|
1093
|
+
|
|
1094
|
+
/**
|
|
1095
|
+
* RemainingVideoSeconds converter
|
|
1096
|
+
*/
|
|
1097
|
+
static convert_t RemainingVideoSecondsCvt = {
|
|
1098
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1099
|
+
NSNumber* val = [rct objectForKey:@"remainingVideoSeconds"];
|
|
1100
|
+
if (val) {
|
|
1101
|
+
opt.remainingVideoSeconds = (THETACInt *) val;
|
|
1102
|
+
}
|
|
1103
|
+
},
|
|
1104
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1105
|
+
if (opt.remainingVideoSeconds) {
|
|
1106
|
+
[rct setObject:opt.remainingVideoSeconds forKey:@"remainingVideoSeconds"];
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
};
|
|
1110
|
+
|
|
1111
|
+
/**
|
|
1112
|
+
* RemainingSpace converter
|
|
1113
|
+
*/
|
|
1114
|
+
static convert_t RemainingSpaceCvt = {
|
|
1115
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1116
|
+
NSNumber* val = [rct objectForKey:@"remainingSpace"];
|
|
1117
|
+
if (val) {
|
|
1118
|
+
opt.remainingSpace = (THETACLong *) val;
|
|
1119
|
+
}
|
|
1120
|
+
},
|
|
1121
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1122
|
+
if (opt.remainingSpace) {
|
|
1123
|
+
[rct setObject:opt.remainingSpace forKey:@"remainingSpace"];
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
};
|
|
1127
|
+
|
|
1128
|
+
/**
|
|
1129
|
+
* TotalSpace converter
|
|
1130
|
+
*/
|
|
1131
|
+
static convert_t TotalSpaceCvt = {
|
|
1132
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1133
|
+
NSNumber* val = [rct objectForKey:@"totalSpace"];
|
|
1134
|
+
if (val) {
|
|
1135
|
+
opt.totalSpace = (THETACLong *) val;
|
|
1136
|
+
}
|
|
1137
|
+
},
|
|
1138
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1139
|
+
if (opt.totalSpace) {
|
|
1140
|
+
[rct setObject:opt.totalSpace forKey:@"totalSpace"];
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
};
|
|
1144
|
+
|
|
1145
|
+
/**
|
|
1146
|
+
* ShutterVolume converter
|
|
1147
|
+
*/
|
|
1148
|
+
static convert_t ShutterVolumeCvt = {
|
|
1149
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1150
|
+
NSNumber* val = [rct objectForKey:@"shutterVolume"];
|
|
1151
|
+
if (val) {
|
|
1152
|
+
opt.shutterVolume = (THETACInt *) val;
|
|
1153
|
+
}
|
|
1154
|
+
},
|
|
1155
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1156
|
+
if (opt.shutterVolume) {
|
|
1157
|
+
[rct setObject:opt.shutterVolume forKey:@"shutterVolume"];
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
};
|
|
1161
|
+
|
|
1162
|
+
/**
|
|
1163
|
+
* GpsInfo converter
|
|
1164
|
+
*/
|
|
1165
|
+
static convert_t GpsInfoCvt = {
|
|
1166
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1167
|
+
NSDictionary *gpsInfoDict = [rct objectForKey:@"gpsInfo"];
|
|
1168
|
+
if (gpsInfoDict) {
|
|
1169
|
+
opt.gpsInfo =
|
|
1170
|
+
[[THETACThetaRepositoryGpsInfo alloc]
|
|
1171
|
+
initWithLatitude:((NSNumber*) [gpsInfoDict objectForKey:@"latitude"]).floatValue
|
|
1172
|
+
longitude:((NSNumber*) [gpsInfoDict objectForKey:@"longitude"]).floatValue
|
|
1173
|
+
altitude:((NSNumber*) [gpsInfoDict objectForKey:@"altitude"]).floatValue
|
|
1174
|
+
dateTimeZone:[gpsInfoDict objectForKey:@"dateTimeZone"]];
|
|
1175
|
+
}
|
|
1176
|
+
},
|
|
1177
|
+
|
|
1178
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1179
|
+
if (opt.gpsInfo) {
|
|
1180
|
+
NSDictionary *gpsInfo = @{
|
|
1181
|
+
@"latitude": @(opt.gpsInfo.latitude),
|
|
1182
|
+
@"longitude": @(opt.gpsInfo.longitude),
|
|
1183
|
+
@"altitude": @(opt.gpsInfo.altitude),
|
|
1184
|
+
@"dateTimeZone": opt.gpsInfo.dateTimeZone
|
|
1185
|
+
};
|
|
1186
|
+
[rct setObject:gpsInfo forKey:@"gpsInfo"];
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
};
|
|
1190
|
+
|
|
1191
|
+
/**
|
|
1192
|
+
* OptionNames converter
|
|
1193
|
+
*/
|
|
1194
|
+
static NSDictionary *NameToOptionEnum = @{
|
|
1195
|
+
@"Aperture": THETACThetaRepositoryOptionNameEnum.aperture,
|
|
1196
|
+
@"CaptureMode": THETACThetaRepositoryOptionNameEnum.capturemode,
|
|
1197
|
+
@"ColorTemperature": THETACThetaRepositoryOptionNameEnum.colortemperature,
|
|
1198
|
+
@"DateTimeZone": THETACThetaRepositoryOptionNameEnum.datetimezone,
|
|
1199
|
+
@"ExposureCompensation": THETACThetaRepositoryOptionNameEnum.exposurecompensation,
|
|
1200
|
+
@"ExposureDelay": THETACThetaRepositoryOptionNameEnum.exposuredelay,
|
|
1201
|
+
@"ExposureProgram": THETACThetaRepositoryOptionNameEnum.exposureprogram,
|
|
1202
|
+
@"FileFormat": THETACThetaRepositoryOptionNameEnum.fileformat,
|
|
1203
|
+
@"Filter": THETACThetaRepositoryOptionNameEnum.filter,
|
|
1204
|
+
@"GpsInfo": THETACThetaRepositoryOptionNameEnum.gpsinfo,
|
|
1205
|
+
@"IsGpsOn": THETACThetaRepositoryOptionNameEnum.isgpson,
|
|
1206
|
+
@"Iso": THETACThetaRepositoryOptionNameEnum.iso,
|
|
1207
|
+
@"IsoAutoHighLimit": THETACThetaRepositoryOptionNameEnum.isoautohighlimit,
|
|
1208
|
+
@"Language": THETACThetaRepositoryOptionNameEnum.language,
|
|
1209
|
+
@"MaxRecordableTime": THETACThetaRepositoryOptionNameEnum.maxrecordabletime,
|
|
1210
|
+
@"OffDelay": THETACThetaRepositoryOptionNameEnum.offdelay,
|
|
1211
|
+
@"SleepDelay": THETACThetaRepositoryOptionNameEnum.sleepdelay,
|
|
1212
|
+
@"RemainingPictures": THETACThetaRepositoryOptionNameEnum.remainingpictures,
|
|
1213
|
+
@"RemainingVideoSeconds": THETACThetaRepositoryOptionNameEnum.remainingvideoseconds,
|
|
1214
|
+
@"RemainingSpace": THETACThetaRepositoryOptionNameEnum.remainingspace,
|
|
1215
|
+
@"TotalSpace": THETACThetaRepositoryOptionNameEnum.totalspace,
|
|
1216
|
+
@"ShutterVolume": THETACThetaRepositoryOptionNameEnum.shuttervolume,
|
|
1217
|
+
@"WhiteBalance": THETACThetaRepositoryOptionNameEnum.whitebalance
|
|
1218
|
+
};
|
|
1219
|
+
|
|
1220
|
+
/**
|
|
1221
|
+
* OptionNameEnum to OptionName
|
|
1222
|
+
*/
|
|
1223
|
+
static NSDictionary *OptionEnumToOption = @{
|
|
1224
|
+
@"Aperture": @"aperture",
|
|
1225
|
+
@"CaptureMode": @"captureMode",
|
|
1226
|
+
@"ColorTemperature": @"colorTemperature",
|
|
1227
|
+
@"DateTimeZone": @"dateTimeZone",
|
|
1228
|
+
@"ExposureCompensation": @"exposureCompensation",
|
|
1229
|
+
@"ExposureDelay": @"exposureDelay",
|
|
1230
|
+
@"ExposureProgram": @"exposureProgram",
|
|
1231
|
+
@"FileFormat": @"fileFormat",
|
|
1232
|
+
@"Filter": @"filter",
|
|
1233
|
+
@"GpsInfo": @"gpsInfo",
|
|
1234
|
+
@"IsGpsOn": @"isGpsOn",
|
|
1235
|
+
@"Iso": @"iso",
|
|
1236
|
+
@"IsoAutoHighLimit": @"isoAutoHighLimit",
|
|
1237
|
+
@"Language": @"language",
|
|
1238
|
+
@"MaxRecordableTime": @"maxRecordableTime",
|
|
1239
|
+
@"OffDelay": @"offDelay",
|
|
1240
|
+
@"SleepDelay": @"sleepDelay",
|
|
1241
|
+
@"RemainingPictures": @"remainingPictures",
|
|
1242
|
+
@"RemainingVideoSeconds": @"remainingVideoSeconds",
|
|
1243
|
+
@"RemainingSpace": @"remainingSpace",
|
|
1244
|
+
@"TotalSpace": @"totalSpace",
|
|
1245
|
+
@"ShutterVolume": @"shutterVolume",
|
|
1246
|
+
@"WhiteBalance": @"whiteBalance"
|
|
1247
|
+
};
|
|
1248
|
+
|
|
1249
|
+
/** Option converter builder */
|
|
1250
|
+
typedef convert_t * (^OptionConverter)();
|
|
1251
|
+
|
|
1252
|
+
/**
|
|
1253
|
+
* option converter tables
|
|
1254
|
+
*/
|
|
1255
|
+
static NSDictionary<NSString*, OptionConverter> *NameToConverter = @{
|
|
1256
|
+
@"aperture": ^{return &ApertureEnum;},
|
|
1257
|
+
@"captureMode": ^{return &CaptureModeEnum;},
|
|
1258
|
+
@"colorTemperature": ^{return &ColorTemperatureCvt;},
|
|
1259
|
+
@"dateTimeZone": ^{return &DateTimeZoneCvt;},
|
|
1260
|
+
@"exposureCompensation": ^{return &ExposureCompensationEnum;},
|
|
1261
|
+
@"exposureDelay": ^{return &ExposureDelayEnum;},
|
|
1262
|
+
@"exposureProgram": ^{return &ExposureProgramEnum;},
|
|
1263
|
+
@"fileFormat": ^{return &FileFormatEnum;},
|
|
1264
|
+
@"filter": ^{return &FilterEnum;},
|
|
1265
|
+
@"gpsInfo": ^{return &GpsInfoCvt;},
|
|
1266
|
+
@"isGpsOn": ^{return &IsGpsOnCvt;},
|
|
1267
|
+
@"iso": ^{return &IsoEnum;},
|
|
1268
|
+
@"isoAutoHighLimit": ^{return &IsoAutoHighLimitEnum;},
|
|
1269
|
+
@"language": ^{return &LanguageEnum;},
|
|
1270
|
+
@"maxRecordableTime": ^{return &MaxRecordableTimeEnum;},
|
|
1271
|
+
@"offDelay": ^{return &OffDelayEnum;},
|
|
1272
|
+
@"sleepDelay": ^{return &SleepDelayEnum;},
|
|
1273
|
+
@"remainingPictures": ^{return &RemainingPicturesCvt;},
|
|
1274
|
+
@"remainingVideoSeconds": ^{return &RemainingVideoSecondsCvt;},
|
|
1275
|
+
@"remainingSpace": ^{return &RemainingSpaceCvt;},
|
|
1276
|
+
@"totalSpace": ^{return &TotalSpaceCvt;},
|
|
1277
|
+
@"shutterVolume": ^{return &ShutterVolumeCvt;},
|
|
1278
|
+
@"whiteBalance": ^{return &WhiteBalanceEnum;},
|
|
1279
|
+
@"_gpsTagRecording": ^{return &GpsTagRecordingEnum;}
|
|
1280
|
+
};
|
|
1281
|
+
|
|
1282
|
+
static NSString *EVENT_NAME = @"ThetaFrameEvent";
|
|
1283
|
+
|
|
1284
|
+
/**
|
|
1285
|
+
* ThetaClientReactNative implementation
|
|
1286
|
+
*/
|
|
1287
|
+
@implementation ThetaClientReactNative {
|
|
1288
|
+
BOOL hasListeners;
|
|
1289
|
+
}
|
|
1290
|
+
RCT_EXPORT_MODULE(ThetaClientReactNative)
|
|
1291
|
+
|
|
1292
|
+
/**
|
|
1293
|
+
* Will be called when this module's first listener is added.
|
|
1294
|
+
*/
|
|
1295
|
+
-(void)startObserving {
|
|
1296
|
+
hasListeners = YES;
|
|
1297
|
+
// Set up any upstream listeners or background tasks as necessary
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
/**
|
|
1301
|
+
* Will be called when this module's last listener is removed, or on dealloc.
|
|
1302
|
+
*/
|
|
1303
|
+
-(void)stopObserving {
|
|
1304
|
+
hasListeners = NO;
|
|
1305
|
+
// Remove upstream listeners, stop unnecessary background tasks
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
/**
|
|
1309
|
+
* export constants
|
|
1310
|
+
*/
|
|
1311
|
+
- (NSDictionary *)constantsToExport
|
|
1312
|
+
{
|
|
1313
|
+
return @{ @"DEFAULT_EVENT_NAME": EVENT_NAME};
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
/**
|
|
1317
|
+
* supported event name list
|
|
1318
|
+
*/
|
|
1319
|
+
-(NSArray *)supportedEvents
|
|
1320
|
+
{
|
|
1321
|
+
return @[EVENT_NAME];
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
/**
|
|
1325
|
+
* dispatch queue to send events
|
|
1326
|
+
*/
|
|
1327
|
+
- (dispatch_queue_t)methodQueue
|
|
1328
|
+
{
|
|
1329
|
+
return dispatch_queue_create("com.ricoh360.event.queue", DISPATCH_QUEUE_SERIAL);
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
/**
|
|
1333
|
+
* require main queue setup
|
|
1334
|
+
*/
|
|
1335
|
+
+ (BOOL)requiresMainQueueSetup
|
|
1336
|
+
{
|
|
1337
|
+
return YES;
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
/**
|
|
1341
|
+
* initialize ThetaRepository
|
|
1342
|
+
* @param endPoint endpoint to connect theta
|
|
1343
|
+
* @param resolve resolver for initilization
|
|
1344
|
+
* @param rejecter rejecter for initialization
|
|
1345
|
+
*/
|
|
1346
|
+
RCT_REMAP_METHOD(initialize,
|
|
1347
|
+
initializeWithEndpoint:(NSString *)endPoint
|
|
1348
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
|
1349
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1350
|
+
{
|
|
1351
|
+
if (!endPoint) {
|
|
1352
|
+
endPoint = @"http://192.168.1.1";
|
|
1353
|
+
}
|
|
1354
|
+
NSError *error = nil;
|
|
1355
|
+
THETACThetaRepositoryCompanion *companion = THETACThetaRepository.companion;
|
|
1356
|
+
[companion doNewInstanceEndpoint:endPoint
|
|
1357
|
+
config:nil
|
|
1358
|
+
timeout:nil
|
|
1359
|
+
completionHandler:^(THETACThetaRepository *repo, NSError *error) {
|
|
1360
|
+
if (error) {
|
|
1361
|
+
reject(@"error", [error localizedDescription], error);
|
|
1362
|
+
} else if (repo) {
|
|
1363
|
+
self.theta = repo;
|
|
1364
|
+
resolve(@(YES));
|
|
1365
|
+
} else {
|
|
1366
|
+
reject(@"error", @"can not create repository", nil);
|
|
1367
|
+
}
|
|
1368
|
+
}];
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
/**
|
|
1372
|
+
* getThetaInfo - retrieve ThetaInfo from THETA via repository
|
|
1373
|
+
* @param resolve resolver for getThetaInfo
|
|
1374
|
+
* @param rejecter rejecter for getThetaInfo
|
|
1375
|
+
*/
|
|
1376
|
+
RCT_REMAP_METHOD(getThetaInfo,
|
|
1377
|
+
getThetaInfoWithResolver:(RCTPromiseResolveBlock)resolve
|
|
1378
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1379
|
+
{
|
|
1380
|
+
[_theta getThetaInfoWithCompletionHandler:^(THETACThetaRepositoryThetaInfo *info,
|
|
1381
|
+
NSError *error) {
|
|
1382
|
+
if (error) {
|
|
1383
|
+
reject(@"error", [error localizedDescription], error);
|
|
1384
|
+
} else if (info) {
|
|
1385
|
+
resolve(@{@"model": info.model,
|
|
1386
|
+
@"serialNumber":info.serialNumber,
|
|
1387
|
+
@"firmwareVersion":info.firmwareVersion,
|
|
1388
|
+
@"hasGps":@(info.hasGps),
|
|
1389
|
+
@"hasGyro":@(info.hasGyro),
|
|
1390
|
+
@"uptime":@(info.uptime)});
|
|
1391
|
+
} else {
|
|
1392
|
+
reject(@"error", @"no info", nil);
|
|
1393
|
+
}
|
|
1394
|
+
}];
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1397
|
+
/**
|
|
1398
|
+
* getThetaState - retrieve ThetaState from THETA via repository
|
|
1399
|
+
* @param resolve resolver for getThetaState
|
|
1400
|
+
* @param rejecter rejecter for getThetaState
|
|
1401
|
+
*/
|
|
1402
|
+
RCT_REMAP_METHOD(getThetaState,
|
|
1403
|
+
getThetaStateWithResolver:(RCTPromiseResolveBlock)resolve
|
|
1404
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1405
|
+
{
|
|
1406
|
+
[_theta getThetaStateWithCompletionHandler:^(THETACThetaRepositoryThetaState *state,
|
|
1407
|
+
NSError *error) {
|
|
1408
|
+
if (error) {
|
|
1409
|
+
reject(@"error", [error localizedDescription], error);
|
|
1410
|
+
} else if (state) {
|
|
1411
|
+
resolve(@{@"fingerprint": state.fingerprint,
|
|
1412
|
+
@"batteryLevel":@(state.batteryLevel),
|
|
1413
|
+
@"chargingState":[ChargingStateEnum.fromTheta
|
|
1414
|
+
objectForKey:state.chargingState],
|
|
1415
|
+
@"isSdCard":@(state.isSdCard),
|
|
1416
|
+
@"recordedTime":@(state.recordedTime),
|
|
1417
|
+
@"recordableTime":@(state.recordableTime),
|
|
1418
|
+
@"latestFileUrl":state.latestFileUrl});
|
|
1419
|
+
} else {
|
|
1420
|
+
reject(@"error", @"no state", nil);
|
|
1421
|
+
}
|
|
1422
|
+
}];
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
/**
|
|
1426
|
+
* listFiles - retrieve File list from THETA via repository
|
|
1427
|
+
* @param fileType file type to retrieve
|
|
1428
|
+
* @param startPosition start position to retrieve
|
|
1429
|
+
* @param entryCount count to retrieve
|
|
1430
|
+
* @param resolve resolver for listFiles
|
|
1431
|
+
* @param rejecter rejecter for listFiles
|
|
1432
|
+
*/
|
|
1433
|
+
RCT_REMAP_METHOD(listFiles,
|
|
1434
|
+
listFilesWithFileTypeEnum:(NSString*)fileType
|
|
1435
|
+
withStartPosition:(int32_t)startPosition
|
|
1436
|
+
withEntryCount:(int32_t)entryCount
|
|
1437
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
|
1438
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1439
|
+
{
|
|
1440
|
+
[_theta listFilesFileType:[FileTypeEnum.toTheta objectForKey:fileType]
|
|
1441
|
+
startPosition:startPosition
|
|
1442
|
+
entryCount:entryCount
|
|
1443
|
+
completionHandler:^(NSArray<THETACThetaRepositoryFileInfo *> *items,
|
|
1444
|
+
NSError *error) {
|
|
1445
|
+
if (error) {
|
|
1446
|
+
reject(@"error", [error localizedDescription], error);
|
|
1447
|
+
} else if (items) {
|
|
1448
|
+
NSMutableArray *ary = [[NSMutableArray alloc] init];
|
|
1449
|
+
for (int i = 0; i < items.count; i++) {
|
|
1450
|
+
THETACThetaRepositoryFileInfo *finfo = items[i];
|
|
1451
|
+
[ary addObject: @{
|
|
1452
|
+
@"name":finfo.name,
|
|
1453
|
+
@"size":@(finfo.size),
|
|
1454
|
+
@"dateTime":finfo.dateTime,
|
|
1455
|
+
@"thumbnailUrl":finfo.thumbnailUrl,
|
|
1456
|
+
@"fileUrl":finfo.fileUrl
|
|
1457
|
+
}];
|
|
1458
|
+
}
|
|
1459
|
+
resolve(ary);
|
|
1460
|
+
} else {
|
|
1461
|
+
reject(@"error", @"no items", nil);
|
|
1462
|
+
}
|
|
1463
|
+
}];
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
/**
|
|
1467
|
+
* deleteFiles - delete specified files
|
|
1468
|
+
* @param fileUrls file url list to delete
|
|
1469
|
+
* @param resolve resolver for deleteFiles
|
|
1470
|
+
* @param rejecter rejecter for deleteFiles
|
|
1471
|
+
*/
|
|
1472
|
+
RCT_REMAP_METHOD(deleteFiles,
|
|
1473
|
+
deleteFilesWithFileUrls:(NSArray*)fileUrls
|
|
1474
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
|
1475
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1476
|
+
{
|
|
1477
|
+
[_theta deleteFilesFileUrls:fileUrls completionHandler:^(NSError *error) {
|
|
1478
|
+
if (error) {
|
|
1479
|
+
reject(@"error", [error localizedDescription], error);
|
|
1480
|
+
} else {
|
|
1481
|
+
resolve(@(YES));
|
|
1482
|
+
}
|
|
1483
|
+
}];
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
/**
|
|
1487
|
+
* deleteAllFiles - delete all files
|
|
1488
|
+
* @param resolve resolver for deleteAllFiles
|
|
1489
|
+
* @param rejecter rejecter for deleteAllFiles
|
|
1490
|
+
*/
|
|
1491
|
+
RCT_REMAP_METHOD(deleteAllFiles,
|
|
1492
|
+
deleteAllFilesWithResolver:(RCTPromiseResolveBlock)resolve
|
|
1493
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1494
|
+
{
|
|
1495
|
+
[_theta deleteAllFilesWithCompletionHandler:^(NSError *error) {
|
|
1496
|
+
if (error) {
|
|
1497
|
+
reject(@"error", [error localizedDescription], error);
|
|
1498
|
+
} else {
|
|
1499
|
+
resolve(@(YES));
|
|
1500
|
+
}
|
|
1501
|
+
}];
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
/**
|
|
1505
|
+
* deleteAllImageFiles - delete all image files
|
|
1506
|
+
* @param resolve resolver for deleteAllImageFiles
|
|
1507
|
+
* @param rejecter rejecter for deleteAllImageFiles
|
|
1508
|
+
*/
|
|
1509
|
+
RCT_REMAP_METHOD(deleteAllImageFiles,
|
|
1510
|
+
deleteAllImageFilesWithResolver:(RCTPromiseResolveBlock)resolve
|
|
1511
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1512
|
+
{
|
|
1513
|
+
[_theta deleteAllImageFilesWithCompletionHandler:^(NSError *error) {
|
|
1514
|
+
if (error) {
|
|
1515
|
+
reject(@"error", [error localizedDescription], error);
|
|
1516
|
+
return;
|
|
1517
|
+
}
|
|
1518
|
+
resolve(@(YES));
|
|
1519
|
+
}];
|
|
1520
|
+
}
|
|
1521
|
+
|
|
1522
|
+
/**
|
|
1523
|
+
* deleteAllVideoFiles - delete all video files
|
|
1524
|
+
* @param resolve resolver for deleteAllVideoFiles
|
|
1525
|
+
* @param rejecter rejecter for deleteAllVideoFiles
|
|
1526
|
+
*/
|
|
1527
|
+
RCT_REMAP_METHOD(deleteAllVideoFiles,
|
|
1528
|
+
deleteAllVideoFilesWithResolver:(RCTPromiseResolveBlock)resolve
|
|
1529
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1530
|
+
{
|
|
1531
|
+
[_theta deleteAllVideoFilesWithCompletionHandler:^(NSError *error) {
|
|
1532
|
+
if (error) {
|
|
1533
|
+
reject(@"error", [error localizedDescription], error);
|
|
1534
|
+
} else {
|
|
1535
|
+
resolve(@(YES));
|
|
1536
|
+
}
|
|
1537
|
+
}];
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1540
|
+
/**
|
|
1541
|
+
* getOptions - get options from THETA via repository
|
|
1542
|
+
* @param optionNames option name list to get
|
|
1543
|
+
* @param resolve resolver for getOptions
|
|
1544
|
+
* @param rejecter rejecter for getOptions
|
|
1545
|
+
*/
|
|
1546
|
+
RCT_REMAP_METHOD(getOptions,
|
|
1547
|
+
getOptionsWithOptionNames:(NSArray*)optionNames
|
|
1548
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
|
1549
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1550
|
+
{
|
|
1551
|
+
NSMutableArray *optionNameList = [[NSMutableArray alloc] init];
|
|
1552
|
+
for (id name in optionNames) {
|
|
1553
|
+
[optionNameList addObject:[NameToOptionEnum objectForKey:name]];
|
|
1554
|
+
}
|
|
1555
|
+
[_theta getOptionsOptionNames:optionNameList
|
|
1556
|
+
completionHandler:^(THETACThetaRepositoryOptions *options, NSError *error) {
|
|
1557
|
+
if (error) {
|
|
1558
|
+
reject(@"error", [error localizedDescription], error);
|
|
1559
|
+
} else if (options) {
|
|
1560
|
+
NSMutableDictionary *results = [[NSMutableDictionary alloc] init];
|
|
1561
|
+
for (id name in optionNames) {
|
|
1562
|
+
id option = [OptionEnumToOption objectForKey:name];
|
|
1563
|
+
convert_t *convert = [NameToConverter objectForKey:option]();
|
|
1564
|
+
if (convert && convert->setFromTheta) {
|
|
1565
|
+
convert->setFromTheta(results, options);
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
resolve(results);
|
|
1569
|
+
} else {
|
|
1570
|
+
reject(@"error", @"no options", nil);
|
|
1571
|
+
}
|
|
1572
|
+
}];
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
/**
|
|
1576
|
+
* setOptions - set options to THETA via repository
|
|
1577
|
+
* @param options options to set
|
|
1578
|
+
* @param resolve resolver for setOptions
|
|
1579
|
+
* @param rejecter rejecter for setOptions
|
|
1580
|
+
*/
|
|
1581
|
+
RCT_REMAP_METHOD(setOptions,
|
|
1582
|
+
setOptionsWithOptions:(NSDictionary*)options
|
|
1583
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
|
1584
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1585
|
+
{
|
|
1586
|
+
THETACThetaRepositoryOptions *newoptions = [[THETACThetaRepositoryOptions alloc] init];
|
|
1587
|
+
for (id option in [options allKeys]) {
|
|
1588
|
+
convert_t *convert = [NameToConverter objectForKey:option]();
|
|
1589
|
+
if (convert && convert->setToTheta) {
|
|
1590
|
+
convert->setToTheta(options, newoptions);
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
[_theta setOptionsOptions:newoptions completionHandler:^(NSError *error) {
|
|
1594
|
+
if (error) {
|
|
1595
|
+
reject(@"error", [error localizedDescription], error);
|
|
1596
|
+
} else {
|
|
1597
|
+
resolve(@(YES));
|
|
1598
|
+
}
|
|
1599
|
+
}];
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
/**
|
|
1603
|
+
* return created data url from [data]
|
|
1604
|
+
*/
|
|
1605
|
+
-(NSString*)createDataURL:(NSData*) data
|
|
1606
|
+
{
|
|
1607
|
+
static NSMutableString *uri = nil;
|
|
1608
|
+
static NSUInteger prefix_length = 0;
|
|
1609
|
+
if (!uri) {
|
|
1610
|
+
uri = [[NSMutableString alloc] init];
|
|
1611
|
+
[uri appendString:@"data:image/jpeg;base64,"];
|
|
1612
|
+
prefix_length = [uri length];
|
|
1613
|
+
}
|
|
1614
|
+
NSString *b64 = [data base64EncodedStringWithOptions:0];
|
|
1615
|
+
NSRange range = {
|
|
1616
|
+
.location = prefix_length,
|
|
1617
|
+
.length = [uri length] - prefix_length
|
|
1618
|
+
};
|
|
1619
|
+
[uri replaceCharactersInRange:range withString:b64];
|
|
1620
|
+
b64 = nil;
|
|
1621
|
+
return uri;
|
|
1622
|
+
}
|
|
1623
|
+
|
|
1624
|
+
/**
|
|
1625
|
+
* getLivePreview - retrieve live preview frame from THETA via repository
|
|
1626
|
+
* @param resolve resolver for getLivePreview
|
|
1627
|
+
* @param rejecter rejecter for getLivePreview
|
|
1628
|
+
*/
|
|
1629
|
+
RCT_REMAP_METHOD(getLivePreview,
|
|
1630
|
+
getLivePreviewWithResolver:(RCTPromiseResolveBlock)resolve
|
|
1631
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1632
|
+
{
|
|
1633
|
+
FrameHandler *_frameHandler =
|
|
1634
|
+
[[FrameHandler alloc] initWith:self withEvent:^(NSData *data) {
|
|
1635
|
+
if (self->hasListeners) {
|
|
1636
|
+
@autoreleasepool {
|
|
1637
|
+
NSString *dataUrl = [self createDataURL:data];
|
|
1638
|
+
[self sendEventWithName:EVENT_NAME body:@{@"data":dataUrl}];
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
}];
|
|
1642
|
+
self.previewing = YES;
|
|
1643
|
+
[_theta getLivePreviewFrameHandler:_frameHandler completionHandler:^(NSError *error) {
|
|
1644
|
+
if (error) {
|
|
1645
|
+
reject(@"error", [error localizedDescription], error);
|
|
1646
|
+
} else {
|
|
1647
|
+
resolve(@(YES));
|
|
1648
|
+
}
|
|
1649
|
+
}];
|
|
1650
|
+
}
|
|
1651
|
+
|
|
1652
|
+
/**
|
|
1653
|
+
* stopLivePreview - stop live previewing
|
|
1654
|
+
*/
|
|
1655
|
+
RCT_REMAP_METHOD(stopLivePreview,
|
|
1656
|
+
stopLivePreview)
|
|
1657
|
+
{
|
|
1658
|
+
self.previewing = NO;
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
/**
|
|
1662
|
+
* getPhotoCaptureBuilder - get photo capture builder from repository
|
|
1663
|
+
*/
|
|
1664
|
+
RCT_REMAP_METHOD(getPhotoCaptureBuilder,
|
|
1665
|
+
getPhotoCaptureBuilder)
|
|
1666
|
+
{
|
|
1667
|
+
self.photoCaptureBuilder = [_theta getPhotoCaptureBuilder];
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
/**
|
|
1671
|
+
* buildPhotoCapture - build photo capture
|
|
1672
|
+
* @param options option to take picture
|
|
1673
|
+
* @param resolve resolver for buildPhotoCapture
|
|
1674
|
+
* @param rejecter rejecter for buildPhotoCapture
|
|
1675
|
+
*/
|
|
1676
|
+
RCT_REMAP_METHOD(buildPhotoCapture,
|
|
1677
|
+
buildPhotoCaptureWithOptions:(NSDictionary*)options
|
|
1678
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
|
1679
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1680
|
+
{
|
|
1681
|
+
if (!self.photoCaptureBuilder) {
|
|
1682
|
+
reject(@"error", @"no photo capture pbuilder", nil);
|
|
1683
|
+
return;
|
|
1684
|
+
}
|
|
1685
|
+
for (id photoOption in [options allKeys]) {
|
|
1686
|
+
convert_t *convert = [NameToConverter objectForKey:photoOption]();
|
|
1687
|
+
if (convert && convert->setPhotoOption) {
|
|
1688
|
+
convert->setPhotoOption(options, self.photoCaptureBuilder);
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
[self.photoCaptureBuilder
|
|
1692
|
+
buildWithCompletionHandler:^(THETACPhotoCapture *photoCapture, NSError *error) {
|
|
1693
|
+
if (error) {
|
|
1694
|
+
reject(@"error", [error localizedDescription], error);
|
|
1695
|
+
return;
|
|
1696
|
+
}
|
|
1697
|
+
if (photoCapture) {
|
|
1698
|
+
self.photoCapture = photoCapture;
|
|
1699
|
+
self.photoCaptureBuilder = nil;
|
|
1700
|
+
resolve(@(YES));
|
|
1701
|
+
} else {
|
|
1702
|
+
reject(@"error", @"no photoCapture", nil);
|
|
1703
|
+
}
|
|
1704
|
+
}];
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1707
|
+
/**
|
|
1708
|
+
* takePicture - take a picture with THETA via repository
|
|
1709
|
+
* @param resolve resolver for takePicture
|
|
1710
|
+
* @param rejecter rejecter for takePicture
|
|
1711
|
+
*/
|
|
1712
|
+
RCT_REMAP_METHOD(takePicture,
|
|
1713
|
+
takePictureWithResolver:(RCTPromiseResolveBlock)resolve
|
|
1714
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1715
|
+
{
|
|
1716
|
+
if (!self.photoCapture) {
|
|
1717
|
+
reject(@"error", @"no photoCapture", nil);
|
|
1718
|
+
return;
|
|
1719
|
+
}
|
|
1720
|
+
PhotoCallback *callback = [[PhotoCallback alloc] initWith:self
|
|
1721
|
+
withResolver:resolve
|
|
1722
|
+
withRejecter:reject];
|
|
1723
|
+
[self.photoCapture takePictureCallback:callback];
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
/**
|
|
1727
|
+
* getVideoCaptureBuilder - get video capture builder
|
|
1728
|
+
*/
|
|
1729
|
+
RCT_REMAP_METHOD(getVideoCaptureBuilder,
|
|
1730
|
+
getVideoCaptureBuilder)
|
|
1731
|
+
{
|
|
1732
|
+
self.videoCaptureBuilder = [_theta getVideoCaptureBuilder];
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
/**
|
|
1736
|
+
* buildVideoCapture - build video capture
|
|
1737
|
+
* @param options option to capture video
|
|
1738
|
+
* @param resolve resolver for buildVideoCapture
|
|
1739
|
+
* @param rejecter rejecter for buildVideoCapture
|
|
1740
|
+
*/
|
|
1741
|
+
RCT_REMAP_METHOD(buildVideoCapture,
|
|
1742
|
+
buildVideoCaptureWithOptions:(NSDictionary*)options
|
|
1743
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
|
1744
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1745
|
+
{
|
|
1746
|
+
if (!self.videoCaptureBuilder) {
|
|
1747
|
+
reject(@"error", @"no video capture builder", nil);
|
|
1748
|
+
return;
|
|
1749
|
+
}
|
|
1750
|
+
for (id videoOption in [options allKeys]) {
|
|
1751
|
+
convert_t *convert = [NameToConverter objectForKey:videoOption]();
|
|
1752
|
+
if (convert && convert->setVideoOption) {
|
|
1753
|
+
convert->setVideoOption(options, self.videoCaptureBuilder);
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
[self.videoCaptureBuilder
|
|
1757
|
+
buildWithCompletionHandler:^(THETACVideoCapture *videoCapture, NSError *error) {
|
|
1758
|
+
if (error) {
|
|
1759
|
+
reject(@"error", @"videoCapture build failed", error);
|
|
1760
|
+
return;
|
|
1761
|
+
}
|
|
1762
|
+
if (videoCapture) {
|
|
1763
|
+
self.videoCapture = videoCapture;
|
|
1764
|
+
self.videoCaptureBuilder = nil;
|
|
1765
|
+
resolve(@(YES));
|
|
1766
|
+
} else {
|
|
1767
|
+
reject(@"error", @"no videoCapture", nil);
|
|
1768
|
+
}
|
|
1769
|
+
}];
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1772
|
+
/**
|
|
1773
|
+
* startCapture - start capture video
|
|
1774
|
+
* @param resolve resolver for startCapture
|
|
1775
|
+
* @param rejecter rejecter for startCapture
|
|
1776
|
+
*/
|
|
1777
|
+
RCT_REMAP_METHOD(startCapture,
|
|
1778
|
+
startCaptureWithResolver:(RCTPromiseResolveBlock)resolve
|
|
1779
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1780
|
+
{
|
|
1781
|
+
if (!self.videoCapture) {
|
|
1782
|
+
reject(@"error", @"no videoCapture", nil);
|
|
1783
|
+
return;
|
|
1784
|
+
}
|
|
1785
|
+
VideoCallback *callback = [[VideoCallback alloc] initWith:self
|
|
1786
|
+
withResolver:resolve
|
|
1787
|
+
withRejecter:reject];
|
|
1788
|
+
self.videoCapturing = [self.videoCapture startCaptureCallback:callback];
|
|
1789
|
+
}
|
|
1790
|
+
|
|
1791
|
+
/**
|
|
1792
|
+
* stopCapture - stop capturing video
|
|
1793
|
+
*/
|
|
1794
|
+
RCT_REMAP_METHOD(stopCapture,
|
|
1795
|
+
stopCapture)
|
|
1796
|
+
{
|
|
1797
|
+
if (!self.videoCapturing) {
|
|
1798
|
+
// todo warning
|
|
1799
|
+
return;
|
|
1800
|
+
}
|
|
1801
|
+
[self.videoCapturing stopCapture];
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1804
|
+
/**
|
|
1805
|
+
* getMetadata - retrieve meta data from THETA via repository
|
|
1806
|
+
* @param resolve resolver for getMetadata
|
|
1807
|
+
* @param rejecter rejecter for getMetadata
|
|
1808
|
+
*/
|
|
1809
|
+
RCT_REMAP_METHOD(getMetadata,
|
|
1810
|
+
getMetadataWithFileUrl:(NSString*)fileUrl
|
|
1811
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
|
1812
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1813
|
+
{
|
|
1814
|
+
[_theta getMetadataFileUrl:fileUrl
|
|
1815
|
+
completionHandler:^(THETACKotlinPair<THETACThetaRepositoryExif *,
|
|
1816
|
+
THETACThetaRepositoryXmp *> *metaData,
|
|
1817
|
+
NSError *error) {
|
|
1818
|
+
if (error) {
|
|
1819
|
+
reject(@"error", [error localizedDescription], error);
|
|
1820
|
+
} else if (metaData) {
|
|
1821
|
+
NSDictionary* exif = nil;
|
|
1822
|
+
NSDictionary* xmp = nil;
|
|
1823
|
+
if (metaData.first) {
|
|
1824
|
+
exif = @{
|
|
1825
|
+
@"exifVersion": metaData.first.exifVersion,
|
|
1826
|
+
@"dateTime": metaData.first.dateTime,
|
|
1827
|
+
@"imageWidth": metaData.first.imageWidth,
|
|
1828
|
+
@"imageLength": metaData.first.imageLength,
|
|
1829
|
+
@"gpsLatitude": metaData.first.gpsLatitude,
|
|
1830
|
+
@"gpsLongitude": metaData.first.gpsLongitude
|
|
1831
|
+
};
|
|
1832
|
+
}
|
|
1833
|
+
if (metaData.second) {
|
|
1834
|
+
xmp = @{
|
|
1835
|
+
@"poseHeadingDegrees": metaData.second.poseHeadingDegrees,
|
|
1836
|
+
@"fullPanoWidthPixels": @(metaData.second.fullPanoWidthPixels),
|
|
1837
|
+
@"fullPanoHeightPixels": @(metaData.second.fullPanoHeightPixels)
|
|
1838
|
+
};
|
|
1839
|
+
}
|
|
1840
|
+
resolve(@{@"exif": exif, @"xmp": xmp});
|
|
1841
|
+
} else {
|
|
1842
|
+
reject(@"error", @"no metaData", nil);
|
|
1843
|
+
}
|
|
1844
|
+
}];
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
/**
|
|
1848
|
+
* reset - reset THETA via repository
|
|
1849
|
+
* @param resolve resolver for reset
|
|
1850
|
+
* @param rejecter rejecter for reset
|
|
1851
|
+
*/
|
|
1852
|
+
RCT_REMAP_METHOD(reset,
|
|
1853
|
+
resetWithResolver:(RCTPromiseResolveBlock)resolve
|
|
1854
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1855
|
+
{
|
|
1856
|
+
[_theta resetWithCompletionHandler:^(NSError *error) {
|
|
1857
|
+
if (error) {
|
|
1858
|
+
reject(@"error", [error localizedDescription], error);
|
|
1859
|
+
} else {
|
|
1860
|
+
resolve(@(YES));
|
|
1861
|
+
}
|
|
1862
|
+
}];
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1865
|
+
/**
|
|
1866
|
+
* restoreSettings - restore THETA setting before initialization
|
|
1867
|
+
* @param resolve resolver for restoreSettings
|
|
1868
|
+
* @param rejecter rejecter for restoreSettings
|
|
1869
|
+
*/
|
|
1870
|
+
RCT_REMAP_METHOD(restoreSettings,
|
|
1871
|
+
restoreSettingsWithResolver:(RCTPromiseResolveBlock)resolve
|
|
1872
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1873
|
+
{
|
|
1874
|
+
[_theta restoreSettingsWithCompletionHandler:^(NSError *error) {
|
|
1875
|
+
if (error) {
|
|
1876
|
+
reject(@"error", [error localizedDescription], error);
|
|
1877
|
+
} else {
|
|
1878
|
+
resolve(@(YES));
|
|
1879
|
+
}
|
|
1880
|
+
}];
|
|
1881
|
+
}
|
|
1882
|
+
|
|
1883
|
+
/**
|
|
1884
|
+
* stopSelfTimer - stop self timer of THETA
|
|
1885
|
+
* @param resolve resolver for stopSelfTimer
|
|
1886
|
+
* @param rejecter rejecter for stopSelfTimer
|
|
1887
|
+
*/
|
|
1888
|
+
RCT_REMAP_METHOD(stopSelfTimer,
|
|
1889
|
+
stopSelfTimerWithResolver:(RCTPromiseResolveBlock)resolve
|
|
1890
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1891
|
+
{
|
|
1892
|
+
[_theta stopSelfTimerWithCompletionHandler:^(NSError *error) {
|
|
1893
|
+
if (error) {
|
|
1894
|
+
reject(@"error", [error localizedDescription], error);
|
|
1895
|
+
} else {
|
|
1896
|
+
resolve(@(YES));
|
|
1897
|
+
}
|
|
1898
|
+
}];
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
/**
|
|
1902
|
+
* convertVideoFormats - convert video format in THETA
|
|
1903
|
+
* @param fileUrl file url to convert
|
|
1904
|
+
* @param toLowResolution to lower resolution
|
|
1905
|
+
* @param applyTopBottomCorrection apply top bottom correction
|
|
1906
|
+
* @param resolve resolver for convertVideoFormats
|
|
1907
|
+
* @param rejecter rejecter for convertVideoFormats
|
|
1908
|
+
*/
|
|
1909
|
+
RCT_REMAP_METHOD(convertVideoFormats,
|
|
1910
|
+
convertVideoFormatsWithFileUrl:(NSString *)fileUrl
|
|
1911
|
+
withToLowResolution:(BOOL)toLowResolution
|
|
1912
|
+
withApplyTopBottomCorrection:(BOOL)applyTopBottomCorrection
|
|
1913
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
|
1914
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1915
|
+
{
|
|
1916
|
+
[_theta convertVideoFormatsFileUrl:fileUrl
|
|
1917
|
+
toLowResolution:toLowResolution
|
|
1918
|
+
applyTopBottomCorrection:applyTopBottomCorrection
|
|
1919
|
+
completionHandler:^(NSString *convertedUrl, NSError *error) {
|
|
1920
|
+
if (error) {
|
|
1921
|
+
reject(@"error", [error localizedDescription], error);
|
|
1922
|
+
} else if (convertedUrl) {
|
|
1923
|
+
resolve(convertedUrl);
|
|
1924
|
+
} else {
|
|
1925
|
+
reject(@"error", @"no convertVideo", nil);
|
|
1926
|
+
}
|
|
1927
|
+
}];
|
|
1928
|
+
}
|
|
1929
|
+
|
|
1930
|
+
/**
|
|
1931
|
+
* cancelVideoconvert - cancel converting video format in THETA
|
|
1932
|
+
* @param resolve resolver for cancelVideoconvert
|
|
1933
|
+
* @param rejecter rejecter for cancelVideoconvert
|
|
1934
|
+
*/
|
|
1935
|
+
RCT_REMAP_METHOD(cancelVideoConvert,
|
|
1936
|
+
cancelVideoConvertWithResolver:(RCTPromiseResolveBlock)resolve
|
|
1937
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1938
|
+
{
|
|
1939
|
+
[_theta cancelVideoConvertWithCompletionHandler:^(NSError *error) {
|
|
1940
|
+
if (error) {
|
|
1941
|
+
reject(@"error", [error localizedDescription], error);
|
|
1942
|
+
} else {
|
|
1943
|
+
resolve(@(YES));
|
|
1944
|
+
}
|
|
1945
|
+
}];
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1948
|
+
/**
|
|
1949
|
+
* finishWlan - finish wireless lan
|
|
1950
|
+
* @param resolve resolver for finishWlan
|
|
1951
|
+
* @param rejecter rejecter for finishWlan
|
|
1952
|
+
*/
|
|
1953
|
+
RCT_REMAP_METHOD(finishWlan,
|
|
1954
|
+
finishWlanWithResolver:(RCTPromiseResolveBlock)resolve
|
|
1955
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1956
|
+
{
|
|
1957
|
+
[_theta finishWlanWithCompletionHandler:^(NSError *error) {
|
|
1958
|
+
if (error) {
|
|
1959
|
+
reject(@"error", [error localizedDescription], error);
|
|
1960
|
+
} else {
|
|
1961
|
+
resolve(@(YES));
|
|
1962
|
+
}
|
|
1963
|
+
}];
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1966
|
+
/**
|
|
1967
|
+
* listAccessPoints - list access points
|
|
1968
|
+
* @param resolve resolver for listAccessPoints
|
|
1969
|
+
* @param rejecter rejecter for listAccessPoints
|
|
1970
|
+
*/
|
|
1971
|
+
RCT_REMAP_METHOD(listAccessPoints,
|
|
1972
|
+
listAccessPointsWithResolver:(RCTPromiseResolveBlock)resolve
|
|
1973
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1974
|
+
{
|
|
1975
|
+
[_theta listAccessPointsWithCompletionHandler:^(NSArray *accessPointList, NSError *error) {
|
|
1976
|
+
if (error) {
|
|
1977
|
+
reject(@"error", [error localizedDescription], error);
|
|
1978
|
+
} else if (accessPointList) {
|
|
1979
|
+
NSMutableArray *ary = [[NSMutableArray alloc] init];
|
|
1980
|
+
for (int i = 0; i < accessPointList.count; i++) {
|
|
1981
|
+
THETACThetaRepositoryAccessPoint *apinfo = accessPointList[i];
|
|
1982
|
+
[ary addObject: @{
|
|
1983
|
+
@"ssid": apinfo.ssid,
|
|
1984
|
+
@"ssidStealth": @(apinfo.ssidStealth),
|
|
1985
|
+
@"authMode": [AuthModeEnum.fromTheta objectForKey:apinfo.authMode],
|
|
1986
|
+
@"connectionPriority": @(apinfo.connectionPriority),
|
|
1987
|
+
@"usingDhcp": @(apinfo.usingDhcp),
|
|
1988
|
+
@"ipAddress": apinfo.ipAddress,
|
|
1989
|
+
@"subnetMask": apinfo.subnetMask,
|
|
1990
|
+
@"defaultGateway": apinfo.defaultGateway
|
|
1991
|
+
}];
|
|
1992
|
+
}
|
|
1993
|
+
resolve(ary);
|
|
1994
|
+
} else {
|
|
1995
|
+
reject(@"error", @"no access point", nil);
|
|
1996
|
+
}
|
|
1997
|
+
}];
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
/**
|
|
2001
|
+
* setAccessPointDynamically - set access point with dhcp
|
|
2002
|
+
* @param ssid ssid to connect
|
|
2003
|
+
* @param ssidStealth ssid is stealth or not
|
|
2004
|
+
* @param authMode auth mode to connect
|
|
2005
|
+
* @param password password to connect with auth
|
|
2006
|
+
* @param connectionPriority connection priority
|
|
2007
|
+
* @param resolve resolver for setAccessPointDynamically
|
|
2008
|
+
* @param rejecter rejecter for setAccessPointDynamically
|
|
2009
|
+
*/
|
|
2010
|
+
RCT_REMAP_METHOD(setAccessPointDynamically,
|
|
2011
|
+
setAccessPointDynamicallyWithSsid:(NSString *)ssid
|
|
2012
|
+
withSsidStealth:(BOOL)ssidStealth
|
|
2013
|
+
withAuthMode:(NSString *)authMode
|
|
2014
|
+
withPassword:(NSString *)password
|
|
2015
|
+
withConnectionPrioryty:(int32_t)connectionPriority
|
|
2016
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
|
2017
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
2018
|
+
{
|
|
2019
|
+
[_theta setAccessPointDynamicallySsid:ssid
|
|
2020
|
+
ssidStealth:ssidStealth
|
|
2021
|
+
authMode:[AuthModeEnum.toTheta objectForKey:authMode]
|
|
2022
|
+
password:password
|
|
2023
|
+
connectionPriority:connectionPriority
|
|
2024
|
+
completionHandler:^(NSError *error) {
|
|
2025
|
+
if (error) {
|
|
2026
|
+
reject(@"error", [error localizedDescription], error);
|
|
2027
|
+
} else {
|
|
2028
|
+
resolve(@(YES));
|
|
2029
|
+
}
|
|
2030
|
+
}];
|
|
2031
|
+
}
|
|
2032
|
+
|
|
2033
|
+
/**
|
|
2034
|
+
* setAccessPointStatically - set access point with static connection info
|
|
2035
|
+
* @param ssid ssid to connect
|
|
2036
|
+
* @param ssidStealth ssid is stealth or not
|
|
2037
|
+
* @param authMode auth mode to connect
|
|
2038
|
+
* @param password password to connect with auth
|
|
2039
|
+
* @param connectionPriority connection priority
|
|
2040
|
+
* @param ipAddress static ipaddress to connect
|
|
2041
|
+
* @param subnetMask subnet mask for ip address
|
|
2042
|
+
* @param defaultGateway default gateway address
|
|
2043
|
+
* @param resolve resolver for setAccessPointStatically
|
|
2044
|
+
* @param rejecter rejecter for setAccessPointStatically
|
|
2045
|
+
*/
|
|
2046
|
+
RCT_REMAP_METHOD(setAccessPointStatically,
|
|
2047
|
+
setAccessPointStaticallyWithSsid:(NSString *)ssid
|
|
2048
|
+
withSsidStealth:(BOOL)ssidStealth
|
|
2049
|
+
withAuthMode:(NSString *)authMode
|
|
2050
|
+
withPassword:(NSString *)password
|
|
2051
|
+
withConnectionPrioryty:(int32_t)connectionPriority
|
|
2052
|
+
withIpAddress:(NSString *)ipAddress
|
|
2053
|
+
withSubnetMask:(NSString *)subnetMask
|
|
2054
|
+
withDefaultGateway:(NSString *)defaultGateway
|
|
2055
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
|
2056
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
2057
|
+
{
|
|
2058
|
+
[_theta setAccessPointStaticallySsid:ssid
|
|
2059
|
+
ssidStealth:ssidStealth
|
|
2060
|
+
authMode:[AuthModeEnum.toTheta objectForKey:authMode]
|
|
2061
|
+
password:password
|
|
2062
|
+
connectionPriority:connectionPriority
|
|
2063
|
+
ipAddress:ipAddress
|
|
2064
|
+
subnetMask:subnetMask
|
|
2065
|
+
defaultGateway:defaultGateway
|
|
2066
|
+
completionHandler:^(NSError *error) {
|
|
2067
|
+
if (error) {
|
|
2068
|
+
reject(@"error", [error localizedDescription], error);
|
|
2069
|
+
} else {
|
|
2070
|
+
resolve(@(YES));
|
|
2071
|
+
}
|
|
2072
|
+
}];
|
|
2073
|
+
}
|
|
2074
|
+
|
|
2075
|
+
/**
|
|
2076
|
+
* deleteAccessPoint - delete access point related ssid
|
|
2077
|
+
* @param ssid ssid to delete
|
|
2078
|
+
* @param resolve resolver for setAccessPointStaticcaly
|
|
2079
|
+
* @param rejecter rejecter for setAccessPointStaticcaly
|
|
2080
|
+
*/
|
|
2081
|
+
RCT_REMAP_METHOD(deleteAccessPoint,
|
|
2082
|
+
deleteAccessPointWithSsid:(NSString *)ssid
|
|
2083
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
|
2084
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
2085
|
+
{
|
|
2086
|
+
[_theta deleteAccessPointSsid:ssid
|
|
2087
|
+
completionHandler:^(NSError *error) {
|
|
2088
|
+
if (error) {
|
|
2089
|
+
reject(@"error", [error localizedDescription], error);
|
|
2090
|
+
} else {
|
|
2091
|
+
resolve(@(YES));
|
|
2092
|
+
}
|
|
2093
|
+
}];
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2096
|
+
// Don't compile this code when we build for the old architecture.
|
|
2097
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
2098
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
2099
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
2100
|
+
{
|
|
2101
|
+
return std::make_shared<facebook::react::NativeThetaClientReactNativeSpecJSI>(params);
|
|
2102
|
+
}
|
|
2103
|
+
#endif
|
|
2104
|
+
|
|
2105
|
+
@end
|